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

Solution 1 (runtime: 77 ms):
// Name-Anshu Raj Jaiswal
// Scholar id-2212172
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
typedef long double ld;
#define pb push_back
#define ff first
#define ss second
#define mpq priority_queue<ll,vector<ll>,greater<ll>>
#define mpqp priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>
#define Mpq priority_queue<ll>
#define Mpqp priority_queue<pair<ll,ll>>
#define all(x) (x).begin(), (x).end()
const ll MOD=998244353;
const ll N=200000;
vector<ll>temp(N+1,0);
ll ceil(ll a,ll b){return (a+b-1)/b;}
void solve()
{         
  ll l,r;
  cin>>l>>r;
  ll a=0,b=0,c=0;
  ll in=-1;
  for(ll i=30;i>=0;i--)
  {
    ll temp1=(r>>i)&1;
    ll temp2=(l>>i)&1;
    if(temp1==1)a+=(1<<i);
    if(temp2==1)b+=(1<<i);
    if(temp1==1&&temp2==0)
    {
      in=i;
      break;
    }
  }
  for(ll i=in-1;i>=0;i--)
  {
    b+=(1<<i);
  }
  if(b-1>=l)
  c=b-1;
  else
  c=a+1;
  cout<<a<<" "<<b<<" "<<c<<endl;
} 
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);cout.tie(NULL);
  ll t;
  cin>>t;
  while(t--)
  {        
	  solve();
  }
  return 0;
} 

Solution 2 (runtime: 61 ms):
#include <bits/stdc++.h>
#include <cmath>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define int long long
const int MOD = 1e9 + 7;
const int INF = LONG_MAX >> 1;
typedef pair<char, int> pchar;
typedef pair<int, int> pint;
typedef vector<int> v;
typedef vector<pint> vpint;
typedef vector<string> vs;
typedef unordered_map<int, int> ump;
typedef map<int, int> mp;
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update>  
    ordered_set;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define fl(i,n) for(int i=0;i<n;i++)
#define rl(i,m,n) for(int i=n;i>=m;i--)
#define py cout << "YES\n";
#define pn cout << "NO\n";
#define pimp cout << "IMPOSSIBLE\n";
#define vr(v) v.begin(), v.end()
#define rv(v) v.end(), v.begin()
#define debug(x) cerr << #x << " "; cerr << x << " "; cerr << endl;
int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); }
int lcm(int a, int b) { return (a / gcd(a, b) * b); }
int moduloMultiplication(int a, int b, int mod) { int res = 0; a %= mod; while (b) { if (b & 1) res = (res + a) % mod; b >>= 1; a = (a * 2) % mod; } return res; }
int powermod(int x, int y, int p) { int res = 1; x = x % p; if (x == 0) return 0; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) % p; } return res; }

// Utility functions
void pv(const vector<int>& v) { for(auto x: v) cout << x << " "; cout << "\n"; }
void pap(const pair<int,int> ap[],int n) { for(int i=0; i<n; i++) cout << ap[i].first << "->" << ap[i].second << "\n"; }
void pm(const map<int,int>& m) { for(auto x: m) cout << x.first << "->" << x.second << "\n"; }
void pa(const int a[], int n) { for (int i = 0; i < n; ++i) cout << a[i] << " "; cout << "\n"; }
bool sorta(const pair<int,int>& a, const pair<int,int>& b) { return (a.second < b.second); }
bool sortd(const pair<int,int>& a, const pair<int,int>& b) { return (a.second > b.second); }

// Bits
string decToBinary(int n) { string s=""; while (n > 0) { s = to_string(n % 2) + s; n = n / 2; } return s; }
int binaryToDecimal(const string& n) { int dec_value = 0; int base = 1; int len = n.length(); for(int i = len - 1; i >= 0; i--) { if (n[i] == '1') dec_value += base; base = base * 2; } return dec_value; }

