Buggy python submission (verdict: Time Limit Exceeded):
class Counter:
  def __init__(self):
    self.v = 0

  def increment(self):
    self.v += 1


H, W = map(int, input().strip().split())

M = [None] * H
MX = [None] * H
MY = [None] * H

for i in range(H):
  M[i] = [c == '.' for c in input().strip()]
  MX[i] = [None] * W
  MY[i] = [None] * W

max_size = 0

for i in range(H):
  for j in range(W):
    if not M[i][j]: continue

    if MX[i][j] is None:
      tmp = Counter()
      for x in range(j, W):
        if not M[i][x]: break
        MX[i][x] = tmp
        tmp.increment()

    if MY[i][j] is None:
      tmp = Counter()
      for y in range(i, H):
        if not M[y][j]: break
        MY[y][j] = tmp
        tmp.increment()

    size = MX[i][j].v + MY[i][j].v - 1
    max_size = max(max_size, size)

print(max_size)

Fixed submission:
class Counter:
  def __init__(self):
    self.v = 0

  def increment(self):
    self.v += 1


H, W = map(int, input().strip().split())

M = [None] * H
MX = [None] * H
MY = [None] * H

for i in range(H):
  M[i] = [c == '.' for c in input().strip()]
  MX[i] = [None] * W
  MY[i] = [None] * W

max_size = 0

for i in range(H):
  for j in range(W):
    if not M[i][j]: continue

    if MX[i][j] is None:
      tmp = Counter()
      for x in range(j, W):
        if not M[i][x]: break
        MX[i][x] = tmp
        tmp.increment()

    if MY[i][j] is None:
      tmp = Counter()
      for y in range(i, H):
        if not M[y][j]: break
        MY[y][j] = tmp
        tmp.increment()

    size = MX[i][j].v + MY[i][j].v - 1
    max_size = max(max_size, size)

print(max_size)

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

M = [None] * H
MX = [None] * H
MY = [None] * H

for i in range(H):
  M[i] = [c == '.' for c in input().strip()]
  MX[i] = [None] * W
  MY[i] = [None] * W

max_size = 0

for i in range(H):
  for j in range(W):
    if not M[i][j]: continue

    x_len = 0
    if MX[i][j] is None:
      for x in range(j, W):
        if not M[i][x]: break
        x_len += 1
      for x in range(j, j + x_len):
        MX[i][x] = x_len
    else:
      x_len = MX[i][j]

    y_len = 0
    if MY[i][j] is None:
      for y in range(i, H):
        if not M[y][j]: break
        y_len += 1
      for y in range(i, i + y_len):
        MY[y][j] = y_len
    else:
      y_len = MY[i][j]

    size = x_len + y_len - 1
    max_size = max(max_size, size)

print(max_size)

Fixed submission:
class Counter:
  def __init__(self):
    self.v = 0

  def increment(self):
    self.v += 1


H, W = map(int, input().strip().split())

M = [None] * H
MX = [None] * H
MY = [None] * H

for i in range(H):
  M[i] = [c == '.' for c in input().strip()]
  MX[i] = [None] * W
  MY[i] = [None] * W

max_size = 0

for i in range(H):
  for j in range(W):
    if not M[i][j]: continue

    if MX[i][j] is None:
      tmp = Counter()
      for x in range(j, W):
        if not M[i][x]: break
        MX[i][x] = tmp
        tmp.increment()

    if MY[i][j] is None:
      tmp = Counter()
      for y in range(i, H):
        if not M[y][j]: break
        MY[y][j] = tmp
        tmp.increment()

    size = MX[i][j].v + MY[i][j].v - 1
    max_size = max(max_size, size)

print(max_size)

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

M = []
for i in range(H):
  M.append([c == '.' for c in list(input().strip())])

max_size = 0
max_pos = None
for i in range(H):
  for j in range(W):
    if not M[i][j]:
      continue

    a = 1
    for x in range(j + 1, W):
      if not M[i][x]: break
      a += 1
    for x in range(j - 1, -1, -1):
      if not M[i][x]: break
      a += 1
    for y in range(i + 1, H):
      if not M[y][j]: break
      a += 1
    for y in range(i - 1, -1, -1):
      if not M[y][j]: break
      a += 1

    if a > max_size:
      max_size = a
      max_pos = (i, j)

print(max_size)
#print(max_size, max_pos)

Fixed submission:
class Counter:
  def __init__(self):
    self.v = 0

  def increment(self):
    self.v += 1


H, W = map(int, input().strip().split())

M = [None] * H
MX = [None] * H
MY = [None] * H

for i in range(H):
  M[i] = [c == '.' for c in input().strip()]
  MX[i] = [None] * W
  MY[i] = [None] * W

max_size = 0

for i in range(H):
  for j in range(W):
    if not M[i][j]: continue

    if MX[i][j] is None:
      tmp = Counter()
      for x in range(j, W):
        if not M[i][x]: break
        MX[i][x] = tmp
        tmp.increment()

    if MY[i][j] is None:
      tmp = Counter()
      for y in range(i, H):
        if not M[y][j]: break
        MY[y][j] = tmp
        tmp.increment()

    size = MX[i][j].v + MY[i][j].v - 1
    max_size = max(max_size, size)

print(max_size)