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

Code 1:
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include<functional> 
//using namespace __gnu_pbds;
using namespace std;
#define ull unsigned long long
#define ll long long 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rf(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(), v.end()
#define vec vector<ll>
#define pb push_back
#define Raftaar ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MEX LONG_LONG_MAX
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
/*


*/                 
            


void solve(){
	ll l,r;
	cin>>l>>r;
	ll a = l;
	ll b = r;

	ll c=0;
	rf(i,30,0){
		ll mask=(1<<i);
		if((a&mask)==0 && (b&mask)==0){
			c|=mask;
		}
		else if ((a&mask)==0 && (b&mask)!=0){
			c|=mask;
		}
	}
	if(c<l || c>r){
		if(l==r){
			c=l;
		}
		else{
			c=l+1;
		}
	}
	cout<<a<<" "<<b<<" "<<c<<endl;
}

int main(){
	Raftaar
	int t=1;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


Code 2:
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include<functional> 
//using namespace __gnu_pbds;
using namespace std;
#define ull unsigned long long
#define ll long long 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rf(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(), v.end()
#define vec vector<ll>
#define pb push_back
#define Raftaar ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MEX LONG_LONG_MAX
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
/*


*/                 
            


void solve(){
	ll l,r;
	cin>>l>>r;
	ll prev=0;
	ll a,b,c;
	rf(i,30,0){
		ll p=0,q=0;
		if(l & (1ll<<i)){
			p=1;
		}
		if(r & (1ll<<i)){
			q=1;
		}
		if(p==q){
			prev+=(p*(1ll<<i));
		}
		else{
			a=prev+(1ll<<i);
			b=a-1;
			break;
		}
	}
	f(i,l,r+1){
		if(i!=a && i!=b){
			c=i;
			break;
		}
	}
	cout<<a<<" "<<b<<" "<<c<<endl;
}

int main(){
	Raftaar
	int t=1;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


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

Code 1:
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
const int N=2e5+7;

void solved(){
    int  l,r;cin>>l>>r;
    int flag=0;
    int a=0,b=0,c=0;
    for(int i=30;i>=0;i--){
        int x=(l>>i)&1;
        int y=(r>>i)&1;
        int t=(1ll<<i);
        if(x==1 and y==1 and flag==0){
            a+=t;
            b+=t;
            c+=t;
            continue;
        }
        if((x==1 or y==1) and flag==0){
            flag=1;
            a+=t;
            b+=0;
            c+=0;
            continue;
        }
        if(flag){
            a+=0;
            b+=t;
            c+=t;
        }
    }
    if(r-l==2){
        cout<<l<<" "<<l+1<<" "<<l+2<<'\n';
        return;
    }
    if(b==c){
        c--;
    }
    cout<<a<<" "<<b<<" "<<c<<'\n';
}

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


Code 2:
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
const int N=2e5+7;

void solved(){
    int  l,r;cin>>l>>r;
    int flag=0;
    int a=0,b=0,c=0;
    for(int i=30;i>=0;i--){
        int x=(l>>i)&1;
        int y=(r>>i)&1;
        int t=(1ll<<i);
        if(x==1 and y==1 and flag==0){
            a+=t;
            b+=t;
            c+=t;
            continue;
        }
        if((x==1 or y==1) and flag==0){
            flag=1;
            a+=t;
            b+=0;
            c+=0;
            continue;
        }
        if(flag){
            a+=0;
            b+=t;
            c+=t;
        }
    }
    if(r-l==2){
        cout<<l<<" "<<l+1<<" "<<l+2<<'\n';
        return;
    }
    if(b==c){
        if(c-1<l){
            a++;
            b++;
        }else{
            c--;
        }
    }
    cout<<a<<" "<<b<<" "<<c<<'\n';
}

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


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

Code 1:
#include <bits/stdc++.h>
#define fi first
#define se second

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int t;
int l, r;

void solve() {
    cin >> l >> r;
    int x = r;

    int k = 0;
    for (int i = 0; i <= 30; i++) {
        if (x & (1 << i)) {
            k = i;
        }
    }
    int y = 0;
    for (int i = 0; i <= k; i++) {
        if ((x & (1 << i)) == 0) {
            y |= (1 << i);
        }
    }

    if (y < l)
        y |= l;

    if (y + 1 >= r) {
        cout << x << " " << y << " " << y - 1 << "\n";
    } else {
        cout << x << " " << y << " " << y + 1 << "\n";
    }
}

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


Code 2:
#include <bits/stdc++.h>
#define fi first
#define se second

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int t;
int l, r;

void solve() {
    cin >> l >> r;
    // int x = r;

    int k = 0;
    for (int i = 0; i <= 30; i++) {
        if (r & (1 << i)) {
            k = i;
        }
    }
    int base = 0;
    int start = -1;
    for (int i = k; i >= 0; i--) {
        if ((r & (1 << i)) != 0 && (l & (1 <<i)) != 0) {
            base |= (1 << i);
        } else if (r & (1 << i)) {
            start = i;
            break;
        }
    }

    int x = base + (1 << start);
    int y = base + (1 << start) - 1;
    int z = 0;
    if (x + 1 > r) {
        z = y - 1;
    } else {
        z = x + 1;
    }

    cout << x << " " << y << " " << z << "\n";

}

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


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

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

void solve(){
    ll l, r;
    cin >> l >> r;
    ll ans = 0;
    ll firstNum = 0, secondNum = 0;
    for (int i = 30; i >= 0; i--) {
        int b1 = 0, b2 = 0;
        if ((1 << i) & r) {
            b1 = 1;
        } 
        if ((1 << i) & l) {
            b2 = 1;
        }

        if (b1 == b2) {
            ans += b1 * (1 << i);
        } else {
            firstNum += ans + (1 << i);
            secondNum += firstNum - 1;
            break;
        }
    }
    for (ll i = l; i <= r; i++) {
        if (i != firstNum && i != secondNum) {
            cout << i << " " << firstNum << " " << secondNum << '\n';
            break;
        }
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    cin>>t;
    while(t--){
        solve();
    }
}

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

void solve(){
    ll l, r;
    cin >> l >> r;
    ll ans = 0;
    ll firstNum = 0, secondNum = 0;
    for (int i = 30; i >= 0; i--) {
        int b1 = 0, b2 = 0;
        if ((1 << i) & r) {
            b1 = 1;
        } 
        if ((1 << i) & l) {
            b2 = 1;
        }

        if (b1 == b2) {
            ans += b1 * (1 << i);
        } else {
            firstNum += ans + (1 << i);
            secondNum += firstNum - 1;
            break;
        }
    }
    for (ll i = l; i < r; i++) {
        if (i != firstNum && i != secondNum) {
            cout << i << " " << firstNum << " " << secondNum << '\n';
            break;
        }
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
    int t = 1;
    cin>>t;
    while(t--){
        solve();
    }
}

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

Code 1:
#include <bits/stdc++.h>
#define fi first
#define se second

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int t;
int l, r;

void solve() {
    cin >> l >> r;
    // int x = r;

    int k = 0;
    for (int i = 0; i <= 30; i++) {
        if (r & (1 << i)) {
            k = i;
        }
    }
    int base = 0;
    int start = -1;
    for (int i = k; i >= 0; i--) {
        if ((r & (1 << i)) != 0 && (l & (1 <<i)) != 0) {
            base |= (1 << i);
        } else if (r & (1 << i)) {
            start = i;
            break;
        }
    }

    int x = base + (1 << start);
    int y = base + (1 << start) - 1;
    int z = 0;
    if (x + 1 > r) {
        z = y - 1;
    } else {
        z = x + 1;
    }

    cout << x << " " << y << " " << z << "\n";

}

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


Code 2:
#include <bits/stdc++.h>
#define fi first
#define se second

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int t;
int l, r;

void solve() {
    cin >> l >> r;
    int x = r;

    int k = 0;
    for (int i = 0; i <= 30; i++) {
        if (x & (1 << i)) {
            k = i;
        }
    }
    int y = 0;
    for (int i = 0; i <= k; i++) {
        if ((x & (1 << i)) == 0) {
            y |= (1 << i);
        }
    }

    // if (y < l)
    y |= l;

    if (y + 1 >= r) {
        cout << x << " " << y << " " << y - 1 << "\n";
    } else {
        cout << x << " " << y << " " << y + 1 << "\n";
    }
}

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


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

Code 1:
#include<bits/stdc++.h>
using namespace std;
ifstream fin("window.in");
ofstream fout("window.out");
void solve(){
    int l,r;
    cin>>l>>r;
    int b(30),prc(0);
    while(((1<<b)&l)==((1<<b)&r))prc+=((1<<b)&r),b--;
    if(prc+(1<<b)==r)cout<<prc+(1<<b)<<" "<<prc+(1<<b)-1<<" "<<prc+(1<<b)-2<<"\n";
    else cout<<prc+(1<<b)<<" "<<prc+(1<<b)-1<<" "<<prc+(1<<b)+1<<"\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long t;
    cin>>t;
    while(t--)solve();
    return 0;
}


Code 2:
#include<bits/stdc++.h>
using namespace std;
ifstream fin("window.in");
ofstream fout("window.out");
void solve(){
    int l,r;
    cin>>l>>r;
    int b(30);
    while(((1<<b)&l)==((1<<b)&r))b--;
    cout<<(1<<b)<<" "<<(1<<b)-1<<" "<<(1<<b)-1<<"\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long t;
    cin>>t;
    while(t--)solve();
    return 0;
}


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

Code 1:
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int T, l, r;
void solve() {
    cin >> l >> r;
    bitset <32> x(l), y(r), ans(0);
    int tp = 31;
    for (; ~tp; tp --) if (x[tp] ^ y[tp]) break;
    for (int i = 31; i > tp; i --) ans[i] = x[i];
    for (int i = tp; ~i; i --) {
        if (!(x[i] ^ y[i])) ans[i] = x[i] ^ 1;
    }
    for (int i = tp; ~i; i --) {
        if (x[i] ^ y[i]) {
            ans[i] = 1;
            if (ans.to_ulong() >= y.to_ulong()) ans[i] = 0;
        }
    }
    int a = x.to_ulong(), b = ans.to_ulong(), c = y.to_ulong();
    cout << a << ' ' << b << ' ' << c << '\n';
}
int32_t main() {
    cin.tie(NULL) -> sync_with_stdio(false);
    for (cin >> T; T --; ) solve();
    return 0;
}

Code 2:
#include<bits/stdc++.h>
using namespace std;
int ls, rs;
inline void slove() {
	int l, r; cin >> l >> r;
	int steps = 0, ans = 0;
	while (r >> steps) {
		ls = l >> steps & 1, rs = r >> steps & 1;
		if (ls != rs)
			if ((ans | (1 << steps)) <= r)ans |= (1 << steps);
		if (ls == rs)
			ans |= ((ls ^ 1) << steps);
		steps++;
	}
	cout << l<<" "<< ans<<" " << r << endl;
}
int main() {
	int T; cin >> T;
	while (T--) {
		slove();
	}
	return 0;
}

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

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

using i64 = long long;

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

    int a = l, c = r, b = 0;
    bool ok = false;
    int pos;
    for (int i = 30; i >= 0; i --) {
        int x = a >> i & 1;
        int y = c >> i & 1;
        if (x ^ y) {
            pos = i;
            break;
        }
    }

    for (int i = 30; i > pos; i --) {
        int x = a >> i & 1;
        b += x << i;
    }

    for (int i = pos; i >= 0; i --) {
        int x = a >> i & 1;
        int y = c >> i & 1;
        if (x ^ y) {
            if (b + (1 << i) < c) {
                b += 1 << i;
            }
        } else {
            b += (!x) << i;
        }
    }

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

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(20);

    int T = 1;
    std::cin >> T;

    while (T --) {
        solve();
    }

    return 0;
}

Code 2:
// Author: Debjit Saha

#include <bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define int long long
#define lld long double
// #define ll long long
#define endl '\n'
#define tab '\t'
#define all(a) a.begin(), a.end()
#define vi vector<int>
#define vp vector<pair<int, int>>
#define vvi vector<vector<int>>
#define vb vector<bool>
#define vs vector<string>
#define mii map<int, int>
#define rep(n) for(int i=0;i<n;i++)
#define REP(i, n) for(int i=0;i<n;i++)
#define trev(x) for(auto it=x.begin(); it!=x.end(); it++)
#define yes(check) cout << (check ? "YES\n" : "NO\n")
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a*b/gcd(a,b)
const int mod=1e9+7;
// const int mod = 998244353;

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

	int sum = 0, p = 32, one = 1;
	while(p > 0) {
		int a = (l>>p) % 2;
		int b = (r>>p) % 2;
		if(a ^ b) {
			sum += (one<<p) - 1;
			break;
		}
		if(b) sum += (one<<p);
		p--;
	}
	// int a = sum+1, b = sum, c = sum-1;
	// int res = (a^b) + (b^c) + (c^a);
	if(sum-1 < l) sum++;
	cout << sum+1 << " " << sum << " " << sum-1 << " " << endl;
}

signed main() {
    fastIO;

    int t;
    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 pb push_back
#define endl "\n"
#define all(x) (x).begin(),(x).end()
#define x first
#define y second
#define int long long
typedef pair<int,int> pii;
typedef double db;
typedef long long LL;
const int N = 1e6+10;



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

}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin.tie(0);

    int _ = 1;
    cin>>_;
    while(_--)
    {
        solve();
    }

    return 0;
}


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

#define pb push_back
#define endl "\n"
#define all(x) (x).begin(),(x).end()
#define x first
#define y second
#define int long long
typedef pair<int,int> pii;
typedef double db;
typedef long long LL;
const int N = 1e6+10;



void solve(){
    int l, r;
    cin >> l >> r;
    int op = 1;
    for (int i = 1 ; i <= 30; i  ++){
        op *= 2;
    }
    int t = r;
    while(op){
        if(r / op && (l / op) == 0 ){
            //cout << "h" << endl;
            t /= op * 2;
            t *= op * 2;
            if(r != op){
                    op += t;
                cout << op   + 1<< " " << op << " " <<  op - 1  << endl;
            }
            else {
                op += t;
                cout << op << " " << op - 1 << " " << op - 2 << endl;
            }
            return ;
        }
        if(r /op && l / op){
            r %= op;
            l %= op;
        }
        //cout << op << " " << r / op << " " << (l / op) << endl;
        op /= 2;
    }

}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin.tie(0);

    int _ = 1;
    cin>>_;
    while(_--)
    {
        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 eb emplace_back

int mod=1e9+7;

int32_t main(){
	int t;
	cin>>t;

	while(t--){
		int l,r;
        cin>>l>>r;
        int x,z, ans=0;

        for(int i=30; i>=0; i--){
            int b1=0, b2=0;

            if(l & (1LL<<i)) b1=1; 
            if(r & (1LL<<i)) b2=1; 

            if(b1==b2){
                ans+=b1 * (1LL<<i);
            }

            else{
                x=ans+ (1LL<<i);
                break;
            }
        }

        for(int i=r; i>=l; i--){
            if(i!=x && i!=x-1){
                z=i;
                break;
            } 
        }

        cout<<x<<" "<<x-1<<" "<<z<<endl;
	}
	
	return 0;
}

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

int mod=1e9+7;

int32_t main(){
	int t;
	cin>>t;

	while(t--){
		int l,r;
        cin>>l>>r;
        int x,z;

        for(int i=r; i>=l; i--){
            if((i & i-1)==0){
                x=i;
                break;
            } 
        }

        for(int i=r; i>=l; i--){
            if(i!=x && i!=x-1){
                z=i;
                break;
            } 
        }

        cout<<x<<" "<<x-1<<" "<<z<<endl;
	}
	
	return 0;
}

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

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

using namespace std;
using ll=long long;

void solve(){
    int l,r;
    cin>>l>>r;
    if(r-l+1==3){
        cout<<l<<' '<<l+1<<' '<<l+2<<'\n';
        return ;
    }
    int p=-1;
    vector<int> ans[3];
    for(int i=30 ; i>=0; i--){
        if((r&(1<<i))!=(l&(1<<i))){
            p=i;
            ans[0].push_back(0);
            ans[1].push_back(0);
            ans[2].push_back(1);
            break;
        }
        else{
            ans[0].push_back((r>>i)&1);
            ans[1].push_back((r>>i)&1);
            ans[2].push_back((r>>i)&1);
        }
    }
    bool flag=true;
    for(int i=p-1 ; i>=0; i--){
        if((l&(1<<i))==0){
            flag=false; ans[0].push_back(1); ans[1].push_back(0);
            ans[2].push_back(0);
        }
        else{
            ans[0].push_back(1); ans[1].push_back(1); ans[2].push_back(0);
        }
    }
    if(flag){
        for(int i=30,j=0; j<p ; j++,i--){
            ans[1][i]=0;
        }
        ans[1][30-p]=1;
        ans[2][30]=1;
    }
    vector<ll> res(3);
    for(int i=0,j=30 ; i<=30; i++,j--){
        for(int k=0; k<3 ; k++){
            res[k]+=(ll)(ans[k][i]<<j);
        }
    }
    for(int i=0; i<3 ; i++) cout<<res[i]<<' ';
    cout<<'\n';
}

signed main(){
    cin.tie(nullptr)->sync_with_stdio(0);
    cout.tie(nullptr)->sync_with_stdio(0);
    int t;
    cin>>t;
    while(t--) solve();
}

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

using namespace std;
using ll=long long;

void solve(){
    int l,r;
    cin>>l>>r;
    int p=-1;
    vector<int> ans[3];
    for(int i=30 ; i>=0; i--){
        if((r&(1<<i))!=(l&(1<<i))){
            p=i;
            ans[0].push_back(0);
            ans[1].push_back(0);
            ans[2].push_back(1);
            break;
        }
        else{
            ans[0].push_back(r&(1<<i));
            ans[1].push_back(r&(1<<i));
            ans[2].push_back(r&(1<<i));
        }
    }
    bool flag=true;
    for(int i=p-1 ; i>=0; i--){
        if((l&(1<<i))==0){
            flag=false; ans[0].push_back(1); ans[1].push_back(0);
            ans[2].push_back(0);
        }
        else{
            ans[0].push_back(1); ans[1].push_back(1); ans[2].push_back(0);
        }
    }
    if(flag){
        for(int i=30,j=0; j<p ; j++,i--){
            ans[1][i]=0;
        }
        ans[1][30-p]=1;
    }
    vector<ll> res(3);
    for(int i=0,j=30 ; i<=30; i++,j--){
        for(int k=0; k<3 ; k++){
            res[k]+=(ll)(ans[k][i]<<j);
        }
    }
    for(int i=0; i<3 ; i++) cout<<res[i]<<' ';
    cout<<'\n';
}

signed main(){
    cin.tie(nullptr)->sync_with_stdio(0);
    cout.tie(nullptr)->sync_with_stdio(0);
    int t;
    cin>>t;
    while(t--) solve();
}

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

Code 1:
#include <bits/stdc++.h>
 
using i64 = long long;
 
void solve() {
    int l, r;
    std::cin >> l >> r;
    int k = 31 - __builtin_clz(l ^ r);
    int a = l | ((1 << k) - 1), b = a + 1, c = (a == l ? r : l);
    std::cout << a << " " << b << " " << c << "\n";
}
 
signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
 
    int t = 1;
    std::cin >> t;
 
    while (t--) {
        solve();
    }
}

Code 2:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, std::less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define ln '\n'
#define ull unsigned  long long
#define ll long long 
#define vll vector<ll>
#define pll pair<ll, ll>
#define ff first
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int> 
#define ld long double
#define ss second
using namespace std;


void setIO(const string io="a"){
    freopen((io+".in").c_str(),"r",stdin) ;
    freopen((io+".out").c_str(),"w",stdout) ;
}
void f(ll a,ll b,ll c){
	cout << (a^b) + (a^c) + (b^c) << ln ;
}

void solve(){
	ll l , r ; cin >> l >> r ;
	ll n = log2(r)+1 ; 
	string s1 = "" ; for(ll i=0;i<n;i++) s1 += '0' ;
	ll a = r , i = n-1 ;
	while(a){
		if ((a&1ll)) s1[i] = '1' ;
		a>>= 1ll ; i-- ;
	}
	string s2 = "" ; for(ll i=0;i<n;i++) s2 += '0' ;
	ll b = l ;  i = n-1 ;
	while(b){
		if ((b&1ll)) s2[i] = '1' ;
		b>>= 1ll ; i-- ;
	}
	string s3 = "" ; for(ll i=0;i<n;i++) s3 += '0' ;
	ll pow = n-1 , val3 = 0 ; 
	for(ll i=0;i<n;i++){
		if (val3+(1ll<<pow)> r ) {
			pow-- ; continue ;
		}
		else if (val3 + (1ll<<pow)-1<l) s3[i] = '1'  ,val3 += (1ll<<pow); 
		else if (s1[i]=='0' and s2[i]=='0') s3[i] = '1' , val3 += (1ll<<pow); 
		pow-- ; 
	}
	if (l==val3) val3++ ;
	//cout << s1  << " " << s2 <<  " " << s3 << ln ;
	cout << r << " " <<  l<< " " << val3 << ln ;
	//f(r,l,val3) ;
	return ;
}
int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
//	setIO() ;
	ll t = 1 ; 
	cin >> t ;
	for(ll i=1;i<=t;i++){
		//cout << "Case " << i << ": " ;
		solve() ;
	}
    return 0;
}





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

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


void __solve(){
  int l,r;
  cin>>l>>r;
  int k=31- __builtin_clz(l^r);
  int a=l|((1<<k) -1);
  int b=a+1;
  int c=(a==l)?r:l;
  cout<<c<<" "<<a<<" "<<b<<'\n';
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  
  int t=1;
  cin>>t;
  while(t--){
    __solve();
  }
  
  return 0;
}

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


void __solve(){
  int l,r;
  cin>>l>>r;
  int k=31- __builtin_clz(l^r);
  int a=l|(1<<k -1);
  int b=a+1;
  int c=(a==l)?r:l;
  cout<<c<<" "<<a<<" "<<b<<'\n';
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  
  int t=1;
  cin>>t;
  while(t--){
    __solve();
  }
  
  return 0;
}

Answer: 1