Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;

//MACROS
#define F first 
#define S second
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define pb push_back
#define PI 3.14159265359
#define endl '\n'

//ALIASES
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
using vpll = vector<pair<long long, long long>>;
using mll = map<long long, long long>;
using mcll = map<char, long long>;
using vvll = vector<vector<long long>>;
using sll = set<long long>;

//CONSTANTS
constexpr ld EPS = 1e-9;
constexpr ll MOD = 998244353 ;                          
constexpr ull INF = 2e18;

//OPERATOR OVERLOADING  
// cin >> pair<T1, T2>
template <typename T1, typename T2>
istream& operator>>(istream& istream, pair<T1, T2>& p){
    return (istream >> p.first >> p.second);
}
// cout << pair<T1, T2>
template <typename T1, typename T2> 
ostream& operator<<(ostream& ostream, const pair<T1, T2>& p){
    return (ostream << p.first << " " << p.second);
}
// cin >> vector<T>
template <typename T> 
istream& operator>>(istream& istream, vector<T>& v){
    for (auto& it : v) cin >> it;
    return istream;
}
// cout << vector<T>
template <typename T> 
ostream& operator<<(ostream& ostream, const vector<T>& c){
    for (auto& it : c) cout << it << " ";
    return ostream;
}
// cout << set<T>
template <typename T> 
ostream& operator<<(ostream& ostream, const set<T>& c){
    for (auto& it : c) cout << it << " ";
    return ostream;
}

ll l, r;

string binary(ll x){
    string s="";
    while(x>0){
        if(x%2==1) s.insert(0, 1, '1');
        else if(x%2==0) s.insert(0, 1, '0');
        x /= 2;
    }
    while(s.length()<64){
        s.insert(0, 1, '0');
    }
    return s;
}
ll numeric(string s){
    ll x=0; ll y = 0;
    for(ll i=0; i<s.length(); i++) {y = 1<<(s.length()-1LL-i); x += (s[i]=='1')*y;}
    return x;
}

void solve(){ 
    cin>>l>>r;
    if(r-l==2){
        cout<<l<<" "<<l+1<<" "<<r<<"\n";
        return;
    }
    string L = binary(l), R = binary(r);
    string A = "", B = "";
    for(int i=0; i<L.length(); i++){
        if(L[i] == R[i]) {A.pb(L[i]); B.pb(L[i]);}
        else break;
    }
    A.pb('1'); B.pb('0');
    while(A.length()<L.length()) {
        A.pb('0'); B.pb('1'); 
    }
    ll a = numeric(A), b=numeric(B), c=(a+b)/2;
    c -= (c==min(a, b));
    cout<<a<<" "<<b<<" "<<c<<"\n";
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1; cin>>t;
    while(t--) solve();
    return 0;
}     

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;

//MACROS
#define F first 
#define S second
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define pb push_back
#define PI 3.14159265359
#define endl '\n'

//ALIASES
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
using vpll = vector<pair<long long, long long>>;
using mll = map<long long, long long>;
using mcll = map<char, long long>;
using vvll = vector<vector<long long>>;
using sll = set<long long>;

//CONSTANTS
constexpr ld EPS = 1e-9;
constexpr ll MOD = 998244353 ;                          
constexpr ull INF = 2e18;

//OPERATOR OVERLOADING  
// cin >> pair<T1, T2>
template <typename T1, typename T2>
istream& operator>>(istream& istream, pair<T1, T2>& p){
    return (istream >> p.first >> p.second);
}
// cout << pair<T1, T2>
template <typename T1, typename T2> 
ostream& operator<<(ostream& ostream, const pair<T1, T2>& p){
    return (ostream << p.first << " " << p.second);
}
// cin >> vector<T>
template <typename T> 
istream& operator>>(istream& istream, vector<T>& v){
    for (auto& it : v) cin >> it;
    return istream;
}
// cout << vector<T>
template <typename T> 
ostream& operator<<(ostream& ostream, const vector<T>& c){
    for (auto& it : c) cout << it << " ";
    return ostream;
}
// cout << set<T>
template <typename T> 
ostream& operator<<(ostream& ostream, const set<T>& c){
    for (auto& it : c) cout << it << " ";
    return ostream;
}

ll l, r;

string binary(ll x){
    string s="";
    while(x>0){
        if(x%2==1) s.insert(0, 1, '1');
        else if(x%2==0) s.insert(0, 1, '0');
        x /= 2;
    }
    while(s.length()<64){
        s.insert(0, 1, '0');
    }
    return s;
}
ll numeric(string s){
    ll x=0; ll y = 0;
    for(ll i=0; i<s.length(); i++) {y = 1<<(s.length()-1LL-i); x += (s[i]=='1')*y;}
    return x;
}

void solve(){ 
    cin>>l>>r;
    if(r-l==2){
        cout<<l<<" "<<l+1<<" "<<r<<"\n";
        return;
    }
    string L = binary(l), R = binary(r);
    string A = "", B = "";
    for(int i=0; i<L.length(); i++){
        if(L[i] == R[i]) {A.pb(L[i]); B.pb(L[i]);}
        else break;
    }
    A.pb('1'); B.pb('0');
    while(A.length()<L.length()) {
        A.pb('0'); B.pb('1'); 
    }
    ll a = numeric(A), b=numeric(B), c=(a+b)/2;
    c -= (c==min(a, b));
    if(c<l) c += 3;
    cout<<a<<" "<<b<<" "<<c<<"\n";
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1; cin>>t;
    while(t--) solve();
    return 0;
}