Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int, input().split())
s = [input() for j in range(H)]

L = [[None for _ in range(W)] for _ in range(H)]
R = [[None for _ in range(W)] for _ in range(H)]
U = [[None for _ in range(W)] for _ in range(H)]
D = [[None for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
        if s[i][j] == "#":
            L[i][j] = 0
        elif j == 0:
            L[i][j] = 1
        else:
            L[i][j] = L[i][j-1] + 1

for i in range(H):
    for j in reversed(range(W)):
        if s[i][j] == "#":
            R[i][j] = 0
        elif j == W-1:
            R[i][j] = 1
        else:
            R[i][j] = R[i][j+1] + 1

for i in range(H):
    for j in range(W):
        if s[i][j] == "#":
            U[i][j] = 0
        elif i == 0:
            U[i][j] = 1
        else:
            U[i][j] = U[i-1][j] + 1

for i in reversed(range(H)):
    for j in range(W):
        if s[i][j] == "#":
            D[i][j] = 0
        elif i == H-1:
            D[i][j] = 1
        else:
            D[i][j] = D[i+1][j] + 1

ans = 0
for i in range(H):
    for j in range(W):
        tmp = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
        if tmp > ans:
            ans = tmp

print(ans)


Fixed submission:
import numpy as np

H,W = map(int, input().split())
s = [list(input()) for j in range(H)]
s = (np.array(s) == ".") * 1

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


for j in range(W):
    if j == 0:
        L[:,j] = s[:,j]
    else:
        L[:,j] = (L[:,j-1] + 1) * s[:,j]
        

for j in reversed(range(W)):
    if j == W-1:
        R[:,j] = s[:,j]
    else:
        R[:,j] = (R[:,j+1] + 1) * s[:,j]


for i in range(H):
    if i == 0:
        U[i,:] = s[i,:]
    else:
        U[i,:] = (U[i-1,:] + 1) * s[i,:]

for i in reversed(range(H)):
    if i == H-1:
        D[i,:] = s[i,:]
    else:
        D[i,:] = (D[i+1,:] + 1) * s[i,:]

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

Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int, input().split())
s = [input() for j in range(H)]

def counter(x, y):
    count = 1
    h1 = x - 1
    while h1 >= 0 and s[h1][y] == ".":
        count += 1
        h1 -= 1
    
    h2 = x + 1
    while h2 < H and s[h2][y] == ".":
        count += 1
        h2 += 1
    
    w1 = y -1
    while w1 >= 0 and s[x][w1] == ".":
        count += 1
        w1 -= 1
    
    w2 = y + 1
    while w2 < W and s[x][w2] == ".":
        count += 1
        w2 += 1
    
    return count

c = []
for i in range(H):
    for j in range(W):
        if s[i][j] == ".":
            c.append(counter(i, j))

print(max(c))


Fixed submission:
import numpy as np

H,W = map(int, input().split())
s = [list(input()) for j in range(H)]
s = (np.array(s) == ".") * 1

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


for j in range(W):
    if j == 0:
        L[:,j] = s[:,j]
    else:
        L[:,j] = (L[:,j-1] + 1) * s[:,j]
        

for j in reversed(range(W)):
    if j == W-1:
        R[:,j] = s[:,j]
    else:
        R[:,j] = (R[:,j+1] + 1) * s[:,j]


for i in range(H):
    if i == 0:
        U[i,:] = s[i,:]
    else:
        U[i,:] = (U[i-1,:] + 1) * s[i,:]

for i in reversed(range(H)):
    if i == H-1:
        D[i,:] = s[i,:]
    else:
        D[i,:] = (D[i+1,:] + 1) * s[i,:]

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