use std::io::{self, BufRead, BufReader}; use std::fs::File; fn main() { let debug = false; // let f = File::open("src/input.txt").unwrap(); // let mut f = BufReader::new(f); let stdin = io::stdin(); let mut f = stdin.lock(); let mut input_str = String::new(); input_str.clear(); f.read_line(&mut input_str); let t: usize = input_str.trim().parse::().unwrap(); if debug { println!("{}", t) } let queries: Vec> = f.lines() .filter_map( |l| l.ok().map( |s| s.split_whitespace() .filter_map(|word| word.parse().ok()) .collect() ) ).collect(); if debug { println!("{:?}", queries) } for q in queries { // println!("{:?}", q); let b = q[0]; let s = q[1]; let c = q[2]; for i in 2..c { // println!("{}", i); let t: i32 = b - i + s - i + i; if t == c { println!("{}", i); } } } }