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

Previous submission (verdict: Wrong answer on test 1):
#define mod 1000000007
#define ull unsigned long long
#define ll long long
#define cy cout<<''YES''<<endl
#define cn cout<<''NO''<<endl
#define hai cout<<-1<<endl
#define pb push_back
#define ff first
#define ss second
bool isprime(ll n){if (n <= 1)  return 0; if (n <= 3)  return 1; if (n%2 == 0 || n%3 == 0) return 0; for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return 0; return 1;}
#include<bits/stdc++.h>
using namespace std;
void fun(vector<ll> &num1,vector<ll> &num2){
  while(num2.size()!=num1.size()){
    num2.pb(0);
  }
}
void solve()
{
    ll v1,v2;
    cin>>v1>>v2;
    vector<ll> num1,num2;
    ll x=v1;
    while(x){
      ll w=(x&1);
      num1.pb(w);
      x=x>>1;
    }
    ll x1=v2;
    while(x1){
      ll w=(x1&1);
      num2.pb(w);
      x1=x1>>1;
    }
    
    reverse(num1.begin(),num1.end());
    reverse(num2.begin(),num2.end());
    if(num1.size()>num2.size()){
      fun(num1,num2);
    }else{
      fun(num2,num1);
    }
    // for(auto it : num1){
    //   cout<<it<<" ";
    // }
    // cout<<endl;
    // cout<<endl;
    // for(auto it : num2){
    //   cout<<it<<" ";
    // }
    // cout<<endl;
    ll x2=0;
    vector<ll> num3;
    for(ll i=0;i<num1.size();i++){
      if(num1[i]!=num2[i]){
        x2=i;
        break;
      }
      num3.pb(num1[i]);
    }
    num3.pb(0);
    x2++;
    for(ll j=x2;j<num1.size();j++){
      if(num1[j]==num2[j] && num1[j]==0){
        num3.pb(1);
      }else if(num1[j]==num2[j] && num1[j]==1){
        num3.pb(0);
      }else{
        num3.pb(1);
      }
    }
    // for(auto it : num3){
    //   cout<<it<<" ";
    // }
    // cout<<endl;
    ll value=0;
    ll ww=1;
    for(ll i=num3.size()-1;i>=0;i--){
      // cout<<num3[i]*ww<<endl;
      value+=num3[i]*ww;
      ww=2*ww;
    }
    cout<<v1<<" "<<value<<" "<<v2<<endl;
}
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t=1;
cin>>t;
while(t--){
solve();
}
  return 0;
}

Submission (verdict: Wrong answer on test 1):
#define mod 1000000007
#define ull unsigned long long
#define ll long long
#define cy cout<<''YES''<<endl
#define cn cout<<''NO''<<endl
#define hai cout<<-1<<endl
#define pb push_back
#define ff first
#define ss second
bool isprime(ll n){if (n <= 1)  return 0; if (n <= 3)  return 1; if (n%2 == 0 || n%3 == 0) return 0; for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return 0; return 1;}
#include<bits/stdc++.h>
using namespace std;
void fun(vector<ll> &num1,vector<ll> &num2){
  while(num2.size()!=num1.size()){
    num2.pb(0);
  }
}
void solve()
{
    ll v1,v2;
    cin>>v1>>v2;
    vector<ll> num1,num2;
    ll x=v1;
    while(x){
      ll w=(x&1);
      num1.pb(w);
      x=x>>1;
    }
    ll x1=v2;
    while(x1){
      ll w=(x1&1);
      num2.pb(w);
      x1=x1>>1;
    }
    
    reverse(num1.begin(),num1.end());
    reverse(num2.begin(),num2.end());
    if(num1.size()>num2.size()){
      fun(num1,num2);
    }else{
      fun(num2,num1);
    }
    // for(auto it : num1){
    //   cout<<it<<" ";
    // }
    // cout<<endl;
    // for(auto it : num2){
    //   cout<<it<<" ";
    // }
    // cout<<num1.size()<<" "<<num2.size()<<endl;
    vector<ll> num3(num1.size(),0); 
    ll idx=0;
    for(ll i=0;i<num1.size();i++){
      num3[i]=num1[i];
      if(num1[i]!=num2[i]){
        idx=i;
        break;
      }
    }
    ll ww=num1[idx+1] | num2[idx+1];
    if(ww){
      num3[idx]=1;
      num3[idx+1]=0;
    }else{
      num3[idx]=0;
      num3[idx+1]=1;
    }
    // cout<<num3.size()<<endl;
    // for(ll i=0;i<num3.size();i++){
    //   cout<<num3[i]<<" ";
    // }
    // cout<<endl;
    for(ll i=idx+2;i<num1.size();i++){
      ll x=num1[i] | num2[i];
      if(x==1){
        num3[i]=0;
      }else {
        num3[i]=1;
      }
    }
    // for(auto it : num1){
    //   cout<<it<<" ";
    // }
    // cout<<endl;
    // for(auto it : num2){
    //   cout<<it<<" ";
    // }
    // cout<<endl;
    // for(auto it : num3){
    //   cout<<it<<" ";
    // }
    // cout<<endl;
    ll value=0;
    ll w1=1;
    for(ll i=num3.size()-1;i>=0;i--){
      value+=w1*num3[i];
      w1=w1*2;
    }
    cout<<v1<<" "<<value<<" "<<v2<<endl;
}
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t=1;
cin>>t;
while(t--){
solve();
}
  return 0;
}