Buggy python submission (verdict: Time Limit Exceeded):
H,W=map(int,input().split())
S=[input() for _ in range(H)]

def solve(sh,sw):
  if S[sh][sw]=="#":
    return 0
  h,w=sh,sw
  cnt=1
  for _ in range(H):
    if h==0:
      break
    h-=1
    if S[h][w]=="#":
      break
    cnt+=1
  h=sh
  for _ in range(H):
    if h==H-1:
      break
    h+=1
    if S[h][w]=="#":
      break
    cnt+=1
  h=sh
  for _ in range(W):
    if w==0:
      break
    w-=1
    if S[h][w]=="#":
      break
    cnt+=1
  w=sw
  for _ in range(W):
    if w==W-1:
      break
    w+=1
    if S[h][w]=="#":
      break
    cnt+=1
  return cnt

ans=0
for i in range(H):
  for j in range(W):
    ans=max(ans,solve(i,j))
print(ans)

Fixed submission:
import numpy as np

H,W=map(int,input().split())
S=np.array([list(input()) for _ in range(H)]) == "."

ups=np.zeros((H,W),dtype=int)
downs=np.zeros((H,W),dtype=int)
rights=np.zeros((H,W),dtype=int)
lefts=np.zeros((H,W),dtype=int)

for i in range(1,H):
    ups[i,:]=(ups[i-1,:]+1)*S[i-1,:]

for i in range(H-2,-1,-1):
    downs[i,:]=(downs[i+1,:]+1)*S[i+1,:]

for i in range(1,W):
    rights[:,i]=(rights[:,i-1]+1)*S[:,i-1]

for i in range(W-2,-1,-1):
    lefts[:,i]=(lefts[:,i+1]+1)*S[:,i+1]

ans=((ups+downs+lefts+rights)*S).max()+1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
H,W=map(int,input().split())
S=[input() for _ in range(H)]

L,R=[[0]*W for _ in range(H)], [[0]*W for _ in range(H)]
D,U=[[0]*W for _ in range(H)], [[0]*W for _ in range(H)]
for i in range(H):
  for j in range(W):
    if j==0:
      L[i][j]=1
      R[i][-(j+1)]=1
    else:
      L[i][j]=L[i][j-1]+1
      R[i][-(j+1)]=R[i][-j]+1
    if i==0:
      D[i][j]=1
      U[-(i+1)][j]=1
    else:
      D[i][j]=D[i-1][j]+1
      U[-(i+1)][j]=U[-i][j]+1
    if S[i][j]=="#":
      L[i][j],D[i][j]=0,0
    if S[i][-(j+1)]=="#":
      R[i][-(j+1)]=0
    if S[-(i+1)][j]=="#":
      U[-(i+1)][j]=0

ans=0
for i in range(H):
  for j in range(W):
    val=L[i][j]+R[i][j]+D[i][j]+U[i][j]-3
    ans=max(ans,val)
print(ans)

Fixed submission:
import numpy as np

H,W=map(int,input().split())
S=np.array([list(input()) for _ in range(H)]) == "."

ups=np.zeros((H,W),dtype=int)
downs=np.zeros((H,W),dtype=int)
rights=np.zeros((H,W),dtype=int)
lefts=np.zeros((H,W),dtype=int)

for i in range(1,H):
    ups[i,:]=(ups[i-1,:]+1)*S[i-1,:]

for i in range(H-2,-1,-1):
    downs[i,:]=(downs[i+1,:]+1)*S[i+1,:]

for i in range(1,W):
    rights[:,i]=(rights[:,i-1]+1)*S[:,i-1]

for i in range(W-2,-1,-1):
    lefts[:,i]=(lefts[:,i+1]+1)*S[:,i+1]

ans=((ups+downs+lefts+rights)*S).max()+1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
H,W=map(int,input().split())
S=[input() for _ in range(H)]

def solve(sh,sw):
  if S[sh][sw]=="#":
    return 0
  h,w=sh,sw
  cnt=1
  for i in range(H):
    if h==0:
      break
    h-=1
    if S[h][w]=="#":
      break
    cnt+=1
  h=sh
  for i in range(H):
    if h==H-1:
      break
    h+=1
    if S[h][w]=="#":
      break
    cnt+=1
  h=sh
  for i in range(W):
    if w==0:
      break
    w-=1
    if S[h][w]=="#":
      break
    cnt+=1
  w=sw
  for i in range(W):
    if w==W-1:
      break
    w+=1
    if S[h][w]=="#":
      break
    cnt+=1
  return cnt

ans=0
for i in range(H):
  for j in range(W):
    ans=max(ans,solve(i,j))
print(ans)

Fixed submission:
import numpy as np

H,W=map(int,input().split())
S=np.array([list(input()) for _ in range(H)]) == "."

ups=np.zeros((H,W),dtype=int)
downs=np.zeros((H,W),dtype=int)
rights=np.zeros((H,W),dtype=int)
lefts=np.zeros((H,W),dtype=int)

for i in range(1,H):
    ups[i,:]=(ups[i-1,:]+1)*S[i-1,:]

for i in range(H-2,-1,-1):
    downs[i,:]=(downs[i+1,:]+1)*S[i+1,:]

for i in range(1,W):
    rights[:,i]=(rights[:,i-1]+1)*S[:,i-1]

for i in range(W-2,-1,-1):
    lefts[:,i]=(lefts[:,i+1]+1)*S[:,i+1]

ans=((ups+downs+lefts+rights)*S).max()+1
print(ans)