Problem: 2057C - Trip to the Olympiad
Language: c++17 

Solution 1 (runtime: 93 ms):
#include<bits/stdc++.h> 
typedef long long ll;
using namespace std;
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define pi acos(-1)
// #define endl '\n'
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define pikapika return 0
#define int long long
const ll INF=0x3f3f3f3f,mod=1e9+7;
ll pow(ll a,ll b,ll c)
{
    ll x=1;
    while(b)
    {
        if(b&1)x=(x*a)%c;
        a=(a*a)%c;
        b>>=1;
    }
    return x;
}
ll ppp(ll a,ll b)
{
    ll x=1;
    while(b)
    {
        if(b&1)x=x*a;
        a=a*a;
        b>>=1;
    }
    return x;
}
ll fact[200005],invfact[200005],N=200001;
void init()
{
 fact[0]=1;
 for(ll i=1;i<=N;i++)
     fact[i]=fact[i-1]*i%mod;
 invfact[N]=pow(fact[N],mod-2,mod);
 for(ll i=N-1;i>=0;i--)
     invfact[i]=invfact[i+1]*(i+1)%mod;
}
ll C(ll n,ll m)
{
 if(n<m)return 0;
 return ((fact[n]*invfact[m])%mod)*invfact[n-m]%mod;
}
//int a[200010];
//struct SegmentTree{
//  int ma;
//}t[400040];
//void update(int o)
//{
//  t[o].ma=max(t[o<<1].ma,t[o<<1|1].ma);
//}
//void build(int o,int l,int r)
//{
//  if(l==r)
//  {
//      t[o].ma=a[l];
//      return;
//  }
//  int mid=(l+r)>>1;
//  build(o<<1,l,mid),build(o<<1|1,mid+1,r);
//  update(o);
//}
//int query(int o,int l,int r,int ql,int qr)
//{
//  if(l==ql&&r==qr)return t[o].ma;
//  int mid=(l+r)>>1;
//  if(qr<=mid)return query(o<<1,l,mid,ql,qr);
//  else if(ql>mid)return query(o<<1|1,mid+1,r,ql,qr);
//  else return max(query(o<<1,l,mid,ql,mid),query(o<<1|1,mid+1,r,mid+1,qr));
//}
//int get(vector<int>&a,int n) 
//{
//    int res=0;
//    int z=n;
//    int m=a.size();
//    for(int i=1;i<1<<m;i++)
//    {
//        int s=0,t=1;
//        for(int j=0;j<m;j++)
//        {
//            if(i>>j&1)
//            {
//                if((long long)t*a[j]>n) 
//                {
//                    t=-1;
//                    break;
//                }
//                s++;
//                t*=a[j];
//            }
//        }
//        if(t!=-1)
//        {
//            if(s&1)res+=n/t;
//            else res-=n/t;
//        }
//    }
//    return z-res;
//}
ll sqrtx(ll n) {
  ll x=sqrt(n)+0.5;
  while (x*x>n) x--;
  return x;
}
void read(ll &a)
{
    char s[10000];
    cin>>s;
    a=0;
    int l=strlen(s);
    for(int i=0;i<l;i++)
    {
        a=a*10+s[i]-'0';
    }
}
using i64 = long long;
template<class T>
constexpr T power(T a, i64 b) {
    T res = 1;
    for (; b; b /= 2, a *= a) {
        if (b % 2) {
            res *= a;
        }
    }
    return res;
}
 
constexpr i64 mul(i64 a, i64 b, i64 p) {
    i64 res = a * b - i64(1.L * a * b / p) * p;
    res %= p;
    if (res < 0) {
        res += p;
    }
    return res;
}
template<i64 P>
struct MLong {
    i64 x;
    constexpr MLong() : x{} {}
    constexpr MLong(i64 x) : x{norm(x % getMod())} {}
    
