qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import math

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

red = N-K + 1


def combination(a, b):
    return (math.factorial(a)//math.factorial(a-b))//math.factorial(b)


w = 10**9+7
for i in range(1, K+1):
    if N-K+1-i > 0:
        ans1 = combination(N-K+1, i)
        ans2 = combination(K-1, i-1)
        print(ans1 % w*ans2 % w)
    else:
        print(0)


Fixed code:
import math

N, K = list(map(int, input().split()))
mod = 10**9+7


def combination(a, b):
    ans = (math.factorial(a) // math.factorial(a-b)) // math.factorial(b)
    return ans


for i in range(1, K+1):
    if (N-K+1-i) >= 0:
        ans1 = combination(N-K+1, i)
        ans2 = combination(K-1, i-1)
        print(ans1 % mod*ans2 % mod)
    else:
        print(0)
Buggy code:
MOD = 10**9 + 7
 
N,K = [int(s) for s in input().split()]
 
comb = [[1]]
for i in range(N + 1):
    comb.append([1])
    for j in range(i):
        comb[-1].append((comb[-2][j] + comb[-2][j + 1]))
    comb[-1].append(1)
    
def combi(n,k):
  return comb[n][k] if n >= k else 1

for i in range(1,K+1):
    print((combi(N-i+1,i) * combi(K-1,i-1)) % MOD)

Fixed code:
MOD = 10**9 + 7
 
N,K = [int(s) for s in input().split()]
 
comb = [[1]]
for i in range(N + 1):
    comb.append([1])
    for j in range(i):
        comb[-1].append((comb[-2][j] + comb[-2][j + 1]) % MOD)
    comb[-1].append(1)
    
def combi(n,k):
  return comb[n][k] if n >= k else 1

for i in range(1,K+1):
  if i <= N-K+1:
    print((combi(N-K+1,i) * combi(K-1,i-1)) % MOD)
  else:
    print(0)
Buggy code:
#ABC132 D
import math
def cmb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, K = map(int, input().split())
for i in range(K):
    try:
        print((cmb(N - K + 1, i + 1) * cmb(K, i)) % ((10 ** 9) + 7))
    except:
        print(0)

Fixed code:
#ABC132 D
import math
def cmb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, K = map(int, input().split())
for i in range(K):
    try:
        print((cmb(N - K + 1, i + 1) * cmb(K - 1, i)) % ((10 ** 9) + 7))
    except:
        print(0)
Buggy code:
u = 10**5
mod = 10**9+7
f = [1]*u
for i in range(1,u):
    f[i]*=f[i-1]*i
    f[i] %= mod

def comb(n,k):
    x = f[n]
    x *= pow(f[k],mod-2,mod)
    x %= mod
    x *= pow(f[n-k],mod-2,mod)
    x %= mod
    return x

n,k = map(int,input().split())
for i in range(1,k+1):
    res = 0
    if n-k >= i:
        res = comb(n-k+1,i)*comb(k-1,i-1)
        res %= mod
    print(res)


Fixed code:
u = 10**5
mod = 10**9+7
f = [1]*u
for i in range(1,u):
    f[i]*=f[i-1]*i
    f[i] %= mod

def comb(n,k):
    x = f[n]
    x *= pow(f[k],mod-2,mod)
    x %= mod
    x *= pow(f[n-k],mod-2,mod)
    x %= mod
    return x

n,k = map(int,input().split())
for i in range(1,k+1):
    res = 0
    if n-k+1 >= i:
        res = comb(n-k+1,i)*comb(k-1,i-1)
        res %= mod
    print(res)
Buggy code:
MOD = 10**9 + 7
def comb(n, k, MOD):
    if n < k or n < 0 or k < 0:
        return 0
    if k == 0:
        return 1
    iinv = [1] * (k + 1)
    ans = n
    for i in range(2, k + 1):
        iinv[i] = MOD - iinv[MOD % i] * (MOD // i) % MOD
        ans *= (n + 1 - i) * iinv[i] % MOD
        ans %= MOD
    return ans
N, K = map(int, input().split())
for i in range(1,K+1):
    if i == 1 or K:
        print(comb(N-K+1,i,MOD))
    else:
        print((comb(N-K+1,i,MOD)*(K-i)*i)%MOD)

Fixed code:
MOD = 10**9 + 7
def comb(n, k, MOD):
    if n < k or n < 0 or k < 0:
        return 0
    if k == 0:
        return 1
    iinv = [1] * (k + 1)
    ans = n
    for i in range(2, k + 1):
        iinv[i] = MOD - iinv[MOD % i] * (MOD // i) % MOD
        ans *= (n + 1 - i) * iinv[i] % MOD
        ans %= MOD
    return ans
N, K = map(int, input().split())
for i in range(1,K+1):
        print((comb(N-K+1,i,MOD)*comb(K-1,K-i,MOD))%MOD)
Buggy code:
from math import factorial

N, K = map(int, input().split())
mod = 10**9 + 1

def cmb(n, r):
    if n >= r:
        return int(factorial(n) // (factorial(r) * factorial(n-r)))
    else:
        return 0

for i in range(1, K+1):
    print(cmb(N-K+1, i) * cmb(K-1, i-1) % mod)

Fixed code:
from math import factorial

N, K = map(int, input().split())
mod = 10**9 + 7

def cmb(n, r):
    if n >= r:
        return int(factorial(n) // (factorial(r) * factorial(n-r)))
    else:
        return 0

for i in range(1, K+1):
    print(cmb(N-K+1, i) * cmb(K-1, i-1) % mod)
Buggy code:
from math import factorial
from decimal import *

n,k = map(int, input().split())

for i in range(1, k+1):
    if n-k < i:
        print(0)
    else:
        ans = ((factorial(n-k+1) // factorial(i) // factorial(n-k+1-i)) * \
            (factorial(k-1) // factorial(i-1) // factorial(k-i))) \
            % (10**9 + 7)
        print(ans)
#     if i == 0:
#         print(n-k+1)
#     elif i == (k-1):


Fixed code:
from math import factorial
from decimal import *

n,k = map(int, input().split())

for i in range(1, k+1):
    if n-k+1 < i:
        print(0)
    else:
        ans = ((factorial(n-k+1) // factorial(i) // factorial(n-k-i+1)) * \
            (factorial(k-1) // factorial(i-1) // factorial(k-i))) \
            % (10**9 + 7)
        print(ans)
#     if i == 0:
#         print(n-k+1)
#     elif i == (k-1):
Buggy code:
T = 10**9+7

N, B = list(map(int, input().split()))
R = N - B
for i in range(1, B+1):
    if i > R + 1:
        print(0)
    else:
        print((nCr(R+1, i) % T) * (nCr(B-1, i-1) % T) % T)

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

def nCr(n, r):
    if n == r:
        return 1
    else:
        return factorial(n, r+1) // factorial(n - r, 1)


Fixed code:
def factorial(n, s):
    f = 1
    for i in range(s, n + 1):
        f *= i
    return f


def nCr(n, r):
    if n == r:
        return 1
    else:
        return factorial(n, r + 1) // factorial(n - r, 1)


T = 10 ** 9 + 7
N, B = list(map(int, input().split()))
R = N - B
for i in range(1, B + 1):
    if i > R + 1:
        print(0)
    else:
        print((nCr(R + 1, i) % T) * (nCr(B - 1, i - 1) % T) % T)
Buggy code:
MOD = 10**9 + 7
MAX = 2000 + 5
fact = [1 for _ in range(MAX)]
finv = [1 for _ in range(MAX)]
for i in range(2, MAX):
    fact[i] = fact[i - 1] * i % MOD
    finv[i] = pow(fact[i], MOD-2, MOD)

def comb(n, k):
    if n < k or n < 0 or k < 0:
        return 0
    return (fac[n] * finv[k] % MOD) * finv[n-k] % MOD

n, k = map(int, input().split())

for i in range(1, k+1):
    ans = comb(k-1, i-1) * comb(n-k+1, i) % MOD
    print(ans)


Fixed code:
MOD = 10**9 + 7
MAX = 2000 + 5
fac = [1 for _ in range(MAX)]
for i in range(2, MAX):
    fac[i] = fac[i - 1] * i % MOD

def comb(n, k):
    if n < k or n < 0 or k < 0:
        return 0
    return (fac[n] * pow(fac[k], MOD-2, MOD) % MOD) * pow(fac[n-k], MOD-2, MOD) % MOD

n, k = map(int, input().split())

for i in range(1, k+1):
    ans = comb(k-1, i-1) * comb(n-k+1, i) % MOD
    print(ans)
Buggy code:
N, K = map(int, input().split())
ans = N - K + 1
for i in range(1, K + 1):
    if i > N - K + 1:
        ans = 0
    print(int(ans) % 1000000007)
    ans = ans * ((N - K + 1 - i) // (i + 1)) * ((K - i) // i)


Fixed code:
N, K = map(int, input().split())
ans = N - K + 1
for i in range(1, K + 1):
    if i > N - K + 1:
        ans = 0
    print(ans % 1000000007)
    ans = ans * (N - K + 1 - i) * (K - i)
    ans = ans // ((i + 1) * i)
Buggy code:
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1] 

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
print(g1)
n,k= map(int,input().split())
m = n - k +1 
for i in range(1,k+1):
    print(nCr(m,i,mod)*nCr(k,i-1,mod))


Fixed code:
n, k = map(int,input().split())
m = n - k + 1 
def nCr(l,r,mod):
    if (r<0 or r>l):
        return 0
    r = min(r,l-r)
    return g1[l] * g2[r] * g2[l-r] % mod
mod = 10**9 + 7
N = 10**5
g1 = [1,1]
g2 = [1,1]
inverse = [0,1]
for i in range(2,N+1):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
for i in range(1,k+1):
    print(nCr(m,i,mod)*nCr(k-1,i-1,mod)%mod)
Buggy code:
from sys import stdin
from operator import mul
from functools import reduce


def cmb(n, r):
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N, K = [int(x) for x in stdin.readline().rstrip().split()]
for i in range(1, K+1):
    if i <= (N - K) :
        ans = cmb(N-K+1, i) * cmb(K-1, i-1)
    else:
        ans = 0
    print(ans % (10**9+7))

Fixed code:
from sys import stdin
from operator import mul
from functools import reduce


def cmb(n, r):
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N, K = [int(x) for x in stdin.readline().rstrip().split()]
for i in range(1, K+1):
    if i <= (N - K) + 1 :
        ans = cmb(N-K+1, i) * cmb(K-1, i-1)
    else:
        ans = 0
    print(ans % (10**9+7))
Buggy code:
def BC132_D():
    n, k = list(map(int, input().split(' ')))
    f = [1] * max(k, n - k + 2)
    for i in range(1, len(f) + 1):
        f[i] = f[i - 1] * i

    def comb(n, r):
        if n < r: return 0
        return f[n] // f[r] // f[n - r]

    for i in range(1, k + 1):
        print(comb(k - 1, i - 1) * comb(n - k + 1, i) % (10**9 + 7))

BC132_D()

Fixed code:
def BC132_D():
    n, k = list(map(int, input().split(' ')))
    f = [1] * max(k, n - k + 2)
    for i in range(1, len(f)):
        f[i] = f[i - 1] * i

    def comb(n, r):
        if n < r: return 0
        return f[n] // f[r] // f[n - r]

    for i in range(1, k + 1):
        print(comb(k - 1, i - 1) * comb(n - k + 1, i) % (10**9 + 7))

BC132_D()
Buggy code:
import math
def bi(x, y):
    if x < y or y < 0: return 0
    if y == 0: return 1
    r = math.factorial(x) // math.factorial(y) // math.factorial(x - y)
    return r % (10**9 + 7)

n, k = list(map(int, input().split(' ')))
for i in range(1, k + 1):
  	if n - k < i - 1: print(0)
    print(bi(k - 1, i - 1) * (bi(n - k - 1, i - 2) + bi(n - k - 1, i - 1) + bi(n - k, i)) % (10**9 + 7))

Fixed code:
import math
def bi(x, y):
  if x < y or y < 0 or x < 0: return 0
  if y == 0: return 1
  return math.factorial(x) // math.factorial(y) // math.factorial(x - y)

n, k = list(map(int, input().split(' ')))
for i in range(1, k + 1):
  print(bi(k - 1, i - 1) * bi(n - k + 1, i) % (10**9 + 7))
Buggy code:
from operator import mul
from functools import reduce
def cmb(n, r):
    if r > n:
        return 0
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

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

r_cnt = N - K
b_cnt = K

for i in range(1, K+1):
    print(( cmb( r_cnt+1, i ) * cmb( b_cnt-

Fixed code:
from operator import mul
from functools import reduce
def cmb(n, r):
    if r > n:
        return 0
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

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

r_cnt = N - K
b_cnt = K

for i in range(1, K+1):
    print(( cmb( r_cnt+1, i ) * cmb( b_cnt-1, i-1 )) % (10**9+7))
Buggy code:
import math

inf = 10**9+7

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

n, k = map(int, input().split())

red = n - k
for i in range(1,k+1):
    if i == 1:
        print(red + 1 -i)
    else:
        print(combinations_count(red+1, i)*2**(k-i)%inf)

Fixed code:
import math

inf = 10**9+7

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

n, k = map(int, input().split())

red = n - k
for i in range(1,k+1):
    if red+1 >= i:
        print(combinations_count(red+1, i)*combinations_count(k-1, i-1)%inf)
    else:
        print(0)
Buggy code:
N, K = map(int, input().split())
def nCr(n, r):
    """
    Calculate the number of combination (nCr = nPr/r!).
    The parameters need to meet the condition of n >= r >= 0.
    It returns 1 if r == 0, which means there is one pattern
    to choice 0 items out of the number of n.
    """

    # 10C7 = 10C3
    r = min(r, n-r)

    # Calculate the numerator.
    numerator = 1
    for i in range(n, n-r, -1):
        numerator *= i

    # Calculate the denominator. Should use math.factorial?
    denominator = 1
    for i in range(r, 1, -1):
        denominator *= i

    return numerator // denominator
for i in range(K-1):
  print(nCr(N-K+1,i+1):nCr(K-1,i+1))

Fixed code:
N, K = map(int, input().split())
def nCr(n, r):
    if n<r :
      return 0
    else:
      """
      Calculate the number of combination (nCr = nPr/r!).
      The parameters need to meet the condition of n >= r >= 0.
      It returns 1 if r == 0, which means there is one pattern
      to choice 0 items out of the number of n.
      """
  
      # 10C7 = 10C3
      r = min(r, n-r)
  
      # Calculate the numerator.
      numerator = 1
      for i in range(n, n-r, -1):
          numerator *= i
  
      # Calculate the denominator. Should use math.factorial?
      denominator = 1
      for i in range(r, 1, -1):
          denominator *= i
  
      return numerator // denominator
for i in range(K):
  a=nCr(N-K+1,i+1)*nCr(K-1,i)
  print(a%1000000007)
Buggy code:
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

n, k = map(int, input().split())

if 1==1:
    for i in range(k):
        if i<n-k:
            mazu=cmb(n-k+1, i+1)
            mazu=mazu%(10**9+7)
            tugi=cmb(k-1, i)
            tugi=tugi%(10**9+7)
            kotae=mazu*tugi
            print(kotae%(10**9+7))
        else:
            print(0)

Fixed code:
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

n, k = map(int, input().split())

if 1==1:
    for i in range(k):
        if i<=n-k:
            mazu=cmb(n-k+1, i+1)
            mazu=mazu%(10**9+7)
            tugi=cmb(k-1, i)
            tugi=tugi%(10**9+7)
            kotae=mazu*tugi
            print(kotae%(10**9+7))
        else:
            print(0)
Buggy code:
N,K = map(int,input().split())

def nCr(n, r, mod=10**9+7):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

for i in range(1,K+1):
    if N-K+1 < i:
        print(0)
        continue
    else:
        print((nCr(N-K+1,i)*nCr(K-1,i-1))%M)


Fixed code:
N,K = map(int,input().split())
M = 10**9+7
def nCr(n, r, mod=10**9+7):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

for i in range(1,K+1):
    if N-K+1 < i:
        print(0)
        continue
    else:
        print((nCr(N-K+1,i)*nCr(K-1,i-1))%M)
Buggy code:
n, k = map(int, input().split())
mod = 10 ** 9 + 7

fact = [1] * (n + 1)
for i in range(2, n + 1):
  fact[i] = fact[i-1] * i % mod
inv_fact = [1] * (n + 1)
inv_fact[n] = pow(fact[n], mod - 2, mod)
for i in range(n - 1, 1, -1):
  inv_fact[i] = inv_factor[i + 1] * (i + 1) % mod

def comb(_n: int, _k: int) -> int:
  return fact[_n] * inv_fact[_n - _k] * inv_vact[_k] % mod

for i in range(1, k + 1):
  red = n - k
  if i > red + 1:
    print(0)
  else:
    print(comb(red + 1, i) * comb(k - 1, k - i) % mod)

Fixed code:
n, k = map(int, input().split())
mod = 10 ** 9 + 7

fact = [1] * (n + 1)
for i in range(2, n + 1):
  fact[i] = fact[i-1] * i % mod
inv_fact = [1] * (n + 1)
inv_fact[n] = pow(fact[n], mod - 2, mod)
for i in range(n - 1, 1, -1):
  inv_fact[i] = inv_fact[i + 1] * (i + 1) % mod

def comb(_n: int, _k: int) -> int:
  return fact[_n] * inv_fact[_n - _k] * inv_fact[_k] % mod

for i in range(1, k + 1):
  red = n - k
  if i > red + 1:
    print(0)
  else:
    print(comb(red + 1, i) * comb(k - 1, k - i) % mod)
Buggy code:
N, K = map(int, input().split())
import math
mod =10**9+7

l = []
l.append(N-K+1)
for i in range(1, K):
  a = l[i-1] * 1/(i+1) * (N-K-i) * 1/(i) * (K-1-i) 
  l.append(int(a))

for j in l:
  print(j%mod)


Fixed code:
N, K = map(int, input().split())
import math
mod =10**9+7

l = []
l.append(N-K+1)
for i in range(1, K):
  a = l[i-1] * (N-K-i+1) * (K-i) // ((i+1)*i)
  l.append(int(a))

for j in l:
  print(j%mod)
Buggy code:
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K=map(int,input().split())
div=10**9+7

for i in range(K):
    if N-K+<i:
        print(0)
    else:
        print(comb(K-1,i)*comb(N-K+1,i+1)%div)

Fixed code:
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K=map(int,input().split())
div=10**9+7

for i in range(K):
    if N-K<i:
        print(0)
    else:
        print(comb(K-1,i)*comb(N-K+1,i+1)%div)
Buggy code:
import sys


def alg_combination_mod(n, r, mod):
    r = min(n - r, r)
    if r == 0:
        return 1
    else:
        denominator = 1
        for i in range(n, n - r, -1):
            denominator = (denominator * i) % mod
        molecule = 1
        for i in range(1, r + 1):
            molecule = (molecule * i) % mod
        return denominator * pow(molecule, mod - 2, mod) % mod


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, k = list(map(int, input().rstrip('\n').split()))
    t = 0
    for i in range(1, k + 1):
        if n - k + 1 >= i:
            print(alg_combination_mod(n - k + 1, i, mod))
        else:
            print(0)
        

if __name__ == '__main__':
    solve()


Fixed code:
import sys


def alg_combination_mod(n, r, mod):
    r = min(n - r, r)
    if r == 0:
        return 1
    else:
        denominator = 1
        for i in range(n, n - r, -1):
            denominator = (denominator * i) % mod
        molecule = 1
        for i in range(1, r + 1):
            molecule = (molecule * i) % mod
        return denominator * pow(molecule, mod - 2, mod) % mod



def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, k = list(map(int, input().rstrip('\n').split()))
    for i in range(k):
        if n - k + 1 >= i + 1 and k - 1 >= i:
            print((alg_combination_mod(n - k + 1, i + 1, mod) * alg_combination_mod(k - 1, i, mod)) % mod)
        else:
            print(0)


if __name__ == '__main__':
    solve()
Buggy code:
nk = list(map(int, list(input().split())))

n = nk[0]
k = nk[1]

countSplit = 1
countPut = n - k + 1

for i in range(k):
    if i == 0:
        print(n - k + 1)
    elif i <= n - k:
        countSplit = int(countSplit * (k - i) / i)
        countPut = int(countPut * (n - k + 1 - i) / (i + 1))
        print(i,(countPut * countSplit) % (10 ** 9 + 7))
    else:
        print(0)

Fixed code:
import math

nk = list(map(int, list(input().split())))

n = nk[0]
k = nk[1]

countSplit = 1
countPut = n - k + 1

for i in range(k):
    if i == 0:
        print(n - k + 1)
    elif i <= n - k:

        countSplit = math.factorial(k - 1) // math.factorial(k - 1 - i) // math.factorial(i)
        countPut = math.factorial(n - k + 1) // math.factorial(n - k - i) // math.factorial(i + 1)
        """
        countSplit = int(countSplit * (k - i) / i)
        countPut = int(countPut * (n - k + 1 - i) / (i + 1))
        """
        print((countPut * countSplit) % (10 ** 9 + 7))

    else:
        print(0)
Buggy code:
N, K = map(int, input().split())

MOD = 10 ** 9

from operator import mul
from functools import reduce


def cmb(n, r):
	if n < r:
		return 0
	r = min(n - r, r)
	if r == 0:
		return 1
	numer = reduce(mul, range(n, n - r, -1))
	denom = reduce(mul, range(1, r + 1))
	return numer // denom % MOD

for i in range(1, K + 1):
	print(cmb(K - 1, i - 1) * cmb(N - K + 1, i) % MOD)

Fixed code:
N, K = map(int, input().split())

MOD = 10 ** 9 + 7

from operator import mul
from functools import reduce


def cmb(n, r):
	if n < r:
		return 0
	r = min(n - r, r)
	if r == 0:
		return 1
	numer = reduce(mul, range(n, n - r, -1))
	denom = reduce(mul, range(1, r + 1))
	return numer // denom % MOD

for i in range(1, K + 1):
	print(cmb(K - 1, i - 1) * cmb(N - K + 1, i) % MOD)
Buggy code:
N,K=map(int,input().split())


    
mod = 10**9+7
x=0
n = N-K+1
for i in range(2,K+1):
  n = n * (N-K+2-i)*(K+1-i)//i*(i-1)
  print(n%mod)


Fixed code:
N,K=map(int,input().split())

mod = 10**9+7
n = N-K+1
print(n)
for i in range(2,K+1):
  n = n * (N-K+2-i)*(K+1-i)//(i*(i-1))
  print(n%mod)
Buggy code:
from sys import stdin
from math import factorial
 
if __name__ == '__main__':
 
    N, K = [int(x) for x in stdin.readline().rstrip().split()]
 
    tmp = 1000000007
    r = 0
    for r in range(K)
        r += 1
        n = N - K + 1
 
        if n - r < 0 or K - r < 0:
            print(0)
            continue
 
        ret = factorial(n) // factorial(r) // factorial(n - r)
        ret2 = factorial(K-1) // factorial(r-1) // factorial((K - 1) - (r - 1))
 
        print((ret * ret2) % tmp)

Fixed code:
from sys import stdin
from math import factorial

if __name__ == '__main__':

    N, K = [int(x) for x in stdin.readline().rstrip().split()]

    tmp = 1000000007
    r = 0
    for r in range(K):
        r += 1
        n = N - K + 1

        if n - r < 0 or K - r < 0:
            print(0)
            continue

        ret = factorial(n) // factorial(r) // factorial(n - r)
        ret2 = factorial(K-1) // factorial(r-1) // factorial((K - 1) - (r - 1))

        print((ret * ret2) % tmp)
Buggy code:
from operator import mul
from functools import reduce

def cmb(n, r):
    r = min(n - r, r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

a = cmb(n, r)
N, K = map(int, input().split())
for i in range(K):
    # a = factorial(N-K+1) / factorial(i+1) / factorial(N-K+1 - (i+1))
    a = cmb(N-K+1, i + 1)
    # b = factorial(K-1) / factorial(i) / factorial(K-1 - i)
    b = cmb(K-1, i)

    print((a*b) % (10**9+7))

Fixed code:
from operator import mul
from functools import reduce

def cmb(n, r):
    r = min(n - r, r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under % (10 ** 9 + 7)

N, K = map(int, input().split())
for i in range(K):
    if N-K+1 >= i + 1 and K-1 >= i:
        # a = factorial(N-K+1) / factorial(i+1) / factorial(N-K+1 - (i+1))
        a = cmb(N-K+1, i + 1)
        # b = factorial(K-1) / factorial(i) / factorial(K-1 - i)
        b = cmb(K-1, i)
        print((a*b) % (10**9+7))
    else:
        print(0)