Calculate the sum of elements in the submatrix with upper left column { i , j } and lower right column at { ni , nj } ;
int sum = dp [ ni ] [ nj ] - dp [ ni ] [ j - 1 ] - dp [ i - 1 ] [ nj ] + dp [ i - 1 ] [ j - 1 ] ; if ( sum >= X ) {