comefrom: <doocs>1267.Count Servers that Communicate_1.py
code: 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
masked: def sample_funcname ( var_0 : List [ List [ int ] ] ) -> int :
      var_1 , var_2 = len ( var_0 ) , len ( var_0 [ 0 ] )
      var_3 = [ 0 ] * var_1
      var_4 = [ 0 ] * var_2
      for var_5 in range ( var_1 ) :
          for var_6 in range ( var_2 ) :
              if var_0 [ var_5 ] [ var_6 ] == 1 :
                  var_3 [ var_5 ] += 1
                  var_4 [ var_6 ] += 1
      var_7 = 0
      for var_5 in range ( var_1 ) :
          for var_6 in range ( var_2 ) :
              if var_0 [ var_5 ] [ var_6 ] == 1 :
                  if var_3 [ var_5 ] > 1 or var_4 [ var_6 ] > 1 :
                      var_7 += 1
      return var_7
  