use std::io::Read; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: usize = itr.next().unwrap().parse().unwrap(); let a: Vec = (0..n) .map(|_| itr.next().unwrap().parse().unwrap()) .collect(); let b: Vec = (0..n) .map(|_| itr.next().unwrap().parse().unwrap()) .collect(); let mut ans: i32 = 0; for i in 0..n { let mut pq = std::collections::BinaryHeap::new(); for j in 0..n { pq.push((-a[j], 0)) } for j in 0..n { let (mut level, mut count) = pq.pop().unwrap(); level *= -1; count *= -1; level += b[(i + j) % n] / 2; count += 1; ans = std::cmp::max(ans, count); pq.push((-level, -count)); } } println!("{}", ans); }