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

Previous submission (verdict: Wrong answer on test 1):
// Pragmas
#pragma GCC optimize("O3,unroll-loops")

// header files
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // for pbds
#include <ext/pb_ds/tree_policy.hpp>

// namespace
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;

/* ordered set*/
template <class T, class cmp = less_equal<T>>
using ordered_set = tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/* ordered map*/
template <class key, class value, class cmp = less_equal<key>>
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
/* find_by_order(k)  returns iterator to kth element starting from 0;
 * order_of_key(k) returns count of elements strictly smaller than k;*/

/* min heap*/
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
using max_heap = priority_queue<T>;

// Constants
#define PI 3.1415926535
#define INF 4e18
#define EPS 1e-9
#define MOD 1000000007

// Aliases
using ll = long long int;
using ull = unsigned long long int;
using ld = long double;

// macros
#define int long long
#define all(s) s.begin(), s.end()
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#define ppc __builtin_popcount
#define parity(x) __builtin_parity(x) // gives true for odd and false for even
#define ppcll __builtin_popcountll
#define msb(x) 63 - __builtin_clzll(x) // gives the most significant bit of the number
#define sz(x) (int)x.size()
#define F first
#define acc accumulate
#define S second
#define amax(a, b) a = max(a, b)
#define amin(a, b) a = min(a, b)
#define getunique(v)                                  \
    {                                                 \
        sort(v.begin(), v.end());                     \
        v.erase(unique(v.begin(), v.end()), v.end()); \
    }
#define kickstart(x)                 \
    {                                \
        cout << "Case #" << x << ":" \
             << " ";                 \
    }
#define hi cout << "hi" << endl


// Operator overloads
template <typename T1, typename T2> // cin >> pair<T1, T2>
istream &operator>>(istream &istream, pair<T1, T2> &p)
{
    return (istream >> p.first >> p.second);
}

template <typename T> // cin >> vector<T>
istream &operator>>(istream &istream, vector<T> &v)
{
    for (auto &it : v)
        cin >> it;
    return istream;
}

template <typename T1, typename T2> // cout << pair<T1, T2>
ostream &operator<<(ostream &ostream, const pair<T1, T2> &p)
{
    return (ostream << p.first << " " << p.second);
}
template <typename T> // cout << vector<T>
ostream &operator<<(ostream &ostream, const vector<T> &c)
{
    for (auto &it : c)
        cout << it << " ";
    return ostream;
}
vector<pair<int, int>> dir = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};

/* ----------------------------------Things get better by time, hope for the best-----------------*/
void solve(int testcase)
{
    // kickstart(testcase);
    // debug(testcase);
	int l,r;
	cin>>l>>r;
	int a=0,b=0,c;
	for(int i=32;i>=0;i--)
	{
		int mask = (1ll<<i);
		if((l&mask)!=(r&mask))
		{
			a|= mask;
			b|=(mask-1);
			break;
		}
		else
		{
			bool f = (l&mask);
			a|= (f*mask);
			b|= (f*mask);
		}
	}
	for(int i=l;i<=r;i++)
	{
		if(i!=a&&i!=b)
		{
			c=i;
			break;
		}
	}
	cout<<a<<" "<<b<<" "<<c<<endl;

}

int32_t main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout << fixed << setprecision(25);
    cerr << fixed << setprecision(10);
    auto start = std::chrono::high_resolution_clock::now();
    int n = 1;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        solve(i);
    }
    auto stop = std::chrono::high_resolution_clock::now();
    auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start);
    // cerr << "Time taken : " << ((long double)duration.count())/((long double) 1e9) <<"s "<< endl;
    return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll , null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define endl '\n'
#define ll long long
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;

const int mod = 1000000007;
const int N = 2e5 + 5;
const int base = 59, base1 = 59;

random_device rd;
mt19937 gen(rd());
uniform_int_distribution<> d(0, 1e9);

void solve(){
    ll l, r;
    cin >> l >> r;
    ll x = r;
    ll y = l;
    ll z = l, cnt = 0;
    for(int i = 30; i >= 0; i--){
        if(!(x & (1 << i)) and !(y & (1 << i))){
            continue;
        }
        if((x & (1 << i)) and (y & (1 << i))){
            continue;
        }
        cnt = i;
        break;
    }
    ll maks = 0, dif = 0;
    for(int i = 0; i <= cnt; i++){
        if(!(y & (1 << i))){
            dif += pow(2, i);
        }
        else{
            dif -= pow(2, i);
        }
        if(dif + z < r and dif + z > l){
            maks = i;
        }
    }
    for(int i = 0; i <= maks; i++){
        if(!(y & (1 << i))){
            z += pow(2, i);
        }
        else{
            z -= pow(2, i);
        }
    }
    cout << x << " " << y << " " << z << endl;
}
int main(){
    io;
    ll t;
    cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
/*
9
ejibmyyju

*/