You are given an integer $$$k$$$ and a matrix $$$v$$$ with $$$n$$$ rows and $$$m$$$ columns. The element in row $$$i$$$ and column $$$j$$$ is denoted by $$$v_{i,j}$$$.
A cell $$$(x, y)$$$ is called a peak if its value is greater than or equal to the sum of the values in all other cells in row $$$x$$$ and column $$$y$$$. Formally, $$$(x, y)$$$ is a peak if
$$$$$$ v_{x,y} \ge \sum_{\substack{1 \le i \le n \\i \neq x}} v_{i,y} + \sum_{\substack{1 \le j \le m \\j \neq y}} v_{x,j}. $$$$$$
You may perform the following operation any number of times (possibly zero):
Find the minimum number of operations required to obtain a matrix with at least $$$k$$$ peaks.
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 three integers $$$n$$$, $$$m$$$, and $$$k$$$ ($$$1 \le n, m \le 10^5$$$, $$$1 \le k \le n \cdot m$$$, $$$n \cdot m \le 10^5$$$) — the number of rows, the number of columns, and the required number of peaks.
The $$$i$$$-th of the next $$$n$$$ lines contains $$$m$$$ integers $$$v_{i,1}, v_{i,2}, \ldots, v_{i,m}$$$ ($$$-10^9 \le v_{i,j} \le 10^9$$$).
It is guaranteed that the sum of $$$n \cdot m$$$ over all test cases does not exceed $$$10^5$$$.
For each test case, output a single integer — the minimum number of operations required to obtain at least $$$k$$$ peaks.
If there is no solution, print a single integer $$$-1$$$.
163 3 7-1 -30 76 -3 221 -18 163 1 21000000003000000002000000001 3 12 3 41 3 11 2 31 2 25 75 2 8531959596 -61416172425363565 672913308981527099 451180253-161687136 898803495-388356105 8977233131 1 101 1 1-51 4 3-8 -4 4 -111 9 5-12 -4 -13 9 -1 -15 6 -15 -41 3 3-12 -15 81 5 510 8 -4 0 -41 3 312 9 -11 3 3-14 11 -61 6 6-1 0 15 3 1 -141 2 21000000000 -1000000000
21000000001027345926980-100116121172000000000
For the first test case, you can perform the following two operations:
After these operations, the matrix will be:
| $$$\color{green}{-1}$$$ | $$$-31$$$ | $$$\color{green}{6}$$$ |
| $$$5$$$ | $$$\color{green}{-5}$$$ | $$$\color{green}{20}$$$ |
| $$$\color{green}{0}$$$ | $$$\color{green}{-20}$$$ | $$$\color{green}{14}$$$ |
The seven peaks are highlighted in green. For example:
It can be shown that fewer than two operations cannot create seven peaks, so the answer is $$$2$$$.
In the eighth test case, the only cell has value $$$-5$$$. A cell in a $$$1 \times 1$$$ matrix is a peak if and only if its value is non-negative. Since every operation only decreases its value, it is impossible to make it a peak.
For the last test case, both cells are peaks exactly when their values are equal. Therefore, the first cell must be decreased from $$$10^9$$$ to $$$-10^9$$$, which requires $$$2 \cdot 10^9$$$ operations.