    static i64 Mod;
    constexpr static i64 getMod() {
        if (P > 0) {
            return P;
        } else {
            return Mod;
        }
    }
    constexpr static void setMod(i64 Mod_) {
        Mod = Mod_;
    }
    constexpr i64 norm(i64 x) const {
        if (x < 0) {
            x += getMod();
        }
        if (x >= getMod()) {
            x -= getMod();
        }
        return x;
    }
    constexpr i64 val() const {
        return x;
    }
    explicit constexpr operator i64() const {
        return x;
    }
    constexpr MLong operator-() const {
        MLong res;
        res.x = norm(getMod() - x);
        return res;
    }
    constexpr MLong inv() const {
        assert(x != 0);
        return power(*this, getMod() - 2);
    }
    constexpr MLong &operator*=(MLong rhs) & {
        x = mul(x, rhs.x, getMod());
        return *this;
    }
    constexpr MLong &operator+=(MLong rhs) & {
        x = norm(x + rhs.x);
        return *this;
    }
    constexpr MLong &operator-=(MLong rhs) & {
        x = norm(x - rhs.x);
        return *this;
    }
    constexpr MLong &operator/=(MLong rhs) & {
        return *this *= rhs.inv();
    }
    friend constexpr MLong operator*(MLong lhs, MLong rhs) {
        MLong res = lhs;
        res *= rhs;
        return res;
    }
    friend constexpr MLong operator+(MLong lhs, MLong rhs) {
        MLong res = lhs;
        res += rhs;
        return res;
    }
    friend constexpr MLong operator-(MLong lhs, MLong rhs) {
        MLong res = lhs;
        res -= rhs;
        return res;
    }
    friend constexpr MLong operator/(MLong lhs, MLong rhs) {
        MLong res = lhs;
        res /= rhs;
        return res;
    }
    friend constexpr std::istream &operator>>(std::istream &is, MLong &a) {
        i64 v;
        is >> v;
        a = MLong(v);
        return is;
    }
    friend constexpr std::ostream &operator<<(std::ostream &os, const MLong &a) {
        return os << a.val();
    }
    friend constexpr bool operator==(MLong lhs, MLong rhs) {
        return lhs.val() == rhs.val();
    }
    friend constexpr bool operator!=(MLong lhs, MLong rhs) {
        return lhs.val() != rhs.val();
    }
};
 
template<>
i64 MLong<0LL>::Mod = 1;
 
template<int P>
struct MInt {
    int x;
    constexpr MInt() : x{} {}
    constexpr MInt(i64 x) : x{norm(x % getMod())} {}
    
    static int Mod;
    constexpr static int getMod() {
        if (P > 0) {
            return P;
        } else {
            return Mod;
        }
    }
    constexpr static void setMod(int Mod_) {
        Mod = Mod_;
    }
    constexpr int norm(int x) const {
        if (x < 0) {
            x += getMod();
        }
        if (x >= getMod()) {
            x -= getMod();
        }
        return x;
    }
    constexpr int val() const {
        return x;
    }
    explicit constexpr operator int() const {
        return x;
    }
    constexpr MInt operator-() const {
        MInt res;
        res.x = norm(getMod() - x);
        return res;
    }
    constexpr MInt inv() const {
        assert(x != 0);
        return power(*this, getMod() - 2);
    }
    constexpr MInt &operator*=(MInt rhs) & {
        x = 1LL * x * rhs.x % getMod();
        return *this;
    }
    constexpr MInt &operator+=(MInt rhs) & {
        x = norm(x + rhs.x);
        return *this;
    }
    constexpr MInt &operator-=(MInt rhs) & {
        x = norm(x - rhs.x);
        return *this;
    }
    constexpr MInt &operator/=(MInt rhs) & {
        return *this *= rhs.inv();
    }
    friend constexpr MInt operator*(MInt lhs, MInt rhs) {
        MInt res = lhs;
        res *= rhs;
        return res;
    }
    friend constexpr MInt operator+(MInt lhs, MInt rhs) {
        MInt res = lhs;
        res += rhs;
        return res;
    }
    friend constexpr MInt operator-(MInt lhs, MInt rhs) {
        MInt res = lhs;
        res -= rhs;
        return res;
    }
    friend constexpr MInt operator/(MInt lhs, MInt rhs) {
        MInt res = lhs;
        res /= rhs;
        return res;
    }
    friend constexpr std::istream &operator>>(std::istream &is, MInt &a) {
        i64 v;
        is >> v;
        a = MInt(v);
        return is;
    }
    friend constexpr std::ostream &operator<<(std::ostream &os, const MInt &a) {
        return os << a.val();
    }
    friend constexpr bool operator==(MInt lhs, MInt rhs) {
        return lhs.val() == rhs.val();
    }
    friend constexpr bool operator!=(MInt lhs, MInt rhs) {
        return lhs.val() != rhs.val();
    }
};
 
template<>
int MInt<0>::Mod = 1;
 
template<int V, int P>
constexpr MInt<P> CInv = MInt<P>(V).inv();
 
constexpr int P = 1e9+7;
using Z = MInt<P>;

struct Comb {
    int n;
    std::vector<Z> _fac;
    std::vector<Z> _invfac;
    std::vector<Z> _inv;
    
    Comb() : n{0}, _fac{1}, _invfac{1}, _inv{0} {}
    Comb(int n) : Comb() {
        init(n);
    }
    
