Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
lst = []
for i in range(h):
    lst.append(list(input()))

R = [[0]*w for _ in range(h)]
L = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        

for i in range(h):
    for j in range(w-1, -1, -1):
        if lst[i][j] == '.':
            if j == w-1:
                R[i][j] = 1
            else:
                R[i][j] = R[i][j-1] + 1            

     
for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i][j-1] + 1

for i in range(h-1, -1, -1):
    for j in range(w):
        if lst[i][j] == '.':
            if i == h-1:
                D[i][j] = 1
            else:
                D[i][j] = D[i][j-1] + 1

ans = 0
x = [[0]*w for _ in range(h)]
for i in range (h):
    for j in range(w):
        x[i][j] = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
    ans = max(ans, max(x[i])
print(ans) 

Fixed submission:
h, w = map(int, input().split())
lst = []
for i in range(h):
    lst.append(list(input()))

R = [[0]*w for _ in range(h)]
L = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        

for i in range(h):
    for j in range(w-1, -1, -1):
        if lst[i][j] == '.':
            if j == w-1:
                R[i][j] = 1
            else:
                R[i][j] = R[i][j+1] + 1            


for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i-1][j] + 1

for i in range(h-1, -1, -1):
    for j in range(w):
        if lst[i][j] == '.':
            if i == h-1:
                D[i][j] = 1
            else:
                D[i][j] = D[i+1][j] + 1

ans = 0
x = [[0]*w for _ in range(h)]
for i in range (h):
    for j in range(w):
        x[i][j] = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
    ans = max(ans, max(x[i]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
h, w = map(int, input().split())
lst = []
for i in range(h):
    lst.append(list(input()))

R = [[0]*w for _ in range(h)]
L = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        

for i in range(h):
    for j in range(w-1, -1, -1):
        if lst[i][j] == '.':
            if j == w-1:
                R[i][j] = 1
            else:
                R[i][j] = R[i][j+1] + 1            


for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i-1][j] + 1

for i in range(h-1, -1, -1):
    for j in range(w):
        if lst[i][j] == '.':
            if i == h-1:
                D[i][j] = 1
            else:
                D[i][j] = D[i+1][j] + 1

ans = 0
x = [[0]*w for _ in range(h)]
for i in range (h):
    for j in range(w):
        x[i][j] = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
    ans = max(ans, max(x[i]))
print(ans) 

Fixed submission:
h, w = map(int, input().split())
lst = []
for i in range(h):
    lst.append(list(input()))

R = [[0]*w for _ in range(h)]
L = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        

for i in range(h):
    for j in range(w-1, -1, -1):
        if lst[i][j] == '.':
            if j == w-1:
                R[i][j] = 1
            else:
                R[i][j] = R[i][j+1] + 1            


for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i-1][j] + 1

for i in range(h-1, -1, -1):
    for j in range(w):
        if lst[i][j] == '.':
            if i == h-1:
                D[i][j] = 1
            else:
                D[i][j] = D[i+1][j] + 1

ans = 0
x = [[0]*w for _ in range(h)]
for i in range (h):
    for j in range(w):
        x[i][j] = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
    ans = max(ans, max(x[i]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
h, w = map(int, input().split())
lst = []
for i in range(h):
    lst.append(list(input()))

R = [[0]*w for _ in range(h)]
L = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        

for i in range(h):
    for j in range(w-1, -1, -1):
        if lst[i][j] == '.':
            if j == w-1:
                R[i][j] = 1
            else:
                R[i][j] = R[i][j+1] + 1            


for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i-1][j] + 1

for i in range(h-1, -1, -1):
    for j in range(w):
        if lst[i][j] == '.':
            if i == h-1:
                D[i][j] = 1
            else:
                D[i][j] = D[i+1][j] + 1

ans = 0
x = [[0]*w for _ in range(h)]
for i in range (h):
    for j in range(w):
        x[i][j] = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
        ans = max(ans, max(x[i]))
print(ans) 

Fixed submission:
h, w = map(int, input().split())
lst = []
for i in range(h):
    lst.append(list(input()))

R = [[0]*w for _ in range(h)]
L = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        

for i in range(h):
    for j in range(w-1, -1, -1):
        if lst[i][j] == '.':
            if j == w-1:
                R[i][j] = 1
            else:
                R[i][j] = R[i][j+1] + 1            


for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i-1][j] + 1

