<doocs>1351.Count Negative Numbers in a Sorted Matrix_1.py
def countNegatives( grid: List[List[int]]) -> int:
    m, n = len(grid), len(grid[0])
    i, j = m - 1, 0
    ans = 0
    while i >= 0 and j < n:
        if grid[i][j] < 0:
            ans += n - j
            i -= 1
        else:
            j += 1
    return ans
def sample_funcname ( var_0 : List [ List [ int ] ] ) -> int :
    var_4 , var_6 = len ( var_0 ) , len ( var_0 [ 0 ] )
    var_8 , var_9 = var_4 - 1 , 0
    var_10 = 0
    while var_8 >= 0 and var_9 < var_6 :
        if var_0 [ var_8 ] [ var_9 ] < 0 :
            var_10 += var_6 - var_9
            var_8 -= 1
        else :
            var_9 += 1
    return var_10
