Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
A = [[[0,0] for _ in range(W)] for _ in range(H)]
for i in range(H):
    cnt = 0
    for j in range(W):
        if S[i][j]=="#":
            cnt = 0
        else:
            cnt += 1
            A[i][j][0] = cnt
for i in range(H):
    for j in range(W-1,-1,-1):
        if S[i][j]=="." and j+1<W:
            A[i][j][0] = max(A[i][j][0],A[i][j+1][0])
for j in range(W):
    cnt = 0
    for i in range(H):
        if S[i][j]=="#":
            cnt = 0
        else:
            cnt += 1
            A[i][j][1] = cnt
cmax = 0
for j in range(W):
    for i in range(H-1,-1,-1):
        if S[i][j]=="." and i+1<H:
            A[i][j][1] = max(A[i][j][1],A[i+1][j][1])
        cmax = max(cmax,A[i][j][0]+A[i][j][1]-1)
print(cmax)        

Fixed submission:
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and S[i][j]==".":
            L[i][j] = 1
        elif j>0 and S[i][j]==".":
            L[i][j] = L[i][j-1]+1
        if i==0 and S[i][j]==".":
            U[i][j] = 1
        elif i>0 and S[i][j]==".":
            U[i][j] = U[i-1][j]+1
for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if j==W-1 and S[i][j]==".":
            R[i][j] = 1
        elif j<W-1 and S[i][j]==".":
            R[i][j] = R[i][j+1]+1
        if i==H-1 and S[i][j]==".":
            D[i][j] = 1
        elif i>0 and S[i][j]==".":
            D[i][j] = D[i+1][j]+1
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(cmax)

Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
A = [[[0,0] for _ in range(W)] for _ in range(H)]
for i in range(H):
    cnt = 0
    for j in range(W):
        if S[i][j]=="#":
            cnt = 0
        else:
            cnt += 1
            A[i][j][0] = cnt
for i in range(H):
    for j in range(W-1,-1,-1):
        if S[i][j]=="." and j+1<W:
            A[i][j][0] = max(A[i][j][0],A[i][j+1][0])
for j in range(W):
    cnt = 0
    for i in range(H):
        if S[i][j]=="#":
            cnt = 0
        else:
            cnt += 1
            A[i][j][1] = cnt
for j in range(W):
    for i in range(H-1,-1,-1):
        if S[i][j]=="." and i+1<H:
            A[i][j][1] = max(A[i][j][1],A[i+1][j][1])
B = [[0 for _ in range(W)] for _ in range(H)]
cmax = 0
for i in range(H):
    for j in range(W):
        if S[i][j]==".":
            B[i][j] = A[i][j][0]+A[i][j][1]-1
            cmax = max(cmax,B[i][j])
print(cmax)        

Fixed submission:
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and S[i][j]==".":
            L[i][j] = 1
        elif j>0 and S[i][j]==".":
            L[i][j] = L[i][j-1]+1
        if i==0 and S[i][j]==".":
            U[i][j] = 1
        elif i>0 and S[i][j]==".":
            U[i][j] = U[i-1][j]+1
for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if j==W-1 and S[i][j]==".":
            R[i][j] = 1
        elif j<W-1 and S[i][j]==".":
            R[i][j] = R[i][j+1]+1
        if i==H-1 and S[i][j]==".":
            D[i][j] = 1
        elif i>0 and S[i][j]==".":
            D[i][j] = D[i+1][j]+1
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(cmax)

Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
A = [[[0,0] for _ in range(W)] for _ in range(H)]
for i in range(H):
    cur = 0
    cnt = 0
    for j in range(W):
        if S[i][j]=="#":
            if cnt>0:
                for k in range(cur,j):
                    A[i][k][0] = cnt
            cur=j+1
            cnt = 0
        else:
            cnt += 1
    if cnt>0:
        for k in range(cur,W):
            A[i][k][0] = cnt
for j in range(W):
    cur = 0
    cnt = 0
    for i in range(H):
        if S[i][j]=="#":
            if cnt>0:
                for k in range(cur,i):
                    A[k][j][1] = cnt
            cur = i+1
            cnt = 0
        else:
            cnt += 1
    if cnt>0:
        for k in range(cur,H):
            A[k][j][1] = cnt
B = [[0 for _ in range(W)] for _ in range(H)]
cmax = 0
for i in range(H):
    for j in range(W):
        if S[i][j]==".":
            B[i][j] = A[i][j][0]+A[i][j][1]-1
            cmax = max(cmax,B[i][j])
print(cmax)        

