Buggy python submission (verdict: Time Limit Exceeded):
h,w=map(int,input().split())
s=[input() for x in range(h)]

e=[[0 for i in range(w)] for j in range(h)]
r=[[0 for i in range(w)] for j in range(h)]
l=[[0 for i in range(w)] for j in range(h)]
d=[[0 for i in range(w)] for j in range(h)]
u=[[0 for i in range(w)] for j in range(h)]


for i in range(h):
  for j in range(w):
    if s[i][j]=='.':
      e[i][j] = 1

for i in range(h):
  l[i][0] = e[i][0]
  r[i][w-1] = e[i][w-1]
  for j in range(1,w):
    l[i][j] = (l[i][j-1]+1) * e[i][j]
    r[i][w-j-1] = (r[i][w-j]+1) * e[i][w-j-1]

for i in range(w):
  u[0][i]=e[0][i]
  d[h-1][i]=e[h-1][i]
  for j in range(1,h):
    u[j][i] = (u[j-1][i]+1) * e[j][i]
    d[h-j-1][i] = (d[h-j][i]+1) * e[h-j-1][i]

m = 0
for i in range(h):
   for j in range(w):
      m = max(m,l[i][j]+r[i][j]+u[i][j]+d[i][j])

print(m-3)


Fixed submission:
import numpy as np

h,w=map(int,input().split())
s=np.array([[(1 if x=='.' else 0) for x in list(input())] for y in range(h)])

r=np.zeros((h,w),dtype=int)
l=np.zeros((h,w),dtype=int)
d=np.zeros((h,w),dtype=int)
u=np.zeros((h,w),dtype=int)

l[:,0] = s[:,0]
r[:,w-1] = s[:,w-1]
for i in range(1,w):
  l[:,i] = (l[:,i-1]+1) * s[:,i]
  r[:,w-i-1] = (r[:,w-i]+1) * s[:,w-i-1]

u[0]=s[0]
d[h-1]=s[h-1]
for i in range(1,h):
  u[i] = (u[i-1]+1) * s[i]
  d[h-i-1] = (d[h-i]+1) * s[h-i-1]

print(((l+r+u+d).max()-3))

Buggy python submission (verdict: Time Limit Exceeded):
h,w=map(int,input().split())
s=[input() for x in range(h)]

e=[[0 for i in range(w)] for j in range(h)]
r=[[0 for i in range(w)] for j in range(h)]
l=[[0 for i in range(w)] for j in range(h)]
d=[[0 for i in range(w)] for j in range(h)]
u=[[0 for i in range(w)] for j in range(h)]


for i in range(h):
  for j in range(w):
    if s[i][j]=='.':
      e[i][j] = 1

for i in range(h):
  l[i][0] = e[i][0]
  for j in range(1,w):
    l[i][j] = (l[i][j-1]+1) * e[i][j]
  r[i][w-1] = e[i][w-1]
  for j in range(w-1,0,-1):
    r[i][j-1] = (r[i][j]+1) * e[i][j-1]

for i in range(w):
  u[0][i]=e[0][i]
  for j in range(1,h):
    u[j][i] = (u[j-1][i]+1) * e[j][i]
  d[h-1][i]=e[h-1][i]
  for j in range(h-1,0,-1):
    d[j-1][i] = (d[j][i]+1) * e[j-1][i]

m = 0
for i in range(h):
   for j in range(w):
      m = max(m,l[i][j]+r[i][j]+u[i][j]+d[i][j]-3)

print(m)


Fixed submission:
import numpy as np

h,w=map(int,input().split())
s=np.array([[(1 if x=='.' else 0) for x in list(input())] for y in range(h)])

r=np.zeros((h,w),dtype=int)
l=np.zeros((h,w),dtype=int)
d=np.zeros((h,w),dtype=int)
u=np.zeros((h,w),dtype=int)

l[:,0] = s[:,0]
r[:,w-1] = s[:,w-1]
for i in range(1,w):
  l[:,i] = (l[:,i-1]+1) * s[:,i]
  r[:,w-i-1] = (r[:,w-i]+1) * s[:,w-i-1]

u[0]=s[0]
d[h-1]=s[h-1]
for i in range(1,h):
  u[i] = (u[i-1]+1) * s[i]
  d[h-i-1] = (d[h-i]+1) * s[h-i-1]

print(((l+r+u+d).max()-3))

Buggy python submission (verdict: Time Limit Exceeded):
N,W=map(int, input().split())
nm=[0]*W
wm=[0]*W
tm=[0]*W

for i in range(N):
  s = input()
  x = 0
  for j in range(W):
    if s[j]=='.':
        nm[j] += 1
    else:
        for k in range (x, j):
           wm[k] = max(wm[k], j-x)
        tm[j] = max(tm[j], wm[j]+nm[j]-1)
        x =j+1
        wm[j] = nm[j] = 0
  for k in range (x, W):
     wm[k] = max(wm[k],W-x)
for j in range (W):
   tm[j] = max(tm[j], wm[j]+nm[j]-1)
print(max(tm))

Fixed submission:
import numpy as np

h,w=map(int,input().split())
s=np.array([[(1 if x=='.' else 0) for x in list(input())] for y in range(h)])

r=np.zeros((h,w),dtype=int)
l=np.zeros((h,w),dtype=int)
d=np.zeros((h,w),dtype=int)
u=np.zeros((h,w),dtype=int)

l[:,0] = s[:,0]
r[:,w-1] = s[:,w-1]
for i in range(1,w):
  l[:,i] = (l[:,i-1]+1) * s[:,i]
  r[:,w-i-1] = (r[:,w-i]+1) * s[:,w-i-1]

u[0]=s[0]
d[h-1]=s[h-1]
for i in range(1,h):
  u[i] = (u[i-1]+1) * s[i]
  d[h-i-1] = (d[h-i]+1) * s[h-i-1]

print(((l+r+u+d).max()-3))