Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)

H, W = map(int, input().split())
field = [list(input()) for _ in range(H)]
MOD = 10 ** 9 + 7
count = [0]
dp = [[-1] * W for _ in range(H)]

def dfs(x, y):
  ret = 0
  for nx, ny in ((1,0), (0,1)):
    nx += x
    ny += y
    if nx == W-1 and ny == H-1:
      ret += 1
    elif dp[ny][nx] > -1:
      ret += dp[ny][nx]
    elif nx < W and ny < H:
      if field[ny][nx] == "#":
        ret += dfs(nx, ny)
  dp[y][x] = ret % MOD
  return ret

dfs(0,0)
print(dp[0][0])


Fixed submission:
import sys
sys.setrecursionlimit(10**9)

H, W = map(int, input().split())
field = [list(input()) for _ in range(H)]
MOD = 10 ** 9 + 7
count = [0]
dp = [[-1] * W for _ in range(H)]

def dfs(x, y):
  ret = 0
  for nx, ny in ((1,0), (0,1)):
    nx += x
    ny += y
    if nx == W-1 and ny == H-1:
      ret += 1
      continue
    elif nx >= W or ny >= H:
      continue
    elif dp[ny][nx] > -1:
      ret += dp[ny][nx]
      continue
    elif field[ny][nx] == "#":
      continue
    else:
      ret += dfs(nx, ny)
  dp[y][x] = ret % MOD
  return ret

dfs(0,0)
print(dp[0][0])

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)

H, W = map(int, input().split())
field = [list(input()) for _ in range(H)]
MOD = 10 ** 9 + 7
count = [0]
dp = [[-1] * W for _ in range(H)]

def dfs(x, y):
  ret = 0
  for nx, ny in ((1,0), (0,1)):
    nx += x
    ny += y
    if nx == W-1 and ny == H-1:
      ret += 1
    elif dp[ny][nx] > -1:
      ret += dp[ny][nx]
    elif nx < W and ny < H and field[ny][nx] == "#":
      ret += dfs(nx, ny)
  dp[y][x] = ret % MOD
  return ret

dfs(0,0)
print(dp[0][0])


Fixed submission:
import sys
sys.setrecursionlimit(10**9)

H, W = map(int, input().split())
field = [list(input()) for _ in range(H)]
MOD = 10 ** 9 + 7
count = [0]
dp = [[-1] * W for _ in range(H)]

def dfs(x, y):
  ret = 0
  for nx, ny in ((1,0), (0,1)):
    nx += x
    ny += y
    if nx == W-1 and ny == H-1:
      ret += 1
      continue
    elif nx >= W or ny >= H:
      continue
    elif dp[ny][nx] > -1:
      ret += dp[ny][nx]
      continue
    elif field[ny][nx] == "#":
      continue
    else:
      ret += dfs(nx, ny)
  dp[y][x] = ret % MOD
  return ret

dfs(0,0)
print(dp[0][0])

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
field = [list(input()) for _ in range(H)]

count = [0]
def dfs(x, y):
  for nx, ny in ((1,0), (0,1)):
    nx += x
    ny += y
    if nx == W-1 and ny == H-1:
      count[0] += 1
      continue
    if nx >= W or ny >= H:
      continue
    if field[ny][nx] == "#":
      continue
    dfs(nx, ny)

dfs(0,0)
print(count[0])


Fixed submission:
import sys
sys.setrecursionlimit(10**9)

H, W = map(int, input().split())
field = [list(input()) for _ in range(H)]
MOD = 10 ** 9 + 7
count = [0]
dp = [[-1] * W for _ in range(H)]

def dfs(x, y):
  ret = 0
  for nx, ny in ((1,0), (0,1)):
    nx += x
    ny += y
    if nx == W-1 and ny == H-1:
      ret += 1
      continue
    elif nx >= W or ny >= H:
      continue
    elif dp[ny][nx] > -1:
      ret += dp[ny][nx]
      continue
    elif field[ny][nx] == "#":
      continue
    else:
      ret += dfs(nx, ny)
  dp[y][x] = ret % MOD
  return ret

dfs(0,0)
print(dp[0][0])