<doocs>0361.Bomb Enemy_1.py
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,
    )
def sample_funcname ( var_0 : List [ List [ str ] ] ) -> int :
    var_5 , var_7 = len ( var_0 ) , len ( var_0 [ 0 ] )
    var_10 = [ [ 0 ] * var_7 for var_8 in range ( var_5 ) ]
    for var_11 in range ( var_5 ) :
        var_12 = 0
        for var_13 in range ( var_7 ) :
            if var_0 [ var_11 ] [ var_13 ] == 'W' :
                var_12 = 0
            elif var_0 [ var_11 ] [ var_13 ] == 'E' :
                var_12 += 1
            var_10 [ var_11 ] [ var_13 ] += var_12
        var_12 = 0
        for var_13 in range ( var_7 - 1 , - 1 , - 1 ) :
            if var_0 [ var_11 ] [ var_13 ] == 'W' :
                var_12 = 0
            elif var_0 [ var_11 ] [ var_13 ] == 'E' :
                var_12 += 1
            var_10 [ var_11 ] [ var_13 ] += var_12
    for var_13 in range ( var_7 ) :
        var_12 = 0
        for var_11 in range ( var_5 ) :
            if var_0 [ var_11 ] [ var_13 ] == 'W' :
                var_12 = 0
            elif var_0 [ var_11 ] [ var_13 ] == 'E' :
                var_12 += 1
            var_10 [ var_11 ] [ var_13 ] += var_12
        var_12 = 0
        for var_11 in range ( var_5 - 1 , - 1 , - 1 ) :
            if var_0 [ var_11 ] [ var_13 ] == 'W' :
                var_12 = 0
            elif var_0 [ var_11 ] [ var_13 ] == 'E' :
                var_12 += 1
            var_10 [ var_11 ] [ var_13 ] += var_12
    return max ( [ var_10 [ var_11 ] [ var_13 ] for var_11 in range ( var_5 ) for var_13 in range ( var_7 ) if var_0 [ var_11 ] [ var_13 ] == '0' ] , var_19 = 0 , )
