Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
//              find_by_order(k) -> iterator to the kth largest element - zero indexed
//              order_of_key(k)  -> no. of items in that are strictly smaller than k
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll,ll>> vpll;
typedef vector<vpll> vvpll;
typedef vector<pair<ld , ld>> vplld;
typedef pair<ll,ll> pll;
typedef vector<pair<ll,pair<ll,ll>>> vppll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
#define fi first
#define se second
#define pb push_back
#define yes  cout << "YES" << endl
#define no  cout << "NO" << endl
#define mod1 998244353
#define mod 1000000007
#define print(a) for(auto x:a) cout<<x<<" ";cout<<endl;
#define printarr(nums,n) for(int i = 0 ; i < n  ;i ++) cout << nums[i] << " "; cout << endl;
#define inputarr(nums,n) for(int i=0;i<n;i++) cin>>nums[i];
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()


long long power(long long a,long long b){
    long long res=1;
    while(b){
        if(b%2==1){
            b--;
            res*=a;
        }
        else{
            a*=a;
            b/=2;
        }
    }
    return res;
}

long long mpower(long long a,long long b,long long p){
    long long res=1;
    while(b){
        if(b%2==1){
            b--;
            res=(res*a)%p;
        }
        else{
            a=(a*a)%p;
            b/=2;
        }
    }
    return res;
}

ll modinv(ll a,ll m){
    ll x=mpower(a,m-2,m);
    return x;
}
/*-----------------------------------------------------------------------------------------*/
void solve(){
    ll l,r;
    cin>>l>>r;

    vll a(32),b(32);
    ll start=0;

    for(int i=0;i<=31;i++){
        if(1&(r>>i)){
            b[i]=1;
            start=i;
        }
    }

    ll x=(1<<start);

    ll ans=0;

    if(r==x||r==x-1){
        ans=l;
    }
    else ans=r;

    cout<<x<<" "<<(x-1)<<" "<<ans<<endl;

}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t;
    cin >> t;
    while (t--) 
    solve();
    return 0;
}

Submission (verdict: Wrong answer on test 1):
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
//              find_by_order(k) -> iterator to the kth largest element - zero indexed
//              order_of_key(k)  -> no. of items in that are strictly smaller than k
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll,ll>> vpll;
typedef vector<vpll> vvpll;
typedef vector<pair<ld , ld>> vplld;
typedef pair<ll,ll> pll;
typedef vector<pair<ll,pair<ll,ll>>> vppll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
#define fi first
#define se second
#define pb push_back
#define yes  cout << "YES" << endl
#define no  cout << "NO" << endl
#define mod1 998244353
#define mod 1000000007
#define print(a) for(auto x:a) cout<<x<<" ";cout<<endl;
#define printarr(nums,n) for(int i = 0 ; i < n  ;i ++) cout << nums[i] << " "; cout << endl;
#define inputarr(nums,n) for(int i=0;i<n;i++) cin>>nums[i];
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()


long long power(long long a,long long b){
    long long res=1;
    while(b){
        if(b%2==1){
            b--;
            res*=a;
        }
        else{
            a*=a;
            b/=2;
        }
    }
    return res;
}

long long mpower(long long a,long long b,long long p){
    long long res=1;
    while(b){
        if(b%2==1){
            b--;
            res=(res*a)%p;
        }
        else{
            a=(a*a)%p;
            b/=2;
        }
    }
    return res;
}

ll modinv(ll a,ll m){
    ll x=mpower(a,m-2,m);
    return x;
}
/*-----------------------------------------------------------------------------------------*/
void solve(){
    ll l,r;
    cin>>l>>r;

    vll a(32),b(32);
    ll start=0;

    for(int i=0;i<=31;i++){
        if(1&(r>>i)){
            b[i]=1;
        }
        if(1&(l>>i)){
            a[i]=1;
        }
        if(a[i]!=b[i]) start=i;
    }

    ll x=(1<<start)|l;

    ll ans=0;

    if(r==x||r==x-1){
        ans=l;
    }
    else ans=r;

    cout<<x<<" "<<(x-1)<<" "<<ans<<endl;

}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t;
    cin >> t;
    while (t--) 
    solve();
    return 0;
}