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

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

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

for i in range(W):
    if i == 0:
        L[:, 0] = S[:, 0]
        R[:, W - 1] = S[:, W - 1]
    else:
        L[:, i] = L[:, i - 1] * S[:, i] + S[:, i]
        R[:, W - i - 1] = R[:, W - i] * S[:, W - i - 1] + S[:, W - i - 1]
for i in range(H):
    if i == 0:
        U[i] = S[i]
        D[H - 1] = S[H - 1]
    else:
        U[i] = U[i - 1] * S[i] + S[i]
        D[H - i - 1] = D[H - i] * S[H - i - 1] + S[H - i - 1]

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

Fixed submission:
import numpy as np

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

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

for i in range(W):
    if i == 0:
        L[:, 0] = S[:, 0]
        R[:, W - 1] = S[:, W - 1]
    else:
        L[:, i] = L[:, i - 1] * S[:, i] + S[:, i]
        R[:, W - i - 1] = R[:, W - i] * S[:, W - i - 1] + S[:, W - i - 1]
for i in range(H):
    if i == 0:
        U[i] = S[i]
        D[H - 1] = S[H - 1]
    else:
        U[i] = U[i - 1] * S[i] + S[i]
        D[H - i - 1] = D[H - i] * S[H - i - 1] + S[H - i - 1]

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

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
H, W = map(int,input().split())
S = []
for i in range(H):
    s = str(input())
    S.append(np.array([s[i] for i in range(W)]))
S = np.array(S)
LR = np.array([np.array([-1 for i in range(W)]) for j in range(H)])
UD = np.array([np.array([-1 for i in range(W)]) for j in range(H)])
count = 0
for h in range(H):
    for w in range(W):
        if S[h][w] == '#':
            LR[h][w] = 0
            LR[h][w-count:w] = np.array([count for i in range(count)])
            count = 0
        else:
            count += 1
    if count != 0:
        LR[h][-count:] = np.array([count for i in range(count)])
        count = 0
UD = UD.T
S = S.T
for w in range(W):
    for h in range(H):
        if S[w][h] == '#':
            UD[w][h] = 0
            UD[w][h-count:h] = np.array([count for i in range(count)])
            count = 0
        else:
            count += 1
    if count != 0:
        UD[w][-count:] = np.array([count for i in range(count)])
        count = 0
UD = UD.T
S = S.T
al = UD + LR
print(np.max(al)-1)

Fixed submission:
import numpy as np

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

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

for i in range(W):
    if i == 0:
        L[:, 0] = S[:, 0]
        R[:, W - 1] = S[:, W - 1]
    else:
        L[:, i] = L[:, i - 1] * S[:, i] + S[:, i]
        R[:, W - i - 1] = R[:, W - i] * S[:, W - i - 1] + S[:, W - i - 1]
for i in range(H):
    if i == 0:
        U[i] = S[i]
        D[H - 1] = S[H - 1]
    else:
        U[i] = U[i - 1] * S[i] + S[i]
        D[H - i - 1] = D[H - i] * S[H - i - 1] + S[H - i - 1]

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