Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
#ABC129 D

H,W = list(map(int,input().split()))
L = [list(input()) for _ in range(H)]
field = [[True for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
        if L[i][j] == '#':
            field[i][j] = False

A = []

for i in range(H):
    for j in range(W):
        if field[i][j]:
            ans = 1
            for k in range(1,H):
                if i + k < H:
                    if field[i+k][j]:
                        ans += 1
                    else:
                        break
                else:
                    break
            for k in range(1,H):
                if i - k >= 0:
                    if field[i-k][j]:
                        ans += 1
                    else:
                        break
                else:
                    break
            for k in range(1,W):
                if j + k < W:
                    if field[i][j+k]:
                        ans += 1
                    else:
                        break
                else:
                    break
            for k in range(1,W):
                if j - k >= 0:
                    if field[i][j-k]:
                        ans += 1
                    else:
                        break
                else:
                    break
            A.append(ans)
print(max(A))


Fixed submission:
#!/usr/bin/env python3
#ABC129 D

H,W = list(map(int,input().split()))
Lamp = [list(input()) for _ in range(H)]
field = [[True for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
            if Lamp[i][j] == '#':
                field[i][j] = False
L = [[1 for _ in range(W)] for _ in range(H)]
R = [[1 for _ in range(W)] for _ in range(H)]
U = [[1 for _ in range(W)] for _ in range(H)]
D = [[1 for _ in range(W)] for _ in range(H)]
ans = 0
for i in range(H):
    for j in range(W):
        if field[i][j]:
            if i-1 >= 0:
                if field[i-1][j]:
                    D[i][j] = D[i-1][j]+1
            if j-1 >= 0:
                if field[i][j-1]:
                    L[i][j] = L[i][j-1]+1
for i in range(H)[::-1]:
    for j in range(W)[::-1]:
        if field[i][j]:
            if i+1 < H:
                if field[i+1][j]:
                    U[i][j] = U[i+1][j]+1
            if j+1 < W:
                if field[i][j+1]:
                    R[i][j] = R[i][j+1]+1

for i in range(H):
    for j in range(W):
        ans = max(ans,R[i][j]+L[i][j]+U[i][j]+D[i][j]-3)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
#ABC129 D

H,W = list(map(int,input().split()))
L = [list(input()) for _ in range(H)]
field = [[True for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
        if L[i][j] == '#':
            field[i][j] = False

A = []

for i in range(H):
    for j in range(W):
        if field[i][j]:
            ans = 1
            for k in range(1,H):
                if i + k < H:
                    if field[i+k][j]:
                        ans += 1
                    else:
                        break
                else:
                    break
            for k in range(1,H):
                if i - k >= 0:
                    if field[i-k][j]:
                        ans += 1
                    else:
                        break
                else:
                    break
            for k in range(1,W):
                if j + k < W:
                    if field[i][j+k]:
                        ans += 1
                    else:
                        break
                else:
                    break
            for k in range(1,W):
                if j - k >= 0:
                    if field[i][j-k]:
                        ans += 1
                    else:
                        break
                else:
                    break
            A.append(ans)
print(max(A))


Fixed submission:
#!/usr/bin/env python3
#ABC129 D

H,W = list(map(int,input().split()))
Lamp = [list(input()) for _ in range(H)]
field = [[True for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
            if Lamp[i][j] == '#':
                field[i][j] = False
L = [[1 for _ in range(W)] for _ in range(H)]
R = [[1 for _ in range(W)] for _ in range(H)]
U = [[1 for _ in range(W)] for _ in range(H)]
D = [[1 for _ in range(W)] for _ in range(H)]
ans = 0
for i in range(H):
    for j in range(W):
        if field[i][j]:
            if i-1 >= 0:
                if field[i-1][j]:
                    D[i][j] = D[i-1][j]+1
            if j-1 >= 0:
                if field[i][j-1]:
                    L[i][j] = L[i][j-1]+1
for i in range(H)[::-1]:
    for j in range(W)[::-1]:
        if field[i][j]:
            if i+1 < H:
                if field[i+1][j]:
                    U[i][j] = U[i+1][j]+1
            if j+1 < W:
                if field[i][j+1]:
                    R[i][j] = R[i][j+1]+1

for i in range(H):
    for j in range(W):
        ans = max(ans,R[i][j]+L[i][j]+U[i][j]+D[i][j]-3)
print(ans)