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

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

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

# left 2 right
for i in range(h):
    for j in range(w):
        if mtx[i][j] == '.':
            ret_mtx[i][j][0] = 1 if i == 0 else ret_mtx[i-1][j][0] + 1
            ret_mtx[i][j][1] = 1 if j == 0 else ret_mtx[i][j-1][1] + 1
        if mtx[-1-i][-1-j] == '.':
            ret_mtx[-1-i][-1-j][2] = 1 if i == 0 else ret_mtx[-i][-1-j][2] + 1
            ret_mtx[-1-i][-1-j][3] = 1 if j == 0 else ret_mtx[-1-i][-j][3] + 1

ret = 0

for i in range(len(ret_mtx)):
    for j in range(len(ret_mtx[i])):
        tmp = sum(ret_mtx[i][j]) - 3
        ret = max(ret, tmp)

print(ret)


Fixed submission:
h, w = map(int, input().split())

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

ret_mtx1 = [[0] * w for _ in range(h)]
ret_mtx2 = [[0] * w for _ in range(h)]
ret_mtx3 = [[0] * w for _ in range(h)]
ret_mtx4 = [[0] * w for _ in range(h)]

# left 2 right
for i in range(h):
    for j in range(w):
        if mtx[i][j] == '.':
            ret_mtx1[i][j] = 1 if i == 0 else ret_mtx1[i-1][j] + 1
            ret_mtx2[i][j] = 1 if j == 0 else ret_mtx2[i][j-1] + 1
        if mtx[-1-i][-1-j] == '.':
            ret_mtx3[-1-i][-1-j] = 1 if i == 0 else ret_mtx3[-i][-1-j] + 1
            ret_mtx4[-1-i][-1-j] = 1 if j == 0 else ret_mtx4[-1-i][-j] + 1

ret = 0

for i in range(h):
    for j in range(w):
        tmp = ret_mtx1[i][j] + ret_mtx2[i][j] + \
            ret_mtx3[i][j] + ret_mtx4[i][j] - 3
        ret = max(ret, tmp)

print(ret)

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

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

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

# left 2 right
for i in range(h):
    for j in range(w):
        if mtx[i][j] == '.':
            ret_mtx[i][j][0] = 1 if i == 0 else ret_mtx[i-1][j][0] + 1
            ret_mtx[i][j][1] = 1 if j == 0 else ret_mtx[i][j-1][1] + 1
        if mtx[-1-i][-1-j] == '.':
            ret_mtx[-1-i][-1-j][2] = 1 if i == 0 else ret_mtx[-i][-1-j][2] + 1
            ret_mtx[-1-i][-1-j][3] = 1 if j == 0 else ret_mtx[-1-i][-j][3] + 1

ret = 0

for i in range(len(ret_mtx)):
    for j in range(len(ret_mtx[i])):
        tmp = sum(ret_mtx[i][j]) - 3
        ret = max(ret, tmp)

print(ret)


Fixed submission:
h, w = map(int, input().split())

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

ret_mtx1 = [[0] * w for _ in range(h)]
ret_mtx2 = [[0] * w for _ in range(h)]
ret_mtx3 = [[0] * w for _ in range(h)]
ret_mtx4 = [[0] * w for _ in range(h)]

# left 2 right
for i in range(h):
    for j in range(w):
        if mtx[i][j] == '.':
            ret_mtx1[i][j] = 1 if i == 0 else ret_mtx1[i-1][j] + 1
            ret_mtx2[i][j] = 1 if j == 0 else ret_mtx2[i][j-1] + 1
        if mtx[-1-i][-1-j] == '.':
            ret_mtx3[-1-i][-1-j] = 1 if i == 0 else ret_mtx3[-i][-1-j] + 1
            ret_mtx4[-1-i][-1-j] = 1 if j == 0 else ret_mtx4[-1-i][-j] + 1

ret = 0

for i in range(h):
    for j in range(w):
        tmp = ret_mtx1[i][j] + ret_mtx2[i][j] + \
            ret_mtx3[i][j] + ret_mtx4[i][j] - 3
        ret = max(ret, tmp)

