Buggy python submission (verdict: Time Limit Exceeded):

import numpy as np
nl = lambda: list(map(int, input().split()))
s = lambda: input()

H, W = nl()
grid = []
for i in range(H):
    grid.append(s())

yokos = np.zeros((H, W), dtype=np.uint64)
for row in range(H):
    count = 0
    prev = 0
    for col in range(W):
        if grid[row][col] == '.':
            count += 1
        else:
            yokos[row, prev:col] = count
            prev = col+1
            count = 0
    if count > 0:
        yokos[row, prev:W] = count

tates = np.zeros((H, W), dtype=np.uint64)
for col in range(W):
    count = 0
    prev = 0
    for row in range(H):
        if grid[row][col] == '.':
            count += 1
        else:
            tates[prev:row, col] = count
            prev = row+1
            count = 0
    if count > 0:
        tates[prev:H, col] = count

res = 0
for row in range(H):
    for col in range(W):
        res = max(res, yokos[row, col] + tates[row, col] - 1)

print(int(res))




Fixed submission:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

H, W = nl()
grid = []
for i in range(H):
    grid.append(s())

ups = [[0]*W for j in range(H)]
downs = [[0]*W for j in range(H)]
lefts = [[0]*W for j in range(H)]
rights = [[0]*W for j in range(H)]

for col in range(W):
    p = 0
    for row in range(H):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        ups[row][col] = p

    p = 0
    for row in range(H-1, -1, -1):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        downs[row][col] = p

for row in range(H):
    p = 0
    for col in range(W):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        lefts[row][col] = p

    p = 0
    for col in range(W-1, -1, -1):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        rights[row][col] = p

res = 0
for row in range(H):
    for col in range(W):
        res = max(res, ups[row][col] + downs[row][col] + lefts[row][col] + rights[row][col] -3)
print(res)

Buggy python submission (verdict: Time Limit Exceeded):

import numpy as np
nl = lambda: list(map(int, input().split()))
s = lambda: input()

H, W = nl()
grid = []
for i in range(H):
    grid.append(s())

yokos = []
for row in range(H):
    count = 0
    yoko = []
    for col in range(W):
        if grid[row][col] == '.':
            count += 1
        else:
            yoko.extend([count] * count)
            yoko.append(0)
            count = 0
    if count > 0:
        yoko.extend([count] * count)
    yokos.append(yoko)


tates = []
for col in range(W):
    count = 0
    tate = []
    for row in range(H):
        if grid[row][col] == '.':
            count += 1
        else:
            tate.extend([count] * count)
            tate.append(0)
            count = 0
    if count > 0:
        tate.extend([count] * count)
    tates.append(tate)

res = 0
for row in range(H):
    for col in range(W):
        res = max(res, yokos[row][col] + tates[col][row] - 1)

print(int(res))




Fixed submission:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

H, W = nl()
grid = []
for i in range(H):
    grid.append(s())

ups = [[0]*W for j in range(H)]
downs = [[0]*W for j in range(H)]
lefts = [[0]*W for j in range(H)]
rights = [[0]*W for j in range(H)]

for col in range(W):
    p = 0
    for row in range(H):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        ups[row][col] = p

    p = 0
    for row in range(H-1, -1, -1):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        downs[row][col] = p

for row in range(H):
    p = 0
    for col in range(W):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        lefts[row][col] = p

    p = 0
    for col in range(W-1, -1, -1):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        rights[row][col] = p

res = 0
for row in range(H):
    for col in range(W):
        res = max(res, ups[row][col] + downs[row][col] + lefts[row][col] + rights[row][col] -3)
print(res)

Buggy python submission (verdict: Time Limit Exceeded):

import numpy as np
nl = lambda: list(map(int, input().split()))
s = lambda: input()

H, W = nl()
grid = []
for i in range(H):
    grid.append(s())


yoko = np.zeros((H, W), dtype=np.uint64)
for row in range(H):
    count = 0
    for col in range(W):
        if grid[row][col] == '.':
            count += 1
            yoko[row][col] = count
        else:
            count = 0

    count = 0
    for col in range(W-1, -1, -1):
        if yoko[row][col] > 0:
            count = max(count, yoko[row][col])
            yoko[row][col] = count
        else:
            count = 0

tate = np.zeros((H, W), dtype=np.uint64)
for col in range(W):
    count = 0
    for row in range(H):
        if grid[row][col] == '.':
            count += 1
            tate[row][col] = count
        else:
            count = 0

    count = 0
    for row in range(H-1, -1, -1):
        if tate[row][col] > 0:
            count = max(count, tate[row][col])
            tate[row][col] = count
        else:
            count = 0

