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

Fixed submission:
import numpy as np
N = int(input())
list_A = list(map(int,input().split()))
for _ in range(100):
    min_A = min(list_A)
    list_A.remove(min_A)
    l = np.array([list_A]) % min_A
    lr = list(l.ravel())
    lr.append(min_A)
    list_A = [x for x in lr if x != 0]
    if len(list_A) <= 1:
        break
print(list_A[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
list_A = list(map(int,input().split()))
for _ in range(100):
    min_A = min(list_A)
    list_A.remove(min_A)
    l = np.array([list_A]) % min_A
    lr = list(l.ravel())
    lr.append(min_A)
    list_A = [x for x in lr if x != 0]
    if len(list_A) <= 1:
        break
print(list_A[0])
Problem p03137 (python)

Fixed submission:
import numpy as np
N, M = map(int, input().split())
list_x = list(map(int, input().split()))
list_x.sort()
list_d = np.diff(list_x)
list_data = list_d.tolist()
if len(list_data) != 0:
    if N >= 2:
        list_data.sort()
        del list_data[-(N-1):]
        print(sum(list_data))
    if N == 1:
        print(sum(list_data))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())
list_x = list(map(int, input().split()))
list_x.sort()
list_d = np.diff(list_x)
list_data = list_d.tolist()
if len(list_data) != 0:
    for _ in range(N-1):
        list_data.remove(max(list_data))
    print(sum(list_data))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
list_x = list(map(int, input().split()))
list_x.sort()
list_data = []
a = list_x[0]
for i,x in enumerate(list_x):
    if i != 0:
        diff = x - a
        a = x
        list_data.append(diff)
    else:
        pass
if len(list_data) != 0:
    for _ in range(N-1):
        list_data.remove(max(list_data))
    print(sum(list_data))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
list_x = list(map(int, input().split()))
list_x.sort()
list_data = []
a = list_x[0]
for i,x in enumerate(list_x):
    if i != 0:
        diff = x - a
        a = x
        list_data.append(diff)
    else:
        pass
if len(list_data) != 0:
    for _ in range(N-1):
        list_data.remove(max(list_data))
    print(sum(list_data))
else:
    print(0)
Problem p03042 (python)

Fixed submission:
a = input()
mm = int(a[:2])
yy = int(a[2:])

can1 = True
can2 = True

if mm>12:
  can1 = False
if mm<1:
  can1= False

if yy>12:
  can2 = False
if yy<1:
  can2 = False

if can1 and can2:
  print("AMBIGUOUS")
elif can2:
  print("YYMM")
elif can1:
  print("MMYY")
else:
  print("NA")

Buggy submission (verdict: Runtime Error):
a = input()
if (a[:2] >0 and a[:2]<13) and (a[2:] >0 and a[2:]<13):
  print("both")
if (a[:2] >0 and a[:2]<13) and (a[2:] ==0 or a[2:]>13):
  print("MMYY")
if (a[:2] ==0 or  a[:2]>13) and (a[2:]>0 or a[2:]<13):
  print("YYMM")
if (a[:2] ==0 or  a[:2]>13) and (a[2:] ==0 or a[2:]>13):
  print("YYMM")
Problem p02970 (python)

Fixed submission:
n,d = map(int, input().split())
a = 0
ct=0

for i in range(n):
    if n<d:
        print(1)
        break
    else:
        a = n- i*(2*d+1)
        if a<=0:
            print(i)
            break

Buggy submission (verdict: Runtime Error):

n,d = map(int, input().split())

while True:
    a = n- i*(2*d+1)
    if a<=0:
        print(i)
        break
    else:
        continue

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

while True:
    a = n- i*(2*d+1)
    if a<=0:
        print(i)
        break
Problem p02970 (python)

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

import math

print(math.ceil(N/(1+2*D)))

Buggy submission (verdict: Runtime Error):
N,D=map(int,input().split())
print(N)
print(D)
import math
print(N/(1+2*D))
math.ceil(N/(1+2*D)
Problem p03631 (python)

Fixed submission:
N = int(input())
N = str(N)
if N[::-1] == N:
  print('Yes')
else:
  print('No')

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

if B<C:
    res = 0
else:
    res = min(B,D) - max(A<C)
print(res)
Problem p03346 (python)

Fixed submission:
N=int(input())
P=[int(input()) for _ in range(N)]
Q=[0 for _ in range(N)]

for i in range(N):
    Q[P[i]-1]=i

cnt=0
tmp=0
for i in range(N-1):
    if Q[i]<Q[i+1]:
        cnt+=1
    else:
        if tmp<cnt+1:
            tmp=cnt+1
        cnt=0

if tmp==0:
    tmp=cnt+1

print(N-tmp)

Buggy submission (verdict: Runtime Error):
N=int(input())
P=[int(input()) for _ in range(N)]
Q=[0 for _ in range(N)]

if N=1:
    print(1)
else:
    for i in range(N):
        Q[P[i]-1]=i

    cnt=0
    tmp=0
    for i in range(N-1):
        if Q[i]<Q[i+1]:
            cnt+=1
        else:
            if tmp<cnt+1:
                tmp=cnt+1
            cnt=0

    print(N-tmp)
Problem p03011 (python)

Fixed submission:
lists = list(map(int,input().split(" ")))
lists.sort()
print(lists[0] + lists[1])

Buggy submission (verdict: Runtime Error):
lists = [P+Q,Q+R,R+P]
print(min(lists))
Problem p03075 (python)

Fixed submission:
lists = [0,0,0,0,0,0]
for i in range(len(lists)):
        lists[i] = int(input())

if lists[4]-lists[0]<=lists[5]:
        print("Yay!")
else:
        print(":(")

Buggy submission (verdict: Runtime Error):
lis

Buggy submission (verdict: Runtime Error):
lis = [a,b,c,d,e,k] 
for i in lis:
  i = input()
if e-a<=k:
  print('Yay!')
else:
  print(':(')
Problem p03207 (python)

Fixed submission:
n = int(input())
lists =[int(input()) for i in range(n)]
sums = sum(lists)
maxs = max(lists)
print(sums-maxs//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
lists =[int(input()) for i in range(n)]
sums = sum(lists)
maxs = max(lists)
print(sums-max//2)
Problem p02987 (python)

Fixed submission:
s=str(input())
lst=list(s)
lst.sort()
result = False

if lst[0] == lst[1]:
    if lst[1] != lst[2]:
        if lst[2] == lst[3]:
            result = True

if result:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import math
n,k=map(int,input().split()) 
lst=list()

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

for i in range(1, k+1):
    if n-k>i:
        lst.append(combinations_count(n-k+1, i) * combinations_count(k-i+(i-1), i-1))  
    elif n-k==i:
        lst.append(combinations_count(K-1,i-1))
    else:
        lst.append(int(0))

for i in range(k):
    print(lst[i]%(10**9+7))
Problem p03315 (python)

Fixed submission:
S = input()
A = 0
for s in S:
	if s == "-":
		A -= 1
	if s == "+":
		A += 1
print(A);

Buggy submission (verdict: Runtime Error):
S = input()
A = 0
for s in S:
	if s == "-":
		A--
	if s == "+":
		A++
print(A);

Buggy submission (verdict: Runtime Error):
S = input()
A = 0
for s in S
	if s == "-":
		A--
	if s == "+":
		A++
print(A);
Problem p02987 (python)

Fixed submission:
a = input()
if a[0] == a[1]:
    if a[0] != a[2] and a[2] == a[3]:
        print("Yes")
    else:
        print("No")
else:
    if a[0] == a[2] and a[1] == a[3]:
        print("Yes")
    elif a[0] == a[3] and a[1] == a[2]:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
a = [x for x in input().split()]
if a[0] == a[1]:
    if a[0] != a[2] and a[2] == a[3]:
        print("Yes")
    else:
        print("No")
else:
    if a[0] == a[2] and a[1] == a[3]:
        print("Yes")
    elif a[0] == a[3] and a[1] == a[2]:
        print("Yes")
    else:
        print("No")
Problem p02990 (python)

Fixed submission:
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

def prob_d(n=None, k=None):
    if n is None and k is None:
        n, k = [int(a) for a in input().split()]
    div = 10 ** 9 + 7
    for i in range(k):
        if n - k + 1 < i + 1:
            print("0")
        else:
            if k == 1:
                ans = cmb(n, i+1) % div
                print(str(ans))
            else:
                ans = cmb(k-1, i) % div
                ans *= (cmb(n - k + 1, i + 1) % div)
                ans = ans % div
                print(str(ans))


prob_d()

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

def prob_d(n=None, k=None):
    if n is None and k is None:
        n, k = [int(a) for a in input().split()]
    div = 10 ** 9 + 7
    for i in range(k):
        if n - k + 1 < i:
            print("0")
        else:
            if k == 1:
                ans = cmb(n, i+1) % div
                print(str(ans))
            else:
                ans = cmb(k-1, i) % div
                ans *= (cmb(n - k + 1, i + 1) % div)
                ans = ans % div
                print(str(ans))

prob_d()

Buggy submission (verdict: Runtime Error):
def prob_d(n=None, k=None):
    if n is None and k is None:
        n, k = [int(a) for a in input().split()]
    div = 10 ** 9 + 7
    for i in range(k):
        if n - k + 1 < i:
            print("0")
        else:
            if k == 1:
                ans = cmb(n, i+1) % div
                print(str(ans))
            else:
                ans = cmb(k-1, i) % div
                ans *= (cmb(n - k + 1, i + 1) % div)
                ans = ans % div
                print(str(ans))


prob_d()

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

def prob_d():
    n, k = [int(a) for a in input().split()]
    div = 10 ** 9 + 7
    for i in range(k):
        if n - k + 1 < i:
            print("0")
        else:
            if k == 1:
                ans = cmb(n, i+1) % div
                print(str(ans))
            else:
                ans = cmb(k-1, i) % div
                ans *= cmb(n - k + 1, i + 1) % div
                ans = ans % div
                print(str(ans))


prob_d()
Problem p03209 (python)

Fixed submission:
N, X = [int(a) for a in input().split()]
ans = 0
now_level = N
num_list = [2 ** (n + 2) - 3 for n in range(N + 1)]
while X > 0:
    if X <= now_level:
        break
    num_list = [2 ** (n + 2) - 3 for n in range(now_level + 1)]
    plus_base = [a + now_level - b for a, b in zip(num_list, range(now_level + 1))]
    eat_num = max([a for a in plus_base if a <= X])
    eat_level = plus_base.index(eat_num)
    now_level = eat_level
    ans += int((num_list[eat_level] + 1) / 2 + 0.1)
    X -= eat_num
    if X > 0:
        X -= 1
        ans += 1
print(str(ans))

Buggy submission (verdict: Runtime Error):
N, X = [int(a) for a in input().split()]
ans = 0
now_level = N
num_list = [2 ** (n + 2) - 3 for n in range(N + 1)]
while X > 0:
    if X == 1:
        break
    num_list = [2 ** (n + 2) - 3 for n in range(now_level + 1)]
    plus_base = [a + now_level - b for a, b in zip(num_list, range(now_level + 1))]
    eat_num = max([a for a in plus_base if a <= X])
    eat_level = plus_base.index(eat_num)
    now_level = eat_level
    ans += int((num_list[eat_level] + 1) / 2 + 0.1)
    X -= eat_num
    if X > 0:
        X -= 1
        ans += 1
print(str(ans))
Problem p02987 (python)

Fixed submission:
ss = input()
set_ss = set(ss)
if len(set_ss) != 2 :
  print("No")
else:
  for s in set(ss):
    if ss.count(s) != 2:
      print("No")
      break
  else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
ss = input()
set_ss = set(ss)
if len(set_ss) != 2 :
  print("No")
else:
	for s in set(ss):
    	if ss.count(s) != 2:
          print("No")
          break
    else:
    	print("Yes")
Problem p03012 (python)

Fixed submission:
import numpy as np

N = int(input())
Ws = np.array(list(map(int,input().split())))

ret = []
for i in range(N):
  s1 = Ws[:i+1].sum()
  s2 = Ws[i+1:].sum()
  ret.append(abs(s1-s2))
  
print(min(ret))

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

N = int(input())
Ws = np.array(map(int,input().split()))

ret = []
for T in range(1,N):
  s1 = Ws[Ws<=T]
  s2 = Ws[Ws>T]
  ret.append(abs(s1-s2))
  
print(min(ret))
Problem p03041 (python)

Fixed submission:
# coding: utf-8
# Your code here!

inp = input().split()
N = int(inp[0])
K = int(inp[1])

S = input()

ch = S[K - 1]

print(S[:K - 1] + ch.lower() + S[K:])

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

inp = input().split()
N = int(inp[0])
K = int(inp[1])

S = input()

ch:str = S[K - 1]


print(S[:K - 1] + ch.lower() + S[K:])
Problem p03042 (python)

Fixed submission:
# coding: utf-8
# Your code here!


S = input()

a = int(S[:2])
b = int(S[2:])

if a > 12 and b <= 12 and b > 0:
    print("YYMM")
elif a <= 12 and b > 12 and a > 0:
    print("MMYY")
elif a <= 12 and b <= 12 and a > 0 and b > 0:
    print("AMBIGUOUS")
elif a == 0 and b <= 12 and b > 0:
    print("YYMM")
elif b == 0 and a <= 12 and a > 0:
    print("MMYY")
else:
    print("NA")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!


S:str = input()

a = int(S[:2])
b = int(S[2:])

if a > 12 and b <= 12 and b > 0:
    print("YYMM")
elif a <= 12 and b > 12 and a > 0:
    print("MMYY")
elif a <= 12 and b <= 12 and a > 0 and b > 0:
    print("AMBIGUOUS")
else:
    print("NA")
Problem p03011 (python)

Fixed submission:
P,Q,R = map(int, input().split())
A = [P+Q, P+R, R+Q]
print(min(A))

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

for j in range(N-1):
    W1 = W[:j+1]
    W2 = W[j+1:N]
    s = abs(sum(W1) - sum(W2))
    m = min(m, s)

print(m)
Problem p02990 (python)

Fixed submission:
import math
N,K=map(int,input().split())

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

for i in range(1,K+1):
    if i>min(K,N-K+1):print(0)
    else:print(((combinations_count(N-K+1,i))*(combinations_count(K-1,i-1)))%1000000007)

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

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

for i in range(1,K+1):
    print((combinations_count(N-K+1,i)%1000000007)*(combinations_count(K-1,i-1)%1000000007)%1000000007)
Problem p03013 (python)

Fixed submission:
N,M=map(int,input().split())
a=[]
for _ in [0]*M:
    a.append(int(input()))

a.append(N+1)    

step=[]

if a[0]==1:j=1
else:j=0

for i in range(2,N+1):
    if i <a[j]:
        step.append(i)
    else:
        step.append(0)
        j+=1

stepsum=[1]   #k段目までの組み合わせ
if a[0]==1:   #1段目がNGなら
    stepsum.append(0)
else:
    stepsum.append(1)
    
for i in step:
    if i==0:stepsum.append(0)
    else:stepsum.append(((stepsum[i-1]+stepsum[i-2]))%1000000007)


ans=stepsum[N]%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
a=[]
for _ in [0]*M:
    a.append(int(input()))

stepsum=[1]   #k段目までの組み合わせ
if a[0]==1:   #1段目がNGなら
    stepsum.append(0)
else:
    stepsum.append(1)
    
for i in range(2,N+1):
    stepsum.append(((stepsum[i-1]+stepsum[i-2])*(not(i in a)))%1000000007)

ans=stepsum[N]%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
a=[]
for _ in [0]*M:
    a.append(int(input()))

stepsum=[1]   #k段目までの組み合わせ
if a[0]==1:   #1段目がNGなら
    stepsum.append(0)
else:
    stepsum.append(1)
    
for i in range(2,N+1):
    stepsum.append((stepsum[i-1]+stepsum[i-2])*(not(i in a)))

ans=stepsum[N]%1000000007
print(ans)
Problem p03077 (python)

Fixed submission:
N = int(input())
tr = [int(input()) for i in range(5)]
# s = -(-N // tr[0])
# cnt = 5 + s - 1
# for i in range(1, 5):
#    # print(cnt, s, (-(-N // tr[i]) - s))
#    if (-(-N // tr[i]) - (-(-N // tr[i-1]))) > 0:
#        cnt += -(-N // tr[i]) - (-(-N // tr[i-1]))
print(-(-N // min(tr)) + 4)

Buggy submission (verdict: Runtime Error):
print(-(-(int(input())) // min([int(input() for i in range(5))])) + 4)
Problem p03041 (python)

Fixed submission:
N,K = (int(x) for x in input().split())
s = input()
print(''.join([x if i != K-1 else x.lower() for i,x in enumerate(s) ]))

Buggy submission (verdict: Runtime Error):
N,K = (int(x) for x in input().split())
s = input()
print ''.join(x for i,x in enumerate(s) if i != K-1 else x.lower())
Problem p03631 (python)

Fixed submission:
# coding: utf-8

a = input()
if a[0] == a[-1]:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8

n = int(input()) 
t = sorted([int(input()) for i in range(n)])

def gcd(a, b):
  while b:
    a, b = b, a % b
  return a
	
def lcm(a, b):
  return a * b // gcd(a, b)
	
def nlcm(list):
  if len(list) > 2:
  	lcm_num = lcm(list[0], list[1])
    for i in range(2, len(list)):
      lcm_num = lcm(lcm_num, list[i])
    print(lcm_num)
  elif len(list) == 2:
    print(lcm(list[0], list[1]))
  else:
  	print(len[-1])


nlcm(t)

Buggy submission (verdict: Runtime Error):
# coding: utf-8

a, b, c, d = map(int, input().split())

if c <= b:
  if b <= d:
    print(b - c)
  else:
    print(d - c)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
# coding: utf-8

a, b, c, d = map(int, input().split())

if c <= b:
	print(b - c)
else:
	print(0)
Problem p03038 (python)

Fixed submission:
n,m=map(int,input().split())
a=sorted(list(map(int,input().split())))
l=[list(map(int,input().split())) for i in range(m)]
l.sort(key=lambda x:x[1])
for i in range(n):
    if a[i]<l[-1][1]:
        a[i]=l[-1][1]
        l[-1][0]-=1
        if l[-1][0]==0:
            l.pop(-1)
            if len(l)==0:break
    else:break
print(sum(a))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=sorted(list(map(int,input().split())))
l=[list(map(int,input().split())) for i in range(m)]
l.sort(key=lambda x:x[1])
for i in range(n):
    if a[i]<l[-1][1]:
        a[i]=l[-1][1]
        l[-1][0]-=1
        if l[-1][0]==0:l.pop(-1)
    else:break
print(sum(a))
Problem p03137 (python)

Fixed submission:
n,m=map(int,input().split())
if n<m:
    l=sorted(list(map(int,input().split())))
    s=[]
    for i in range(m-1):s.append(l[i+1]-l[i])
    s.sort(reverse=True)
    ans=l[-1]-l[0]
    if m>1:
        for i in range(n-1):ans-=s[i]
    print(ans)
else:print(0)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
s=[]
for i in range(m-1):s.append(l[i+1]-l[i])
s.sort(reverse=True)
ans=l[-1]-l[0]
if m>1:
    for i in range(n-1):ans-=s[i]
print(ans)
Problem p02990 (python)

Fixed submission:
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


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

for i in range(1, K+1):
    if i > R+1:
        print(0)
    else:
        ans = cmb(R+1, i, mod) * cmb(K-1, i-1, mod) % mod
        print(ans)

Buggy submission (verdict: Runtime Error):
ef cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


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

for i in range(1, K+1):
    if i > R+1:
        print(0)
    else:
        ans = cmb(R+1, i, mod) * cmb(K-1, i-1, mod) % mod
        print(ans)

Buggy submission (verdict: Runtime Error):
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7

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

for i in range(1, K+1):
    if i > R+1:
        print(0)
    else:
        ans = cmb(R+1, i, mod) * cmb(K-1, i-1, mod) % mod
        print(ans)

Buggy submission (verdict: Runtime Error):
#整数Nを得る
N, K = map(int,input().split())
mod = 10**9 +7

for i in range(1,K+1):
    Ans = 1
    a = N - K + 1
    for j in range(1, i +1):
        Ans = int(Ans * a / j)
        a = a-1
    c = 1
    for j in range(1,i):

        c = int(c * (K - j)/j)
    
    Ans = int(Ans * c)
    Ans = Ans % mod
    print(Ans)

Buggy submission (verdict: Runtime Error):
#整数Nを得る
N, K = map(int,input().split())
mod = 10**9 +7

for i in range(1,K+1):
    Ans = 1
    a = N - K + 1
    for j in range(1, i +1):
        Ans = Ans * a / j
        a = a-1
    c = 1
    for j in range(1,i):

        c = c * (K - j)/j
    
    Ans = int(Ans * c)
    Ans = Ans % mod
    print(Ans)

Buggy submission (verdict: Runtime Error):
#整数Nを得る
N, K = map(int,input().split())
mod = 10**9 +7

for i in range(1,K+1):
    Ans = 1
    a = N - K + 1
    for j in range(1, i +1):
        Ans = Ans * a / j
        a = a-1
    c = 1
    for j in range(1,i):

        c = c * (K - j)/j
    Ans = int(Ans * c % mod)
    print(Ans)

Buggy submission (verdict: Runtime Error):
#整数Nを得る
N, K = map(int,input().split())
mod = 10**9 +7
Ans = 1

for i in range(1,K+1):
    if i == 1:
        Ans = N - K + 1
        print(Ans)
    else:
        Ans = 1
        a = N - K + 1
        for j in range(1, i +1):
            Ans = Ans * a / j
            a = a-1
        c = 1
        for j in range(1,i):
            c = c * (K - j)/j

        Ans = int(Ans * c % mod)
        print(Ans)
Problem p03137 (python)

Fixed submission:
n, m = map(int, input().split())
if m == 1 or n >= m:
  print(0)
else:
  x = list(map(int, input().split()))
  x.sort()
  d = [0]*(m-1)
  for i in range(m-1):
    d[i] = x[i+1] - x[i]
  d.sort(reverse = True)
  sum = sum(d)
  for i in range(n-1):
    sum -= d[i]
  print(sum)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
if m == 1:
  print(0)
else:
  x = list(map(int, input().split()))
  x.sort()
  d = [0]*(m-1)
  for i in range(m-1):
    d[i] = x[i+1] - x[i]
  d.sort(reverse = True)
  sum = sum(d)
  for i in range(n-1):
    sum -= d[i]
  print(sum)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
if m == 1:
  print(0)
  exit()
x = list(map(int, input().split()))
x.sort()
d = [0]*(m-1)
for i in range(m-1):
  d[i] = x[i+1] - x[i]
d.sort(reverse = True)
sum = sum(d)
for i in range(n-1):
  sum -= d[i]
print(sum)
Problem p02990 (python)

Fixed submission:
from math import factorial

N, K = map(int, input().split())
mod = 10**9 + 7

def cmb(n, r):
    if n >= r:
        return int(factorial(n) // (factorial(r) * factorial(n-r)))
    else:
        return 0

for i in range(1, K+1):
    print(cmb(N-K+1, i) * cmb(K-1, i-1) % mod)

Buggy submission (verdict: Runtime Error):
import math

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

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

for i in range(1, K + 1):
    print(int((nCk(N-K+1, i) * nCk(K-1, i-1)) % (10**9 + 7)))