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

front_is_air = False
count = 0


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

for i in range(h):
    for j in range(w):
        if front_is_air:
            if s[i][j] == ".":
                count += 1
                left[i][j] = count
            else:
                front_is_air = False
                count = 0

        else:
            if s[i][j] == ".":
                front_is_air = True
                count += 1
                left[i][j] = count

        if j == w-1:
            front_is_air = False
            count = 0


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

for i in range(h):
    for j in range(w-1, -1, -1):
        if front_is_air:
            if s[i][j] == ".":
                count += 1
                right[i][j] = count
            else:
                front_is_air = False
                count = 0

        else:
            if s[i][j] == ".":
                front_is_air = True
                count += 1
                right[i][j] = count

        if j == 0:
            front_is_air = False
            count = 0


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

for i in range(w):
    for j in range(h):
        if front_is_air:
            if s[j][i] == ".":
                count += 1
                up[j][i] = count
            else:
                front_is_air = False
                count = 0

        else:
            if s[j][i] == ".":
                count += 1
                front_is_air = True
                up[j][i] = count

        if j == h-1:
            front_is_air = False
            count = 0


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

for i in range(w):
    for j in range(h-1, -1, -1):
        if front_is_air:
            if s[j][i] == ".":
                count += 1
                down[j][i] = count
            else:
                front_is_air = False
                count = 0

        else:
            if s[j][i] == ".":
                count += 1
                front_is_air = True
                down[j][i] = count

        if j == 0:
            front_is_air = False
            count = 0


memo = []

for i in range(h):
    for j in range(w):
        memo.append(left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3)

print(max(memo))

Fixed submission:
h, w = map(int, input().split())
s = [input() for _ in range(h)]

front_is_air = False
count = 0


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

for i in range(h):
    for j in range(w):
        if front_is_air:
            if s[i][j] == ".":
                count += 1
                left[i][j] = count
            else:
                front_is_air = False
                count = 0

        else:
            if s[i][j] == ".":
                front_is_air = True
                count += 1
                left[i][j] = count

        if j == w-1:
            front_is_air = False
            count = 0


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

for i in range(h):
    for j in range(w-1, -1, -1):
        if front_is_air:
            if s[i][j] == ".":
                count += 1
                right[i][j] = count
            else:
                front_is_air = False
                count = 0

        else:
            if s[i][j] == ".":
                front_is_air = True
                count += 1
                right[i][j] = count

        if j == 0:
            front_is_air = False
            count = 0


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

for i in range(w):
    for j in range(h):
        if front_is_air:
            if s[j][i] == ".":
                count += 1
                up[j][i] = count
            else:
                front_is_air = False
                count = 0

        else:
            if s[j][i] == ".":
                count += 1
                front_is_air = True
                up[j][i] = count

        if j == h-1:
            front_is_air = False
            count = 0


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

for i in range(w):
    for j in range(h-1, -1, -1):
        if front_is_air:
            if s[j][i] == ".":
                count += 1
                down[j][i] = count
            else:
                front_is_air = False
                count = 0

        else:
            if s[j][i] == ".":
                count += 1
                front_is_air = True
                down[j][i] = count

        if j == 0:
            front_is_air = False
            count = 0


memo = []

for i in range(h):
    for j in range(w):
        memo.append(left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3)

print(max(memo))

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

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

front_is_air = False
count = 0

for i in range(h):
    for j in range(w):
        if front_is_air:
            if s[i][j] == ".":
                count += 1
            else:
                for k in range(j-count, j):
                    memo1[i][k] = count
                front_is_air = False
                count = 0

        else:
            if s[i][j] == ".":
                count += 1
                front_is_air = True

        if j == w-1:
            if s[i][j] == ".":
                for k in range(j-count+1, j+1):
                    memo1[i][k] = count
                front_is_air = False
                count = 0


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

for i in range(w):
    for j in range(h):
        if front_is_air:
            if s[j][i] == ".":
                count += 1
            else:
                for k in range(j-count, j):
                    memo2[k][i] = count
                front_is_air = False
                count = 0

        else:
            if s[j][i] == ".":
                count += 1
                front_is_air = True

        if j == h-1:
            if s[j][i] == ".":
                for k in range(j-count+1, j+1):
                    memo2[k][i] = count
                front_is_air = False
                count = 0

memo = []

for i in range(h):
    for j in range(w):
        memo.append(memo1[i][j] + memo2[i][j] - 1)

print(max(memo))

Fixed submission:
h, w = map(int, input().split())
s = [input() for _ in range(h)]

front_is_air = False
count = 0


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

for i in range(h):
    for j in range(w):
        if front_is_air:
            if s[i][j] == ".":
                count += 1
                left[i][j] = count
            else:
                front_is_air = False
                count = 0

        else:
            if s[i][j] == ".":
                front_is_air = True
                count += 1
                left[i][j] = count

        if j == w-1:
            front_is_air = False
            count = 0


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

for i in range(h):
    for j in range(w-1, -1, -1):
        if front_is_air:
            if s[i][j] == ".":
                count += 1
                right[i][j] = count
            else:
                front_is_air = False
                count = 0

        else:
            if s[i][j] == ".":
                front_is_air = True
                count += 1
                right[i][j] = count

        if j == 0:
            front_is_air = False
            count = 0


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

for i in range(w):
    for j in range(h):
        if front_is_air:
            if s[j][i] == ".":
                count += 1
                up[j][i] = count
            else:
                front_is_air = False
                count = 0

        else:
            if s[j][i] == ".":
                count += 1
                front_is_air = True
                up[j][i] = count

        if j == h-1:
            front_is_air = False
            count = 0


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

for i in range(w):
    for j in range(h-1, -1, -1):
        if front_is_air:
            if s[j][i] == ".":
                count += 1
                down[j][i] = count
            else:
                front_is_air = False
                count = 0

        else:
            if s[j][i] == ".":
                count += 1
                front_is_air = True
                down[j][i] = count

        if j == 0:
            front_is_air = False
            count = 0


memo = []

for i in range(h):
    for j in range(w):
        memo.append(left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3)

print(max(memo))