ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2060D - Subtract Min Sort
Language: GNU C11

Previous submission (verdict: Wrong answer on test 2):
//given a sequence of n positive integers(+ve)

//Select an index i (1??<n), and subtract min(ai,ai+1) from both ai  and ai+1

#include<stdio.h>

#include<string.h>



int min(int a, int b){

    if (a<b){

        return a;

    }

    else {

        return b;

    }

}



int main(){

    int t;

    scanf("%d",&t);

    while(t!=0){

        int n;

        scanf("%d",&n);

        int arr[n];

        for(int i=0;i<n;i++){

            scanf("%d",&arr[i]);

        }

        if (arr[0]>arr[1]){

            printf("NO\n");

            t-=1;

            continue;

        }

        int flag=1;

        int max=0;



        for(int i=1;i<n-1;i++){

            if(arr[i]>arr[i+1]){

                int r=min(arr[i],arr[i-1]);

                arr[i]-=r;

                arr[i-1]-=r;

                if(arr[i]>arr[i+1]  || arr[i-1]<max){

                    printf("NO\n");

                    flag=0;

                    break;

                }

            }

        }



        if(flag){

            printf("YES\n");

        }

        t-=1;

    }



    return 0;

}

Submission (verdict: Wrong answer on test 2):
//given a sequence of n positive integers(+ve)

//Select an index i (1??<n), and subtract min(ai,ai+1) from both ai  and ai+1

#include<stdio.h>

#include<string.h>



int min(int a, int b){

    if (a<b){

        return a;

    }

    else {

        return b;

    }

}



int main(){

    int t;

    scanf("%d",&t);

    while(t!=0){

        int n;

        scanf("%d",&n);

        int arr[n];

        for(int i=0;i<n;i++){

            scanf("%d",&arr[i]);

        }

        if (arr[0]>arr[1]){

            printf("NO\n");

            t-=1;

            continue;

        }

        int flag=1;

        int max=0;



        for(int i=1;i<n-1;i++){

            if(arr[i]>arr[i+1]){

                int r=min(arr[i],arr[i-1]);

                arr[i]-=r;

                arr[i-1]-=r;

                if(arr[i]>arr[i+1]  || arr[i-1]<max){

                    printf("NO\n");

                    flag=0;

                    break;

                }

                max=arr[i-1];

            }

        }



        if(flag){

            printf("YES\n");

        }

        t-=1;

    }



    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: GNU C11

Previous submission (verdict: Wrong answer on test 2):
//given a sequence of n positive integers(+ve)

//Select an index i (1??<n), and subtract min(ai,ai+1) from both ai  and ai+1

#include<stdio.h>

#include<string.h>



int min(int a, int b){

    if (a<b){

        return a;

    }

    else {

        return b;

    }

}



int main(){

    int t;

    scanf("%d",&t);

    while(t!=0){

        int n;

        scanf("%d",&n);

        int arr[n];

        for(int i=0;i<n;i++){

            scanf("%d",&arr[i]);

        }

        if (arr[0]>arr[1]){

            printf("NO\n");

            t-=1;

            continue;

        }

        int flag=1;



        for(int i=1;i<n-1;i++){

            if(arr[i]>arr[i+1]){

                int r=min(arr[i],arr[i-1]);

                arr[i]-=r;

                arr[i-1]-=r;

                if(arr[i]>arr[i+1]){

                    printf("NO\n");

                    flag=0;

                    break;

                }

            }

        }



        if(flag){

            printf("YES\n");

        }

        t-=1;

    }



    return 0;

}

Submission (verdict: Wrong answer on test 2):
//given a sequence of n positive integers(+ve)

//Select an index i (1??<n), and subtract min(ai,ai+1) from both ai  and ai+1

#include<stdio.h>

#include<string.h>



int min(int a, int b){

    if (a<b){

        return a;

    }

    else {

        return b;

    }

}



int main(){

    int t;

    scanf("%d",&t);

    while(t!=0){

        int n;

        scanf("%d",&n);

        int arr[n];

        for(int i=0;i<n;i++){

            scanf("%d",&arr[i]);

        }

        if (arr[0]>arr[1]){

            printf("NO\n");

            t-=1;

            continue;

        }

        int flag=1;

        int max=0;



        for(int i=1;i<n-1;i++){

            if(arr[i]>arr[i+1]){

                int r=min(arr[i],arr[i-1]);

                arr[i]-=r;

                arr[i-1]-=r;

                if(arr[i]>arr[i+1]  || arr[i-1]<max){

                    printf("NO\n");

                    flag=0;

                    break;

                }

            }

        }



        if(flag){

            printf("YES\n");

        }

        t-=1;

    }



    return 0;

}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)


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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
// change these numbers
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t;
    cin>>t;
    
    while(t--){
        string s;
        cin>>s;

        int n=s.size();
        int two=0;
        int three=0;
        int val=0;

        for(int i =0;i<n;i++){
            val+=(s[i]-'0')%9;
            if(s[i]=='2'){
                two++;
            }
            else if(s[i]=='3'){
                three++;
            }
        }
        int req=9-val;
        int flag=0;

        for(int i=0;i<=two;i++){
            for(int j=0;j<=three;j++){
                int sum = (i*2 + j*6)%9;
                if(sum==req){
                    flag=1;
                    break;
                }
            }
        }

        if(flag==1){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }

    }
    
    
    return 0;
}

