ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2057C - Trip to the Olympiad
Language: c++23 

Code 1:
// #define ONLINE_JUDGE 1
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long; using pll = pair<ll, ll>;
#define all(a) (a).begin(),(a).end()
#define LL(...) ll __VA_ARGS__; input(__VA_ARGS__)
const ll N = 2e6 + 10;
#ifdef ONLINE_JUDGE
#define dbg(x)
#else
#define dbg(x) cerr << #x << "==" << (x) << '\n' << flush;
#endif
template<class... T> void input(T &...a) { (cin >> ... >> a); }
template<class T,class U> bool chmax(T &a, const U b) {return a<b?a=b,true:false; }
template<class T,class U> bool chmin(T &a, const U b) {return a>b?a=b,true:false; }
// clang-format on
bool gbit(ll n, ll k) { return (n >> k) & 1; }
void solve()
{
    LL(l, r);
    vector<ll> ans(3);
    ll now = 0;
    ll base = 0;
    for (ll k = 30; k >= 0; k--)
    {
        if (gbit(l, k) != gbit(r, k))
        {
            now = k;
            break;
        }
        base |= (gbit(l, k) << k);
    }
    ll a = (1 << now), b = a - 1; 
    a |= base, b |= base;
    ll c = (b - 1 >= l ? b - 1 : a + 1);
    cout << a << ' ' << b << ' ' << c << '\n';
}

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll T = 1;
    cin >> T;
    while (T--) solve();
    return 0;
}

Code 2:
// #define ONLINE_JUDGE 1
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long; using pll = pair<ll, ll>;
#define all(a) (a).begin(),(a).end()
#define LL(...) ll __VA_ARGS__; input(__VA_ARGS__)
const ll N = 2e6 + 10;
#ifdef ONLINE_JUDGE
#define dbg(x)
#else
#define dbg(x) cerr << #x << "==" << (x) << '\n' << flush;
#endif
template<class... T> void input(T &...a) { (cin >> ... >> a); }
template<class T,class U> bool chmax(T &a, const U b) {return a<b?a=b,true:false; }
template<class T,class U> bool chmin(T &a, const U b) {return a>b?a=b,true:false; }
// clang-format on
bool gbit(ll n, ll k) { return (n >> k) & 1; }
void solve()
{
    LL(l, r);
    vector<ll> ans(3);
    ll now = 0;
    for (ll k = 30; k >= 0; k--)
    {
        if (gbit(l, k) != gbit(r, k))
        {
            now = k;
            break;
        }
    }
    ll a = (1 << now), b = a - 1, c = (b - 1 >= l ? b - 1 : a + 1);
    cout << a << ' ' << b << ' ' << c << '\n';
}

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll T = 1;
    cin >> T;
    while (T--) solve();
    return 0;
}

Answer: 1
Problem: 2057C - Trip to the Olympiad
Language: c++17 

Code 1:
#include <bits/stdc++.h>
using namespace std;
#define int long long

int32_t main() 
{
    int t;
    cin>>t;
    while(t--){
      int l,r;
      cin>>l>>r;
      if(r-l==2){
        cout<<l<<" "<<l+1<<" "<<r<<endl;
        continue;
      }
      int val=pow(2,30);
      int ans=-1;
      while(ans==-1){
        int x=l/val;
        int y=r/val;
        if(x==y){
          if(y-x+1>val){
          int a=(x+1)*val;
            if(a-2>=l){
              cout<<a<<" "<<a-1<<" "<<a-2;
            }
            else{
              cout<<a<<" "<<a-1<<" "<<a+1;
            }
            break;
          }  
        }
        else{
         int a=(x+1)*val;
            if(a-2>=l){
              cout<<a<<" "<<a-1<<" "<<a-2;
            }
            else{
              cout<<a<<" "<<a-1<<" "<<a+1;
            }
            break;
        }
        val=val/2;
      }
      cout<<endl;
      
    }
}

