A. Lever
math
In Divergent Universe, The Lever iterates itself given two arrays \(a\) and \(b\) of length \(n\). In each iteration, The Lever will do the following: Choose a random index \(i\) such that \(a_i > b_i\). Then, decrease \(a_i\) by \(1\). If there does not exist such \(i\), ignore this step. Choose a random index \(i\) such that \(a_i < b_i\). Then, increase \(a_i\) by \(1\). If there does not exist such \(i\), ignore this step. After each iteration, the Lever will check if step \(1\) is ignored, and if so, it will end its iteration.You're given the two arrays. Find the number of iterations that the Lever does. It can be shown this number is fixed over all possibilities of random indices that The Lever can choose for each step.
Each test contains multiple test cases. The first line contains the number of test cases \(t\) (\(1 \le t \le 10^4\)). The description of the test cases follows. The first line of each test case contains one integer \(n\) (\(1 \le n \le 10\)).The second line of each test case contains \(n\) integers \(a_1, a_2, \dots, a_n\) (\(1 \le a_i \le 10\)).The third line of each test case contains \(n\) integers \(b_1, b_2, \dots, b_n\) (\(1 \le b_i \le 10\)).
For each test case, output one integer — the number of iterations that the Lever does.
In the first sample case:In the first iteration, the Lever decreases \(a_1\) by \(1\) and increases \(a_2\) by \(1\), and \(a\) becomes \([6,4]\).In the second iteration, the Lever decreases \(a_1\) by \(1\) and increases \(a_2\) by \(1\), and \(a\) becomes \([5,5]\).In the third iteration, the Lever increases \(a_2\) by \(1\), and \(a\) becomes \([5,6]\). Since it fails to decrease an element, its iteration ends. Therefore, the answer is \(3\).In the second sample case, the Lever does nothing in its first iteration, and thus it does only one iteration.