Buggy python submission (verdict: Runtime Error):
import numpy as np
H,W=map(int,input().split())
S=[list(input()) for h in range(H)]
S=[[1 if s=='.' else 0 for s in S[h]] for h in range(H)]
S=np.array(S)
L=S.copy()
R=S.copy()
U=S.copy()
D=S.copy()
for w in range(1,W):
    L[:,w]=(L[:,w-1]+1)*S[:,j]
    R[:,-(1+w)]=(R[:,-w]+1)*S[:,-(1+w)]
for h in range(1,H):
    U[h,:]=(U[h-1,:]+1)*S[h,:]
    D[-(1+h),:]=(D[-h,:]+1)*S[-(1+h),:]
print(int((L+R+U+D).max())-3)

Fixed submission:
import numpy as np
H,W=map(int,input().split())
S=[list(input()) for h in range(H)]
S=[[1 if s=='.' else 0 for s in S[h]] for h in range(H)]
S=np.array(S)
L=S.copy()
R=S.copy()
U=S.copy()
D=S.copy()
for w in range(1,W):
    L[:,w]=(L[:,w-1]+1)*S[:,w]
    R[:,-(1+w)]=(R[:,-w]+1)*S[:,-(1+w)]
for h in range(1,H):
    U[h,:]=(U[h-1,:]+1)*S[h,:]
    D[-(1+h),:]=(D[-h,:]+1)*S[-(1+h),:]
print(int((L+R+U+D).max())-3)

Buggy python submission (verdict: Time Limit Exceeded):
H,W=map(int,input().split())
S=[]
for h in range(H):
    Sh=list(input())
    S.append(Sh)
    
L=[[0 for w in range(W)] for h in range(H)]
R=[[0 for w in range(W)] for h in range(H)]
U=[[0 for w in range(W)] for h in range(H)]
D=[[0 for w in range(W)] for h in range(H)]

for h in range(H):
    a=0
    b=0
    for w in range(W):
        if S[h][w]=='.':
            a+=1
        if S[h][w]=='#':
            a=0
        if S[h][-(1+w)]=='.':
            b+=1
        if S[h][-(1+w)]=='#':
            b=0
        L[h][w]+=a
        R[h][-(1+w)]+=b

for w in range(W):
    a=0
    b=0
    for h in range(H):
        if S[h][w]=='.':
            a+=1
        if S[h][w]=='#':
            a=0
        if S[-(1+h)][w]=='.':
            b+=1
        if S[-(1+h)][w]=='#':
            b=0
        U[h][w]+=a
        D[-(1+h)][w]+=b

maxScore=0
for h in range(H):
    for w in range(W):
        score=L[h][w]+R[h][w]+U[h][w]+D[h][w]-3
        if score>maxScore:
            maxScore=score

print(maxScore)

Fixed submission:
import numpy as np
H,W=map(int,input().split())
S=[list(input()) for h in range(H)]
S=[[1 if s=='.' else 0 for s in S[h]] for h in range(H)]
S=np.array(S)
L=S.copy()
R=S.copy()
U=S.copy()
D=S.copy()
for w in range(1,W):
    L[:,w]=(L[:,w-1]+1)*S[:,w]
    R[:,-(1+w)]=(R[:,-w]+1)*S[:,-(1+w)]
for h in range(1,H):
    U[h,:]=(U[h-1,:]+1)*S[h,:]
    D[-(1+h),:]=(D[-h,:]+1)*S[-(1+h),:]
print(int((L+R+U+D).max())-3)

Buggy python submission (verdict: Time Limit Exceeded):
H,W=map(int,input().split())
S=[]
for h in range(H):
    Sh=list(input())
    S.append(Sh)
    
L=[[0 for w in range(W)] for h in range(H)]
R=[[0 for w in range(W)] for h in range(H)]
U=[[0 for w in range(W)] for h in range(H)]
D=[[0 for w in range(W)] for h in range(H)]

for h in range(H):
    a=0
    for w in range(W):
        if S[h][w]=='.':
            a+=1
        else:
            a=0
        L[h][w]+=a

for h in range(H):
    a=0
    for w in range(W):
        if S[h][-(1+w)]=='.':
            a+=1
        else:
            a=0
        R[h][-(1+w)]+=a

for w in range(W):
    a=0
    for h in range(H):
        if S[h][w]=='.':
            a+=1
        else:
            a=0
        U[h][w]+=a
    
for w in range(W):
    a=0
    for h in range(H):
        if S[-(1+h)][w]=='.':
            a+=1
        else:
            a=0
        D[-(1+h)][w]+=a

maxScore=0
for h in range(H):
    for w in range(W):
        score=L[h][w]+R[h][w]+U[h][w]+D[h][w]-3
        if score>maxScore:
            maxScore=score

