Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

H,W = map(int,input().split())
grid = [list(input()) for i in range(H)]
dp = np.zeros([H + 1,W + 1],dtype = int)
dp[0][0] = 1
mod = (10 ** 9) + 7

for i in range(H):
  for j in range(W):
    if i > 0 or j > 0:
      if grid[i][j] == "#":
        dp[i][j] = 0
      else:
        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod

print(dp[H - 1][W - 1])

Fixed submission:
import sys
import numpy as np
from functools import lru_cache
from collections import deque

#input = sys.stdin.readline
#sys.setrecursionlimit(10 ** 5)

H,W = map(int,input().split())
grid = [list(input()) for i in range(H)]
dp = [[0] * (W + 1) for i in range(H + 1)]
dp[0][0] = 1
mod = (10 ** 9) + 7

for i in range(H):
  for j in range(W):
    if i > 0 or j > 0:
      if grid[i][j] == "#":
        dp[i][j] = 0
      else:
        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod

print(dp[H - 1][W - 1])
#print(dp)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
from functools import lru_cache
from collections import deque

#input = sys.stdin.readline
#sys.setrecursionlimit(10 ** 5)

H,W = map(int,input().split())
grid = [list(input()) for i in range(H)]
dp = np.zeros([H + 1,W + 1],dtype = int)
dp[0][0] = 1
mod = (10 ** 9) + 7

def plus(a,b):
  a += b
  if a > mod:
    a %= mod
  return a

for i in range(H):
  for j in range(W):
    if i + 1 < H and grid[i + 1][j] == ".":
      dp[i + 1][j] = plus(dp[i + 1][j],dp[i][j])
      
    if j + 1 < W and grid[i][j + 1] == ".":
      dp[i][j + 1] = plus(dp[i][j + 1],dp[i][j])

print(dp[H - 1][W - 1])
#print(dp)

Fixed submission:
import sys
import numpy as np
from functools import lru_cache
from collections import deque

#input = sys.stdin.readline
#sys.setrecursionlimit(10 ** 5)

H,W = map(int,input().split())
grid = [list(input()) for i in range(H)]
dp = [[0] * (W + 1) for i in range(H + 1)]
dp[0][0] = 1
mod = (10 ** 9) + 7

for i in range(H):
  for j in range(W):
    if i > 0 or j > 0:
      if grid[i][j] == "#":
        dp[i][j] = 0
      else:
        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod

print(dp[H - 1][W - 1])
#print(dp)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
from functools import lru_cache
from collections import deque

#nput = sys.stdin.readline
#sys.setrecursionlimit(10 ** 5)

H,W = map(int,input().split())
grid = [list(input()) for i in range(H)]
dp = np.zeros([H + 1,W + 1],dtype = int)
dp[0][0] = 1
div = (10 ** 9) + 7

for i in range(H):
  for j in range(W):
    if i + 1 < H and grid[i + 1][j] == ".":
      dp[i + 1][j] += (dp[i][j] % div)
    if j + 1 < W and grid[i][j + 1] == ".":
      dp[i][j + 1] += (dp[i][j] % div)

print(dp[H - 1][W - 1] % div)

Fixed submission:
import sys
import numpy as np
from functools import lru_cache
from collections import deque

#input = sys.stdin.readline
#sys.setrecursionlimit(10 ** 5)

H,W = map(int,input().split())
grid = [list(input()) for i in range(H)]
dp = [[0] * (W + 1) for i in range(H + 1)]
dp[0][0] = 1
mod = (10 ** 9) + 7

for i in range(H):
  for j in range(W):
    if i > 0 or j > 0:
      if grid[i][j] == "#":
        dp[i][j] = 0
      else:
        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod

print(dp[H - 1][W - 1])
#print(dp)