comefrom: <doocs>0361.Bomb Enemy_1.py
code: def maxKilledEnemies( grid: List[List[str]]) -> int:
      m, n = len(grid), len(grid[0])
      g = [[0] * n for _ in range(m)]
      for i in range(m):
          t = 0
          for j in range(n):
              if grid[i][j] == 'W':
                  t = 0
              elif grid[i][j] == 'E':
                  t += 1
              g[i][j] += t
          t = 0
          for j in range(n - 1, -1, -1):
              if grid[i][j] == 'W':
                  t = 0
              elif grid[i][j] == 'E':
                  t += 1
              g[i][j] += t
      for j in range(n):
          t = 0
          for i in range(m):
              if grid[i][j] == 'W':
                  t = 0
              elif grid[i][j] == 'E':
                  t += 1
              g[i][j] += t
          t = 0
          for i in range(m - 1, -1, -1):
              if grid[i][j] == 'W':
                  t = 0
              elif grid[i][j] == 'E':
                  t += 1
              g[i][j] += t
      return max(
          [g[i][j] for i in range(m) for j in range(n) if grid[i][j] == '0'],
          default=0,
      )
masked: def sample_funcname ( var_0 : List [ List [ str ] ] ) -> int :
      var_1 , var_2 = len ( var_0 ) , len ( var_0 [ 0 ] )
      var_4 = [ [ 0 ] * var_2 for var_3 in range ( var_1 ) ]
      for var_5 in range ( var_1 ) :
          var_6 = 0
          for var_7 in range ( var_2 ) :
              if var_0 [ var_5 ] [ var_7 ] == 'W' :
                  var_6 = 0
              elif var_0 [ var_5 ] [ var_7 ] == 'E' :
                  var_6 += 1
              var_4 [ var_5 ] [ var_7 ] += var_6
          var_6 = 0
          for var_7 in range ( var_2 - 1 , - 1 , - 1 ) :
              if var_0 [ var_5 ] [ var_7 ] == 'W' :
                  var_6 = 0
              elif var_0 [ var_5 ] [ var_7 ] == 'E' :
                  var_6 += 1
              var_4 [ var_5 ] [ var_7 ] += var_6
      for var_7 in range ( var_2 ) :
          var_6 = 0
          for var_5 in range ( var_1 ) :
              if var_0 [ var_5 ] [ var_7 ] == 'W' :
                  var_6 = 0
              elif var_0 [ var_5 ] [ var_7 ] == 'E' :
                  var_6 += 1
              var_4 [ var_5 ] [ var_7 ] += var_6
          var_6 = 0
          for var_5 in range ( var_1 - 1 , - 1 , - 1 ) :
              if var_0 [ var_5 ] [ var_7 ] == 'W' :
                  var_6 = 0
              elif var_0 [ var_5 ] [ var_7 ] == 'E' :
                  var_6 += 1
              var_4 [ var_5 ] [ var_7 ] += var_6
      return max ( [ var_4 [ var_5 ] [ var_7 ] for var_5 in range ( var_1 ) for var_7 in range ( var_2 ) if var_0 [ var_5 ] [ var_7 ] == '0' ] , var_8 = 0 , )
  