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;

long long mod = 1e9 + 7;


int cmpfunc(const void *a, const void *b) {
    return (*(int*)a - *(int*)b);
}

int longCmpfunc(const void *a, const void *b) {
    const long long *first = (*(const long long **)a);
    const long long *second = (*(const long long **)b);

    return (first[0] < second[0]) ? -1 : (first[0] > second[0]);
}

int twoDcmpfunc(const void *a, const void *b) {
    return (*(int(*)[2])a)[0] - (*(int(*)[2])b)[0];
}

bool sortBySecond(const pair<long long, long long> &a, const pair<long long, long long> &b) {
    return a.second < b.second;
}

int revCmpfunc(const void* a, const void* b){
    int* elementA = (int*)a;
    int* elementB = (int*)b;

    if (*elementA < *elementB)
        return -1;
    else if (*elementA > *elementB)
        return 0;
    else
        return 1;
}

long long Ceil(long long i, long long k){
    if(i % k == 0) return i/k;

    else return i/k + 1;
}

void swap(int* a, int* b) {
    int temp = *a;
    *a = *b;
    *b = temp;
}

long long maximum(long long a, long long b){
    if(a > b) return a;
    return b;
}

long long minimum(long long a, long long b){
    if(a < b) return a;
    return b;
}

int gcd(int a, int b){
    while(a != 0 && b != 0){
        if(a > b) a = a % b;

        else b = b % a;
    }

    if(a != 0) return a;
    return b;
}

int lcm(int num1, int num2) {
    int g = gcd(num1, num2);
    int lcm = (num1 * num2) / g;
    return lcm;
}

int isprime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return i;
    }
    return 0;
}

int binarySearch(vector<long long> &arr, int low, int high, long long target) {
    while (low <= high) {

        int mid = low + (high - low) / 2;
        // if (arr[mid] == target) return mid;

        if (arr[mid] < target) 
            low = mid + 1;

        else high = mid - 1;
    }

    return low;      // For lower bound
}

long long lwr_bound(vector<long long> &arr, long long l, long long r, long long target) {
    while(l <= r) {
        long long mid = l + (r - l) / 2;

        if(arr[mid] < target) l = mid + 1;

        else r = mid - 1;
    }

    return l;
}

long long upr_bound(vector<long long> &arr, long long l, long long r, long long target) {
    while(l <= r) {
        long long mid = l + (r - l) / 2;

        if(arr[mid] == target) return mid;

        if(arr[mid] > target) r = mid - 1;

        else l = mid + 1;
    }

    return r;
}


void bfs(int n, vector<int> edges[], int inedges[], vector<int> &topoSort) {
    queue<int> q;
    for(int i = 0; i < n; i++) if(inedges[i] == 0) q.push(i);

    while(!q.empty()) {
        int u = q.front();
        q.pop();
        topoSort.push_back(u);

        for(int i = 0; i < (int)edges[u].size(); i++) {
            --inedges[edges[u][i]];
            if(inedges[edges[u][i]] == 0) q.push(edges[u][i]);
        }
    }
}

vector<long long> minimum_weight;
void dijkstra(int u, vector<pair<long long, long long>> edges[], int visited[], vector<long long>& distance) {
    priority_queue<pair<long long, long long>, vector<pair<long long, long long>>, greater<pair<long long, long long>>> q;

    distance[u] = 0;
    q.push({0, u});

    while(!q.empty()) {
        long long w = q.top().first;
        long long v = q.top().second;
        q.pop();

        if(!visited[v]) {
            visited[v] = 1;

            long long least_weight = LLONG_MAX;

            for(pair<long long, long long> p : edges[v]) {
                long long weight = w + p.second;

                if(weight < distance[p.first]) {
                    distance[p.first] = weight;
                    q.push({weight, p.first});

                    if(p.second < minimum_weight[p.first]) minimum_weight[p.first] = p.second;
                }
            }
        }
    }
}

long long findParent(int u, int parent[]) {
    if(u == parent[u]) return u;
    
    return parent[u] = findParent(parent[u], parent);
}
 
bool merge(int u, int v, int parent[], int size[]) {
    int cu = findParent(u, parent);
    int cv = findParent(v, parent);

    if (cu == cv) return false;

    if (size[cu] < size[cv]) {
        swap(cu, cv);
    }
    
    parent[cv] = cu;
    size[cu] += size[cv];

    return true;
}


void dfs(int u, vector<int> edges[], int visited[], long long *count) {
    visited[u] = 1;
    ++(*count);

    for(auto it : edges[u]) {
        if(!visited[it]) dfs(it, edges, visited, count);
    }
}

