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

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ull unsigned long long 
#define int long long int
 
#define init ios_base::sync_with_stdio(false); cin.tie(NULL);
#define no cout << "NO\n"
#define yes cout << "YES\n"
#define mod 1000000007
#define endd cout << "\n"
#define endl "\n"
#define came cout<<"came\n";
 
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; __print(x); cerr << endl;
#else 
#define debug(x)
#endif
//----------------------------------------------------------------------------------------------  
template<class T>
void __print(T t){cerr<<t<<" ";}
template<class T>
void in(T a[],int n){for(int i=0;i<n;i++) cin>>a[i];}
template<class T> 
void out(T a[], int x){for(int i = 0; i < x; i++){cout << a[i] << " "; } cout << endl;}
template<class T> 
void in(vector<T>& a, int n){for(int i = 0; i < n; i++){ T x; cin >> x; a.push_back(x);}}
template<class T>
void in(vector<vector<T>>& a,int n,int m){vector<T> tp;for(int i=0;i<n;i++){tp.clear();in(tp,m);a.push_back(tp);}}
template<class T>
void out(vector<T> a){for(auto i : a)cout << i << " ";cout << endl;}
struct pair_hash{
template <class T1, class T2>
std::size_t operator()(const pair<T1, T2>& pair) const {return std::hash<T1>()(pair.first) ^ (std::hash<T2>()(pair.second) << 1);}};
class DSU{
 public:
    vector<int> parent,rank,size;
    DSU(int n){
         // rank.resize(n+1,0);
         parent.resize(n+1);
         size.resize(n+1,1);
         iota(parent.begin(),parent.end(),0);
    }
    //finding ultimate parent()
    int fup(int node){
         if(node == parent[node]) return node;
         // path compression
         return parent[node] = fup(parent[node]);
    }
    // union by rank()
    void joinr(int u,int v){
         int p1 = fup(u), p2 = fup(v);
         if(p1==p2) return;
         else if(rank[p1]>rank[p2]){
             parent[p2]=p1;
         }
         else if(rank[p2]>rank[p1]){
             parent[p1]=p2;
         }
         else{
            parent[p1]=p2;
            //we ar attaching component p1 to p2
            rank[p2]++;
         }
    }
    // union by size()
    void joins(int u,int v){
        int p1 = fup(u);
        int p2 = fup(v);
        if(p1==p2) return;
        else if(size[p1]>size[p2]) size[p1]+=size[p2],parent[p2]=p1;
        else size[p2]+=size[p1],parent[p1]=p2;
    }};
inline int fib(int n) {const double phi = (1 + sqrt(5)) / 2;const double psi = (1 - sqrt(5)) / 2;return round((pow(phi, n) - pow(psi, n)) / sqrt(5));}
inline int gcd(int A, int B){while(A>0&&B>0){if(A>B) A%=B;else B%=A;}return ((A==0)?B:A);}
inline int lcm(int A, int B) {return ((A * B) / (gcd(A, B)));}
inline bool isprime(int X) {if(X==1) return 0;if (X == 2) return true;for (int i = 2; i <= sqrt(X); i++) {if ((X % i) == 0)return false;}return true;}
// int Mod(string &a,int k){int rem=0;for(int i=0;i<a.size();i++){rem = (rem*10+(a[i]-'0'))%k;}return rem;}
class sieve{
  public:
  int n;
  vector<bool> is_prime;
  vector<int> primes;  
  sieve(int n){
     this->n=n;
     is_prime.resize(n+1,true);
     is_prime[0] = is_prime[1] = false;
     for(int i=2;i<=n;i++){
     if(is_prime[i]){
        primes.push_back(i);
        for(int j=i*i;j<=n;j+=i)
            is_prime[j] = false;
    }
   }
  }
  bool fun(int ind){
     return is_prime[ind];
  } };
int pow(int a,int b){if(b==0) return 1;int res=pow(a,b/2);if(b%2) return ((((res*res)%mod)*a)%mod);else return ((res*res)%mod);}
int modInverse(int a,int p){int res=1,exp=p-2;while(exp){if(exp%2)res=(1LL*res*a)%p;a=(1LL*a*a)%p; exp/=2;}return res;}
//-------------------------------------------------UDF------------------------------------------------
signed main(){
    init;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);  
    #endif
    ll _ = 1;
    cin >> _;
    while(_--){
       int l,r;cin>>l>>r;
       bitset<30> a(l),b(r);
       
       for(int i=30;i>1;i--){
           if(a[i]!=b[i]){
              for(int j=i+1;j>=0;j--) a[i]=1,b[i]=0;
              break;
           }
       }
       int x=a.to_ulong(),y=b.to_ulong();
       cout<<x<<" "<<y<<" ";
       for(int i=l;i<=r;i++){
         if(i!=x&&i!=y){cout<<i<<endl;break;}
       }
    }  
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ull unsigned long long 
#define int long long int
 
