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

Solution 1 (runtime: 77 ms):
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define ull unsigned long long
#define vvll vector<vector<ll>>
#define all(x) (x).begin(),(x).end()
#define rall(x) x.rbegin(),x.rend()
#define ff first
#define ss second
#define pb push_back
//#define mp make_pair
#define endl "\n"
#define yes cout<<"Yes"<<"\n"
#define no cout<<"No"<<"\n"
#define rep(i,a,b) for (int i = a; i < b; i++)
#define rev(i,a,b) for(int i=a;i>=b;i--)
#define rev_sort(x) sort(all(x),greater<ll>())
#define fastIO                                                                 \
    ios::sync_with_stdio(false);                                               \
    cin.tie(NULL);                                                             \
    cout.tie(NULL);                                                            \
    cout.precision(numeric_limits<double>::max_digits10);

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
const int mod=998244353;
const int N=2e5+5;
vll fact(2e5+5,1);
ll binPow(ll a,ll b)
{
    if (b == 0)return 1;
    if (b == 1)return a;
    ll ret = binPow(a,b/2);
    if (b%2 == 0)return (ret * ret)%mod;
    return ((ret * ret)%mod * a)%mod;
}
ll inv(ll a)
{
    return (binPow(a,mod - 2)%mod + mod)%mod;
}
ll binom(ll a,ll b)
{
    if (b < 0 or a < 0)return 0;
    return (((fact[a] * inv(fact[b]))%mod * inv(fact[a - b]))%mod + mod)%mod;
}
ll M = 10000000;
ll sieve[10000001];
void createSieve() {
    for (int i = 2; i <= M; i++) {
        sieve[i] = 1;
    }
    for (int i = 2; i * i <= M; i++) {
        if (sieve[i] == 1) {
            if (i == 2) {
                for (int j = i * i; j <= M; j += i) {
                    sieve[j] = 2;
                }
            }
            else {
                for (int j = i * i; j <= M; j += 2 * i) {
                    if (sieve[j] == 1) {
                        sieve[j] = i;
                    }
                }
            }
        }
    }
}
class DisjointSet {
    vector<int> rank, parent, size; 
public: 
    DisjointSet(int n) {
        rank.resize(n+1, 0); 
        parent.resize(n+1);
        size.resize(n+1); 
        for(int i = 0;i<=n;i++) {
            parent[i] = i; 
            size[i] = 1; 
        }
    }

    int findUPar(int node) {
        if(node == parent[node])
            return node; 
        return parent[node] = findUPar(parent[node]); 
    }

    void unionByRank(int u, int v) {
        int ulp_u = findUPar(u); 
        int ulp_v = findUPar(v); 
        if(ulp_u == ulp_v) return; 
        if(rank[ulp_u] < rank[ulp_v]) {
            parent[ulp_u] = ulp_v; 
        }
        else if(rank[ulp_v] < rank[ulp_u]) {
            parent[ulp_v] = ulp_u; 
        }
        else {
            parent[ulp_v] = ulp_u; 
            rank[ulp_u]++; 
        }
    }

    void unionBySize(int u, int v) {
        int ulp_u = findUPar(u); 
        int ulp_v = findUPar(v); 
        if(ulp_u == ulp_v) return; 
        if(size[ulp_u] < size[ulp_v]) {
            parent[ulp_u] = ulp_v; 
            size[ulp_v] += size[ulp_u]; 
        }
        else {
            parent[ulp_v] = ulp_u;
            size[ulp_u] += size[ulp_v]; 
        }
    }
};

ll isPrime(ll n){
    if (n<=1)return 0;
    for (int i=2;i*i<=n;i++){
        if (n%i==0){
            return i;
        }
    }
    return 0;
}

ll factors(ll n){
    ll cnt=0;
    for(int i=1;i*i<=n;i++){
        if(n%i==0){
            if(i*i==n){
                cnt++;
            }
            else{
                cnt+=2;
            }
        }
    }
    return cnt;
}
 
void solve()
{
    ll l,r;
    cin>>l>>r;
    ll k=31-__builtin_clz(l^r);
    //cout<<k<<" ";
    ll a=l|((1<<k)-1);
    ll b=a+1,c;
    if(a==l){
        c=r;
    }
    else{
        c=l;
    }
    cout<<a<<" "<<b<<" "<<c<<endl;
}

int main(){
    fastIO;
    // #ifndef ONLINE_JUDGE
    // freopen("inputf.in","r",stdin);
    // freopen("outputf.in","w",stdout);
    // #endif
    ll t=1;
    cin>>t;
    for (int i = 1;i<=2e5;i++)fact[i] = (i * fact[i - 1])%mod;
    while(t--){
      solve();
    }
    return 0;
}

Solution 2 (runtime: 62 ms):
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;
    while (t--){
        int l, r;
        cin >> l >> r;

        int a = r, b = r; 
        bool found = false;
        for (int i = 30; i >= 0; i--) {
            if (!found && ((l & (1 << i)) != (r & (1 << i)))) {
                found = true;
                a |= (1 << i);  
                b &= ~(1 << i); 
            } 
            else if (found) {
                a &= ~(1 << i); 
                b |= (1 << i);  
            }
        }
        int c = (abs(a-b)!=1) ? (a+b)/2 : (l!=b) ? l : r;
        cout << a << " " << b << " " << c << "\n";
    }

    return 0;
}