Buggy python submission (verdict: Runtime Error):
import numpy as np

H, W = map(int, input().split())
S = np.array([list(input() for _ in range(H))]) == '.'

D = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)
L = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)

for h in range(H):
    U[h] = (U[h - 1] + 1) * S[h]
    D[-h - 1] = (D[-h] + 1) * S[-h - 1]
for w in range(W):
    L[:, w] = (L[:, w - 1] + 1) * S[:, w]
    R[:, -w - 1] = (R[:, -w] + 1) * S[: -w - 1]#print(L)
print(np.max(U + D + L + R) - 3)

Fixed submission:
import numpy as np

H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)]) == '.'

D = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)
L = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)

for h in range(H):
    U[h] = (U[h - 1] + 1) * S[h]
    D[-h - 1] = (D[-h] + 1) * S[-h - 1]
for w in range(W):
    L[:, w] = (L[:, w - 1] + 1) * S[:, w]
    R[:, -w - 1] = (R[:, -w] + 1) * S[:, -w - 1]
print(np.max(U + D + L + R) - 3)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
H, W = map(int, input().split())

grid = [[] for h in range(H)]

for h in range(H):
    grid[h] = list(input())

L = np.array([[0] * W for h in range(H)])
U = np.array([[0] * W for h in range(H)])
R = np.array([[0] * W for h in range(H)])
D = np.array([[0] * W for h in range(H)])

for h in range(H):
    for w in range(W):

        if grid[h][w] != '#':
            if w == 0:
                L[h][w] = 1
            else:
                L[h][w] = L[h][w - 1] + 1
            if h == 0:
                U[h][w] = 1
            else:
                U[h][w] = U[h - 1][w] + 1

        if grid[H - h - 1][W - w - 1] != '#':
            if w == 0:
                R[H - h - 1][W - w - 1] = 1
            else:
                R[H - h - 1][W - w - 1] = R[H - h - 1][W - w] + 1
            if h == 0:
                D[H - h - 1][W - w - 1] = 1
            else:
                D[H - h - 1][W - w - 1] = D[H - h][W - w - 1] + 1

print(max((L + R + U + D - 3).ravel()))

Fixed submission:
import numpy as np

H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)]) == '.'

D = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)
L = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)

for h in range(H):
    U[h] = (U[h - 1] + 1) * S[h]
    D[-h - 1] = (D[-h] + 1) * S[-h - 1]
for w in range(W):
    L[:, w] = (L[:, w - 1] + 1) * S[:, w]
    R[:, -w - 1] = (R[:, -w] + 1) * S[:, -w - 1]
print(np.max(U + D + L + R) - 3)

Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())

grid = [[] for h in range(H)]

for h in range(H):
    grid[h] = list(input())

L = [[0] * W for h in range(H)]
U = [[0] * W for h in range(H)]
R = [[0] * W for h in range(H)]
D = [[0] * W for h in range(H)]

for h in range(H):
    for w in range(W):
        if grid[h][w] == '#':
            L[h][w] = 0
            U[h][w] = 0
        else:
            if w == 0:
                L[h][w] = 1
            else:
                L[h][w] = L[h][w - 1] + 1
            if h == 0:
                U[h][w] = 1
            else:
                U[h][w] = U[h - 1][w] + 1

        if grid[H - h - 1][W - w - 1] == '#':
            R[H - h - 1][W - w - 1] = 0
            D[H - h - 1][W - w - 1] = 0
        else:
            if w == 0:
                R[H - h - 1][W - w - 1] = 1
            else:
                R[H - h - 1][W - w - 1] = R[H - h - 1][W - w] + 1
            if h == 0:
                D[H - h - 1][W - w - 1] = 1
            else:
                D[H - h - 1][W - w - 1] = D[H - h][W - w - 1] + 1
            


import numpy as np
print(max((np.array(L) + np.array(R) + np.array(U) + np.array(D) - 3).ravel()))

Fixed submission:
import numpy as np

H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)]) == '.'

D = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)
L = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)