vector<long long> answer;
void find_cycle(long long start, long long end, vector<long long> new_graph[], int visited[], vector<long long> &cycle) {
    cycle.push_back(start);
    visited[start] = 1;
 
    for(auto it : new_graph[start]) {
        if(it == end) {
            answer = cycle;
            return;
        }

        if(!visited[it]) find_cycle(it, end, new_graph, visited, cycle);
    }
    
    cycle.pop_back();
}

void TopologicalSort(int n, vector<int> edges[], int inedges[], vector<int> &toposort) {
    queue<int> q;
    for(int i = 0; i < n; i++) if(!inedges[i]) q.push(i);

    while(!q.empty()) {
        int u = q.front();
        q.pop();

        toposort.push_back(u);

        for(int i = 0; i < (int)edges[u].size(); i++) {
            --inedges[edges[u][i]];
            if(inedges[edges[u][i]] == 0) q.push(edges[u][i]);
        }
    }
}

void heightbfs(int u, int h, vector<int> edges[], int visited[], int height[]) {
    visited[u] = 1;
    height[u] = h++;
    // parent[u] = u;

    queue<int> q;
    q.push(u);

    while(!q.empty()) {
        int v = q.front();
        q.pop();

        for(int i = 0; i < (int)edges[v].size(); i++) {
            if(!visited[edges[v][i]]) {
                height[edges[v][i]] = height[v] + 1;
                visited[edges[v][i]] = 1;
                // parent[edges[v][i]] = v;
                q.push(edges[v][i]);
            }
        }
        ++h;
    }
}

long long exp(long long num, long long k, long long modulo) {   // (num ^ k) % mod
    if(k == 0) return 1;
    if(k == 1) return num % modulo;

    long long temp = exp(num, k / 2, modulo);

    if(k % 2 == 0) return (temp * temp) % modulo;
    else return (((temp * temp) % modulo) * num) % modulo;
}

long long inverseMod(long long num, long long modulo) {
    // if(num == 1) return 1;
    // return (modulo - ((modulo / num) * inverse(modulo % num, modulo)) % modulo + modulo) % modulo;

    return exp(num, modulo - 2, modulo);
}

vector<int> findPrimeFactors(int n) {
    vector<int> arr;

    while(n % 2 == 0) {
        arr.push_back(2);
        n /= 2;
    }

    for(int i = 3; i * i <= n; i += 2) {
        while(n % i == 0) {
            arr.push_back(i);
            n /= i;
        }
    }

    if(n > 2) arr.push_back(n);

    return arr;
}

vector<long long> findDivisor(long long n) {
    vector<long long> arr;

    for(int i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            arr.push_back(i);
            
            if(i != n / i) arr.push_back(n / i);
        }
    }

    return arr;
}

void findPrimes(bool arr[], int bound) {
    for(int i = 2; i * i <= bound; i++) {
        if(arr[i]) {
            for(int j = i * i; j <= bound; j += i) arr[j] = false;
        }
    }
}

long long diophantine_gcd(int a, int b, long long &x, long long &y) {
    if(b == 0) {
        x = 1;
        y = 0;
        return a;
    }

    long long x1, y1;
    long long d = diophantine_gcd(b, a % b, x1, y1);

    x = y1;
    y = x1 - y1 * (a / b);

    return d;
}


bool find_diophantine_solution(int a, int b, int c, long long &x, long long &y) {
    if(a == 0 && b == 0) {
        if(c == 0) {
            x = 0;
            y = 0;
            return true;
        }

        else return false;
    }

    long long g = diophantine_gcd(a, b, x, y);

    if(c % g != 0) return false;

    long long sign = c / g;

    x = x * (c / g);
    y = y * (c / g);

    return true;
}

void Number_Of_Component_In_Subtree(int u, int parent, vector<int> edges[], int components[]) {
    components[u] = 0;

    for(auto it : edges[u]) {
        if(it != parent) {
            Number_Of_Component_In_Subtree(it, u, edges, components);
            components[u] += components[it] + 1;
        }
    }
}

void Find_Maximum_Subtree_Height_At_Every_Node(int u, int parent, vector<int> edges[], int depth[]) {
    int maxdepth = 0;

    for(auto it : edges[u]) {
        if(it != parent) {
            Find_Maximum_Subtree_Height_At_Every_Node(it, u, edges, depth);
            maxdepth = max(maxdepth, depth[it]);
        }
    }

    depth[u] = maxdepth + 1;
}


