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

Previous submission (verdict: Wrong answer on test 2):
/********************      $$  CODE RED $$      ************************/
#include<bits/stdc++.h>
using namespace std;
#define int int32_t
#define nl cout << endl

/********* UNION OF TWO SETS ************/
#define union_sets(s, c, m) merge(s.begin(), s.end(), c.begin(), c.end(), inserter(m, m.end()))

#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define read(a, x) for (int i = 0; i < x; i++) cin >> a[i]
#define allsmall(s) transform(s.begin(), s.end(), s.begin(), [](char c){ return tolower(c); });
#define allcaps(s) transform(s.begin(), s.end(), s.begin(), [](char c){ return toupper(c); });

#define printvec(v) for (auto &el : v) cout << el << " "; nl
#define printmap(m) for (auto &p : m) cout << p.first << " " << p.second << endl;
#define print2dv(v) for (auto &row : v) { for (auto &el : row) cout << el << " "; nl; }
const int M = 1000000007;

#define fore(i, n) for (int i = 0; i < n; i++)
#define forr(i, a, b) for (int i = a; i <= b; i++)
#define sz(x) static_cast<int>(x.size())
#define rev(x) reverse(x.begin(), x.end())
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define endl '\n'

const int imax = INT_MAX >> 1;
const int INF = INT64_MAX >> 1;

#define in(v, n) vector<int> v(n); for (int &i : v) cin >> i;
#define pq(x) priority_queue<x>
#define map(x, y) map<x, y>
#define pr(x, y) pair<x, y>
#define vec(x) vector<x>
vector<int> prime;
set<int> prime_set;

// Modular arithmetic functions
int madd(int a, int b) { return (a + b) % M; }
int msub(int a, int b) { return (((a - b) % M) + M) % M; }
int mmul(int a, int b) { return ((a % M) * (b % M)) % M; }

int mpow(int base, int exp) {
  int res = 1;
  while (exp) {
    if (exp % 2 == 1) res = (res * base) % M;
    base = (base * base) % M;
    exp >>= 1;
  }
  return res;
}

int minv(int base) { return mpow(base, M - 2); }
int mdiv(int a, int b) { return mmul(a, minv(b)); }

// Prime number sieve
void primes(int n) {
  prime.assign(n + 1, 1);
  for (int p = 2; p * p <= n; p++) {
    if (prime[p]) {
      for (int i = p * p; i <= n; i += p) prime[i] = 0;
    }
  }
  for (int i = 2; i <= n; i++) {
    if (prime[i]) prime_set.insert(i);
  }
}

// Optimized isPrime function
bool isPrime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i += 6) {
    if (n % i == 0 || n % (i + 2) == 0) return false;
  }
  return true;
}

// Solve function template
void solve() {
  // Your problem-specific code here
    int a,b;
    cin>>a>>b;
    if(b-a==2){
        cout<<a<<" "<<b<<" "<<a+1<<endl;
        return;
    }
    string s1="";
    string s2="";
    while(a){
        s1+=to_string(a%2);
        a/=2;
    }
    while(b){
        s2+=to_string(b%2);
        b/=2;
    }
    reverse(all(s1));
    reverse(all(s2));
    while(s1.size()!=s2.size()){
        s1="0"+s1;
    }
    int num=0;
    for(int i=0;i<s1.size();i++){
        if(s1[i]!=s2[i]){
            int a=num;
            int b=num;
            int c=num;
            c+=(1<<(s1.size()-i-1))-2;
            a+=(1<<(s1.size()-i-1))-1;
            b+=(1<<(s1.size()-i-1));
            cout<<a<<" "<<b<<" "<<c<<endl;
            return;
        }
        else if(s1[i]=='1') num+=(1<<(s1.size()-i-1));
    }

}

// Main function
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int tc = 1;
  cin >> tc;
  for (int t = 1; t <= tc; t++) {
    solve();
  }
  return 0;
}

