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

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

left = np.array([[0] * W for i in range(H)])
for i in range(H):
    c = -1
    for j in range(W):
        if S[i][j] == '#':
            c = -1
        else:
            c += 1
        left[i][j] = c

right = np.array([[0] * W for i in range(H)])
for i in range(H):
    c = -1
    for j in range(W-1, -1, -1):
        if S[i][j] == '#':
            c = -1
        else:
            c += 1
        right[i][j] = c

up = np.array([[0] * W for i in range(H)])
for j in range(W):
    c = -1
    for i in range(H):
        if S[i][j] == '#':
            c = -1
        else:
            c += 1
        up[i][j] = c

down = np.array([[0] * W for i in range(H)])
for j in range(W):
    c = -1
    for i in range(H-1, -1, -1):
        if S[i][j] == '#':
            c = -1
        else:
            c += 1
        down[i][j] = c

n_all = right+left+up+down
print(np.max(n_all)+1)


Fixed submission:
import numpy as np

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

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

for i in range(H):
    U[i] = (U[i-1]+1)*S[i]
    D[-i - 1] = (D[-i] + 1) * S[-i - 1]

for i in range(W):
    L[:, i] = (L[:, i - 1] + 1) * S[:, i]
    R[:, -i - 1] = (R[:, -i] + 1) * S[:, -i - 1]

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

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

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

left = [[0] * W for i in range(H)]
for i in range(H):
    c = -1
    for j in range(W):
        if S[i][j] == '#':
            c = -1
        else:
            c += 1
        left[i][j] = c

right = [[0] * W for i in range(H)]
for i in range(H):
    c = -1
    for j in range(W-1, -1, -1):
        if S[i][j] == '#':
            c = -1
        else:
            c += 1
        right[i][j] = c

up = [[0] * W for i in range(H)]
for j in range(W):
    c = -1
    for i in range(H):
        if S[i][j] == '#':
            c = -1
        else:
            c += 1
        up[i][j] = c

down = [[0] * W for i in range(H)]
for j in range(W):
    c = -1
    for i in range(H-1, -1, -1):
        if S[i][j] == '#':
            c = -1
        else:
            c += 1
        down[i][j] = c

n_right = np.array(right)
n_left = np.array(left)
n_up = np.array(up)
n_down = np.array(down)

n_all = n_right+n_left+n_up+n_down
print(np.max(n_all)+1)


Fixed submission:
import numpy as np

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

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

for i in range(H):
    U[i] = (U[i-1]+1)*S[i]
    D[-i - 1] = (D[-i] + 1) * S[-i - 1]

for i in range(W):
    L[:, i] = (L[:, i - 1] + 1) * S[:, i]
    R[:, -i - 1] = (R[:, -i] + 1) * S[:, -i - 1]

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

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)
import numpy as np

H,W=map(int,input().split())
S=[list(input()) for _ in range(H)]

m_horizontal=[[0 for i in range(W)] for j in range(H)]
m_vertical=[[0 for i in range(W)] for j in range(H)]


for y in range(H):
    for x in range(W):
        if S[y][x]=='#':
            m_horizontal[y][x]=0
        elif x==0 or m_horizontal[y][x-1]==0:
            cnt=0
            i=x
            while S[y][i]=='.':
                cnt+=1
                i+=1
                if i==W:
                    break
            m_horizontal[y][x]=cnt
        else:
            m_horizontal[y][x]=m_horizontal[y][x-1]


        if S[y][x]=='#':
            m_vertical[y][x]=0
        elif y==0 or m_vertical[y-1][x]==0:
            cnt=0
            i=y
            while S[i][x]=='.':
                cnt+=1
                i+=1
                if i==H:
                    break
            m_vertical[y][x]=cnt
        else:
            m_vertical[y][x]=m_vertical[y-1][x]

ho=np.array(m_horizontal)
ve=np.array(m_vertical)
hv=ho+ve
print(np.amax(hv)-1)

Fixed submission:
import numpy as np

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

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

for i in range(H):
    U[i] = (U[i-1]+1)*S[i]
    D[-i - 1] = (D[-i] + 1) * S[-i - 1]

for i in range(W):
    L[:, i] = (L[:, i - 1] + 1) * S[:, i]
    R[:, -i - 1] = (R[:, -i] + 1) * S[:, -i - 1]

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

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(1000000)
import numpy as np

H,W=map(int,input().split())
S=[list(input()) for _ in range(H)]

m_horizontal=[[0 for i in range(W)] for j in range(H)]
m_vertical=[[0 for i in range(W)] for j in range(H)]


for y in range(H):
    for x in range(W):
        if S[y][x]=='#':
            m_horizontal[y][x]=0
        elif x==0 or m_horizontal[y][x-1]==0:
            cnt=0
            i=x
            while S[y][i]=='.':
                cnt+=1
                i+=1
                if i==W:
                    break
            m_horizontal[y][x]=cnt
        else:
            m_horizontal[y][x]=m_horizontal[y][x-1]


        if S[y][x]=='#':
            m_vertical[y][x]=0
        elif y==0 or m_vertical[y-1][x]==0:
            cnt=0
            i=y
            while S[i][x]=='.':
                cnt+=1
                i+=1
                if i==H:
                    break
            m_vertical[y][x]=cnt
        else:
            m_vertical[y][x]=m_vertical[y-1][x]

ho=np.array(m_horizontal)
ve=np.array(m_vertical)
hv=ho+ve
print(np.amax(hv)-1)

Fixed submission:
import numpy as np

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

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

for i in range(H):
    U[i] = (U[i-1]+1)*S[i]
    D[-i - 1] = (D[-i] + 1) * S[-i - 1]

for i in range(W):
    L[:, i] = (L[:, i - 1] + 1) * S[:, i]
    R[:, -i - 1] = (R[:, -i] + 1) * S[:, -i - 1]

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