Problem p02990 (python)

Fixed submission:
N, K = map(int,input().split()) # 複数の数字を変数に格納

red = N - K
blue = K
division = 10 ** 9 + 7

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 % division
  
for i in range(K):
    if i > red:
        print("0")
    else:
        tmp_blue = cmb(blue-1,i) % division
        tmp_red = cmb(red+1,red-i)
        result = int(tmp_blue * tmp_red % division)
        print("{}".format(result))

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split()) # 複数の数字を変数に格納

red = N - K
blue = K
division = 10 ** 9 + 7

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 % division
  
for i in range(K):
    if i > red:
        print("0")
    else:
        tmp_blue = cmb(blue-1,i) % division
        tmp_red = 1
        for j in range(i+1):
            tmp_red = tmp_red * (red+1-j) / (i+1-j) 
        result = int(tmp_blue * tmp_red % division)
        print("{}".format(result))

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split()) # 複数の数字を変数に格納

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
  
red = N - K
blue = K
division = 10 ** 9 + 7

for i in range(K):
    if i > red:
        print("0")
    else:
        tmp_blue = cmb(blue-1,i) % division
        tmp_red = 1
        for j in range(i+1):
            tmp_red = tmp_red * (red+1-j) / (i+1-j) 
        result = int(tmp_blue * tmp_red % division)
        print("{}".format(result))

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split()) # 複数の数字を変数に格納

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
  
red = N - K
blue = K
division = 10 ** 9 + 7

for i in range(K):
    if i > red:
        print("0")
    else:
        tmp_blue = cmb(blue-1,i) % division
        tmp_red = 1
        for j in range(i+1):
            tmp_red = tmp_red * (red+1-j) / (j+1) 
        result = int(tmp_blue * tmp_red % division)
        print("{}".format(result))

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split()) # 複数の数字を変数に格納

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
  
red = N - K
blue = K
division = 10 ** 9 + 7

for i in range(K):
    if red == 0 and i == 0:
        print("1")
    elif i > red:
        print("0")
    else:
        tmp_blue = cmb(blue-1,i)
        tmp_red = 1
        for j in range(i+1):
            tmp_red = tmp_red * (red+1-j) / (j+1)
        result = int(tmp_blue * tmp_red % division)
        print("{}".format(result))

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split()) # 複数の数字を変数に格納

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
  
red = N - K
blue = K
division = 10 ** 9 + 7

for i in range(K):
    if i > red:
        print("0")
    else:
        tmp_blue = cmb(blue-1,i)
        tmp_red = 1
        for j in range(i+1):
            tmp_red = tmp_red * (red+1-j) / (j+1) % division 
        result = int(tmp_blue * tmp_red % division)
        print("{}".format(result))

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split()) # 複数の数字を変数に格納

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
  
red = N - K
blue = K
division = 10 ** 9 + 7

for i in range(K):
    if i > red:
        print("0")
    else:
        tmp_blue = cmb(blue-1,i)
        tmp_red = 1
        for j in range(i+1):
            tmp_red = tmp_red * (red+1-j) / (j+1) 
        result = int(tmp_blue * tmp_red % division)
        print("{}".format(result))

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split()) # 複数の数字を変数に格納

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
  
red = N - K
blue = K
division = 10 ** 9 + 7

for i in range(K):
    if i > red:
        print("{} 0".format(i+1))
    else:
        tmp_blue = cmb(blue-1,i)
        tmp_red = 1
        for j in range(i+1):
            tmp_red = tmp_red * (red+1-j) / (j+1) 
        result = int(tmp_blue * tmp_red % division)
        print("{} {}".format(i+1,result))

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split()) # 複数の数字を変数に格納

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
  
 red = N - K
blue = K
division = 10 ** 9 + 7

for i in range(K):
    if i > red:
        print("{} 0".format(i+1))
    else:
        tmp_blue = cmb(blue-1,i)
        tmp_red = 1
        for j in range(i+1):
            tmp_red = tmp_red * (red+1-j) / (j+1) 
        result = int(tmp_blue * tmp_red % division)
        print("{} {}".format(i+1,result))