Code 2:
#include <bits/stdc++.h>
using namespace std;
#define int long long

int32_t main() 
{
    int t;
    cin>>t;
    while(t--){
      int l,r;
      cin>>l>>r;
      if(r-l==2){
        cout<<l<<" "<<l+1<<" "<<r<<endl;
        continue;
      }
      int val=pow(2,30);
      int ans=-1;
      while(ans==-1){
        int x=l/val;
        int y=r/val;
        if(x==y){
          if(y-x+1>val){
          int a=(x+1)*val;
            if(a-2>=l){
              cout<<a<<" "<<a-1<<" "<<a-2;
            }
            else{
              cout<<a<<" "<<a-1<<" "<<a+1;
            }
            break;
          }  
        }
        else{
         int a=(x+1)*val;
            if(a-2>=l){
              cout<<a<<" "<<a-1<<" "<<a-2;
            }
            else{
              cout<<a<<" "<<a-1<<" "<<a+1;
            }
            break;
        }
        val=val/2;
      }
      
    }
}

Answer: 1
Problem: 2057C - Trip to the Olympiad
Language: c++17 

Code 1:
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=100010;
int l,r;
int a[3];
void solve(){
	memset(a,0,sizeof(a));
	cin>>l>>r;
	int res=0;
	while(1){
		if(r-l==2){
			cout<<l+res<<" "<<l+res+1<<" "<<l+res+2<<"\n";
			return;
		}
		int x=1;
		while(x*2<=r)x<<=1;
		if(x<=l){
			res+=x;
			l-=x;
			r-=x;
			continue;
		}
		cout<<x+res<<" "<<x+res-1<<" "<<(x==r?l:r)+res<<"\n";
		break;
	}
	return;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int T=1;
	cin>>T;
	while(T--)solve();
	return 0;
}

Code 2:
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=100010;
int l,r;
int a[3];
void solve(){
	memset(a,0,sizeof(a));
	cin>>l>>r;
	for(int i=30;i>=0;i--){
		sort(a,a+3);
		int x=1<<i;
		if(a[0]+x>r)continue;
		if(a[2]+x<=l){
			a[0]+=x;
			a[1]+=x;
			a[2]+=x;
			continue;
		}
		a[0]+=x;
		if(a[1]<l&&l<=a[1]+x&&a[1]+x<=r)a[1]+=x;
	}
	sort(a,a+3);
	cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<"\n";
	return;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int T=1;
	cin>>T;
	while(T--)solve();
	return 0;
}


Answer: 1
Problem: 2057C - Trip to the Olympiad
Language: c++17 

Code 1:
#include <bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

#define dbg(x) cerr << #x << ": " << x << '\n';
#define dbgv(v) cerr << #v << ": "; for(auto &el : v) cerr << el << " "; cerr << '\n';

using namespace std;
using ll = long long;

const ll MOD = 1e9 + 7;
const ll INF = 1e18 + 5;

void solve(){
    int l, r;
    cin >> l >> r;
    int log = 31 - __builtin_clz(l ^ r);    
    int a = l | ((1 << log) - 1), b = a + 1, c = (a == l ? r : r);
    cout << a << " " << b << " " << c << "\n";
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t;
    cin >> t;
    while(t--){
        solve();
    }
}


Code 2:
#include <bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

#define dbg(x) cerr << #x << ": " << x << '\n';
#define dbgv(v) cerr << #v << ": "; for(auto &el : v) cerr << el << " "; cerr << '\n';

using namespace std;
using ll = long long;

const ll MOD = 1e9 + 7;
const ll INF = 1e18 + 5;

void solve(){
    int l, r;
    cin >> l >> r;
    int log = 31 - __builtin_clz(l ^ r);    
    int a = l | ((1 << log) - 1), b = a + 1, c = (a == l ? r : l);
    cout << a << " " << b << " " << c << "\n";
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t;
    cin >> t;
    while(t--){
        solve();
    }
}


