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

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define fi first
#define se second
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb push_back
#define cntbit __builtin_popcountll
#define pii pair<int, int>
#define vii vector<pair<int, int>>
#define ll long long
#define all(x) (x).begin(), (x).end()
using namespace std;
const int N = 200010; 
const int inf = 1ll<<62;
const int mod = 998244353;
void chkmax(int &a,int b){
    a = max(a, b);
}
void chkmin(int &a,int b){
	a = min(a, b);
}
void add(int &a, int b) {
    a += b;
    if (a >= mod) a -= mod;
}
void sub(int &a,int b){
	a -= b;
	if(a < 0) a += mod;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int qmi(int a, int b) {
    int res = 1;
    for (; b; b >>= 1) {
        if (b & 1) res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}
vector<int> con(int x){
	vector<int> r;
	while(x){
		r.pb(x&1);
		x/=2;
	}
	reverse(all(r));
	return r;
}
int g(int a,int b,int c){
	return (a^b)+(a^c)+(b^c); 
}
void solve(){
	int l,r;
	cin>>l>>r;
	int base=0;
	vector<int> L=con(l);
	vector<int> R=con(r);
	if(L.size()<R.size()){
		vector<int> nl;
		int di=R.size()-L.size();
		while(di--) nl.pb(0);
		for(auto x:L) nl.pb(x);
		L=nl;
	}
	
	int s=0,sum=0,val=1,len=R.size();
	rep(i,0,len-1){
		val*=2;
	}
	while(s<len&&L[s]==R[s]){
		s++;
		sum+=val;
		val/=2;
	}
	int lef=len-s;
	int num=1;
	rep(i,0,lef-1) num*=2;
	int a=-1,b=-1,c=-1;
	if(l-sum<=num-2){
		a=(sum+num);
		b=(sum+num-1);
		c=(sum+num-2);
		cout<<(sum+num)<<" "<<(sum+num-1)<<" "<<(sum+num-2)<<endl;
		//int res=g(a,b,c);
		//cout<<res<<endl;
	}else{
		a=(sum+num);
		b=(sum+num+1);
		c=(sum+num-1);
		cout<<(sum+num)<<" "<<(sum+num+1)<<" "<<(sum+num-1)<<endl;
		//int res=g(a,b,c);
		//cout<<res<<endl;
	}
	
}
signed main() {
	
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cout<<fixed<<setprecision(12);
    int T = 1;cin>>T;
    while (T--) {
        solve(); 
    }

}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define fi first
#define se second
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb push_back
#define cntbit __builtin_popcountll
#define pii pair<int, int>
#define vii vector<pair<int, int>>
#define ll long long
#define all(x) (x).begin(), (x).end()
using namespace std;
const int N = 200010; 
const int inf = 1ll<<62;
const int mod = 998244353;
void chkmax(int &a,int b){
    a = max(a, b);
}
void chkmin(int &a,int b){
	a = min(a, b);
}
void add(int &a, int b) {
    a += b;
    if (a >= mod) a -= mod;
}
void sub(int &a,int b){
	a -= b;
	if(a < 0) a += mod;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int qmi(int a, int b) {
    int res = 1;
    for (; b; b >>= 1) {
        if (b & 1) res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}
vector<int> con(int x){
	vector<int> r;
	while(x){
		r.pb(x&1);
		x/=2;
	}
	reverse(all(r));
	return r;
}
int g(int a,int b,int c){
	return (a^b)+(a^c)+(b^c); 
}
void solve(){
	int l,r;
	cin>>l>>r;
	int base=0;
	vector<int> L=con(l);
	vector<int> R=con(r);
	if(L.size()<R.size()){
		vector<int> nl;
		int di=R.size()-L.size();
		while(di--) nl.pb(0);
		for(auto x:L) nl.pb(x);
		L=nl;
	}
	
//	for(auto x:L)
//		cout<<x;
//	cout<<endl;
//	for(auto x:R)
//		cout<<x;
//	cout<<endl;
	
	int s=0,sum=0,val=1,len=R.size();
	rep(i,0,len-1){
		val*=2;
	}
	//cout<<val<<endl;
	while(s<len&&L[s]==R[s]){
		s++;
		if(L[s-1]==1) sum+=val;
		val/=2;
	}
	int lef=len-s;
	int num=1;
	rep(i,0,lef-1) num*=2;
	int a=-1,b=-1,c=-1;
	if(l-sum<=num-2){
		a=(sum+num);
		b=(sum+num-1);
		c=(sum+num-2);
		cout<<(sum+num)<<" "<<(sum+num-1)<<" "<<(sum+num-2)<<endl;
		//cout<<sum<<' '<<num<<endl;
		int res=g(a,b,c);
		//cout<<res<<endl;
	}else{
		a=(sum+num);
		b=(sum+num+1);
		c=(sum+num-1);
		cout<<(sum+num)<<" "<<(sum+num+1)<<" "<<(sum+num-1)<<endl;
		//int res=g(a,b,c);
		//cout<<res<<endl;
	}
	
}
signed main() {
	
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cout<<fixed<<setprecision(12);
    int T = 1;cin>>T;
    while (T--) {
        solve(); 
    }

}