Buggy python submission (verdict: Runtime Error):
a, b = list(map(int, input().split()))
grid = list()
grid.append([-1 for _ in range(b + 2)])
for t in range(0, a):
    grid.append([-1])
    line = list(input())
    for k in range(len(line)):
        if line[k] == '#':
            grid[t + 1] += [-1]
        else:
            grid[t + 1] += [0]
    grid[t + 1] +=[-1]
grid.append([-1 for _ in range(b + 2)])
grid[1][1] = 1
for y in range(1, a + 1):
    for x in range(1, b + 1):
        if grid[x][y] > 0:
            if grid[x + 1][y] != -1:
                grid[x + 1][y] += grid[x][y]
            if grid[x][y + 1] != -1:
                grid[x][y + 1] += grid[x][y]
print(grid[-2][-2])

Fixed submission:
a, b = list(map(int, input().split()))
grid = list()
grid.append([-1 for _ in range(b + 2)])
for t in range(0, a):
    grid.append([-1])
    line = list(input())
    for k in range(len(line)):
        if line[k] == '#':
            grid[t + 1] += [-1]
        else:
            grid[t + 1] += [0]
    grid[t + 1] += [-1]
grid.append([-1 for _ in range(b + 2)])
grid[1][1] = 1
for x in range(1, a + 1):
    for y in range(1, b + 1):
        if grid[x][y] > 0:
            if grid[x + 1][y] != -1:
                grid[x + 1][y] += grid[x][y]
            if grid[x][y + 1] != -1:
                grid[x][y + 1] += grid[x][y]
print(grid[-2][-2] % (10 ** 9 + 7))

Buggy python submission (verdict: Time Limit Exceeded):
a, b = list(map(int, input().split()))
grid = list()
grid.append([-1 for _ in range(b + 2)])
for t in range(0, a):
    grid.append([-1])
    line = list(input())
    for k in range(len(line)):
        if line[k] == '#':
            grid[t + 1] += [-1]
        else:
            grid[t + 1] += [0]
    grid[t + 1] +=[-1]
grid.append([-1 for _ in range(b + 2)])
check_list = [[1, 1]]
while len(check_list) != 0:
    new_check_list = []
    for x, y in check_list:
        if grid[x + 1][y] != -1:
            grid[x + 1][y] += 1
            new_check_list.append([x + 1, y])
        if grid[x][y + 1] != -1:
            grid[x][y + 1] += 1
            new_check_list.append([x, y + 1])
    check_list = new_check_list
print(grid[-2][-2])

Fixed submission:
a, b = list(map(int, input().split()))
grid = list()
grid.append([-1 for _ in range(b + 2)])
for t in range(0, a):
    grid.append([-1])
    line = list(input())
    for k in range(len(line)):
        if line[k] == '#':
            grid[t + 1] += [-1]
        else:
            grid[t + 1] += [0]
    grid[t + 1] += [-1]
grid.append([-1 for _ in range(b + 2)])
grid[1][1] = 1
for x in range(1, a + 1):
    for y in range(1, b + 1):
        if grid[x][y] > 0:
            if grid[x + 1][y] != -1:
                grid[x + 1][y] += grid[x][y]
            if grid[x][y + 1] != -1:
                grid[x][y + 1] += grid[x][y]
print(grid[-2][-2] % (10 ** 9 + 7))

Buggy python submission (verdict: Time Limit Exceeded):
a, b = list(map(int, input().split()))
grid = list()
grid.append([-1 for _ in range(b + 2)])
grid.append([-1] + [1] + [0 for _ in range(b - 1)] + [-1])
for _ in range(a - 1):
    grid.append([-1] + [0 for _ in range(b)] + [-1])
grid.append([-1 for _ in range(b + 2)])
for t in range(a):
    line = list(input())
    for k in range(len(line)):
        if line[k] == '#':
            grid[t + 1][k + 1] = -1
check_list = [[1, 1]]
while len(check_list) != 0:
    new_check_list = []
    for x, y in check_list:
        if grid[x + 1][y] != -1:
            grid[x + 1][y] += 1
            new_check_list.append([x + 1, y])
        if grid[x][y + 1] != -1:
            grid[x][y + 1] += 1
            new_check_list.append([x, y + 1])
    check_list = new_check_list
print(grid[-2][-2])

Fixed submission:
a, b = list(map(int, input().split()))
grid = list()
grid.append([-1 for _ in range(b + 2)])
for t in range(0, a):
    grid.append([-1])
    line = list(input())
    for k in range(len(line)):
        if line[k] == '#':
            grid[t + 1] += [-1]
        else:
            grid[t + 1] += [0]
    grid[t + 1] += [-1]
grid.append([-1 for _ in range(b + 2)])
grid[1][1] = 1
for x in range(1, a + 1):
    for y in range(1, b + 1):
        if grid[x][y] > 0:
            if grid[x + 1][y] != -1:
                grid[x + 1][y] += grid[x][y]
            if grid[x][y + 1] != -1:
                grid[x][y + 1] += grid[x][y]
print(grid[-2][-2] % (10 ** 9 + 7))