Fixed submission:
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and S[i][j]==".":
            L[i][j] = 1
        elif j>0 and S[i][j]==".":
            L[i][j] = L[i][j-1]+1
        if i==0 and S[i][j]==".":
            U[i][j] = 1
        elif i>0 and S[i][j]==".":
            U[i][j] = U[i-1][j]+1
for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if j==W-1 and S[i][j]==".":
            R[i][j] = 1
        elif j<W-1 and S[i][j]==".":
            R[i][j] = R[i][j+1]+1
        if i==H-1 and S[i][j]==".":
            D[i][j] = 1
        elif i>0 and S[i][j]==".":
            D[i][j] = D[i+1][j]+1
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(cmax)

Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
C = {(i,j):[0,0] for i in range(H) for j in range(W)}
for j in range(W):
    cnt = 0
    for i in range(H):
        if S[i][j]=="#":
            cnt = 0
        else:
            C[(i,j)][0] = cnt+1
            cnt += 1
    for i in range(H-2,-1,-1):
        C[(i,j)][0] = max(C[(i,j)][0],C[(i+1,j)][0])
for i in range(H):
    cnt = 0
    for j in range(W):
        if S[i][j]=="#":
            cnt = 0
        else:
            C[(i,j)][1] = cnt+1
            cnt += 1
    for j in range(W-2,-1,-1):
        C[(i,j)][1] = max(C[(i,j)][1],C[(i,j+1)][1])
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,sum(C[(i,j)]))
print(cmax-1)

Fixed submission:
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and S[i][j]==".":
            L[i][j] = 1
        elif j>0 and S[i][j]==".":
            L[i][j] = L[i][j-1]+1
        if i==0 and S[i][j]==".":
            U[i][j] = 1
        elif i>0 and S[i][j]==".":
            U[i][j] = U[i-1][j]+1
for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if j==W-1 and S[i][j]==".":
            R[i][j] = 1
        elif j<W-1 and S[i][j]==".":
            R[i][j] = R[i][j+1]+1
        if i==H-1 and S[i][j]==".":
            D[i][j] = 1
        elif i>0 and S[i][j]==".":
            D[i][j] = D[i+1][j]+1
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(cmax)

Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
C = {(i,j):[0,0] for i in range(H) for j in range(W)}
for j in range(W):
    cnt = 0
    for i in range(H):
        if S[i][j]=="#":
            cnt = 0
        else:
            C[(i,j)][0] = cnt+1
            cnt += 1
    for i in range(H-2,-1,-1):
        C[(i,j)][0] = max(C[(i,j)][0],C[(i+1,j)][0])
for i in range(H):
    cnt = 0
    for j in range(W):
        if S[i][j]=="#":
            cnt = 0
        else:
            C[(i,j)][1] = cnt+1
            cnt += 1
    for j in range(W-2,-1,-1):
        C[(i,j)][1] = max(C[(i,j)][1],C[(i,j+1)][1])
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,sum(C[(i,j)]))
print(cmax-1)

Fixed submission:
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and S[i][j]==".":
            L[i][j] = 1
        elif j>0 and S[i][j]==".":
            L[i][j] = L[i][j-1]+1
        if i==0 and S[i][j]==".":
            U[i][j] = 1
        elif i>0 and S[i][j]==".":
            U[i][j] = U[i-1][j]+1
for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if j==W-1 and S[i][j]==".":
            R[i][j] = 1
        elif j<W-1 and S[i][j]==".":
            R[i][j] = R[i][j+1]+1
        if i==H-1 and S[i][j]==".":
            D[i][j] = 1
        elif i>0 and S[i][j]==".":
            D[i][j] = D[i+1][j]+1
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(cmax)

Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
C = {(i,j):[0,0] for i in range(H) for j in range(W)}
for j in range(W):
    cnt = 0
    cur = 0
    for i in range(H):
        if S[i][j]=="#":
            for i1 in range(cur,i):
                C[(i1,j)][0] = cnt
            cnt = 0
            cur = i+1
        else:
            cnt += 1
    for i1 in range(cur,H):
        C[(i1,j)][0] = cnt
for i in range(H):
    cnt = 0
    cur = 0
    for j in range(W):
        if S[i][j]=="#":
            for j1 in range(cur,j):
                C[(i,j1)][1] = cnt
            cnt = 0
            cur = j+1
        else:
            cnt += 1
    for j1 in range(cur,W):
        C[(i,j1)][1] = cnt
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,sum(C[(i,j)]))
print(cmax-1)