// read the question correctly (ll vs int)
// template by bqi343 and iNum
// used by techguy2
// functions go before int main() silly
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 4):
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
	vector<int> nums(n);
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}

	vector<vector<int>> ans;

	vector<vector<int>> same;

	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			if (nums[j] < nums[i]) {
				ans.push_back({nums[i], nums[j]});
			}
			else {
				same.push_back({nums[j], nums[i]});
				same.push_back({nums[i], nums[j]});
			}
		}
	}

	cout << ans.size() + same.size() << '\n';
	for (auto& arr : same) {
		cout << arr[0] << " " << arr[1] << '\n';
	}
	for (auto& arr: ans) {
		cout << arr[0] << " " << arr[1] << '\n';
	}
}


Submission (verdict: Wrong answer on test 1):
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
	vector<int> nums(n);
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}

	vector<vector<int>> ans;


	for (int i = n - 1; i >= 0; i--) {
		vector<vector<int>> same;
		vector<vector<int>> diffs;
		for (int j = i - 1; j >= 0; j--) {
			if (nums[i] > nums[j]) {
				same.push_back({nums[i], nums[j]});
			}
			else {
				diffs.push_back({nums[j], nums[i]});
			}
		}
		for (int j = same.size() - 1; j >= 0; j--) {
			same.push_back({same[j][1], same[j][0]});
		}
		for (int j = 0; j < same.size(); j++) {
			ans.push_back(same[j]);
		}
		for (int j = 0; j < diffs.size(); j++) {
			ans.push_back(diffs[j]);
		}
		
	}

	cout << ans.size() << '\n';
	for (auto& arr : ans) {
		cout << arr[0] << " " << arr[1] << '\n';
	}
}


/*

1 2 3

2 1 3
2 3 1
2 1 3
1 2 3
1 3 2
1 2 3





*/
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 4):
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
	vector<int> nums(n);
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}

	vector<vector<int>> ans;

	vector<vector<int>> same;

	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			if (nums[j] < nums[i]) {
				ans.push_back({nums[i], nums[j]});
			}
			else {
				same.push_back({nums[j], nums[i]});
				same.push_back({nums[i], nums[j]});
			}
		}
	}

	cout << ans.size() + same.size() << '\n';
	for (auto& arr : same) {
		cout << arr[0] << " " << arr[1] << '\n';
	}
	for (auto& arr: ans) {
		cout << arr[0] << " " << arr[1] << '\n';
	}
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 7):
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
	vector<int> nums(n);
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}

	vector<vector<int>> ans;


	for (int i = n - 1; i >= 0; i--) {
		vector<vector<int>> same;
		vector<vector<int>> diffs;
		for (int j = i - 1; j >= 0; j--) {
			if (nums[i] > nums[j]) {
				same.push_back({nums[i], nums[j]});
			}
			else {
				diffs.push_back({nums[j], nums[i]});
			}
		}
		for (int j = same.size() - 1; j >= 0; j--) {
			same.push_back({same[j][1], same[j][0]});
		}
		for (int j = 0; j < same.size(); j++) {
			ans.push_back(same[j]);
		}
		sort(diffs.begin(), diffs.end());
		for (int j = 0; j < diffs.size(); j++) {
			ans.push_back(diffs[j]);
		}
		
	}

	cout << ans.size() << '\n';
	for (auto& arr : ans) {
		cout << arr[0] << " " << arr[1] << '\n';
	}
}


