Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())
obs = [[False for _ in range(W)] for _ in range(H)]
for y in range(H):
    s = input()
    for x in range(W):
        obs[y][x] = (s[x] == '#')

inc_x = [[0 for _ in range(W)] for _ in range(H)]
cnt_x = [[0 for _ in range(W)] for _ in range(H)]
for y in range(H):
    for x in range(W):
        if obs[y][x]: 
            inc_x[y][x]= 0
        elif x == 0 or obs[y][x-1]:
            inc_x[y][x] = 1
        else:
            inc_x[y][x] = inc_x[y][x-1] + 1
    for x in reversed(range(W)):
        if obs[y][x]:
            cnt_x[y][x]= 0
        elif x == W-1 or obs[y][x+1]:
            cnt_x[y][x] = inc_x[y][x]
        else:
            cnt_x[y][x] += cnt_x[y][x+1]

inc_y = [[0 for _ in range(W)] for _ in range(H)]
cnt_y = [[0 for _ in range(W)] for _ in range(H)]
for x in range(W):
    for y in range(H):
        if obs[y][x]: 
            inc_y[y][x]= 0
        elif y == 0 or obs[y-1][x]:
            inc_y[y][x] = 1
        else:
            inc_y[y][x] = inc_y[y-1][x] + 1
    for y in reversed(range(H)):
        if obs[y][x]:
            cnt_y[y][x]= 0
        elif y == H-1 or obs[y+1][x]:
            cnt_y[y][x] = inc_y[y][x]
        else:
            cnt_y[y][x] += cnt_y[y+1][x]


cnt = [[cnt_x[y][x]+cnt_y[y][x]-1 for x in range(W)] for y in range(H)]
ans = max([max(cnt[y]) for y in range(H)])
print(ans)


Fixed submission:
H, W = map(int, input().split())
obs = [[False for _ in range(W)] for _ in range(H)]
for y in range(H):
    s = input()
    for x in range(W):
        obs[y][x] = (s[x] == '#')

inc_x = [[0 for _ in range(W)] for _ in range(H)]
cnt_x = [[0 for _ in range(W)] for _ in range(H)]
for y in range(H):
    for x in range(W):
        if obs[y][x]: 
            inc_x[y][x]= 0
        elif x == 0 or obs[y][x-1]:
            inc_x[y][x] = 1
        else:
            inc_x[y][x] = inc_x[y][x-1] + 1
    for x in reversed(range(W)):
        if obs[y][x]:
            cnt_x[y][x]= 0
        elif x == W-1 or obs[y][x+1]:
            cnt_x[y][x] = inc_x[y][x]
        else:
            cnt_x[y][x] += cnt_x[y][x+1]

inc_y = [[0 for _ in range(W)] for _ in range(H)]
cnt_y = [[0 for _ in range(W)] for _ in range(H)]
for x in range(W):
    for y in range(H):
        if obs[y][x]: 
            inc_y[y][x]= 0
        elif y == 0 or obs[y-1][x]:
            inc_y[y][x] = 1
        else:
            inc_y[y][x] = inc_y[y-1][x] + 1
    for y in reversed(range(H)):
        if obs[y][x]:
            cnt_y[y][x]= 0
        elif y == H-1 or obs[y+1][x]:
            cnt_y[y][x] = inc_y[y][x]
        else:
            cnt_y[y][x] += cnt_y[y+1][x]


cnt = [[cnt_x[y][x]+cnt_y[y][x]-1 for x in range(W)] for y in range(H)]
ans = max([max(cnt[y]) for y in range(H)])
print(ans)

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

H, W = map(int, input().split())
obs = [[False for _ in range(W)] for _ in range(H)]
for y in range(H):
    s = input()
    for x in range(W):
        obs[y][x] = (s[x] == '#')

inc_x = [[0 for _ in range(W)] for _ in range(H)]
cnt_x = [[0 for _ in range(W)] for _ in range(H)]
for y in range(H):
    for x in range(W):
        if obs[y][x]: 
            inc_x[y][x]= 0
        elif x == 0 or obs[y][x-1]:
            inc_x[y][x] = 1
        else:
            inc_x[y][x] = inc_x[y][x-1] + 1
    for x in reversed(range(W)):
        if obs[y][x]:
            cnt_x[y][x]= 0
        elif x == W-1 or obs[y][x+1]:
            cnt_x[y][x] = inc_x[y][x]
        else:
            cnt_x[y][x] += cnt_x[y][x+1]

inc_y = [[0 for _ in range(W)] for _ in range(H)]
cnt_y = [[0 for _ in range(W)] for _ in range(H)]
for x in range(W):
    for y in range(H):
        if obs[y][x]: 
            inc_y[y][x]= 0
        elif y == 0 or obs[y-1][x]:
            inc_y[y][x] = 1
        else:
            inc_y[y][x] = inc_y[y-1][x] + 1
    for y in reversed(range(H)):
        if obs[y][x]:
            cnt_y[y][x]= 0
        elif y == H-1 or obs[y+1][x]:
            cnt_y[y][x] = inc_y[y][x]
        else:
            cnt_y[y][x] += cnt_y[y+1][x]


cnt = np.amax(np.array([[cnt_x[y][x]+cnt_y[y][x] for x in range(W)] for y in range(H)])) - 1
print(cnt)


Fixed submission:
H, W = map(int, input().split())
obs = [[False for _ in range(W)] for _ in range(H)]
for y in range(H):
    s = input()
    for x in range(W):
        obs[y][x] = (s[x] == '#')

inc_x = [[0 for _ in range(W)] for _ in range(H)]
cnt_x = [[0 for _ in range(W)] for _ in range(H)]
for y in range(H):
    for x in range(W):
        if obs[y][x]: 
            inc_x[y][x]= 0
        elif x == 0 or obs[y][x-1]:
            inc_x[y][x] = 1
        else:
            inc_x[y][x] = inc_x[y][x-1] + 1
    for x in reversed(range(W)):
        if obs[y][x]:
            cnt_x[y][x]= 0
        elif x == W-1 or obs[y][x+1]:
            cnt_x[y][x] = inc_x[y][x]
        else:
            cnt_x[y][x] += cnt_x[y][x+1]

inc_y = [[0 for _ in range(W)] for _ in range(H)]
cnt_y = [[0 for _ in range(W)] for _ in range(H)]
for x in range(W):
    for y in range(H):
        if obs[y][x]: 
            inc_y[y][x]= 0
        elif y == 0 or obs[y-1][x]:
            inc_y[y][x] = 1
        else:
            inc_y[y][x] = inc_y[y-1][x] + 1
    for y in reversed(range(H)):
        if obs[y][x]:
            cnt_y[y][x]= 0
        elif y == H-1 or obs[y+1][x]:
            cnt_y[y][x] = inc_y[y][x]
        else:
            cnt_y[y][x] += cnt_y[y+1][x]


cnt = [[cnt_x[y][x]+cnt_y[y][x]-1 for x in range(W)] for y in range(H)]
ans = max([max(cnt[y]) for y in range(H)])
print(ans)