Answer: 2
Problem: 2057C - Trip to the Olympiad
Language: c++17 

Code 1:
#include <bits/stdc++.h>
#define lli long long
#define endl "\n"
#define vi vector<lli>
#define vpi vector<pair<lli, lli>>
#define vvi vector<vector<lli>>
#define fo(i, a, n) for(lli i = a; i<n; i++)
#define rfo(i, a, n) for(lli i = n-1; i>=a; i--)
#define nay {cout << "No\n"; return;}
#define yay {cout << "Yes\n"; return;}
#define vin(v) for(auto&x:v)cin>>x;
#define print(v) for(auto x:v) cout<<x<<" "; cout<<"\n"; 
#define all(v) v.begin(),v.end()
#define pb push_back
using namespace std;

const lli MOD = 1e9+7;

string num_to_bin(lli n) {
    string ans;
    if (n==0) return "0";
    while (n!=0) {
        if (n%2==0) ans.push_back('0');
        else ans.push_back('1');
        n/=2;
    }
    reverse(ans.begin(), ans.end());
    return ans;
}

void solve() {
    lli l,r; cin >> l >> r;
    lli a = 0, b = 0;
    for (int i=30; i>=0; i--) {
        lli b1 = l & (1ll << i);
        lli b2 = r & (1ll << i);
        if (b1 == b2) {
            b += b1 * (1ll << i);
        }
        else {
            b += (1ll << i);
            a = b-1;
            break;
        }
    }
    lli c;
    if (l<=a-1 && r>=a-1) c = a-1;
    else c = b+1;
    cout << a << " " << b << " " << c << endl;
}

int main() {
    int t; cin >> t;
    while (t--) {
        solve();
    }
}

Code 2:
#include <bits/stdc++.h>
#define lli long long
#define endl "\n"
#define vi vector<lli>
#define vpi vector<pair<lli, lli>>
#define vvi vector<vector<lli>>
#define fo(i, a, n) for(lli i = a; i<n; i++)
#define rfo(i, a, n) for(lli i = n-1; i>=a; i--)
#define nay {cout << "No\n"; return;}
#define yay {cout << "Yes\n"; return;}
#define vin(v) for(auto&x:v)cin>>x;
#define print(v) for(auto x:v) cout<<x<<" "; cout<<"\n"; 
#define all(v) v.begin(),v.end()
#define pb push_back
using namespace std;

const lli MOD = 1e9+7;

string num_to_bin(lli n) {
    string ans;
    if (n==0) return "0";
    while (n!=0) {
        if (n%2==0) ans.push_back('0');
        else ans.push_back('1');
        n/=2;
    }
    reverse(ans.begin(), ans.end());
    return ans;
}

void solve() {
    lli l,r; cin >> l >> r;
    lli a = 0, b = 0;
    for (int i=30; i>=0; i--) {
        lli b1=0, b2=0;
        if (l & (1ll << i)) b1 = 1;
        if (r & (1ll << i)) b2 = 1;
        if (b1 == b2) {
            b += b1 * (1ll << i);
        }
        else {
            b += (1ll << i);
            a = b-1;
            break;
        }
    }
    lli c;
    if (l<=a-1 && r>=a-1) c = a-1;
    else c = b+1;
    cout << a << " " << b << " " << c << endl;
}

int main() {
    int t; cin >> t;
    while (t--) {
        solve();
    }
}

Answer: 2
Problem: 2057C - Trip to the Olympiad
Language: c++23 

Code 1:
#include<bits/stdc++.h>
using namespace std;
#define int long long int

