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

Solution 1 (runtime: 62 ms):
//******************************************************************
//						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;
}

Solution 2 (runtime: 77 ms):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int T, l[40], r[40], lenl, lenr;

int main () {
	scanf("%d", &T);
	while (T--) {
		memset(l, 0, sizeof(l)), memset(r, 0, sizeof(r)), lenl = lenr = 0;
		int x, y, L, R;
		scanf("%d%d", &x, &y);
		L = x, R = y;
		while (x)
			l[++lenl] = x & 1, x >>= 1;
		while (y)
			r[++lenr] = y & 1, y >>= 1;
		lenl = lenr;
		int sum = 0, len = lenr;
		for (int i = len; i; i--) {
			if (l[i] != r[i]) {
				int a = sum + (1 << (i - 1)), b = a - 1;
				printf("%d %d ", a, b);
				if (a > L && b > L)
					printf("%d\n", L);
				else
					printf("%d\n", R);
				break;
			}
			sum += (1 << (i - 1)) * l[i];
		}
	}
	return 0;
}