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

Previous submission (verdict: Wrong answer on test 2):
//#pragma once
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using namespace std;

#define REP(i,a,b) for (int i = a; i < (b); i++)
#define rep(i,a,b) for (int i = a; i < (b); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef set<int> si;
typedef set<long long> sl;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll MOD = 1e9+7;
const double pi = acos(-1);


void solve_test_case(){
    ll l, r; cin >> l >> r;
    if(l == 1 && r == 3) {
        cout << 1 << " " << 2 << " " << 3 << "\n";
        return;
    }

    ll a, b, c;
    b = l;
    c = r;
    a = 0;
    for(int j = 30; j >= 0; j--) {
        if((r & (1ll << j)) == (l & (1ll << j))) {
            if(r & (1ll << j)) {
                a |= (1ll << j);
            }
        }else{
            for(int w = j - 1; w >= 0; w--) {
                if((l & (1ll << w)) == 0) a |= (1ll << w);
            }

            if(a < l) a |= (1 << j);
            break;
        }
    }

    vl ans = {a, b, c};
    sort(all(ans));
    if(ans[1] == ans[2]) ans[1]--;
    cout << ans[0] << " " << ans[1] << " " << ans[2] << "\n";
    assert(ans[0] != ans[1]);
    assert(ans[0] != ans[2]);
    assert(ans[1] != ans[2]);
}


int main(){
    ios::sync_with_stdio(0);
    cout << setprecision(20) << fixed;
    cin.tie(0);
    cout.tie(0);
    int tc = 1;
    cin >> tc;


    rep(i,1,tc + 1) {
        //cout << "Case #" << i << ": ";
        solve_test_case();
    }

    return 0;
}


Submission (verdict: Wrong answer on test 1):
//#pragma once
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using namespace std;

#define REP(i,a,b) for (int i = a; i < (b); i++)
#define rep(i,a,b) for (int i = a; i < (b); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef set<int> si;
typedef set<long long> sl;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll MOD = 1e9+7;
const double pi = acos(-1);


void solve_test_case(){
    ll l, r; cin >> l >> r;
    ll a, b, c;
    b = l;
    c = r;
    a = 0;
    for(int j = 30; j >= 0; j--) {
        if((r & (1ll << j)) == (l & (1ll << j))) {
            if(r & (1ll << j)) {
                a |= (1ll << j);
            }
        }else{
            a |= (1ll << j);
            if(a == c) a--; 
            for(int w = j - 1; w >= 0; w--) {
                if((c & (1ll << w)) == 0 && (a & (1ll << w) == 0)) b |= (1ll << w);
            }
            break;
        }
    }

    vl ans = {a, b, c};
    sort(all(ans));
    if(ans[1] == ans[2]) ans[1]--;
    cout << ans[0] << " " << ans[1] << " " << ans[2] << "\n";
    assert(ans[0] != ans[1]);
    assert(ans[0] != ans[2]);
    assert(ans[1] != ans[2]);
}


int main(){
    ios::sync_with_stdio(0);
    cout << setprecision(20) << fixed;
    cin.tie(0);
    cout.tie(0);
    int tc = 1;
    cin >> tc;


    rep(i,1,tc + 1) {
        //cout << "Case #" << i << ": ";
        solve_test_case();
    }

    return 0;
}