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 ll = long long;
using namespace std;
 
ll t;
 
void printArr(vector<int> &a){
    for(int i=0; i<a.size(); i++){
        cout<<a[i]<<" ";
    }
    cout<<'\n';
}


void solve(){

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

    bool flag = false;

    int a=0, b=0, c=1;

    int bit = -1;

    if(r-l+1 == 3){
        cout<<l<<" "<<l+1<<" "<<r<<"\n";
        return;
    }

    for(int i=31; i>=0; i--){
        
        int lbit = (( 1 << i ) & l);
        int rbit = ((1 << i) & r);

        // cout<<"i th bit: " << i << "  " << "Lbit -> "<<lbit<<"  "<<"Rbit "<<rbit<<'\n';

        if(!(lbit ^ rbit)){
            if(rbit != 0){
                a |= (1 << i);
                b |= (1 << i);
                c |= (1 << i);
            }
        }else{
            bit = i;
            break;
        }
    }

    // cout<<a<<" "<<b<<" "<<c<<endl;
    // cout<<"First bit: "<<bit<<endl;

    while(bit >= 0){
        int rbit = (1 << bit) & r;
        int lbit = (1 << bit) & l;

        if(rbit && !lbit){
            a |= (1 << bit);
        }else {
            break;
        } 
        bit--;
    }

    // cout<<"Second bit: "<<bit<<endl;


    while(bit >= 0){
        int rbit = (1 << bit) & r;
        int lbit = (1 << bit) & l;

        if(lbit){
            b |= (1 << bit);
        }else{
            break;
        }
        bit--;
    }

    while(bit > 0){
        c |= (1<<bit);
        bit--;
    }

    if(b==l){
        c = b+1;
    }



    // cout<<"Third bit: "<<bit<<endl;


    

    cout<<a<<" "<<b<< " "<<c<<endl;

    // R  1 0 1 1 1 0 0 => 
    // L  1 0 1 0 0 1 1

    // 1 0 1 1 0
    // 0 0 1 1 0

    // 1 0
    // 0 0

    // 0 1 1 1 1 1 1 1
    // 0 1 1 1 0 0 1 1
}
 
int main() {
 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    cin>>t;
    while(t--){
        solve();
    }
 
    return 0;
}

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
 
ll t;
 
void printArr(vector<int> &a){
    for(int i=0; i<a.size(); i++){
        cout<<a[i]<<" ";
    }
    cout<<'\n';
}


void solve(){

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

    bool flag = false;

    int a=0, b=0, c=0;

    vector<int> av, bv, cv;
    if(r-l+1 == 3){
        cout<<l<<" "<<l+1<<" "<<r<<"\n";
        return;
    }

    int bits = (int)(log(r) / log(2));

    while(bits >= 0 && l!=0) {

        int lbit = ((1 << bits) & l) && 1;
        int rbit = ((1 << bits) & r) && 1;

        if(!(rbit ^ lbit)){
            if(rbit==1){
                a |= (1 << bits);
                b |= (1 << bits);
                c |= (1 << bits);
            }
        }else{
            break;
        }
        bits--;
    }

    // cout<<bits<<'\n';
    // cout<<a<<endl;
    a |= (1 << bits);
    bits--;

    while(bits >= 0 && ((( 1 << bits ) & l) == 0)){
        b |= (1 << bits);
        bits--;
    }

    while(bits >= 0){
        c |= (1 << bits);
        bits--;
    }

    if(c == b){
        b = c+1;
    }

    cout<< a <<" "<< b << " "<< c <<endl;

    // R  1 0 1 1 1 0 0 => 
    // L  1 0 1 0 0 1 1

    // 1 0 1 1 0
    // 0 0 1 1 0

    // 1 0
    // 0 0

    // 0 1 1 1 1 1 1 1
    // 0 1 1 1 0 0 1 1

    // 0 1 1 1 1 0 0 0
    // 0 1 1 1 0 1 0 0
    // 0 1 1 1 0 0 1 1

    // 0 1 0 0 1 0 0 1
    // 0 1 0 0 0 0 0 0

    // 1 0 0
    // 0 1 1
    


}
 
int main() {
 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    cin>>t;
    while(t--){
        solve();
    }
 
    return 0;
}