for h in range(H):
    U[h] = (U[h - 1] + 1) * S[h]
    D[-h - 1] = (D[-h] + 1) * S[-h - 1]
for w in range(W):
    L[:, w] = (L[:, w - 1] + 1) * S[:, w]
    R[:, -w - 1] = (R[:, -w] + 1) * S[:, -w - 1]
print(np.max(U + D + L + R) - 3)

Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())

grid = [[] for h in range(H)]

for h in range(H):
    grid[h] = list(input())

L = [[0] * W for h in range(H)]
U = [[0] * W for h in range(H)]
R = [[0] * W for h in range(H)]
D = [[0] * W for h in range(H)]

for h in range(H):
    for w in range(W):
        if grid[h][w] == '#':
            L[h][w] = 0
            U[h][w] = 0
        else:
            if w == 0:
                L[h][w] = 1
            else:
                L[h][w] = L[h][w - 1] + 1

            if h == 0:
                U[h][w] = 1
            else:
                U[h][w] = U[h - 1][w] + 1

    for w in range(W - 1, -1, -1):
        if grid[h][w] == '#':
            R[h][w] = 0
        else:
            if w == W - 1:
                R[h][w] = 1
            else:
                R[h][w] = R[h][w + 1] + 1

for h in range(H - 1, -1, -1):
    for w in range(W):
        if grid[h][w] == '#':
            D[h][w] = 0
        else:
            if h == H - 1:
                D[h][w] = 1
            else:
                D[h][w] = D[h + 1][w] + 1

import numpy as np
print(max((np.array(L) + np.array(R) + np.array(U) + np.array(D) - 3).ravel()))

Fixed submission:
import numpy as np

H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)]) == '.'

D = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)
L = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)

for h in range(H):
    U[h] = (U[h - 1] + 1) * S[h]
    D[-h - 1] = (D[-h] + 1) * S[-h - 1]
for w in range(W):
    L[:, w] = (L[:, w - 1] + 1) * S[:, w]
    R[:, -w - 1] = (R[:, -w] + 1) * S[:, -w - 1]
print(np.max(U + D + L + R) - 3)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
H, W = map(int, input().split())

grid = [[] for h in range(H)]
for h in range(H):
    grid[h] = [-1 if _ == '#' else 0 for _ in input()]
    grid[h] = [-1] + grid[h] + [-1]
    #print(grid[h])
    count = 0
    for w in range(W + 1):
        if grid[h][w] == -1 and grid[h][w + 1] == 0:
            count = 1
            tmp = w + 1
        elif grid[h][w] == 0 and grid[h][w + 1] == 0:
            count += 1
        elif grid[h][w] == 0 and grid[h][w + 1] == -1:
            grid[h][tmp: w + 1] = [count] * (w + 1 - tmp)
            count = 0
    #print(grid)
#print(grid)
pad_grid = [[-1] * (W + 2)] + grid + [[-1] * (W + 2)]
#pad_grid
#print(pad_grid)
t_grid = np.transpose(pad_grid)

for h in range(1, W + 1):
    for w in range(H + 1):
        if t_grid[h][w] == -1 and t_grid[h][w + 1] != 0:
            count = 1
            tmp = w + 1
        elif t_grid[h][w] != -1 and t_grid[h][w + 1] != -1:
            count += 1
        elif t_grid[h][w] != -1 and t_grid[h][w + 1] == -1:
            t_grid[h][tmp: w + 1] += count - 1
            count = 0
    #print(t_grid)
print(max(t_grid.ravel()))

Fixed submission:
import numpy as np

H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)]) == '.'

D = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)
L = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)

for h in range(H):
    U[h] = (U[h - 1] + 1) * S[h]
    D[-h - 1] = (D[-h] + 1) * S[-h - 1]
for w in range(W):
    L[:, w] = (L[:, w - 1] + 1) * S[:, w]
    R[:, -w - 1] = (R[:, -w] + 1) * S[:, -w - 1]
print(np.max(U + D + L + R) - 3)