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

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

#define int long long
#define debug(x) std::cerr<<"The "<<#x<<" = "<<x<<'\n';

using i128 = __int128;
using i64 = long long;
using u64 = unsigned long long;

constexpr int N = 1e6 + 5;
constexpr int mod = 998244353;
constexpr i64 INF = 0x7fffffffffffffffLL;

void solve() {
    int l, r;
    std::cin >> l >> r;
    int now = 0;
    for (int i = 30; i >= 0; i--) {
        if ((l >> i & 1) != (r >> i & 1)) {
            int x = (1LL << i) - 1, y = 0;
            x += now, y += now + (1LL << i);
            std::cout << x << " " << y << " " << ((x != l && y != l) ? l : r) << '\n';
            return ;
        }
        now += ((l >> i & 1) ? (1LL << i) : 0);
    }
}

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

Code 2:
#include<iostream>
#include<cmath>
#include<algorithm>
#include<set>
#include<vector>
#include<queue>
#include<map>
#include<cstring>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define ll long long
unordered_set<ll>sett;
int main()
{
    ll t;
    cin>>t;
    for(ll k1=1;k1<=t;k1++)
    {
        ll i,j,k,cnt1=0,cnt2=0,l,r;
        cin>>l>>r;
        ll base=r;
        while(base>0) base/=2,cnt1++;
        for(i=cnt1;i>=1;i--)
        {
            base=pow(2,i-1);
            ll x=r/base;
            x*=base;
            if(x>l)
            {
                if(x!=r) cout<<x<<" "<<x-1<<" "<<x+1<<endl;
                else cout<<x<<" "<<x-1<<" "<<x-2<<endl;
                break;
            }
        }
    }
}

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

Code 1:
#include <bits/stdc++.h>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <math.h>
#include <set>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll  long long
// const ll MOD = 998244353 ;
// inline ll mul(ll a1, ll a2) { return ((a1 * a2) % MOD); }
// inline ll sum(ll a1, ll a2) { return ((a1 + a2) % MOD); }
// inline ll sub(ll a1, ll a2) { return  ((a1 - a2 + MOD) % MOD); }
int main() {
    IOS
    int test ;
    cin>>test;
    while(test--) {
        ll l , r ;
        cin>>l>>r;
        ll z = 1 ,  x = l ^ r ;
        while( x % z == 0 ) {
            z *= 2 ;
        }
        z /= 2 ;
        x = z ;
        z *= (r/z) ;
        if(z<=l) {
            z +=x ;
        }
        ll a1 = z , a2 = z - 1 , a3;
        ll max = -1  ;
        for( int i = l ; i <= r ; i++ ) {
            if ((i==a1)or(i==a2)) {
                continue ;
            }
            if ((i^a1)+(i^a2)>max) {
                max = i^a1 + i^a2 ;
                a3 = i ;
            }
        }
        cout<<a1<<" "<<a2<<" "<<a3<<endl;
    }
    return 0;
}

Code 2:
#include <bits/stdc++.h>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <math.h>
#include <set>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll  long long
// const ll MOD = 998244353 ;
// inline ll mul(ll a1, ll a2) { return ((a1 * a2) % MOD); }
// inline ll sum(ll a1, ll a2) { return ((a1 + a2) % MOD); }
// inline ll sub(ll a1, ll a2) { return  ((a1 - a2 + MOD) % MOD); }
int main() {
    IOS
    int test ;
    cin>>test;
    while(test--) {
        ll l , r ;
        cin>>l>>r;
        ll z = 1 ,  x = l ^ r ;
        int k = 31 - __builtin_clz(l ^ r);
        z = 1 << k ;
        ll a1 = l | (z-1) , a2 = a1 + 1 , a3 ;
        if(a1 == l) {
            a3 = r ;
        }else {
            a3 = l ;
        }
        cout<<a1<<" "<<a2<<" "<<a3<<endl;
    }
    return 0;
}

