Sum of Submatrix Method 2

If we are taking (i,j) as the top left corner then shouldn’t we take the the point R (Which we are adding at the end ) as
(0,0)-(i,j).

Also can you tell me which point are we taking as the left corner here? Mathematically speaking, (1,2) or (2,3) from top.

Okay I don’t think that I got your doubt exactly but I will try to explain the algo.

First of all , all the prefix sums are stored keeping (0,0) as top left corner.

Now the fir two loops of i and j are iterating over the top left corner.
Bi and Bj are iterating over the bottom right corner.

After this we are simply using the observation used in the video for any set of points (i,j,bi,bj)
and adding it to the sum.
i,j is top left corner of the rectangle and bi,bj is bottom right.