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

Previous submission (verdict: Wrong answer on test 1):
/*
  __  __          _    _ _____            _   _
 |  \/  |   /\   | |  | |  __ \     /\   | \ | |
 | \  / |  /  \  | |__| | |__) |   /  \  |  \| |
 | |\/| | / /\ \ |  __  |  _  /   / /\ \ | . ` |
 | |  | |/ ____ \| |  | | | \ \  / ____ \| |\  |
 |_|  |_/_/    \_\_|  |_|_|  \_\/_/    \_\_| \_|
                                                     */
#include <bits/stdc++.h>
#include <cmath> // Include cmath for M_PI
#ifndef M_PI
#define M_PI 3.14159265358979323846 // Define M_PI if not already defined
#endif
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ull unsigned long long
#define endl "\n"
using namespace std;
/*
pair<int, int> t[4*MAXN];

pair<int, int> combine(pair<int, int> a, pair<int, int> b) {
    if (a.first > b.first)
        return a;
    if (b.first > a.first)
        return b;
    return make_pair(a.first, a.second + b.second);
}

void build(int a[], int v, int tl, int tr) {
    if (tl == tr) {
        t[v] = make_pair(a[tl], 1);
    } else {
        int tm = (tl + tr) / 2;
        build(a, v*2, tl, tm);
        build(a, v*2+1, tm+1, tr);
        t[v] = combine(t[v*2], t[v*2+1]);
    }
}

pair<int, int> get_max(int v, int tl, int tr, int l, int r) {
    if (l > r)
        return make_pair(-INF, 0);
    if (l == tl && r == tr)
        return t[v];
    int tm = (tl + tr) / 2;
    return combine(get_max(v*2, tl, tm, l, min(r, tm)),
                   get_max(v*2+1, tm+1, tr, max(l, tm+1), r));
}

void update(int v, int tl, int tr, int pos, int new_val) {
    if (tl == tr) {
        t[v] = make_pair(new_val, 1);
    } else {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            update(v*2, tl, tm, pos, new_val);
        else
            update(v*2+1, tm+1, tr, pos, new_val);
        t[v] = combine(t[v*2], t[v*2+1]);
    }
}
*/

template <typename T>
void pop_front(std::vector<T> &v)
{
    if (v.size() > 0)
    {
        v.erase(v.begin());
    }
}
const int MOD = 1e9 + 7;
long long binpow(long long a, long long b, long long m)
{
    a %= m;
    long long res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
bool sortFirst(const pair<ll, ll> &a, const pair<ll, ll> &b)
{
    if (a.first == b.first)
    {
        return a.second > b.second;
    }
    return a.first < b.first;
}

void solve()
{
    ll l, r;
    cin >> l >> r;
    ll fark = r - l;
    ll a = r;
    int i = 31;
    ll b = 0;
    for (; i >= 0; i--)
    {
        if ((1LL << i) & fark)
        {

            break;
        }
        else
        {
            if ((1LL << i) & a)
            {
                b += (1LL << i);
            }
        }
    }

    for (int j = i; j >= 0; j--)
    {
        if (!((1LL << j) & a))
        {
            b += (1LL << j);
        }
    }
    ll c = a;
    for (int j = 0; j < 32; j++)
    {
        if ((1LL << j) & a)
        {
            c -= (1LL << j);
            break;
        }
    }
    cout << a << " " << max(b, l) << " " << c << endl;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);

    int t;
    cin >> t;

    while (t--)
    {
        solve();
    }

    return 0;
}

Submission (verdict: Wrong answer on test 1):
/*
  __  __          _    _ _____            _   _
 |  \/  |   /\   | |  | |  __ \     /\   | \ | |
 | \  / |  /  \  | |__| | |__) |   /  \  |  \| |
 | |\/| | / /\ \ |  __  |  _  /   / /\ \ | . ` |
 | |  | |/ ____ \| |  | | | \ \  / ____ \| |\  |
 |_|  |_/_/    \_\_|  |_|_|  \_\/_/    \_\_| \_|
                                                     */
#include <bits/stdc++.h>
#include <cmath> // Include cmath for M_PI
#ifndef M_PI
#define M_PI 3.14159265358979323846 // Define M_PI if not already defined
#endif
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ull unsigned long long
#define endl "\n"
using namespace std;
/*
pair<int, int> t[4*MAXN];

pair<int, int> combine(pair<int, int> a, pair<int, int> b) {
    if (a.first > b.first)
        return a;
    if (b.first > a.first)
        return b;
    return make_pair(a.first, a.second + b.second);
}

void build(int a[], int v, int tl, int tr) {
    if (tl == tr) {
        t[v] = make_pair(a[tl], 1);
    } else {
        int tm = (tl + tr) / 2;
        build(a, v*2, tl, tm);
        build(a, v*2+1, tm+1, tr);
        t[v] = combine(t[v*2], t[v*2+1]);
    }
}

pair<int, int> get_max(int v, int tl, int tr, int l, int r) {
    if (l > r)
        return make_pair(-INF, 0);
    if (l == tl && r == tr)
        return t[v];
    int tm = (tl + tr) / 2;
    return combine(get_max(v*2, tl, tm, l, min(r, tm)),
                   get_max(v*2+1, tm+1, tr, max(l, tm+1), r));
}

void update(int v, int tl, int tr, int pos, int new_val) {
    if (tl == tr) {
        t[v] = make_pair(new_val, 1);
    } else {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            update(v*2, tl, tm, pos, new_val);
        else
            update(v*2+1, tm+1, tr, pos, new_val);
        t[v] = combine(t[v*2], t[v*2+1]);
    }
}
*/

template <typename T>
void pop_front(std::vector<T> &v)
{
    if (v.size() > 0)
    {
        v.erase(v.begin());
    }
}
const int MOD = 1e9 + 7;
long long binpow(long long a, long long b, long long m)
{
    a %= m;
    long long res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
bool sortFirst(const pair<ll, ll> &a, const pair<ll, ll> &b)
{
    if (a.first == b.first)
    {
        return a.second > b.second;
    }
    return a.first < b.first;
}

void solve()
{
    ll l, r;
    cin >> l >> r;
    int i = 31;
    bool t = false;
    bool tt = false;
    for (; i >= 0; i--)
    {
        if ((1LL << i) & l)
        {
            t = true;
        }
        if ((1LL << i) & r)
        {
            tt = true;
        }
        if (t && tt)
        {
            break;
        }
    }
    int j = i;
    for (; j >= 0; j--)
    {
        if (((1LL << j) & l) && !((1LL << j) & r))
        {
            break;
        }
    }
    ll k = 31 - __builtin_clz(l ^ r);
    ll a = l | (1LL << (k - 1));
    ll b = a + 1;
    ll c = l;
    if (b == l)
    {
        c = r;
    }
    cout << a << " " << b << " " << c << endl;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);

    int t;
    cin >> t;

    while (t--)
    {
        solve();
    }

    return 0;
}