# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

By shefin · Limits 1s, 512 MB

You are a businessman who is fond of Vinia GPU. You buy Vinia GPUs from Byteland and sell them to Bitland. There are $n$ GPU shops in Byteland and $m$ GPU shops in Bitland. For some reason, the shop owners have put a restriction on you. From a shop in Byteland, you can buy at most $1$ GPU. Similarly, you can sell at most $1$ GPU to a shop in Bitland. The shop owners also decide the price of the GPU themselves.

You will be given the price of the Vinia GPU in the shops. You have to tell the maximum profit you can make. You can choose not to buy any GPU at all.

## Input

The input starts with an integer $T(1\leq T\leq 1000)$, the number of test cases.

In each test case, the first line contains two space-separated integers $n(1\leq n\leq 10^5)$ and $m(1\leq m\leq 10^5)$, the number of shops in Byteland and Bitland respectively.

The next line contains $n$ space-separated integers. The $i^{th}$ integer represents the price of the Vinia GPU in the $i^{th}$ shop in Byteland.
The third line contains $m$ space-separated integers. The $i^{th}$ integer represents the price of the Vinia GPU in the $i^{th}$ shop in Bitland.
All the prices will be in $[1, 10^9]$ range.

The sum of $n$ over all test cases and the sum of $m$ over all test cases will not exceed $5\times10^5$.

## Output

For each test case, print the maximum profit in a line.

## Sample

InputOutput
2
3 4
10 70 20
50 60 1 5
3 1
10 70 20
50

80
40


In the first test case, you can buy two GPUs from shop $1$ and shop $3$ in Byteland and sell them to shop $1$ and shop $2$ in Bitland.

### Statistics

89% Solution Ratio

Siddik_53rdEarliest, 1w ago

Shan_1603109Fastest, 0.1s

Asif_AlimLightest, 918 kB

FrdhsnShortest, 468B