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

grids = []
for _ in range(H):
    grids.append(input())

hr_scores = []
vr_scores = []


max_value = 0
for w in range(W):
    cnt = 0
    start_h = 0
    lis = []
    for h in range(H):    
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (h - start_h) + [0]
            start_h = h + 1
            cnt = 0
    if cnt:
        lis += [cnt] * (h - start_h + 1)
    vr_scores.append(lis)
vr_scores = [[vr_scores[w][h] for w in range(W)] for h in range(H)]
for h in range(H):
    cnt = 0
    start_w = 0
    lis = []
    for w in range(W):
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (w - start_w) + [0]
            if cnt:
                max_value = max(
                    max_value,
                    max(vr_scores[h][start_w: w]) + cnt
                )
            start_w = w + 1
            cnt = 0
    if cnt:
        max_value = max(
            max_value,
            max(vr_scores[h][start_w: w + 1]) + cnt
         )

print(max(max_value - 1, 0))

Fixed submission:
H, W = map(int, input().split())

grids = []
for _ in range(H):
    grids.append(input())

hr_scores = []
vr_scores = []


max_value = 0
for w in range(W):
    cnt = 0
    start_h = 0
    lis = []
    for h in range(H):    
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (h - start_h) + [0]
            start_h = h + 1
            cnt = 0
    if cnt:
        lis += [cnt] * (h - start_h + 1)
    vr_scores.append(lis)
vr_scores = [[vr_scores[w][h] for w in range(W)] for h in range(H)]
for h in range(H):
    cnt = 0
    start_w = 0
    lis = []
    for w in range(W):
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (w - start_w) + [0]
            if cnt:
                max_value = max(
                    max_value,
                    max(vr_scores[h][start_w: w]) + cnt
                )
            start_w = w + 1
            cnt = 0
    if cnt:
        max_value = max(
            max_value,
            max(vr_scores[h][start_w: w + 1]) + cnt
         )

print(max(max_value - 1, 0))

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())

grids = []
for _ in range(H):
    grids.append(input())

grids = np.array(grids)
t_grids = grids.T
hr_scores = np.array([[-1] * W for _ in range(H)])
vr_scores = np.array([[-1] * H for _ in range(W)])

for h in range(H):
    cnt_hr = 0
    cnt_vr = 0
    start_hr = 0
    start_vr = 0
    for w in range(W):
        if grids[h][w] == '.':
            cnt_hr += 1
        else:
            hr_scores[h, w] = 0
            hr_scores[h, start_hr: w] = cnt_hr
            start_hr = w + 1
            cnt_hr = 0
        if t_grids[w][h] == '.':
            cnt_vr += 1
        else:
            vr_scores[h, w] = 0
            vr_scores[h, start_vr: w] = cnt_vr
            start_vr = w + 1
            cnt_vr = 0
    if cnt_hr:
        hr_scores[h, start_hr: w + 1] = cnt_hr
    if cnt_vr:
        vr_scores[h, start_vr: w + 1] = cnt_vr
        
print(max((hr_scores + vr_scores.T).max() - 1, 0))

Fixed submission:
H, W = map(int, input().split())

grids = []
for _ in range(H):
    grids.append(input())

hr_scores = []
vr_scores = []


max_value = 0
for w in range(W):
    cnt = 0
    start_h = 0
    lis = []
    for h in range(H):    
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (h - start_h) + [0]
            start_h = h + 1
            cnt = 0
    if cnt:
        lis += [cnt] * (h - start_h + 1)
    vr_scores.append(lis)
vr_scores = [[vr_scores[w][h] for w in range(W)] for h in range(H)]
for h in range(H):
    cnt = 0
    start_w = 0
    lis = []
    for w in range(W):
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (w - start_w) + [0]
            if cnt:
                max_value = max(
                    max_value,
                    max(vr_scores[h][start_w: w]) + cnt
                )
            start_w = w + 1
            cnt = 0
    if cnt:
        max_value = max(
            max_value,
            max(vr_scores[h][start_w: w + 1]) + cnt
         )

print(max(max_value - 1, 0))

Buggy python submission (verdict: Runtime Error):
import numpy as np

H, W = map(int, input().split())

grids = []
for _ in range(H):
    grids.append(input())

grids = np.array(grids)
t_grids = grids.T
hr_scores = np.array([[-1] * W for _ in range(H)])
vr_scores = np.array([[-1] * H for _ in range(W)])

for h in range(H):
    cnt_hr = 0
    cnt_vr = 0
    start_hr = 0
    start_vr = 0
    for w in range(W):
        if grids[h][w] == '.':
            cnt_hr += 1
        else:
            hr_scores[h, w] = 0
            hr_scores[h, start_hr: w] = cnt_hr
            start_hr = w + 1
            cnt_hr = 0
        if t_grids[w][h] == '.':
            cnt_vr += 1
        else:
            vr_scores[h, w] = 0
            vr_scores[h, start_vr: w] = cnt_vr
            start_vr = w + 1
            cnt_vr = 0
    if cnt_hr:
        hr_scores[h, start_hr: w + 1] = cnt_hr
    if cnt_vr:
        vr_scores[h, start_vr: w + 1] = cnt_vr
        