// Check functions
bool isPrime(int n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for(int i = 5; i * i <= n; i += 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; }
bool isPowerOfTwo(int n) { if (n == 0) return false; return (ceil(log2(n)) == floor(log2(n))); }
bool isPerfectSquare(int x) { if (x >= 0) { int sr = sqrt(x); return (sr * sr == x); } return false; }
void nl() { cout << "\n"; }
void yn(int x) { if (x == 1) cout << "YES" << "\n"; else cout << "NO" << "\n"; }
void yes() { cout << "YES" << "\n"; }
void no() { cout << "NO" << "\n"; }
void print(int x) { cout << x << "\n"; }
bool sortbysec(const pair<int,int>& a, const pair<int,int>& b) { return (a.second < b.second); }



int kade(const int a[], int n) {
    int mx = LLONG_MIN, cs = 0;
    for (int i = 0; i < n; ++i) {   
        cs = (cs + a[i]);
        if (cs >= mx) {
            mx = cs;
        }
        if (cs < 0) {
            cs = 0;
        }
    }
    return mx;
}
vector<int> getFactorization(int x,int spf[])
{
    vector<int> ret;
    set<int> st;
    st.insert(1);
    int temp=x;
    while (x != 1) {
        st.insert(spf[x]);
        x = x / spf[x];
    }
    for(auto y: st){
        ret.push_back(y);
    }
    return ret;
}

double sinDegrees(double angleInDegrees) {
    // Convert degrees to radians
    double angleInRadians = angleInDegrees * (M_PI / 180.0);
    double result = sin(angleInRadians);
    // Set result to 0 if it's very close to zero to handle floating-point precision issues
    return (std::abs(result) < 1e-10) ? 0 : result;
}

double cosDegrees(double angleInDegrees) {
    // Convert degrees to radians
    double angleInRadians = angleInDegrees * (M_PI / 180.0);
    double result = cos(angleInRadians);
    // Set result to 0 if it's very close to zero to handle floating-point precision issues
    return (std::abs(result) < 1e-10) ? 0 : result;
}
double distanceBetweenPoints(double x1, double y1, double x2, double y2) {
    // Calculate the distance using the distance formula
    return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
}
bool comp(pair<int,int> &a,pair<int,int> &b){
    if(max(a.first,a.second)==max(b.first,b.second)) return min(a.first,a.second)<min(b.first,b.second);
    else return max(a.first,a.second)<max(b.first,b.second);
}

int dfs(vector<int> adj[],int node,int dp[]){
     if(dp[node]!=0) return dp[node];
     
     for(auto child: adj[node]){    
         dp[node]=max(1+dfs(adj,child,dp),dp[node]);
     }
     return dp[node];
}
// int n,m;
// int dp[10][1001][1001];
// int f(int i,int a,int b){
//     if(i==m) return 1;
//     if(a>b||b<1||a>n) return 0;
//     if(dp[i][a][b]!=-1) return dp[i][a][b];
//     return dp[i][a][b]=(f(i+1,a,b)+f(i,a+1,b)+f(i,a,b-1)-f(i,a+1,b-1)+MOD)%MOD;
// }

int kade1(vector<int> a) {
    int n=a.size();
    int mx = LLONG_MIN, cs = 0;
    for (int i = 0; i < n; ++i) {   
        cs = (cs + a[i]);
        if (cs >= mx) {
            mx = cs;
        }
        if (cs < 0) {
            cs = 0;
        }
    }
    return mx;
}
int smallestSumSubarr(vector<int> arr)
{
    // to store the minimum value that is ending
    // up to the current index
    int n=arr.size();
    int min_ending_here = INT_MAX;
     
    // to store the minimum value encountered so far
    int min_so_far = INT_MAX;
     
    // traverse the array elements
    for (int i=0; i<n; i++)
    {
        // if min_ending_here > 0, then it could not possibly
        // contribute to the minimum sum further
        if (min_ending_here > 0)
            min_ending_here = arr[i];
         
        // else add the value arr[i] to min_ending_here    
        else
            min_ending_here += arr[i];
         
        // update min_so_far
        min_so_far = min(min_so_far, min_ending_here);            
    }
     
    // required smallest sum contiguous subarray value
    return min_so_far;
}
int xorsum(int a,int b,int c){
    return (a^b)+(b^c)+(c^a);
}
signed main()
 { 
ios::sync_with_stdio(false); 
cin.tie(NULL);
  int tc;
  cin>>tc;
   // cout<<xorsum(98,85,76)<<"\n";
  while(tc--){
   int l,r;
   cin>>l>>r;
   int lmsb=0,rmsb=0;
   int ans=0;
   for (int i = 31; i>=0; i--)
   {   

       if((r & (1<<i))==(l & (1<<i))&&(l & (1<<i))){
          ans+=(1<<i);
       }
       if((r & (1<<i))!=(l & (1<<i))){
         rmsb=i;
         break;
       }
   }
   // cout<<ans<<"\n";
   int a=(1<<rmsb)+ans;
   int b=a-1>=l?a-1:a+1;
   int c=l;
   while(a==c||b==c){
      c++;
   }
   cout<<a<<" "<<b<<" "<<c<<"\n";
  
}

}