void sol1(){
    int a,b,c, ans=0, i=0; cin>>a>>b;
    vector<pair<int, int>>vp;
    unordered_map<int,int>mp;
    while(a--){cin>>c; mp[c]++;}
    for(auto &b: mp){vp.push_back({b.second, b.first});}
    sort(vp.begin(), vp.end());
    while(b>0 and i<vp.size()){
        int minn=min(b, vp[i].first);
        vp[i].first-=minn; b-=minn; i++;
    }
    for(auto &b: vp){
        if(b.first>0){ans++;}
    }
    cout<<max(1LL,ans)<<"\n";
}
void sol2(){
    int a,b,aa,bb,cc,ans=0; cin>>a>>b;
    for(int i=30; i>=0; i--){
       int a1=0,a2=0;
       if(a&(1ll<<i)){a1=1;}
       if(b&(1ll<<i)){a2=1;}
       if(a1==a2){
          ans+=a1*(1ll<<i);
       }
       else{
        aa=ans+(1ll<<i);
        bb=aa-1;
        break;
       }
    }
    for(int i=a; i<=b; i++){
        if(i!=aa and i!=bb){
            cc=i; break;
        }
    }
    cout<<aa<<" "<<bb<<" "<<cc<<"\n";
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int t; cin>>t;
    while(t--){
    //   sol1();
        sol2();
    }
     
    return 0;
}

Code 2:
#include<bits/stdc++.h>
using namespace std;
#define int long long int

void sol1(){
    int a,b,c, ans=0, i=0; cin>>a>>b;
    vector<pair<int, int>>vp;
    unordered_map<int,int>mp;
    while(a--){cin>>c; mp[c]++;}
    for(auto &b: mp){vp.push_back({b.second, b.first});}
    sort(vp.begin(), vp.end());
    while(b>0 and i<vp.size()){
        int minn=min(b, vp[i].first);
        vp[i].first-=minn; b-=minn; i++;
    }
    for(auto &b: vp){
        if(b.first>0){ans++;}
    }
    cout<<max(1LL,ans)<<"\n";
}
void sol2(){
    int a,b,aa,bb,cc,ans=0; cin>>a>>b;
    for(int i=30; i>=0; i++){
       int a1=0,a2=0;
       if(a&(1ll<<i)){a1=1;}
       if(b&(1ll<<i)){a2=1;}
       if(a1==a2){
          ans+=a1*(1ll<<i);
       }
       else{
        aa=ans+(1ll<<i);
        bb=aa-1;
        break;
       }
    }
    for(int i=a; i<=b; i++){
        if(i!=aa and i!=bb){
            cc=i; break;
        }
    }
    cout<<aa<<" "<<bb<<" "<<cc<<"\n";
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int t; cin>>t;
    while(t--){
    //   sol1();
        sol2();
    }
     
    return 0;
}

Answer: 1
Problem: 2057C - Trip to the Olympiad
Language: c++20 

Code 1:
#include<bits/stdc++.h>
using namespace std;
void solve(){
	int l,r;
	cin>>l>>r;
	int x=0,y=0;
	for(int i=30;i>=0;i--){
		if(((1<<i)&r)!=((1<<i)&l)){
			x+=(1<<i);
			y+=(1<<i)-1;
			break;
		}
		else{
			x+=(1<<i)*(((1<<i)&r));
			y+=(1<<i)*(((1<<i)&r));
		}
	}
	cout<<x<<" "<<y<<" ";
	if(x+1<=r){
		cout<<x+1<<'\n';
	}
	else{
		cout<<y-1<<'\n';
	}
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int t=1;
	cin>>t;
	while(t--) solve();
	return 0;
}

Code 2:
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve(){
	int l,r;
	cin>>l>>r;
	int x=0,y=0;
	for(int i=30;i>=0;i--){
		if(((r>>i)&1)!=((l>>i)&1)){
			x+=(1<<i);
			y+=(1<<i)-1;
			// cout<<i<<'\n';
			break;
		}
		else{
			x+=(1<<i)*(r>>i&1);
			y+=(1<<i)*(r>>i&1);
			// cout<<i<<" "<<x<<" "<<y<<'\n';
		}
	}
	cout<<x<<" "<<y<<" ";
	if(x+1<=r){
		cout<<x+1<<'\n';
	}
	else{
		cout<<y-1<<'\n';
	}
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int t=1;
	cin>>t;
	while(t--) solve();
	return 0;
}

