Buggy python submission (verdict: Runtime Error):
from scipy.special import comb

# as this method is slow, time out error occurred
def factorial(n):
    total = 1
    for i in range(1, n+1):
        total *= i
    return total

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

MOD = 1000000000 + 7
def main():
    N, K = list(map(int, input().split()))

    for k in range(1, K+1):
        res = int(comb(N-K+1, k))
        res *= int(comb(K-1, k-1))
        print(res % MOD)

if __name__ == '__main__':
    main()

Fixed submission:
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p


p = 10 ** 9 + 7
N = 2000  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)


N, K = list(map(int, input().split()))

for k in range(1, K + 1):
    res = cmb(N - K + 1, k, p)
    res *= cmb(K - 1, k - 1, p)
    print(res % p)

Buggy python submission (verdict: Time Limit Exceeded):
import math

def factorial(n):
    total = 1
    for i in range(1, n+1):
        total *= i
    return total

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

MOD = 1000000000 + 7
def main():
    N, K = list(map(int, input().split()))

    for k in range(1, K+1):
        res = combinations_count(N-K+1, k)
        res *= combinations_count(K-1, k-1)
        print(res % MOD)

if __name__ == '__main__':
    main()

Fixed submission:
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p


p = 10 ** 9 + 7
N = 2000  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)


N, K = list(map(int, input().split()))

for k in range(1, K + 1):
    res = cmb(N - K + 1, k, p)
    res *= cmb(K - 1, k - 1, p)
    print(res % p)

Buggy python submission (verdict: Runtime Error):
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

MOD = 1000000000 + 7
def main():
    N, K = list(map(int, input().split()))

    for k in range(1, K+1):
        res = combinations_count(N-K+1, k)
        res *=  combinations_count(K-1, k-1)
        print(res % MOD)

if __name__ == '__main__':
    main()

Fixed submission:
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p


p = 10 ** 9 + 7
N = 2000  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)


N, K = list(map(int, input().split()))

for k in range(1, K + 1):
    res = cmb(N - K + 1, k, p)
    res *= cmb(K - 1, k - 1, p)
    print(res % p)