Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02693 (python)

Fixed submission:
K = int(input())
A, B = map(int,input().split())

for i in range(A,B+1):
  if i % K == 0:
    print("OK")
    exit()
    
print("NG")

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

x = N
for x in reversed(range(1,N+1)):
  if x % B != 0:
    print(int(A*x/B)-A*int(x/B))
    exit()

    
print("0")

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

x = N
for x in reversed(range(1,N+1)):
  if x % B != 0:
    print(int(A*x/B)-A*int(x/B))
    exit()

    
print(0)

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

x = N
for x in reversed(range(1,N+1)):
  if x % B != 0:
    print(int(A*x/B)-A*int(x/B))
    exit()


print(0)

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

x = N
for x in reversed(range(1,N+1)):
  if x % B != 0:
    print(int(A*x/B)-A*int(x/B))
    exit()

print(0)

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

for x in reversed(range(1,N+1)):
  if x % B != 0:
    print(int(A*x/B)-A*int(x/B))
    exit()

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

x = N
for x in reversed(range(1,N+1)):
  if x % B != 0:
    print(int(A*x/B)-A*int(x/B))
    exit()

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

x = N
for x in reversed(range(N)):
  if x % B != 0:
    print(int(A*x/B)-A*int(x/B))
    exit()

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

x = N
for i in range(N):
  if x % B != 0:
    print(int(A*x/B)-A*int(x/B))
    exit()
  else:
    x -= 1

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

x = N
for i in range(N):
  if x % B != 0:
    print(int(A*x/B)-A*int(x/B))
    exit()
Problem p02771 (python)

Fixed submission:
l = set(map(int,input().split()))
if len(l) == 2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
l = [input() for _ in range(N)]
m = set(l)
d = dict()

for name in m:
  d[name] = l.count(name)
  
max_in_d = max(d_values())
max_kv_list = sorted([kv[0] for kv in d.items() if kv[1] == max_in_d])
for name in max_kv_list:
  print(name)
Problem p02779 (python)

Fixed submission:
n = int(input())
xs = set(map(int,input().split()))

if len(xs) == n:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
n = int(input())
xs = set(map(int,input().split()))

if lrn(cs) == n:
  print("YES")
else:
  print("NO")
Problem p02790 (python)

Fixed submission:
a,b=map(int,input().split())

bg=max(a,b)
sm=min(a,b)

print(str(sm)*bg)

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

ans=1
for i in range(1,N):
  p_prev = sorted(p[0:i])
  if p[i] < p_prev[0]:
    ans += 1
    
print(ans)
Problem p02819 (python)

Fixed submission:
import math
import sys
sys.setrecursionlimit(100000)

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
  
X = int(input())

def findPrime(x):
  if is_prime(x):
    return x
  else:
    return findPrime(x+1)

print(findPrime(X))

Buggy submission (verdict: Runtime Error):
import math
import sys
sys.setrecursionlimit(100000)

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
  
X = int(input())

def findPrime(x):
  if is_Prime(x):
    return x
  else:
    return findPrime(x+1)

print(findPrime(X))
Problem p02820 (python)

Fixed submission:
#!/usr/bin/env python3

# from numba import njit
import sys
sys.setrecursionlimit(10**8)
# input = stdin.readline

# @njit
def solve(n,k,r,s,p,t):
  winHand = {"r":"p", "s":"b", "p":"s"}
  bestHandMemo = [""]*(n+1) # i手目の勝ち手
  
  memo = [-1]*(n+1)
  def calcPoint(char):
    if char == "r":
      return p
    elif char == "s":
      return r
    elif char == "p":
      return s
    else:
      raise ValueError
  def dp(i):
    if i == 0:
      return 0
    elif memo[i] != -1:
      return memo[i]
    elif i <= k:
      bestHandMemo[i-1] = winHand[t[i-1]] # 自由に出せる
      return dp(i-1) + calcPoint(t[i-1])
    elif winHand[t[i-1]] == bestHandMemo[i-k-1]:
      bestHandMemo[i-1] = "" # あいこでも負けても同じこと
      return dp(i-1)
    else: # 勝てる
      bestHandMemo[i-1] = winHand[t[i-1]]
      return dp(i-1) + calcPoint(t[i-1])
  
  for i in range(n+1):
    memo[i] = dp(i)

  return memo[n]
    



