Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

H, W = (int(i) for i in input().split())
#e = [[i for i in input().split()] for i in range(H)]
e = []
for x in range(H):
    e.append(list(input()))

maxcount = 1
for i in range(H):
    for j in range(W):
        #print("start", i, j)
        count = 1
        if e[i][j] == "#":
            continue
        for k in range(i+1, H):
            #print(e[k][j], k, j)
            if e[k][j] == "#":
                #print(k, j)
                break
            else:
                count +=1
        #print("1 ", count)
        for l in range(1, i+1):
            #print(e[i-l][j], i-l, j)
            if e[i-l][j] == "#":
                break
            else:
                count += 1
        #print("2 ", count)
        if count + W -1 < maxcount:
            continue
        for m in range(j+1, W):
            if e[i][m] == "#":
                break
            else:
                count +=1
        #print("3 ",count)
        for n in range(1, j+1):
            if e[i][j-n] == "#":
                break
            else:
                count +=1
        if maxcount < count:
            maxcount = count
        if maxcount == W+H:
            break
    else:
        continue
    break
print(maxcount)


Fixed submission:
import sys
input = sys.stdin.readline

H, W = (int(i) for i in input().split())
#e = [[i for i in input().split()] for i in range(H)]
e = []
for x in range(H):
    e.append(list(input()))

L = [[0] * W for i in [1] * H]
R = [[0] * W for i in [1] * H]
D = [[0] * W for i in [1] * H]
U = [[0] * W for i in [1] * H]
totalmax = 0

for i in range(H):
    for j in range(W):
        if e[i][j] == ".":
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        if e[i][W-1-j] == ".":
            #print(i, W-1-j)
            if W-1-j == W-1:
                R[i][W-1-j] = 1
            else:
                R[i][W-1-j] = R[i][W-j] + 1
                #print(R[i][W-j-2])
            #print(R[i][W-j-1])
        if e[i][j] == ".":
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i-1][j] + 1
        if e[H-1-i][j] == ".":
            if H-1-i == H-1:
                D[H-1-i][j] = 1
            else:
                D[H-1-i][j] = D[H-i][j] + 1

for i in range(H):
    #print("")
    for j in range(W):
        totalmax = max(totalmax, L[i][j]+R[i][j]+D[i][j]+U[i][j]-3)
        #print(L[i][j],R[i][j], D[i][j], U[i][j], end="/")



print(totalmax)

Buggy python submission (verdict: Time Limit Exceeded):
H, W = (int(i) for i in input().split())
#e = [[i for i in input().split()] for i in range(H)]
e = []
for x in range(H):
    e.append(list(input()))

maxcount = 1
for i in range(H):
    for j in range(W):
        #print("start", i, j)
        count = 1
        if e[i][j] == "#":
            continue
        for k in range(i+1, H):
            #print(e[k][j], k, j)
            if e[k][j] == "#":
                #print(k, j)
                break
            else:
                count +=1
        #print("1 ", count)
        for l in range(1, i+1):
            #print(e[i-l][j], i-l, j)
            if e[i-l][j] == "#":
                break
            else:
                count += 1
        #print("2 ", count)
        if count + W -1 < maxcount:
            continue
        for m in range(j+1, W):
            if e[i][m] == "#":
                break
            else:
                count +=1
        #print("3 ",count)
        for n in range(1, j+1):
            if e[i][j-n] == "#":
                break
            else:
                count +=1
        if maxcount < count:
            maxcount = count
        if maxcount == W+H:
            break
    else:
        continue
    break
print(maxcount)


Fixed submission:
import sys
input = sys.stdin.readline

H, W = (int(i) for i in input().split())
#e = [[i for i in input().split()] for i in range(H)]
e = []
for x in range(H):
    e.append(list(input()))

L = [[0] * W for i in [1] * H]
R = [[0] * W for i in [1] * H]
D = [[0] * W for i in [1] * H]
U = [[0] * W for i in [1] * H]
totalmax = 0

for i in range(H):
    for j in range(W):
        if e[i][j] == ".":
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        if e[i][W-1-j] == ".":
            #print(i, W-1-j)
            if W-1-j == W-1:
                R[i][W-1-j] = 1
            else:
                R[i][W-1-j] = R[i][W-j] + 1
                #print(R[i][W-j-2])
            #print(R[i][W-j-1])
        if e[i][j] == ".":
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i-1][j] + 1
        if e[H-1-i][j] == ".":
            if H-1-i == H-1:
                D[H-1-i][j] = 1
            else:
                D[H-1-i][j] = D[H-i][j] + 1

for i in range(H):
    #print("")
    for j in range(W):
        totalmax = max(totalmax, L[i][j]+R[i][j]+D[i][j]+U[i][j]-3)
        #print(L[i][j],R[i][j], D[i][j], U[i][j], end="/")



print(totalmax)

Buggy python submission (verdict: Time Limit Exceeded):
H, W = (int(i) for i in input().split())
#e = [[i for i in input().split()] for i in range(H)]
e = []
for x in range(H):
    e.append(list(input()))

maxcount = 1
for i in range(H):
    for j in range(W):
        #print("start", i, j)
        count = 1
        if e[i][j] == "#":
            continue
        for k in range(i+1, H):
            #print(e[k][j], k, j)
            if e[k][j] == "#":
                #print(k, j)
                break
            else:
                count +=1
        #print("1 ", count)
        for l in range(1, i+1):
            #print(e[i-l][j], i-l, j)
            if e[i-l][j] == "#":
                break
            else:
                count += 1
        #print("2 ", count)
        for m in range(j+1, W):
            if e[i][m] == "#":
                break
            else:
                count +=1
        #print("3 ",count)
        for n in range(1, j+1):
            if e[i][j-n] == "#":
                break
            else:
                count +=1
        if maxcount < count:
            maxcount = count
        #print(count)
print(maxcount)


Fixed submission:
import sys
input = sys.stdin.readline

H, W = (int(i) for i in input().split())
#e = [[i for i in input().split()] for i in range(H)]
e = []
for x in range(H):
    e.append(list(input()))

L = [[0] * W for i in [1] * H]
R = [[0] * W for i in [1] * H]
D = [[0] * W for i in [1] * H]
U = [[0] * W for i in [1] * H]
totalmax = 0

for i in range(H):
    for j in range(W):
        if e[i][j] == ".":
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        if e[i][W-1-j] == ".":
            #print(i, W-1-j)
            if W-1-j == W-1:
                R[i][W-1-j] = 1
            else:
                R[i][W-1-j] = R[i][W-j] + 1
                #print(R[i][W-j-2])
            #print(R[i][W-j-1])
        if e[i][j] == ".":
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i-1][j] + 1
        if e[H-1-i][j] == ".":
            if H-1-i == H-1:
                D[H-1-i][j] = 1
            else:
                D[H-1-i][j] = D[H-i][j] + 1

for i in range(H):
    #print("")
    for j in range(W):
        totalmax = max(totalmax, L[i][j]+R[i][j]+D[i][j]+U[i][j]-3)
        #print(L[i][j],R[i][j], D[i][j], U[i][j], end="/")



print(totalmax)