res = 0
for row in range(H):
    for col in range(W):
        res = max(res, yoko[row][col] + tate[row][col] - 1)

print(int(res))




Fixed submission:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

H, W = nl()
grid = []
for i in range(H):
    grid.append(s())

ups = [[0]*W for j in range(H)]
downs = [[0]*W for j in range(H)]
lefts = [[0]*W for j in range(H)]
rights = [[0]*W for j in range(H)]

for col in range(W):
    p = 0
    for row in range(H):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        ups[row][col] = p

    p = 0
    for row in range(H-1, -1, -1):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        downs[row][col] = p

for row in range(H):
    p = 0
    for col in range(W):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        lefts[row][col] = p

    p = 0
    for col in range(W-1, -1, -1):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        rights[row][col] = p

res = 0
for row in range(H):
    for col in range(W):
        res = max(res, ups[row][col] + downs[row][col] + lefts[row][col] + rights[row][col] -3)
print(res)

Buggy python submission (verdict: Time Limit Exceeded):

nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

H, W = nl()
grid = []
for i in range(H):
    grid.append(s())

yoko = [[0] * W for h in range(H)]
for row in range(H):
    count = 0
    for col in range(W):
        if grid[row][col] == '.':
            count += 1
            yoko[row][col] = count
        else:
            count = 0

    count = 0
    for col in range(W-1, -1, -1):
        if yoko[row][col] > 0:
            count = max(count, yoko[row][col])
            yoko[row][col] = count
        else:
            count = 0

tate = [[0] * W for h in range(H)]
for col in range(W):
    count = 0
    for row in range(H):
        if grid[row][col] == '.':
            count += 1
            tate[row][col] = count
        else:
            count = 0

    count = 0
    for row in range(H-1, -1, -1):
        if tate[row][col] > 0:
            count = max(count, tate[row][col])
            tate[row][col] = count
        else:
            count = 0

res = 0
for row in range(H):
    for col in range(W):
        res = max(res, yoko[row][col] + tate[row][col] - 1)

print(res)




Fixed submission:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

H, W = nl()
grid = []
for i in range(H):
    grid.append(s())

ups = [[0]*W for j in range(H)]
downs = [[0]*W for j in range(H)]
lefts = [[0]*W for j in range(H)]
rights = [[0]*W for j in range(H)]

for col in range(W):
    p = 0
    for row in range(H):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        ups[row][col] = p

    p = 0
    for row in range(H-1, -1, -1):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        downs[row][col] = p

for row in range(H):
    p = 0
    for col in range(W):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        lefts[row][col] = p

    p = 0
    for col in range(W-1, -1, -1):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        rights[row][col] = p

res = 0
for row in range(H):
    for col in range(W):
        res = max(res, ups[row][col] + downs[row][col] + lefts[row][col] + rights[row][col] -3)
print(res)

Buggy python submission (verdict: Runtime Error):

nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

H, W = nl()
grid = []
for i in range(H):
    grid.append(s())

yoko = [[0] * W for h in range(H)]
for row in range(H):
    prev = 0
    count = 0
    for col in range(W):
            for i in range(prev, col):
                yoko[row][i] = count
            prev = col+1
            count = 0
        else:
            count += 1
    for i in range(prev, W):
        yoko[row][i] = count

tate = [[0] * W for h in range(H)]
for col in range(W):
    prev = 0
    count = 0
    for row in range(H):
            for i in range(prev, row):
                tate[i][col] = count
            prev = col+1
            count = 0
        else:
            count += 1
    for i in range(prev, H):
        tate[i][col] = count

res = 0
for row in range(H):
    for col in range(W):
        res = max(res, yoko[row][col] + tate[row][col] - 1)

print(res)




Fixed submission:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

H, W = nl()
grid = []
for i in range(H):
    grid.append(s())

ups = [[0]*W for j in range(H)]
downs = [[0]*W for j in range(H)]
lefts = [[0]*W for j in range(H)]
rights = [[0]*W for j in range(H)]

for col in range(W):
    p = 0
    for row in range(H):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        ups[row][col] = p

    p = 0
    for row in range(H-1, -1, -1):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        downs[row][col] = p

for row in range(H):
    p = 0
    for col in range(W):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        lefts[row][col] = p

    p = 0
    for col in range(W-1, -1, -1):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        rights[row][col] = p

res = 0
for row in range(H):
    for col in range(W):
        res = max(res, ups[row][col] + downs[row][col] + lefts[row][col] + rights[row][col] -3)
print(res)