package main import . "fmt" func main() { var a, b int Scan(&a,&b) Println(solve(a,b)) } func solve(a, b int) int { var x, y int for i := 62; i >= 0; i-- { c := 1 << i switch { case x+c <= a && y+c <= b: if x < y { x += c } else { y += c } case x+c <= a: x += c case y+c <= b: y += c } } return min(x,y,x^y) } func init() { check() } func check() { for a := 1; a <= 100; a++ { for b := 1; b <= 100; b++ { s1 := solve(a, b) s2 := bruteforce(a, b) if s1 != s2 { panic(Sprintf("a=%d,b=%d,s1=%d,s2=%d",a,b,s1,s2)) } } } } func bruteforce(a, b int) int { ans := 0 for x := 0; x <= a; x++ { for y := 0; y <= b; y++ { ans = max(ans, min(x,y,x^y)) } } return ans }