Fixed submission:
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and S[i][j]==".":
            L[i][j] = 1
        elif j>0 and S[i][j]==".":
            L[i][j] = L[i][j-1]+1
        if i==0 and S[i][j]==".":
            U[i][j] = 1
        elif i>0 and S[i][j]==".":
            U[i][j] = U[i-1][j]+1
for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if j==W-1 and S[i][j]==".":
            R[i][j] = 1
        elif j<W-1 and S[i][j]==".":
            R[i][j] = R[i][j+1]+1
        if i==H-1 and S[i][j]==".":
            D[i][j] = 1
        elif i>0 and S[i][j]==".":
            D[i][j] = D[i+1][j]+1
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(cmax)

Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
A = [[[0,0] for _ in range(W)] for _ in range(H)]
for i in range(H):
    cnt = 0
    for j in range(W):
        if S[i][j]=="#":
            cnt = 0
        else:
            cnt += 1
            A[i][j][0] = cnt
for i in range(H):
    for j in range(W-2,-1,-1):
        A[i][j][0] = 0 if A[i][j][0]==0 else max(A[i][j][0],A[i][j+1][0])
for j in range(W):
    cnt = 0
    for i in range(H):
        if S[i][j]=="#":
            cnt = 0
        else:
            cnt += 1
            A[i][j][1] = cnt
for j in range(W):
    for i in range(H-2,-1,-1):
        A[i][j][1] = 0 if A[i][j][1]==0 else max(A[i][j][1],A[i+1][j][1])
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,sum(A[i][j]))
print(cmax-1)

Fixed submission:
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and S[i][j]==".":
            L[i][j] = 1
        elif j>0 and S[i][j]==".":
            L[i][j] = L[i][j-1]+1
        if i==0 and S[i][j]==".":
            U[i][j] = 1
        elif i>0 and S[i][j]==".":
            U[i][j] = U[i-1][j]+1
for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if j==W-1 and S[i][j]==".":
            R[i][j] = 1
        elif j<W-1 and S[i][j]==".":
            R[i][j] = R[i][j+1]+1
        if i==H-1 and S[i][j]==".":
            D[i][j] = 1
        elif i>0 and S[i][j]==".":
            D[i][j] = D[i+1][j]+1
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(cmax)

Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
A = [[[0,0] for _ in range(W)] for _ in range(H)]
for i in range(H):
    cur = 0
    cnt = 0
    for j in range(W):
        if S[i][j]=="#":
            A[i][j-1][0] = cnt
            cur = j+1
            cnt = 0
        else:
            cnt += 1
        A[i][W-1][0] = cnt
for i in range(H):
    for j in range(W-1,-1,-1):
        if A[i][j][0]>0:
            cnt = A[i][j][0]
        elif S[i][j]!="#":
            A[i][j][0] = cnt
        else:
            cnt = 0
for j in range(W):
    cur = 0
    cnt = 0
    for i in range(H):
        if S[i][j]=="#":
            A[i-1][j][1] = cnt
            cur = i+1
            cnt = 0
        else:
            cnt += 1
    A[H-1][j][1] = cnt
for j in range(W):
    for i in range(H-1,-1,-1):
        if A[i][j][1]>0:
            cnt = A[i][j][1]
        elif S[i][j]!="#":
            A[i][j][1] = cnt
        else:
            cnt = 0
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,sum(A[i][j]))
print(cmax-1)

Fixed submission:
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and S[i][j]==".":
            L[i][j] = 1
        elif j>0 and S[i][j]==".":
            L[i][j] = L[i][j-1]+1
        if i==0 and S[i][j]==".":
            U[i][j] = 1
        elif i>0 and S[i][j]==".":
            U[i][j] = U[i-1][j]+1
for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if j==W-1 and S[i][j]==".":
            R[i][j] = 1
        elif j<W-1 and S[i][j]==".":
            R[i][j] = R[i][j+1]+1
        if i==H-1 and S[i][j]==".":
            D[i][j] = 1
        elif i>0 and S[i][j]==".":
            D[i][j] = D[i+1][j]+1
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(cmax)

Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
A = [[[0,0] for _ in range(W)] for _ in range(H)]
for i in range(H):
    cur = 0
    cnt = 0
    for j in range(W):
        if S[i][j]=="#":
            A[i][j-1][0] = cnt
            cur = j+1
            cnt = 0
        else:
            cnt += 1
        A[i][W-1][0] = cnt
for i in range(H):
    for j in range(W-1,-1,-1):
        if A[i][j][0]>0:
            cnt = A[i][j][0]
        else:
            if S[i][j]!="#":
                A[i][j][0] = cnt
            else:
                cnt = 0