Answer: 2
Problem: 2057C - Trip to the Olympiad
Language: c++17 

Code 1:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair<int,int>
#define iii pair<int, ii>
#define fi first
#define se second
#define inf 1e16
int tc, l, r;
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if(fopen("main.inp","r")) {
        freopen("main.inp", "r", stdin);
        freopen("main.out", "w", stdout);
    }
    cin >> tc;
    while(tc--) {
        cin >> l >> r;
        int a = 0, b = 0, c =  0;
        for(int j = 30; j >= 0; j--) {
            if((r&(1<<j)) && (l&(1<<j))) {
                a += (1<<j);
                b += (1<<j);
                c += (1<<j);
            }
            else if(!(r&(1<<j)) && !(l&(1<<j))) continue;
            else {
                a += (1<<j);
                b += (1<<j)-1;
                c += (1<<j)-2;
                break;
            }
        }
        if(min({a,b,c}) < l) {
            a++;
            b++;
            c++;
        }
        cout << a << ' ' << b << ' ' << c << '\n';
    }
    return 0;
}


Code 2:
#include <bits/stdc++.h>
using namespace std;
int mod=1e9+7;
long long power(long long x,int y)
{
    long long res=1;
    while(y>0)
    {
        int r=y%2;
        if(r==1)
        {
            res=res*x;
        }
        y=y/2;
        x=x*x;
    }
    return res;
}
int main() {
    int t;
    cin>>t;
    while(t--)
    {
       long long low,l,high,h;
       cin>>low>>high;
       l=low;
       h=high;
       vector<int>v1(35,0),v2(35,0);
       int j=32;
      // long long p=1;
       while(high>0)
       {
           int r1=high%2;
           int r2=low%2;
           v1[j]=r1;
           v2[j]=r2;
           j--;
          
           high=high/2;
           low=low/2;    
         
        }
       // cout<<j<<endl;
        long long z=0;
        int idx;
        for(int i=0;i<=32;i++)
        {
            if(v1[i]==v2[i])
            {
                continue;
            }
            idx=33-i;
           
           z=power(2,idx);
            z--;
            break;
        }
    //     cout<<z<<endl;
      //  cout<<z;
        long long num1=l^z;
        long long num2=h^z;
        if(num1<high&&num1>low)
        {
            cout<<l<<" "<<num1<<" "<<h<<endl;
        }
        else if(num2>low&&num2<high){
             cout<<l<<" "<<num2<<" "<<h<<endl;
        }
        else{
            cout<<l<<" "<<l+1<<" "<<h<<endl;
        }
    }
    
    return 0;
}

Answer: 1
Problem: 2057C - Trip to the Olympiad
Language: c++20 

Code 1:
#include <bits/stdc++.h>
using namespace std;
#define vii vector<vector<int>>
#define vi vector<int>
#define pb push_back
#define int long long
#define double long double
#define fi first
#define se second
#define s(v) sort(v.begin(), v.end())
#define r(v) reverse(v.begin(), v.end())
#define fast                         \
   ios_base::sync_with_stdio(false); \
   cin.tie(NULL);                    \
   cout.tie(NULL);
void solve()
{
   int l, r;
   cin >> l >> r;
   bool flag = 0;
   int a = 0, b = 0, c = 0;
   for (int i = 31; i >= 0; i--)
   {
      int l_bit = (l & (1LL << i)) > 0;
      int r_bit = (r & (1LL << i)) > 0;
      if (l_bit == r_bit && !flag)
      {
         if (l_bit)
         {
            a |= (1LL << i);
            b |= (1LL << i);
            c |= (1LL << i);
         }
      }
      else
      {
         if (flag == 0)
         {
            flag = 1;
            a |= (1LL << i);
         }
         else
         {
            b |= (1LL << i);
         }
      }
   }
   cout << a << " " << b << " " << c << endl;
}
int32_t main()
{
   fast int t;
   cin >> t;
   while (t--)
      solve();
   return 0;
}

