use std::io::Read; use std::cmp; fn main() { let mut buf = String::new(); std::io::stdin().read_to_string(&mut buf).unwrap(); let mut iter = buf.split_whitespace(); iter.next(); let sushi_lane = iter.map(|v| v.parse::().unwrap()); let mut max_one_before: usize = 0; let mut max_two_before: usize = 0; for sushi in sushi_lane { let cur_max: usize = cmp::max(sushi + max_two_before, max_one_before); max_two_before = max_one_before; max_one_before = cur_max; } println!("{}", max_one_before); }