/*

1 2 3

2 1 3
2 3 1
2 1 3
1 2 3
1 3 2
1 2 3





*/

Submission (verdict: Accepted):
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
	vector<int> nums(n);
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}

	vector<vector<int>> ans;


	for (int i = n - 1; i >= 0; i--) {
		vector<vector<int>> same;
		vector<vector<int>> diffs;
		for (int j = i - 1; j >= 0; j--) {
			if (nums[i] > nums[j]) {
				same.push_back({nums[i], nums[j]});
			}
			else {
				diffs.push_back({nums[j], nums[i]});
			}
		}
		sort(same.begin(), same.end());
		reverse(same.begin(), same.end());
		for (int j = same.size() - 1; j >= 0; j--) {
			same.push_back({same[j][1], same[j][0]});
		}
		for (int j = 0; j < same.size(); j++) {
			ans.push_back(same[j]);
		}
		sort(diffs.begin(), diffs.end());
		for (int j = 0; j < diffs.size(); j++) {
			ans.push_back(diffs[j]);
		}
		
	}

	cout << ans.size() << '\n';
	for (auto& arr : ans) {
		cout << arr[0] << " " << arr[1] << '\n';
	}
}


/*

1 2 3

2 1 3
2 3 1
2 1 3
1 2 3
1 3 2
1 2 3





*/
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
	vector<int> nums(n);
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}

	vector<vector<int>> ans;


	for (int i = n - 1; i >= 0; i--) {
		vector<vector<int>> same;
		vector<vector<int>> diffs;
		for (int j = i - 1; j >= 0; j--) {
			if (nums[i] > nums[j]) {
				same.push_back({nums[i], nums[j]});
			}
			else {
				diffs.push_back({nums[j], nums[i]});
			}
		}
		for (int j = same.size() - 1; j >= 0; j--) {
			same.push_back({same[j][1], same[j][0]});
		}
		for (int j = 0; j < same.size(); j++) {
			ans.push_back(same[j]);
		}
		for (int j = 0; j < diffs.size(); j++) {
			ans.push_back(diffs[j]);
		}
		
	}

	cout << ans.size() << '\n';
	for (auto& arr : ans) {
		cout << arr[0] << " " << arr[1] << '\n';
	}
}


/*

1 2 3

2 1 3
2 3 1
2 1 3
1 2 3
1 3 2
1 2 3





*/

Submission (verdict: Wrong answer on test 4):
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
	vector<int> nums(n);
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}

	vector<vector<int>> ans;


	for (int i = n - 1; i >= 0; i--) {
		vector<vector<int>> same;
		vector<vector<int>> diffs;
		for (int j = i - 1; j >= 0; j--) {
			if (nums[i] > nums[j]) {
				same.push_back({nums[i], nums[j]});
			}
			else {
				diffs.push_back({nums[j], nums[i]});
			}
		}
		sort(same.begin(), same.end());
		for (int j = same.size() - 1; j >= 0; j--) {
			same.push_back({same[j][1], same[j][0]});
		}
		for (int j = 0; j < same.size(); j++) {
			ans.push_back(same[j]);
		}
		sort(diffs.begin(), diffs.end());
		for (int j = 0; j < diffs.size(); j++) {
			ans.push_back(diffs[j]);
		}
		
	}

	cout << ans.size() << '\n';
	for (auto& arr : ans) {
		cout << arr[0] << " " << arr[1] << '\n';
	}
}