Code 2:
#include <bits/stdc++.h>
using namespace std;
#define vii vector<vector<int>>
#define vi vector<int>
#define pb push_back
#define int long long
#define double long double
#define fi first
#define se second
#define s(v) sort(v.begin(), v.end())
#define r(v) reverse(v.begin(), v.end())
#define fast                         \
   ios_base::sync_with_stdio(false); \
   cin.tie(NULL);                    \
   cout.tie(NULL);
void solve()
{
   int l, r;
   cin >> l >> r;
   bool flag = 0;
   int a = 0, b = 0, c = 0;
   for (int i = 31; i >= 0; i--)
   {
      int l_bit = (l & (1LL << i)) > 0;
      int r_bit = (r & (1LL << i)) > 0;
      if (l_bit == r_bit && !flag)
      {
         if (l_bit)
         {
            a |= (1LL << i);
            b |= (1LL << i);
            c |= (1LL << i);
         }
      }
      else
      {
         if (flag == 0)
         {
            flag = 1;
            a |= (1LL << i);
            c |= (1LL << i);
         }
         else
         {
            b |= (1LL << i);
            // c |= (1LL << i);
         }
      }
   }
   for (int i = l; i <= r; i++)
   {
      if (i != a && i != b)
      {
         cout << a << " " << b << " " << i << endl;
         return;
      }
   }
}
int32_t main()
{
   fast int t;
   cin >> t;
   while (t--)
      solve();
   return 0;
}

Answer: 2
Problem: 2057C - Trip to the Olympiad
Language: c++17 

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

int get_highest_diff_bin_bit(int l, int r){
    int diff = (l ^ r);
    int cnt = 0;
    while(diff){
        diff >>= 1;
        cnt++;
    }
    return cnt;
}

int get_bit_num(int n){
    int cnt = 0;
    while(n){
        n >>= 1;
        cnt++;
    }
    return cnt;
}

int rand_from_l_to_r(int l, int r, int first, int second){
    int res = rand() % (r - l + 1) + l;
    // cout << "l: "<<l << " r: "<<r << endl;
    while (res == first || res == second)
    {
        res = rand() % (r - l + 1) + l;
        
    }
    return res;
}


int main(){
    int k,l,r;
    cin >> k ;
    for (int i=0; i< k; i++){
        cin >> l >> r;
        //cout << two_sum << endl;
        int first =  l >> (get_highest_diff_bin_bit(l, r)-1);
        // cout << "prefix:" << first << endl;
        first <<= (get_highest_diff_bin_bit(l, r)-1);
        
        int mask = (1 << (get_highest_diff_bin_bit(l, r)-1)) - 1;

        first |= mask;
        
        int second = r >> (get_highest_diff_bin_bit(l, r)-1);
        // cout << "prefix:" << second << endl;
        second <<= (get_highest_diff_bin_bit(l, r)-1);
        
        int third = rand_from_l_to_r(l, r, first, second);
        cout << first << " " << second << " " << third << endl;
    }
    
    return 0;
}

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

int get_highest_diff_bin_bit(int l, int r){
    int diff = (l ^ r);
    int cnt = 0;
    while(diff){
        diff >>= 1;
        cnt++;
    }
    return cnt;
}

int get_bit_num(int n){
    int cnt = 0;
    while(n){
        n >>= 1;
        cnt++;
    }
    return cnt;
}


