<doocs>1267.Count Servers that Communicate_1.py
def countServers( grid: List[List[int]]) -> int:
    m, n = len(grid), len(grid[0])
    rows = [0] * m
    cols = [0] * n
    for i in range(m):
        for j in range(n):
            if grid[i][j] == 1:
                rows[i] += 1
                cols[j] += 1
    res = 0
    for i in range(m):
        for j in range(n):
            if grid[i][j] == 1:
                if rows[i] > 1 or cols[j] > 1:
                    res += 1
    return res
def sample_funcname ( var_0 : List [ List [ int ] ] ) -> int :
    var_4 , var_6 = len ( var_0 ) , len ( var_0 [ 0 ] )
    var_7 = [ 0 ] * var_4
    var_8 = [ 0 ] * var_6
    for var_10 in range ( var_4 ) :
        for var_11 in range ( var_6 ) :
            if var_0 [ var_10 ] [ var_11 ] == 1 :
                var_7 [ var_10 ] += 1
                var_8 [ var_11 ] += 1
    var_13 = 0
    for var_10 in range ( var_4 ) :
        for var_11 in range ( var_6 ) :
            if var_0 [ var_10 ] [ var_11 ] == 1 :
                if var_7 [ var_10 ] > 1 or var_8 [ var_11 ] > 1 :
                    var_13 += 1
    return var_13
