Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <bits/stdc++.h>
#include <queue>
#include <unordered_set>
#include <set>
#include <map>
#include <chrono>
 
using namespace std;
 
#define se second
#define fi first
#define pb push_back
 
#define all(v) v.begin(),v.end()
#define loop(n) for(int i = 0; i < n; i++)
#define forn(i,st, n) for (int i = st; i < int(n); i++)
#define ll long long 
#define ld long double
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define umii unordered_map<int,int,custom_hash>
#define umll unordered_map<ll,ll,custom_hash>
#define vpii vector<pii>
#define vvi vector<vector<int>>
#define vvc vector<vector<char>>
#define mem(a,b) memset(a, b, sizeof(a))
 
#define lz(x) __builtin_clz(x) // gives no. of leading zeros
#define tz(x) __builtin_ctz(x)
#define popc(x) __builtin_popcount(x)
#define setbits(x) __builtin_popcountll(x)
#define msb(x) 63 - __builtin_clzll(x)
#define lsb(x) __builtin_ctzll(x)
#define parity(x) __builtin_parity(x) // return 1 if odd no. of setbits else 0
 
#define input(v) for(auto &it:v)cin>>it 
#define output(v) for(auto &it:v)cout<<it<<" "
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
 
//-------------------------------------- Start_Here ------------------------------------------------------------------------------------------------
 
 
void solve(){
    ll l, r;
    cin >> l >> r;

    ll a, b,c;

    ll m = 31 - lz(l ^ r);

    int k = 0;
    while ((1LL << k) <= r) k++;
    k--;

    if((1LL << k) < l ){
        a = l;
    }
    else{
        a = (1LL << k);
    }

    c = (a==r) ? l:r;

    b = l | (1LL<<m) - 1;


    
  cout<<a<<" " <<b<<" "<<c<<endl;
}
 
int main() {
    fast;
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Submission (verdict: Accepted):
#include <iostream>
#include <bits/stdc++.h>
#include <queue>
#include <unordered_set>
#include <set>
#include <map>
#include <chrono>
 
using namespace std;
 
#define se second
#define fi first
#define pb push_back
 
#define all(v) v.begin(),v.end()
#define loop(n) for(int i = 0; i < n; i++)
#define forn(i,st, n) for (int i = st; i < int(n); i++)
#define ll long long 
#define ld long double
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define umii unordered_map<int,int,custom_hash>
#define umll unordered_map<ll,ll,custom_hash>
#define vpii vector<pii>
#define vvi vector<vector<int>>
#define vvc vector<vector<char>>
#define mem(a,b) memset(a, b, sizeof(a))
 
#define lz(x) __builtin_clz(x) // gives no. of leading zeros
#define tz(x) __builtin_ctz(x)
#define popc(x) __builtin_popcount(x)
#define setbits(x) __builtin_popcountll(x)
#define msb(x) 63 - __builtin_clzll(x)
#define lsb(x) __builtin_ctzll(x)
#define parity(x) __builtin_parity(x) // return 1 if odd no. of setbits else 0
 
#define input(v) for(auto &it:v)cin>>it 
#define output(v) for(auto &it:v)cout<<it<<" "
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
 
//-------------------------------------- Start_Here ------------------------------------------------------------------------------------------------

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

    ll a, b,c;

    ll m = lz(l ^ r);

    int k = 31 - m;

    a = r & ~((1LL<<k)-1);
    b = a-1;

    for(int i = l;i<=r;i++){
        if(i!= a && i!=b){
            c =i;
            break;
        }
    }
    //cout << ((1LL<<(m+1) - 1)<<" dfd ";


    
  cout<<a<<" " <<b<<" "<<c<<endl;
}
 
int main() {
    fast;
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}