# [Kattis] Paradox With Averages (Hard)
>題目連結:https://open.kattis.com/problems/averageshard
*Note that this is a harder version of the problem averageseasy.*
:::success
*請注意,這是問題 averageseasy 的較難版本。*
:::
One well-known joke goes as follows: If a bad Computer Science student drops out of college and goes to a different college to study Economics instead, he will increase the average intelligence on both colleges.
:::success
有一則著名的笑話如下:如果一個糟糕的計算機科學學生輟學,去了別的學校學經濟學,他會提高兩所學校的平均智力。
:::
In this problem we investigate the math behind this joke. Given the list of student IQs for both colleges, find the number of students of Computer Science that can make the joke true.
:::success
在這個問題中,我們探討了這個笑話背後的數學問題。給定兩所學校的學生IQ列表,找出可以使這個有趣事件成真的計算機科學學生的數量。
:::
## Input
The first line of the input file contains an integer $T$ specifying the number of test cases. Each test case is preceded by a blank line.
:::success
輸入文件的第一行包含一個整數$T$,表示測試案例的數量。每個測試案例之前都有一個空行。
:::
Each test case looks as follows: The first line contains two positive integers $NCS$ and $NE$ – the number of students of Computer Science and Economics, respectively. The number of Computer Science students will be at least 2 and there will be at most $200000$ students in every college.
:::success
每個測試案例的格式如下:第一行包含兩個正整數$NCS$和$NE$,分別表示計算機科學和經濟學學生的人數。計算機科學學生的數量至少為2,每個學校最多有$200000$名學生。
:::
The following lines contain a total of $NCS+NE$ whitespace-separated positive integers giving the IQs of all the students. The first $NCS$ students mentioned in the input are Computer Science students, the remaining ones study Economics. The IQ of some students can be as high as $100000$.
:::success
接下來的行包含總共$NCS+NE$個以空格分隔的正整數,表示所有學生的IQ。輸入中提到的前$NCS$名學生是計算機科學學生,其餘的學生學經濟學。一些學生的IQ可能高達$100000$。
:::
## Output
For each test case output a single line with a single integer – the number of Computer Science students that would cause the funny event to happen.
:::success
對於每個測試案例,輸出一個整數,表示使這個有趣事件成真的計算機科學學生的數量。
:::
### Sample Input 1
```
1
5 5
100 101 102 103 104
98 100 102 99 101
```
### Sample Output 1
```
1
```
###### 翻譯錯誤請留言告知