map int input split for in range append for in range append for in ran

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
n, k = map(int, input().split())
a = []
for i in range(n):
a.append([])
for j in range(k):
a[i].append(1)
for i in range(n - 1):
for j in range(k - 1):
a[i + 1][j + 1] = a[i + 1][j] + a[i][j + 1]
print(a[n - 1][k - 1] % ((10 ** 6) + 7))