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

Solution 1 (runtime: 92 ms):
#include <bits/stdc++.h>
#define lli long long
#define endl "\n"
#define vi vector<lli>
#define vpi vector<pair<lli, lli>>
#define vvi vector<vector<lli>>
#define fo(i, a, n) for(lli i = a; i<n; i++)
#define rfo(i, a, n) for(lli i = n-1; i>=a; i--)
#define nay {cout << "No\n"; return;}
#define yay {cout << "Yes\n"; return;}
#define vin(v) for(auto&x:v)cin>>x;
#define print(v) for(auto x:v) cout<<x<<" "; cout<<"\n"; 
#define all(v) v.begin(),v.end()
#define pb push_back
using namespace std;

const lli MOD = 1e9+7;

string num_to_bin(lli n) {
    string ans;
    if (n==0) return "0";
    while (n!=0) {
        if (n%2==0) ans.push_back('0');
        else ans.push_back('1');
        n/=2;
    }
    reverse(ans.begin(), ans.end());
    return ans;
}

void solve() {
    lli l,r; cin >> l >> r;
    lli a = 0, b = 0;
    for (int i=30; i>=0; i--) {
        lli b1=0, b2=0;
        if (l & (1ll << i)) b1 = 1;
        if (r & (1ll << i)) b2 = 1;
        if (b1 == b2) {
            b += b1 * (1ll << i);
        }
        else {
            b += (1ll << i);
            a = b-1;
            break;
        }
    }
    lli c;
    if (l<=a-1 && r>=a-1) c = a-1;
    else c = b+1;
    cout << a << " " << b << " " << c << endl;
}

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

Solution 2 (runtime: 77 ms):
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long int ll;
typedef unsigned long long ull;
const ll INF = (1ll << 61);
const ll inf = 1e9;
const ll MOD=1e9 + 7;
const ll M=998244353;
 
 
 
ll gcd(ll a, ll b) {
    return b ? gcd (b, a % b) : a;
}
 
ll lcm(ll a,ll b){
  return ((a*b)/gcd(a,b));
}

ll fact[2000001];

void factfun(){
  fact[0] = fact[1] = 1;
  for(ll i=2;i<=2000000;i++){
    fact[i] = (fact[i-1]%MOD * i%MOD)%MOD;
  }
}

ll expo(ll a,ll n){
   ll ans = 1;
   while(n > 0){
    if(n & 1ll){
      ans = ans * a % MOD;
    }
    a = a * a % MOD;
    n >>= 1;
   }
   return ans;
}

ll fermatNCr(ll a,ll b){
   return ((fact[a]%MOD * expo(fact[b],MOD - 2)%MOD * expo(fact[a - b],MOD - 2)%MOD)%MOD);
}



void solve(){
   ll l,r;
   cin>>l>>r;
   /*if(r == l + 2){
    cout<<l<<" "<<l + 1<<" "<<l + 2<<endl;
    return;
   }*/

   ll a = 0,b = 0,c = 0;
   ll flg = 0,fset = 0;
   for(ll i=30;i>=0;i--){
     if(flg == 0){
      ll b1 = ((l >> i) & 1ll);
      ll b2 = ((r >> i) & 1ll);
       if(b1 == b2){
        a += (b1 << i);
        b += (b1 << i);
        c += (b1 << i);
       }
       else{
        flg = 1;
        a += (b1 << i);
        b += (b1 << i);
        c += (b2 << i);
       }
     }
     else{
       ll b1 = ((l >> i) & 1ll);
       ll b2 = ((r >> i) & 1ll);
       if(b1 == 1 && fset == 0){
          fset = 1;
          a += (1 << i);
          b += (1 << i);
          c += (0 << i);
       }
       else{
         a += (b1 << i);
         b += (1 << i);
         c += (0 << i);
       }
     }
   }
   
   if(a == b){
    b = a + 1;
    c = r;
   }
   
   cout<<a<<" "<<b<<" "<<c<<endl;
}
 
 
 
 
 
int main(){
 
   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    /*#ifndef ONLINE_JUDGE
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
    #endif*/
    

      ll testcase;
      //testcase = 1;
      cin>>testcase;
     
      while(testcase--){       
        solve();
      }
 
}