Buggy python submission (verdict: Runtime Error):
import numpy as np


def main():
    h, w = map(int, input().split())
    grid = [input() for _ in range(h)]
    field = np.array([[0] * w for _ in range(h)])

    for i, row in enumerate(grid):
        row = row + "#"
        cnt = row.count("#")

        idx = -1
        for j in range(cnt + 1):
            idx_next = row.find("#", idx + 1)
            field[i][idx+1:idx_next] = idx_next - idx - 1
            idx = idx_next

    m = 0
    field = field.T
    grid_t = zip(*grid)

    for i, row in enumerate(grid_t):
        row = "".join(row) + "#"
        cnt = row.count("#")

        idx = -1
        for j in range(cnt + 1):
            idx_next = row.find("#", idx + 1)
            field[i][idx+1:idx_next] += idx_next - idx - 1
            idx = idx_next
        if max(field[i]) > m:
            m = max(field[i])

    print(m - 1)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    h, w = map(int, input().split())
    grid = [input() for _ in range(h)]
    field = [[0] * w for _ in range(h)]

    for i, row in enumerate(grid):
        row = row + "#"
        cnt = row.count("#")
        idx = -1
        for j in range(cnt + 1):
            idx_next = row.find("#", idx + 1)
            for k in range(idx + 1, idx_next):
                field[i][k] = idx_next - idx - 1
            idx = idx_next

    m = 0
    for i, row in enumerate(zip(*grid)):
        row = "".join(row) + "#"
        cnt = row.count("#")
        idx = -1
        for j in range(cnt + 1):
            idx_next = row.find("#", idx + 1)
            for k in range(idx + 1, idx_next):
                field[k][i] += idx_next - idx - 1
                if field[k][i] > m:
                    m = field[k][i]
            idx = idx_next
    print(m - 1)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


def main():
    h, w = map(int, input().split())
    grid = [input() for _ in range(h)]
    field = np.array([[0] * w for _ in range(h)])

    for i, row in enumerate(grid):
        row = row + "#"
        cnt = row.count("#")

        idx = -1
        for j in range(cnt + 1):
            idx_next = row.find("#", idx + 1)
            field[i][idx+1:idx_next] = idx_next - idx - 1
            idx = idx_next

    m = 0
    field = field.T

    for i, row in enumerate(zip(*grid)):
        row = "".join(row) + "#"
        cnt = row.count("#")

        idx = -1
        for j in range(cnt + 1):
            idx_next = row.find("#", idx + 1)
            field[i][idx+1:idx_next] += idx_next - idx - 1
            idx = idx_next
        if max(field[i]) > m:
            m = max(field[i])

    print(m - 1)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    h, w = map(int, input().split())
    grid = [input() for _ in range(h)]
    field = [[0] * w for _ in range(h)]

    for i, row in enumerate(grid):
        row = row + "#"
        cnt = row.count("#")
        idx = -1
        for j in range(cnt + 1):
            idx_next = row.find("#", idx + 1)
            for k in range(idx + 1, idx_next):
                field[i][k] = idx_next - idx - 1
            idx = idx_next

    m = 0
    for i, row in enumerate(zip(*grid)):
        row = "".join(row) + "#"
        cnt = row.count("#")
        idx = -1
        for j in range(cnt + 1):
            idx_next = row.find("#", idx + 1)
            for k in range(idx + 1, idx_next):
                field[k][i] += idx_next - idx - 1
                if field[k][i] > m:
                    m = field[k][i]
            idx = idx_next
    print(m - 1)


if __name__ == "__main__":
    main()

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

grid = [input() for _ in range(h)]

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

for i, row in enumerate(grid):
    row = row + "#"
    cnt = row.count("#")

    idx = -1
    for j in range(cnt + 1):
        idx_next = row.find("#", idx + 1)
        for k in range(idx + 1, idx_next):
            field[i][k] = idx_next - idx - 1
        idx = idx_next

m = 0
for i, row in enumerate(zip(*grid)):
    row = "".join(row) + "#"
    cnt = row.count("#")

    idx = -1
    for j in range(cnt + 1):
        idx_next = row.find("#", idx + 1)
        for k in range(idx + 1, idx_next):
            field[k][i] += idx_next - idx - 1
            if field[k][i] > m:
                m = field[k][i]
        idx = idx_next

print(m - 1)

Fixed submission:
def main():
    h, w = map(int, input().split())
    grid = [input() for _ in range(h)]
    field = [[0] * w for _ in range(h)]

    for i, row in enumerate(grid):
        row = row + "#"
        cnt = row.count("#")
        idx = -1
        for j in range(cnt + 1):
            idx_next = row.find("#", idx + 1)
            for k in range(idx + 1, idx_next):
                field[i][k] = idx_next - idx - 1
            idx = idx_next

    m = 0
    for i, row in enumerate(zip(*grid)):
        row = "".join(row) + "#"
        cnt = row.count("#")
        idx = -1
        for j in range(cnt + 1):
            idx_next = row.find("#", idx + 1)
            for k in range(idx + 1, idx_next):
                field[k][i] += idx_next - idx - 1
                if field[k][i] > m:
                    m = field[k][i]
            idx = idx_next
    print(m - 1)


if __name__ == "__main__":
    main()