Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll mod=1e9+7;

void print_array(vector<ll> &arr)
{
    ll n = arr.size();
    for(int i = 0; i < n; i++)
    {
        if(i)
            cout << " ";
        cout << arr[i];
    }
    cout<< endl;
}

void input_array(vector<ll> &arr)
{
    ll n = arr.size();
    for(int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
}

ll power(ll n,ll k)
{
    ll ans=1;
    for(int i=0;i<k;i++)
    {
        ans*=n;
    }
    return ans;
}
//[2,1,3,0]

//map<ll,ll> mp;

void countDivisors(ll n,map<ll,ll> &mp) 
{ 
    //int cnt = 0; 
    for (int i = 1; i <= sqrt(n); i++) { 
        if (n % i == 0) { 
            if (n / i == i) 
                {
                    mp[i]++;
                }
  
            else // Otherwise count both 
            {
               mp[i]++; 
               mp[n/i]++;
            }
        } 
    } 
    return ; 
} 

ll fact(ll n)
{
    ll ans=1;
    for(int i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}

ll highest_pow(ll n)
{
    ll ans=0;
    while(n/2>1)
    {
        n/=2;
        ans++;
    }
    return ans;
}

void allDivisors(int n,map<ll,ll>& mp)
{
    
    for (int i = 1; i <= sqrt(n); i++) {
        if (n % i == 0) {
            if (n / i == i)
                mp[i]++;
            else // Otherwise print both
                {
                    mp[i]++;
                    mp[n/i]++;
                }
        }
    }
}

void divisors(ll n, map<ll,ll>& mp)
{
    while (n % 2 == 0) {
        mp[2]++;
        n = n/2; 
    } 
    for (int i = 3; i*i <= n; i = i + 2) {
      
        // While i divides n, print i and divide n 
        while (n % i == 0) {
          
            mp[i]++; 
            n = n/i; 
        } 
    }
    if(n>2)
    {
        mp[n]++;
    }
}
vector<vector<ll>> directions={{1,0},{0,1},{-1,0},{0,-1}};

ll value(ll a, ll b, ll c)
{
    ll ans=(a^b)+(b^c)+(a^c);
    return ans;
}


void solve()
{
   // ll l,r;
    //cin>>l>>r;
    //max power, max_power-1, 
    ll l,r;
    cin>>l>>r;
    ll a=l,b=r;
    ll c=l+1;
   for(int i=30;i>=0;i--)
   {
       ll bit=(1ll<<i);
       ll t1=(a&(1ll<<i));
       ll t2=(b&(1ll<<i));
       if(t1&&t2)
       continue;
       else 
       {
        ll temp=(c|bit);
       if(temp<r)
       c=temp;
       }
   }
   int i=0;
   while(c<=l)
   {
       c|=(1<<i);
       i++;
   }
   // ll p=(a^b)+(b^c)+(a^c);
    cout<<a<<" "<<b<<" "<<c<<endl;
    
  //  cout<<p<<endl;
    //cout<<"---------------- "<<endl;
}




int main(){
    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
    int t;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll mod=1e9+7;

void print_array(vector<ll> &arr)
{
    ll n = arr.size();
    for(int i = 0; i < n; i++)
    {
        if(i)
            cout << " ";
        cout << arr[i];
    }
    cout<< endl;
}

void input_array(vector<ll> &arr)
{
    ll n = arr.size();
    for(int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
}

ll power(ll n,ll k)
{
    ll ans=1;
    for(int i=0;i<k;i++)
    {
        ans*=n;
    }
    return ans;
}
//[2,1,3,0]

//map<ll,ll> mp;

void countDivisors(ll n,map<ll,ll> &mp) 
{ 
    //int cnt = 0; 
    for (int i = 1; i <= sqrt(n); i++) { 
        if (n % i == 0) { 
            if (n / i == i) 
                {
                    mp[i]++;
                }
  
            else // Otherwise count both 
            {
               mp[i]++; 
               mp[n/i]++;
            }
        } 
    } 
    return ; 
} 

ll fact(ll n)
{
    ll ans=1;
    for(int i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}

ll highest_pow(ll n)
{
    ll ans=0;
    while(n/2>1)
    {
        n/=2;
        ans++;
    }
    return ans;
}

void allDivisors(int n,map<ll,ll>& mp)
{
    
    for (int i = 1; i <= sqrt(n); i++) {
        if (n % i == 0) {
            if (n / i == i)
                mp[i]++;
            else // Otherwise print both
                {
                    mp[i]++;
                    mp[n/i]++;
                }
        }
    }
}

void divisors(ll n, map<ll,ll>& mp)
{
    while (n % 2 == 0) {
        mp[2]++;
        n = n/2; 
    } 
    for (int i = 3; i*i <= n; i = i + 2) {
      
        // While i divides n, print i and divide n 
        while (n % i == 0) {
          
            mp[i]++; 
            n = n/i; 
        } 
    }
    if(n>2)
    {
        mp[n]++;
    }
}
vector<vector<ll>> directions={{1,0},{0,1},{-1,0},{0,-1}};


void solve()
{
   ll l,r;
   cin>>l>>r;
   ll a=0;
   ll b=0;
   ll c=0;
   ll i=30;
   for(i=30;i>=0;i--)
   {
    if((l&(1<<i))!=(r&(1<<i)))
    {
        a|=(1ll<<i);
        i--;
        break;
    }//MSB
    if(l&(1ll<<i)&&(r&(1ll<<i)))
    {
        a|=(1ll<<i);
        b|=(1ll<<i);
    }
   }
   while(i>=0)
   {
    b|=(1<<i);
    i--;
   }
   for(i=l;i<=r;i++)
   {
    if(i==a||i==b)
    continue;
    else{
        c=i;
        break;
    }
   }
   cout<<a<<" "<<b<<" "<<c<<endl;
}




int main(){
    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
    int t;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}