Golf course

All submissions for this problem are available.
A company wants to invest into building a golf course. They could choose the land to build the course from a rectangle area of size MxN. The rectangle area is divided into MxN cells. They measured the elevation of each cell and recorded it into an integer number.
The company decided that the golf course should be a KxK square (K ≤ min(M,N)). Thus, there are (MK+1)(NK+1) possible KxK squares that can be used to build the golf course. For each such square, the company wants to know the highest elevation of a cell inside the square. They also need to know how many cells that have such highest elevations.
Write a program that help the company do the above task.
Input
The first line contains t, the number of test cases (about 10). Then t test cases follow. Each test case has the following form:
 The first line contains three integers M, N, K (1 ≤ M, N ≤ 500, 1 ≤ K ≤ min(M,N) ).
 There are M lines follow. Each line contains N nonnegative integers not exceeding 10000. Each integer represents the elevation of a cell.
There is a blank line after each test case.
Output
For each test case, in the first line print "Case d:" where d is the number of the test case. Then print MK+1 lines and in each line print NK+1 entries. Successive entries should be separated by spaces. The entry in the i^{th} line and the j^{th} column has the following form:
 The first number is the highest elevation of a cell in the KxK square whose top left corner is (i,j).
 If there is more than one cell in the square that has the highest elevation, print (c), where c is the number of cells inside the square that have the highest elevation.
Print a blank line after each test case.
Example
Input: 2 3 3 2 5 5 5 5 5 5 5 5 5 3 3 2 4 2 1 3 5 7 2 8 8 Output: Case 1: 5(4) 5(4) 5(4) 5(4) Case 2: 5 7 8 8(2)
Author:  admin 
Tags  admin 
Date Added:  10072009 
Time Limit:  0.14 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, TCL, kotlin, TEXT, SCM chicken, CLOJ, COB, FS 
Comments
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 