I thought an algorithm like this would work well:

1) walk each row

2) sum and average each two values

3) any two that meet this criteria, keep scanning until all the contiguous values in the row that meet the criteria, have been found.

4) at the starting column, then use the "flip" trick, to go down the column, continuing until all contiguous column values that meet the criteria, have been found.

5) when you've done this for all the values found in #3, then add up the values in this submatrix. rows = stop row - start row, cols = stop col - start col. total = rows * cols.

6) biggest total, wins.

I'm a hobby coder, so there may be a much better way to do this.

The "flip" trick is just putting the columns var in the inner nested loop

Code:

for(col = 0; col < someVariable; col++) {
for(row = 0; row < someVariable; row++) {
//just something to do in a column
tally += grid[col][row]; //walk down a column in a 2D matrix.
}
}