print(ret)

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

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

for i in range(h):
    s = input()
    for j, ch in enumerate(s):
        mtx[i][j] = 1 if ch == '#' else 0

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

# left 2 right
for i in range(h):
    for j in range(w):
        if mtx[i][j] == 0:
            ret_mtx[i][j][0] = 1 if i == 0 else ret_mtx[i-1][j][0] + 1
            ret_mtx[i][j][1] = 1 if j == 0 else ret_mtx[i][j-1][1] + 1
        if mtx[-1-i][-1-j] == 0:
            ret_mtx[-1-i][-1-j][2] = 1 if i == 0 else ret_mtx[-i][-1-j][2] + 1
            ret_mtx[-1-i][-1-j][3] = 1 if j == 0 else ret_mtx[-1-i][-j][3] + 1

ret = 0

for i in range(len(ret_mtx)):
    for j in range(len(ret_mtx[i])):
        tmp = sum(ret_mtx[i][j]) - 3
        ret = max(ret, tmp)

print(ret)


Fixed submission:
h, w = map(int, input().split())

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

ret_mtx1 = [[0] * w for _ in range(h)]
ret_mtx2 = [[0] * w for _ in range(h)]
ret_mtx3 = [[0] * w for _ in range(h)]
ret_mtx4 = [[0] * w for _ in range(h)]

# left 2 right
for i in range(h):
    for j in range(w):
        if mtx[i][j] == '.':
            ret_mtx1[i][j] = 1 if i == 0 else ret_mtx1[i-1][j] + 1
            ret_mtx2[i][j] = 1 if j == 0 else ret_mtx2[i][j-1] + 1
        if mtx[-1-i][-1-j] == '.':
            ret_mtx3[-1-i][-1-j] = 1 if i == 0 else ret_mtx3[-i][-1-j] + 1
            ret_mtx4[-1-i][-1-j] = 1 if j == 0 else ret_mtx4[-1-i][-j] + 1

ret = 0

for i in range(h):
    for j in range(w):
        tmp = ret_mtx1[i][j] + ret_mtx2[i][j] + \
            ret_mtx3[i][j] + ret_mtx4[i][j] - 3
        ret = max(ret, tmp)

print(ret)

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

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

for i in range(h):
    s = input()
    for j, ch in enumerate(s):
        mtx[i][j] = 1 if ch == '#' else 0

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

# left 2 right
for i in range(h):
    for j in range(w):
        if mtx[i][j] == 1:
            continue
        else:
            ret_mtx[i][j][0] = 1 if i == 0 else ret_mtx[i-1][j][0] + 1
            ret_mtx[i][j][1] = 1 if j == 0 else ret_mtx[i][j-1][1] + 1


for i in range(h):
    for j in range(w):
        if mtx[-1-i][-1-j] == 1:
            continue
        else:
            ret_mtx[-1-i][-1-j][2] = 1 if i == 0 else ret_mtx[-i][-1-j][2] + 1
            ret_mtx[-1-i][-1-j][3] = 1 if j == 0 else ret_mtx[-1-i][-j][3] + 1

ret = 0

for i in range(len(ret_mtx)):
    for j in range(len(ret_mtx[i])):
        tmp = sum(ret_mtx[i][j]) - 3
        ret = max(ret, tmp)

print(ret)


Fixed submission:
h, w = map(int, input().split())

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

ret_mtx1 = [[0] * w for _ in range(h)]
ret_mtx2 = [[0] * w for _ in range(h)]
ret_mtx3 = [[0] * w for _ in range(h)]
ret_mtx4 = [[0] * w for _ in range(h)]