#define init ios_base::sync_with_stdio(false); cin.tie(NULL);
#define no cout << "NO\n"
#define yes cout << "YES\n"
#define mod 1000000007
#define endd cout << "\n"
#define endl "\n"
#define came cout<<"came\n";
 
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; __print(x); cerr << endl;
#else 
#define debug(x)
#endif
//----------------------------------------------------------------------------------------------  
template<class T>
void __print(T t){cerr<<t<<" ";}
template<class T>
void in(T a[],int n){for(int i=0;i<n;i++) cin>>a[i];}
template<class T> 
void out(T a[], int x){for(int i = 0; i < x; i++){cout << a[i] << " "; } cout << endl;}
template<class T> 
void in(vector<T>& a, int n){for(int i = 0; i < n; i++){ T x; cin >> x; a.push_back(x);}}
template<class T>
void in(vector<vector<T>>& a,int n,int m){vector<T> tp;for(int i=0;i<n;i++){tp.clear();in(tp,m);a.push_back(tp);}}
template<class T>
void out(vector<T> a){for(auto i : a)cout << i << " ";cout << endl;}
struct pair_hash{
template <class T1, class T2>
std::size_t operator()(const pair<T1, T2>& pair) const {return std::hash<T1>()(pair.first) ^ (std::hash<T2>()(pair.second) << 1);}};
class DSU{
 public:
    vector<int> parent,rank,size;
    DSU(int n){
         // rank.resize(n+1,0);
         parent.resize(n+1);
         size.resize(n+1,1);
         iota(parent.begin(),parent.end(),0);
    }
    //finding ultimate parent()
    int fup(int node){
         if(node == parent[node]) return node;
         // path compression
         return parent[node] = fup(parent[node]);
    }
    // union by rank()
    void joinr(int u,int v){
         int p1 = fup(u), p2 = fup(v);
         if(p1==p2) return;
         else if(rank[p1]>rank[p2]){
             parent[p2]=p1;
         }
         else if(rank[p2]>rank[p1]){
             parent[p1]=p2;
         }
         else{
            parent[p1]=p2;
            //we ar attaching component p1 to p2
            rank[p2]++;
         }
    }
    // union by size()
    void joins(int u,int v){
        int p1 = fup(u);
        int p2 = fup(v);
        if(p1==p2) return;
        else if(size[p1]>size[p2]) size[p1]+=size[p2],parent[p2]=p1;
        else size[p2]+=size[p1],parent[p1]=p2;
    }};
inline int fib(int n) {const double phi = (1 + sqrt(5)) / 2;const double psi = (1 - sqrt(5)) / 2;return round((pow(phi, n) - pow(psi, n)) / sqrt(5));}
inline int gcd(int A, int B){while(A>0&&B>0){if(A>B) A%=B;else B%=A;}return ((A==0)?B:A);}
inline int lcm(int A, int B) {return ((A * B) / (gcd(A, B)));}
inline bool isprime(int X) {if(X==1) return 0;if (X == 2) return true;for (int i = 2; i <= sqrt(X); i++) {if ((X % i) == 0)return false;}return true;}
// int Mod(string &a,int k){int rem=0;for(int i=0;i<a.size();i++){rem = (rem*10+(a[i]-'0'))%k;}return rem;}
class sieve{
  public:
  int n;
  vector<bool> is_prime;
  vector<int> primes;  
  sieve(int n){
     this->n=n;
     is_prime.resize(n+1,true);
     is_prime[0] = is_prime[1] = false;
     for(int i=2;i<=n;i++){
     if(is_prime[i]){
        primes.push_back(i);
        for(int j=i*i;j<=n;j+=i)
            is_prime[j] = false;
    }
   }
  }
  bool fun(int ind){
     return is_prime[ind];
  } };
int pow(int a,int b){if(b==0) return 1;int res=pow(a,b/2);if(b%2) return ((((res*res)%mod)*a)%mod);else return ((res*res)%mod);}
int modInverse(int a,int p){int res=1,exp=p-2;while(exp){if(exp%2)res=(1LL*res*a)%p;a=(1LL*a*a)%p; exp/=2;}return res;}
//-------------------------------------------------UDF------------------------------------------------
signed main(){
    init;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);  
    #endif
    ll _ = 1;
    cin >> _;
    while(_--){
       int l,r;cin>>l>>r;
       bitset<30> a(l),b(r);
       
       for(int i=30;i>=0;i--){
           if(a[i]!=b[i]){
              for(int j=i-1;j>=0;j--) a[j]=1,b[j]=0;
              break;
           }
       }
       int x=a.to_ulong(),y=b.to_ulong();
       cout<<x<<" "<<y<<" ";
       for(int i=l;i<=r;i++){
         if(i!=x&&i!=y){cout<<i<<endl;break;}
       }
    }  
}