Problem: 2057C - Trip to the Olympiad
Language: Java 21

Previous submission (verdict: Wrong answer on test 1):
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;


public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int t = sc.nextInt();
        while(t-- != 0){
            int l = sc.nextInt(), r = sc.nextInt();
            int a = 0, b = 0, c = 0;
            int n1 = countBits(l), n2 = countBits(r);
            if(r - l == 2){
                a = l; b = a + 1; c = b + 1;
            }
            else{
                int count = 0;
                for(int i = Math.max(n1, n2) - 1; i >= 0; i--){
                    int bit1 = ((l & (int)(1 << i)) == 0) ? 0 : 1;
                    int bit2 = ((r & (int)(1 << i)) == 0) ? 0 : 1;
                    count = i;
                    if(bit1 != bit2){
                        break;
                    }
                    int val = bit1 << i;
                    a += val; b += val; c += val;
                }
                a += (int)(1 << count);
                for(int i = count - 1; i >= 0; i--){
                    b += (int)(1 << i);
                    c += (int)((i % 2) << i);
                }
            }
            out.println(a + " " + b + " " + c);
        }
        out.close();
        }
    
    static int countBits(int n){
        int count = 0;
        while(n != 0){
            n /= 2;
            count++;
        }
        return count;
    }

        static class FastScanner {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            StringTokenizer st = new StringTokenizer("");
     
            String next() {
                while (!st.hasMoreTokens())
                    try {
                        st = new StringTokenizer(br.readLine());
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                return st.nextToken();
            }
     
            int nextInt() {
                return Integer.parseInt(next());
            }
     
            int[] readArray(int n) {
                int[] a = new int[n];
                for (int i = 0; i < n; i++)
                    a[i] = nextInt();
                return a;
            }
     
            long nextLong() {
                return Long.parseLong(next());
            }
        }

    }

Submission (verdict: Wrong answer on test 1):
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;


public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int t = sc.nextInt();
        while(t-- != 0){
            int l = sc.nextInt(), r = sc.nextInt();
            int a = 0, b = 0, c = 0;
            int n1 = countBits(l), n2 = countBits(r);
            if(r - l == 2){
                a = l; b = a + 1; c = b + 1;
            }
            else{
                int count = 0;
                for(int i = Math.max(n1, n2) - 1; i >= 0; i--){
                    int bit1 = ((l & (int)(1 << i)) == 0) ? 0 : 1;
                    int bit2 = ((r & (int)(1 << i)) == 0) ? 0 : 1;
                    count = i;
                    if(bit1 != bit2){
                        break;
                    }
                    int val = bit1 << i;
                    a += val; b += val;
                }
                a += (int)(1 << count);
                for(int i = count - 1; i >= 0; i--){
                    b += (int)(1 << i);
                }
                if(a == r) c = b + 1;
                else c = a + 1;
            }
            out.println(a + " " + b + " " + c);
        }
        out.close();
        }
    
    static int countBits(int n){
        int count = 0;
        while(n != 0){
            n /= 2;
            count++;
        }
        return count;
    }

        static class FastScanner {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            StringTokenizer st = new StringTokenizer("");
     
            String next() {
                while (!st.hasMoreTokens())
                    try {
                        st = new StringTokenizer(br.readLine());
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                return st.nextToken();
            }
     
            int nextInt() {
                return Integer.parseInt(next());
            }
     
            int[] readArray(int n) {
                int[] a = new int[n];
                for (int i = 0; i < n; i++)
                    a[i] = nextInt();
                return a;
            }
     
            long nextLong() {
                return Long.parseLong(next());
            }
        }

    }