Problem p02990 (python)

Fixed submission:
N, K = map(int, input().split())
from operator import mul
from functools import reduce
 
def nCr(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
 
for j in range(K):
  if (K+j)>N:
    print(0)
  else:
    x = (nCr((K-1), j) * nCr(N-K+1, j+1))
    if (x > (10**9+7)):
         print(x%(10**9+7))
    else:
         print(x)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
 
def fact(n):
    if n == 0 or n == 1:
        return 1
    else:
        return n * fact(n-1)

def nCr(n, r):
    return fact(n) // fact(n - r) * fact(r)
 
for j in range(K):
  if (K+j)>N:
    print(0)
  else:
    x = (nCr((K-1), j) * nCr(N-K+1, j+1))
    if (x > (10**9+7)):
         print(x%(10**9+7))
    else:
         print(x)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())

def fact(n):
    if n == 0 or n == 1:
        return 1
    else:
        return n * fact(n-1)

def nCr(n, r):
    return fact(n) // fact(n - r) * fact(r)
 
for j in range(K):
  if (2*j+1)>N:
    print(0)
  else:
    x = (nCr((K-1), j) * nCr(N-K+1, j+1))
    if (x > (10**9+7)):
         print(x%(10**9+7))
    else:
         print(x)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
import math


def fact(n):
    if n == 0 or n == 1:
        return 1
    else:
        return n * fact(n-1)

def nCr(n, r):
    return fact(n) // fact(n - r) * fact(r))
 
for j in range(K):
  if (2*j+1)>N:
    print(0)
  else:
    x = (nCr((K-1), j) * nCr(N-K+1, j+1))
    if (x > (10**9+7)):
         print(x%(10**9+7))
    else:
         print(x)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
import math
def nCr(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
 
for j in range(K):
  if (2*j+1)>N:
    print(0)
  else:
    x = (nCr((K-1), j) * nCr(N-K+1, j+1))
    if (x > (10**9+7)):
         print(x-(10**9+7))
    else:
         print(x)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
import math
def nCr(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
 
for j in range(K):
  if (2*j+1)>N:
    print(0)
  else:
    x = (nCr((K-1), j) * nCr(N-K+1, j+1))
    if (x > (10**9+7)):
         print(x%(10**9+7))
    else:
         print(x)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
from operator import mul
from functools import reduce

def nCr(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

for j in range(K):
  if (2*j+1)>N:
    print(0)
  else:
    x = (nCr((K-1), j) * nCr(N-K+1, j+1))
    if (x > (10**9+7)):
         print(x%(10**9+7))
    else:
         print(x)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
from operator import mul
from functools import reduce

def nCr(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

for j in range(K):
  if (2*j+1)>N:
    print(0)
  else:
    x = (nCr((K+j-2), j) * nCr(N-K+1, j+1)
    if x > 10**9+7:
         print(x%(10**9+7))
    else:
         print(x)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
import math
def nCr(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for j in range(K):
  if (2*j+1)>N:
    print(0)
  else:
    x = (nCr((K+j-2), j) * nCr(N-K+1, j+1)
    if x > 10**9+7:
         print(x-(10**9+7))
    else:
         print(x)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
import math
def nCr(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for j in range(K):
  if (2*j+1)>N:
    print(0)
  else:
    x = (nCr((K+j-2), j) * nCr(N-K+1, j+1)
    if x > 10**9+7:
         print(x%(10**9+7))
    else:
         print(x)