Answer: 2
Problem: 2057C - Trip to the Olympiad
Language: python

Code 1:
def read_list():
    return list(map(int, input().split()))


class Solution:
    def solve(self):
        l, r = tuple(read_list())

        t = 1
        while t * 2 <= r:
            t *= 2

        rm = 0
        while l >= t:
            l -= t
            r -= t
            rm += t
            t //= 2

        if l < t - 1:
            print(l + rm, t - 1 + rm, r + rm)
        elif l == t - 1:
            print(l + rm, t + rm, r + rm)


if __name__ == "__main__":
    tests = int(input())
    for _ in range(tests):
        Solution().solve()


Code 2:
def read_list():
    return list(map(int, input().split()))


def f(a, b, c):
    return (a ^ b) + (b ^ c) + (c ^ a)


class Solution:
    def solve(self):
        l, r = tuple(read_list())
        L = l
        R = r
        lb = []
        rb = []
        for _ in range(32):
            lb.append(l % 2)
            l //= 2
            rb.append(r % 2)
            r //= 2
        for i in range(31, -1, -1):
            if lb[i] != rb[i]:
                assert lb[i] == 0 and rb[i] == 1
                X = L | ((1 << i) - 1)
                if L < X:
                    print(L, X, X + 1)
                else:
                    print(X, X + 1, X + 2)
                break


if __name__ == "__main__":
    tests = int(input())
    for _ in range(tests):
        Solution().solve()


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

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

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
const int N = 1e8 ;
int main() {

ios_base::sync_with_stdio(false); cin.tie(NULL);

ll tt ; cin >> tt ;

while(tt--) {

    ll l , r ; cin >> l >> r ;
    
    ll a = 0 , b = 0 ;
    ll ind = -1 ;
    for( int i = 30 ; i >= 0 ; i--) {

            if((l & (1 << i)) != (r & (1 << i)) ) {
                ind = i ; break;
            }
            if(l & (1 << i)) {
                a += (1 << i) ;
                b = a;
            }
        }
    a += (1 << ind) ;
    ind--;
    for( int i = ind ; i >= 0; i--) {
        b += (1 << i) ;
    }
    ll c ;
    for( int i = l ; i <= r ; i++) {
        if(i != a && i != b) {
            c = i ; break;
        }
    }
    cout << a << " " << b << " " << c << "\n" ;
    }
}
   


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

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
const int N = 1e8 ;
int main() {

ios_base::sync_with_stdio(false); cin.tie(NULL);

ll tt ; cin >> tt ;

while(tt--) {

    ll l , r ; cin >> l >> r ;
    
    ll a = 0 , b = 0 , c = 0 ;
    ll ind = -1 ;
    for( int i = 30 ; i >= 0 ; i--) {

            if((l & (1 << i)) != (r & (1 << i)) ) {
                ind = i ; break;
            }
            if(l & (1 << i)) {
                a += (1 << i) ;
                c = b = a;
            }
        }
    a += (1 << ind) ;
    ind--;
    for( int i = ind ; i >= 0; i--) {
        b += (1 << i) ;
        if(i) c += (1 << i) ;
    }
    cout << a << " " << b << " " << c << "\n" ;
    }
}
   


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

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

using namespace std;
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vll vector<long long>
#define vpi vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define mapi map<int,int>
#define mapll map<ll,ll>
#define yes cout << "YES\n"
#define no cout<<"NO\n"
#define fori_n for(int i = 0; i<n; i++)
#define prans cout<<ans<<"\n";
#define mod 1000000007

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int t;
    cin >> t;
    while(t--){
        ll l, r;
        cin >> l >> r;
        ll x = round(powl(2, (ll)log2l(r)));
        ll y = x, sum = 0;
        while(y){
            if(sum+y-1>=l && sum+y>=l && sum+y<=r){
                break;
            }
            if(sum+y<=r)
            sum+=y;
            y/=2;
        }
        x = sum+y-1;
        y+=sum;
        ll z;
        if(r==y){
            z = r-2;
        }
        else z = r;
        cout << x << " " << y << " " << z << endl;
    }
    return 0;
}

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



