Buggy python submission (verdict: Time Limit Exceeded):
def main():
    h, w = map(int, input().split())

    g = [list("#" * (w + 2))]
    for _ in range(h):
        g.append(["#"] + list(input()) + ["#"])
    g += [list("#" * (w + 2))]

    DX = [0, 1, 0, -1]
    DY = [1, 0, -1, 0]

    #print(*g, sep="\n")


    def cnt_dot(k, l):
        if g[k][l] == ".":
            cnt = 1
            for dx, dy in zip(DX, DY):
                x, y = k + dx, l + dy
                while g[x][y] == ".":
                    cnt += 1
                    x, y = x + dx, y + dy
            return cnt
        else:
            return 0


    res = 0
    for i in range(h + 2):
        for j in range(w + 2):
            res = max(res, cnt_dot(i, j))
    print(res)
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    h, w = map(int, input().split())

    g = [list("#" * (w + 2))]
    for _ in range(h):
        g.append(["#"] + list(input()) + ["#"])
    g += [list("#" * (w + 2))]
    area = [[0] * (w + 2) for _ in range(h + 2)]

    for i in range(h + 2):
        cnt = 0
        for j in range(w + 2):
            if g[i][j] == "#":
                for k in range(j - cnt, j):
                    area[i][k] += cnt
                cnt = 0
            else:
                cnt += 1

    for i in range(w + 2):
        cnt = 0
        for j in range(h + 2):
            if g[j][i] == "#":
                for k in range(j - cnt, j):
                    area[k][i] += cnt
                cnt = 0
            else:
                cnt += 1

    res = 0
    for i in range(h + 2):
        for j in range(w + 2):
            res = max(res, area[i][j])
    print(res - 1)
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
h, w = map(int, input().split())

g = [list("#" * (w + 2))]
for _ in range(h):
    g.append(["#"] + list(input()) + ["#"])
g += [list("#" * (w + 2))]

DX = [0, 1, 0, -1]
DY = [1, 0, -1, 0]

#print(*g, sep="\n")


def cnt_dot(k, l):
    if g[k][l] == ".":
        cnt = 1
        for dx, dy in zip(DX, DY):
            x, y = k + dx, l + dy
            while g[x][y] == ".":
                cnt += 1
                x, y = x + dx, y + dy
        return cnt
    else:
        return 0


res = 0
for i in range(h + 2):
    for j in range(w + 2):
        res = max(res, cnt_dot(i, j))
print(res)



Fixed submission:
def main():
    h, w = map(int, input().split())

    g = [list("#" * (w + 2))]
    for _ in range(h):
        g.append(["#"] + list(input()) + ["#"])
    g += [list("#" * (w + 2))]
    area = [[0] * (w + 2) for _ in range(h + 2)]

    for i in range(h + 2):
        cnt = 0
        for j in range(w + 2):
            if g[i][j] == "#":
                for k in range(j - cnt, j):
                    area[i][k] += cnt
                cnt = 0
            else:
                cnt += 1

    for i in range(w + 2):
        cnt = 0
        for j in range(h + 2):
            if g[j][i] == "#":
                for k in range(j - cnt, j):
                    area[k][i] += cnt
                cnt = 0
            else:
                cnt += 1

    res = 0
    for i in range(h + 2):
        for j in range(w + 2):
            res = max(res, area[i][j])
    print(res - 1)
if __name__ == '__main__':
    main()