Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>

using i64 = long long;
using ld = long double;
using u64 = unsigned long long;
const int maxn = 1e5 + 7, mod = 1e9 + 7;

void solve()
{
    int l, r;
    std::cin >> l >> r;

    int a[35] = {}, c[35] = {}, b = 0;

    int aa = l, cc = r, n = 0, max = 0;
    while (aa != 0)
    {
        a[++n] = aa & 1;
        aa >>= 1;
    }

    max = n;
    n = 0;
    while (cc != 0)
    {
        c[++n] = cc & 1;
        cc >>= 1;
    }

    max = std::max(n, max);

    while (max > 0 && a[max] == c[max])
    {
        b += (1 << (max - 1));
        max--;
    }

    for (int i = max; i > 0; i--)
    {
        if (a[i] == c[i])
        {
            b += (a[i] & 1) << (i - 1);
        }
        else
        {
            b += 1 << (i - 1);
        }
        if (b >= r)
        {
            b -= 1 << (i - 1);
        }
    }

    std::cout << l << " " << b << " " << r << "\n";

    return;
}

void baoli()
{
    int l, r;
    std::cin >> l >> r;

    int a = l, b = l, c = l, ans = 0;

    for (int i = l; i <= r; i++)
    {
        for (int j = l; j <= r; j++)
        {
            for (int k = l; k <= r; k++)
            {
                if ((i ^ j) + (i ^ k) + (j ^ k) > ans)
                {
                    ans = (i ^ j) + (i ^ k) + (j ^ k);
                    a = i;
                    b = j;
                    c = k;
                }
            }
        }
    }

    std::cout << a << " " << b << " " << c << " " << ans << "\n";
}

int main()
{
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);

    // std::cout << std::bitset<10>(98) << "\n";
    // std::cout << std::bitset<10>(69) << "\n";
    // std::cout << (98 ^ 93) + (98 ^ 93) + (93 ^ 93) << "\n";
    int T = 1;
    std::cin >> T;
    while (T--)
    {
        solve();
    }

    return 0;
}

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>

using i64 = long long;
using ld = long double;
using u64 = unsigned long long;
const int maxn = 1e5 + 7, mod = 1e9 + 7;

void solve()
{
    int l, r;
    std::cin >> l >> r;

    int a[35] = {}, c[35] = {}, b = 0;

    int aa = l, cc = r, n = 0, max = 0;
    while (aa != 0)
    {
        a[++n] = aa & 1;
        aa >>= 1;
    }

    max = n;
    n = 0;
    while (cc != 0)
    {
        c[++n] = cc & 1;
        cc >>= 1;
    }

    max = std::max(n, max);

    while (max > 0 && a[max] == c[max])
    {
        b += (1 << (max - 1));
        max--;
    }

    for (int i = max; i > 0; i--)
    {
        if (a[i] == c[i])
        {
            b += (a[i] ^ 1) << (i - 1);
        }
        else
        {
            b += 1 << (i - 1);
        }
        if (b >= r)
        {
            b -= 1 << (i - 1);
        }
    }

    std::cout << l << " " << b << " " << r << "\n";

    return;
}

void baoli()
{
    int l, r;
    std::cin >> l >> r;

    int a = l, b = l, c = l, ans = 0;

    for (int i = l; i <= r; i++)
    {
        for (int j = l; j <= r; j++)
        {
            for (int k = l; k <= r; k++)
            {
                if ((i ^ j) + (i ^ k) + (j ^ k) > ans)
                {
                    ans = (i ^ j) + (i ^ k) + (j ^ k);
                    a = i;
                    b = j;
                    c = k;
                }
            }
        }
    }

    std::cout << a << " " << b << " " << c << " " << ans << "\n";
}

int main()
{
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);

    // std::cout << std::bitset<10>(98) << "\n";
    // std::cout << std::bitset<10>(69) << "\n";
    // std::cout << (98 ^ 93) + (98 ^ 93) + (93 ^ 93) << "\n";
    int T = 1;
    std::cin >> T;
    while (T--)
    {
        solve();
    }

    return 0;
}