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;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T> using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 2e5 + 5, mod = 1e9 + 7;
const long long inf = 1e18;
#define pb push_back
#define all(c) c.begin(), c.end()
#define allr(a) a.rbegin(),a.rend()
#define debug(x) cout << '>' << #x << " : " << x << endl;
#define F first
#define S second
#define fastIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
typedef unsigned long long ull;
typedef long long ll;

/*
  // think greedy first, codeforces A,B usually some sort of greedy, A super simple usually (800)
  // C on Div2 or E on Div3/4 require more thinking but still not too hard
  // for later problems, think about data structures like segment tree and ordered set
  // try query problems, im oddly good at them
  // As a participant, I approve these statements.
*/

void file_input() {
  freopen(".in","r",stdin);
  freopen(".out","w",stdout);
}


void solve(){
    ll t=1;   cin>>t;
    while(t--){
        ll x, y;    cin>>x>>y;
        ll c=0;
        bool f=0;
        
        for(ll i=30 ; i>=0 ; i--){
            ll bit_x= ((x>>i) & 1);
            ll bit_y= ((y>>i) & 1);
            //cout << "Bit position: " << i << ", x: " << bit_x << ", y: " << bit_y << endl;
            if(f==0 and bit_x==bit_y){
                if(bit_x==1) c = c|(1<<i);
            }
            else if(f==0 and bit_x!=bit_y){
                f=1;
            }
            else if(f){
                if(bit_x==bit_y){
                    if(bit_x==0) c = c|(1<<i); 
                }
                else if(bit_x==0 and bit_y==1) c = c|(1<<i);
            }
            //ll bit_c= ((c>>i) & 1);
            //debug(bit_c);
        }

        cout<<x<<' '<<y<<' '<<c<<endl;
    }
}

int main()
{
    //file_input();
    fastIO;
    solve();
}



Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T> using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 2e5 + 5, mod = 1e9 + 7;
const long long inf = 1e18;
#define pb push_back
#define all(c) c.begin(), c.end()
#define allr(a) a.rbegin(),a.rend()
#define debug(x) cout << '>' << #x << " : " << x << endl;
#define F first
#define S second
#define fastIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
typedef unsigned long long ull;
typedef long long ll;

/*
  // think greedy first, codeforces A,B usually some sort of greedy, A super simple usually (800)
  // C on Div2 or E on Div3/4 require more thinking but still not too hard
  // for later problems, think about data structures like segment tree and ordered set
  // try query problems, im oddly good at them
  // As a participant, I approve these statements.
*/

void file_input() {
  freopen(".in","r",stdin);
  freopen(".out","w",stdout);
}


void solve(){
    ll t=1;   cin>>t;
    while(t--){
        ll x, y;    cin>>x>>y;
        ll c=0;
        bool f=0;
        
        for(ll i=30 ; i>=0 ; i--){
            ll bit_x= ((x>>i) & 1);
            ll bit_y= ((y>>i) & 1);
            //cout << "Bit position: " << i << ", x: " << bit_x << ", y: " << bit_y << endl;
            if(f==0 and bit_x==bit_y){
                if(bit_x==1) c = c|(1<<i);
            }
            else if(f==0 and bit_x!=bit_y){
                f=1;
            }
            else if(f){
                if(bit_x==bit_y){
                    if(bit_x==0) c = c|(1<<i); 
                }
                else if(bit_x==0 and bit_y==1) c = c|(1<<i);
            }
            //ll bit_c= ((c>>i) & 1);
            //debug(bit_c);
        }
        if(x>=c) c=x+1;
        if(y<=c) c=y-1;
        cout<<x<<' '<<y<<' '<<c<<endl;
    }
}

int main()
{
    //file_input();
    fastIO;
    solve();
}