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

Code 1:
#include <bits/stdc++.h>
using namespace std;

#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef unordered_map<ll, ll> umpl;
typedef unordered_map<int, int> umpi;
typedef map<ll, ll> mpl;
typedef map<int, int> mpi;
typedef priority_queue<ll> pql;
typedef priority_queue<int> pqi;
typedef priority_queue<ll, vector<ll>, greater<ll>> minpql;
typedef priority_queue<int, vector<int>, greater<int>> minpqi;
typedef stack<ll> stl;
typedef stack<int> sti;
const ll mod = 1'000'000'007;
const ll N = 3e5, M = N;
vpii dir = {{1,0},{-1,0},{0,1},{0,-1}};
vpii dir1 = {{1,0},{-1,0},{0,1},{0,-1},{1,1},{-1,-1},{1,-1},{-1,1}};
//=======================

vi g[N];

ll logB2(ll n)
{
    ll count=0;
    while (n>0)
    {
        n/=2;
        count++;
    }
    return count;
}

ll XNOR(ll a, ll b)
{
	ll numOfBits = logB2(max(a, b));
	ll mask = (1 << numOfBits) - 1;
	ll xnor = ~(a ^ b);
	return xnor & mask;
}
void solve()
{
    ll n, i, j, k, m;
    ll l,r;
    cin>>l>>r;
    ll a=l;
    ll b=r;
    ll count=0;
    while (a!=b)
    {
        a/=2;
        b/=2;
        count++;
    }
    ll num=a;
    num=num<<count;
    num=num|(1<<(count-1));
    if(num-2<l)
    {
        cout<<num<<" "<<num-1<<" "<<num+1<<endl;
    }
    else
    {
        cout<<num<<" "<<num-1<<" "<<num-2<<endl;
    }
    
    
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    ll t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    // solve();
    return 0;
}


Code 2:
#include <bits/stdc++.h>
using namespace std;

#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef unordered_map<ll, ll> umpl;
typedef unordered_map<int, int> umpi;
typedef map<ll, ll> mpl;
typedef map<int, int> mpi;
typedef priority_queue<ll> pql;
typedef priority_queue<int> pqi;
typedef priority_queue<ll, vector<ll>, greater<ll>> minpql;
typedef priority_queue<int, vector<int>, greater<int>> minpqi;
typedef stack<ll> stl;
typedef stack<int> sti;
const ll mod = 1'000'000'007;
const ll N = 3e5, M = N;
vpii dir = {{1,0},{-1,0},{0,1},{0,-1}};
vpii dir1 = {{1,0},{-1,0},{0,1},{0,-1},{1,1},{-1,-1},{1,-1},{-1,1}};
//=======================

vi g[N];

ll logB2(ll n)
{
    ll count=0;
    while (n>0)
    {
        n/=2;
        count++;
    }
    return count;
}

ll XNOR(ll a, ll b)
{
	ll numOfBits = logB2(max(a, b));
	ll mask = (1 << numOfBits) - 1;
	ll xnor = ~(a ^ b);
	return xnor & mask;
}
void solve()
{
    ll n, i, j, k, m;
    ll l,r;
    cin>>l>>r;
    // if(temp+1 <=r)
    // {
    //     if(temp-1>=l)
    //     {
    //         // cout<<temp<<" "<<r<<" "<<temp-1<<endl;
    //         // cout<<temp<<" "<<temp+1<<" "<<temp-1<<endl;
    //         // cout<<(temp^(temp+1)+((temp-1)^(temp+1))+(temp^(temp-1)))<<endl;
    //         ll a=temp;
    //         ll b=temp-1;
    //         // ll c=temp+1;
    //         ll c=r;
    //         cout<<(a^b) + (b^c) + (c^a)<<endl;
    //     }
    //     else
    //     {
    //         cout<<temp<<" "<<temp+1<<" "<<temp+2<<endl;
    //         // cout<<(temp^(temp+1)+((temp-1)^(temp+1))+(temp^(temp-1)))<<endl;
    //         ll a=temp;
    //         ll b=temp+2;
    //         ll c=temp+1;
    //         cout<<(a^b) + (b^c) + (c^a)<<endl;
            
    //     }
        
    // }
    
    // else
    // {
    //     cout<<temp<<" "<<temp-2<<" "<<temp-1<<endl;
    //     cout<<(temp^(temp-2)+((temp-1)^(temp-2))+(temp^(temp-1)))<<endl;
    // }
    // ll a=134;
    // ll b=132;
    // ll c=137;
    // 98 85 76
    // ll a=7;
    // ll b=16;
    // ll c=11;
    // cout<<(a^b) + (b^c) + (c^a)<<endl;
    // a=22;
    // b=6;
    // c=9;
    // cout<<(a^b) + (b^c) + (c^a)<<endl;
    // ll num=l^r;
    // if(num>=r)
    // {
    //     num/=2;
    // }
    // if(num<=l)
    // {
    //     num*=2;
    // }
    // // ll temp=logB2(l);
    // // temp=pow(2, (temp-1));
    // // num=temp;
    // // if(num==r)
    // // {
    // //     num/=2;
    // // }
    // ll f=l;
    // ll s=r;
    // // // cout<<num<<endl;
    // // ll count=0;
    // // while (l>0 || r>0)
    // // {
    // //     ll bit1=l&1;
    // //     ll bit2=r&1;
    // //     l=l/2;
    // //     r=r/2;
    // //     if(r==0 && l==0 )
    // //     {
    // //         break;
    // //     }
    // //     if(bit1==bit2)
    // //     {
    // //         if(bit1==0)
    // //         {
    // //             num=num|(1<<count);
    // //         }
    // //     }
    // //     count++;
    // // }
    // cout<<f<<" "<<s<<" "<<num<<endl;

    // ll a=7;
    // ll b=16;
    // ll c=11;
    // // cout<<(a^b) + (b^c) + (c^a)<<endl;
    // ll num=XNOR(l,r);
    // if(num>=r)
    // {
    //     num/=2;
    // }
    // if(num<=l)
    // {
    //     num*=2;
    // }
    // cout<<num<<" "<<l<<" "<<r<<endl;
    // ll a=2;
    // ll b=8;
    // ll c=7;
    // cout<<(a^b) + (b^c) + (c^a)<<endl;
    ll temp=logB2(r);
    ll temp1=temp;
    temp1--;
    temp=pow(2, (temp-1));
    ll num=temp;
    // cout<<num<<endl;
    if(num<=r-1 && num>=l+1)
    {
        cout<<num-1<<" "<<num<<" "<<num+1<<endl;
        return;
    }
    if(num==r)
    {
        cout<<num<<" "<<num-1<<" "<<num-2<<endl;
        return;
    }
    if(num<=l)
    {
        while (1)
        {
            ll newNum=num;
            newNum=newNum|(1<<temp1);
            if(newNum<=r-1 && newNum>=l+1)
            {
                cout<<newNum-1<<" "<<newNum<<" "<<newNum+1<<endl;
                return;
            }
            if(newNum==r)
            {
                cout<<newNum<<" "<<newNum-1<<" "<<newNum-2<<endl;
                return;
            }
            num=newNum;
            // cout<<num<<endl;
            temp1--;
            if(temp1<0)
            {
                break;
            }
        }
        
    }


}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    ll t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    // solve();
    return 0;
}


Answer: 1