void solve() {
	int l, r;
	cin >> l >> r;
	int idx = -1;
	int mid = 0;
	for (int i=30;i>=1;i--) {
		int a = l & (1 << i);
		int b = r & (1 << i);
		if (a == b) {
			idx = i;
			if (a > 0) mid += (1 << i);
		} else {
			break;
		}
	}
	mid += (1 << (idx-1));
	if (mid - 1 == l) {
		cout << l  << " " << mid + 1 << " " << mid << endl;
	} else {
		cout << l  << " " << mid - 1 << " " << mid << endl;
	}
	
//	int mid = 1;
//	while (mid * 2 <= r) {
//		mid = mid * 2;
//	}
//	if (l + 1 < mid) {
//		cout << l  << " " << mid - 1 << " " << mid << endl;
//	} else if (l == mid - 1) {
//		cout << l  << " " << mid << " " << r << endl;
//	} else {
//		// l >= mid
//		
//		cout << endl;
//	}
}

signed main() {
	ios::sync_with_stdio(false);
	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>
using namespace std;
void solve()
{
long long l,r;
cin>>l>>r;
long long ans=0;
long long a,b,c;
for(int i=30;i>=0;i--){
  long long b1 = (l&(1<<i));
  long long b2 = (r&(1<<i));
  if(b1==b2){
    ans += b1*(1<<i);
  }else {
    a = ans + (1<<i);
    b = a-1;
  }
}
for(long long i = l ;i<=r;i++){
  if(i!=a && i!=b) {
    c= i;
    break;
    }

}
cout<<a<<" "<<b<<" "<<c<<"\n";


}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    int t = 1;
    cin >> t;
    // cout<<t<<endl;
    while (t--)
    {
        solve();
    }
    return 0;
}





Code 2:
#include <bits/stdc++.h>
using namespace std;
void solve()
{
long long l,r;
cin>>l>>r;
long long ans=0;
long long a,b,c;
for(int i=30;i>=0;i--){
  long long b1=0,b2=0;
  if(l&(1LL<<i)) b1 =1 ;
  if(r&(1LL<<i)) b2 =1 ;  
  if(b1==b2){
    ans += b1*(1LL<<i);
  }else {
    a = ans + (1LL<<i);
    b = a-1;
    break;
  }
}
for(long long i = r ;i>=l;i--){
  if(i!=a && i!=b) {
    c= i;
    break;
    }

}
cout<<a<<" "<<b<<" "<<c<<"\n";


}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    int t = 1;
    cin >> t;
    // cout<<t<<endl;
    while (t--)
    {
        solve();
    }
    return 0;
}





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

Code 1:
#include <bits/stdc++.h>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <math.h>
#include <set>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll  long long
// const ll MOD = 998244353 ;
// inline ll mul(ll a1, ll a2) { return ((a1 * a2) % MOD); }
// inline ll sum(ll a1, ll a2) { return ((a1 + a2) % MOD); }
// inline ll sub(ll a1, ll a2) { return  ((a1 - a2 + MOD) % MOD); }
int main() {
    IOS
    int test ;
    cin>>test;
    while(test--) {
        ll l , r ;
        cin>>l>>r;
        ll z = 1 ,  x = l ^ r ;
        int k = 31 - __builtin_clz(l ^ r);
        z = 1 << k ;
        ll a1 = l | (z-1) , a2 = a1 + 1 , a3 ;
        if(a1 == l) {
            a3 = r ;
        }else {
            a3 = l ;
        }
        cout<<a1<<" "<<a2<<" "<<a3<<endl;
    }
    return 0;
}