    void init(int m) {
        if (m <= n) return;
        _fac.resize(m + 1);
        _invfac.resize(m + 1);
        _inv.resize(m + 1);
        
        for (int i = n + 1; i <= m; i++) {
            _fac[i] = _fac[i - 1] * i;
        }
        _invfac[m] = _fac[m].inv();
        for (int i = m; i > n; i--) {
            _invfac[i - 1] = _invfac[i] * i;
            _inv[i] = _invfac[i] * _fac[i - 1];
        }
        n = m;
    }
    
    Z fac(int m) {
        if (m > n) init(2 * m);
        return _fac[m];
    }
    Z invfac(int m) {
        if (m > n) init(2 * m);
        return _invfac[m];
    }
    Z inv(int m) {
        if (m > n) init(2 * m);
        return _inv[m];
    }
    Z binom(int n, int m) {
        if (n < m || m < 0) return 0;
        return fac(n) * invfac(m) * invfac(n - m);
    }
} comb;

struct DSU {
    std::vector<int> f, siz;
    
    DSU() {}
    DSU(int n) {
        init(n);
    }
    
    void init(int n) {
        f.resize(n);
        std::iota(f.begin(), f.end(), 0);
        siz.assign(n, 1);
    }
    
    int find(int x) {
        while (x != f[x]) {
            x = f[x] = f[f[x]];
        }
        return x;
    }
    
    bool same(int x, int y) {
        return find(x) == find(y);
    }
    
    bool merge(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) {
            return false;
        }
        siz[x] += siz[y];
        f[y] = x;
        return true;
    }
    
    int size(int x) {
        return siz[find(x)];
    }
};
template <typename T>
struct Fenwick {
    int n;
    std::vector<T> a;
    
    Fenwick(int n = 0) {
        init(n);
    }
    
    void init(int n) {
        this->n = n;
        a.assign(n, T());
    }
    
    void add(int x, T v) {
        for (int i = x + 1; i <= n; i += i & -i) {
            a[i - 1] += v;
        }
    }
    
    T sum(int x) {
        auto ans = T();
        for (int i = x; i > 0; i -= i & -i) {
            ans += a[i - 1];
        }
        return ans;
    }
    
    T rangeSum(int l, int r) {
        return sum(r) - sum(l);
    }
    
    int kth(T k) {
        int x = 0;
        for (int i = 1 << std::__lg(n); i; i /= 2) {
            if (x + i <= n && k >= a[x + i - 1]) {
                x += i;
                k -= a[x - 1];
            }
        }
        return x;
    }
};
std::vector<int> manacher(std::string s) {
    std::string t = "#";
    for (auto c : s) {
        t += c;
        t += '#';
    }
    int n = t.size();
    std::vector<int> r(n);
    for (int i = 0, j = 0; i < n; i++) {
        if (2 * j - i >= 0 && j + r[j] > i) {
            r[i] = std::min(r[2 * j - i], j + r[j] - i);
        }
        while (i - r[i] >= 0 && i + r[i] < n && t[i - r[i]] == t[i + r[i]]) {
            r[i] += 1;
        }
        if (i + r[i] > j + r[j]) {
            j = i;
        }
    }
    return r;
}
void solve()
{
    int l, r;
    cin>>l>>r;
    int a=0,b=0;
    for(int i=30;i>0;i--)
    {
        if((l^r)>>i&1)
        {
            a|=1<<i;
            b|=(1<<i)-1;
            break;
        }
        else
        {
            a+=l&(1<<i);
            b+=l&(1<<i);
        }
    }
    int c=l;
    while(c==a||c==b)c++;
    cout<<a<<" "<<b<<" "<<c<<"\n";
}
signed main()
{
    ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);
    int T=1;
    // init();
    cin>>T;
    while(T--)
    {
        solve();
    }
    pikapika;
}

Solution 2 (runtime: 93 ms):
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[32],tmp=1,ans1,ans2;
ll t,l,r;
inline void get(ll x,ll y){
	ll t1,t2;
	ans1=0;
	for(int i=31;i>=1;i--){
		if(x>=a[i]) t1=1;
		else t1=0;
		if(y>=a[i]) t2=1;
		else t2=0;
		if(t1||t2){
		ans1=a[i]+ans1;
		ans2=ans1-1;
		x=x-a[i];
		y=y-a[i];
		}
		if(t1!=t2) break;
	}
}
int main(){
	cin>>t;
	for(int i=1;i<=31;i++){
		a[i]=tmp;
		tmp=tmp*2;
	}
	while(t--){
		cin>>l>>r;
		get(l,r);
		if(ans2==l){
			cout<<r<<" "<<ans1<<" "<<ans2<<endl;
		}
		else cout<<ans1<<" "<<ans2<<" "<<l<<endl;
	}
	return 0;
}