Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
 
#define endl '\n'
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long int,long long int> pll;
typedef vector<int> vi;
typedef vector<long long int> vll;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<long long int,long long int>> vpll;
typedef map<long long int,long long int> mll;
typedef unordered_map<long long int,long long int> umll;
typedef set<int> si;
typedef set<char> sc;
#define F first
#define S second
#define sz(a) int((a).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vpdsort(a) sort(a.rbegin(),a.rend())
#define vpasort(a) sort(a.begin(),a.end())
#define asort(a) sort(a.begin(),a.end())
#define dsort(a) sort(a.begin(),a.end(),greater<long long int>())
#define ai(i,s,n) for(int i=s ; i<n ;++i ){ cin>>arr[i]; }
#define pb push_back
#define mp make_pair
void debug() { cout<<"debug\n";}
void yes() { cout<<"YES\n"; }
void no() { cout<<"NO\n"; }
void swapint(int* a,int* b){ int t=*a; *a=*b; *b=t;}
void swapv(vll &v,ll i,ll j){ ll t=v[i];v[i]=v[j];v[j]=t;}
#define mod 1e9 + 7
#define PI 3.1415926535897932384626433832795
 
 
void solve()
{
    ll l,r;cin>>l>>r;
    int tbit = 0;
    for(int i=29;i>=0;--i){
        if(((r&(1LL<<i))!=0) && ((l&(1LL<<i))==0)){
            tbit = i;
            break;
        }
    }
    // cout<<tbit<<endl;
    ll a = r;
    ll b = r;
    ll c = r;
    for(int i=0;i<tbit;++i){
        a = a & (~(1LL<<i));
        b = b || (1LL<<i);
    }
    b = b & (~(1LL<<tbit));
    for(ll i=l;i<=r;++i){
        if(i!=a && i!=b){
            c = i;
            break;
        }
    }
    cout<<a<<" "<<b<<" "<<c<<endl;
}
 


/* main()  FUNCTION */
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int tc;cin >> tc;
    while(tc--) 

    solve();
    return 0;
}

Submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <vector>
#include <stack>
#include <limits.h>
#include <set>
#include <string>
#include <math.h>
#include <deque>
#include <queue>
#include <string>
#include <iomanip>
using namespace std;

/********************************************************

// Important header files   
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
#include <iostream>  
using namespace __gnu_pbds;  
  
// Declaring ordered_set 
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update>  
    ordered_set;  

// declaration syntax : ordered_set st;
// index syntax : st.order_of_key('element'); 

*******************************************************/

vector<long long> findprime(long long n)
{   
    n += 1LL;
    vector<int>prime(n, 0);

    for(long long i = 2; i < n; i++)
    {
        if(prime[i] == 0)
        {
            for(long long j = i; j < n; j+=i) prime[j] = (-1);
            //cout << "marking i : " << i << endl;
            prime[i] = 1;
        }
    }

    vector<long long>p;
    for(long long i = 2; i < n; i++)
    {   
        if(prime[i] == 1) p.push_back(i);
    }
    return p;
}


long long lcm(long long a, long long b) 
{ 
    long long greater = max(a, b); 
    long long smallest = min(a, b); 
    for (long long i = greater; ; i += greater) { 
        if (i % smallest  == 0) 
            return i; 
    } 
} 

void findRoots(long long a, long long b, long long c, long long &root1, long long &root2)
{
    // If a is 0, then equation is
    // not quadratic, but linear
    if (a == 0) {
        // cout << "Invalid";
        root1 = -1LL, root2 = -1LL;
        return;
    }

    long long d = b * b - 4 * a * c;
    double sqrt_val = sqrt(abs(d));

    if (d > 0) {
        // cout << "Roots are real and different ";
        // cout << (double)(-b + sqrt_val) / (2 * a) << " "
        //      << (double)(-b - sqrt_val) / (2 * a);
        root1 = (double)(-b + sqrt_val) / (2 * a);
        root2 = (double)(-b - sqrt_val) / (2 * a);
    }
    else if (d == 0) {
        // cout << "Roots are real and same ";
        // cout << -(double)b / (2 * a);
        root1 = -(double)b/(2*a);
        root2 = -(double)b/(2*a);
    }

    // d < 0
    else {
        // cout << "Roots are complex ";
        // cout << -(double)b / (2 * a) << " + i"
        //      << sqrt_val / (2 * a) << " "
        //      << -(double)b / (2 * a) << " - i"
        //      << sqrt_val / (2 * a);
        root1 = 1LL;
        root2 = 1LL;
    }
}

long long gcd(long long a, long long b) 
{ 
    // Find Minimum of a and b 
    long long result = min(a, b); 
    while (result > 0) { 
        if (a % result == 0 && b % result == 0) { 
            break; 
        } 
        result--; 
    } 
  
    // Return gcd of a and b 
    return result; 
}





/************************ Main code ************************/


void print(vector<long long>v, string s)
{
    cout << s << " : ";
    for(auto i : v) cout << i << " ";
    cout << endl; 
}
void print(vector<string>v, string s)
{
    cout << s << " :-" << endl;
    for(auto i : v) cout << i << endl;
    cout << endl; 
}

void print(vector<vector<int>>vv, string s)
{;
    cout << s << " :-" << endl;
    for(auto i : vv)
    {
        for(auto j : i) cout << j << " ";
        cout << endl;
    }
}



struct month{

    string name;
    int num;
};


int main() {


#ifndef ONLINE_JUDGE
//for getting input from input.txt
freopen("input.txt", "r", stdin);
//for writing output to output.txt
freopen("output.txt", "w", stdout);
#endif
    
int tt;
cin >> tt;
while(tt--){

    int l, r;
    cin >> l >> r;

    int toadd = 0;

    for(int shift = 30; shift >= 0; shift--) {
        int power = 1 << shift;

            // cout << "l : " << l << " power : " << power << " r : " << r << endl;

        if((power <= r)) {

            // cout << "[Hit] l : " << l << " power : " << power << " r : " << r << endl;

            if(l <= power-1){ 

                int third;
                if(l <= power-2) third = power-2;
                else third = power+1;

                cout << (power + toadd) << " " << (power-1 + toadd) << " " << (third + toadd) << endl;
                break;
            }
            else {
                l -= power;
                r -= power;

                toadd += power;
            }
        }
    }
    // cout << "tt : " << tt << endl;
}


return 0;
}