Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
/* *--------------------BOILERPLATE---------------------------* */
long long int mod = 1e9 + 7;
long long int N = 1e5 + 1;
#define INF3 INT32_MAX
#define INF6 INT64_MAX
#define ll long long
#define vin vector<int>
#define nl cout << endl
#define viin vector<pair<int, int>>
typedef vector<ll> vll;
#define mpii map<int, int>
#define mpsi map<string, int>
#define vbl vector<bool>
#define vlln vector<pair<long long, long long>>
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ioset;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> imset;
typedef tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update> doset;
typedef tree<int, null_type, greater_equal<int>, rb_tree_tag, tree_order_statistics_node_update> dmset;
// .insert(),.erase(),find_by_order(k),order_of_key(k);

#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << " ";_print(x);cerr << endl;
#else
#define debug(x)
#endif
void _print(int a) { cerr << a; }
void _print(string a) { cerr << a; }
void _print(long long a) { cerr << a; }
void _print(char a) { cerr << a; }
void _print(bool a) { cerr << a; }
void _print(pair<ll,ll> a) {cerr<<a.first<<" "<<a.second<<endl;}
void _print(pair<int,int> a) {cerr<<a.first<<" "<<a.second<<endl;}
template <class T>
void _print(vector<T> vec)
{cerr << "[";for (T i : vec){_print(i);cerr << " ";}cerr << "]";}
template <class T>
void _print(set<T> st){cerr << "[ ";for (T i : st){_print(i);cerr << " ";}cerr << "]";}
template <class T>
void _print(multiset<T> st)
{cerr << "[ ";for (T i : st){_print(i);cerr << " ";}cerr << "]";}
#define FOR(i, n) for (int i = 0; i < n; i++)
#define prvec(vec)for (auto _ : vec){cout << _ << " ";}
#define prdeb(vec)for (auto _ : vec){cerr << _ << " ";}
#define prser(vec)for (unsigned int _ = 0; _ < vec.size(); _++){cout << vec[_] << " ";}
#define cia(vec)for (unsigned int _ = 0; _ < vec.size(); _++){cin >> vec[_];}
#define srt(vec) sort(vec.begin(), vec.end());
#define rsrt(vec) sort(vec.begin(), vec.end(), greater<int>());
#define Y cout << "YES";
#define N cout << "NO";
template <class T>void ceilt(T &a, T &b){if (a % b == 0){a /= b;}else{a /= b;a++;}}
/* *--------------------BOILERPLATE---------------------------* */

/* *-----------------------CODE-------------------------------* */

void solve()
{
    int a,b;cin>>b>>a;
    int c = 0;int i = 0;
    int temp = a;
    while(a){   
        debug((a&1));
        debug(b&(1<<i));
        if(((a&1) == 0) && ((b&(1<<i)) == 0)){
            c+=(1<<i);
            a/=2;i++;
        }else if(((a&1)!=0) && ((b&(1<<i)) == 0)){
            if(c+(1<<i) < temp)c+=(1<<i);
            a/=2;i++;  
        }else if(((a&1) == 0) && ((b&(1<<i))!=0)){
            c+=(1<<i);
            a/=2;i++;
        }else{
            a/=2;i++;
        }
    }
    cout<<temp<<" "<<c<<" "<<b;
    debug((temp^b) + (temp^c) + (b^c));
}
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("Error.txt", "w", stderr);
    #endif
    ios::sync_with_stdio(false);
    std::cin.tie(0);
    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
        nl;
    }
}
/* *-----------------------CODE-------------------------------* */
                                

Submission (verdict: Wrong answer on test 2):
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
/* *--------------------BOILERPLATE---------------------------* */
long long int mod = 1e9 + 7;
long long int N = 1e5 + 1;
#define INF3 INT32_MAX
#define INF6 INT64_MAX
#define ll long long
#define vin vector<int>
#define nl cout << endl
#define viin vector<pair<int, int>>
typedef vector<ll> vll;
#define mpii map<int, int>
#define mpsi map<string, int>
#define vbl vector<bool>
#define vlln vector<pair<long long, long long>>
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ioset;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> imset;
typedef tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update> doset;
typedef tree<int, null_type, greater_equal<int>, rb_tree_tag, tree_order_statistics_node_update> dmset;
// .insert(),.erase(),find_by_order(k),order_of_key(k);

#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << " ";_print(x);cerr << endl;
#else
#define debug(x)
#endif
void _print(int a) { cerr << a; }
void _print(string a) { cerr << a; }
void _print(long long a) { cerr << a; }
void _print(char a) { cerr << a; }
void _print(bool a) { cerr << a; }
void _print(pair<ll,ll> a) {cerr<<a.first<<" "<<a.second<<endl;}
void _print(pair<int,int> a) {cerr<<a.first<<" "<<a.second<<endl;}
template <class T>
void _print(vector<T> vec)
{cerr << "[";for (T i : vec){_print(i);cerr << " ";}cerr << "]";}
template <class T>
void _print(set<T> st){cerr << "[ ";for (T i : st){_print(i);cerr << " ";}cerr << "]";}
template <class T>
void _print(multiset<T> st)
{cerr << "[ ";for (T i : st){_print(i);cerr << " ";}cerr << "]";}
#define FOR(i, n) for (int i = 0; i < n; i++)
#define prvec(vec)for (auto _ : vec){cout << _ << " ";}
#define prdeb(vec)for (auto _ : vec){cerr << _ << " ";}
#define prser(vec)for (unsigned int _ = 0; _ < vec.size(); _++){cout << vec[_] << " ";}
#define cia(vec)for (unsigned int _ = 0; _ < vec.size(); _++){cin >> vec[_];}
#define srt(vec) sort(vec.begin(), vec.end());
#define rsrt(vec) sort(vec.begin(), vec.end(), greater<int>());
#define Y cout << "YES";
#define N cout << "NO";
template <class T>void ceilt(T &a, T &b){if (a % b == 0){a /= b;}else{a /= b;a++;}}
/* *--------------------BOILERPLATE---------------------------* */

/* *-----------------------CODE-------------------------------* */

void solve()
{
    ll int a,b;cin>>b>>a;
    ll int c = 0;
    ll int i = log2(a)+1;
    int temp = a;
    while((a&(1<<i)) == (b&(1<<i))){
        c+=(a&(1<<i));i--;
    }
    int cut = i;
    i--;
    while(i>=0){
        if((a&(1ll<<i)) != 0 && ((b&(1ll<<i)) == 0)){
            c+=(1ll<<i);
            i--;
        }else if((a&(1ll<<i)) == 0 && ((b&(1ll<<i)) == 0)){
            c+=(1ll<<i);i--;
        }else if((a&(1ll<<i)) == 0 && ((b&(1ll<<i)) != 0)){
            c+=(1ll<<i);i--;
        }
        else i--;
    }
    if(c<b){
        c+=(1ll<<(cut));
    }
    cout<<a<<" "<<b<<" "<<c;
    debug((a^b)+(a^c) + (b^c));
}
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("Error.txt", "w", stderr);
    #endif
    ios::sync_with_stdio(false);
    std::cin.tie(0);
    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
        nl;
    }
}
/* *-----------------------CODE-------------------------------* */