use proconio::{fastout, input}; const DIRS: [(isize, isize); 4] = [(0, 1), (1, 0), (0, -1), (-1, 0)]; trait OrdExt { fn chmax(&mut self, other: Self) -> bool; fn chmin(&mut self, other: Self) -> bool; } impl OrdExt for T { fn chmax(&mut self, other: Self) -> bool { if *self < other { *self = other; true } else { false } } fn chmin(&mut self, other: Self) -> bool { if *self > other { *self = other; true } else { false } } } #[fastout] fn main() { input! { gx: isize, gy: isize, } if gx == 0 && gy == 0 { println!("0"); } else if gx.abs() == gy.abs() { println!("1"); } else if gx == 0 || gy == 0 { println!("1"); } else { println!("2"); } }