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

Solution 1 (runtime: 124 ms):
#include <bits\stdc++.h>

using namespace std;
typedef long long ll;

ll binary_to_ll(string s){
    ll n = 0;
    for (int i = 0; i < s.size(); i++)
    {
        n *= 2;
        n += (s[i]-'0');
    }
    return n;
}


int main(void){
    // ios::sync_with_stdio(false), cin.tie(nullptr);
    int t; cin >> t;
    while (t--)
    {
        ll l,r; cin >> l >> r;
        if(r-l == 2){
            cout << l << " " << l+1 << " " << l+2 << endl;
            continue;
        }
        ll a=r-2,b=r-1,c=r;
        string temp = bitset<64>(r).to_string();
        int size = 64-temp.find('1');
        string masked = string(size,'0');
        // for (int i = l; i <= r; i++)
        // {
        //     cout << i << ": " << bitset<64>(i).to_string() << endl;
        // }

        string l_str = bitset<64>(r).to_string();
        string r_str = bitset<64>(l).to_string();

        int distinct_bit = 0;
        string a_Str = "";
        for (int i = 0; i < 64; i++)
        {
            if(l_str[i] != r_str[i]){
                distinct_bit = i;
                break;
            }else{
                a_Str += l_str[i];
            }
        }

        a = binary_to_ll(a_Str+"0"+string(63-distinct_bit,'1'));
        b = a+1;
        if(min(r,a+b) != b){
            c = min(r,a+b);
        }else{
            c = max(l,1LL);
        }


        // for (int i = 0; i < masked.size(); i++)
        // {
        //     masked[i] = '1';
        //     ll toFind = binary_to_ll(masked);
        //     if(toFind <= r && toFind >= l+2){
        //         a = toFind;
        //         b = a-1;
        //         c = a-2;
        //         break;
        //     }
        // }
        // cout << "?" << (a^b)+(b^c)+(c^a) << endl;
        // ll a1[3];
        // for (int i = 0; i < 3; i++)
        // {
        //     cin >> a1[i];
        // }
        // cout << "?" << (a1[0]^a1[1])+(a1[2]^a1[1])+(a1[2]^a1[0]) << endl;
        cout << a << " " << b << " " << c << " \n";
    }
    return 0;
}
// auto print = [](std::ostream& os, auto... args) {
// ((os << args << " "), ...) << std::endl; // Fold expression
// };
// print(std::cout, a, b, c);

/*

i want to find three numbers such that most of their bits don't match, right? yes!

let's try this with only 2 numbers

0 and 8


0001
0010
0011

0100
0101
0110
0111
1000

0 and 8 will give me the highest xor if only two numbers are to be considered

0 and 8, the other highest needs to be considered now


a*(b+c) + b*c - this wont work


*/

Solution 2 (runtime: 93 ms):
#include <bits/stdc++.h>
#define fi first
#define se second

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int t;
int l, r;

void solve() {
    cin >> l >> r;
    // int x = r;

    int k = 0;
    for (int i = 0; i <= 30; i++) {
        if (r & (1 << i)) {
            k = i;
        }
    }
    int base = 0;
    int start = -1;
    for (int i = k; i >= 0; i--) {
        if ((r & (1 << i)) != 0 && (l & (1 <<i)) != 0) {
            base |= (1 << i);
        } else if (r & (1 << i)) {
            start = i;
            break;
        }
    }

    int x = base + (1 << start);
    int y = base + (1 << start) - 1;
    int z = 0;
    if (x + 1 > r) {
        z = y - 1;
    } else {
        z = x + 1;
    }

    cout << x << " " << y << " " << z << "\n";

}

int main() {
    cin >> t;
    while (t--) solve();
}