Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;

// typedef int data_type;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<data_type, null_type,less<data_type>, rb_tree_tag,tree_order_statistics_node_update> 

//                 All set operations and below ones
//              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

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define bgn begin
#define ub upper_bound
#define lb lower_bound
#define endl '\n'

#define getArrInput(v, n) for(int i = 0; i < n; i++) cin>>v[i];
#define printArr(v, n) for(int i = 0; i < n; i++) cout<<v[i]<<" "; cout<<"\n";
#define print(a) for(auto x:a) cout<<x<<" ";cout<<endl;
#define yes  cout << "YES" << endl
#define no  cout << "NO" << endl
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sortall(x) sort(all(x))

typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef std::vector<ll> v_ll;
typedef std::vector<int> v_int;
typedef std::vector<bool> v_bool;
typedef std::vector<ld> v_ld;

typedef std::vector<pii> v_pii;
typedef std::vector<pll> v_pll;

typedef std::vector<v_ll> v2d_ll;
typedef std::vector<v_int> v2d_int;
typedef std::vector<v_bool> v2d_bool;
typedef std::vector<v_ld> v2d_ld;

typedef std::vector<v_pii> v2d_pii;
typedef std::vector<v_pll> v2d_pll;

#define create_pq(a) priority_queue<a>
#define create_graph(a) vector<vector<a>>


//-------------------------------GLOBAL VARIABLES AND CONSTANTS---------------------------
const int mod = 1000000007;
const int mod1 = 998244353;
const ll llmax = LLONG_MAX;
const ll llmin = LLONG_MIN;
const int imin = INT_MIN;
const int imax = INT_MAX;


//--------------------------------------IMPORTANT FUNCTIONS-------------------------------


// START OF MATRIX EXPONENTIATION
vector<v_ll> matrix_mul_mod(vector<v_ll>& m1, vector<v_ll>& m2, int mod){
    // ONLY FOR N x N MATRICES
    int n = m1.size();

    vector<v_ll> ans(n, v_ll(n, 0));

    for(int i = 0; i < n; i++){

        for(int j = 0; j < n; j++){

            for(int k = 0; k < n; k++){

                ans[i][j] = ( ans[i][j] + m1[i][k]*m2[k][j] )%mod;

            }
        }
    }

    return ans;
}

vector<v_ll> matrix_power_mod( vector<v_ll>& base, int exp, int mod){

    if(exp == 0){
        return {{}};
    }

    vector<v_ll> ans = base;
    exp--;

    while(exp > 0){

        if(exp&1){
            ans = matrix_mul_mod(ans, base, mod);
            exp--;
        }else{
            base = matrix_mul_mod(base, base, mod);
            exp /= 2;
        }

    }

    return ans;
}
// END OF MATRIX EXPONENTIATION


// TRANSPOSE OF A MATRIX
v2d_ll transpose(v2d_ll& v){
 
    int n = v.size(), m = v[0].size();
    v2d_ll ans(m, v_ll(n));
    for(int i = 0; i < n; i++){
        for(int j = 0; j  < m ; j++){
            ans[j][i] = v[i][j];
        }
    }
 
    return ans;
 
}


// XOR of 0 1 2...n
ll find_xor(ll n){
  if (n % 4 == 0) return n;
  if (n % 4 == 1) return 1;
  if (n % 4 == 2) return n + 1;
  return 0;
}

ll power(ll base, int exp){
    ll ans = 1;
    while(exp > 0){
        if(exp%2){
            ans = (ans*base);
            exp--;
        }else{
            base = (base*base);
            exp >>= 1;
        }
    }

    return ans;
}

ll power_mod(ll base, int exp, int mod){
    ll ans = 1;
    while(exp > 0){
        if(exp%2){
            ans = (ans*base)%mod;
            exp--;
        }else{
            base = (base*base)%mod;
            exp >>= 1;
        }
    }

    return ans;
}

ll inverse_mod(ll base, int mod){
    return power_mod(base, mod-2, mod);
}

/*-------------------------------------END OF TEMPLATE--------------------------------------*/
void precompute(){

}

void solve(){

    int l, r; cin>>l>>r;

    int x; // Largest different bit
    for(int s = 30; s >= 0; s--){
        if( (l>>s) != (r>>s) ){
            x = s; break;
        }
    }

    // cout<<x<<' ';

    int n = (l>>x)<<x;
    for(int s = 0; s < x; s++){
        if( ((1<<s)&l) == ((1<<s)&r)){
            n += (1<<s)*(((1<<s)&l) == 0);
        }else{
            n += (1<<s)*(((1<<s)&l) > 0);
        }
    }

    if( (1<<x)+n < r) n += (1<<x);

    cout<<n<<' '<<l<<' '<<r;
    cout<<endl;
}

int main() {

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

    int t = 1;
    cin>>t;

    precompute();

    for(int i = 1; i <= t; i++){
        // cout<<"Case #"<<i<<": ";
        solve();
    }

    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
// #include "template.cpp"
#define FAST ios_base::sync_with_stdio(0); cin.tie(0)
#define endl '\n'
#define int long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int, int>
#define vpii vector<pair<int, int>>
#define umii unordered_map<int, int>
#define usi unordered_set<int>
#define all(arr) (arr).begin(), (arr).end()
using namespace std;

signed main() {
    FAST;
    int t, l, r;
    cin >> t;
    while (t--) {
        cin >> l >> r;
        int k = 63 - __builtin_clz(l ^ r);
        int a = l | ((1 << k) - 1), b = a + 1, c = ((a == l) ? r : l);
        cout << a << " " << b << " " << c << endl;
    }
    return 0;
};