Store the count for the current X and Y
cnt = 0 NEW_LINE for k in range ( 0 , N ) : NEW_LINE INDENT if ( X [ i ] >= x1 [ k ] and X [ i ] + 1 <= x2 [ k ] and Y [ j ] >= y1 [ k ] and Y [ j ] + 1 <= y2 [ k ] ) : NEW_LINE INDENT cnt += 1 NEW_LINE DEDENT DEDENT