Buggy python submission (verdict: Runtime Error):
h, w = list(map(int, input().split()))
data = []
for i in range(h):
    data.append(list(input()))
dp = [[-1 for i in range(w)] for j in range(h)]
dp[0][0] = 1
def cal(row, column):
    if row < 0 or column < 0:
        return 0

    if data[row][column] == '#':
        return 0

    if dp[row][column] == -1:
        dp[row][column]  = cal(row - 1, column) + cal(row, column - 1)


    return dp[row][column]
mod = (10 ** 9) + 7
print(cal(h - 1, w - 1) % mod)


Fixed submission:
from collections import deque
h, w = list(map(int, input().split()))
grid = []
for i in range(h):
    grid.append(list(input()))
#x,y渡すと、（h,w）に入ってるかどうか判定
def check(s,t):
    if (0 <=  s <= h - 1) and (0 <= t <= w - 1):
        return True
    else:
        return False
ans = [[0 for i in range(w)] for j in range(h)]
#graph => そこまでの距離を保存した二次元配列　grid=>与えられた迷路
ans[0][0] = 1
mod = 10**9+7
for i in range(h):
    for j in range(w):
        if grid[i][j] != '#':
            if i - 1 >= 0:
                ans[i][j] += ans[i-1][j]
            if j - 1 >= 0:
                ans[i][j] += ans[i][j-1]
        else:
            ans[i][j] = 0
        ans[i][j] %= mod
print(ans[-1][-1])

Buggy python submission (verdict: Runtime Error):
h, w = list(map(int, input().split()))
data = []
for i in range(h):
    data.append(list(input()))
dp = [[None for i in range(w)] for j in range(h)]
dp[0][0] = 1
def cal(row, column):
    if row < 0 or column < 0:
        return 0

    if data[row][column] == '#':
        return 0

    if dp[row][column] == None:
        dp[row][column]  = cal(row - 1, column) + cal(row, column - 1)


    return dp[row][column]
mod = (10 ** 9) + 7
print(cal(h - 1, w - 1) % mod)


Fixed submission:
from collections import deque
h, w = list(map(int, input().split()))
grid = []
for i in range(h):
    grid.append(list(input()))
#x,y渡すと、（h,w）に入ってるかどうか判定
def check(s,t):
    if (0 <=  s <= h - 1) and (0 <= t <= w - 1):
        return True
    else:
        return False
ans = [[0 for i in range(w)] for j in range(h)]
#graph => そこまでの距離を保存した二次元配列　grid=>与えられた迷路
ans[0][0] = 1
mod = 10**9+7
for i in range(h):
    for j in range(w):
        if grid[i][j] != '#':
            if i - 1 >= 0:
                ans[i][j] += ans[i-1][j]
            if j - 1 >= 0:
                ans[i][j] += ans[i][j-1]
        else:
            ans[i][j] = 0
        ans[i][j] %= mod
print(ans[-1][-1])

Buggy python submission (verdict: Runtime Error):
h, w = list(map(int, input().split()))
data = []
for i in range(h):
    data.append(list(input()))
dp = [[None for i in range(w)] for j in range(h)]
dp[0][0] = 1
def cal(row, column):
    if row < 0 or column < 0:
        return 0

    if data[row][column] == '#':
        return 0

    if dp[row][column] == None:
        dp[row][column]  = cal(row - 1, column) + cal(row, column - 1)
        return dp[row][column]
    else:

        return dp[row][column]
mod = (10 ** 9) +7
print(cal(h - 1, w - 1) % mod)


Fixed submission:
from collections import deque
h, w = list(map(int, input().split()))
grid = []
for i in range(h):
    grid.append(list(input()))
#x,y渡すと、（h,w）に入ってるかどうか判定
def check(s,t):
    if (0 <=  s <= h - 1) and (0 <= t <= w - 1):
        return True
    else:
        return False
ans = [[0 for i in range(w)] for j in range(h)]
#graph => そこまでの距離を保存した二次元配列　grid=>与えられた迷路
ans[0][0] = 1
mod = 10**9+7
for i in range(h):
    for j in range(w):
        if grid[i][j] != '#':
            if i - 1 >= 0:
                ans[i][j] += ans[i-1][j]
            if j - 1 >= 0:
                ans[i][j] += ans[i][j-1]
        else:
            ans[i][j] = 0
        ans[i][j] %= mod
print(ans[-1][-1])