#K47707. Emptying Baskets

    ID: 28258 Type: Default 1000ms 256MiB

Emptying Baskets

Emptying Baskets

You are given several test cases. In each test case, you must determine the minimum number of operations required to empty all baskets. Each basket contains a certain number of apples. In a single operation, you can remove exactly one apple from every basket that is still non-empty.

Because you can perform the operation on all baskets simultaneously, the minimum number of operations required is equal to the number of apples in the basket that initially contains the most apples.

For example, if a test case has baskets with 1, 2, 1, 3, 2 apples respectively, the minimum number of operations required is 3, since the basket with the maximum apples contains 3 apples.

Your task is to compute this number for each test case.

Note: Use LaTeX format for any formulas. The formula for the answer in each test case is:

\( \text{answer} = \max_{1 \leq i \leq n} a_i \),

where \(a_i\) is the number of apples in the \(i\)-th basket.

inputFormat

The first line of input contains an integer \(T\) denoting the number of test cases. Then, for each test case:

  • The first line contains an integer \(n\) denoting the number of baskets.
  • The second line contains \(n\) space-separated integers, where the \(i\)-th integer represents the number of apples in the \(i\)-th basket.

All input is provided via standard input (stdin).

outputFormat

For each test case, output a single line containing the minimum number of operations required to empty all baskets. Each test case's answer should be printed on a new line via standard output (stdout).

## sample
3
5
1 2 1 3 2
2
5 5
4
7 8 9 10
3

5 10

</p>