Buggy python submission (verdict: Time Limit Exceeded):
H,W=map(int,input().split())
S=[[i for i in list(input())]for _ in range(H)]
L=[[0]*W for _ in range(H)]
R=[[0]*W for _ in range(H)]
U=[[0]*W for _ in range(H)]
D=[[0]*W for _ in range(H)]
for i in range(H):
    count=0
    for j in range(W):
        if S[i][j]=="#":
            count=0
        else:
            count=count+1
        L[i][j]=count
for i in range(H):
    count=0
    for j in range(W)[::-1]:
        if S[i][j]=="#":
            count=0
        else:
            count=count+1
        R[i][j]=count
for i in range(W):
    count=0
    for j in range(H):
        if S[j][i]=="#":
            count=0
        else:
            count=count+1
        U[j][i]=count
for i in range(W):
    count=0
    for j in range(H)[::-1]:
        if S[j][i]=="#":
            count=0
        else:
            count=count+1
        D[j][i]=count
ans=0
for i in range(H):
    for j in range(W):
        ans=max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(ans)

Fixed submission:
H,W=map(int,input().split())
S=[[i for i in list(input())]for _ in range(H)]
L=[[0]*W for _ in range(H)]
R=[[0]*W for _ in range(H)]
U=[[0]*W for _ in range(H)]
D=[[0]*W for _ in range(H)]
for i in range(H):
    count=0
    for j in range(W):
        if S[i][j]=="#":
            count=0
        else:
            count=count+1
        L[i][j]=count
for i in range(H):
    count=0
    for j in range(W)[::-1]:
        if S[i][j]=="#":
            count=0
        else:
            count=count+1
        R[i][j]=count
for i in range(W):
    count=0
    for j in range(H):
        if S[j][i]=="#":
            count=0
        else:
            count=count+1
        U[j][i]=count
for i in range(W):
    count=0
    for j in range(H)[::-1]:
        if S[j][i]=="#":
            count=0
        else:
            count=count+1
        D[j][i]=count
ans=0
for i in range(H):
    for j in range(W):
        ans=max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
H,W=map(int,input().split())
S=[[i for i in list(input())]for _ in range(H)]
L=[[1]*W for _ in range(H)]
for i in range(H):
    count=1
    for j in range(W):
        if S[i][j]=="#":
            L[i][j]=0
            count=0
        elif 0<j:
            count=count+1
            L[i][j]=count
R=[[1]*W for _ in range(H)]
for i in range(H):
    count=1
    for j in range(W)[::-1]:
        if S[i][j]=="#":
            R[i][j]=0
            count=0
        elif j<W-1:
            count=count+1
            R[i][j]=count
U=[[1]*W for _ in range(H)]
for i in range(W):
    count=1
    for j in range(H):
        if S[j][i]=="#":
            U[j][i]=0
            count=0
        elif 0!=j:
            count=count+1
            U[j][i]=count
D=[[1]*W for _ in range(H)]
for i in range(W):
    count=1
    for j in range(H)[::-1]:
        if S[j][i]=="#":
            D[j][i]=0
            count=0
        elif j!=H-1:
            count=count+1
            D[j][i]=D[j+1][i]+1
ans=0
for i in range(H):
    for j in range(W):
        count=L[i][j]+R[i][j]+U[i][j]+D[i][j]-3
        ans=max(ans,count)
print(ans)

Fixed submission:
H,W=map(int,input().split())
S=[[i for i in list(input())]for _ in range(H)]
L=[[0]*W for _ in range(H)]
R=[[0]*W for _ in range(H)]
U=[[0]*W for _ in range(H)]
D=[[0]*W for _ in range(H)]
for i in range(H):
    count=0
    for j in range(W):
        if S[i][j]=="#":
            count=0
        else:
            count=count+1
        L[i][j]=count
for i in range(H):
    count=0
    for j in range(W)[::-1]:
        if S[i][j]=="#":
            count=0
        else:
            count=count+1
        R[i][j]=count
for i in range(W):
    count=0
    for j in range(H):
        if S[j][i]=="#":
            count=0
        else:
            count=count+1
        U[j][i]=count
for i in range(W):
    count=0
    for j in range(H)[::-1]:
        if S[j][i]=="#":
            count=0
        else:
            count=count+1
        D[j][i]=count
ans=0
for i in range(H):
    for j in range(W):
        ans=max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
H,W=map(int,input().split())
S=[[i for i in list(input())]for _ in range(H)]
L=[[1]*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j]=="#":
            L[i][j]=0
        elif 0<j:
            L[i][j]=L[i][j-1]+1
R=[[1]*W for _ in range(H)]
for i in range(H):
    for j in range(W)[::-1]:
        if S[i][j]=="#":
            R[i][j]=0
        elif j<W-1:
            R[i][j]=R[i][j+1]+1
U=[[1]*W for _ in range(H)]
for i in range(W):
    for j in range(H):
        if S[j][i]=="#":
            U[j][i]=0
        elif 0!=j:
            U[j][i]=U[j-1][i]+1
D=[[1]*W for _ in range(H)]
for i in range(W):
    for j in range(H)[::-1]:
        if S[j][i]=="#":
            D[j][i]=0
        elif j!=H-1:
            D[j][i]=D[j+1][i]+1
ans=0
for i in range(H):
    for j in range(W):
        count=L[i][j]+R[i][j]+U[i][j]+D[i][j]-3
        ans=max(ans,count)
print(ans)

Fixed submission:
H,W=map(int,input().split())
S=[[i for i in list(input())]for _ in range(H)]
L=[[0]*W for _ in range(H)]
R=[[0]*W for _ in range(H)]
U=[[0]*W for _ in range(H)]
D=[[0]*W for _ in range(H)]
for i in range(H):
    count=0
    for j in range(W):
        if S[i][j]=="#":
            count=0
        else:
            count=count+1
        L[i][j]=count
for i in range(H):
    count=0
    for j in range(W)[::-1]:
        if S[i][j]=="#":
            count=0
        else:
            count=count+1
        R[i][j]=count
for i in range(W):
    count=0
    for j in range(H):
        if S[j][i]=="#":
            count=0
        else:
            count=count+1
        U[j][i]=count
for i in range(W):
    count=0
    for j in range(H)[::-1]:
        if S[j][i]=="#":
            count=0
        else:
            count=count+1
        D[j][i]=count
ans=0
for i in range(H):
    for j in range(W):
        ans=max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(ans)