use std::io::Read; fn solve(a: usize, b: usize) { let bit_size = format!("{:b}", std::cmp::max(a, b)).len(); let mut result: u128 = 1; format!("{:0>1$b}", a, bit_size).chars().zip(format!("{:0>1$b}", b, bit_size).chars()) .map(|pair| { if pair.0 == '0' { if pair.1 == '0' { 1 } else { 2 } } else { if pair.1 == '0' { 0 } else { 1 } } }) .for_each(|i| result *= i); if result == 1 { println!("{}", result); } else { println!("{}", result / 2); } } fn main() { let mut ab = String::new(); std::io::stdin().read_to_string(&mut ab).ok(); let ab: Vec = ab.trim().split('\n').next().unwrap().trim().split_whitespace() .map(|i| i.parse::().unwrap()) .collect(); solve(ab[0], ab[1]); }