Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
H,W=map(int,input().split())
S=[]
ans=0

for _ in range(H):
    S.append(list(input()))

l=[[0]*W for _ in range(H)]

for h in range(H):
    count=0
    start=0
    for i in range(W):
        if S[h][i]=="#":
            count=0
            start=i+1
        else:
            count+=1
            l[h][i]+=count

for h in range(H):
    count=0
    start=W-1
    for i in range(W)[::-1]:
        if S[h][i]=="#":
            count=0
            start=i
        else:
            count+=1
            l[h][i]+=count

for w in range(W):
    count=0
    start=0
    for i in range(H):
        if S[i][w]=="#":
            count=0
            start=i+1
        else:
            count+=1
            l[i][w]+=count

for w in range(W):
    count=0
    start=H-1
    for i in range(H)[::-1]:
        if S[i][w]=="#":
            count=0
            start=i
        else:
            count+=1
            l[i][w]+=count
            ans=max(ans,l[i][w])

print(ans-3)

Fixed submission:
# coding: utf-8
# Your code here!
H,W=map(int,input().split())
S=[]
ans=0

for _ in range(H):
    S.append(list(input()))

l=[[0]*W for _ in range(H)]

for h in range(H):
    count=0
    start=0
    for i in range(W):
        if S[h][i]=="#":
            count=0
            start=i+1
        else:
            count+=1
            l[h][i]+=count

for h in range(H):
    count=0
    start=W-1
    for i in range(W)[::-1]:
        if S[h][i]=="#":
            count=0
            start=i
        else:
            count+=1
            l[h][i]+=count

for w in range(W):
    count=0
    start=0
    for i in range(H):
        if S[i][w]=="#":
            count=0
            start=i+1
        else:
            count+=1
            l[i][w]+=count

for w in range(W):
    count=0
    start=H-1
    for i in range(H)[::-1]:
        if S[i][w]=="#":
            count=0
            start=i
        else:
            count+=1
            l[i][w]+=count
            ans=max(ans,l[i][w])

print(ans-3)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
def up(w,h,count):
    if h==-1:
        return count-1
    elif S[h][w]=="#":
        return count-1
    else:
        count=up(w,h-1,count+1)
    return count

def down(w,h,count):
    if h==H:
        return count-1
    elif S[h][w]=="#":
        return count-1
    else:
        count=down(w,h+1,count+1)
    return count
        
def right(w,h,count):
    if w==W:
        return count-1
    elif S[h][w]=="#":
        return count-1
    else:
        count=right(w+1,h,count+1)
    return count

def left(w,h,count):
    if w==-1:
        return count-1
    elif S[h][w]=="#":
        return count-1
    else:
        count=left(w-1,h,count+1)
    return count

H,W=map(int,input().split())
S=[]

for _ in range(H):
    S.append(list(input()))

ans=0
for h in range(H):
    for w in range(W):
        if S[h][w]=="#":
            continue
        ans=max((up(w,h,0)+down(w,h,0)+right(w,h,0)+left(w,h,0)),ans)
        
        """
        if ans==(up(w,h,0)+down(w,h,0)+right(w,h,0)+left(w,h,0)):
            print(h,w)
            print(up(w,h,0),down(w,h,0),right(w,h,0),left(w,h,0))
        """
print(ans+1)

Fixed submission:
# coding: utf-8
# Your code here!
H,W=map(int,input().split())
S=[]
ans=0

for _ in range(H):
    S.append(list(input()))

l=[[0]*W for _ in range(H)]

for h in range(H):
    count=0
    start=0
    for i in range(W):
        if S[h][i]=="#":
            count=0
            start=i+1
        else:
            count+=1
            l[h][i]+=count

for h in range(H):
    count=0
    start=W-1
    for i in range(W)[::-1]:
        if S[h][i]=="#":
            count=0
            start=i
        else:
            count+=1
            l[h][i]+=count

for w in range(W):
    count=0
    start=0
    for i in range(H):
        if S[i][w]=="#":
            count=0
            start=i+1
        else:
            count+=1
            l[i][w]+=count

for w in range(W):
    count=0
    start=H-1
    for i in range(H)[::-1]:
        if S[i][w]=="#":
            count=0
            start=i
        else:
            count+=1
            l[i][w]+=count
            ans=max(ans,l[i][w])

print(ans-3)