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

# 上下左右に余分に1マスとっとく
square = [[[0, 0, 0, 0] for _ in range(W + 2)] for _ in range(H + 2)]
for row in range(H + 2):
	for column in range(W + 2):
		if row == 0 or row == H + 1 or column == 0 or column == W + 1:
			square[row][column] = [-1, -1, -1, -1]

for row in range(H):
	S = list(map(str, input()))
	for column in range(W):
		if S[column] == "#":
			# 下駄をはかせるの忘れない
			square[row + 1][column + 1] = [-1, -1, -1, -1]
			

for row in range(1, H + 1):
	for column in range(1, W + 1):
		if square[row][column][0] == -1: continue
		square[row][column][0] = square[row][column - 1][0] + 1
		
for row in range(1, H + 1):
	for column in reversed(range(1, W + 1)):
		if square[row][column][0] == -1: continue
		square[row][column][1] = square[row][column + 1][1] + 1
		
for column in range(1, W + 1):
	for row in range(1, H + 1):
		if square[row][column][0] == -1: continue
		square[row][column][2] = square[row - 1][column][2] + 1
		
for column in range(1, W + 1):
	for row in reversed(range(1, H + 1)):
		if square[row][column][0] == -1: continue
		square[row][column][3] = square[row + 1][column][3] + 1

ret = 0
		
for row in range(1, H + 1):
	for column in range(1, W + 1):
		# print(row, column, 1 + sum(square[row][column]))
		ret = max(ret, 1 + sum(square[row][column]))
		
print(ret)

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

# 上下左右に余分に1マスとっとく
square = [[0 for _ in range(W)] for _ in range(H)]

for row in range(H):
	S = list(map(str, input()))
	for column in range(W):
		if S[column] == "#":
			# 下駄をはかせるの忘れない
			square[row][column] = -1
			
for row in range(H):
	done = [False for _ in range(W)]
	for column in range(W):
		if square[row][column] == -1: continue
		if done[column]: continue
		l = 1
		while column + l <= W - 1:
			if square[row][column + l] == -1: break
			l += 1
		for i in range(column, column + l):
			square[row][i] += l
			done[i] = True
			
for column in range(W):
	done = [False for _ in range(H)]
	for row in range(H):
		if square[row][column] == -1: continue
		if done[row]: continue
		l = 1
		while row + l <= H - 1:
			if square[row + l][column] == -1: break
			l += 1
		for i in range(row, row + l):
			square[i][column] += l
			done[i] = True

ret = 0			
for row in range(H):
	for column in range(W):
		ret = max(ret, square[row][column] - 1)
		
		
print(ret)

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

# H, W = 4, 6
board = []
L = [[0 for i in range(W)] for i in range(H)]
R = [[0 for i in range(W)] for i in range(H)]
U = [[0 for i in range(W)] for i in range(H)]
D = [[0 for i in range(W)] for i in range(H)]

# board = [['#', '.', '.', '#', '.', '.'], ['.', '.', '.', '.', '.', '#'], ['.', '.', '.', '.', '#', '.'], ['#', '.', '#', '.', '.', '.']]

# insert elements to the board
for i in range(H):
	a = list(input())
	board.append(a)


# high_score is output values
high_score = 0
	
# round robin
for h in range(H):
	for w in range(W):
		# print(h, w)
		# board put light is envolved
		score = 1
		# if not obstacle in board[h][w]
		if board[h][w] != "#":
			# DOWN
			for i in range(1, H):
				if h + i == W:
					break
				elif board[h + i][w] == "#":
					break
			score += i - 1
			D[h][w] = i - 1
			# print(D[h][w])
			
			# UP
			if h == 0 or board[h - 1][w] == "#":
				U[h][w] = 0
			else:
				U[h][w] = U[h - 1][w] + 1
			score += U[h][w]
			# print(U[h][w])
			
			# RIGHT
			for i in range(1, W):
				if w + i == W:
					break
				elif board[h][w + i] == "#":
					break
			score += i - 1
			R[h][w] = i - 1
			# print(R[h][w])
			
			# LEFT
			if w == 0 or board[h][w - 1] == "#":
				L[h][w] = 0
			else:
				L[h][w] = L[h][w - 1] + 1
			score += L[h][w]
			# print(L[h][w])
			
			# print(score)
			if score > high_score:
				high_score = score
				
print(high_score)

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

# 上下左右に余分に1マスとっとく
square = [[0 for _ in range(W)] for _ in range(H)]

for row in range(H):
	S = list(map(str, input()))
	for column in range(W):
		if S[column] == "#":
			# 下駄をはかせるの忘れない
			square[row][column] = -1
			
for row in range(H):
	done = [False for _ in range(W)]
	for column in range(W):
		if square[row][column] == -1: continue
		if done[column]: continue
		l = 1
		while column + l <= W - 1:
			if square[row][column + l] == -1: break
			l += 1
		for i in range(column, column + l):
			square[row][i] += l
			done[i] = True
			
for column in range(W):
	done = [False for _ in range(H)]
	for row in range(H):
		if square[row][column] == -1: continue
		if done[row]: continue
		l = 1
		while row + l <= H - 1:
			if square[row + l][column] == -1: break
			l += 1
		for i in range(row, row + l):
			square[i][column] += l
			done[i] = True

ret = 0			
for row in range(H):
	for column in range(W):
		ret = max(ret, square[row][column] - 1)
		
		
print(ret)