print(maxScore)

Fixed submission:
import numpy as np
H,W=map(int,input().split())
S=[list(input()) for h in range(H)]
S=[[1 if s=='.' else 0 for s in S[h]] for h in range(H)]
S=np.array(S)
L=S.copy()
R=S.copy()
U=S.copy()
D=S.copy()
for w in range(1,W):
    L[:,w]=(L[:,w-1]+1)*S[:,w]
    R[:,-(1+w)]=(R[:,-w]+1)*S[:,-(1+w)]
for h in range(1,H):
    U[h,:]=(U[h-1,:]+1)*S[h,:]
    D[-(1+h),:]=(D[-h,:]+1)*S[-(1+h),:]
print(int((L+R+U+D).max())-3)

Buggy python submission (verdict: Time Limit Exceeded):
H,W=map(int,input().split())
S=[]
for h in range(H):
    Sh=list(input())
    S.append(Sh)
    
L=[]
for h in range(H):
    Lh=[]
    a=0
    for w in range(W):
        if S[h][w]=='.':
            a+=1
        else:
            a=0
        Lh=Lh+[a]
    L.append(Lh)

R=[]
for h in range(H):
    Rh=[]
    a=0
    for w in range(W):
        if S[h][-(1+w)]=='.':
            a+=1
        else:
            a=0
        Rh=[a]+Rh
    R.append(Rh)

U=[]
for w in range(W):
    Uw=[]
    a=0
    for h in range(H):
        if S[h][w]=='.':
            a+=1
        else:
            a=0
        Uw=Uw+[a]
    U.append(Uw)
U=[[U[w][h] for w in range(W)] for h in range(H)]
    
D=[]
for w in range(W):
    Dw=[]
    a=0
    for h in range(H):
        if S[-(1+h)][w]=='.':
            a+=1
        else:
            a=0
        Dw=[a]+Dw
    D.append(Dw)
D=[[D[w][h] for w in range(W)] for h in range(H)]

maxScore=0
for h in range(H):
    for w in range(W):
        score=L[h][w]+R[h][w]+U[h][w]+D[h][w]-3
        if score>maxScore:
            maxScore=score
print(maxScore)

Fixed submission:
import numpy as np
H,W=map(int,input().split())
S=[list(input()) for h in range(H)]
S=[[1 if s=='.' else 0 for s in S[h]] for h in range(H)]
S=np.array(S)
L=S.copy()
R=S.copy()
U=S.copy()
D=S.copy()
for w in range(1,W):
    L[:,w]=(L[:,w-1]+1)*S[:,w]
    R[:,-(1+w)]=(R[:,-w]+1)*S[:,-(1+w)]
for h in range(1,H):
    U[h,:]=(U[h-1,:]+1)*S[h,:]
    D[-(1+h),:]=(D[-h,:]+1)*S[-(1+h),:]
print(int((L+R+U+D).max())-3)

Buggy python submission (verdict: Time Limit Exceeded):
H,W=map(int,input().split())
S=[]
for h in range(H):
    Sh=list(input())
    newSh=[]
    for w in range(W):
        if Sh[w]=='#':
            newSh.append(1)
        else:
            newSh.append(0)
    Sh=newSh
    S.append(Sh)
    
L=[]
for h in range(H):
    Lh=[]
    a=0
    for w in range(W):
        if S[h][w]==0:
            a+=1
        else:
            a=0
        Lh=Lh+[a]
    L.append(Lh)

R=[]
for h in range(H):
    Rh=[]
    a=0
    for w in range(W):
        if S[h][-(1+w)]==0:
            a+=1
        else:
            a=0
        Rh=[a]+Rh
    R.append(Rh)

U=[]
for w in range(W):
    Uw=[]
    a=0
    for h in range(H):
        if S[h][w]==0:
            a+=1
        else:
            a=0
        Uw=Uw+[a]
    U.append(Uw)
U=[[U[w][h] for w in range(W)] for h in range(H)]
    
D=[]
for w in range(W):
    Dw=[]
    a=0
    for h in range(H):
        if S[-(1+h)][w]==0:
            a+=1
        else:
            a=0
        Dw=[a]+Dw
    D.append(Dw)
D=[[D[w][h] for w in range(W)] for h in range(H)]

maxScore=0
for h in range(H):
    for w in range(W):
        score=L[h][w]+R[h][w]+U[h][w]+D[h][w]-3
        if score>maxScore:
            maxScore=score
print(maxScore)

Fixed submission:
import numpy as np
H,W=map(int,input().split())
S=[list(input()) for h in range(H)]
S=[[1 if s=='.' else 0 for s in S[h]] for h in range(H)]
S=np.array(S)
L=S.copy()
R=S.copy()
U=S.copy()
D=S.copy()
for w in range(1,W):
    L[:,w]=(L[:,w-1]+1)*S[:,w]
    R[:,-(1+w)]=(R[:,-w]+1)*S[:,-(1+w)]
