Buggy python submission (verdict: Time Limit Exceeded):
h, w = [int(i) for i in input().split()]

s = [input() for i in range(h)]

light = [[0 for i in range(w)] for j in range(h)]

for j in range(h):
    point = 0
    for i in range(w):
        if s[j][i] == ".":
            point += 1
            light[j][i] += point
        else:
            point = 0

    point = 0
    for i in range(w):
        if s[j][-1-i] == ".":
            point += 1
            light[j][-1-i] += point
        else:
            point = 0

for j in range(w):
    point = 0
    for i in range(h):
        if s[i][j] == ".":
            point += 1
            light[i][j] += point
        else:
            point = 0

    point = 0
    for i in range(h):
        if s[-1-i][j] == ".":
            point += 1
            light[-1-i][j] += point
        else:
            point = 0

ans = 0
for i in range(h):
    ans = max(ans, max(light[i]))
print(ans-3)

Fixed submission:
h, w = [int(i) for i in input().split()]

s = [input() for i in range(h)]

light = [[0 for i in range(w)] for j in range(h)]

for j in range(h):
    point = 0
    for i in range(w):
        if s[j][i] == ".":
            point += 1
            light[j][i] += point
        else:
            point = 0

    point = 0
    for i in range(w):
        if s[j][-1-i] == ".":
            point += 1
            light[j][-1-i] += point
        else:
            point = 0

for j in range(w):
    point = 0
    for i in range(h):
        if s[i][j] == ".":
            point += 1
            light[i][j] += point
        else:
            point = 0

    point = 0
    for i in range(h):
        if s[-1-i][j] == ".":
            point += 1
            light[-1-i][j] += point
        else:
            point = 0

ans = 0
for i in range(h):
    ans = max(ans, max(light[i]))
print(ans-3)

Buggy python submission (verdict: Time Limit Exceeded):
h, w = [int(i) for i in input().split()]

s = [input() for i in range(h)]

light = [[[0, 0, 0, 0] for i in range(w)] for j in range(h)]

for j in range(h):
    point = 0
    for i in range(w):
        if s[j][i] == ".":
            point += 1
            light[j][i][0] += point
        else:
            point = 0

    point = 0
    for i in range(w):
        if s[j][-1-i] == ".":
            point += 1
            light[j][-1-i][1] += point
        else:
            point = 0

for j in range(w):
    point = 0
    for i in range(h):
        if s[i][j] == ".":
            point += 1
            light[i][j][2] += point
        else:
            point = 0

    point = 0
    for i in range(h):
        if s[-1-i][j] == ".":
            point += 1
            light[-1-i][j][3] += point
        else:
            point = 0

ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, sum(light[i][j]) -3)

print(ans)


Fixed submission:
h, w = [int(i) for i in input().split()]

s = [input() for i in range(h)]

light = [[0 for i in range(w)] for j in range(h)]

for j in range(h):
    point = 0
    for i in range(w):
        if s[j][i] == ".":
            point += 1
            light[j][i] += point
        else:
            point = 0

    point = 0
    for i in range(w):
        if s[j][-1-i] == ".":
            point += 1
            light[j][-1-i] += point
        else:
            point = 0

for j in range(w):
    point = 0
    for i in range(h):
        if s[i][j] == ".":
            point += 1
            light[i][j] += point
        else:
            point = 0

    point = 0
    for i in range(h):
        if s[-1-i][j] == ".":
            point += 1
            light[-1-i][j] += point
        else:
            point = 0

ans = 0
for i in range(h):
    ans = max(ans, max(light[i]))
print(ans-3)

Buggy python submission (verdict: Time Limit Exceeded):
h, w = [int(i) for i in input().split()]

s = [input() for i in range(h)]

light = [[[0, 0, 0, 0] for i in range(w)] for j in range(h)]

for j in range(h):
    point = 0
    for i in range(w):
        if s[j][i] == ".":
            point += 1
            light[j][i][0] += point
        else:
            point = 0

    point = 0
    for i in range(w):
        if s[j][-1-i] == ".":
            point += 1
            light[j][-1-i][1] += point
        else:
            point = 0

for j in range(w):
    point = 0
    for i in range(h):
        if s[i][j] == ".":
            point += 1
            light[i][j][2] += point
        else:
            point = 0

    point = 0
    for i in range(h):
        if s[-1-i][j] == ".":
            point += 1
            light[-1-i][j][3] += point
        else:
            point = 0

ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, sum(light[i][j]) -3)

print(ans)


Fixed submission:
h, w = [int(i) for i in input().split()]

s = [input() for i in range(h)]

light = [[0 for i in range(w)] for j in range(h)]

for j in range(h):
    point = 0
    for i in range(w):
        if s[j][i] == ".":
            point += 1
            light[j][i] += point
        else:
            point = 0

    point = 0
    for i in range(w):
        if s[j][-1-i] == ".":
            point += 1
            light[j][-1-i] += point
        else:
            point = 0

for j in range(w):
    point = 0
    for i in range(h):
        if s[i][j] == ".":
            point += 1
            light[i][j] += point
        else:
            point = 0

    point = 0
    for i in range(h):
        if s[-1-i][j] == ".":
            point += 1
            light[-1-i][j] += point
        else:
            point = 0

ans = 0
for i in range(h):
    ans = max(ans, max(light[i]))
print(ans-3)