Problem p02990 (python)

Fixed submission:
# coding: utf-8
# Your code here!
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 % INF

N,K = map(int,input().split())
INF = 10**9 + 7
for i in range(1,K+1):
    print(cmb(K-1, i-1) * cmb(N-K+1, i) % INF)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import itertools
import math
from scipy.special import comb

N,K = map(int,input().split())
INF = 10**9 + 7
for i in range(1,K+1):
    print(comb(K-1, i-1, True) * comb(N-K+1, i, True) % INF)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import itertools
import math
from scipy.special import comb

N,K = map(int,input().split())
m = 10**9 + 7
for i in range(1,K+1):
    b = comb(K-1, i-1, True)
    r = comb(N-K+1, i, True)
    print(b * r % m)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import itertools
import math
from scipy.special import comb

N,K = map(int,input().split())
m = 10**9 + 7
for i in range(1,K+1):
    b = comb(K-1, i-1, True)
    r = comb(N-K+1, i, True)
    print(int(b * r % m))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import itertools
import math
from scipy.special import comb

N,K = map(int,input().split())
m = 10**9 + 7
for i in range(1,K+1):
    b = comb(K-1, i-1, True)
    r = comb(N-K+1, i, True)
    print(int(b * r % m))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import itertools
import math
from scipy.special import comb

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())
m = pow(10, 9) + 7
for i in range(1,K+1):
    b = cmb(K-1, i-1)
    r = cmb(N-K+1, i)
    print(int(b * r % m))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import itertools
import math
from scipy.special import comb

N,K = map(int,input().split())
m = pow(10, 9) + 7
for i in range(1,K+1):
    b = comb(K-1, i-1, True)
    r = comb(N-K+1, i, True)
    print(int(b * r % m))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import itertools
import math
from scipy import special

N,K = map(int,input().split())
m = math.pow(10, 9) + 7
for i in range(1,K+1):
    b = special.comb(K-1, i-1, True)
    r = special.comb(N-K+1, i, True)
    print(int(b * r % m))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import itertools
import math
from scipy import special

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

for i in range(1,K+1):
    b = special.comb(K-1, i-1, True)
    r = special.comb(N-K+1, i, True)
    print(int(b * r % (math.pow(10, 9) + 7)))