Problem: 2057C - Trip to the Olympiad
Language: Rust 2021

Previous submission (verdict: Wrong answer on test 1):
#![allow(unused)]

use std::fmt::Debug;
use std::hash::Hash;
use std::io;
use std::io::Write;
use std::str::FromStr;

fn next<T>() -> T
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    input.trim().parse().unwrap()
}

fn next_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    let arr: Vec<T> = input
        .trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    arr
}

fn ask(s: String) {
    println!("{}", s);
    io::stdout().flush().unwrap();
}

macro_rules! next_tuple {
    ($($t:ty),*) => {{
        let mut input = String::new();
        io::stdin().read_line(&mut input).unwrap();
        let mut iter = input.trim().split_whitespace();
        (
            $(
                iter.next().unwrap().parse::<$t>().unwrap(),
            )*
        )
    }};
}

fn next_char_vec() -> Vec<char> {
    let s: String = next();
    s.chars().collect::<Vec<char>>()
}

macro_rules! multi {
    ($blk: block) => {
        let t: usize = next();
        for _ in 0..t {
            $blk
        }
    };
}

macro_rules! single {
    ($blk: block) => {{
        $blk
    }};
}

macro_rules! getu {
    ($name: ident) => {
        let mut $name: usize = next();
    };
}

macro_rules! simple_vec {
    ($size: ident, $name: ident, $t: ty) => {
        let $size: usize = next();
        let mut $name: Vec<$t> = next_vec();
    };
}

macro_rules! print_bool {
    ($v: expr) => {
        println!("{}", if ($v) { "Yes" } else { "No" });
    };
}

macro_rules! print_vec {
    ($v: expr) => {
        println!(
            "{}",
            ($v).iter()
                .map(|x| x.to_string())
                .collect::<Vec<_>>()
                .join(" ")
        );
    };
}

fn gcd(mut a: usize, mut b: usize) -> usize {
    if a == b {
        return a;
    }
    if b > a {
        let temp = a;
        a = b;
        b = temp;
    }
    while b > 0 {
        let temp = a;
        a = b;
        b = temp % b;
    }
    return a;
}

fn lcm(a: usize, b: usize) -> usize {
    return a * (b / gcd(a, b));
}

struct XorShift64 {
    state: u64,
}

impl XorShift64 {
    fn new(seed: u64) -> Self {
        Self { state: seed }
    }

    fn next(&mut self) -> u64 {
        let mut x = self.state;
        x ^= x << 13;
        x ^= x >> 7;
        x ^= x << 17;
        self.state = x;
        x
    }
}

fn generate_random_vector(n: usize, seed: u64) -> Vec<u64> {
    let mut rng = XorShift64::new(seed);
    (0..n).map(|_| rng.next()).collect()
}

struct XorShift128 {
    state: u128,
    max: u128,
}

impl XorShift128 {
    fn new(seed: u128, max: u128) -> Self {
        Self { state: seed, max }
    }

    fn next(&mut self) -> u128 {
        let mut x = self.state;
        x ^= x << 13;
        x ^= x >> 7;
        x ^= x << 17;
        self.state = x;
        x % self.max
    }
}

fn generate_random_vector128(n: usize, seed: u128, max: u128) -> Vec<u128> {
    let mut rng = XorShift128::new(seed, max);
    (0..n).map(|_| rng.next()).collect()
}

const U64_HASH: u64 = 6818302623243877264;
const U128_HASH: u128 = 68183026232438772646818302623243877264;

const ALPHABETS: [char; 26] = [
    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
    't', 'u', 'v', 'w', 'x', 'y', 'z',
];

type UVec = Vec<usize>;

const MOD: usize = 1000000007;
// const MOD: usize = 998244353;

const MLOG: usize = 23;

fn main() {
    multi!({
        let (l, r) = next_tuple!(usize, usize);
        let mut k = 1;
        while (k * 2) <= r {
            k *= 2;
        }
        println!("{} {} {}", k, k - 1, if (k == r) { l } else { r });
    });
}


