Problem p02990 (python)

Fixed submission:
import math

def combi(n ,k):
    return math.factorial(n)//(math.factorial(k)*math.factorial(n-k))

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

for i in range(1,K+1):
    if R + 1 >= i:
        tmp = combi(R+1,i) * combi(K-1,i-1)
    else:
        tmp = 0
    print(tmp % (10**9+7))

Buggy submission (verdict: Runtime Error):
import numpy as np
 
def main():
    N,M = map(int,input().split())
    A = np.array(list(map(int,input().split())))
    A = np.sort(A)
    BC = [] #空の配列
 
    for i in range(M):
        tmp = list(map(int,input().split()))
        BC.append(tmp)
 
    #降順にソート
    BC =sorted(BC, key=lambda x: x[1],reverse=True)
    
    c = 0 #カーソル
    flag = 0
 
    for k in BC:
        
        if flag == 1:
            break
 
        a = k[0] #項数
        b = k[1] #置換する値
 
        #末項がb以下　→　置換する意義がある
        if A[c+a-1] <= b:
            A[c:c+a] = [b] * a
            print(A)
            c = c + a
        #初項がb以上　→　置換する意義がない
        elif A[c] >= b:
            flag = 1
            break
        else:
        #初項がb未満だが、末項がbより大きい　→　どこかで切り替わる点が存在
            for j in range(a):
                if A[c+j] > b:
                    A[c:c+j] = [b] * j
                    flag = 1
                    break
 
    print(np.sum(A))
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math

def combi(n ,k):
    return math.factorial(n)//(math.factorial(k)*math.factorial(n-k))

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

for i in range(1,K+1):
    tmp = combi(R+1,i) * combi(K-1,i-1)
    print(tmp % (10**9+7))

Buggy submission (verdict: Runtime Error):
import math

def combi(n ,k):
    return math.factorial(n)//(math.factorial(k)*math.factorial(n-k))

bignum = 1000000007

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

for i in range(1,K+1):
    tmp = combi(R+1,i) * combi(K-1,i-1)
    print(tmp % bignum)

Buggy submission (verdict: Runtime Error):
import math

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

def C(n, r):
    return P(n, r)//math.factorial(r)

bignum = 1000000007

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

for i in range(1,K+1):
    tmp = C(R+1,i) * C(K-1,i-1)
    print(tmp % bignum)

Buggy submission (verdict: Runtime Error):
from math import factorial

def cmb(n, r):
    a = factorial(n) / factorial(r) / factorial(n - r)
    return a

bignum = 1000000007

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

for i in range(1,K+1):
    tmp = cmb(R+1,i) * cmb(K-1,i-1)
    print(int(tmp) % bignum)

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

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

bignum = 1000000007

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

for i in range(1,K+1):
    tmp = cmb(R+1,i)*cmb(K-1,i-1)
    print(tmp%bignum)

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

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

bignum = 1000000007

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

for i in range(1,K+1):
    tmp = cmb(R+1,i)*cmb(K-1,i-1)
    print(tmp%bignum)

Buggy submission (verdict: Runtime Error):
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

bignum = 1000000007

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

for i in range(1,K+1):
    tmp = cmb(R+1,i)*cmb(K-1,i-1)
    print(tmp%bignum)