use proconio::*; use std::collections::*; fn main() { input! { t: i32, } for _z in 0..t { input! { a: i64, b: i64, c: i64, } let mut res: i64 = 0; res += b - b % 2; let b = b % 2; if a >= b + c { res += b + c * 2; } else { res += b + c * 2; res -= (b + c - a) / 2 * 3; if (a + b + c) % 2 == 1 { if b >= 1 { res -= 1; } else { res -= 2; } } } println!("{}", res); } }