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

Previous submission (verdict: Wrong answer on test 2):
// Free the individual from all

#include <bits/stdc++.h>

using namespace std;

template <typename T>
using v = vector<T>;

template <typename T>
using vv = vector<vector<T>>;

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vd = vector<double>;
using vui = vector<unsigned int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using vvs = vector<vector<string>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vvi = vector<vector<int>>;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;

const bool IS_TEST_CASES = true;

int bl(int a) {
    int res = -1;
    while (a) {
        a >>= 1;
        ++res;
    }

    return res;
}

bool ex(ll a, int i) {
    return ((a >> i) & 1);
}

void solve(int testc, int testci) {

    ll l, r, a = 0, b = 0, c = 0;

    cin >> l >> r;

    while (bl(l) == bl(r)) {
        a |= (1ll << bl(r));
        b |= (1ll << bl(r));
        c |= (1ll << bl(r));
        l &= (~(1ll << bl(l)));
        r &= (~(1ll << bl(r)));
        
    }

    if (r == 3) {
        a |= 1;
        b |= 2;
        c |= 3;

    } else {
        a |= (1ll << bl(r));
        c |= ((1ll << bl(r)) - 1);
        b |= ((1ll << bl(r)) - 2);
    }

    cout << a << ' ' << b << ' ' << c << '\n';
}

int main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1, ti = 1;

    if (IS_TEST_CASES) {
        cin >> t;
    }

    while (ti <= t) {

        solve(t, ti++);

#ifndef ONLINE_JUDGE
        cout << "------------------------------\n";
#endif
    }

    return 0;
}

Submission (verdict: Accepted):
// Free the individual from all

#include <bits/stdc++.h>

using namespace std;

template <typename T>
using v = vector<T>;

template <typename T>
using vv = vector<vector<T>>;

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vd = vector<double>;
using vui = vector<unsigned int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using vvs = vector<vector<string>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vvi = vector<vector<int>>;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;

const bool IS_TEST_CASES = true;

int bl(int a) {
    int res = -1;
    while (a) {
        a >>= 1;
        ++res;
    }

    return res;
}

bool ex(ll a, int i) {
    return ((a >> i) & 1);
}

void solve(int testc, int testci) {

    ll l, r, a = 0, b = 0, c = 0;

    cin >> l >> r;

    while (bl(l) == bl(r)) {
        a |= (1ll << bl(r));
        b |= (1ll << bl(r));
        c |= (1ll << bl(r));
        l &= (~(1ll << bl(l)));
        r &= (~(1ll << bl(r)));
        
    }

    if (r == 3) {
        a |= 1;
        b |= 2;
        c |= 3;

    } else if (r > (1ll << bl(r))) {
        
        a |= (1ll << bl(r));
        c |= ((1ll << bl(r)) - 1);
        b |= (1ll << bl(r)) + 1;

    } else {
        a |= (1ll << bl(r));
        c |= ((1ll << bl(r)) - 1);
        b |= ((1ll << bl(r)) - 2);
    }

    cout << a << ' ' << b << ' ' << c << '\n';
}

int main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1, ti = 1;

    if (IS_TEST_CASES) {
        cin >> t;
    }

    while (ti <= t) {

        solve(t, ti++);

#ifndef ONLINE_JUDGE
        cout << "------------------------------\n";
#endif
    }

    return 0;
}