Buggy python submission (verdict: Runtime Error):
import numpy as np
h,w=map(int,input().split())
S=np.array([list(input()) for _ in range(h)])
S=np.where(S==".",1,0)

left,right,up,down=[np.zeros((h,w)) for _ in range(4)]
for i in range(w):
    left[:,i]=(left[:,i-1]+1)*S[:,i]
    right[:,-i-1]=(right[:,-i]+1)*S[:,-i-1]
for i in range(h):
    up[i]=(up[i-1]+1)*S[i]
    down[-i-1]=(down[-i]+1)*S[-i-1]

print(int(np.max(left+right+up+down)-3))


Fixed submission:
import numpy as np
h,w=map(int,input().split())
S=np.array([list(input()) for _ in range(h)])
S=np.where(S==".",1,0)

left,right,up,down=[np.zeros((h,w),dtype=np.int64) for _ in range(4)]
for i in range(w):
    left[:,i]=(left[:,i-1]+1)*S[:,i]
    right[:,-i-1]=(right[:,-i]+1)*S[:,-i-1]
for i in range(h):
    up[i]=(up[i-1]+1)*S[i]
    down[-i-1]=(down[-i]+1)*S[-i-1]

print(int(np.max(left+right+up+down)-3))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline

h,w=map(int,input().split())
S=[["#"]+list(input())+["#"] for _ in range(h)]
S.insert(0,["#"]*(w+2))
S.append(["#"]*(w+2))

C=[[[0]*4 for _ in range(w+2)] for _ in range(h+2)]
for i in range(1,h+1):
    for n, flag in enumerate((1, -1)):
        for j in range(1,w+1)[::flag]:
            if S[i][j]!="#":C[i][j][n] +=C[i][j-flag][n]+1
for i in range(1,w+1):
    for n, flag in enumerate((1, -1)):
        for j in range(1,h+1)[::flag]:
            if S[j][i]!="#":C[j][i][n+2] +=C[j-flag][i][n+2]+1

print(max([sum(C[i][j])-3 for i in range(1,h+1) for j in range(1,w+1)]))

Fixed submission:
import numpy as np
h,w=map(int,input().split())
S=np.array([list(input()) for _ in range(h)])
S=np.where(S==".",1,0)

left,right,up,down=[np.zeros((h,w),dtype=np.int64) for _ in range(4)]
for i in range(w):
    left[:,i]=(left[:,i-1]+1)*S[:,i]
    right[:,-i-1]=(right[:,-i]+1)*S[:,-i-1]
for i in range(h):
    up[i]=(up[i-1]+1)*S[i]
    down[-i-1]=(down[-i]+1)*S[-i-1]

print(int(np.max(left+right+up+down)-3))

Buggy python submission (verdict: Runtime Error):
import numpy as np
h,w=map(int,input().split())
S=np.array([list(input()) for _ in range(h)])
S=np.where(S==".",1,0)

left,right,up,down=[np.zeros((h,w)) for _ in range(4)]
for i in range(w):
    left[:,i]=(left[:,i-1]+1)*S[:,i]
    right[:,-i-1]=(right[:,-i]+1)*S[i,-i-1]
for i in range(h):
    up[i]=(up[i-1]+1)*S[i]
    down[-i-1]=(down[-i]+1)*S[-i-1]

print(np.max(left+right+up+down)-3)

Fixed submission:
import numpy as np
h,w=map(int,input().split())
S=np.array([list(input()) for _ in range(h)])
S=np.where(S==".",1,0)

left,right,up,down=[np.zeros((h,w),dtype=np.int64) for _ in range(4)]
for i in range(w):
    left[:,i]=(left[:,i-1]+1)*S[:,i]
    right[:,-i-1]=(right[:,-i]+1)*S[:,-i-1]
for i in range(h):
    up[i]=(up[i-1]+1)*S[i]
    down[-i-1]=(down[-i]+1)*S[-i-1]

print(int(np.max(left+right+up+down)-3))

Buggy python submission (verdict: Time Limit Exceeded):
h,w=map(int,input().split())
S=[["#"]+list(input())+["#"] for _ in range(h)]
S.insert(0,["#"]*(w+2))
S.append(["#"]*(w+2))

