ZOJ 1074 - To the Max

Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1 x 1 or greater located within the whole array. The sum of a rectangle is the sum of all the elements in that rectangle. In this problem the sub-rectangle with the largest sum is referred to as the maximal sub-rectangle.

Explanation
Kadane's Algorithm works in a one-dimensional sequence. However, it can still be adapted to work on a two-dimensional array, by adding new columns that contain relevant sums of the columns in the original array.

Gotchas

 * Any points one can easily overlook?
 * The correct way to understand ambiguous formulations?

Implementations
https://rextester.com/QFMA70178

Optimizations
Optimizations here.

Input
4 0 -2 -7 0 9 2 -6 2 -4 1 -4 1 -1 8 0 -2

Output
15