Buggy python submission (verdict: Time Limit Exceeded):
def MAP(): return map(int,input().split())

H,W = MAP()
lst = [list(input()) for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        #Left
        if lst[i][j]==".":
            L[i][j] = L[i][j-1]+1
        #Up
            U[i][j] = U[i-1][j]+1
        #Right
        if lst[i][-(j+1)]==".":
            R[i][-(j+1)] = R[i][-j]+1
        #Down
        if lst[-(i+1)][j]==".":
            D[-(i+1)][j] = D[-i][j]+1
ans=0
for i in range(H):
    for j in range(W):
        ans = max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)

print(ans)

Fixed submission:
def MAP(): return map(int,input().split())

H,W = MAP()
lst = [list(input()) for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        #Left
        if lst[i][j]==".":
            L[i][j] = L[i][j-1]+1
        #Up
            U[i][j] = U[i-1][j]+1
        #Right
        if lst[i][-(j+1)]==".":
            R[i][-(j+1)] = R[i][-j]+1
        #Down
        if lst[-(i+1)][j]==".":
            D[-(i+1)][j] = D[-i][j]+1
ans=0
for i in range(H):
    for j in range(W):
        ans = max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def MAP(): return map(int,input().split())

H,W = MAP()
lst = [list(input()) for _ in range(H)]
ans=0
for i in range(H):
    for j in range(W):
        tmp=0
        if lst[i][j]=="#":
            continue
        #yoko
        for k in lst[i][j:]:
            if k=="#":
                break
            tmp+=1
        for k in range(j-1,-1,-1):
            if lst[i][k]=="#":
                break
            tmp+=1
        #tate
        for k in range(i,H):
            if lst[k][j]=="#":
                break
            tmp+=1
        for k in range(i-1,-1,-1):
            if lst[k][j]=="#":
                break
            tmp+=1
        ans = max(ans,tmp-1)

print(ans)

Fixed submission:
def MAP(): return map(int,input().split())

H,W = MAP()
lst = [list(input()) for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        #Left
        if lst[i][j]==".":
            L[i][j] = L[i][j-1]+1
        #Up
            U[i][j] = U[i-1][j]+1
        #Right
        if lst[i][-(j+1)]==".":
            R[i][-(j+1)] = R[i][-j]+1
        #Down
        if lst[-(i+1)][j]==".":
            D[-(i+1)][j] = D[-i][j]+1
ans=0
for i in range(H):
    for j in range(W):
        ans = max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def MAP(): return map(int,input().split())

H,W = MAP()
lst = [list(input()) for _ in range(H)]
ans=0
for i in range(H):
    for j in range(W):
        tmp=0
        if lst[i][j]=="#":
            continue
        #yoko
        for k in lst[i][j:]:
            if k=="#":
                break
            tmp+=1
        for k in range(j-1,-1,-1):
            if lst[i][k]=="#":
                break
            tmp+=1
        #tate
        for k in range(i,H):
            if lst[k][j]=="#":
                break
            tmp+=1
        for k in range(i-1,-1,-1):
            if lst[k][j]=="#":
                break
            tmp+=1
        ans = max(ans,tmp-1)

print(ans)

Fixed submission:
def MAP(): return map(int,input().split())

H,W = MAP()
lst = [list(input()) for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        #Left
        if lst[i][j]==".":
            L[i][j] = L[i][j-1]+1
        #Up
            U[i][j] = U[i-1][j]+1
        #Right
        if lst[i][-(j+1)]==".":
            R[i][-(j+1)] = R[i][-j]+1
        #Down
        if lst[-(i+1)][j]==".":
            D[-(i+1)][j] = D[-i][j]+1
ans=0
for i in range(H):
    for j in range(W):
        ans = max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)

print(ans)