Buggy python submission (verdict: Runtime Error):

h, w = map(int, input().split())
s = list(input() for _ in range(h))

yoko = [[0]*w for _ in range(h)]
tate = [[0]*w for _ in range(h)]


def yoko_check(y, x, cnt):
    global yoko, s
    if x == w-1:
        yoko[y][x] = cnt
        return cnt
    else:
        if s[y][x+1] == "#":
            yoko[y][x] = cnt
            return cnt
        else:
            yoko[y][x] = yoko_check(y, x+1, cnt+1)
            return yoko[y][x]


def tate_check(y, x, cnt):
    global tate, s
    if y == h-1:
        tate[y][x] = cnt
        return cnt
    else:
        if s[y+1][x] == "#":
            tate[y][x] = cnt
            return cnt
        else:
            tate[y][x] = tate_check(y+1, x, cnt+1)
            return tate[y][x]


for y in range(h):
    for x in range(w):
        if yoko[y][x] == 0 and s[y][x] == ".":
            yoko_check(y, x, 1)
        if tate[y][x] == 0 and s[y][x] == ".":
            tate_check(y, x, 1)

# print(tate)

result = 0
for y in range(h):
    for x in range(w):
        if s[y][x] == ".":
            result = max(result, tate[y][x]+yoko[y][x]-1)

print(result)


Fixed submission:
import sys
sys.setrecursionlimit(2147483647)
 
h,w=map(int,input().split())
s=list(input() for _ in range(h))
 
yoko=[[0]*w for _ in range(h)]
tate=[[0]*w for _ in range(h)]
 
def yoko_check(y,x,cnt):
    global yoko,s
    if x==w-1:
        yoko[y][x]=cnt
        return cnt
    else:
        if s[y][x+1]=="#":
            yoko[y][x]=cnt
            return cnt
        else:
            yoko[y][x]=yoko_check(y,x+1,cnt+1)
            return yoko[y][x]
 
 
def tate_check(y,x,cnt):
    global tate,s
    if y==h-1:
        tate[y][x]=cnt
        return cnt
    else:
        if s[y+1][x]=="#":
            tate[y][x]=cnt
            return cnt
        else:
            tate[y][x]=tate_check(y+1,x,cnt+1)
            return tate[y][x]
 
 
for y in range(h):
    for x in range(w):
        if yoko[y][x]==0 and s[y][x]==".":
            yoko_check(y,x,1)
        if tate[y][x]==0 and s[y][x]==".":
            tate_check(y,x,1)
 
#print(tate)
 
result=0
for y in range(h):
    for x in range(w):
        if s[y][x]==".":
            result=max(result,tate[y][x]+yoko[y][x]-1)  
 
print(result)

Buggy python submission (verdict: Runtime Error):
import numpy as np

H, W = map(int, input().split())
A = []
for _ in range(H):
    S = [0 if c == '#' else 1 for c in input().strip()]
    A.append(S)
A = np.array(A)
top = np.zeros((H+1, W), dtype=np.int)
bottom = np.zeros((H+1, W), dtype=np.int)
right = np.zeros((H, W+1), dtype=np.int)
left = np.zeros((H, W+1), dtype=np.int)
for i in range(1, H+1):
    top[i] = (top[i-1] + 1) * A[i-1]
for i in range(H-1, -1, -1):
    bottom[i] = (bottom[i+1] + 1) * A[i]
for i in range(1, W+1):
    right[:, i] = (right[:, i-1] + 1) * A[:, i-1]
for i in range(W-1, -1, -1):
    left[:, i] = (left[:, i+1] + 1) * A[:, i]
R = (top[1:] + bottom[:H] - 1) * A
C = (right[:, 1:] + left[:, :W] - 1) * A
RC = (R + C - 1) * A

print(RC.max)


Fixed submission:
import sys
sys.setrecursionlimit(2147483647)
 
h,w=map(int,input().split())
s=list(input() for _ in range(h))
 
yoko=[[0]*w for _ in range(h)]
tate=[[0]*w for _ in range(h)]
 
def yoko_check(y,x,cnt):
    global yoko,s
    if x==w-1:
        yoko[y][x]=cnt
        return cnt
    else:
        if s[y][x+1]=="#":
            yoko[y][x]=cnt
            return cnt
        else:
            yoko[y][x]=yoko_check(y,x+1,cnt+1)
            return yoko[y][x]
 
 
def tate_check(y,x,cnt):
    global tate,s
    if y==h-1:
        tate[y][x]=cnt
        return cnt
    else:
        if s[y+1][x]=="#":
            tate[y][x]=cnt
            return cnt
        else:
            tate[y][x]=tate_check(y+1,x,cnt+1)
            return tate[y][x]
 
 
for y in range(h):
    for x in range(w):
        if yoko[y][x]==0 and s[y][x]==".":
            yoko_check(y,x,1)
        if tate[y][x]==0 and s[y][x]==".":
            tate_check(y,x,1)
 
#print(tate)
 
result=0
for y in range(h):
    for x in range(w):
        if s[y][x]==".":
            result=max(result,tate[y][x]+yoko[y][x]-1)  
 
print(result)