comefrom: <doocs>0463.Island Perimeter_1.py
code: def islandPerimeter( grid: List[List[int]]) -> int:
      m, n = len(grid), len(grid[0])
      ans = 0
      for i in range(m):
          for j in range(n):
              if grid[i][j] == 1:
                  ans += 4
                  if i < m - 1 and grid[i + 1][j] == 1:
                      ans -= 2
                  if j < n - 1 and grid[i][j + 1] == 1:
                      ans -= 2
      return ans
masked: def sample_funcname ( var_0 : List [ List [ int ] ] ) -> int :
      var_1 , var_2 = len ( var_0 ) , len ( var_0 [ 0 ] )
      var_3 = 0
      for var_4 in range ( var_1 ) :
          for var_5 in range ( var_2 ) :
              if var_0 [ var_4 ] [ var_5 ] == 1 :
                  var_3 += 4
                  if var_4 < var_1 - 1 and var_0 [ var_4 + 1 ] [ var_5 ] == 1 :
                      var_3 -= 2
                  if var_5 < var_2 - 1 and var_0 [ var_4 ] [ var_5 + 1 ] == 1 :
                      var_3 -= 2
      return var_3
  