ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

using namespace std;

vector<int> reverseArray(vector<int> &arr) {
    vector<int> ret;
    int n=arr.size();
    for (int i=n-1;i>=0;i--){
        ret.push_back(arr[i]);
    }
    return ret;
}

vector<long long> diffArray(vector<long long> &arr) {
    vector<long long> ret;
    int n=arr.size();
    for(int i=1;i<n;i++) {
        ret.push_back(arr[i] - arr[i-1]);
    }
    return ret;
}

long long sumOf(vector<long long> &arr) {
    long long ans = 0ll;
    for(int i: arr) {
        ans+=i;
    }
    return ans;
}

void solve(){
    int n;
    cin>>n;
    vector<long long> a(n,0ll);
    for (auto &i:a) {
        cin>>i;
    }
    long long ans = sumOf(a);
    while(n>1) {
        a = diffArray(a);
        ans=max(ans, abs(sumOf(a)));
        n--;
    }
    cout<<max(ans, a[0])<<'\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

using namespace std;

vector<int> reverseArray(vector<int> &arr) {
    vector<int> ret;
    int n=arr.size();
    for (int i=n-1;i>=0;i--){
        ret.push_back(arr[i]);
    }
    return ret;
}

vector<long long> diffArray(vector<long long> &arr) {
    vector<long long> ret;
    int n=arr.size();
    for(int i=1;i<n;i++) {
        ret.push_back(arr[i] - arr[i-1]);
    }
    return ret;
}

long long sumOf(vector<long long> &arr) {
    long long ans = 0ll;
    for(int i: arr) {
        ans+=i;
    }
    return ans;
}

void solve(){
    int n;
    cin>>n;
    vector<long long> a(n,0ll);
    for (auto &i:a) {
        cin>>i;
    }
    long long ans = sumOf(a);
    while(n>1) {
        a = diffArray(a);
        ans=max(ans, abs(sumOf(a)));
        n--;
    }
    cout<<max(ans, abs(a[0]))<<'\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

using namespace std;

vector<int> reverseArray(vector<int> &arr) {
    vector<int> ret;
    int n=arr.size();
    for (int i=n-1;i>=0;i--){
        ret.push_back(arr[i]);
    }
    return ret;
}

vector<int> diffArray(vector<int> &arr) {
    vector<int> ret;
    int n=arr.size();
    for(int i=1;i<n;i++) {
        ret.push_back(arr[i] - arr[i-1]);
    }
    return ret;
}

long long sumOf(vector<int> &arr) {
    long long ans = 0ll;
    for(int i: arr) {
        ans+=i;
    }
    return ans;
}

void solve(){
    int n;
    cin>>n;
    vector<int> a(n,0);
    for (int &i:a) {
        cin>>i;
    }
    long long ans = sumOf(a);
    while(n>1) {
        a = diffArray(a);
        ans=max(ans, abs(sumOf(a)));
        n--;
    }
    cout<<max(ans, 1ll*a[0])<<'\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

using namespace std;

vector<int> reverseArray(vector<int> &arr) {
    vector<int> ret;
    int n=arr.size();
    for (int i=n-1;i>=0;i--){
        ret.push_back(arr[i]);
    }
    return ret;
}

vector<long long> diffArray(vector<long long> &arr) {
    vector<long long> ret;
    int n=arr.size();
    for(int i=1;i<n;i++) {
        ret.push_back(arr[i] - arr[i-1]);
    }
    return ret;
}

long long sumOf(vector<long long> &arr) {
    long long ans = 0ll;
    for(int i: arr) {
        ans+=i;
    }
    return ans;
}

void solve(){
    int n;
    cin>>n;
    vector<long long> a(n,0ll);
    for (auto &i:a) {
        cin>>i;
    }
    long long ans = sumOf(a);
    while(n>1) {
        a = diffArray(a);
        ans=max(ans, abs(sumOf(a)));
        n--;
    }
    cout<<max(ans, a[0])<<'\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)

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

using namespace std;

bool isInSet(pair<int,int> pr, set<pair<int,int>> &s) {
    return s.find(pr) != s.end();
}

void solve(){
    int n;
    cin>>n;
    set<pair<int, int>> edge_set;
    vector<pair<int,int>> deg(n);
    for(int i=0;i<n;i++) {
        deg[i].second = i;
        deg[i].first = 0;
    }
    for (int i=1;i<n;i++) {
        int u,v;
        cin>>u>>v;
        --u,--v;
        edge_set.insert(make_pair(u,v));
        edge_set.insert(make_pair(v,u));
        deg[u].first++;
        deg[v].first++;
    }
    if (n==2) {
        cout<<"0\n";
        return;
    }
    sort(deg.begin(), deg.end());
    int ans = 0;
    for(int i=n-1;i>=n-3;i--) {
        for(int j=i-1;j>=n-3;j--) {
            ans = max(ans, deg[i].first + deg[j].first - (isInSet(make_pair(deg[i].second, deg[j].second), edge_set) ? 1: 0));
        }
    }
    cout<<(ans-1)<<'\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

using namespace std;

bool isInSet(pair<int,int> pr, set<pair<int,int>> &s) {
    return s.find(pr) != s.end();
}

void solve(){
    int n;
    cin>>n;
    set<pair<int, int>> edge_set;
    vector<pair<int,int>> deg(n);
    for(int i=0;i<n;i++) {
        deg[i].second = i;
        deg[i].first = 0;
    }
    for (int i=1;i<n;i++) {
        int u,v;
        cin>>u>>v;
        --u,--v;
        edge_set.insert(make_pair(u,v));
        edge_set.insert(make_pair(v,u));
        deg[u].first++;
        deg[v].first++;
    }
    if (n==2) {
        cout<<"0\n";
        return;
    }
    sort(deg.begin(), deg.end());
    int ans = 0;
    for(int i=n-2;i>=0;i--) {
        int j=n-1;
        ans = max(ans, deg[i].first + deg[j].first - (isInSet(make_pair(deg[i].second, deg[j].second), edge_set) ? 1: 0));
    }
    ans = max(ans, deg[n-2].first + deg[n-3].first - (isInSet(make_pair(deg[n-2].second, deg[n-3].second), edge_set) ? 1: 0));
    cout<<(ans-1)<<'\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)


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

using namespace std;

bool isInSet(pair<int,int> pr, set<pair<int,int>> &s) {
    return s.find(pr) != s.end();
}

void solve(){
    int n;
    cin>>n;
    set<pair<int, int>> edge_set;
    vector<pair<int,int>> deg(n);
    for(int i=0;i<n;i++) {
        deg[i].second = i;
        deg[i].first = 0;
    }
    for (int i=1;i<n;i++) {
        int u,v;
        cin>>u>>v;
        --u,--v;
        edge_set.insert(make_pair(u,v));
        edge_set.insert(make_pair(v,u));
        deg[u].first++;
        deg[v].first++;
    }
    if (n==2) {
        cout<<"0\n";
        return;
    }
    sort(deg.rbegin(), deg.rend());
    int ans = 0;
    for(int i=0;i<3;i++) {
        for(int j=i+1;j<3;j++) {
            ans = max(ans, deg[i].first + deg[j].first - (isInSet(make_pair(deg[i].second, deg[j].second), edge_set) ? 1: 0));
        }
    }
    cout<<(ans-1)<<'\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)

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

using namespace std;

bool isInSet(pair<int,int> pr, set<pair<int,int>> &s) {
    return s.find(pr) != s.end();
}

void solve(){
    int n;
    cin>>n;
    set<pair<int, int>> edge_set;
    vector<pair<int,int>> deg(n);
    for(int i=0;i<n;i++) {
        deg[i].second = i;
        deg[i].first = 0;
    }
    for (int i=1;i<n;i++) {
        int u,v;
        cin>>u>>v;
        --u,--v;
        edge_set.insert(make_pair(u,v));
        edge_set.insert(make_pair(v,u));
        deg[u].first++;
        deg[v].first++;
    }
    if (n==2) {
        cout<<"0\n";
        return;
    }
    sort(deg.rbegin(), deg.rend());
    int ans = 0;
    for(int i=0;i<3;i++) {
        for(int j=i+1;j<3;j++) {
            ans = max(ans, deg[i].first + deg[j].first - (isInSet(make_pair(deg[i].second, deg[j].second), edge_set) ? 1: 0));
        }
    }
    cout<<(ans-1)<<'\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

using namespace std;

bool isInSet(pair<int,int> pr, set<pair<int,int>> &s) {
    return s.find(pr) != s.end();
}

void solve(){
    int n;
    cin>>n;
    set<pair<int, int>> edge_set;
    vector<pair<int,int>> deg(n);
    for(int i=0;i<n;i++) {
        deg[i].second = i;
        deg[i].first = 0;
    }
    for (int i=1;i<n;i++) {
        int u,v;
        cin>>u>>v;
        --u,--v;
        edge_set.insert(make_pair(u,v));
        edge_set.insert(make_pair(v,u));
        deg[u].first++;
        deg[v].first++;
    }
    if (n==2) {
        cout<<"0\n";
        return;
    }
    sort(deg.begin(), deg.end());
    int ans = 0;
    for(int i=n-1;i>=n-3;i--) {
        for(int j=i-1;j>=n-3;j--) {
            ans = max(ans, deg[i].first + deg[j].first - (isInSet(make_pair(deg[i].second, deg[j].second), edge_set) ? 1: 0));
        }
    }
    cout<<(ans-1)<<'\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
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;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;

const ll MOD = 1e9 + 7;

#define fast_io() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define mp make_pair
#define fl(a,b) for(ll i=a;i<b;i++)
#define fl2(a,b) for(ll j=a;j<b;j++)
#define fl3(a,b) for(ll k=a;k<b;k++)
#define bl(a,b) for(ll k=a;k>b;k--)
ll M = 1000000007;


int cmp(ll a,ll b,ll c){
    return (a^b)+(b^c)+(c^a);
}
void solve() {
    ll s,e;
    cin >> s>>e;
    ll a =0,b=0,c=0;
    int bitWidth = ceil(log2(e)); 
    int mask = (1 << bitWidth) - 1; 
    a = pow(2,bitWidth);
    while(a>e && bitWidth>=0){
        bitWidth--;
        a = pow(2,bitWidth);
    }
    b = a-1;
    while(c==a || c==b) c++;
    ll ans = (a^b) + (b^c) + (c^a);
    cout<<a<<" "<<b<<" "<<c<<endl;
}

int main() {
    fast_io();
    #ifndef ONLINE_JUDGE
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
    #endif

    // solve();

    int t;
    cin>>t;
    while(t--)
        solve();
    return 0;
}
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;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;

const ll MOD = 1e9 + 7;

#define fast_io() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define mp make_pair
#define fl(a,b) for(ll i=a;i<b;i++)
#define fl2(a,b) for(ll j=a;j<b;j++)
#define fl3(a,b) for(ll k=a;k<b;k++)
#define bl(a,b) for(ll k=a;k>b;k--)
ll M = 1000000007;


int cmp(ll a,ll b,ll c){
    return (a^b)+(b^c)+(c^a);
}
void solve() {
    ll s,e;
    cin >> s>>e;
    ll a =0,b=0,c=0;
    int bitWidth = ceil(log2(e)); 
    int mask = (1 << bitWidth) - 1; 
    a = pow(2,bitWidth);
    while(a>e && bitWidth>=0){
        bitWidth--;
        a = pow(2,bitWidth);
    }
    b = a-1;
    while(c==a || c==b) c++;
    ll ans = (a^b) + (b^c) + (c^a);
    cout<<a<<" "<<b<<" "<<c<<endl;
}

int main() {
    fast_io();
    #ifndef ONLINE_JUDGE
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
    #endif

    // solve();

    int t;
    cin>>t;
    while(t--)
        solve();
    return 0;
}

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

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;

const ll MOD = 1e9 + 7;

#define fast_io() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define mp make_pair
#define fl(a,b) for(ll i=a;i<b;i++)
#define fl2(a,b) for(ll j=a;j<b;j++)
#define fl3(a,b) for(ll k=a;k<b;k++)
#define bl(a,b) for(ll k=a;k>b;k--)
ll M = 1000000007;


int cmp(ll a,ll b,ll c){
    return (a^b)+(b^c)+(c^a);
}
void solve() {
    ll s,e;
    cin >> s>>e;
    ll a =s,b=s,c=s;
    int bitWidth = ceil(log2(e)); 
    int mask = (1 << bitWidth) - 1; 
    a = pow(2,bitWidth);
    while(a>e && bitWidth>=0){
        bitWidth--;
        a = pow(2,bitWidth);
    }
    b = a-1;
    while(c==a || c==b) c++;
    ll ans = (a^b) + (b^c) + (c^a);
    cout<<a<<" "<<b<<" "<<c<<endl;
}

int main() {
    fast_io();
    #ifndef ONLINE_JUDGE
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
    #endif

    // solve();

    int t;
    cin>>t;
    while(t--)
        solve();
    return 0;
}
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;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;

const ll MOD = 1e9 + 7;

#define fast_io() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define mp make_pair
#define fl(a,b) for(ll i=a;i<b;i++)
#define fl2(a,b) for(ll j=a;j<b;j++)
#define fl3(a,b) for(ll k=a;k<b;k++)
#define bl(a,b) for(ll k=a;k>b;k--)
ll M = 1000000007;


int cmp(ll a,ll b,ll c){
    return (a^b)+(b^c)+(c^a);
}
void solve() {
    ll s,e;
    cin >> s>>e;
    ll a =s,b=s,c=s;
    int bitWidth = ceil(log2(e)); 
    int mask = (1 << bitWidth) - 1; 
    a = pow(2,bitWidth);
    while(a>e && bitWidth>=0){
        bitWidth--;
        a = pow(2,bitWidth);
    }
    b = a-1;
    while(c==a || c==b) c++;
    ll ans = (a^b) + (b^c) + (c^a);
    cout<<a<<" "<<b<<" "<<c<<endl;
}

int main() {
    fast_io();
    #ifndef ONLINE_JUDGE
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
    #endif

    // solve();

    int t;
    cin>>t;
    while(t--)
        solve();
    return 0;
}

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

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;

const ll MOD = 1e9 + 7;

#define fast_io() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define mp make_pair
#define fl(a,b) for(ll i=a;i<b;i++)
#define fl2(a,b) for(ll j=a;j<b;j++)
#define fl3(a,b) for(ll k=a;k<b;k++)
#define bl(a,b) for(ll k=a;k>b;k--)
#define clz(a) __builtin_clz(a)
ll M = 1000000007;


int cmp(ll a,ll b,ll c){
    return (a^b)+(b^c)+(c^a);
}
void solve() {
    ll s,e;
    cin>>s>>e;
    ll diffbits = 31 - clz(s^e);
    ll a = s | ((1<<diffbits)-1);
    ll b = a+1;
    ll c;
    if(a==s) c = e;
    else c = s;

    cout<<a<<" "<<b<<" "<<c<<endl;

}

int main() {
    fast_io();
    #ifndef ONLINE_JUDGE
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
    #endif

    // solve();

    int t;
    cin>>t;
    while(t--)
        solve();
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <numeric>
#include <cstring>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <climits>
#include <random>

using namespace std;

const long long int inf = LLONG_MAX-10000000000ll;
const long long mod = 1e9+7;
const long long mod2 = 998244353;

#define inp(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define inp1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define out(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}
#define out1(a,n) for(int i=1;i<=n;i++){cout<<a[i]<<" ";}
#define loop(n) for(int i=0;i<n;i++)
#define loop1(n) for(int i=1;i<=n;i++)
#define rloop(n) for(int i=n-1;i>=0;i--)
#define loop2(n) for(int j=0;j<n;j++)
#define nl cout<<endl;
#define all(v) v.begin(),v.end()
#define pb push_back
#define ll long long
#define F first
#define S second

typedef vector<ll> vi;
typedef pair<ll,ll> pi;

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t = 1;
    cin>>t;
    while(t--){
        
        int l,r;
        cin>>l>>r;

        int fl = 1,ind = -1;
        ll ans = 0;
        for(int i=30;i>=0;i--){
            bool x = l&(1ll<<i);
            bool y = r&(1ll<<i);

            if(x==y){
                if(x==1 && fl)ans|=(1ll<<i);
                if(x==0 && fl==0)ans|=(1ll<<i);
            }
            else{
                if(fl){fl=0;ind=i;continue;}
                else ans|=(1ll<<i);
            }
        }
        if(ans<=l)ans|=(1ll<<ind);

        cout<<l<<" "<<r<<" "<<ans<<endl;

    }
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <cstdio>
#include <algorithm>


void solve() {
	int l, r; scanf("%d%d", &l, &r);
	int eq=1; int ans1=0, ans2;
	for(int i = 29;i >= 0;i--) {
		if(eq&&(l&(1<<i))!=(r&(1<<i))) {
			eq=0; ans1^=(1<<i);
		} else if(eq) {
			ans1^=(l&(1<<i)); ans2^=(l&(1<<i));
		} else {
			ans2^=(1<<i);
		}
	}
	printf("%d %d %d\n", ans1, ans2, ans2);
}


int main() {
//	freopen("in.txt", "r", stdin);
	int T; scanf("%d", &T);
	while(T--) {
		solve();
	}
	return 0;
}



Submission (verdict: Wrong answer on test 1):
#include <cstdio>
#include <algorithm>


void solve() {
	int l, r; scanf("%d%d", &l, &r);
	int eq=1; int ans1=0, ans2=0;
	for(int i = 29;i >= 0;i--) {
		if(eq&&(l&(1<<i))!=(r&(1<<i))) {
			eq=0; ans1^=(1<<i);
		} else if(eq) {
			ans1^=(l&(1<<i)); ans2^=(l&(1<<i));
		} else {
			ans2^=(1<<i);
		}
	}
	printf("%d %d %d\n", ans1, ans2, ans2);
}


int main() {
//	freopen("in.txt", "r", stdin);
	int T; scanf("%d", &T);
	while(T--) {
		solve();
	}
	return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <cstdio>
#include <algorithm>


void solve() {
	int l, r; scanf("%d%d", &l, &r);
	int eq=1; int ans1=0, ans2;
	for(int i = 29;i >= 0;i--) {
		if(!(eq&&(l&(1<<i))==(r&(1<<i)))) {
			eq=0; ans1^=(1<<i);
		} else if(eq) {
			ans1^=l&(1<<i); ans2^=l&(1<<i);
		} else {
			ans2^=(1<<i);
		}
	}
	printf("%d %d %d\n", ans1, ans2, ans2);
}


int main() {
//	freopen("in.txt", "r", stdin);
	int T; scanf("%d", &T);
	while(T--) {
		solve();
	}
	return 0;
}



Submission (verdict: Wrong answer on test 1):
#include <cstdio>
#include <algorithm>


void solve() {
	int l, r; scanf("%d%d", &l, &r);
	int eq=1; int ans1=0, ans2;
	for(int i = 29;i >= 0;i--) {
		if(eq&&(l&(1<<i))!=(r&(1<<i))) {
			eq=0; ans1^=(1<<i);
		} else if(eq) {
			ans1^=(l&(1<<i)); ans2^=(l&(1<<i));
		} else {
			ans2^=(1<<i);
		}
	}
	printf("%d %d %d\n", ans1, ans2, ans2);
}


int main() {
//	freopen("in.txt", "r", stdin);
	int T; scanf("%d", &T);
	while(T--) {
		solve();
	}
	return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <cstdio>
#include <algorithm>


void solve() {
	int l, r; scanf("%d%d", &l, &r);
	int eq=1; int ans1=0, ans2=0;
	for(int i = 29;i >= 0;i--) {
		if(eq&&(l&(1<<i))!=(r&(1<<i))) {
			eq=0; ans1^=(1<<i);
		} else if(eq) {
			ans1^=(l&(1<<i)); ans2^=(l&(1<<i));
		} else {
			ans2^=(1<<i);
		}
	}
	printf("%d %d %d\n", ans1, ans2, ans2);
}


int main() {
//	freopen("in.txt", "r", stdin);
	int T; scanf("%d", &T);
	while(T--) {
		solve();
	}
	return 0;
}


Submission (verdict: Accepted):
#include <cstdio>
#include <algorithm>


void solve() {
	int l, r; scanf("%d%d", &l, &r);
	int eq=1; int ans1=0, ans2=0;
	for(int i = 29;i >= 0;i--) {
		if(eq&&(l&(1<<i))!=(r&(1<<i))) {
			eq=0; ans1^=(1<<i);
		} else if(eq) {
			ans1^=(l&(1<<i)); ans2^=(l&(1<<i));
		} else {
			ans2^=(1<<i);
		}
	}
	if(ans2==l) {
		printf("%d %d %d\n", ans1+1, ans1, ans2);
	} else {
		printf("%d %d %d\n", ans1, ans2, ans2-1);
	}
	
}


int main() {
//	freopen("in.txt", "r", stdin);
	int T; scanf("%d", &T);
	while(T--) {
		solve();
	}
	return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include <cstdio>
#include <algorithm>


void solve() {
	int l, r; scanf("%d%d", &l, &r);
	int eq=1; int ans1=0, ans2;
	for(int i = 29;i >= 0;i--) {
		if(!(eq&&(l&(1<<i))==(r&(1<<i)))) {
			eq=0; ans1^=(1<<i);
		} else if(eq) {
			ans1^=l&(1<<i); ans2^=l&(1<<i);
		} else {
			ans2^=(1<<i);
		}
	}
	printf("%d %d %d\n", ans1, ans2, ans2);
}


int main() {
//	freopen("in.txt", "r", stdin);
	int T; scanf("%d", &T);
	while(T--) {
		solve();
	}
	return 0;
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) begin(x), end(x)
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
//im in the dark here;

int dx[]{0, 1, 0, -1, 1, 1, -1, -1};
int dy[]{1, 0, -1, 0, 1, -1, -1, 1};

const int N = 2e5 + 5, M = 1e9 + 7;

void solve() {
    string s;
    cin >> s;
    int i = s.size() - 1;
    while(i) {
        bool alt = 1;
        for (int j = i; j > 0; --j) {
            if (s[j] - 1 > s[j - 1]) {
                alt = 0;
                s[j] -= 1;
                swap(s[j], s[j - 1]);
            }
            else {
                break;
            }
        }
        if (alt) {
            i--;
        }
    }
    cout << s << '\n';
}

int main() {
    ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt","w", stdout);
#endif

    int t = 1;
    cin >> t;

    FOR (i, 1, t + 1) {
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) begin(x), end(x)
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
//im in the dark here;

int dx[]{0, 1, 0, -1, 1, 1, -1, -1};
int dy[]{1, 0, -1, 0, 1, -1, -1, 1};

const int N = 2e5 + 5, M = 1e9 + 7;

void solve() {
    string s;
    cin >> s;
    int i = s.size() - 1;
    while(i) {
        bool alt = 1;
        for (int j = i; j > max(0, i - (s[j] - 1 - '0')); --j) {
            if (s[j] - 1 > s[j - 1]) {
                alt = 0;
                s[j] -= 1;
                swap(s[j], s[j - 1]);
            }
        }
        if (alt) {
            i--;
        }
    }
    cout << s << '\n';
}

int main() {
    ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt","w", stdout);
#endif

    int t = 1;
    cin >> t;

    FOR (i, 1, t + 1) {
        solve();
    }
    return 0;
}