Problem: 2057C - Trip to the Olympiad
Language: c++23 

Code 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;
                    }
                }
            }
            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;
        }
    }
}

Code 2:
#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))
        {
            // cout << "came here" << endl;
            lli first_difference = __builtin_clzll(left ^ right);
            bitset<64> b(left);
            b[63 - first_difference] = 1;
            for (lli i = 0; i < 63 - first_difference; i++)
            {
                b[i] = 0;
            }
            bitset<64> b1(left);
            for (lli i = 0; i < 63 - first_difference; i++)
            {
                b1[i] = 1;
            }
            b1[63 - first_difference] = 0;
            lli first = b.to_ullong();
            lli second = b1.to_ullong();
            lli third;
            for (lli i = left; i <= right; i++)
            {
                if (i != first && i != second)
                {
                    third = i;
                    break;
                }
            }
            cout << first << " " << second << " " << third << 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;
        }
    }
}

Answer: 2