Problem 2536 · Medium
Mark each submatrix at its four corners in a two-dimensional difference grid, then take the prefix sums.
Open the interactive visualisation