# left 2 right
for i in range(h):
    for j in range(w):
        if mtx[i][j] == '.':
            ret_mtx1[i][j] = 1 if i == 0 else ret_mtx1[i-1][j] + 1
            ret_mtx2[i][j] = 1 if j == 0 else ret_mtx2[i][j-1] + 1
        if mtx[-1-i][-1-j] == '.':
            ret_mtx3[-1-i][-1-j] = 1 if i == 0 else ret_mtx3[-i][-1-j] + 1
            ret_mtx4[-1-i][-1-j] = 1 if j == 0 else ret_mtx4[-1-i][-j] + 1

ret = 0

for i in range(h):
    for j in range(w):
        tmp = ret_mtx1[i][j] + ret_mtx2[i][j] + \
            ret_mtx3[i][j] + ret_mtx4[i][j] - 3
        ret = max(ret, tmp)

print(ret)

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

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

for i in range(h):
    s = input()
    for j, ch in enumerate(s):
        mtx[i][j] = 1 if ch == '#' else 0

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

# left 2 right
for i in range(h):
    for j in range(w):
        if mtx[i][j] == 1:
            continue
        else:
            ret_mtx[i][j][0] = 1 if i == 0 else ret_mtx[i-1][j][0] + 1
            ret_mtx[i][j][1] = 1 if j == 0 else ret_mtx[i][j-1][1] + 1


for i in range(h):
    for j in range(w):
        if mtx[-1-i][-1-j] == 1:
            continue
        else:
            ret_mtx[-1-i][-1-j][2] = 1 if i == 0 else ret_mtx[-i][-1-j][2] + 1
            ret_mtx[-1-i][-1-j][3] = 1 if j == 0 else ret_mtx[-1-i][-j][3] + 1

ret = 0

for i in range(len(ret_mtx)):
    for j in range(len(ret_mtx[i])):
        tmp = sum(ret_mtx[i][j]) - 3
        ret = max(ret, tmp)

print(ret)


Fixed submission:
h, w = map(int, input().split())

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

ret_mtx1 = [[0] * w for _ in range(h)]
ret_mtx2 = [[0] * w for _ in range(h)]
ret_mtx3 = [[0] * w for _ in range(h)]
ret_mtx4 = [[0] * w for _ in range(h)]

# left 2 right
for i in range(h):
    for j in range(w):
        if mtx[i][j] == '.':
            ret_mtx1[i][j] = 1 if i == 0 else ret_mtx1[i-1][j] + 1
            ret_mtx2[i][j] = 1 if j == 0 else ret_mtx2[i][j-1] + 1
        if mtx[-1-i][-1-j] == '.':
            ret_mtx3[-1-i][-1-j] = 1 if i == 0 else ret_mtx3[-i][-1-j] + 1
            ret_mtx4[-1-i][-1-j] = 1 if j == 0 else ret_mtx4[-1-i][-j] + 1

ret = 0

for i in range(h):
    for j in range(w):
        tmp = ret_mtx1[i][j] + ret_mtx2[i][j] + \
            ret_mtx3[i][j] + ret_mtx4[i][j] - 3
        ret = max(ret, tmp)

print(ret)

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

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

for i in range(h):
    s = input()
    for j, ch in enumerate(s):
        mtx[i][j] = 1 if ch == '#' else 0

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

# left 2 right
for i in range(h):
    cur = 0
    for j, ch in enumerate(mtx[i]):
        if mtx[i][j] == 0:
            cur += 1
            ret_mtx[i][j][0] = cur
        else:
            cur = 0

for i in range(h):
    cur = 0
    for j in range(1, w+1):
        if mtx[i][-j] == 0:
            cur += 1
            ret_mtx[i][-j][1] = cur
        else:
            cur = 0

for j in range(w):
    cur = 0
    for i in range(h):
        if mtx[i][j] == 0:
            cur += 1
            ret_mtx[i][j][2] = cur
        else:
            cur = 0

for j in range(w):
    cur = 0
    for i in range(1, h+1):
        if mtx[-i][j] == 0:
            cur += 1
            ret_mtx[-i][j][3] = cur
        else:
            cur = 0

ret = 0

for i in range(len(ret_mtx)):
    for j in range(len(ret_mtx[i])):
        tmp = sum(ret_mtx[i][j]) - 3
        ret = max(ret, tmp)