/*

1 2 3

2 1 3
2 3 1
2 1 3
1 2 3
1 3 2
1 2 3





*/
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 4):
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
	vector<int> nums(n);
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}

	vector<vector<int>> ans;


	for (int i = n - 1; i >= 0; i--) {
		vector<vector<int>> same;
		vector<vector<int>> diffs;
		for (int j = i - 1; j >= 0; j--) {
			if (nums[i] > nums[j]) {
				same.push_back({nums[i], nums[j]});
			}
			else {
				diffs.push_back({nums[j], nums[i]});
			}
		}
		sort(same.begin(), same.end());
		for (int j = same.size() - 1; j >= 0; j--) {
			same.push_back({same[j][1], same[j][0]});
		}
		for (int j = 0; j < same.size(); j++) {
			ans.push_back(same[j]);
		}
		sort(diffs.begin(), diffs.end());
		for (int j = 0; j < diffs.size(); j++) {
			ans.push_back(diffs[j]);
		}
		
	}

	cout << ans.size() << '\n';
	for (auto& arr : ans) {
		cout << arr[0] << " " << arr[1] << '\n';
	}
}


/*

1 2 3

2 1 3
2 3 1
2 1 3
1 2 3
1 3 2
1 2 3





*/

Submission (verdict: Wrong answer on test 7):
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
	vector<int> nums(n);
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}

	vector<vector<int>> ans;


	for (int i = n - 1; i >= 0; i--) {
		vector<vector<int>> same;
		vector<vector<int>> diffs;
		for (int j = i - 1; j >= 0; j--) {
			if (nums[i] > nums[j]) {
				same.push_back({nums[i], nums[j]});
			}
			else {
				diffs.push_back({nums[j], nums[i]});
			}
		}
		for (int j = same.size() - 1; j >= 0; j--) {
			same.push_back({same[j][1], same[j][0]});
		}
		for (int j = 0; j < same.size(); j++) {
			ans.push_back(same[j]);
		}
		sort(diffs.begin(), diffs.end());
		for (int j = 0; j < diffs.size(); j++) {
			ans.push_back(diffs[j]);
		}
		
	}

	cout << ans.size() << '\n';
	for (auto& arr : ans) {
		cout << arr[0] << " " << arr[1] << '\n';
	}
}


/*

1 2 3

2 1 3
2 3 1
2 1 3
1 2 3
1 3 2
1 2 3





*/
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#define _CRT_SECURE_NO_WARNINGS                                                                                                                            

#include <algorithm> 
#include <bitset> 
#include <cassert> 
#include <chrono> 
#include <ctime> 
#include <deque> 
#include <fstream> 
#include <functional> 
#include <initializer_list> 
#include <iomanip> 
#include <iostream> 
#include <map> 
#include <math.h> 
#include <queue> 
#include <random> 
#include <set> 
#include <stack> 
#include <stdexcept> 
#include <string> 
#include <unordered_map> 
#include <unordered_set> 
#include <vector> 

using namespace std;

#define ll long long 
#define ld long double 
#define sz(a) (int)a.size() 
#define all(a) a.begin(), a.end() 
#define rall(a) a.rbegin(), a.rend() 

ll mod = (ll)(1e9 + 7);
const int inf = 1e9 + 1;

ll gcd(ll a, ll b) {
	if (b == 0)
		return a;
	else
		return gcd(b, a % b);
}

ll binpow(ll a, ll n) {
	if (n == 0)
		return 1ll;
	if (n % 2 == 1ll)
		return (binpow(a, n - 1ll) * a) % mod;
	else {
		ll b = binpow(a, n / 2);
		return (b * b) % mod;
	}
}

struct point {
	int x; 
	int y;
	int i;
};

void solve() {
	int n; cin >> n;

	vector<int> a(n);
	int sum = 0;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		sum += a[i];
	}

	if (n == 1) {
		cout << a[0] << '\n';
		return;
	}

	int ans = 0;
	ans = abs(sum);

	for (int i = 0; i < n; ++i) {
		sum = 0;
		for (int j = 0; j < n - i - 1; ++j) {
			a[j] = a[j + 1] - a[j];
			sum += a[j];
		}

		ans = max(ans, abs(sum));
	}

	cout << ans << '\n';
}

