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

left=[[0 for _ in range(w)] for _ in range(h)]
right=[[0 for _ in range(w)] for _ in range(h)]
up=[[0 for _ in range(w)] for _ in range(h)]
down=[[0 for _ in range(w)] for _ in range(h)]

for i in range(h):
    count=1
    for j in range(w):
        if(s[i][j]=='.'):
            left[i][j]=count
            count+=1
        else:
            left[i][j]=0
            count=1

for i in range(h):
    count=1
    for j in range(w-1,-1,-1):
        if(s[i][j]=='.'):
            right[i][j]=count
            count+=1
        else:
            right[i][j]=0
            count=1

for j in range(w):
    count=1
    for i in range(h):
        if(s[i][j]=='.'):
            up[i][j]=count
            count+=1
        else:
            up[i][j]=0
            count=1

ans=0
for j in range(w):
    count=1
    for i in range(h-1,-1,-1):
        if(s[i][j]=='.'):
            down[i][j]=count
            count+=1
        else:
            down[i][j]=0
            count=1

        ans=max(ans,left[i][j]+right[i][j]+up[i][j]+down[i][j]-3)

print(ans)


Fixed submission:
import numpy as np
h,w=map(int,input().split())
s=[]
for _ in range(h):
    si=input()
    si=si.replace('.', '1')
    si=si.replace('#', '0')
    s.append(list(map(int,si)))
s=np.array(s)

left=np.zeros((h,w))
right=np.zeros((h,w))
up=np.zeros((h,w))
down=np.zeros((h,w))

for i in range(w):
    if(i==0):
        left[:,i]=s[:,i]
        right[:,w-i-1]=s[:,w-i-1]
    else:
        left[:,i]=(left[:,i-1]+1)*s[:,i]
        right[:,w-i-1]=(right[:,w-i]+1)*s[:,w-i-1]

for i in range(h):
    if(i==0):
        down[i,:]=s[i,:]
        up[h-i-1,:]=s[h-i-1,:]
    else:
        down[i,:]=(down[i-1,:]+1)*s[i,:]
        up[h-i-1,:]=(up[h-i,:]+1)*s[h-i-1,:]

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

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

tate=[[-1 for _ in range(w)] for _ in range(h)]
yoko=[[-1 for _ in range(w)] for _ in range(h)]

def search(i,j):
    ansij=1

    if(yoko[i][j] == -1):
        xl=j
        while(0<xl and s[i][xl-1]=='.'):
            ansij+=1
            xl-=1
        xr=j
        while(xr<w-1 and s[i][xr+1]=='.'):
            ansij+=1
            xr+=1

        for k in range(xl,xr+1):
            yoko[i][k]=xr-xl
    else:
        ansij+=yoko[i][j]

    if(tate[i][j] == -1):
        yu=i
        while(0<yu and s[yu-1][j]=='.'):
            ansij+=1
            yu-=1
        yd=i
        while(yd<h-1 and s[yd+1][j]=='.'):
            ansij+=1
            yd+=1

        for k in range(yu,yd+1):
            tate[k][j]=yd-yu
    else:
        ansij+=tate[i][j]

    return ansij

ans=0
for i in range(h):
    for j in range(w):
        if(s[i][j]=='.'):
            ansij=search(i, j)
            if(ans<ansij):
#                print(i,j,ansij)
                ans=ansij

print(ans)


Fixed submission:
import numpy as np
h,w=map(int,input().split())
s=[]
for _ in range(h):
    si=input()
    si=si.replace('.', '1')
    si=si.replace('#', '0')
    s.append(list(map(int,si)))
s=np.array(s)

left=np.zeros((h,w))
right=np.zeros((h,w))
up=np.zeros((h,w))
down=np.zeros((h,w))

for i in range(w):
    if(i==0):
        left[:,i]=s[:,i]
        right[:,w-i-1]=s[:,w-i-1]
    else:
        left[:,i]=(left[:,i-1]+1)*s[:,i]
        right[:,w-i-1]=(right[:,w-i]+1)*s[:,w-i-1]

for i in range(h):
    if(i==0):
        down[i,:]=s[i,:]
        up[h-i-1,:]=s[h-i-1,:]
    else:
        down[i,:]=(down[i-1,:]+1)*s[i,:]
        up[h-i-1,:]=(up[h-i,:]+1)*s[h-i-1,:]

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

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


def search(i,j):
    ansij=1
    y=i
    x=j
    while(0<x and s[y][x-1]=='.'):
        ansij+=1
        x-=1
    y=i
    x=j
    while(x<w-1 and s[y][x+1]=='.'):
        ansij+=1
        x+=1
    y=i
    x=j
    while(0<y and s[y-1][x]=='.'):
        ansij+=1
        y-=1
    y=i
    x=j
    while(y<h-1 and s[y+1][x]=='.'):
        ansij+=1
        y+=1
    return ansij


ans=0
for i in range(h):
    for j in range(w):
        if(s[i][j]=='.'):
            ansij=search(i, j)
            if(ans<ansij):
#                print(i,j,ansij)
                ans=ansij

print(ans)


Fixed submission:
import numpy as np
h,w=map(int,input().split())
s=[]
for _ in range(h):
    si=input()
    si=si.replace('.', '1')
    si=si.replace('#', '0')
    s.append(list(map(int,si)))
s=np.array(s)

left=np.zeros((h,w))
right=np.zeros((h,w))
up=np.zeros((h,w))
down=np.zeros((h,w))

for i in range(w):
    if(i==0):
        left[:,i]=s[:,i]
        right[:,w-i-1]=s[:,w-i-1]
    else:
        left[:,i]=(left[:,i-1]+1)*s[:,i]
        right[:,w-i-1]=(right[:,w-i]+1)*s[:,w-i-1]

for i in range(h):
    if(i==0):
        down[i,:]=s[i,:]
        up[h-i-1,:]=s[h-i-1,:]
    else:
        down[i,:]=(down[i-1,:]+1)*s[i,:]
        up[h-i-1,:]=(up[h-i,:]+1)*s[h-i-1,:]

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