comefrom: <doocs>0892.Surface Area of 3D Shapes_1.py
code: def surfaceArea( grid: List[List[int]]) -> int:
      ans = 0
      for i, row in enumerate(grid):
          for j, v in enumerate(row):
              if v:
                  ans += 2 + v * 4
                  if i:
                      ans -= min(v, grid[i - 1][j]) * 2
                  if j:
                      ans -= min(v, grid[i][j - 1]) * 2
      return ans
masked: def sample_funcname ( var_0 : List [ List [ int ] ] ) -> int :
      var_4 = 0
      for var_6 , var_7 in enumerate ( var_0 ) :
          for var_8 , var_9 in enumerate ( var_7 ) :
              if var_9 :
                  var_4 += 2 + var_9 * 4
                  if var_6 :
                      var_4 -= min ( var_9 , var_0 [ var_6 - 1 ] [ var_8 ] ) * 2
                  if var_8 :
                      var_4 -= min ( var_9 , var_0 [ var_6 ] [ var_8 - 1 ] ) * 2
      return var_4
  