Buggy python submission (verdict: Time Limit Exceeded):
def main():
    H, W = list(map(int, input().split()))
    A = [list(input()) for _ in range(H)]
    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 h in range(H):
        for w in range(W):
            if A[h][w] == '#':
                pass
            else:
                if w == 0:
                    L[h][w] = 1
                else:
                    L[h][w] = L[h][w - 1] + 1
    for h in range(H):
        for w in range(W - 1, -1, -1):
            if A[h][w] == '#':
                pass
            else:
                if w == W - 1:
                    R[h][w] = 1
                else:
                    R[h][w] = R[h][w + 1] + 1
    for w in range(W):
        for h in range(H):
            if A[h][w] == '#':
                pass
            else:
                if h == 0:
                    U[h][w] = 1
                else:
                    U[h][w] = U[h - 1][w] + 1
    for w in range(W):
        for h in range(H - 1, -1, -1):
            if A[h][w] == '#':
                pass
            else:
                if h == H - 1:
                    D[h][w] = 1
                else:
                    D[h][w] = D[h + 1][w] + 1
    ans = 0
    for h in range(H):
        for w in range(W):
            ans = max(ans, L[h][w] + R[h][w] + U[h][w] + D[h][w] - 3)
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np
def main():
    printl = lambda l: [print(x) for x in l]
    H, W = list(map(int, input().split()))
    A = np.array([[1 if i == '.' else 0 for i in input()] for _ in range(H)])
    L = np.zeros((H, W), dtype = np.int)
    R = np.zeros((H, W), dtype = np.int)
    U = np.zeros((H, W), dtype = np.int)
    D = np.zeros((H, W), dtype = np.int)
    L[:, 0] = A[:, 0]
    for w in range(1, W):
        L[:, w] = (L[:, w - 1] + 1) * A[:, w]
    R[:, W - 1] = A[:, W - 1]
    for w in range(W - 2, -1, -1):
        R[:, w] = (R[:, w + 1] + 1) * A[:, w]
    U[0, :] = A[0, :]
    for h in range(1, H):
        U[h, :] = (U[h - 1, :] + 1) * A[h, :]
    D[H - 1, :] = A[H - 1, :]
    for h in range(H - 2, -1, -1):
        D[h, :] = (D[h + 1, :] + 1) * A[h, :]
    print(np.max(L + R + U + D - 3))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product
def main():
    H, W = list(map(int, input().split()))
    A = [['#'] * (W + 2)] + [['#', ] + list(input()) + ['#', ] for _ in range(H)] + [['#'] * (W + 2)]
    DX = [[1, 0], [-1, 0], [0, 1], [0, -1]]
    ans = 0
    for h, w in product(range(1, H + 1), range(1, W + 1)):
        if A[h][w] == '.':
            count = 1
            for (dx, dy) in DX:
                x, y = h, w
                while True:
                    if A[x + dx][y + dy] == '.':
                        x += dx
                        y += dy
                        count += 1
                    else:
                        break
            ans = max(ans, count)
        else:
            continue
    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np
def main():
    printl = lambda l: [print(x) for x in l]
    H, W = list(map(int, input().split()))
    A = np.array([[1 if i == '.' else 0 for i in input()] for _ in range(H)])
    L = np.zeros((H, W), dtype = np.int)
    R = np.zeros((H, W), dtype = np.int)
    U = np.zeros((H, W), dtype = np.int)
    D = np.zeros((H, W), dtype = np.int)
    L[:, 0] = A[:, 0]
    for w in range(1, W):
        L[:, w] = (L[:, w - 1] + 1) * A[:, w]
    R[:, W - 1] = A[:, W - 1]
    for w in range(W - 2, -1, -1):
        R[:, w] = (R[:, w + 1] + 1) * A[:, w]
    U[0, :] = A[0, :]
    for h in range(1, H):
        U[h, :] = (U[h - 1, :] + 1) * A[h, :]
    D[H - 1, :] = A[H - 1, :]
    for h in range(H - 2, -1, -1):
        D[h, :] = (D[h + 1, :] + 1) * A[h, :]
    print(np.max(L + R + U + D - 3))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
from itertools import product
def main():
    H, W = list(map(int, input().split()))
    A = [['#'] * (W + 2)] + [['#', ] + list(input()) + ['#', ] for _ in range(H)] + [['#'] * (W + 2)]
    DX = [[1, 0], [-1, 0], [0, 1], [0, -1]]
    ans = 0
    for h, w in product(range(1, H + 1), range(1, W + 1)):
        if A[h][w] == '.':
            count = 1
            for (dx, dy) in DX:
                stack = deque([[h, w]])
                while stack:
                    x, y = stack.popleft()
                    if A[x + dx][y + dy] == '.':
                        stack.append([x + dx, y + dy])
                        count += 1
                    else:
                        continue
            ans = max(ans, count)
        else:
            continue
    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np
def main():
    printl = lambda l: [print(x) for x in l]
    H, W = list(map(int, input().split()))
    A = np.array([[1 if i == '.' else 0 for i in input()] for _ in range(H)])
    L = np.zeros((H, W), dtype = np.int)
    R = np.zeros((H, W), dtype = np.int)
    U = np.zeros((H, W), dtype = np.int)
    D = np.zeros((H, W), dtype = np.int)
    L[:, 0] = A[:, 0]
    for w in range(1, W):
        L[:, w] = (L[:, w - 1] + 1) * A[:, w]
    R[:, W - 1] = A[:, W - 1]
    for w in range(W - 2, -1, -1):
        R[:, w] = (R[:, w + 1] + 1) * A[:, w]
    U[0, :] = A[0, :]
    for h in range(1, H):
        U[h, :] = (U[h - 1, :] + 1) * A[h, :]
    D[H - 1, :] = A[H - 1, :]
    for h in range(H - 2, -1, -1):
        D[h, :] = (D[h + 1, :] + 1) * A[h, :]
    print(np.max(L + R + U + D - 3))

if __name__ == '__main__':
    main()