Submission (verdict: Accepted):
/********************      $$  CODE RED $$      ************************/
#include<bits/stdc++.h>
using namespace std;
#define int int32_t
#define nl cout << endl

/********* UNION OF TWO SETS ************/
#define union_sets(s, c, m) merge(s.begin(), s.end(), c.begin(), c.end(), inserter(m, m.end()))

#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define read(a, x) for (int i = 0; i < x; i++) cin >> a[i]
#define allsmall(s) transform(s.begin(), s.end(), s.begin(), [](char c){ return tolower(c); });
#define allcaps(s) transform(s.begin(), s.end(), s.begin(), [](char c){ return toupper(c); });

#define printvec(v) for (auto &el : v) cout << el << " "; nl
#define printmap(m) for (auto &p : m) cout << p.first << " " << p.second << endl;
#define print2dv(v) for (auto &row : v) { for (auto &el : row) cout << el << " "; nl; }
const int M = 1000000007;

#define fore(i, n) for (int i = 0; i < n; i++)
#define forr(i, a, b) for (int i = a; i <= b; i++)
#define sz(x) static_cast<int>(x.size())
#define rev(x) reverse(x.begin(), x.end())
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define endl '\n'

const int imax = INT_MAX >> 1;
const int INF = INT64_MAX >> 1;

#define in(v, n) vector<int> v(n); for (int &i : v) cin >> i;
#define pq(x) priority_queue<x>
#define map(x, y) map<x, y>
#define pr(x, y) pair<x, y>
#define vec(x) vector<x>
vector<int> prime;
set<int> prime_set;

// Modular arithmetic functions
int madd(int a, int b) { return (a + b) % M; }
int msub(int a, int b) { return (((a - b) % M) + M) % M; }
int mmul(int a, int b) { return ((a % M) * (b % M)) % M; }

int mpow(int base, int exp) {
  int res = 1;
  while (exp) {
    if (exp % 2 == 1) res = (res * base) % M;
    base = (base * base) % M;
    exp >>= 1;
  }
  return res;
}

int minv(int base) { return mpow(base, M - 2); }
int mdiv(int a, int b) { return mmul(a, minv(b)); }

// Prime number sieve
void primes(int n) {
  prime.assign(n + 1, 1);
  for (int p = 2; p * p <= n; p++) {
    if (prime[p]) {
      for (int i = p * p; i <= n; i += p) prime[i] = 0;
    }
  }
  for (int i = 2; i <= n; i++) {
    if (prime[i]) prime_set.insert(i);
  }
}

// Optimized isPrime function
bool isPrime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i += 6) {
    if (n % i == 0 || n % (i + 2) == 0) return false;
  }
  return true;
}

// Solve function template
void solve() {
  // Your problem-specific code here
    int a,b;
    cin>>a>>b;
    int l=a;
    string s1="";
    string s2="";
    while(a){
        s1+=to_string(a%2);
        a/=2;
    }
    while(b){
        s2+=to_string(b%2);
        b/=2;
    }
    reverse(all(s1));
    reverse(all(s2));
    while(s1.size()!=s2.size()){
        s1="0"+s1;
    }
    int num=0;
    for(int i=0;i<s1.size();i++){
        if(s1[i]!=s2[i]){
            int a=num;
            int b=num;
            int c=num;
            c+=(1<<(s1.size()-i-1))-2;
            a+=(1<<(s1.size()-i-1))-1;
            b+=(1<<(s1.size()-i-1));
            if(c>=l)
            { cout<<a<<" "<<b<<" "<<c<<endl; }
            else{
                cout<<a+1<<" "<<b+1<<" "<<c+1<<endl;
            }
            return;
        }
        else if(s1[i]=='1') num+=(1<<(s1.size()-i-1));
    }

}

// Main function
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int tc = 1;
  cin >> tc;
  for (int t = 1; t <= tc; t++) {
    solve();
  }
  return 0;
}