for h in range(1,H):
    U[h,:]=(U[h-1,:]+1)*S[h,:]
    D[-(1+h),:]=(D[-h,:]+1)*S[-(1+h),:]
print(int((L+R+U+D).max())-3)

Buggy python submission (verdict: Time Limit Exceeded):
H,W=map(int,input().split())
S=[]
for h in range(H):
    Sh=list(input())
    newSh=[]
    for w in range(W):
        if Sh[w]=='#':
            newSh.append(1)
        else:
            newSh.append(0)
    Sh=newSh
    S.append(Sh)
    
L=[]
for h in range(H):
    Lh=[]
    a=0
    for w in range(W):
        if S[h][w]==0:
            a+=1
        else:
            a=0
        Lh=Lh+[a]
    L.append(Lh)

R=[]
for h in range(H):
    Rh=[]
    a=0
    for w in range(W):
        if S[h][-(1+w)]==0:
            a+=1
        else:
            a=0
        Rh=[a]+Rh
    R.append(Rh)

U=[]
for w in range(W):
    Uw=[]
    a=0
    for h in range(H):
        if S[h][w]==0:
            a+=1
        else:
            a=0
        Uw=Uw+[a]
    U.append(Uw)
U=[[U[w][h] for w in range(W)] for h in range(H)]
    
D=[]
for w in range(W):
    Dw=[]
    a=0
    for h in range(H):
        if S[-(1+h)][w]==0:
            a+=1
        else:
            a=0
        Dw=[a]+Dw
    D.append(Dw)
D=[[D[w][h] for w in range(W)] for h in range(H)]

maxScore=0
for h in range(H):
    for w in range(W):
        score=L[h][w]+R[h][w]+U[h][w]+D[h][w]-3
        if score>maxScore:
            maxScore=score
print(maxScore)

Fixed submission:
import numpy as np
H,W=map(int,input().split())
S=[list(input()) for h in range(H)]
S=[[1 if s=='.' else 0 for s in S[h]] for h in range(H)]
S=np.array(S)
L=S.copy()
R=S.copy()
U=S.copy()
D=S.copy()
for w in range(1,W):
    L[:,w]=(L[:,w-1]+1)*S[:,w]
    R[:,-(1+w)]=(R[:,-w]+1)*S[:,-(1+w)]
for h in range(1,H):
    U[h,:]=(U[h-1,:]+1)*S[h,:]
    D[-(1+h),:]=(D[-h,:]+1)*S[-(1+h),:]
print(int((L+R+U+D).max())-3)

Buggy python submission (verdict: Time Limit Exceeded):
H,W=map(int,input().split())
S=[]
for h in range(H):
    Sh=list(input())
    newSh=[]
    for w in range(W):
        if Sh[w]=='#':
            newSh.append(1)
        else:
            newSh.append(0)
    Sh=newSh
    S.append(Sh)

L=[]
for h in range(H):
    Lh=[]
    a=0
    for w in range(W):
        if S[h][w]==0:
            a+=1
        else:
            a=0
        Lh.append(a)
    L.append(Lh)
    
R=[]
for h in range(H):
    Rh=[]
    a=0
    for w in range(W):
        if S[h][-(1+w)]==0:
            a+=1
        else:
            a=0
        Rh.append(a)
    Rh.reverse()
    R.append(Rh)

U=[]
for w in range(W):
    Uw=[]
    a=0
    for h in range(H):
        if S[h][w]==0:
            a+=1
        else:
            a=0
        Uw.append(a)
    U.append(Uw)
U=[[U[w][h] for w in range(W)] for h in range(H)]

D=[]
for w in range(W):
    Dw=[]
    a=0
    for h in range(H):
        if S[-(1+h)][w]==0:
            a+=1
        else:
            a=0
        Dw.append(a)
    Dw.reverse()
    D.append(Dw)
D=[[D[w][h] for w in range(W)] for h in range(H)]
    
maxScore=0
for h in range(H):
    for w in range(W):
        score=L[h][w]+R[h][w]+U[h][w]+D[h][w]-3
        if score>maxScore:
            maxScore=score
print(maxScore)

Fixed submission:
import numpy as np
H,W=map(int,input().split())
S=[list(input()) for h in range(H)]
S=[[1 if s=='.' else 0 for s in S[h]] for h in range(H)]
S=np.array(S)
L=S.copy()
R=S.copy()
U=S.copy()
D=S.copy()
for w in range(1,W):
    L[:,w]=(L[:,w-1]+1)*S[:,w]
    R[:,-(1+w)]=(R[:,-w]+1)*S[:,-(1+w)]