print(ret)


Fixed submission:
h, w = map(int, input().split())

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

ret_mtx1 = [[0] * w for _ in range(h)]
ret_mtx2 = [[0] * w for _ in range(h)]
ret_mtx3 = [[0] * w for _ in range(h)]
ret_mtx4 = [[0] * w for _ in range(h)]

# left 2 right
for i in range(h):
    for j in range(w):
        if mtx[i][j] == '.':
            ret_mtx1[i][j] = 1 if i == 0 else ret_mtx1[i-1][j] + 1
            ret_mtx2[i][j] = 1 if j == 0 else ret_mtx2[i][j-1] + 1
        if mtx[-1-i][-1-j] == '.':
            ret_mtx3[-1-i][-1-j] = 1 if i == 0 else ret_mtx3[-i][-1-j] + 1
            ret_mtx4[-1-i][-1-j] = 1 if j == 0 else ret_mtx4[-1-i][-j] + 1

ret = 0

for i in range(h):
    for j in range(w):
        tmp = ret_mtx1[i][j] + ret_mtx2[i][j] + \
            ret_mtx3[i][j] + ret_mtx4[i][j] - 3
        ret = max(ret, tmp)

print(ret)

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

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

for i in range(h):
    s = input()
    for j, ch in enumerate(s):
        mtx[i][j] = 1 if ch == '#' else 0

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

# left 2 right
for i in range(h):
    cur = 0
    for j, ch in enumerate(mtx[i]):
        if mtx[i][j] == 0:
            cur += 1
            ret_mtx[i][j][0] = cur
        else:
            cur = 0

for i in range(h):
    cur = 0
    for j in range(1, w+1):
        if mtx[i][-j] == 0:
            cur += 1
            ret_mtx[i][-j][1] = cur
        else:
            cur = 0

for j in range(w):
    cur = 0
    for i in range(h):
        if mtx[i][j] == 0:
            cur += 1
            ret_mtx[i][j][2] = cur
        else:
            cur = 0

for j in range(w):
    cur = 0
    for i in range(1, h+1):
        if mtx[-i][j] == 0:
            cur += 1
            ret_mtx[-i][j][3] = cur
        else:
            cur = 0

ret = 0

for i in range(len(ret_mtx)):
    for j in range(len(ret_mtx[i])):
        tmp = sum(ret_mtx[i][j]) - 3
        ret = max(ret, tmp)

print(ret)


Fixed submission:
h, w = map(int, input().split())

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

ret_mtx1 = [[0] * w for _ in range(h)]
ret_mtx2 = [[0] * w for _ in range(h)]
ret_mtx3 = [[0] * w for _ in range(h)]
ret_mtx4 = [[0] * w for _ in range(h)]

# left 2 right
for i in range(h):
    for j in range(w):
        if mtx[i][j] == '.':
            ret_mtx1[i][j] = 1 if i == 0 else ret_mtx1[i-1][j] + 1
            ret_mtx2[i][j] = 1 if j == 0 else ret_mtx2[i][j-1] + 1
        if mtx[-1-i][-1-j] == '.':
            ret_mtx3[-1-i][-1-j] = 1 if i == 0 else ret_mtx3[-i][-1-j] + 1
            ret_mtx4[-1-i][-1-j] = 1 if j == 0 else ret_mtx4[-1-i][-j] + 1

ret = 0

for i in range(h):
    for j in range(w):
        tmp = ret_mtx1[i][j] + ret_mtx2[i][j] + \
            ret_mtx3[i][j] + ret_mtx4[i][j] - 3
        ret = max(ret, tmp)

print(ret)

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

for i in range(h):
    lis.append(input())

mtx = [[[0] * 2 for i in range(w)] for j in range(h)]

for i in range(len(lis)):
    cnt = 0
    start = 0
    for j in range(w):
        if lis[i][j] == '.':
            cnt += 1
            if j == w - 1:
                for k in range(start, w):
                    mtx[i][k][0] = cnt
        else:
            for k in range(start, j):
                mtx[i][k][0] = cnt
            start = j + 1
            cnt = 0