def main():
  N,K = map(int,input().split())
  R,S,P = map(int,input().split())
  T = input()
  print(solve(N,K,R,S,P,T))
  return

if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

# from numba import njit

# input = stdin.readline

# @njit
def solve(n,k,r,s,p,t):
  winHand = {"r":"p", "s":"b", "p":"s"}
  bestHandMemo = [""]*(n+1) # i手目の勝ち手
  
  def calcPoint(char):
    if char == "r":
      return p
    elif char == "s":
      return r
    elif char == "p":
      return s
    else:
      raise ValueError
  def dp(i):
    if i == 0:
      return 0
    elif i <= k:
      bestHandMemo[i-1] = winHand[t[i-1]] # 自由に出せる
      return dp(i-1) + calcPoint(t[i-1])
    elif winHand[t[i-1]] == bestHandMemo[i-k-1]:
      bestHandMemo[i-1] = "" # あいこでも負けても同じこと
      return dp(i-1)
    else: # 勝てる
      bestHandMemo[i-1] = winHand[t[i-1]]
      return dp(i-1) + calcPoint(t[i-1])
  
  memo = [0]*(n+1)
  for i in range(n+1):
    memo[i] = dp(i)

  return memo[n]
    



def main():
  N,K = map(int,input().split())
  R,S,P = map(int,input().split())
  T = input()
  print(solve(N,K,R,S,P,T))
  return

if __name__ == '__main__':
  main()
Problem p02832 (python)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))

counter = 0
for i in range(N):
  if a[i] == counter+1:
    counter += 1

ans = -1 if counter == 0 else N - counter
print(ans)

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

def solve(l, K=0):
  if K+1 in l:
    pos = l.index(K+1)
    return solve(l[pos:],K+1)
  else:
    return K
  
def judge(x):
  if x == 0:
    return -1
  else:
    return N-x


print(judge(solve(a)))

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

def solve(l, K=0):
  if K+1 in l:
    pos = l.index(K+1)
    return solve(l[pos:],K+1)
  else:
    return K
  
def judge(x):
  if x == 0:
    return -1
  else:
    return N-x


print(judge(solve(a)))
Problem p02880 (python)

Fixed submission:
N = int(input())
l = []
for i in range(1,10):
  for j in range(1,10):
    l.append(i*j)
    
if N in l:
  print("Yes")
  exit()
else:
  print("No")
  exit()

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(9):
  for j in range(9):
    if (i+!)*(j+1) == N:
      print("Yes")
      exit()
print("No")
Problem p03073 (python)

Fixed submission:
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(10**6)

def operation(s,f):
    c = 0
    for i in range(len(s)):
        if (s[i] == f and i % 2 == 1) or (s[i] != f and i % 2 == 0):
            c += 1
    return c

def solve(s):
    return min(operation(s,"0"),operation(s,"1"))

def main():
    S = input()
    print(solve(S))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(10**8)

def operation(s,memo=-1,ans=0):
    if len(s) <= 0:
        return ans
    elif s[0] == memo == "0": #変えるパターン
        return operation(s[1:],"1",ans+1)
    elif s[0] == memo == "1": #変えるパターン
        return operation(s[1:],"0",ans+1)
    else:
        return operation(s[1:],s[0],ans)

def solve(s):
    return min(operation(s,"0"),operation(s,"1"))

def main():
    S = input()
    print(solve(S))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(10**10)

def operation(s,memo=-1,ans=0):
    if len(s) <= 0:
        return ans
    elif s[0] == memo == "0": #変えるパターン
        return operation(s[1:],"1",ans+1)
    elif s[0] == memo == "1": #変えるパターン
        return operation(s[1:],"0",ans+1)
    else:
        return operation(s[1:],s[0],ans)

def solve(s):
    return min(operation(s,"0"),operation(s,"1"))

def main():
    S = input()
    print(solve(S))


if __name__ == '__main__':
    main()
Problem p03803 (python)

Fixed submission:
A,B=map(int,input().split())

def judge(a,b):
  if a > b > 1 or (a == 1 and b != 1):
    return "Alice"
  elif a == b:
    return "Draw"
  else:
    return "Bob"
  
