Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import sys


class UnionFind:

    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.size = [1 for _ in range(N)]

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            return self.find(self.parent[x])

    def union(self, x, y):
        px = self.find(x)
        py = self.find(y)
        if px == py:
            return
        if self.size[px] < self.size[py]:
            self.parent[px] = py
            self.size[py] += self.size[px]
        else:
            self.parent[py] = px
            self.size[px] += self.size[py]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def get_size(self, x):
        return self.size[self.find(x)]


# python template for atcoder1
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H, W = map(int, input().split())
grid = [[v for v in input()[:-1]] for _ in range(H)]

columns = UnionFind(W*H)
rows = UnionFind(W*H)

# init columns
for row in range(H):
    for col1, col2 in zip(range(W), range(1, W)):
        if grid[row][col1] == "." and grid[row][col2] == ".":
            columns.union(row*W+col1, row*W+col2)

# init rows:
for col in range(W):
    for row1, row2 in zip(range(H), range(1, H)):
        if grid[row1][col] == "." and grid[row2][col] == ".":
            rows.union(row1*W+col, row2*W+col)

ans = 0
for row in range(H):
    for col in range(W):
        if grid[row][col] == ".":
            un = row*W+col
            tmp = rows.get_size(un)+columns.get_size(un)-1
            ans = max(ans, tmp)
print(ans)


Fixed submission:

import sys


# python template for atcoder1
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H, W = map(int, input().split())
grid = [[v for v in input()[:-1]] for _ in range(H)]

col_seq = [[1]*W for _ in range(H)]
row_seq = [[1]*W for _ in range(H)]

for row in range(H):
    for col in range(W):
        if grid[row][col] == "#":
            col_seq[row][col] = 0
            row_seq[row][col] = 0

# init columns
for row in range(H):
    for col1, col2 in zip(range(W), range(1, W)):
        if grid[row][col1] == "." and grid[row][col2] == "." and col_seq[row][col1] == 1:
            seq = 2
            next_col = col2+1
            while next_col < W:
                if grid[row][next_col] == ".":
                    seq += 1
                else:
                    break
                next_col += 1
            for i in range(col1, col1+seq):
                col_seq[row][i] = seq

# init rows:
for col in range(W):
    for row1, row2 in zip(range(H), range(1, H)):
        if grid[row1][col] == "." and grid[row2][col] == "." and row_seq[row1][col] == 1:
            seq = 2
            next_row = row2+1
            while next_row < H:
                if grid[next_row][col] == ".":
                    seq += 1
                else:
                    break
                next_row += 1
            for i in range(row1, row1+seq):
                row_seq[i][col] = seq

ans = 0
for row in range(H):
    for col in range(W):
        if grid[row][col] == ".":
            tmp = col_seq[row][col]+row_seq[row][col]-1
            ans = max(ans, tmp)
print(ans)