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

H = [[0] * w for _ in range(h)]
W = [[0] * w for _ in range(h)]

for i in range(h):
    done = [0] * w
    for j in range(w):
        if lst[i][j] == '#':
            continue
        if done[j]:
            continue
        k = 0
        while lst[i][j+k] != '#':
            done[j+k] = 1
            k += 1  # kが照らせるマスの長さ
            if j+k > w-1:
                break
        for l in range(k):
            H[i][j+l] = k


for j in range(w):
    done = [0] * h
    for i in range(h):
        if lst[i][j] == '#':
            continue
        if done[i]:
            continue
        k = 0
        while lst[i+k][j] != '#':
            done[i+k] = 1
            k += 1  # kが照らせるマスの長さ
            if i+k > h-1:
                break
        for l in range(k):
            W[i+l][j] = k

ans = 0
for i in range(h):
    for j in range(w):
        if lst[i][j] != '#':
            ans = max(ans, H[i][j] + W[i][j] - 1)

print(ans)

Fixed submission:
h, w = map(int, input().split())
lst = [[0] for _ in range(h)]
for i in range(h):
    tmp = list(input())
    lst[i] = tmp

H = [[0] * w for _ in range(h)]
W = [[0] * w for _ in range(h)]

for i in range(h):
    done = [0] * w
    for j in range(w):
        if lst[i][j] == '#':
            continue
        if done[j]:
            continue
        k = 0
        while lst[i][j+k] != '#':
            done[j+k] = 1
            k += 1  # kが照らせるマスの長さ
            if j+k > w-1:
                break
        for l in range(k):
            H[i][j+l] = k


for j in range(w):
    done = [0] * h
    for i in range(h):
        if lst[i][j] == '#':
            continue
        if done[i]:
            continue
        k = 0
        while lst[i+k][j] != '#':
            done[i+k] = 1
            k += 1  # kが照らせるマスの長さ
            if i+k > h-1:
                break
        for l in range(k):
            W[i+l][j] = k

ans = 0
for i in range(h):
    for j in range(w):
        if lst[i][j] != '#':
            ans = max(ans, H[i][j] + W[i][j] - 1)

print(ans)

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

L = [[0] * w for _ in range(h)]
R = [[0] * w for _ in range(h)]
U = [[0] * w for _ in range(h)]
D = [[0] * w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '#':
            continue
        if j == 0:
            L[i][j] = 1
        else:
            if lst[i][j] == '.':
                L[i][j] = L[i][j-1] + 1
            else:
                continue

for i in range(h):
    for j in range(w)[::-1]:
        if lst[i][j] == '#':
            continue
        if j == w-1:
            R[i][j] = 1
        else:
            if lst[i][j] == '.':
                R[i][j] = R[i][j+1] + 1
            else:
                continue

for i in range(h)[::-1]:
    for j in range(w):
        if lst[i][j] == '#':
            continue
        if i == h-1:
            D[i][j] = 1
        else:
            if lst[i][j] == '.':
                D[i][j] = D[i+1][j] + 1
            else:
                continue

for i in range(h):
    for j in range(w):
        if lst[i][j] == '#':
            continue
        if i == 0:
            U[i][j] = 1
        else:
            if lst[i][j] == '.':
                U[i][j] = U[i-1][j] + 1
            else:
                continue

ans = 0
for i in range(h):
    for j in range(w):
        if lst[i][j] != '#':
            tmp = L[i][j] + R[i][j] + D[i][j] + U[i][j] - 3
            ans = max(ans, tmp)

print(ans)

Fixed submission:
h, w = map(int, input().split())
lst = [[0] for _ in range(h)]
for i in range(h):
    tmp = list(input())
    lst[i] = tmp

H = [[0] * w for _ in range(h)]
W = [[0] * w for _ in range(h)]

for i in range(h):
    done = [0] * w
    for j in range(w):
        if lst[i][j] == '#':
            continue
        if done[j]:
            continue
        k = 0
        while lst[i][j+k] != '#':
            done[j+k] = 1
            k += 1  # kが照らせるマスの長さ
            if j+k > w-1:
                break
        for l in range(k):
            H[i][j+l] = k


for j in range(w):
    done = [0] * h
    for i in range(h):
        if lst[i][j] == '#':
            continue
        if done[i]:
            continue
        k = 0
        while lst[i+k][j] != '#':
            done[i+k] = 1
            k += 1  # kが照らせるマスの長さ
            if i+k > h-1:
                break
        for l in range(k):
            W[i+l][j] = k

ans = 0
for i in range(h):
    for j in range(w):
        if lst[i][j] != '#':
            ans = max(ans, H[i][j] + W[i][j] - 1)

print(ans)

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

L = [[0] * w for _ in range(h)]
R = [[0] * w for _ in range(h)]
U = [[0] * w for _ in range(h)]
D = [[0] * w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '#':
            continue
        if j == 0:
            L[i][j] = 1
        else:
            if lst[i][j] == '.':
                L[i][j] = L[i][j-1] + 1
            else:
                continue

for i in range(h):
    for j in range(w)[::-1]:
        if lst[i][j] == '#':
            continue
        if j == w-1:
            R[i][j] = 1
        else:
            if lst[i][j] == '.':
                R[i][j] = R[i][j+1] + 1
            else:
                continue

for i in range(h)[::-1]:
    for j in range(w):
        if lst[i][j] == '#':
            continue
        if i == h-1:
            D[i][j] = 1
        else:
            if lst[i][j] == '.':
                D[i][j] = D[i+1][j] + 1
            else:
                continue

for i in range(h):
    for j in range(w):
        if lst[i][j] == '#':
            continue
        if i == 0:
            U[i][j] = 1
        else:
            if lst[i][j] == '.':
                U[i][j] = U[i-1][j] + 1
            else:
                continue

ans = 0
for i in range(h):
    for j in range(w):
        if lst[i][j] != '#':
            tmp = L[i][j] + R[i][j] + D[i][j] + U[i][j] - 3
            ans = max(ans, tmp)

print(ans)

Fixed submission:
h, w = map(int, input().split())
lst = [[0] for _ in range(h)]
for i in range(h):
    tmp = list(input())
    lst[i] = tmp

H = [[0] * w for _ in range(h)]
W = [[0] * w for _ in range(h)]

for i in range(h):
    done = [0] * w
    for j in range(w):
        if lst[i][j] == '#':
            continue
        if done[j]:
            continue
        k = 0
        while lst[i][j+k] != '#':
            done[j+k] = 1
            k += 1  # kが照らせるマスの長さ
            if j+k > w-1:
                break
        for l in range(k):
            H[i][j+l] = k


for j in range(w):
    done = [0] * h
    for i in range(h):
        if lst[i][j] == '#':
            continue
        if done[i]:
            continue
        k = 0
        while lst[i+k][j] != '#':
            done[i+k] = 1
            k += 1  # kが照らせるマスの長さ
            if i+k > h-1:
                break
        for l in range(k):
            W[i+l][j] = k

ans = 0
for i in range(h):
    for j in range(w):
        if lst[i][j] != '#':
            ans = max(ans, H[i][j] + W[i][j] - 1)

print(ans)