#### Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

### Problem Description

You are given an 2-dimensional array of non-negative integers consisting of *R* rows and *C* columns.

A square of integers is considered to be more ideal than another square if the difference in the largest and smallest integers is smaller.

Rar the Cat wants you to find the minimum difference in largest and smallest integers in all *K* by *K* integer regions of the 2-dimensional array.

### Input

The first line of input will have 3 integers: *R*, *C* followed by *K*.

*R* lines of *C* integers will then follow, describing the 2-dimensional array.

### Output

A single integer, the minimum difference in largest and smallest integers for all *K* by *K* regions in the 2-dimensional array.

### Limits

For all testcases, the 2-dimensional array will not contain integers exceeding 10^{9}. In addition, 0 < *K* ≤ *R* and 0 < *K* ≤ *C* will also be satisfied.

Subtask 1 (21%): 0 ≤ *R*, *C* ≤ 100.

Subtask 2 (28%): 0 ≤ *R*, *C* ≤ 500.

Subtask 3 (51%): 0 ≤ *R*, *C* ≤ 1000.

Subtask 4 (0%): Sample Testcase

### Sample Testcase

#### Input

5 4 2 1 2 5 6 0 17 16 0 16 17 2 1 2 10 2 1 1 2 2 2

#### Output

1

#### Explanation

Either2 1 2 1or

2 1 2 2

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 21 | 3 | 0.5s | 256MB | Minimum |

2 | 28 | 5 | 0.5s | 256MB | Minimum |

3 | 51 | 11 | 0.5s | 256MB | Minimum |

4 | 0 | 1 | 0.5s | 256MB | Minimum |

### Judge Compile Command

g++-8 ans.cpp -o idealsquare -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512