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,b,c;
	for(int i=32;i>=0;i--)
	{
		int mask = (1ll<<i);
		if((l&mask)!=(r&mask))
		{
			a|= mask;
			b|=(mask-1);
		}
		else
		{
			a|= ((l&mask)*mask);
			b|= ((l&mask)*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):
// Online C++ compiler to run C++ program online
using namespace std;
#include <bits/stdc++.h>

int main() {
    /*
    b1, b1, b2
    b1, b1
    b1, b1
    11, 10, 01: 01, 11, 10: 1 + 3 + 2 = 6
    
    01, 10, 00: 11, 10, 01: 6
    1000:
    1111, 0, 1
    100000, 1111111, 1111110
    n, n-1, n-2: where n is the largest set bit smaller than r
    101101:
    
    1000, 0111, 0110
    1<<i: 2^0, 2^1, 2^2
    (1<<i)&r != 0
    */
    int t;
    cin>>t;
    while(t--){
        int l, r;
        cin>>l>>r;
        int maxVal = 0;
        for(int i=0;i<33;i++){
            if((1<<i) & r){
                maxVal = (1<<i);
            }
        }
        cout<<maxVal<<" "<<maxVal-1<<" "<<maxVal-2<<endl;
    }
    
    
}