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

ans=0
tate=[]

for i in range(W):
    c=0
    ad=[]
    while(c<H):
        ad.append(S[c][i])
        c+=1
    tate.append(ad)

left=[]
right=[]
up=[]
down=[]

for i in range(H):
    tmp=S[i]
    cnt=0
    al = [0 for _ in range(W)]
    for j in range(W):
        if tmp[j]==".":
            cnt+=1
            al[j]=cnt
        else:
            cnt=0
    left.append(al)

for i in range(H):
    tmp = S[i]
    tmp=tmp[::-1]
    cnt = 0
    ar = [0 for _ in range(W)]
    for j in range(W):
        if tmp[j] == ".":
            cnt += 1
            ar[j] = cnt
        else:
            cnt = 0
    ar=ar[::-1]
    right.append(ar)

for j in range(W):
    tt=tate[j]
    cnt=0
    bl=[0 for i in range(H)]
    for k in range(H):
        if tt[k]==".":
            cnt+=1
            bl[k]=cnt
        else:
            cnt=0
    up.append(bl)

for j in range(W):
    tt=tate[j]
    tt=tt[::-1]
    cnt=0
    br=[0 for i in range(H)]
    for k in range(H):
        if tt[k]==".":
            cnt+=1
            br[k]=cnt
        else:
            cnt=0
    br=br[::-1]
    down.append(br)

for i in range(H):
    for j in range(W):
        gh=left[i][j]+right[i][j]+up[j][i]+down[j][i]-3
        ans=max(gh,ans)

print(ans)






Fixed submission:
H,W=map(int,input().split())
S=[input() for i in range(H)]

ans=0
tate=[]

for i in range(W):
    c=0
    ad=[]
    while(c<H):
        ad.append(S[c][i])
        c+=1
    tate.append(ad)

left=[]
right=[]
up=[]
down=[]

for i in range(H):
    tmp=S[i]
    cnt=0
    al = [0 for _ in range(W)]
    for j in range(W):
        if tmp[j]==".":
            cnt+=1
            al[j]=cnt
        else:
            cnt=0
    left.append(al)

for i in range(H):
    tmp = S[i]
    tmp=tmp[::-1]
    cnt = 0
    ar = [0 for _ in range(W)]
    for j in range(W):
        if tmp[j] == ".":
            cnt += 1
            ar[j] = cnt
        else:
            cnt = 0
    ar=ar[::-1]
    right.append(ar)

for j in range(W):
    tt=tate[j]
    cnt=0
    bl=[0 for i in range(H)]
    for k in range(H):
        if tt[k]==".":
            cnt+=1
            bl[k]=cnt
        else:
            cnt=0
    up.append(bl)

for j in range(W):
    tt=tate[j]
    tt=tt[::-1]
    cnt=0
    br=[0 for i in range(H)]
    for k in range(H):
        if tt[k]==".":
            cnt+=1
            br[k]=cnt
        else:
            cnt=0
    br=br[::-1]
    down.append(br)

for i in range(H):
    for j in range(W):
        gh=left[i][j]+right[i][j]+up[j][i]+down[j][i]-3
        ans=max(gh,ans)

print(ans)

Buggy python submission (verdict: Runtime Error):
#tempt
h,w=map(int,input().split())
s=[]
for i in range(h):
    g=list(map(str,input().split()))
    s.append(g)

revs=[]
for i in range(h):
    tmp=s[i][::-1]
    revs.append(tmp)

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

    for j in range(1,w-2):
        if s[i][1]=='.':
            left[j]=left[j-1]+1
            count+=1
        else:
            left[j]=0
            count=0
    cnta.append(left)

cntb=[]

for i in range(h):
    right=[0]*w
    count = 0
    if revs[i][0]=='.':
        right[0]=1
        count+=1

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

print(cntb)


Fixed submission:
H,W=map(int,input().split())
S=[input() for i in range(H)]

ans=0
tate=[]

for i in range(W):
    c=0
    ad=[]
    while(c<H):
        ad.append(S[c][i])
        c+=1
    tate.append(ad)

left=[]
right=[]
up=[]
down=[]

for i in range(H):
    tmp=S[i]
    cnt=0
    al = [0 for _ in range(W)]
    for j in range(W):
        if tmp[j]==".":
            cnt+=1
            al[j]=cnt
        else:
            cnt=0
    left.append(al)

for i in range(H):
    tmp = S[i]
    tmp=tmp[::-1]
    cnt = 0
    ar = [0 for _ in range(W)]
    for j in range(W):
        if tmp[j] == ".":
            cnt += 1
            ar[j] = cnt
        else:
            cnt = 0
    ar=ar[::-1]
    right.append(ar)

for j in range(W):
    tt=tate[j]
    cnt=0
    bl=[0 for i in range(H)]
    for k in range(H):
        if tt[k]==".":
            cnt+=1
            bl[k]=cnt
        else:
            cnt=0
    up.append(bl)

for j in range(W):
    tt=tate[j]
    tt=tt[::-1]
    cnt=0
    br=[0 for i in range(H)]
    for k in range(H):
        if tt[k]==".":
            cnt+=1
            br[k]=cnt
        else:
            cnt=0
    br=br[::-1]
    down.append(br)

for i in range(H):
    for j in range(W):
        gh=left[i][j]+right[i][j]+up[j][i]+down[j][i]-3
        ans=max(gh,ans)

print(ans)