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

l = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
  for j in range(w):
    if j == 0:
      if s[i][j] == '#':
        l[i][j] = 0
      else:
        l[i][j] = 1
    else:
      if s[i][j] == '#':
        l[i][j] = 0
      else:
        l[i][j] = l[i][j-1] + 1

r = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
  for j in range(w-1, -1, -1):
    if j == w-1:
      if s[i][j] == '#':
        r[i][j] = 0
      else:
        r[i][j] = 1
    else:
      if s[i][j] == '#':
        r[i][j] = 0
      else:
        r[i][j] = r[i][j+1] + 1

u = [[0 for i in range(w)] for j in range(h)]
for j in range(w):
  for i in range(h):
    if i == 0:
      if s[i][j] == '#':
        u[i][j] = 0
      else:
        u[i][j] = 1
    else:
      if s[i][j] == '#':
        u[i][j] = 0
      else:
        u[i][j] = u[i-1][j] + 1

d = [[0 for i in range(w)] for j in range(h)]
for j in range(w):
  for i in range(h-1, -1, -1):
    if i == h-1:
      if s[i][j] == '#':
        d[i][j] = 0
      else:
        d[i][j] = 1
    else:
      if s[i][j] == '#':
        d[i][j] = 0
      else:
        d[i][j] = d[i+1][j] + 1

ans = 0
for i in range(h):
  for j in range(w):
    a = l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3
    ans = max(ans, a)

print(ans)

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

l = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
  for j in range(w):
    if j == 0:
      if s[i][j] == '#':
        l[i][j] = 0
      else:
        l[i][j] = 1
    else:
      if s[i][j] == '#':
        l[i][j] = 0
      else:
        l[i][j] = l[i][j-1] + 1

r = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
  for j in range(w-1, -1, -1):
    if j == w-1:
      if s[i][j] == '#':
        r[i][j] = 0
      else:
        r[i][j] = 1
    else:
      if s[i][j] == '#':
        r[i][j] = 0
      else:
        r[i][j] = r[i][j+1] + 1

u = [[0 for i in range(w)] for j in range(h)]
for j in range(w):
  for i in range(h):
    if i == 0:
      if s[i][j] == '#':
        u[i][j] = 0
      else:
        u[i][j] = 1
    else:
      if s[i][j] == '#':
        u[i][j] = 0
      else:
        u[i][j] = u[i-1][j] + 1

d = [[0 for i in range(w)] for j in range(h)]
for j in range(w):
  for i in range(h-1, -1, -1):
    if i == h-1:
      if s[i][j] == '#':
        d[i][j] = 0
      else:
        d[i][j] = 1
    else:
      if s[i][j] == '#':
        d[i][j] = 0
      else:
        d[i][j] = d[i+1][j] + 1

ans = 0
for i in range(h):
  for j in range(w):
    a = l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3
    ans = max(ans, a)

print(ans)

Buggy python submission (verdict: Runtime Error):
h,w = map(int, input().split())
s = []
for i in range(h):
  s.add(input())

l = [[0]*w]*h
for i in range(h):
  for j in range(w):
    if j == 0:
      if s[i][j] == '#':
        l[i][j] = 0
      else:
        l[i][j] = 1
    else:
      if s[i][j] == '#':
        l[i][j] = 0
      else:
        l[i][j] = l[i][j-1] + 1

r = [[0]*w]*h
for i in range(h):
  for j in range(w-1, 0, -1):
    if j == w-1:
      if s[i][j] == '#':
        r[i][j] = 0
      else:
        r[i][j] = 1
    else:
      if s[i][j] == '#':
        r[i][j] = 0
      else:
        r[i][j] = r[i][j+1] + 1

u = [[0]*w]*h
for j in range(w):
  for i in range(h):
    if i == 0:
      if s[i][j] == '#':
        u[i][j] = 0
      else:
        u[i][j] = 1
    else:
      if s[i][j] == '#':
        u[i][j] = 0
      else:
        u[i][j] = u[i-1][j] + 1

d = [[0]*w]*h
for j in range(w):
  for i in range(h-1, 0, -1):
    if i == h-1:
      if s[i][j] == '#':
        d[i][j] = 0
      else:
        d[i][j] = 1
    else:
      if s[i][j] == '#':
        d[i][j] = 0
      else:
        d[i][j] = d[i+1][j] + 1

ans = 0
for i in range(h):
  for j in range(w):
    ans = max(ans, l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3)

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

l = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
  for j in range(w):
    if j == 0:
      if s[i][j] == '#':
        l[i][j] = 0
      else:
        l[i][j] = 1
    else:
      if s[i][j] == '#':
        l[i][j] = 0
      else:
        l[i][j] = l[i][j-1] + 1

r = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
  for j in range(w-1, -1, -1):
    if j == w-1:
      if s[i][j] == '#':
        r[i][j] = 0
      else:
        r[i][j] = 1
    else:
      if s[i][j] == '#':
        r[i][j] = 0
      else:
        r[i][j] = r[i][j+1] + 1

u = [[0 for i in range(w)] for j in range(h)]
for j in range(w):
  for i in range(h):
    if i == 0:
      if s[i][j] == '#':
        u[i][j] = 0
      else:
        u[i][j] = 1
    else:
      if s[i][j] == '#':
        u[i][j] = 0
      else:
        u[i][j] = u[i-1][j] + 1

d = [[0 for i in range(w)] for j in range(h)]
for j in range(w):
  for i in range(h-1, -1, -1):
    if i == h-1:
      if s[i][j] == '#':
        d[i][j] = 0
      else:
        d[i][j] = 1
    else:
      if s[i][j] == '#':
        d[i][j] = 0
      else:
        d[i][j] = d[i+1][j] + 1

ans = 0
for i in range(h):
  for j in range(w):
    a = l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3
    ans = max(ans, a)

print(ans)