Code 2:
#include <bits/stdc++.h>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <math.h>
#include <set>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll  long long
// const ll MOD = 998244353 ;
// inline ll mul(ll a1, ll a2) { return ((a1 * a2) % MOD); }
// inline ll sum(ll a1, ll a2) { return ((a1 + a2) % MOD); }
// inline ll sub(ll a1, ll a2) { return  ((a1 - a2 + MOD) % MOD); }
int main() {
    IOS
    int test ;
    cin>>test;
    while(test--) {
        ll l , r ;
        cin>>l>>r;
        ll z = 1 ,  x = l ^ r ;
        while( x % z == 0 ) {
            z *= 2 ;
        }
        z /= 2 ;
        ll a1 = l | (z-1) , a2 = a1 + 1 , a3;
        ll max = -1  ;
        for( int i = l ; i <= r ; i++ ) {
            if ((i==a1)or(i==a2)) {
                continue ;
            }
            if ((i^a1)+(i^a2)>max) {
                max = i^a1 + i^a2 ;
                a3 = i ;
            }
        }
        cout<<a1<<" "<<a2<<" "<<a3<<endl;
    }
    return 0;
}

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

Code 1:
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define fst first
#define scd second

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
using vi = vector<int>;
using vl = vector<ll>;
const ll INF = 1e18 + 7;
const int N = 5e6 + 7;
const int M = 5e8 + 7;
const int modN = 998244353;
mt19937_64 rng(time(0));

ll a[N];

void solve(){
    ll l, r;
    cin >> l >> r;
    ll num = log2(r);
    ll cur = 1ll << num;
    num--;
    while(cur <= l && num >= 0){
        if(cur + (1ll << num) <= r)
            cur += (1ll << num);
        num--;
    }
    cout << cur << " " << cur - 1 << " ";
    if(cur != r)
        cout << r << "\n";
    else
        cout << l << "\n";
}   
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll T;
    cin >> T;
    while(T--)
        solve();
    return 0;
}   


Code 2:
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define fst first
#define scd second

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
using vi = vector<int>;
using vl = vector<ll>;
const ll INF = 1e18 + 7;
const int N = 5e6 + 7;
const int M = 5e8 + 7;
const int modN = 998244353;
mt19937_64 rng(time(0));

ll a[N];

void solve(){
    ll l, r;
    cin >> l >> r;
    ll num = log2(r);
    ll cur = 1ll << num;
    num--;
    while((cur + 1ll << num) <= l && num >= 0){
        if(cur + (1ll << num) <= r)
            cur += (1ll << num);
        num--;
    }
    cout << cur << " " << cur - 1 << " ";
    if(cur != r)
        cout << r << "\n";
    else
        cout << l << "\n";
}   
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll T;
    cin >> T;
    while(T--)
        solve();
    return 0;
}   


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

Code 1:
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod = 1e9+7;
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
#define srt(x) sort(x.begin(),x.end());
#define print(x) for(int i = 0;i<x.size();i++)cout<<x[i]<<" ";cout<<"\n";

void solve() {
    int l,r;
    cin >> l >> r;
    int j = 0;
    int a = 0 , b = 0, c = 0;
    for(int i = 30;i>=0;i--){
        if((l&(1<<i))!=(r&(1<<i))){
            // both bits different
            j = i;
            break;
        }else{
            // same bits
            int x = l&(1<<i);
            a += (x << (i-1));
            b += (x << (i-1));
        }
    }
    a<<=1;
    for(int i = j-1;i>=0;i--){
        a<<=1;
        a+=1;
    }
    b <<= 1;
    b+=1;
    for(int i = j-1;i>=0;i--){
        b<<=1;
    }
    for(int i = l;i<=r;i++){
        if(a!=i && b!=i){
            c = i;
            break;
        }
    }
    cout<<a<<" "<<b<<" "<<c<<"\n";
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int _t;
    cin >> _t;
    while(_t--){
        solve();
    }
    
    return 0;
}



Code 2:
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod = 1e9+7;
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
#define srt(x) sort(x.begin(),x.end());
#define print(x) for(int i = 0;i<x.size();i++)cout<<x[i]<<" ";cout<<"\n";