int main(){
    int k,l,r;
    cin >> k ;
    for (int i=0; i< k; i++){
        cin >> l >> r;
        //cout << two_sum << endl;
        int first =  l >> (get_highest_diff_bin_bit(l, r)-1);
        // cout << "prefix:" << first << endl;
        first <<= (get_highest_diff_bin_bit(l, r)-1);
        
        int mask = (1 << (get_highest_diff_bin_bit(l, r)-1)) - 1;

        first |= mask;
        
        int second = r >> (get_highest_diff_bin_bit(l, r)-1);
        // cout << "prefix:" << second << endl;
        second <<= (get_highest_diff_bin_bit(l, r)-1);
        
        int third = l+1;
        cout << first << " " << second << " " << third << endl;
    }
    
    return 0;
}

Answer: 1
Problem: 2057C - Trip to the Olympiad
Language: c++17 

Code 1:
#include <bits/stdc++.h>
using namespace std;
#define int long long int

#define fastio() ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)

void solve(int t) {
    int l,r;
    cin>>l>>r;

    int max_val = l;

    for(int i=0;i<30;i++){
        int num = pow(2,i);
        if(num>=l&&num<=r) max_val=max(max_val,num);
    }

    // If-else case
    int a,b,c;

    if(max_val==l){

        a=l;
        b=l+1;
        c=r;

    }else if(max_val==r){

        a=r;
        b=r-1;
        c=l;

    }else{

        a=max_val;
        b=a-1;
        int check1 = (a^r)+(b^r);
        int check2 = (a^l)+(b^l);
        if(check1>check2) c=r;
        else c=l; 
        if(b==l) c=r;

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

signed main() {
    fastio();

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

    int t; t = 1;
    cin >> t;

    for (int i = 0; i < t; i++) {
         solve(i);
    }
    return 0;
}

Code 2:
#include <bits/stdc++.h>
using namespace std;
#define int long long int

#define fastio() ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)

void solve(int t) {
    // int l,r;
    // cin>>l>>r;

    // int max_val = l;

    // for(int i=0;i<30;i++){
    //     int num = pow(2,i);
    //     if(num>=l&&num<=r) max_val=max(max_val,num);
    // }

    // // If-else case
    // int a,b,c;

    // if(max_val==l){

    //     a=l;
    //     c=r;
    //     int num1 = -1;

    //     for(int i=l+1;i<r;i++){
    //         if(num1<=((a^i)+(c^i))){
    //             num1 = max(num1,(a^i+c^i));
    //             b=i;
    //         }
    //     }

    // }else if(max_val==r){

    //     a=r;
    //     b=r-1;
    //     c=l;

    // }else{

    //     a=max_val;
    //     b=a-1;
    //     int check1 = (a^r)+(b^r);
    //     int check2 = (a^l)+(b^l);
    //     if(check1>check2) c=r;
    //     else c=l; 
    //     if(b==l) c=r;

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

    int l, r;
    cin >> l >> r;
    int k = 31 - __builtin_clz(l ^ r); // Trailing zeroes of l^r
    int a =(pow(2,k) - 1);
    a=a|l;
    int b = a + 1; 
    int c = (a == l ? r : l);
    cout << a << " " << b << " " << c << "\n";
}

signed main() {
    fastio();

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

    int t; t = 1;
    cin >> t;

    for (int i = 0; i < t; i++) {
         solve(i);
    }
    return 0;
}



Answer: 2
Problem: 2057C - Trip to the Olympiad
Language: c++23 

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

int main() {
	int t, l, r;
	cin >> t;
	while (t--) {
		cin >> l >> r;
		int a = l | ((1 << (int)(log2(l ^ r))) - 1);
		int b = a + 1;
		int c = (b == r ? l : r);
		cout << a << ' ' << b << ' ' << c << endl;
	}
	return 0;
}

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

int main() {
	int t, l, r;
	cin >> t;
	while (t--) {
		cin >> l >> r;
		int a = 1 << ((int)log2(r));
		int b = (a - 1 >= l ? a - 1 : a + 1);
		int c = (a == r ? l : r);
		cout << a << ' ' << b << ' ' << c << endl;
	}
	return 0;
}

Answer: 1