Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
//******************************************************************
//						Author: Ritik Arora
#include <bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

#define ll long long int

#include <ext/pb_ds/assoc_container.hpp> // Common file
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; // find_by_order, order_of_key

#define nline '\n'
#define inf LLONG_MAX
ll mod1 = 1e9 + 7;
ll mod2 = 998244353;

ll expo(ll a, ll b, ll mod)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
        b = b >> 1;
    }
    return res;
}

vector<ll> sieve(int n)
{
    int *arr = new int[n + 1]();
    vector<ll> vect;
    for (int i = 2; i <= n; i++)
        if (arr[i] == 0)
        {
            vect.push_back(i);
            for (int j = 2 * i; j <= n; j += i)
                arr[j] = 1;
        }
    return vect;
}

ll inverseMod(ll n, ll mod) { return expo(n, mod - 2, mod); }
ll mod_mul(ll a, ll b, ll m)
{
    a = a % m;
    b = b % m;
    return (((a * b) % m) + m) % m;
}
ll mod_div(ll a, ll b, ll m)
{
    a = a % m;
    b = b % m;
    return (mod_mul(a, inverseMod(b, m), m) + m) % m;
} // only for prime m

#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define alice cout<<"ALICE"<<endl
#define bob cout<<"BOB"<<endl
#define draw cout<<"DRAW"<<endl



void solve()
{
    ll l,r;
    cin >> l >> r;
    ll fix = 0;
    ll start = int(log2(r));

    for (int i = start; i >= 0;i--)
    {
        ll a = (r >> i) & 1;
        ll b = (l >> i) & 1;
        if(a)
        {
            ll wt = (1 << i);

            if(b){
                fix += wt;
                r -= wt;
                l -= wt;
            }
            else{
                ll a = fix + wt;
                ll b = fix + wt - 1;
                if(a+1<=r)
                {
                    cout << a << " " << b << " " << a + 1 << endl;
                }
                else{
                    cout << a << " " << b << " " << b - 1 << endl;
                }
                return;
            }
        }
    }
    
}
int main()
{
    // unordered_map<long long int,int,custom_hash> mp;
    // StringHash hash(word);
    // hash.substrHash(idx1,idx2)==hash.substrHash(idx3,idx4);
    // Trie* T = new Trie();
    // string ritik="ritik";
    // T->insertNode(ritik);
    // #ifndef ONLINE_JUDGE
    // freopen("Error.txt", "w", stderr);
    // #endif
    fastio();
    int t;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Submission (verdict: Accepted):
//******************************************************************
//						Author: Ritik Arora
#include <bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

#define ll long long int

#include <ext/pb_ds/assoc_container.hpp> // Common file
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; // find_by_order, order_of_key

#define nline '\n'
#define inf LLONG_MAX
ll mod1 = 1e9 + 7;
ll mod2 = 998244353;

ll expo(ll a, ll b, ll mod)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
        b = b >> 1;
    }
    return res;
}

vector<ll> sieve(int n)
{
    int *arr = new int[n + 1]();
    vector<ll> vect;
    for (int i = 2; i <= n; i++)
        if (arr[i] == 0)
        {
            vect.push_back(i);
            for (int j = 2 * i; j <= n; j += i)
                arr[j] = 1;
        }
    return vect;
}

ll inverseMod(ll n, ll mod) { return expo(n, mod - 2, mod); }
ll mod_mul(ll a, ll b, ll m)
{
    a = a % m;
    b = b % m;
    return (((a * b) % m) + m) % m;
}
ll mod_div(ll a, ll b, ll m)
{
    a = a % m;
    b = b % m;
    return (mod_mul(a, inverseMod(b, m), m) + m) % m;
} // only for prime m

#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define alice cout<<"ALICE"<<endl
#define bob cout<<"BOB"<<endl
#define draw cout<<"DRAW"<<endl



void solve()
{
    ll l,r;
    cin >> l >> r;
    ll fix = 0;
    ll start = int(log2(r));

    for (int i = start; i >= 0;i--)
    {
        ll a = (r >> i) & 1;
        ll b = (l >> i) & 1;
        if(a)
        {
            ll wt = (1 << i);

            if(b){
                fix += wt;
                r -= wt;
                l -= wt;
            }
            else{
                ll a = fix + wt;
                ll b = fix + wt - 1;
                if(wt+1<=r)
                {
                    cout << a << " " << b << " " << a + 1 << endl;
                }
                else{
                    cout << a << " " << b << " " << b - 1 << endl;
                }
                return;
            }
        }
    }
    
}
int main()
{
    // unordered_map<long long int,int,custom_hash> mp;
    // StringHash hash(word);
    // hash.substrHash(idx1,idx2)==hash.substrHash(idx3,idx4);
    // Trie* T = new Trie();
    // string ritik="ritik";
    // T->insertNode(ritik);
    // #ifndef ONLINE_JUDGE
    // freopen("Error.txt", "w", stderr);
    // #endif
    fastio();
    int t;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}