void solve() {
    int l,r;
    cin >> l >> r;
    int j = 0;
    int a = 0 , b = 0, c = 0;
    for(int i = 30;i>=0;i--){
        if((l&(1<<i))!=(r&(1<<i))){
            // both bits different
            j = i;
            break;
        }else{
            // same bits
            int x = 0;
            if(l&(1<<i))x = 1;
            a += x*(1<<i);
            b += x*(1<<i);
        }
    }
    int x = 1;
    for(int i = j-2;i>=0;i--){
        x<<=1;
        x+=1;
    }
    a+=x;
    b+=(1<<(j));
    for(int i = l;i<=r;i++){
        if(a!=i && b!=i){
            c = i;
            break;
        }
    }
    cout<<a<<" "<<b<<" "<<c<<"\n";
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int _t;
    cin >> _t;
    while(_t--){
        solve();
    }
    
    return 0;
}



Answer: 2
Problem: 2057C - Trip to the Olympiad
Language: python

Code 1:
for _ in range(int(input())):
    b, a = map(int, input().split())
    k = (1 << ((a^b).bit_length()-1)) - 1
    print(b | k, b | k, a & (~k))

Code 2:
for _ in range(int(input())):
    b, a = map(int, input().split())
    k = (1 << ((a^b).bit_length()-1)) - 1
    if (b|k == b):
        m = (b|k)+2
    else:
        m = (b | k) -1
    print(b | k, m, (b | k) +1)

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 rep(i ,a ,b) for(int i =a;i<=b;++i)
#define endl '\n'
#define debug(a) cout<<#a<<'='<<a<<endl;
#define inf 0x3f3f3f3f
#define ls u<<1
#define rs u<<1|1
typedef pair<int,int> pii;
int ksm(int a , int b){
	int res = 1;
	while(b){
		if(b&1) res = res * a ;
		b >>= 1;
		a = a * a ;
	}
	return res;
}
void solve(){
   int l , r;
   cin>>l>>r;
   int cnt = 0;

   if(r - l == 2){
    cout<<l<<' '<<l+1<<' '<<l+2<<endl;
    return;
   }
   int ans = 0;
   while(1){
    int x = 1;
    while(x*2 <= r)x *=2;
    if(x <=l){
        ans +=x;
        r -=x;
        l -=x;
        continue;
    }
    if(x == r)cout<<x + ans<<' '<<x + ans-1<<' '<<l+ans<<endl;
    else cout<<x + ans<<' '<<x + ans-1<<' '<<r+ans<<endl;
    return;
    

   }
 
  
}
 
 
signed main(){
    ios::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    int _ = 1;
    cin>>_; 
    while(_--)solve();
    return 0;
}

Code 2:
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define rep(i ,a ,b) for(int i =a;i<=b;++i)
#define endl '\n'
#define debug(a) cout<<#a<<'='<<a<<endl;
#define inf 0x3f3f3f3f
#define ls u<<1
#define rs u<<1|1
typedef pair<int,int> pii;
int ksm(int a , int b){
	int res = 1;
	while(b){
		if(b&1) res = res * a ;
		b >>= 1;
		a = a * a ;
	}
	return res;
}
void solve(){
   int l , r;
   cin>>l>>r;
   int cnt = 0;
   int ans = 0;
   while(1){
    if(ksm(2 , cnt) <= r){
        ans = ksm(2 , cnt);
        cnt++;
    }
    else{
        break;
    }

   }
 
   if(ans -2 >= l){
    cout<<ans<<' '<<ans-1<<' '<<l<<endl;
    return;
   }
    if(r - l >= 5){
        cout<<l<<' '<<l+2<<' '<<l+2+3<<endl;
        return;
    }
    cout<<l<<' '<<l+1<<' '<<l+2<<endl;
}
 
 
signed main(){
    ios::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    int _ = 1;
    cin>>_; 
    while(_--)solve();
    return 0;
}

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

