Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
H, W = map(int, input().split())
S = [list(input()) for i in range(H)]

# 横
A = np.array([[-10000] * W for i in range(H)])
B = np.array([[-10000] * W for i in range(H)])

S = np.array(S)
S2 = S.T


A2 = A.T
for j in range(H):
    ii = 0
    s = 0
    for i in range(W+1):
        if i == W or S2[i, j] == '#':
            A2[ii:i, j] = s
            s = 0
            ii = i + 1
        else:
            s += 1
A = A2.T

for j in range(W):
    ii = 0
    s = 0
    for i in range(H+1):
        if i == H or S[i, j] == '#':
            B[ii:i, j] = s
            s = 0
            ii = i + 1
        else:
            s += 1

X = A + B - 1
print(np.max(X))        


Fixed submission:
H, W = map(int, input().split())
S = [list(input()) for i in range(H)]

# 横
A = [[-10000] * W for i in range(H)]
B = [[-10000] * W for i in range(H)]

for i in range(H):
    jj = 0
    s = 0
    for j in range(W+1):
        if j == W or S[i][j] == '#':
            for x in range(jj, j):
                A[i][x] = s
            s = 0
            jj = j + 1
        else:
            s += 1


for j in range(W):
    ii = 0
    s = 0
    for i in range(H+1):
        if i == H or S[i][j] == '#':
            for y in range(ii, i):
	            B[y][j] = s
            s = 0
            ii = i + 1
        else:
            s += 1

m = 0
for i in range(H):
    for j in range(W):
        m = max(A[i][j] + B[i][j] - 1, m)
            
print(m)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
H, W = map(int, input().split())
S = [list(input()) for i in range(H)]

# 横
A = np.array([[-10000] * W for i in range(H)])
B = np.array([[-10000] * W for i in range(H)])

S = np.array(S)
for i in range(H):
    jj = 0
    s = 0
    for j in range(W+1):
        if j == W or S[i, j] == '#':
            A[i, jj:j] = s
            s = 0
            jj = j + 1
        else:
            s += 1

S2 = S.T
B2 = B.T
for i in range(W):
    jj = 0
    s = 0
    for j in range(H+1):
        if j == H or S2[i, j] == '#':
            B2[i, jj:j] = s
            s = 0
            jj = j + 1
        else:
            s += 1

B = B2.T
X = A + B - 1
print(np.max(X))        


Fixed submission:
H, W = map(int, input().split())
S = [list(input()) for i in range(H)]

# 横
A = [[-10000] * W for i in range(H)]
B = [[-10000] * W for i in range(H)]

for i in range(H):
    jj = 0
    s = 0
    for j in range(W+1):
        if j == W or S[i][j] == '#':
            for x in range(jj, j):
                A[i][x] = s
            s = 0
            jj = j + 1
        else:
            s += 1


for j in range(W):
    ii = 0
    s = 0
    for i in range(H+1):
        if i == H or S[i][j] == '#':
            for y in range(ii, i):
	            B[y][j] = s
            s = 0
            ii = i + 1
        else:
            s += 1

m = 0
for i in range(H):
    for j in range(W):
        m = max(A[i][j] + B[i][j] - 1, m)
            
print(m)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
H, W = map(int, input().split())
S = [input() for i in range(H)]

# 横
A = np.array([[-10000] * W for i in range(H)])
B = np.array([[-10000] * W for i in range(H)])


for i in range(H):
    jj = 0
    s = 0
    for j in range(W+1):
        if j == W or S[i][j] == '#':
            A[i, jj:j] = s
            s = 0
            jj = j + 1
        else:
            s += 1

for j in range(W):
    ii = 0
    s = 0
    for i in range(H+1):
        if i == H or S[i][j] == '#':
            B[ii:i, j] = s
            s = 0
            ii = i + 1
        else:
            s += 1

X = A + B - 1
print(np.max(X))        


Fixed submission:
H, W = map(int, input().split())
S = [list(input()) for i in range(H)]

# 横
A = [[-10000] * W for i in range(H)]
B = [[-10000] * W for i in range(H)]

for i in range(H):
    jj = 0
    s = 0
    for j in range(W+1):
        if j == W or S[i][j] == '#':
            for x in range(jj, j):
                A[i][x] = s
            s = 0
            jj = j + 1
        else:
            s += 1


for j in range(W):
    ii = 0
    s = 0
    for i in range(H+1):
        if i == H or S[i][j] == '#':
            for y in range(ii, i):
	            B[y][j] = s
            s = 0
            ii = i + 1
        else:
            s += 1

m = 0
for i in range(H):
    for j in range(W):
        m = max(A[i][j] + B[i][j] - 1, m)
            
print(m)