void Find_Bridges(int u, int parent, vector<int> edges[], int visited[], int first_time[], int min_time[],
                    long long components[], vector<int> &candidates, int *time) {

    visited[u] = 1;
    components[u] = 1;
    first_time[u] = *time;
    min_time[u] = *time;

    ++(*time);

    for(auto it : edges[u]) {
        if(it == parent) continue;

        else if(!visited[it]) {
            Find_Bridges(it, u, edges, visited, first_time, min_time, components, candidates, time);

            min_time[u] = min(min_time[u], min_time[it]);

            components[u] += components[it];
        }

        else min_time[u] = min(min_time[u], min_time[it]);
    }

    if(min_time[u] >= first_time[u]) candidates.push_back(u);
}

long long Lower_Bound(long long low, long long high, long long n, long long diff, int k, long long target) {
    while(high - low > 1) {
        long long mid = low + (high - low) / 2;

        long long val = (n * mid) - diff;
        // printf("%lld %lld\n", mid, val);

        if(val > target) high = mid;

        else low = mid;
    }

    return low;
}

long long count_inversions(int arr[], int temp[], int left, int mid, int right) {
    long long count = 0;

    int l = left, r = mid, ite = left;

    while(l < mid && r <= right) {
        if(arr[l] < arr[r]) temp[ite++] = arr[l++];

        else {
            temp[ite++] = arr[r++];

            count += (mid - l);
        }
    }

    while(l < mid) temp[ite++] = arr[l++];
    while(r <= right) temp[ite++] = arr[r++];

    for(int i = left; i < right + 1; i++) arr[i] = temp[i];

    return count;
}

long long merge(int arr[], int temp[], int left, int right) {
    // temp is an empty array of same size as arr
    // left = 0 && right = arr.size() - 1

    long long inversions = 0;

    if(left < right) {
        int mid = (left + right) / 2;

        inversions += merge(arr, temp, left, mid);
        inversions += merge(arr, temp, mid + 1, right);

        inversions += count_inversions(arr, temp, left, mid + 1, right);
    }

    return inversions;
}

int traverse(int u, vector<int> edges[], int visited[], int a[]) {
    visited[u] = 1;

    int minimum = INT_MAX;

    for(auto it : edges[u]) {
        minimum = min(minimum, traverse(it, edges, visited, a));
    }

    if(u == 0) return minimum;

    if(minimum == INT_MAX) return a[u];

    else  {
        if(a[u] > minimum) return minimum;

        else return (a[u] + minimum) / 2;
    }
}


void sieve_of_eratosthenes(vector<bool>& is_prime, int max_n) {
    is_prime[0] = false;
    is_prime[1] = false;

    for (int i = 2; i <= max_n; i++) is_prime[i] = true;

    for (int i = 2; i <= sqrt(max_n); i++) {
        if (is_prime[i]) {
            for (int j = i * i; j <= max_n; j += i) {
                is_prime[j] = false;
            }
        }
    }
}

int mydfs(int u, vector<int> edges[], int visited[], int dp[]) {
    if(visited[u]) return dp[u];
    
    visited[u] = 1;
    
    int height = mydfs(edges[u][0], edges, visited, dp);

    return dp[u] = height + 1;
}

int range_query_len;

struct range_query {
    int l, r, idx;
};

bool range_query_compare(range_query a, range_query b) {
    if(a.l / range_query_len == b.l / range_query_len) return a.r < b.r;
    return a.l < b.l;
}

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

    int t;
    scanf("%d", &t);

    while(t--) {
        long long l, r;
        scanf("%lld %lld", &l, &r);

        long long number = 1;
        long long x;

        while(number <= r) {
            long long temp = (r / number) * number;
            
            if(temp >= l && temp <= r) x = temp;
            
            number <<= 1;
        }

        long long y = x - 1;

        long long z = l == y ? x + 1 : l;

        printf("%lld %lld %lld", x, y, z);

        printf("\n");
    }

    return 0;
}

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

void solve(){
    int l,r;
    cin >> l >> r;
    if(l==0){
        cout << r <<" " << r-1 <<" " << l <<"\n";
    }
    else if(r-l+1==3) cout << l << " " << l+1 << " " <<r <<"\n";
    else{
        int k = __lg(l^r);
        int a = (l|(1<<k)-1), b=a+1, c = (a==l?r:l);
        cout << a << " "<<b <<" "<< c<<"\n"; 
        }
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int t;
    cin>>t;
    while(t--){
       solve();
    }
    return 0; 
    
}