IntermediateRating 1100
Hourglass Sum
An hourglass is a 3×3 window minus its middle-left and middle-right cells. Print the largest hourglass sum.
Input
r c (≥ 3), then r lines.
Output
A number.
Sample 1
Input
6 6 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 2 4 4 0 0 0 0 2 0 0 0 0 1 2 4 0
Output
19
Sample 2
Input
3 3 1 1 1 1 1 1 1 1 1
Output
7
Output appears here