Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define pii pair<int, int>

int mylog2(int n){
    int res = 0;

    while (n > 1){
        n /= 2;
        res++;
    }

    return res;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t;
    while(t--){
        int l, r;
        cin >> l >> r;
        
        int log2l = mylog2(l);
        int log2r = mylog2(r);

        // cout << log2l << " " << log2r << "\n";

        if (log2l < log2r){
            int a = (1LL << log2r) - 1;
            int b = (1LL << log2r);
            int c;
            if (r >= b + 1) {
                c = b + 1;
            } else {
                c = a - 1;
            }

            // cout << a << " " << b << " " << c << "\n";

        } else {
            int cnst = 0;
            int cur = log2l;
            while ((l >> cur) == (r >> cur)){
                cnst += ((l >> cur) << cur);
                l -= ((l >> cur) << cur);
                r -= ((r >> cur) << cur);
                cur--;
            }

            // cout << cnst << " " << l << " " << r << "\n";

            // log2l = mylog2(l);
            log2r = mylog2(r);
            int a = cnst + (1LL << log2r) - 1;
            int b = cnst + (1LL << log2r);
            int c;

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

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

    }
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define pii pair<int, int>

int mylog2(int n){
    int res = 0;

    while (n > 1){
        n /= 2;
        res++;
    }

    return res;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t;
    while(t--){
        int l, r;
        cin >> l >> r;
        
        int log2l = mylog2(l);
        int log2r = mylog2(r);

        // cout << log2l << " " << log2r << "\n";

        if (log2l < log2r){
            int a = (1LL << log2r) - 1;
            int b = (1LL << log2r);
            int c;
            if (r >= b + 1) {
                c = b + 1;
            } else {
                c = a - 1;
            }

            cout << a << " " << b << " " << c << "\n";

        } else {
            int cnst = 0;
            int cur = log2l;
            while ((l >> cur) == (r >> cur)){
                cnst += ((l >> cur) << cur);
                l -= ((l >> cur) << cur);
                r -= ((r >> cur) << cur);
                cur--;
            }

            // cout << cnst << " " << l << " " << r << "\n";

            // log2l = mylog2(l);
            log2r = mylog2(r);
            int a = cnst + (1LL << log2r) - 1;
            int b = cnst + (1LL << log2r);
            int c;

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

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

    }
}