for h in range(1,H):
    U[h,:]=(U[h-1,:]+1)*S[h,:]
    D[-(1+h),:]=(D[-h,:]+1)*S[-(1+h),:]
print(int((L+R+U+D).max())-3)

Buggy python submission (verdict: Runtime Error):
H,W=map(int,input().split())
S=[]
for h in range(H):
    Sh=list(input())
    newSh=[]
    for w in range(W):
        if Sh[w]=='#':
            newSh.append(1)
        else:
            newSh.append(0)
    Sh=newSh
    S.append(Sh)

# for h in range(H):
#     print(S[h])
    
# print('#############')
    
L=[]
for h in range(H):
    Lh=[]
    a=0
    for w in range(W):
        if S[h][w]==0:
            a+=1
        else:
            a=0
        Lh.append(a)
    L.append(Lh)

# for h in range(H):
#     print(L[h])
    
# print('#############')
    
R=[]
for h in range(H):
    Rh=[]
    a=0
    for w in range(W):
        if S[h][-(1+w)]==0:
            a+=1
        else:
            a=0
        Rh.append(a)
    Rh.reverse()
    R.append(Rh)

# for h in range(H):
#     print(R[h])
    
# print('#############')

U=[]
for w in range(W):
    Uw=[]
    a=0
    for h in range(H):
        if S[h][w]==0:
            a+=1
        else:
            a=0
        Uw.append(a)
    U.append(Uw)
U=[[U[w][h] for w in range(W)] for h in range(H)]
    
# for h in range(H):
#     print(U[h])

# print('#############')

D=[]
for w in range(W):
    Dw=[]
    a=0
    for h in range(H):
        if S[-(1+h)][w]==0:
            a+=1
        else:
            a=0
        Dw.append(a)
    Dw.reverse()
    D.append(Dw)
D=[[D[w][h] for w in range(W)] for h in range(H)]
    
# for h in range(H):
#     print(D[h])
    
# print('#############')

maxScore=0
for h in range(H):
    for w in range(W):
        score=L[h][w]+R[h][w]+U[h][w]+D[h][w]-3
        if score>maxScore:
            maxScore=score
print(maxScore)H,W=map(int,input().split())
S=[]
for h in range(H):
    Sh=list(input())
    newSh=[]
    for w in range(W):
        if Sh[w]=='#':
            newSh.append(1)
        else:
            newSh.append(0)
    Sh=newSh
    S.append(Sh)

# for h in range(H):
#     print(S[h])
    
# print('#############')
    
L=[]
for h in range(H):
    Lh=[]
    a=0
    for w in range(W):
        if S[h][w]==0:
            a+=1
        else:
            a=0
        Lh.append(a)
    L.append(Lh)

# for h in range(H):
#     print(L[h])
    
# print('#############')
    
R=[]
for h in range(H):
    Rh=[]
    a=0
    for w in range(W):
        if S[h][-(1+w)]==0:
            a+=1
        else:
            a=0
        Rh.append(a)
    Rh.reverse()
    R.append(Rh)

# for h in range(H):
#     print(R[h])
    
# print('#############')

U=[]
for w in range(W):
    Uw=[]
    a=0
    for h in range(H):
        if S[h][w]==0:
            a+=1
        else:
            a=0
        Uw.append(a)
    U.append(Uw)
U=[[U[w][h] for w in range(W)] for h in range(H)]
    
# for h in range(H):
#     print(U[h])

# print('#############')

D=[]
for w in range(W):
    Dw=[]
    a=0
    for h in range(H):
        if S[-(1+h)][w]==0:
            a+=1
        else:
            a=0
        Dw.append(a)
    Dw.reverse()
    D.append(Dw)
D=[[D[w][h] for w in range(W)] for h in range(H)]
    
# for h in range(H):
#     print(D[h])
    
# print('#############')

maxScore=0
for h in range(H):
    for w in range(W):
        score=L[h][w]+R[h][w]+U[h][w]+D[h][w]-3
        if score>maxScore:
            maxScore=score
print(maxScore)

Fixed submission:
import numpy as np
H,W=map(int,input().split())
S=[list(input()) for h in range(H)]
S=[[1 if s=='.' else 0 for s in S[h]] for h in range(H)]
S=np.array(S)
L=S.copy()
R=S.copy()
U=S.copy()
D=S.copy()
for w in range(1,W):
    L[:,w]=(L[:,w-1]+1)*S[:,w]
    R[:,-(1+w)]=(R[:,-w]+1)*S[:,-(1+w)]
for h in range(1,H):
    U[h,:]=(U[h-1,:]+1)*S[h,:]
    D[-(1+h),:]=(D[-h,:]+1)*S[-(1+h),:]
print(int((L+R+U+D).max())-3)