for j in range(W):
    cur = 0
    cnt = 0
    for i in range(H):
        if S[i][j]=="#":
            A[i-1][j][1] = cnt
            cur = i+1
            cnt = 0
        else:
            cnt += 1
    A[H-1][j][1] = cnt
for j in range(W):
    for i in range(H-1,-1,-1):
        if A[i][j][1]>0:
            cnt = A[i][j][1]
        else:
            if S[i][j]!="#":
                A[i][j][1] = cnt
            else:
                cnt = 0
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,sum(A[i][j]))
print(cmax-1)

Fixed submission:
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and S[i][j]==".":
            L[i][j] = 1
        elif j>0 and S[i][j]==".":
            L[i][j] = L[i][j-1]+1
        if i==0 and S[i][j]==".":
            U[i][j] = 1
        elif i>0 and S[i][j]==".":
            U[i][j] = U[i-1][j]+1
for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if j==W-1 and S[i][j]==".":
            R[i][j] = 1
        elif j<W-1 and S[i][j]==".":
            R[i][j] = R[i][j+1]+1
        if i==H-1 and S[i][j]==".":
            D[i][j] = 1
        elif i>0 and S[i][j]==".":
            D[i][j] = D[i+1][j]+1
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(cmax)

Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
A = [[[0,0] for _ in range(W)] for _ in range(H)]
for i in range(H):
    cur = 0
    cnt = 0
    for j in range(W):
        if S[i][j]=="#":
            for k in range(cur,j):
                A[i][k][0] = cnt
            cur = j+1
            cnt = 0
        else:
            cnt += 1
    for k in range(cur,W):
        A[i][k][0] = cnt
for j in range(W):
    cur = 0
    cnt = 0
    for i in range(H):
        if S[i][j]=="#":
            for k in range(cur,i):
                A[k][j][1] = cnt
            cur = i+1
            cnt = 0
        else:
            cnt += 1
    for k in range(cur,H):
        A[k][j][1] = cnt
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,sum(A[i][j]))
print(cmax-1)

Fixed submission:
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and S[i][j]==".":
            L[i][j] = 1
        elif j>0 and S[i][j]==".":
            L[i][j] = L[i][j-1]+1
        if i==0 and S[i][j]==".":
            U[i][j] = 1
        elif i>0 and S[i][j]==".":
            U[i][j] = U[i-1][j]+1
for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if j==W-1 and S[i][j]==".":
            R[i][j] = 1
        elif j<W-1 and S[i][j]==".":
            R[i][j] = R[i][j+1]+1
        if i==H-1 and S[i][j]==".":
            D[i][j] = 1
        elif i>0 and S[i][j]==".":
            D[i][j] = D[i+1][j]+1
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(cmax)

Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
Srow = [[] for _ in range(H)]
for i in range(H):
    cur = 0
    cnt = 0
    for j in range(W):
        if S[i][j]!="#":
            cnt += 1
        else:
            Srow[i].append((cur,j,cnt))
            cnt = 0
            cur = j+1
    if S[i][W-1]!="#":
        Srow[i].append((cur,W,cnt))
Scol = [[] for _ in range(W)]
for j in range(W):
    cur = 0
    cnt = 0
    for i in range(H):
        if S[i][j]!="#":
            cnt += 1
        else:
            Scol[j].append((cur,i,cnt))
            cnt = 0
            cur = i+1
    if S[H-1][j]!="#":
        Scol[j].append((cur,H,cnt))
A = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for x in Srow[i]:
        s,e,cnt = x[0],x[1],x[2]
        for j in range(s,e):
            A[i][j] = cnt
for j in range(W):
    for y in Scol[j]:
        s,e,cnt = y[0],y[1],y[2]
        for i in range(s,e):
            A[i][j] += cnt
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,A[i][j])
print(cmax-1)

Fixed submission:
H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and S[i][j]==".":
            L[i][j] = 1
        elif j>0 and S[i][j]==".":
            L[i][j] = L[i][j-1]+1
        if i==0 and S[i][j]==".":
            U[i][j] = 1
        elif i>0 and S[i][j]==".":
            U[i][j] = U[i-1][j]+1
for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if j==W-1 and S[i][j]==".":
            R[i][j] = 1
        elif j<W-1 and S[i][j]==".":
            R[i][j] = R[i][j+1]+1
        if i==H-1 and S[i][j]==".":
            D[i][j] = 1
        elif i>0 and S[i][j]==".":
            D[i][j] = D[i+1][j]+1
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(cmax)