use itertools::Itertools; use std::io::stdin; use std::io::BufRead; fn main() { let mut prev: Option = None; let mut increased = 0; for (a, b, c) in stdin() .lock() .lines() .map(|line| line.unwrap().parse::().unwrap()) .tuple_windows() { let sum = a + b + c; match prev { Some(prev) => { if sum > prev { increased += 1 } } _ => (), } prev = Some(sum) } println!("{}", increased) }