signed main() {
	ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	//freopen("test.in", "r", stdin); 
	cout << fixed << setprecision(8);
	int t = 1;
	cin >> t;
	while (t--) {
		solve();
	}
}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define rng(i,c,n) for(int i=c;i<n;i++)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define vec(...) vector<__VA_ARGS__>
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
void print(){cout<<'\n';}
template<class h,class...t>
void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}

void slv(){
	int l,r;
	cin>>l>>r;
	if(r-l==2){
		print(l,l+1,r);
		return;
	}
	int a=0;
	per(j,30){
		if((r>>j&1)!=(l>>j&1)){
			if(r!=(a|(1<<j))) print(a|(1<<j)+1,a|((1<<j)-1)-1,a|((1<<j)-1));
			else print(a|(1<<j),a|((1<<j)-1)-1,a|((1<<j)-1)-2);
			break;
		}
		a|=(r>>j&1)<<j;
	}
}

signed main(){
	ios::sync_with_stdio(0),cin.tie(0);
	int t;
	cin>>t;
	rep(cs,t){
		slv();
	}
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define rng(i,c,n) for(int i=c;i<n;i++)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define vec(...) vector<__VA_ARGS__>
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
void print(){cout<<'\n';}
template<class h,class...t>
void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}

void slv(){
	int l,r;
	cin>>l>>r;
	if(r-l==2){
		print(l,l+1,r);
		return;
	}
	int a=0;
	per(j,30){
		if((r>>j&1)!=(l>>j&1)){
			if(r!=(a|(1<<j))){
				if(l!=(a|((1<<j)-1))){
					print((a|(1<<j))+1,(a|((1<<j)-1))-1,a|((1<<j)-1));
				}else{
					print((a|(1<<j))+1,(a|(1<<j))+2,a|((1<<j)-1));
				}
			}else{
				print(a|(1<<j),(a|((1<<j)-1))-1,(a|((1<<j)-1))-2);
			}
			break;
		}
		a|=(r>>j&1)<<j;
	}
}

signed main(){
	ios::sync_with_stdio(0),cin.tie(0);
	int t;
	cin>>t;
	rep(cs,t){
		slv();
	}
}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define rng(i,c,n) for(int i=c;i<n;i++)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define vec(...) vector<__VA_ARGS__>
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
void print(){cout<<'\n';}
template<class h,class...t>
void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}

void slv(){
	int l,r;
	cin>>l>>r;
	int a=0;
	per(j,30){
		if((r>>j&1)!=(l>>j&1)){
			print(a|(1<<j),a|((1<<j)-1),a|(1<<j));
			break;
		}
		a|=(r>>j&1)<<j;
	}
}

signed main(){
	ios::sync_with_stdio(0),cin.tie(0);
	int t;
	cin>>t;
	rep(cs,t){
		slv();
	}
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define rng(i,c,n) for(int i=c;i<n;i++)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define vec(...) vector<__VA_ARGS__>
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
void print(){cout<<'\n';}
template<class h,class...t>
void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}

void slv(){
	int l,r;
	cin>>l>>r;
	if(r-l==2){
		print(l,l+1,r);
		return;
	}
	int a=0;
	per(j,30){
		if((r>>j&1)!=(l>>j&1)){
			if(r!=(a|(1<<j))) print(a|(1<<j)+1,a|((1<<j)-1)-1,a|((1<<j)-1));
			else print(a|(1<<j),a|((1<<j)-1)-1,a|((1<<j)-1)-2);
			break;
		}
		a|=(r>>j&1)<<j;
	}
}

signed main(){
	ios::sync_with_stdio(0),cin.tie(0);
	int t;
	cin>>t;
	rep(cs,t){
		slv();
	}
}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define rng(i,c,n) for(int i=c;i<n;i++)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define vec(...) vector<__VA_ARGS__>
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
void print(){cout<<'\n';}
template<class h,class...t>
void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}

void slv(){
	int l,r;
	cin>>l>>r;
	int a=0;
	per(j,30){
		if((r>>j&1)!=(l>>j&1)){
			print(a|(1<<j),a|((1<<j)-1),a|(1<<j));
			break;
		}
		a|=(r>>j&1)<<j;
	}
}

signed main(){
	ios::sync_with_stdio(0),cin.tie(0);
	int t;
	cin>>t;
	rep(cs,t){
		slv();
	}
}