print(max((hr_scores + vr_scores.T).max() - 1, 0))

Fixed submission:
H, W = map(int, input().split())

grids = []
for _ in range(H):
    grids.append(input())

hr_scores = []
vr_scores = []


max_value = 0
for w in range(W):
    cnt = 0
    start_h = 0
    lis = []
    for h in range(H):    
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (h - start_h) + [0]
            start_h = h + 1
            cnt = 0
    if cnt:
        lis += [cnt] * (h - start_h + 1)
    vr_scores.append(lis)
vr_scores = [[vr_scores[w][h] for w in range(W)] for h in range(H)]
for h in range(H):
    cnt = 0
    start_w = 0
    lis = []
    for w in range(W):
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (w - start_w) + [0]
            if cnt:
                max_value = max(
                    max_value,
                    max(vr_scores[h][start_w: w]) + cnt
                )
            start_w = w + 1
            cnt = 0
    if cnt:
        max_value = max(
            max_value,
            max(vr_scores[h][start_w: w + 1]) + cnt
         )

print(max(max_value - 1, 0))

Buggy python submission (verdict: Runtime Error):
import numpy as np

H, W = map(int, input().split())

grids = []
for _ in range(H):
    grids.append(input())

hr_scores = []
vr_scores = []

for h in range(H):
    cnt = 0
    start_w = 0
    lis = []
    for w in range(W):
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (w - start_w) + [0]
            start_w = w + 1
            cnt = 0
    if cnt:
        lis += [cnt] * (w - start_w + 1)
    hr_scores.append(lis)

for w in range(W):
    cnt = 0
    start_h = 0
    lis = []
    for h in range(H):
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (h - start_h) + [0]
            start_h = h + 1
            cnt = 0
    if cnt:
        lis += [cnt] * (h - start_h + 1)
    vr_scores.append(lis)

hr_scores = np.array(hr_scores)
vr_scores = np.array(vr_scores)
print(max((hr_scores + vr_scores).max() - 1, 0))

Fixed submission:
H, W = map(int, input().split())

grids = []
for _ in range(H):
    grids.append(input())

hr_scores = []
vr_scores = []


max_value = 0
for w in range(W):
    cnt = 0
    start_h = 0
    lis = []
    for h in range(H):    
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (h - start_h) + [0]
            start_h = h + 1
            cnt = 0
    if cnt:
        lis += [cnt] * (h - start_h + 1)
    vr_scores.append(lis)
vr_scores = [[vr_scores[w][h] for w in range(W)] for h in range(H)]
for h in range(H):
    cnt = 0
    start_w = 0
    lis = []
    for w in range(W):
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (w - start_w) + [0]
            if cnt:
                max_value = max(
                    max_value,
                    max(vr_scores[h][start_w: w]) + cnt
                )
            start_w = w + 1
            cnt = 0
    if cnt:
        max_value = max(
            max_value,
            max(vr_scores[h][start_w: w + 1]) + cnt
         )

print(max(max_value - 1, 0))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

H, W = map(int, input().split())

grids = []
for _ in range(H):
    grids.append(input())

hr_scores = np.array([[-1] * W for _ in range(H)])
vr_scores = np.array([[-1] * W for _ in range(H)])

for h in range(H):
    cnt = 0
    start_w = 0
    for w in range(W):
        if grids[h][w] == '.':
            cnt += 1
        else:
            hr_scores[h, w] = 0
            hr_scores[h, start_w: w] = cnt
            start_w = w + 1
            cnt = 0
    if cnt:
        hr_scores[h, start_w: w + 1] = cnt

for w in range(W):
    cnt = 0
    start_h = 0
    for h in range(H):
        if grids[h][w] == '.':
            cnt += 1
        else:
            vr_scores[h, w] = 0
            vr_scores[start_h: h , w] = cnt
            start_h = h + 1
            cnt = 0
    if cnt:
        vr_scores[start_h: h + 1, w] = cnt

print(max((hr_scores + vr_scores).max() - 1, 0))

Fixed submission:
H, W = map(int, input().split())

grids = []
for _ in range(H):
    grids.append(input())

hr_scores = []
vr_scores = []


max_value = 0
for w in range(W):
    cnt = 0
    start_h = 0
    lis = []
    for h in range(H):    
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (h - start_h) + [0]
            start_h = h + 1
            cnt = 0
    if cnt:
        lis += [cnt] * (h - start_h + 1)
    vr_scores.append(lis)
vr_scores = [[vr_scores[w][h] for w in range(W)] for h in range(H)]
for h in range(H):
    cnt = 0
    start_w = 0
    lis = []
    for w in range(W):
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (w - start_w) + [0]
            if cnt:
                max_value = max(
                    max_value,
                    max(vr_scores[h][start_w: w]) + cnt
                )
            start_w = w + 1
            cnt = 0
    if cnt:
        max_value = max(
            max_value,
            max(vr_scores[h][start_w: w + 1]) + cnt
         )

print(max(max_value - 1, 0))