Buggy python submission (verdict: Time Limit Exceeded):
# D - Lamp

from numpy import zeros, max

H, W = map(int, input().split())
M = [[str(m) for m in input()] for _ in range(H)]
U = zeros((H, W), dtype=int)
L = zeros((H, W), dtype=int)
D = zeros((H, W), dtype=int)
R = zeros((H, W), dtype=int)

for i in range(H):
    for j in range(W):
        if M[i][j] != '#':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i - 1][j] + 1
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j - 1] + 1

        k, l = H - i - 1, W - j - 1
        if M[k][l] != '#':
            if i == 0:
                D[k][l] = 1
            else:
                D[k][l] = D[k + 1][l] + 1
            if j == 0:
                R[k][l] = 1
            else:
                R[k][l] = R[k][l + 1] + 1

print(max(U + L + D + R - 3))


Fixed submission:
# # D - Lamp

import numpy as np

H, W = map(int, input().split())
M = [list(input()) for _ in range(H)]
M = (np.array(M) == '.') * 1

L = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)
D = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)

for i in range(W):
    if i == 0:
        L[:, i] = M[:, i]
        R[:, W - i - 1] = M[:, W - i - 1]
    else:
        L[:, i] = (L[:, i - 1] + 1) * M[:, i]
        R[:, W - i - 1] = (R[:, W - i] + 1) * M[:, W - i - 1]

for i in range(H):
    if i == 0:
        U[i, :] = M[i, :]
        D[H - i - 1, :] = M[H - i - 1, :]
    else:
        U[i, :] = (U[i - 1, :] + 1) * M[i, :]
        D[H - i - 1, :] = (D[H - i, :] + 1) * M[H - i - 1, :]

print(max(np.max(L + R + D + U - 3), 0))

Buggy python submission (verdict: Time Limit Exceeded):
# D - Lamp

from numpy import zeros

H, W = map(int, input().split())
M = [[str(m) for m in input()] for _ in range(H)]
U = zeros((H, W), dtype=int)
L = zeros((H, W), dtype=int)
D = zeros((H, W), dtype=int)
R = zeros((H, W), dtype=int)

for i in range(H):
    for j in range(W):
        if M[i][j] != '#':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i - 1][j] + 1
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j - 1] + 1

        k, l = H - i - 1, W - j - 1
        if M[k][l] != '#':
            if i == 0:
                D[k][l] = 1
            else:
                D[k][l] = D[k + 1][l] + 1
            if j == 0:
                R[k][l] = 1
            else:
                R[k][l] = R[k][l + 1] + 1

ans = 0
for i in range(H):
    for j in range(W):
        p = U[i][j] + L[i][j] + D[i][j] + R[i][j] - 3
        ans = max(ans, p)

print(ans)


Fixed submission:
# # D - Lamp

import numpy as np

H, W = map(int, input().split())
M = [list(input()) for _ in range(H)]
M = (np.array(M) == '.') * 1

L = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)
D = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)

for i in range(W):
    if i == 0:
        L[:, i] = M[:, i]
        R[:, W - i - 1] = M[:, W - i - 1]
    else:
        L[:, i] = (L[:, i - 1] + 1) * M[:, i]
        R[:, W - i - 1] = (R[:, W - i] + 1) * M[:, W - i - 1]

for i in range(H):
    if i == 0:
        U[i, :] = M[i, :]
        D[H - i - 1, :] = M[H - i - 1, :]
    else:
        U[i, :] = (U[i - 1, :] + 1) * M[i, :]
        D[H - i - 1, :] = (D[H - i, :] + 1) * M[H - i - 1, :]

print(max(np.max(L + R + D + U - 3), 0))

Buggy python submission (verdict: Time Limit Exceeded):
# D - Lamp

H, W = map(int, input().split())
M = [[str(m) for m in input()] for _ in range(H)]
U = [[0] * W for _ in range(H)]
L = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]

for i in range(H):
    for j in range(W):
        if M[i][j] != '#':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i - 1][j] + 1
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j - 1] + 1

        k, l = H - i - 1, W - j - 1
        if M[k][l] != '#':
            if i == 0:
                D[k][l] = 1
            else:
                D[k][l] = D[k + 1][l] + 1
            if j == 0:
                R[k][l] = 1
            else:
                R[k][l] = R[k][l + 1] + 1

ans = 0
for i in range(H):
    for j in range(W):
        p = U[i][j] + L[i][j] + D[i][j] + R[i][j] - 3
        ans = max(ans, p)

print(ans)


Fixed submission:
# # D - Lamp

import numpy as np

H, W = map(int, input().split())
M = [list(input()) for _ in range(H)]
M = (np.array(M) == '.') * 1

L = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)
D = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)

for i in range(W):
    if i == 0:
        L[:, i] = M[:, i]
        R[:, W - i - 1] = M[:, W - i - 1]
    else:
        L[:, i] = (L[:, i - 1] + 1) * M[:, i]
        R[:, W - i - 1] = (R[:, W - i] + 1) * M[:, W - i - 1]

for i in range(H):
    if i == 0:
        U[i, :] = M[i, :]
        D[H - i - 1, :] = M[H - i - 1, :]
    else:
        U[i, :] = (U[i - 1, :] + 1) * M[i, :]
        D[H - i - 1, :] = (D[H - i, :] + 1) * M[H - i - 1, :]

print(max(np.max(L + R + D + U - 3), 0))

Buggy python submission (verdict: Time Limit Exceeded):
# D - Lamp

H, W = map(int, input().split())
M = [[str(m) for m in input()] for _ in range(H)]
U = [[0] * W for _ in range(H)]
L = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]

