Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(5000)

H, W = map(int, input().split())
F = [input() for _ in range(H)]
FH = [[0]*W for _ in range(H)]
FV = [[0]*W for _ in range(H)]


def search(x, y, c, d):
    if not (0 <= x < H and 0 <= y < W):
        return c
    if F[x][y] == "#":
        return c
    else:
        if d == "h":
            return search(x, y+1, c+1, "h")
        else:
            return search(x+1, y, c+1, "v")

ans = 0
for i in range(H):
    for j in range(W):
        if F[i][j] == "#":
            FH[i][j] = 0
        elif F[i][j] == ".":
            if FH[i][j-1] > 0:
                FH[i][j] = FH[i][j-1]
            else:
                FH[i][j] = search(i, j+1, 1, "h")

ans = 0
for i in range(H):
    for j in range(W):
        if F[i][j] == "#":
            FV[i][j] = 0
        elif F[i][j] == ".":
            if FV[i-1][j] > 0:
                FV[i][j] = FV[i-1][j]
            else:
                FV[i][j] = search(i+1, j, 1, "v")

        if FH[i][j] + FV[i][j] > ans:
            ans = FH[i][j] + FV[i][j]

if ans >= 2:
    print(ans-1)
else:
    print(ans)


Fixed submission:
import numpy as np

H, W = map(int, input().split())
F = np.array([[1 if i == "." else 0 for i in input()] for _ in range(H)])
FU = np.zeros((H, W), dtype=int)
FD = np.zeros((H+1, W), dtype=int)
FL = np.zeros((H, W), dtype=int)
FR = np.zeros((H, W+1), dtype=int)

for i in range(H):
    FU[i] += (FU[i-1]+1)*F[i]

for i in range(H-1, -1, -1):
    FD[i] += (FD[i+1]+1)*F[i]

for i in range(W):
    FL[:, i] += (FL[:, i-1]+1)*F[:, i]

for i in range(W-1, -1, -1):
    FR[:, i] += (FR[:, i+1]+1)*F[:, i]

FV = FU + FD[:-1] - 1
FH = FL + FR[:, :-1] - 1
ans = np.max(FV+FH)
if ans >= 2:
    print(ans-1)
else:
    print(ans)

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
F = [input() for _ in range(H)]
FH = [[0]*W for _ in range(H)]
FV = [[0]*W for _ in range(H)]


def search(x, y, c, d):
    if not (0 <= x < H and 0 <= y < W):
        return c
    if F[x][y] == "#":
        return c
    else:
        if d == "h":
            return search(x, y+1, c+1, "h")
        else:
            return search(x+1, y, c+1, "v")

ans = 0
for i in range(H):
    for j in range(W):
        if F[i][j] == "#":
            FH[i][j] = 0
        elif F[i][j] == ".":
            if FH[i][j-1] > 0:
                FH[i][j] = FH[i][j-1]
            else:
                FH[i][j] = search(i, j+1, 1, "h")

for i in range(H):
    for j in range(W):
        if F[i][j] == "#":
            FV[i][j] = 0
        elif F[i][j] == ".":
            if FV[i-1][j] > 0:
                FV[i][j] = FV[i-1][j]
            else:
                FV[i][j] = search(i+1, j, 1, "v")

ans = 0
for i in range(H):
    for j in range(W):
        if FH[i][j] + FV[i][j] > ans:
            ans = FH[i][j] + FV[i][j]

print(ans-1)


Fixed submission:
import numpy as np

H, W = map(int, input().split())
F = np.array([[1 if i == "." else 0 for i in input()] for _ in range(H)])
FU = np.zeros((H, W), dtype=int)
FD = np.zeros((H+1, W), dtype=int)
FL = np.zeros((H, W), dtype=int)
FR = np.zeros((H, W+1), dtype=int)

for i in range(H):
    FU[i] += (FU[i-1]+1)*F[i]

for i in range(H-1, -1, -1):
    FD[i] += (FD[i+1]+1)*F[i]

for i in range(W):
    FL[:, i] += (FL[:, i-1]+1)*F[:, i]

for i in range(W-1, -1, -1):
    FR[:, i] += (FR[:, i+1]+1)*F[:, i]

FV = FU + FD[:-1] - 1
FH = FL + FR[:, :-1] - 1
ans = np.max(FV+FH)
if ans >= 2:
    print(ans-1)
else:
    print(ans)

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


def search(x, y):
    if not (0 <= x < H and 0 <= y < W):
        return False
    if F[x][y] == "#":
        return False
    else:
        return True


ans = 0
for i in range(H):
    for j in range(W):
        if F[i][j] == ".":
            count = 1
            x, y = i, j
            while True:
                if search(x, y+1):
                    count += 1
                    y += 1
                else:
                    break
            x, y = i, j
            while True:
                if search(x+1, y):
                    count += 1
                    x += 1
                else:
                    break
            x, y = i, j
            while True:
                if search(x-1, y):
                    count += 1
                    x -= 1
                else:
                    break
            x, y = i, j
            while True:
                if search(x, y-1):
                    count += 1
                    y -= 1
                else:
                    break
            if count > ans:
                ans = count

print(ans)

Fixed submission:
import numpy as np

H, W = map(int, input().split())
F = np.array([[1 if i == "." else 0 for i in input()] for _ in range(H)])
FU = np.zeros((H, W), dtype=int)
FD = np.zeros((H+1, W), dtype=int)
FL = np.zeros((H, W), dtype=int)
FR = np.zeros((H, W+1), dtype=int)

for i in range(H):
    FU[i] += (FU[i-1]+1)*F[i]

for i in range(H-1, -1, -1):
    FD[i] += (FD[i+1]+1)*F[i]

for i in range(W):
    FL[:, i] += (FL[:, i-1]+1)*F[:, i]

for i in range(W-1, -1, -1):
    FR[:, i] += (FR[:, i+1]+1)*F[:, i]

FV = FU + FD[:-1] - 1
FH = FL + FR[:, :-1] - 1
ans = np.max(FV+FH)
if ans >= 2:
    print(ans-1)
else:
    print(ans)