Code 1:
#include<bits/stdc++.h>
using namespace std;
int T,l,r,x;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>T;while(T--){
		cin>>l>>r;
		for(int i=29;i;i--)
			if(((l>>i)^(r>>i))&1){
				x=(r>>i|1)<<i;
				cout<<x<<' ';
				cout<<x-1<<' ';
				if(x==r)cout<<l<<'\n';
				else cout<<r<<'\n';
				break;
			}
	} 
	return 0;
}

Code 2:
#include<bits/stdc++.h>
using namespace std;
int T,l,r,x;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>T;while(T--){
		cin>>l>>r;
		for(int i=29;i;i--)
			if(((l>>i)^(r>>i))&1){
				x=(r>>i|1)<<i;
				cout<<x<<' ';
				cout<<x-1<<' ';
				cout<<x-1<<'\n';
				break;
			}
	} 
	return 0;
}

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

Code 1:
#include "bits/stdc++.h"
using namespace std;
#define all(v) v.begin(), v.end()
#define debug(x) cout<< #x<<'='<<x<<endl;
#define ll long long
#define pb push_back
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 
    int t;
    cin>>t;
    while(t--){
     int l,r;
     cin >> l >> r;
     int temp = 0;
     for(int i = 30; i >= 0; i--){
         if(((l>>i)&1))temp^=(1<<i);
         else if((temp^(1<<i)) <= r){
            if(((temp|((1<<i)-1)) == l) && (i == 1)){
                cout << l << " " << (temp|(1<<i)) << " " << (temp|((1<<(i+1))-1)) << endl;
            }
            else if(((temp|((1<<i)-1)) == l)){
                cout << l << " " << (temp|(1<<i)) << " " << (temp|(((1<<(i+1))-1)^(1<<(i-1)))) << endl;
            }
            else {
            cout << l << " " << (temp|(1<<i)) << " " << (temp|(1<<i))-1 << endl;
            }
            break;
         }
     }
}
}

Code 2:
#include "bits/stdc++.h"
using namespace std;
#define all(v) v.begin(), v.end()
#define debug(x) cout<< #x<<'='<<x<<endl;
#define ll long long
#define pb push_back
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 
    int t;
    cin>>t;
    while(t--){
     int l,r;
     cin >> l >> r;
     int temp = 0;
     for(int i = 30; i >= 0; i--){
         if(((l>>i)&1))temp^=(1<<i);
         else if((temp^(1<<i)) <= r){
            if(((temp|((1<<i)-1)) == l)){
                cout << l << " " << (temp|(1<<i)) << " " << (temp|((1<<(i))+1)) << endl;
            }
            else {
            cout << l << " " << (temp|(1<<i)) << " " << (temp|(1<<i))-1 << endl;
            }
            break;
         }
     }
}
}

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

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

int main(){
    ll t;
    cin>>t;
    while(t--){
        ll l,r;
        cin>>l>>r;
        ll a,b,c;
        ll ans=0;
        for(int i=30;i>=0;i--){
            ll b1=0;
            ll b2=0;
            if(l & (1ll << i)) 
                b1=1;
            if(r & (1ll << i)) 
                b2=1;
            if(b1==b2){
                ans+=b1*(1ll <<i);
            }
            else{
                a=ans+(1ll << i);
                b=a-1;
                break;
            }
        }
        for(ll i=l;i<=r;i++){
            if(i!=a && i!=b){
                c=i;
                break;
            }
        }
        cout << a << " " << b << " " << c << endl;
    }
    return 0;
}

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

int reverseBits(int n)
{
    int rev = 0;
    while (n > 0) {
        rev <<= 1;
 
        if (n & 1 == 1)
            rev ^= 1;
        n >>= 1;
    }
 
    return rev;
}

int main(){
    int t;
    cin>>t;
    while(t--){
		int a,b;
		cin>>a>>b;
        int c=a+reverseBits(a^b);
        cout<<a<<" "<<b<<" "<<c<<endl;
        
    }
    return 0;
}

Answer: 1