print(judge(A,B))

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())

def judge(a,b):
  if a > b:
    return "Alice"
  elif a = b:
    return "Draw"
  else:
    return "Bob"
  
print(judge(A,B))
Problem p02577 (python)

Fixed submission:
n = int(input())
if n%9 == 0: print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header
int main() {
	ll sum=0;
	string n;
	cin >> n;
	rep(i, n.length()){
		sum+=n[i]-'0';
	}
	if(sum%9 == 0) puts("Yes");
	else puts("No");
	return 0;
}
Problem p02572 (python)

Fixed submission:
def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    mod = 10**9+7
    a_sum = sum(A)
    a_cum = [0] * (n+1)
    for i in range(n):
        a_cum[i + 1] = a_cum[i] + A[i]
    ans = 0
    for i in range(len(A)-1):
        ans += A[i] * (a_sum - a_cum[i+1]) % mod
        ans %= mod
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    mod = 10**9+7
    # a_sum = sum(A)
    a_cum = [0] * (n+1)
    for i in range(n):
        a_cum[i + 1] = a_cum[i] + A[i]
    ans = 0
    for i in range(len(A)-1):
        ans += A[i] * (a_cum[n] - a_cum[i+1]) % mod
        ans %= mod
    print(ans)

if __name__ == '__main__':
    main()

n = int(input())
A = [int(x) for x in input().split()]
mod = 10**9+7
# a_sum = sum(A)
a_cum = [0] * (n+1)
for i in range(n):
    a_cum[i + 1] = a_cum[i] + A[i]
ans = 0
for i in range(len(A)-1):
    ans += A[i] * (a_cum[n] - a_cum[i+1])
ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np

def main():
    n = int(input())
    A_ = [int(x) for x in input().split()]
    A = [a for a in A_ if a != 0]
    N = len(A)

    # mod = 10**9+7
    mod = 200003
    PR = 2
    order = [1]
    x = PR
    while x != 1:
        order.append(x)
        x *= PR
        x %= mod

    order_l = len(order)
    where = np.zeros(mod, int)
    for i in range(order_l):
        where[order[i]] = i
    prevCnt = np.zeros(mod, int)
    resCnt = np.zeros(mod, int)
    for n in range(N):
        if A[n] != 0:
            prevCnt[where[A[n]]] += 1
            resCnt[(A[n] * A[n]) % mod ] -= 1
    N_=1
    while N_ < 2*len(prevCnt): N_ *= 2
    nf = np.zeros(N_,int)
    nf[:len(prevCnt)]=prevCnt
    nf=np.fft.rfft(nf)
    fftRes = np.rint( np.fft.irfft(nf*nf))
    for r in range(len(fftRes)):
        if fftRes[r] != 0:
            resCnt[order[r % order_l]] += fftRes[r]
    ans = 0
    for p in range(mod):
        if resCnt[p] != 0:
            ans += (resCnt[p] // 2) * p
    print(ans)

if __name__ == '__main__':
    main()
Problem p02623 (python)

Fixed submission:
def main():
    n, m, k = map(int, input().split())
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]

    acum = [0] * (n + 1)
    bcum = [0] * (m + 1)
    for i in range(n):
        acum[i + 1] = acum[i] + a[i]
    for i in range(m):
        bcum[i + 1] = bcum[i] + b[i]
        
    j = m
    maxv = 0
    for i in range(n+1):
        if acum[i] > k:
            break
        while acum[i] + bcum[j] > k:
            j -= 1
        maxv = max(maxv, i + j)
    print(maxv)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m, k = map(int, input().split())
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]

    maxv = 0
    acum = [0] * (n + 1)
    bcum = [0] * (m + 1)
    for i in range(n):
        acum[i + 1] = acum[i] + a[i]
    for i in range(m):
        bcum[i + 1] = bcum[i] + b[i]

    for i in range(n + 1):
        if acum[i] > k:
            continue
        maxv = max(maxv, i + bisect_right(bcum, k - acum[i]) - 1)
    print(maxv)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from collections import deque
