ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'

const int N = 3e5 + 10;

int n , m;
int k;

void solve()
{
    int l, r;
    cin >> l >> r;
    k = 0;
    int n = r;
    while (n) {
        k++;
        n >>= 1;
    }
    // cout << k << endl;
    int ans = 0, ans1 = 0;
    bool c = 0;
    for (int i = k - 1 ;i > 0; i -- ) {
        if(c){
            ans ^= 1 << i;
        }
        if(!c){
            if(r & 1 << i && l & 1 << i){
                ans ^=  1 << i;
                ans1 ^= 1 << i;
            }
            else if((r & 1 << i )== 0 && (l & 1 << i )== 0)
                continue;
            else {
                ans1 ^= 1 << i;
                c = 1;
            }
        }

    }
    if(ans1 > l && ans < r)
        cout << l << ' ' << ans1 << ' ' << r << endl;
    else
        cout << l << ' ' << ans << ' ' << r << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int t=1;
    cin>>t;
    while(t--)
    {
        solve();
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'

const int N = 3e5 + 10;

int n , m;
int k;

void solve()
{
    int l, r;
    cin >> l >> r;
    k = 0;
    int n = r;
    while (n) {
        k++;
        n >>= 1;
    }
    // cout << k << endl;
    int ans = 0, ans1 = 0;
    bool c = 0;
    for (int i = k - 1 ;i > 0; i -- ) {
        if(c){
            ans ^= 1 << i;
        }
        if(!c){
            if(r & 1 << i && l & 1 << i){
                ans ^=  1 << i;
                ans1 ^= 1 << i;
            }
            else if((r & 1 << i )== 0 && (l & 1 << i )== 0)
                continue;
            else {
                ans1 ^= 1 << i;
                c = 1;
            }
        }

    }
    if(ans1 > l && ans < r)
        cout << l << ' ' << ans1 << ' ' << r << endl;
    else
        cout << l << ' ' << ans << ' ' << r << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int t=1;
    cin>>t;
    while(t--)
    {
        solve();
    }
}

Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'

const int N = 3e5 + 10;

int n , m;
int k;

void solve()
{
    int l, r;
    cin >> l >> r;
    k = 0;
    int n = r;
    while (n) {
        k++;
        n >>= 1;
    }
    // cout << k << endl;
    int ans = 0, ans1 = 0;
    bool c = 0;
    for (int i = k - 1 ;i >= 0; i -- ) {
        if(c){
            ans ^= 1 << i;
        }
        if(!c){
            if(r & 1 << i && l & 1 << i){
                ans ^=  1 << i;
                ans1 ^= 1 << i;
            }
            else if((r & 1 << i )== 0 && (l & 1 << i )== 0)
                continue;
            else {
                ans1 ^= 1 << i;
                c = 1;
            }
        }
      //  cout << ans << ' ' << ans1 << endl;
    }
    if(ans1 > l && ans1 < r)
        cout << l << ' ' << ans1 << ' ' << r << endl;
    else
        cout << l << ' ' << ans << ' ' << r << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int t=1;
    cin>>t;
    while(t--)
    {
        solve();
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'

const int N = 3e5 + 10;

int n , m;
int k;

void solve()
{
    int l, r;
    cin >> l >> r;
    k = 0;
    int n = r;
    while (n) {
        k++;
        n >>= 1;
    }
    // cout << k << endl;
    int ans = 0, ans1 = 0;
    bool c = 0;
    for (int i = k - 1 ;i >= 0; i -- ) {
        if(c){
            ans ^= 1 << i;
        }
        if(!c){
            if(r & 1 << i && l & 1 << i){
                ans ^=  1 << i;
                ans1 ^= 1 << i;
            }
            else if((r & 1 << i )== 0 && (l & 1 << i )== 0)
                continue;
            else {
                ans1 ^= 1 << i;
                c = 1;
            }
        }
      //  cout << ans << ' ' << ans1 << endl;
    }
    if(ans1 > l && ans1 < r)
        cout << l << ' ' << ans1 << ' ' << r << endl;
    else
        cout << l << ' ' << ans << ' ' << r << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int t=1;
    cin>>t;
    while(t--)
    {
        solve();
    }
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'

const int N = 3e5 + 10;

int n , m;
int k;

void solve()
{
    int l, r;
    cin >> l >> r;
    k = 0;
    int n = r;
    while (n) {
        k++;
        n >>= 1;
    }
    // cout << k << endl;
    int ans = 0, ans1 = 0;
    bool c = 0;
    for (int i = k - 1 ;i >= 0; i -- ) {
        if(c){
            ans ^= 1 << i;
        }
        if(!c){
            if(r & 1 << i && l & 1 << i){
                ans ^=  1 << i;
                ans1 ^= 1 << i;
            }
            else if((r & 1 << i )== 0 && (l & 1 << i )== 0)
                continue;
            else {
                ans1 ^= 1 << i;
                c = 1;
            }
        }
      //  cout << ans << ' ' << ans1 << endl;
    }
    if(ans1 == l || ans == l)
        cout << ans << ' ' << ans1 << ' ' << r << endl;
    else
        cout << ans << ' ' << ans1 << ' ' << l << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int t=1;
    cin>>t;
    while(t--)
    {
        solve();
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 5):
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+10;
int a[N],st[N];
vector<pair<int,int>>p,q;
signed main()
{
	int t=1;
	//cin>>t;
	while(t--)
	{
	  int n;
	  cin>>n;
	  for(int i=1;i<=n;i++)cin>>a[i];
	  for(int i=1;i<=n;i++)
	  {
	  	st[a[i]]=1;
	  	for(int j=a[i]+1;j<=n;j++)
		{
			if(!st[j])
		  	p.push_back({j,a[i]});	
		}
	  	for(int j=n;j>=a[i]+1;j--)
		  {
		  	if(!st[j])
		  	p.push_back({a[i],j});
		  }
	  	for(int j=1;j<a[i];j++)
		  {
		  	if(!st[j])
		  	p.push_back({a[i],j});
		  }
	  }
	 cout<<p.size()<<'\n';
	 for(auto [x,y]:p)
	 {
	 	cout<<x<<" "<<y<<'\n';
	 }
	}
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+10;
int a[N],st[N];
vector<pair<int,int>>p,q;
signed main()
{
	int t=1;
	//cin>>t;
	while(t--)
	{
	  int n;
	  cin>>n;
	  for(int i=1;i<=n;i++)cin>>a[i];
	  for(int i=1;i<=n;i++)
	  {
	  	st[a[i]]=1;
	  	for(int j=a[i]+1;j<=n;j++)
		{
			if(!st[j])
		  	p.push_back({j,a[i]});	
		}
	  	for(int j=n;j>=a[i]+1;j--)
		  {
		  	if(!st[j])
		  	p.push_back({a[i],j});
		  }
	  	for(int j=a[i]-1;j>=1;j--)
		  {
		  	if(!st[j])
		  	p.push_back({a[i],j});
		  }
	  }
	 cout<<p.size()<<'\n';
	 for(auto [x,y]:p)
	 {
	 	cout<<x<<" "<<y<<'\n';
	 }
	}
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 4):
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+10;
int a[N],st[N];
vector<pair<int,int>>p,q;
signed main()
{
	int t=1;
	//cin>>t;
	while(t--)
	{
	  int n;
	  cin>>n;
	  for(int i=1;i<=n;i++)cin>>a[i];
	 for(int i=n;i>=1;i--)
	 {
	 	st[a[i]]=1;
	 	for(int j=a[i]+1;j<=n;j++)
	 	{
	 		if(!st[j])
		 	p.push_back({j,a[i]});
		}
	 }
	 for(int i=1;i<n;i++)
	 {
	 	if(a[i]<a[i+1])
	 	{
	 	p.push_back({a[i+1],a[i]});
	 	p.push_back({a[i],a[i+1]});
	 	}
	 }
	 cout<<p.size()<<'\n';
	 for(auto [x,y]:p)
	 {
	 	cout<<x<<" "<<y<<'\n';
	 }
	}
}

Submission (verdict: Wrong answer on test 5):
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+10;
int a[N],st[N];
vector<pair<int,int>>p,q;
signed main()
{
	int t=1;
	//cin>>t;
	while(t--)
	{
	  int n;
	  cin>>n;
	  for(int i=1;i<=n;i++)cin>>a[i];
	  for(int i=1;i<=n;i++)
	  {
	  	st[a[i]]=1;
	  	for(int j=a[i]+1;j<=n;j++)
		{
			if(!st[j])
		  	p.push_back({j,a[i]});	
		}
	  	for(int j=n;j>=a[i]+1;j--)
		  {
		  	if(!st[j])
		  	p.push_back({a[i],j});
		  }
	  	for(int j=1;j<a[i];j++)
		  {
		  	if(!st[j])
		  	p.push_back({a[i],j});
		  }
	  }
	 cout<<p.size()<<'\n';
	 for(auto [x,y]:p)
	 {
	 	cout<<x<<" "<<y<<'\n';
	 }
	}
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 4):
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+10;
int a[N];
vector<pair<int,int>>p,q;
signed main()
{
	int t=1;
	//cin>>t;
	while(t--)
	{
	  int n;
	  cin>>n;
	  for(int i=1;i<=n;i++)cin>>a[i];
	  for(int i=1;i<=n;i++)
	  {
	  	for(int j=i+1;j<=n;j++)
	  	{
		  if(a[i]>a[j])p.push_back({a[i],a[j]});
		  else q.push_back({a[j],a[i]});	
		}
	  }	
	  cout<<p.size()+2*q.size()<<'\n';
	  for(auto xx:p)
	  {
	  	auto [x,y]=xx;
	  	cout<<x<<" "<<y<<'\n';
	  }
	   for(auto xx:q)
	  	  {
	  	  	auto [x,y]=xx;
	  	  	cout<<x<<" "<<y<<'\n';
	  	  		cout<<y<<" "<<x<<'\n';
	  	  }
	}
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 4):
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+10;
int a[N];
vector<pair<int,int>>p,q;
signed main()
{
	int t=1;
	//cin>>t;
	while(t--)
	{
	  int n;
	  cin>>n;
	  for(int i=1;i<=n;i++)cin>>a[i];
	  for(int i=1;i<=n;i++)
	  {
	  	for(int j=i+1;j<=n;j++)
	  	{
		  if(a[i]>a[j])p.push_back({a[i],a[j]});
		  else q.push_back({a[j],a[i]});	
		}
	  }	
	  cout<<p.size()+2*q.size()<<'\n';
	  for(auto xx:p)
	  {
	  	auto [x,y]=xx;
	  	cout<<x<<" "<<y<<'\n';
	  }
	   for(auto xx:q)
	  	  {
	  	  	auto [x,y]=xx;
	  	  	cout<<x<<" "<<y<<'\n';
	  	  		cout<<y<<" "<<x<<'\n';
	  	  }
	}
}

Submission (verdict: Wrong answer on test 4):
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+10;
int a[N];
vector<pair<int,int>>p,q;
signed main()
{
	int t=1;
	//cin>>t;
	while(t--)
	{
	  int n;
	  cin>>n;
	  for(int i=1;i<=n;i++)cin>>a[i];
	  for(int i=1;i<=n;i++)
	  {
	  	for(int j=i+1;j<=n;j++)
	  	{
		  if(a[i]>a[j])p.push_back({a[i],a[j]});
		  else if(abs(i-j)==1)q.push_back({a[j],a[i]});	
		}
	  }	
	  cout<<p.size()+2*q.size()<<'\n';
	  for(auto xx:p)
	  {
	  	auto [x,y]=xx;
	  	cout<<x<<" "<<y<<'\n';
	  }
	   for(auto xx:q)
  	  {
  	  	auto [x,y]=xx;
  	  	cout<<x<<" "<<y<<'\n';
  	  	cout<<y<<" "<<x<<'\n';
  	  }
	}
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 4):
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+10;
int a[N];
vector<pair<int,int>>p,q;
signed main()
{
	int t=1;
	//cin>>t;
	while(t--)
	{
	  int n;
	  cin>>n;
	  for(int i=1;i<=n;i++)cin>>a[i];
	  for(int i=1;i<=n;i++)
	  {
	  	for(int j=i+1;j<=n;j++)
	  	{
		  if(a[i]>a[j])p.push_back({a[i],a[j]});
		  else if(abs(i-j)==1)q.push_back({a[j],a[i]});	
		}
	  }	
	  cout<<p.size()+2*q.size()<<'\n';
	  for(auto xx:p)
	  {
	  	auto [x,y]=xx;
	  	cout<<x<<" "<<y<<'\n';
	  }
	   for(auto xx:q)
  	  {
  	  	auto [x,y]=xx;
  	  	cout<<x<<" "<<y<<'\n';
  	  	cout<<y<<" "<<x<<'\n';
  	  }
	}
}

Submission (verdict: Wrong answer on test 4):
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+10;
int a[N],st[N];
vector<pair<int,int>>p,q;
signed main()
{
	int t=1;
	//cin>>t;
	while(t--)
	{
	  int n;
	  cin>>n;
	  for(int i=1;i<=n;i++)cin>>a[i];
	 for(int i=n;i>=1;i--)
	 {
	 	st[a[i]]=1;
	 	for(int j=a[i]+1;j<=n;j++)
	 	{
	 		if(!st[j])
		 	p.push_back({j,a[i]});
		}
	 }
	 for(int i=1;i<n;i++)
	 {
	 	if(a[i]<a[i+1])
	 	{
	 	p.push_back({a[i+1],a[i]});
	 	p.push_back({a[i],a[i+1]});
	 	}
	 }
	 cout<<p.size()<<'\n';
	 for(auto [x,y]:p)
	 {
	 	cout<<x<<" "<<y<<'\n';
	 }
	}
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>

#define int long long

#define endl '\n'

using namespace std;



typedef long long ll;

typedef pair<int, int> PII;



void solve()

{

    string s;

    cin >> s;

    int cur = 0;

    for (int i = 0; i < s.size(); i++)

    {

        cur = cur * 10 + (s[i] - '0');

        cur %= 9;

    }



    int cnt2 = 0, cnt6 = 0;

    for (int i = 0; i < s.size(); i++)

    {

        if(s[i] == '2')

            cnt2++;

        if(s[i] == '3')

            cnt6++;

    }

    

    cnt2 %= 9;

    cnt6 %= 9;



    for(int i = 0; i <= cnt2; i++)

        for(int j = 0; j <= cnt6; j++){

            if((cur + i * 2 + j * 6) % 9 == 0){

                cout << "YES" << endl;

                return;

            }

        }



    cout << "NO" << endl;

}



signed main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    // freopen("test.in", "r", stdin);



    int t = 1;

    cin >> t;

    while (t--)

        solve();



    return 0;

}

Submission (verdict: Accepted):
#include <bits/stdc++.h>

#define int long long

#define endl '\n'

using namespace std;



typedef long long ll;

typedef pair<int, int> PII;



void solve()

{

    string s;

    cin >> s;

    int cur = 0;

    for (int i = 0; i < s.size(); i++)

    {

        cur = cur * 10 + (s[i] - '0');

        cur %= 9;

    }



    int cnt2 = 0, cnt6 = 0;

    for (int i = 0; i < s.size(); i++)

    {

        if(s[i] == '2')

            cnt2++;

        if(s[i] == '3')

            cnt6++;

    }



    for(int i = 0; i <= cnt2; i++)

        for(int j = 0; j <= cnt6; j++){

            if((cur + i * 2 + j * 6) % 9 == 0){

                cout << "YES" << endl;

                return;

            }

        }



    cout << "NO" << endl;

}



signed main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    // freopen("test.in", "r", stdin);



    int t = 1;

    cin >> t;

    while (t--)

        solve();



    return 0;

}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>

#define int long long

#define endl '\n'

using namespace std;



typedef long long ll;

typedef pair<int, int> PII;



void solve()

{

    string s;

    cin >> s;

    int cur = 0;

    for (int i = 0; i < s.size(); i++)

    {

        cur = cur * 10 + (s[i] - '0');

        cur %= 9;

    }



    int cnt2 = 0, cnt3 = 0;

    for (int i = 0; i < s.size(); i++)

    {

        if(s[i] == '2')

            cnt2++;

        if(s[i] == '3')

            cnt3++;

    }

    

    cnt2 %= 9;

    cnt3 %= 3;



    for(int i = 0; i <= cnt2; i++)

        for(int j = 0; j <= cnt3; j++){

            if((cur + i * 2 + j * 6) % 9 == 0){

                cout << "YES" << endl;

                return;

            }

        }



    cout << "NO" << endl;

}



signed main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    // freopen("test.in", "r", stdin);



    int t = 1;

    cin >> t;

    while (t--)

        solve();



    return 0;

}

Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>

#define int long long

#define endl '\n'

using namespace std;



typedef long long ll;

typedef pair<int, int> PII;



void solve()

{

    string s;

    cin >> s;

    int cur = 0;

    for (int i = 0; i < s.size(); i++)

    {

        cur = cur * 10 + (s[i] - '0');

        cur %= 9;

    }



    int cnt2 = 0, cnt6 = 0;

    for (int i = 0; i < s.size(); i++)

    {

        if(s[i] == '2')

            cnt2++;

        if(s[i] == '3')

            cnt6++;

    }

    

    cnt2 %= 9;

    cnt6 %= 9;



    for(int i = 0; i <= cnt2; i++)

        for(int j = 0; j <= cnt6; j++){

            if((cur + i * 2 + j * 6) % 9 == 0){

                cout << "YES" << endl;

                return;

            }

        }



    cout << "NO" << endl;

}



signed main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    // freopen("test.in", "r", stdin);



    int t = 1;

    cin >> t;

    while (t--)

        solve();



    return 0;

}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>

#define int long long

#define endl '\n'

using namespace std;



typedef long long ll;

typedef pair<int, int> PII;



void solve()

{

    string s;

    cin >> s;

    int cur = 0;

    for (int i = 0; i < s.size(); i++)

    {

        cur = cur * 10 + (s[i] - '0');

        cur %= 9;

    }



    int cnt2 = 0, cnt3 = 0;

    for (int i = 0; i < s.size(); i++)

    {

        if(s[i] == '2')

            cnt2++;

        if(s[i] == '3')

            cnt3++;

    }

    

    cnt2 %= 9;

    cnt3 %= 3;



    for(int i = 0; i <= cnt2; i++)

        for(int j = 0; j <= cnt3; j++){

            if((cur + i * 2 + j * 6) % 9 == 0){

                cout << "YES" << endl;

                return;

            }

        }



    cout << "NO" << endl;

}



signed main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    // freopen("test.in", "r", stdin);



    int t = 1;

    cin >> t;

    while (t--)

        solve();



    return 0;

}