Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


H, W = map(int, input().split())

grid = list()
for _ in range(H):
    grid.append(input())

up = np.zeros((H, W), dtype = int)
down = np.zeros((H, W), dtype = int)
left = np.zeros((H, W), dtype = int)
right = np.zeros((H, W), dtype = int)

for col in range(W):
    cnt = 0
    for row in range(H):
        if grid[row][col] == '.':
            cnt += 1
        else:
            cnt = 0
        up[row][col] = cnt
for col in range(W):
    cnt = 0
    for row in reversed(range(H)):
        if grid[row][col] == '.':
            cnt += 1
        else:
            cnt = 0
        down[row][col] = cnt
for row in range(H):
    cnt = 0
    for col in range(W):
        if grid[row][col] == '.':
            cnt += 1
        else:
            cnt = 0
        left[row][col] = cnt
for row in range(H):
    cnt = 0
    for col in reversed(range(W)):
        if grid[row][col] == '.':
            cnt += 1
        else:
            cnt = 0
        right[row][col] = cnt

print(np.max(up + down + left + right) - 3)

Fixed submission:
import numpy as np


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

up = np.zeros((H, W), dtype = int)
down = np.zeros((H, W), dtype = int)
left = np.zeros((H, W), dtype = int)
right = np.zeros((H, W), dtype = int)

for i in range(H):
    down[i] = (down[i - 1] + 1) * grid[i]
    up[-i - 1] = (up[-i] + 1) * grid[-i - 1]

for i in range(W):
    right[:, i] = (right[:, i - 1] + 1) * grid[:, i]
    left[:, -i - 1] = (left[:, -i] + 1) * grid[:, -i - 1]

print(np.max(up + down + left + right) - 3)

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

grid = list()
for _ in range(H):
    grid.append(input())

up = [[0 for _ in range(W)] for _ in range(H)]
down = [[0 for _ in range(W)] for _ in range(H)]
left = [[0 for _ in range(W)] for _ in range(H)]
right = [[0 for _ in range(W)] for _ in range(H)]

for col in range(W):
    cnt = 0
    for row in range(H):
        if grid[row][col] == '.':
            cnt += 1
        else:
            cnt = 0
        up[row][col] = cnt
for col in range(W):
    cnt = 0
    for row in reversed(range(H)):
        if grid[row][col] == '.':
            cnt += 1
        else:
            cnt = 0
        down[row][col] = cnt
for row in range(H):
    cnt = 0
    for col in range(W):
        if grid[row][col] == '.':
            cnt += 1
        else:
            cnt = 0
        left[row][col] = cnt
for row in range(H):
    cnt = 0
    for col in reversed(range(W)):
        if grid[row][col] == '.':
            cnt += 1
        else:
            cnt = 0
        right[row][col] = cnt

ans = 0
for i in range(H):
    for j in range(W):
        if grid[i][j] == '#':
            continue
        lighted = up[i][j] + down[i][j] + left[i][j] + right[i][j] - 3
        ans = max(ans, lighted)
print(ans)

Fixed submission:
import numpy as np


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

up = np.zeros((H, W), dtype = int)
down = np.zeros((H, W), dtype = int)
left = np.zeros((H, W), dtype = int)
right = np.zeros((H, W), dtype = int)

for i in range(H):
    down[i] = (down[i - 1] + 1) * grid[i]
    up[-i - 1] = (up[-i] + 1) * grid[-i - 1]

for i in range(W):
    right[:, i] = (right[:, i - 1] + 1) * grid[:, i]
    left[:, -i - 1] = (left[:, -i] + 1) * grid[:, -i - 1]

print(np.max(up + down + left + right) - 3)