from heapq import heapify, heappush, heappop
def main():
    n, m, k = map(int, input().split())
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]
    a_q = deque(a)
    b_q = deque(b)
    i = 0
    l = []
    heapify(l)
    point = 0
    cnt = 0
    aq = a_q.popleft()
    bq = b_q.popleft()
    heappush(l, aq)
    heappush(l, bq)
    if sum(a) + sum(b) <= k:
        print(len(a) + len(b))
    else:
        while point <= k:
            min_l = heappop(l)
            if point + min_l > k:
                print(cnt)
                exit()
            else:
                point += min_l
                cnt += 1
            if min_l == aq:
                if len(a_q) != 0:
                    aq = a_q.popleft()
                    heappush(l, aq)
            else:
                if len(b_q) != 0:
                    bq = b_q.popleft()
                    heappush(l, bq)
        print(cnt)

if __name__ == '__main__':
    main()
Problem p02629 (python)

Fixed submission:
def main():
    n = int(input())
    ans = []
    for i in range(1, 12):
        if n <= 26**i:
            n -= 1
            for j in range(i):
                a = n % 26
                ans.append(chr(97+a))
                n = n // 26
            break
        else:
            n -= 26**i
    print(*ans[::-1], sep='')
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    ans = []
    A = [26, 702, 18278, 475254, 12356630, 321272406, 8353082582, 217180147158, 5646683826134, 146813779479510]
    for i in range(9, 0, -1):
        if n > A[i-1]:
            a = n // 26**i
            if a <= 26:
                ans.append(chr(96+a))
                n = n - (26**i*a)
            else:
                a = 26
                ans.append(chr(96+a))
                n = n - (26**i*a)
    ans.append(chr(96+n))
    print(*ans, sep='')
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    ans = []
    A = [26, 702, 18278, 475254, 12356630, 321272406, 8353082582, 217180147158, 5646683826134, 146813779479510]
    for i in range(9, 0, -1):
        if n > A[i-1]:
            a = n // 26**i
            if a <= 26:
                ans.append(chr(96+a))
                n = n - (26**i*a)
            else:
                a = 26
                ans.append(chr(96+a))
                n = n - (26**i*a)
    ans.append(chr(96+n))
    print(*ans, sep='')

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    ans = []
    A = [3817158266467286,  146813779479510, 5646683826134, 217180147158, 8353082582, 321272406, 12356630, 475254,  18278, 702, 26]
    for i in range(11, 0, -1):
        if n > A[11-i]:
            a = n // 26**i
            if a == 27:
                a = 26
                print('i',i,  'a',a)
                ans.append(chr(96+a))
                n = n - (26**i*a)
    ans.append(chr(96+n))
    print(*ans, sep='')

if __name__ == '__main__':
    main()
Problem p02659 (python)

Fixed submission:
from decimal import *
def main():
    a, b = map(str, input().split())
    res = int(a) * Decimal(b)
    print(int(res))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
  
    a, b = map(str, input().split())
    res = int(a) * ((int(b)+0.001) * 100) // 100
    print(int(res))
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
  
    a, b = map(int, input().split())
    res = a * ((b+0.001) * 100) // 100
    print(int(res))
 
if __name__ == '__main__':
    main()
Problem p02785 (python)

Fixed submission:
def main():
    n, k = map(int, input().split())
    h = [int(x) for x in input().split()]
    h_s = sorted(h)
    if len(h_s) <= k:
        ans = 0
    else:
        for _ in range(k):
            h_s.pop()
        ans = sum(h_s)
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())
    h = [int(x) for x in input().split()]
    h_s = sorted(h)
    if len(h_s) <= k:
        ans = 0
    else:
        for _ in range(k):
            h_s.pop()
        ans = sum(h_s)
    print(ans)

