Loop to find the sum of the matrix of every possible submatrix
for x in range ( N ) : NEW_LINE INDENT for y in range ( M ) : NEW_LINE INDENT if ( x + i - 1 <= N - 1 and y + i - 1 <= M - 1 ) : NEW_LINE INDENT if ( sumQuery ( aux , x , y , x + i - 1 , y + i - 1 ) > K ) : NEW_LINE INDENT satisfies = False NEW_LINE DEDENT DEDENT DEDENT DEDENT if ( satisfies == True ) : NEW_LINE INDENT return ( i ) NEW_LINE DEDENT return 0 NEW_LINE