time limit per test: 0.5 sec. memory limit per test: 16000 KB
input: standard output: standard
You are given N*M matrix A. You are to find such matrix B, that B[i,j]=min{ A[x,y] : (y>=j) and (x>=i+j-y) }
Input
On the first line of the input there are two integer numbers, N and M (1<=N,M<=1000). Then matrix A follows: next N lines contains M integers each (not greater than 32000 by absolute value). The j-th number on then i-th of this lines is A[i,j].
Output
Write matrix B in the same format as matrix A, but without N and M.