LearnPy Hub
← Arena
AdvancedRating 1700

Rectangle With the Biggest Sum

Print the largest sum of any non-empty rectangle of cells in the grid.

Input

r and c (≤ 60), then r rows.

Output

One integer.

Sample 1

Input
4 5
1 2 -1 -4 -20
-8 -3 4 2 1
3 8 10 1 3
-4 -1 1 7 -6
Output
29

Sample 2

Input
1 1
-5
Output
-5
solution.py
Output appears here
Rectangle With the Biggest Sum · Python Arena problem · LearnPy Hub