use proconio::input; fn main() { let contest_time: i32 = 6000; let problem_total: u8 = 7; input! { times: [i32; problem_total] } let mut rem: i32 = contest_time; for time in times { rem -= time; let ans = if rem >= 0 { rem } else { -1 }; println!("{}", ans); } }