Submission (verdict: Accepted):
#![allow(unused)]

use std::fmt::Debug;
use std::hash::Hash;
use std::io;
use std::io::Write;
use std::str::FromStr;

fn next<T>() -> T
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    input.trim().parse().unwrap()
}

fn next_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    let arr: Vec<T> = input
        .trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    arr
}

fn ask(s: String) {
    println!("{}", s);
    io::stdout().flush().unwrap();
}

macro_rules! next_tuple {
    ($($t:ty),*) => {{
        let mut input = String::new();
        io::stdin().read_line(&mut input).unwrap();
        let mut iter = input.trim().split_whitespace();
        (
            $(
                iter.next().unwrap().parse::<$t>().unwrap(),
            )*
        )
    }};
}

fn next_char_vec() -> Vec<char> {
    let s: String = next();
    s.chars().collect::<Vec<char>>()
}

macro_rules! multi {
    ($blk: block) => {
        let t: usize = next();
        for _ in 0..t {
            $blk
        }
    };
}

macro_rules! single {
    ($blk: block) => {{
        $blk
    }};
}

macro_rules! getu {
    ($name: ident) => {
        let mut $name: usize = next();
    };
}

macro_rules! simple_vec {
    ($size: ident, $name: ident, $t: ty) => {
        let $size: usize = next();
        let mut $name: Vec<$t> = next_vec();
    };
}

macro_rules! print_bool {
    ($v: expr) => {
        println!("{}", if ($v) { "Yes" } else { "No" });
    };
}

macro_rules! print_vec {
    ($v: expr) => {
        println!(
            "{}",
            ($v).iter()
                .map(|x| x.to_string())
                .collect::<Vec<_>>()
                .join(" ")
        );
    };
}

fn gcd(mut a: usize, mut b: usize) -> usize {
    if a == b {
        return a;
    }
    if b > a {
        let temp = a;
        a = b;
        b = temp;
    }
    while b > 0 {
        let temp = a;
        a = b;
        b = temp % b;
    }
    return a;
}

fn lcm(a: usize, b: usize) -> usize {
    return a * (b / gcd(a, b));
}

struct XorShift64 {
    state: u64,
}

impl XorShift64 {
    fn new(seed: u64) -> Self {
        Self { state: seed }
    }

    fn next(&mut self) -> u64 {
        let mut x = self.state;
        x ^= x << 13;
        x ^= x >> 7;
        x ^= x << 17;
        self.state = x;
        x
    }
}

fn generate_random_vector(n: usize, seed: u64) -> Vec<u64> {
    let mut rng = XorShift64::new(seed);
    (0..n).map(|_| rng.next()).collect()
}

struct XorShift128 {
    state: u128,
    max: u128,
}

impl XorShift128 {
    fn new(seed: u128, max: u128) -> Self {
        Self { state: seed, max }
    }

    fn next(&mut self) -> u128 {
        let mut x = self.state;
        x ^= x << 13;
        x ^= x >> 7;
        x ^= x << 17;
        self.state = x;
        x % self.max
    }
}

fn generate_random_vector128(n: usize, seed: u128, max: u128) -> Vec<u128> {
    let mut rng = XorShift128::new(seed, max);
    (0..n).map(|_| rng.next()).collect()
}

const U64_HASH: u64 = 6818302623243877264;
const U128_HASH: u128 = 68183026232438772646818302623243877264;

const ALPHABETS: [char; 26] = [
    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
    't', 'u', 'v', 'w', 'x', 'y', 'z',
];

type UVec = Vec<usize>;

const MOD: usize = 1000000007;
// const MOD: usize = 998244353;

const MLOG: usize = 23;

fn main() {
    multi!({
        let (l, r) = next_tuple!(usize, usize);
        let mut k: usize = 1 << 32;
        while ((l & k) == (r & k)) {
            k >>= 1;
        }
        let x = (k - 1) | l;
        let y = x + 1;
        let z = if (y == r) { l } else { r };
        println!("{} {} {}", x, y, z);
    });
}