@karlr42 The trick is to realize that the first min(a) rows are updated by every operation. Similarly the first min(b) columns are updated by every operation. So that sub matrix from 0 to mina, 0 to minb are updated by every operation. So those cells contain the max, and we simply count the number of those cells.

Range Addition II