for i in range(h-1, -1, -1):
    for j in range(w):
        if lst[i][j] == '.':
            if i == h-1:
                D[i][j] = 1
            else:
                D[i][j] = D[i+1][j] + 1

ans = 0
x = [[0]*w for _ in range(h)]
for i in range (h):
    for j in range(w):
        x[i][j] = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
    ans = max(ans, max(x[i]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
h, w = map(int, input().split())
lst = []
for i in range(h):
    lst.append(list(input()))

R = [[0]*w for _ in range(h)]
L = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        

for i in range(h):
    for j in range(w-1, -1, -1):
        if lst[i][j] == '.':
            if j == w-1:
                R[i][j] = 1
            else:
                R[i][j] = R[i][j+1] + 1            


for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i-1][j] + 1

for i in range(h-1, -1, -1):
    for j in range(w):
        if lst[i][j] == '.':
            if i == h-1:
                D[i][j] = 1
            else:
                D[i][j] = D[i+1][j] + 1

ans = 0
x = [[0]*w for _ in range(h)]
for i in range (h):
    for j in range(w):
        x[i][j] = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
        ans = max(ans, max(x[i]))
print(ans) 

Fixed submission:
h, w = map(int, input().split())
lst = []
for i in range(h):
    lst.append(list(input()))

R = [[0]*w for _ in range(h)]
L = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        

for i in range(h):
    for j in range(w-1, -1, -1):
        if lst[i][j] == '.':
            if j == w-1:
                R[i][j] = 1
            else:
                R[i][j] = R[i][j+1] + 1            


for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i-1][j] + 1

for i in range(h-1, -1, -1):
    for j in range(w):
        if lst[i][j] == '.':
            if i == h-1:
                D[i][j] = 1
            else:
                D[i][j] = D[i+1][j] + 1

ans = 0
x = [[0]*w for _ in range(h)]
for i in range (h):
    for j in range(w):
        x[i][j] = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
    ans = max(ans, max(x[i]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
h, w = map(int, input().split())
lst = []
for i in range(h):
    lst.append(list(input()))

R = [[0]*w for _ in range(h)]
L = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        

for i in range(h):
    for j in range(w-1, -1, -1):
        if lst[i][j] == '.':
            if j == w-1:
                R[i][j] = 1
            else:
                R[i][j] = R[i][j+1] + 1            


for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i-1][j] + 1

for i in range(h-1, -1, -1):
    for j in range(w):
        if lst[i][j] == '.':
            if i == h-1:
                D[i][j] = 1
            else:
                D[i][j] = D[i+1][j] + 1

ans = 0
x = [[0]*w for _ in range(h)]
for i in range (h):
    for j in range(w):
        x[i][j] = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
        ans = max(ans, x[i][j])
print(ans) 

Fixed submission:
h, w = map(int, input().split())
lst = []
for i in range(h):
    lst.append(list(input()))

R = [[0]*w for _ in range(h)]
L = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        

for i in range(h):
    for j in range(w-1, -1, -1):
        if lst[i][j] == '.':
            if j == w-1:
                R[i][j] = 1
            else:
                R[i][j] = R[i][j+1] + 1            


for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i-1][j] + 1

for i in range(h-1, -1, -1):
    for j in range(w):
        if lst[i][j] == '.':
            if i == h-1:
                D[i][j] = 1
            else:
                D[i][j] = D[i+1][j] + 1

ans = 0
x = [[0]*w for _ in range(h)]
for i in range (h):
    for j in range(w):
        x[i][j] = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
    ans = max(ans, max(x[i]))
print(ans)