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

Previous submission (verdict: Time limit exceeded on test 3):
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    lli t;
    cin >> t;
    while (t--)
    {
        lli left, right;
        cin >> left >> right;
        // if leading_zeros_left==leading_zeros_right-->choose one number as first odd second number as right and greedy approach to choose third
        // else -->first number as (set bit 1 after min leading zeros and all zeros after that ->and seoond num as first-1 and greedy to choose third)
        // cout << __builtin_clzll(left) << " " << __builtin_clzll(right) << endl;
        if (__builtin_clzll(left) == __builtin_clzll(right))
        {
            lli first = right;
            lli second;
            for (lli i = left; i < right; i++)
            {
                if (i % 2 != 0)
                {
                    second = i;
                    break;
                }
            }
            lli maxi = -1;
            lli third;
            for (lli i = left; i <= right; i++)
            {
                if (i != first && i != second)
                {
                    if (((first ^ i) + (second ^ i)) > maxi)
                    {
                        maxi = (first ^ i) + (second ^ i);
                        third = i;
                    }
                }
            }
            cout << first << " " << second << " " << third << endl;
            // cout << (first ^ second) + maxi << endl;
            // cout << (123 ^ 118) + (123 ^ 121) + (121 ^ 118) << endl;
        }
        else
        {
            lli max_leading = __builtin_clzll(right);
            bitset<64> b;
            b[63 - max_leading] = 1;
            lli first = b.to_ullong();
            lli second = first - 1;
            lli maxi = -1;
            lli third;
            for (lli i = left; i <= right; i++)
            {
                if (i != first && i != second)
                {
                    if (((first ^ i) + (second ^ i)) > maxi)
                    {
                        maxi = (first ^ i) + (second ^ i);
                        third = i;
                        break;
                    }
                }
            }
            cout << first << " " << second << " " << third << endl;
        }
    }
}

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    lli t;
    cin >> t;
    while (t--)
    {
        lli left, right;
        cin >> left >> right;
        // if leading_zeros_left==leading_zeros_right-->choose one number as first odd second number as right and greedy approach to choose third
        // else -->first number as (set bit 1 after min leading zeros and all zeros after that ->and seoond num as first-1 and greedy to choose third)
        // cout << __builtin_clzll(left) << " " << __builtin_clzll(right) << endl;
        if (__builtin_clzll(left) == __builtin_clzll(right))
        {
            lli first = right;
            lli second;
            for (lli i = left; i < right; i++)
            {
                if (i % 2 != 0)
                {
                    second = i;
                    break;
                }
            }
            lli maxi = -1;
            lli third;
            for (lli i = left; i <= right; i++)
            {
                if (i != first && i != second)
                {
                    if (((first ^ i) + (second ^ i)) > maxi)
                    {
                        maxi = (first ^ i) + (second ^ i);
                        third = i;
                        break;
                    }
                }
            }
            cout << first << " " << second << " " << third << endl;
            // cout << (first ^ second) + maxi << endl;
            // cout << (123 ^ 118) + (123 ^ 121) + (121 ^ 118) << endl;
        }
        else
        {
            lli max_leading = __builtin_clzll(right);
            bitset<64> b;
            b[63 - max_leading] = 1;
            lli first = b.to_ullong();
            lli second = first - 1;
            lli maxi = -1;
            lli third;
            for (lli i = left; i <= right; i++)
            {
                if (i != first && i != second)
                {
                    if (((first ^ i) + (second ^ i)) > maxi)
                    {
                        maxi = (first ^ i) + (second ^ i);
                        third = i;
                        break;
                    }
                }
            }
            cout << first << " " << second << " " << third << endl;
        }
    }
}