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

Solution 1 (runtime: 77 ms):
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
 //find_by order()->iterator of indexed element,  order_of_key()-> number of elements strictly less than x
#define lli long long int
typedef tree < lli,  null_type ,  less_equal<lli> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;

mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count());
 
#define endl '\n'
using pii=pair<lli,lli>;
#define MP make_pair
#define F first
#define ld long double
#define S second
#define all(o) o.begin(),o.end()
lli M=1e9+7; 
using mll = map<lli,lli>;
using vi = vector<lli>;
using vvi = vector<vector<lli>>;
using vpii = vector<pii>;
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define mem(a,b) memset(a,b,sizeof(a))
#define state pair<lli,pii>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define deb(x) cout << #x << "=" << x << "\n"
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << "\n"
#define pb push_back
#define mid (l+r)/2
#define lb lower_bound
#define ub upper_bound
template <typename T> T gcd(T a, T b){return (b==0)?a:gcd(b,a%b);}
template <typename T> T bin_pow(T b, T p, T m){T x = 1;while(p){if(p&1)x=(x*b)%m;b=(b*b)%m;p=p>>1;}return x;}
//---- Debugger ---- //
#define debarr(a,n) cout<<#a<<" : ";for(int i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define debmat(mat,row,col) cout<<#mat<<" :\n";for(int i=0;i<row;i++) {for(int j=0;j<col;j++) cerr<<mat[i][j]<<" ";cerr<<endl;}
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const unordered_set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const unordered_map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const multiset<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
lli fact[1000100],inv_fact[1000100];
lli nCr(lli n,lli r){if(r>n || n<0 ||r<0)return 0;lli d=(inv_fact[r]*inv_fact[n-r])%M;  lli f=(fact[n]*d)%M;return f;}
lli nPr(lli n,lli r){return (nCr(n,r)*fact[r])%M;}
lli n,m,x,k,tt,q,p,y,h,w,l,r,d;
lli lcm(lli a,lli b){
    return (a*b/__gcd(a,b));
}
#undef mid
vi arr,brr;
vvi g,div1;



lli solve(lli n1,lli m1){
 cin>>l>>r;

 lli posl=-1,posr=-1;
 for(lli i=30;i>=0;i--){
   if(((l>>i)&1LL) && (posl==-1)){
    posl=i;
   }
   if(((r>>i)&1LL) && (posr==-1)){
    posr=i;
   }
 }

 if(abs(posr-posl)>=2){
  cout<<(1LL<<posr)<<" "<<(1LL<<(posr-1))<<" "<<((1LL<<(posr-1))-1)<<endl;
  return 1;
 }
 else if(posr-posl==1){
  if((r&(r-1))==0){
    cout<<r<<" "<<r-1<<" "<<r-2<<endl;
  }
  else{
    lli num=(1LL<<posr);
    cout<<num+1<<" "<<num<<" "<<num-1<<endl;
  }
  return 1;
 }

 for(lli i=30;i>=0;i--){
  lli nr=(r>>i)&1LL,nl=(l>>i)&1LL;
  if(nr==1 && nl==0){
    lli num=(1LL<<i);
    lli n1=r&((1LL<<(i+1))-1);
    lli lft=r-n1;
    if(n1==num){
     cout<<lft+n1<<" "<<lft+n1-1<<" "<<lft+n1-2<<endl;
    }
    else{
     cout<<lft+num+1<<" "<<lft+num<<" "<<lft+num-1<<endl;
    }
    return 1;
  }
 }


 return 1;
}


int main(){
 IOS
 
  //  freopen("input.txt", "r", stdin);
  //  freopen("output.txt", "w", stdout);
  //  fact[0]=1;
  //  for(lli i=1;i<=200200;i++){
  //    fact[i]=(i*fact[i-1])%M;
  //  }
  //  for(lli i=0;i<=200200;i++){
  //   inv_fact[i]=bin_pow<lli>(fact[i],M-2,M);
  //  }
//  deb(nCr(5,2));

//  div1.resize(1001000);
//  for(lli i=1;i<1001000;i++){
//   for(lli j=i;j<1001000;j+=i){
//     div1[j].pb(i);
//   }
//  }

//  pr(div1[10]);

 

cin>>tt;
// tt=1;
// lli cnt=1;
  while(tt--){
    solve(0,0);
  
  }
  
}

Solution 2 (runtime: 92 ms):
#include<iostream>
#include<cmath>
#include<algorithm>
#include<set>
#include<vector>
#include<queue>
#include<map>
#include<cstring>
using namespace std;
#define ll long long
int main()
{
    ll t;
    cin>>t;
    for(ll k1=1;k1<=t;k1++)
    {
        ll i,j,k,cnt1=0,cnt2=0,l,r;
        cin>>l>>r;
        ll base=r;
        while(base>0) base/=2,cnt1++;
        ll a=pow(2,cnt1-1),b=a-1,c=a-2;
        if(a!=l)
        {
            if(c>=l) cout<<a<<" "<<b<<" "<<c<<endl;
            else 
            {
                c=a+1;
                cout<<a<<" "<<b<<" "<<c<<endl;
            }
        }
        else 
        {
            base=r-l;
            while(base>0) base/=2,cnt2++;
            b=a+pow(2,cnt2-1);
            c=b-1;
            cout<<a<<" "<<b<<" "<<c<<endl;
        }
    }
}