for i in range(w):
    cnt = 0
    start = 0
    for j in range(h):
        if lis[j][i] == '.':
            cnt += 1
            if j == h - 1:
                for k in range(start, h):
                    mtx[k][i][1] = cnt
        else:
            for k in range(start, j):
                mtx[k][i][1] = cnt
            start = j + 1
            cnt = 0


ret = 0
for i in range(h):
    for j in range(w):
        ret = max(ret, mtx[i][j][0] + mtx[i][j][1] - 1)

print(ret)


Fixed submission:
h, w = map(int, input().split())

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

ret_mtx1 = [[0] * w for _ in range(h)]
ret_mtx2 = [[0] * w for _ in range(h)]
ret_mtx3 = [[0] * w for _ in range(h)]
ret_mtx4 = [[0] * w for _ in range(h)]

# left 2 right
for i in range(h):
    for j in range(w):
        if mtx[i][j] == '.':
            ret_mtx1[i][j] = 1 if i == 0 else ret_mtx1[i-1][j] + 1
            ret_mtx2[i][j] = 1 if j == 0 else ret_mtx2[i][j-1] + 1
        if mtx[-1-i][-1-j] == '.':
            ret_mtx3[-1-i][-1-j] = 1 if i == 0 else ret_mtx3[-i][-1-j] + 1
            ret_mtx4[-1-i][-1-j] = 1 if j == 0 else ret_mtx4[-1-i][-j] + 1

ret = 0

for i in range(h):
    for j in range(w):
        tmp = ret_mtx1[i][j] + ret_mtx2[i][j] + \
            ret_mtx3[i][j] + ret_mtx4[i][j] - 3
        ret = max(ret, tmp)

print(ret)

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

for i in range(h):
    lis.append(input())

mtx = [[[0] * 2 for i in range(w)] for j in range(h)]

for i in range(len(lis)):
    cnt = 0
    start = 0
    for j in range(w):
        if lis[i][j] == '.':
            cnt += 1
            if j == w - 1:
                for k in range(start, w):
                    mtx[i][k][0] = cnt
        else:
            for k in range(start, j):
                mtx[i][k][0] = cnt
            start = j + 1
            cnt = 0

for i in range(w):
    cnt = 0
    start = 0
    for j in range(h):
        if lis[j][i] == '.':
            cnt += 1
            if j == h - 1:
                for k in range(start, h):
                    mtx[k][i][1] = cnt
        else:
            for k in range(start, j):
                mtx[k][i][1] = cnt
            start = j + 1
            cnt = 0


ret = 0
for i in range(h):
    for j in range(w):
        ret = max(ret, mtx[i][j][0] + mtx[i][j][1] - 1)

print(ret)


Fixed submission:
h, w = map(int, input().split())

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

ret_mtx1 = [[0] * w for _ in range(h)]
ret_mtx2 = [[0] * w for _ in range(h)]
ret_mtx3 = [[0] * w for _ in range(h)]
ret_mtx4 = [[0] * w for _ in range(h)]

# left 2 right
for i in range(h):
    for j in range(w):
        if mtx[i][j] == '.':
            ret_mtx1[i][j] = 1 if i == 0 else ret_mtx1[i-1][j] + 1
            ret_mtx2[i][j] = 1 if j == 0 else ret_mtx2[i][j-1] + 1
        if mtx[-1-i][-1-j] == '.':
            ret_mtx3[-1-i][-1-j] = 1 if i == 0 else ret_mtx3[-i][-1-j] + 1
            ret_mtx4[-1-i][-1-j] = 1 if j == 0 else ret_mtx4[-1-i][-j] + 1

ret = 0

for i in range(h):
    for j in range(w):
        tmp = ret_mtx1[i][j] + ret_mtx2[i][j] + \
            ret_mtx3[i][j] + ret_mtx4[i][j] - 3
        ret = max(ret, tmp)

print(ret)