C=[[[0]*4 for _ in range(w+2)] for _ in range(h+2)]
for i in range(1,h+1):
    for n, flag in enumerate((1, -1)):
        for j in range(1,w+1)[::flag]:
            if S[i][j]!="#":C[i][j][n] +=C[i][j-flag][n]+1
for i in range(1,w+1):
    for n, flag in enumerate((1, -1)):
        for j in range(1,h+1)[::flag]:
            if S[j][i]!="#":C[j][i][n+2] +=C[j-flag][i][n+2]+1

print(max([sum(C[i][j])-3 for i in range(1,h+1) for j in range(1,w+1)]))

Fixed submission:
import numpy as np
h,w=map(int,input().split())
S=np.array([list(input()) for _ in range(h)])
S=np.where(S==".",1,0)

left,right,up,down=[np.zeros((h,w),dtype=np.int64) for _ in range(4)]
for i in range(w):
    left[:,i]=(left[:,i-1]+1)*S[:,i]
    right[:,-i-1]=(right[:,-i]+1)*S[:,-i-1]
for i in range(h):
    up[i]=(up[i-1]+1)*S[i]
    down[-i-1]=(down[-i]+1)*S[-i-1]

print(int(np.max(left+right+up+down)-3))

Buggy python submission (verdict: Time Limit Exceeded):
h,w=map(int,input().split())
S=[["#"]+list(input())+["#"] for _ in range(h)]
S.insert(0,["#"]*(w+2))
S.append(["#"]*(w+2))

C=[[[0]*4 for _ in range(w+2)] for _ in range(h+2)]
for n,flag in enumerate((1,-1)):
    for i in range(1,h+1):
        for j in range(1,w+1)[::flag]:
            if S[i][j]!="#":C[i][j][n] +=C[i][j-flag][n]+1
for n,flag in enumerate((1,-1)):
    for i in range(1,w+1):
        for j in range(1,h+1)[::flag]:
            if S[j][i]!="#":C[j][i][n+2] +=C[j-flag][i][n+2]+1

print(max([sum(C[i][j])-3 for i in range(1,h+1) for j in range(1,w+1)]))

Fixed submission:
import numpy as np
h,w=map(int,input().split())
S=np.array([list(input()) for _ in range(h)])
S=np.where(S==".",1,0)

left,right,up,down=[np.zeros((h,w),dtype=np.int64) for _ in range(4)]
for i in range(w):
    left[:,i]=(left[:,i-1]+1)*S[:,i]
    right[:,-i-1]=(right[:,-i]+1)*S[:,-i-1]
for i in range(h):
    up[i]=(up[i-1]+1)*S[i]
    down[-i-1]=(down[-i]+1)*S[-i-1]

print(int(np.max(left+right+up+down)-3))

Buggy python submission (verdict: Time Limit Exceeded):
h,w=map(int,input().split())
S=[["#"]+list(input())+["#"] for _ in range(h)]
S.insert(0,["#"]*(w+2))
S.append(["#"]*(w+2))

C=[[[0]*4 for _ in range(w+2)] for _ in range(h+2)]
for n,flag in enumerate((1,-1)):
    for i in range(1,h+1):
        for j in range(1,w+1)[::flag]:
            if S[i][j]!="#":C[i][j][n] +=C[i][j-flag][n]+1
for n,flag in enumerate((1,-1)):
    for i in range(1,w+1):
        for j in range(1,h+1)[::flag]:
            if S[j][i]!="#":C[j][i][n+2] +=C[j-flag][i][n+2]+1

print(max([sum(C[i][j])-3 for i in range(1,h+1) for j in range(1,w+1)]))

Fixed submission:
import numpy as np
h,w=map(int,input().split())
S=np.array([list(input()) for _ in range(h)])
S=np.where(S==".",1,0)

left,right,up,down=[np.zeros((h,w),dtype=np.int64) for _ in range(4)]
for i in range(w):
    left[:,i]=(left[:,i-1]+1)*S[:,i]
    right[:,-i-1]=(right[:,-i]+1)*S[:,-i-1]
for i in range(h):
    up[i]=(up[i-1]+1)*S[i]
    down[-i-1]=(down[-i]+1)*S[-i-1]

print(int(np.max(left+right+up+down)-3))