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

light_space = [[1 for i in range(w)] for j in range(h)]
max_light = 0
for i in range(w):
    light = -1
    light_right = -1
    for j in range(h):
        low_point = len(space)-j-1

        if space[j][i] == "#":
            light = -1
            light_space[j][i] = 0
        else:
            light += 1
            light_space[j][i] += light

        if space[low_point][i] == "#":
            light_right = -1
            light_space[low_point][i] = 0
        else:
            light_right += 1
            light_space[low_point][i] += light_right

for j in range(h):
    light = -1
    light_right = -1
    for i in range(w):
        right_point = len(space[j])-i-1

        if space[j][i] == "#":
            light = -1
            light_space[j][i] = 0
        else:
            light += 1
            light_space[j][i] += light
        
        if space[j][right_point] == "#":
            light_right = -1
            light_space[j][right_point] = 0
        else:
            light_right += 1
            light_space[j][right_point] += light_right

        max_light = max(max_light,light_space[j][right_point],light_space[j][i])


print(max_light)

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

light_space = [[1 for i in range(w)] for j in range(h)]
max_light = 0
for i in range(w):
    light = -1
    light_right = -1
    for j in range(h):
        low_point = len(space)-j-1

        if space[j][i] == "#":
            light = -1
            light_space[j][i] = 0
        else:
            light += 1
            light_space[j][i] += light

        if space[low_point][i] == "#":
            light_right = -1
            light_space[low_point][i] = 0
        else:
            light_right += 1
            light_space[low_point][i] += light_right

for j in range(h):
    light = -1
    light_right = -1
    for i in range(w):
        right_point = len(space[j])-i-1

        if space[j][i] == "#":
            light = -1
            light_space[j][i] = 0
        else:
            light += 1
            light_space[j][i] += light
        
        if space[j][right_point] == "#":
            light_right = -1
            light_space[j][right_point] = 0
        else:
            light_right += 1
            light_space[j][right_point] += light_right

        max_light = max(max_light,light_space[j][right_point],light_space[j][i])


print(max_light)

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

max_light = 0
for i in range(h):
    for j in range(w):
        if space[i][j] != "#":
            light = 1
            #right
            pos = j+1
            while( pos < len(space[i])):
                if space[i][pos] == ".":
                    light += 1
                    pos += 1
                else:
                    break
            pos = j-1
            while( 0 <= pos ):
                if space[i][pos] == ".":
                    light += 1
                    pos -= 1
                else:
                    break
            pos = i+1
            while(pos < len(space)):
                if space[pos][j] == ".":
                    light += 1
                    pos += 1
                else:
                    break

            pos = i-1
            while( 0 <= pos ):
                if space[pos][j] == ".":
                    light += 1
                    pos -= 1
                else:
                    break
        
            max_light = max(max_light,light)
print(max_light)

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

light_space = [[1 for i in range(w)] for j in range(h)]
max_light = 0
for i in range(w):
    light = -1
    light_right = -1
    for j in range(h):
        low_point = len(space)-j-1

        if space[j][i] == "#":
            light = -1
            light_space[j][i] = 0
        else:
            light += 1
            light_space[j][i] += light

        if space[low_point][i] == "#":
            light_right = -1
            light_space[low_point][i] = 0
        else:
            light_right += 1
            light_space[low_point][i] += light_right

for j in range(h):
    light = -1
    light_right = -1
    for i in range(w):
        right_point = len(space[j])-i-1

        if space[j][i] == "#":
            light = -1
            light_space[j][i] = 0
        else:
            light += 1
            light_space[j][i] += light
        
        if space[j][right_point] == "#":
            light_right = -1
            light_space[j][right_point] = 0
        else:
            light_right += 1
            light_space[j][right_point] += light_right

        max_light = max(max_light,light_space[j][right_point],light_space[j][i])


print(max_light)