if __name__ == '__main__':
    main(
Problem p02819 (python)

Fixed submission:
from bisect import bisect_left

def main():
    def eratosthenes(n):
        A = [i for i in range(2, n+1)]
        P = []
        i = 2
        while i**2 <= n:
            prime = min(A)
            P.append(prime)
            j = 0
            while j < len(A):
                if A[j] % prime == 0:
                    A.pop(j)
                    continue
                j += 1
            i += 1    
        for a in A:
            P.append(a)
        return P

    x = int(input())
    prime_table = eratosthenes(100003)
    idx = bisect_left(prime_table, x)
    ans = prime_table[idx]
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def eratosthenes(n):
    A = [i for i in range(2, n+1)]
    P = []
    i = 2
    while i**2 <= n:
        prime = min(A)
        P.append(prime)
        j = 0
        while j < len(A):
            if A[j] % prime == 0:
                A.pop(j)
                continue
            j += 1
        i += 1    
    for a in A:
        P.append(a)
    return P
    
x = int(input())
prime_table = eratosthenes(100003)
prime_set = set(prime_table)
if x in prime_set:
    print(x)
else:
    idx = bisect_right(prime_table, x)
    ans = prime_table[idx]
    print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_right

def eratosthenes(n):
    A = [i for i in range(2, n+1)]
    P = []
    i = 2
    while i**2 <= n:
        prime = min(A)
        P.append(prime)
        j = 0
        while j < len(A):
            if A[j] % prime == 0:
                A.pop(j)
                continue
            j += 1
        i += 1    
    for a in A:
        P.append(a)
    return P
    
x = int(input())
prime_table = eratosthenes(100003)
prime_set = set(prime_table)
if x in prime_set:
    print(x)
else:
    idx = bisect_left(prime_table, x)
    ans = prime_table[idx]
    print(ans)
Problem p02912 (python)

Fixed submission:
from heapq import heapify, heappush, heappop

def main():
    n, m = map(int, input().split())
    a = [int(x)*-1 for x in input().split()]
    ans = sum(a)*-1
    diff = 0
    
    heapify(a)
    for _ in range(1, m+1):
        _h_a = heappop(a) * -1
        diff += _h_a - _h_a // 2
        heappush(a, (_h_a // 2)*-1)
    ans -= diff
    print(ans)
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    a = [int(x)*-1 for x in input().split()]
    ans = sum(a)*-1
    diff = 0
    
    heapify(a)
    for _ in range(1, m+1):
        _h_a = heappop(a) * -1
        diff += _h_a - _h_a // 2
        heappush(a, (_h_a // 2)*-1)
    ans -= diff
    print(ans)
    
if __name__ == '__main__':
    main()
Problem p02951 (python)

Fixed submission:
def main():
    a, b, c = map(int, input().split())
    ans = c - (a - b)
    if ans > 0:
        print(ans)
    else:
        print(0)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    h = list(map(int, input().split()))

    pre = 0
    flag = True
    for i in range(n):
        if h[i] - 1 >= pre:
            h[i] -= -1
        if h[i] < pre:
            flag = False
            break
        pre = h[i]
    
    if flag:
        print('Yes')
    else:
        print('No')
                

if __name__ == '__main__':
    main()
Problem p02990 (python)

Fixed submission:
from operator import mul
from functools import reduce

def main():

    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 = map(int, input().split())
    mod = 10**9+7

    # 青をi個に分割する組みわせ
    # i個に分割するにはi-1個区切りが必要
    # 区切りを入れられる場所はk-1
    # k-1Ci-1 
    for i in range(1, k+1):
        #cmb(k-1, i-1))
    # 赤の分割
    # 分け方として0を許すように考えて
    # n-k個 + 端2つをi+1に分割する（n-k+1の選べる場所からi個区切りを選ぶ（青がi個だから））
        #cmb(n-k+2, i)
        if n-k+1 >= i:
            print(cmb(k-1, i-1) * cmb(n-k+1, i) % mod)
        else:
            print(0)

if __name__ == '__main__':
    main()

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

def main():

    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 = map(int, input().split())
    mod = 10**9+7
    
    # 青をi個に分割する組みわせ
    # i個に分割するにはi-1個区切りが必要
    # 区切りを入れられる場所はk-1
    # k-1Ci-1 
    for i in range(1, k+1):
        #cmb(k-1, i-1))
    # 赤の分割
    # 分け方として0を許すように考えて
    # n-k個 + 端2つをi+1に分割する（n-k+1の選べる場所からi個区切りを選ぶ（青がi個だから））
        #cmb(n-k+2, i)
        print(cmb(k-1, i-1) * cmb(n-k+1, i) % mod)

if __name__ == '__main__':
    main()