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

Solution 1 (runtime: 78 ms):
#include <bits/stdc++.h>
#define ll long long
using namespace std;

void important()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

bool isPrime(ll n)
{
    if(n==2)return true;
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0 || n%3==0)return false;
    for(ll i=5;i*i<=n;i=i+6)
    if(n%i==0 || n%(i+2)==0)return false;
    return true;
}
////////////////////////////////////////////////////
////////////////////////////////////////////////////
ll fast_power(ll a,ll b)
{
    if(b==0){return 1;}
    if(b%2==0){return fast_power(a,b/2)*fast_power(a,b/2);}
    return fast_power(a,b-1)*a;
}
////////////////////////////////////////////////////
unsigned long long power(unsigned long long x,
                         ll y, ll p)
{
    unsigned long long res = 1; // Initialize result
 
    x = x % p; // Update x if it is more than or
    // equal to p
 
    while (y > 0)
    {
 
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res * x) % p;
 
        // y must be even now
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}
////////////////////////////////////////////////////
class dsu{
    vector<ll> parent,rank;
    public:
    dsu(ll n)
    {
        parent.resize(n+1);
        rank.resize(n+1);
        for(int i=0;i<=n;i++)
        {
            parent[i]=i;
        }
    }
    ll up(ll node)
    {
        if(node==parent[node])
        return node;
        return parent[node]=up(parent[node]);
    }
    void union1(int u,int v)
    {
        ll val=up(u),cal=up(v);
        if(val==cal)
        {
            return;
        }
        if(rank[val]>rank[cal])
        {
            parent[cal]=parent[val];
        }
        else if(rank[cal]>rank[val])
            parent[val]=parent[cal];
            else
            {
                parent[cal]=parent[val];
                rank[val]++;
            }
    }
    
};
ll func(ll n,ll bit)
{
    if(n<=0)return 0;
   n-=((1LL<<bit)-1);
   return max(0LL,(n/(1LL<<(bit+1)))*(1LL<<bit)+min(1LL<<bit,n%(1LL<<(bit+1))));
}

void sol() {
  ll l,r;
  cin>>l>>r;
  ll a=0;
  ll b=a,c=a;
  for(ll i=30;i>=0;i--)
  {
      ll totalOnes=func(r,i)-func(l-1,i);
      ll totalZeros=(r-l+1)-totalOnes;
    //  cout<<totalOnes<<" "<<totalZeros<<endl;
      if(totalOnes>0 and totalZeros>0)
      {
          
          if(a<b)
          {
              a+=1<<i;
          }
          else 
          {
              b+=1<<i;
          }
      }
      else
      {
          if(totalOnes)
          {
             a+=1<<i;
             b+=1<<i;
          }
          
         
      }
  }
  for(ll i=l;i<=r;i++)
  {
      if(i!=a and i!=b)
      {
          c=i;
          break;
      }
  }
 
  cout<<a<<" "<<b<<" "<<c;
}

int32_t main()
{
    important();

   
    int t;
    t=1;
   cin>>t;

  
    while(t--)
    {
     
        sol();
    cout<<"\n";
    }
}


Solution 2 (runtime: 46 ms):
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define fi first
#define sc second
#define PI acos(-1.0)
#define MOD 1000000007
#define endl '\n'
#define eb emplace_back
#define set(n, k) (n = (1LL << k))
#define unset(n, k) (n &= ~(1LL << k))
#define check(n , k) (n & (1LL << k))
#define toggle(n, k) (n ^ (1LL << k))
#define fastio std::ios_base::sync_with_stdio (false); cin.tie(0); cout.tie(0);
int popcount(ll n) {return __builtin_popcountll(n);}
int poplow(ll n) {return __builtin_ctzll(n);}
int pophigh(ll n) {return 63 - __builtin_ctzll(n);}
ll PERFECT_NUM[]={6,28,496,8128,33550336,8589869056,137438691328,2305843008139952128};
//-----------------------------------------------------------------------------------
ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a, ll b){
    return ((a/gcd(a,b))*b);
}

ll BigMod(ll a, ll p, ll m){
    ll ret=1;
    while(p){
        if(p&1) ret=((ret%m)*(a%m))%m;
        a=((a%m)*(a%m))%m;
        p/=2;
    }
    return ret;
}
ll AddMul(ll a, ll p, ll m){
    ll ret=0;
    while(p){
        if(p&1) ret=((ret%m)+(a%m))%m;
        a=((a%m)+(a%m))%m;
        p /= 2;
    }
    return ret;
}
void iofile(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}
//-------------------------------------------------------------------------
 /*TO GET SOMETHING YOU NEVER HAD YOU HAVE TO DO SOMETHING YOU NEVER DID*/
//-------------------------------------------------------------------------

void solve(){
    int l, r; cin >> l >> r;
    int k = 31 - __builtin_clz(l ^ r);
    int a = l | ((1 << k) - 1);
    int b = a + 1;
    int c = (a == l ? r : l);

    cout << a << " " << b << " " << c << endl;
}


int main(){
    fastio;
    iofile();
    int t=1, tc=1;
    cin>>t;
    //cin.ignore();
    while(t--){
        //cout<<"Case "<<tc++<<": ";
        solve();
    }

    return 0;
}