for i in range(H):
    for j in range(W):
        if M[i][j] != '#':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i - 1][j] + 1
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j - 1] + 1

        if M[H - i - 1][W - j - 1] != '#':
            if i == 0:
                D[H - i - 1][W - j - 1] = 1
            else:
                D[H - i - 1][W - j - 1] = D[H - i][W - j - 1] + 1
            if j == 0:
                R[H - i - 1][W - j - 1] = 1
            else:
                R[H - i - 1][W - j - 1] = R[H - i - 1][W - j] + 1

ans = 0
for i in range(H):
    for j in range(W):
        p = U[i][j] + L[i][j] + D[i][j] + R[i][j] - 3
        ans = max(ans, p)

print(ans)


Fixed submission:
# # D - Lamp

import numpy as np

H, W = map(int, input().split())
M = [list(input()) for _ in range(H)]
M = (np.array(M) == '.') * 1

L = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)
D = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)

for i in range(W):
    if i == 0:
        L[:, i] = M[:, i]
        R[:, W - i - 1] = M[:, W - i - 1]
    else:
        L[:, i] = (L[:, i - 1] + 1) * M[:, i]
        R[:, W - i - 1] = (R[:, W - i] + 1) * M[:, W - i - 1]

for i in range(H):
    if i == 0:
        U[i, :] = M[i, :]
        D[H - i - 1, :] = M[H - i - 1, :]
    else:
        U[i, :] = (U[i - 1, :] + 1) * M[i, :]
        D[H - i - 1, :] = (D[H - i, :] + 1) * M[H - i - 1, :]

print(max(np.max(L + R + D + U - 3), 0))

Buggy python submission (verdict: Time Limit Exceeded):
# D - Lamp

H, W = map(int, input().split())
M = [[str(m) for m in input()] for _ in range(H)]
U = [[0] * W for _ in range(H)]
L = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]

for i in reversed(range(H)):
    for j in reversed(range(W)):
        if M[i][j] == '#':
            continue

        if i == H - 1:
            D[i][j] = 1
        else:
            D[i][j] = D[i + 1][j] + 1

        if j == W - 1:
            R[i][j] = 1
        else:
            R[i][j] = R[i][j + 1] + 1

mx = 0
for i in range(H):
    for j in range(W):
        if M[i][j] == '#':
            continue

        if i == 0:
            U[i][j] = 1
        else:
            U[i][j] = U[i - 1][j] + 1

        if j == 0:
            L[i][j] = 1
        else:
            L[i][j] = L[i][j - 1] + 1

        p = U[i][j] + L[i][j] + D[i][j] + R[i][j] - 3
        mx = max(mx, p)

# mx = 0
# for i in range(H):
#     for j in range(H):
#         p = U[i][j] + L[i][j] + D[i][j] + R[i][j] - 3
#         mx = max(mx, p)

print(mx)


Fixed submission:
# # D - Lamp

import numpy as np

H, W = map(int, input().split())
M = [list(input()) for _ in range(H)]
M = (np.array(M) == '.') * 1

L = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)
D = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)

for i in range(W):
    if i == 0:
        L[:, i] = M[:, i]
        R[:, W - i - 1] = M[:, W - i - 1]
    else:
        L[:, i] = (L[:, i - 1] + 1) * M[:, i]
        R[:, W - i - 1] = (R[:, W - i] + 1) * M[:, W - i - 1]

for i in range(H):
    if i == 0:
        U[i, :] = M[i, :]
        D[H - i - 1, :] = M[H - i - 1, :]
    else:
        U[i, :] = (U[i - 1, :] + 1) * M[i, :]
        D[H - i - 1, :] = (D[H - i, :] + 1) * M[H - i - 1, :]

print(max(np.max(L + R + D + U - 3), 0))

Buggy python submission (verdict: Runtime Error):
# D - Lamp

H, W = map(int, input().split())
M = [[str(m) for m in input()] for _ in range(H)]
U = [[0] * W for _ in range(H)]
L = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if i == 0 and M[i][j] != '#':
            U[i][j] = 1
        if j == 0 and M[i][j] != '#':
            L[i][j] = 1
        if i != 0 and j != 0 and M[i][j] != '#':
            U[i][j] = U[i - 1][j] + 1
            L[i][j] = L[i][j - 1] + 1

for i in reversed(range(H)):
    for j in reversed(range(W)):
        if i == H - 1 and M[i][j] != '#':
            D[i][j] = 1
        if j == W - 1 and M[i][j] != '#':
            R[i][j] = 1
        if i != H - 1 and j != W - 1 and M[i][j] != '#':
            D[i][j] = D[i + 1][j] + 1
            R[i][j] = R[i][j + 1] + 1

mx = 0
for i in range(H):
    for j in range(H):
        p = U[i][j] + L[i][j] + D[i][j] + R[i][j] - 3
        mx = max(mx, p)

print(mx)


Fixed submission:
# # D - Lamp

import numpy as np

H, W = map(int, input().split())
M = [list(input()) for _ in range(H)]
M = (np.array(M) == '.') * 1

L = np.zeros((H, W), dtype=int)
R = np.zeros((H, W), dtype=int)
D = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)

for i in range(W):
    if i == 0:
        L[:, i] = M[:, i]
        R[:, W - i - 1] = M[:, W - i - 1]
    else:
        L[:, i] = (L[:, i - 1] + 1) * M[:, i]
        R[:, W - i - 1] = (R[:, W - i] + 1) * M[:, W - i - 1]

for i in range(H):
    if i == 0:
        U[i, :] = M[i, :]
        D[H - i - 1, :] = M[H - i - 1, :]
    else:
        U[i, :] = (U[i - 1, :] + 1) * M[i, :]
        D[H - i - 1, :] = (D[H - i, :] + 1) * M[H - i - 1, :]

print(max(np.max(L + R + D + U - 3), 0))