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

Fixed submission:
def ii():return int(input())
def iim():return map(int,input().split())
def ism():return map(str,input().split())
def iil():return list(map(int,input().split()))
s,t=ism()
a,b=iim()
u=input()

if u == s:
    print(a-1,b)
else:
    print(a,b-1)

Buggy submission (verdict: Runtime Error):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
s,t=iim()
a,b=iim()
u=ii()

if u == s:
    print(a-1,b)
else:
    print(a,b-1)
Problem p02879 (python)

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

if a < 10 and b < 10:
    print(a*b)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
a, b = map(int,input())

if a < 10 and b < 10:
    print(a*b)
else:
    print(-1)
Problem p03013 (python)

Fixed submission:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,m = iim()
broke = []
for j in range(m):
    broke.append(ii())
if n > 1:
    num = [1]
    if len(broke) and broke[0] == 1:
        num.append(0)
        broke.pop(0)
    else:
        num.append(1)

    for i in range(2,n+1):
        if len(broke) and broke[0] == i:
            num.append(0)
            broke.pop(0)
        else:
            num.append((num[-1]+num[-2])%1000000007)
    print(num[-1])
else:
    print(1)

Buggy submission (verdict: Runtime Error):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,m = iim()
broke = []
for j in range(m):
    broke.append(ii())

num = [1]
if broke[0] == 1:
    num.append(0)
    broke.pop(0)
else:
    num.append(1)

for i in range(2,n+1):
    if len(broke) and broke[0] == i:
        num.append(0)
        broke.pop(0)
    else:
        num.append((num[-1]+num[-2])%1000000007)

print(num[-1])
Problem p02693 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))  # 入力のときに N を使う必要はありません
icount = 0
if A[1] - A[0] >= N:
  print('OK')
  icount = icount + 1
else:
  for i in range(A[0], A[1]+1):
    if i % N == 0:
      print('OK')
      icount = icount + 1
      if icount == 1:
        break
      
if icount == 0:
  print('NG')

Buggy submission (verdict: Runtime Error):
A = list(map(int, input().split()))  # 入力のときに N を使う必要はありません
i_max = 0
i_count = 0
j_count = 0

for x in range(1, A[2]+1):
  if i_max < ((A[0]*x)//A[1]-A[0]*(x//A[1])):
    i_max = ((A[0]*x)//A[1]-A[0]*(x//A[1]))
    i_count = x
  if (x - i_count) == 1:
    j_count = j_count + 1
  if (j_count == 2):
    break
    
print(i_count)

Buggy submission (verdict: Runtime Error):
A = list(map(int, input().split()))
icount = 0
if A[2] - A[1] >= A[0]:
  print('OK')
  icount = icount + 1
else:
  for i in range(A[1]:A[2]+1):
    if i % A[0] == 0:
      print('OK')
      icount = icount + 1
      if icount == 1:
        break
      
if icount == 0:
  print('NG')
Problem p02629 (python)

Fixed submission:
n = int(input())

def num2alpha(num):
    if num <= 26:
        return chr(96 + num)
    elif num % 26 == 0:
        return num2alpha(num // 26 - 1) + chr(122)
    else:
        return num2alpha(num // 26) + chr(96 + num % 26)

print(num2alpha(n))

Buggy submission (verdict: Runtime Error):
n = input()

def num2alpha(num):
    if num<=26:
        return chr(96+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(122)
    else:
        return num2alpha(num//26)+chr(96+num%26)


print(num2alpha(n))

Buggy submission (verdict: Runtime Error):
n = input()

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
    
print(num2alpha(n))
Problem p02597 (python)

Fixed submission:
n = int(input())

c = list(input())

w_count = c.count("W")
r_count = c.count("R")

right_center = c[r_count:]
right_w_count = right_center.count("W")

print(w_count - right_w_count)

Buggy submission (verdict: Runtime Error):

if w_count >= r_count:
    print(w_count)
else:
    print(w_count - right_w_count)
Problem p02712 (python)

Fixed submission:
import sys, os

if __name__ == '__main__':
    N = int(input())
    s = 0
    for i in range(1, N+1):
        if i % 3 ==0 or i % 5 ==0:
            continue
        else:
            s += i
    print(s)

Buggy submission (verdict: Runtime Error):
import sys, os

if __name__ == '__main__':
    N = input()
    s = 0
    for i in range(1, N+1):
        if i % 3 ==0 or i % 5 ==0:
            continue
        else:
            s += i
    print(s)

Buggy submission (verdict: Runtime Error):
import sys, os

if __name__ == '__main__':
    N = input()
    s = 0
    for i in range(1, N+1):
        if i % 3 ==0 or i % 5 ==0:
            continue
        else:
            s += i
    print(s)
Problem p02594 (python)

Fixed submission:

ondo = input()
if int(ondo) >= 30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):

ondo = input()
if ondo >= 30:
  print("Yes")
else:
  print("No")
Problem p02753 (python)

Fixed submission:
s = input()
print('YNeos'[s=='AAA' or s=='BBB'::2])

Buggy submission (verdict: Runtime Error):
s = input()
q = int(input())
for _ in range(q):
  t = input()
  if t[0]=='1':
    s = s[::-1]
  else:
    if t[2]=='1':
      s = t[4:] + s
    else:
      s = s + t[4:]
print(s)
Problem p02835 (python)

Fixed submission:
a1, a2, a3 = map(int, input().split())
if (a1+a2+a3)>21:
  print("bust")
else:
  print("win")

Buggy submission (verdict: Runtime Error):
a1, a2, a3 = map(int, input())
if (a1+a2+a3)>21:
  print("bust")
else:
  print("win")
Problem p02881 (python)

Fixed submission:
n=int(input());print(min(x+n//x-2for x in range(1,int(n**.5)+1)if n%x<1))

Buggy submission (verdict: Runtime Error):
n=int(input());print(min(x+n/x-2for x in range(1,int(n**.5)+1)if n%x<0))
Problem p02912 (python)

Fixed submission:
import heapq
N, M = map(int, input().split())
a_list = [-float(i) for i in input().split()]
heapq.heapify(a_list)
for _ in range(M):
    _ = heapq.heapreplace(a_list, a_list[0]/2.0)
ans = sum([-int(i) for i in a_list])
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())
As = np.array( list( map(float, input().split()) ) )
As /= 2.0
As.sort()
a2 = As[-2]
N1 = int(N/10)
for _ in range(M):
    As[-1] /= 2.0
    if As[-1] < a2:
        As[-N1:].sort()

ans = np.sum(np.floor(As*2.0))
print(int(ans))
Problem p02987 (python)

Fixed submission:
S = [s for s in input()]
S.sort()
if (S[0]==S[1]) and (S[1]!=S[2]) and (S[2]==S[3]):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n, *ps = map(int, open(0).read().split())
cou =0
for x, y, z in zip(ps[:-2], ps[1:-1], ps[2:]):
  if (x-y)*(z-y)<0:
    cou += 1
print(cou)
Problem p03075 (python)

Fixed submission:
a,*_,e,k=map(int,open(0))
print('Y:a(y !'[e-a>k::2])

Buggy submission (verdict: Runtime Error):
a, _,e,k=map(int,open(0).read().split())
print(e-a<=k ‘Yay!’or ‘:(‘)
Problem p03107 (python)

Fixed submission:
s=sorted(list(input()))
if s[0]==s[-1]:
  print(0)
else:
  a=s.index('1')
  print(2*min(a,len(s)-a))

Buggy submission (verdict: Runtime Error):
s=sorted(list(input()))
if s[0]==s[-1]:
  print(0)
else:
  a=s.index('1')
  print(2*min(a,len(s)-a)

Buggy submission (verdict: Runtime Error):
s=sorted(list(input()));a=s.index('1');print(2*min(a,len(s)-a))

Buggy submission (verdict: Runtime Error):
s=sorted(list(input());a=s.index('1');print(2*min(a,len(s)-a))

Buggy submission (verdict: Runtime Error):
s=list(input()).sort();a=s.index('1');print(2*min(a,len(s)-a))
Problem p03127 (python)

Fixed submission:
def gcd(x, y):
  if y==0: return x
  return gcd(y, x%y)

N = int(input())
A = list(map(int, input().split()))
a = A[0]
for i in range(N-1):
  a = gcd(a, A[i+1])
print(a)

Buggy submission (verdict: Runtime Error):
def gcd(x, y):
  if y==0: return x
  return gcd(y, x%y)

def recurfunc(i, x):
  if i==N-1:
    print(x)
    return
  recurfunc(i+1, gcd(x, A[i+1]))

N = int(input())
A = list(map(int, input().split()))
recurfunc(1, gcd(A[0], A[1]))

Buggy submission (verdict: Runtime Error):
def gcd(x, y):
  if y==0: return x
  return gcd(y, x%y)

def recurfunc(i, x):
  if i==N-1:
    print(x)
    return
  recurfunc(i+1, gcd(x, A[i+1]))

N = int(input())
A = list(map(int, input().split()))
recurfunc(1, gcd(A[0], A[1]))
Problem p02594 (python)

Fixed submission:
n = int(input())
if n >= 30:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
if n >= 25:
  print 'Yes'
else:
  print 'No'
Problem p02627 (python)

Fixed submission:
str = input()
if(str.islower()):
  print('a')
else:
  print('A')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(x) for x in input().split()]
q = int(input())
for i in range(q):
  a.sort()
  su = 0
  b,c = map(int,input().split())
  for j in range(n):
    if(a[j] > b ):
      break
    if(a[j] == b):
      a[j] = c
    su += a[j]
  print(su)
Problem p02597 (python)

Fixed submission:
n = int(input())
c = input()
cnt = 0
ans = 0

for i in range(n):
    if c[i] == 'R':
        cnt += 1
    
for j in range(cnt):
    if c[j] == 'W':
        ans += 1
        
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
c = list(input())
cnt = 0

for i in range(n):
    if c[i] == 'W':
        for j in range(n-1,0,-1 ):
            if c[j] == 'R':
                if i < j:
                    c[i] = 'R'
                    c[j] = 'W'
                    cnt += 1
                    print(i, j)
                    print(c)
                break
print(cnt)
Problem p02859 (python)

Fixed submission:
r = int(input())
print(r*r)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
# スペース区切りの整数の入力
b, c = map(int, input().split())
# 文字列の入力
s = input()
# 出力
print("{} {}".format(a+b+c, s))

Buggy submission (verdict: Runtime Error):
a = int(input())
b,c = map(int, input().split())
s = input()
print("{} {}".format(a+b+c, s))
Problem p02729 (python)

Fixed submission:
import itertools
r = 2
N, M = map(int, input().split())
Nmath = len(list(itertools.combinations(range(N), r)))
Mmath = len(list(itertools.combinations(range(M), r)))

print(int(Nmath+Mmath))

Buggy submission (verdict: Runtime Error):
from scipy import special
N, M = map(int, input().split())

Nmath = special.comb(N, 2)
Mmath = special.comb(M, 2)

print(int(Nmath+Mmath))

Buggy submission (verdict: Runtime Error):
from scipy import special
N, M = map(int, input().split())

Nmath = special.comb(N, 2,True)
Mmath = special.comb(M, 2,True)

print(Nmath+Mmath)
Problem p02777 (python)

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

if S==U:
    print(A-1,B)
else:
    print(A,B-1)

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

if S==U:
    print(A-1)
else:
    print(B-1)
Problem p02785 (python)

Fixed submission:
n, k = map(int,input().split())
h = list(map(int,input().split()))

h.sort(reverse=True)
for i in range(0,min(k,len(h))):
    h[i] = 0
hp = 0
for j in range(k,n):
    hp += h[j]

print(hp)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
List = list(map(int, input().split()))
List.sort()
List.reverse()
ans=0

if len(List) == K-1:
    print(0)
    quit()

def Check(List,ans):
    if sum(List) <= 0:
        print(ans)
        quit()

#print(List)

i=0
while i<K:
    del List[0]
    i+=1

Check(List,ans)

j=0
while 1==1:
    ans+=List[j]
    List[j]=0
    Check(List,ans)
    j+=1
Problem p02819 (python)

Fixed submission:
X=int(input())

def isPrime(n):
  if n < 2:
    # 2未満は素数でない
    return False
  if n == 2:
    # 2は素数
    return True
  for p in range(2, n):
      if n % p == 0:
        # nまでの数で割り切れたら素数ではない
        return False
  # nまでの数で割り切れなかったら素数
  return True
  
while 1==1:
    if isPrime(X)==True:
        print(X)
        quit()
    X+=1

Buggy submission (verdict: Runtime Error):
from sympy import isprime
X=int(input())

while 1==1:
    if isprime(X)==True:
        print(X)
        quit()
    
    X+=1
Problem p02831 (python)

Fixed submission:
from fractions import gcd

A, B = map(int, input().split())

def lcm(x, y):
    return (x * y) // gcd(x, y)

print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
import math

A, B = map(int, input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))
Problem p03038 (python)

Fixed submission:
import numpy as np
 
N,M = map(int,input().split())
 
A = np.array([int(x) for x in input().split()],dtype=np.int64)
A.sort()
 
BC = np.array([[int(x) for x in input().split()] for _ in range(M)])
B = BC[:,0]
C = BC[:,1]
 
idx = C.argsort()
B = B[idx][::-1]
C = C[idx][::-1]
 
p = 0
for b,c in zip(B,C):
  A[p:p+b] = np.maximum(A[p:p+b],c)
  p += b
 
answer = A.sum()
print(answer)

Buggy submission (verdict: Runtime Error):
import numpy as np
 
N,M = map(int,input().split())
 
A = np.array([int(x) for x in input().split()],dtype=np.int64)
A.sort()
 
BC = np.array([[int(x) for x in input().split()] for _ in range(M)])
B = BC[:,0]
C = BC[:,1]
 
idx = C.argsort()
B = B[idx][::-1]
C = C[idx][::-1]
 
p = 0
for b,c in zip(B,C):
  A[p:p+b] = np.maximum(A[p:p+b],c)
  p += b
 
answer = A.sum()
print(answer)
Problem p03075 (python)

Fixed submission:
# coding: utf-8
# Your code here!
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if e-a<=k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if e-a<=k
    print("Yay!")
else:
    print(":(")
Problem p02970 (python)

Fixed submission:
n,d=map(int,input().split())
if n%(2*d+1)!=0:
   print(n//(2*d+1)+1)
else:
    print(n//(2*d+1))

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
if n%(2*d+1)!=0:
   print(n//(2*d+1)+1)
else:
    print(n//(2*d+1
Problem p02987 (python)

Fixed submission:
s=list(input())
if s.count(s[0])==s.count(s[1])==s.count(s[2])==s.count(s[3])==2:
   print("Yes")
else:
   print("No")

Buggy submission (verdict: Runtime Error):
import collections
s=list(input())
a=collections.Counter(s)
values, counts = zip(*a.most_common())
if counts[0]==counts[1]==2 and len(values)==2:
   print("Yes")
else:
   print("No")

Buggy submission (verdict: Runtime Error):
import collections
s=list(input())
a=collections.Counter(s)
b=a.keys()
c=a.values()
values, counts = zip(*a.most_common())
if counts[0]==counts[1]==2 and len(values)==2:
    print("Yes")
else:
   print("No")

Buggy submission (verdict: Runtime Error):
import collections
s=list(input())
a=collections.Counter(s)
b=a.keys()
c=a.values()
values, counts = zip(*a.most_common())
if counts[0]==counts[1] and len(values)==2:
    print("Yes")
else:
   print("No")

Buggy submission (verdict: Runtime Error):
import collections
s=list(input())
a=collections.Counter(s)
b=a.keys()
c=a.values()
values, counts = zip(*a.most_common())
if values[0]==values[1] and len(b)==2:
    print("Yes")
else:
   print("No")
Problem p02659 (python)

Fixed submission:
ab=input().split()
a=int(ab[0])
b=ab[1].replace('.','')
b=int(b)
ans=a*b//100
print(ans)

Buggy submission (verdict: Runtime Error):
ab=input().split()
a=int(ab[0])
b=ab[1].replace('.','')
ans=a*b//100
print(ans)
Problem p02693 (python)

Fixed submission:
K=int(input())
ab=list(map(int, input().split()))
A=ab[0]
B=ab[1]
flg=False
for i in range(A,B+1):
    if i%K==0:
        flg=True
if flg:
    print('OK')
else:
    print('NG')

Buggy submission (verdict: Runtime Error):
nmq=list(map(int, input().split()))
N=nmq[0]
M=nmq[1]
Q=nmq[2]
ablist=[list(map(int, input().split())) for i in range(Q)]
sumlist=[]
alist=[i for i in range(1,M+1)]
import itertools as ite
case=list(ite.combinations_with_replacement(alist,N))
for nowcase in case:
    sumd=0
    for i in range(Q):
        a=ablist[i][0]
        b=ablist[i][1]
        c=ablist[i][2]
        d=ablist[i][3]
        aa=nowcase[a-1]
        ab=nowcase[b-1]
        if ab-aa==c:
            sumd+=d
    sumlist.append(sumd)
print(max(sumlist))

Buggy submission (verdict: Runtime Error):
nmq=list(map(int, input().split()))
N=nmq[0]
M=nmq[1]
Q=nmq[2]
ablist=[list(map(int, input().split())) for i in range(Q)]
sumlist=[]
alist=[i for i in range(1,M+1)]
import itertools as ite
case=list(ite.combinations_with_replacement(alist,N))
for nowcase in case:
    sumd=0
    for i in range(Q):
        a=ablist[i][0]
        b=ablist[i][1]
        c=ablist[i][2]
        d=ablist[i][3]
        aa=nowcase[a-1]
        ab=nowcase[b-1]
        if ab-aa==c:
            sumd+=d
    sumlist.append(sumd)
sumlist.sort(reverse=True)
print(sumlist[0])

Buggy submission (verdict: Runtime Error):
nmq=list(map(int, input().split()))
N=nmq[0]
M=nmq[1]
Q=nmq[2]
ablist=[list(map(int, input().split())) for i in range(Q)]
sumlist=[]
alist=[i for i in range(1,M+1)]
import itertools as ite
case=list(ite.combinations_with_replacement(alist,N))
for nowcase in case:
    sumd=0
    for i in range(Q):
        a=ablist[i][0]
        b=ablist[i][1]
        c=ablist[i][2]
        d=ablist[i][3]
        aa=nowcase[a-1]
        ab=nowcase[b-1]
        if ab-aa==c:
            sumd+=d
    sumlist.append(sumd)
sumlist.sort(reverse=True)
print(sumlist[0])

Buggy submission (verdict: Runtime Error):
nmq=list(map(int, input().split()))
N=nmq[0]
M=nmq[1]
Q=nmq[2]
ablist=[list(map(int, input().split())) for i in range(Q)]
sumlist=[]
alist=[]
for i in range(1,M+1):
    alist.append(i)
import itertools as ite
case=list(ite.combinations_with_replacement(alist,N))
for nowcase in case:
    sumd=0
    for i in range(Q):
        a=ablist[i][0]
        b=ablist[i][1]
        c=ablist[i][2]
        d=ablist[i][3]
        aa=nowcase[a-1]
        ab=nowcase[b-1]
        if ab-aa==c:
            sumd+=d
    sumlist.append(sumd)
sumlist.sort(reverse=True)
print(sumlist[0])
Problem p02595 (python)

Fixed submission:
N,D=map(int,input().split())
D2=D*D
c=0
for i in range(N):
  x,y =map(int,input().split())
  if x*x+y*y<=D2:
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
N,D=map(int,input())
D2=D*D
c=0
for i in range(N):
  x,y =sprit(int,input())
  if x*x+y*y<=D2:
    c+=1
print(c)
Problem p02785 (python)

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

if N<=K:
  print(0)
else:
  H.sort()
  a=sum(H[0:N-K])
  print(a)

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


if N<=K:
  print(0)
else:
  H.sort()
  a=sum(H[0:N-K])
  print(a)
Problem p02831 (python)

Fixed submission:

def fx(a,b):
  while b!=0:
    a,b=b,a%b
  return a

a,b=map(int,input().split())
a,b=max(a,b),min(a,b)
print(a*b//fx(a,b))

Buggy submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
print(math.gcd(a,b))
Problem p02833 (python)

Fixed submission:
def fx(X, n):
    if (X//n):
      #print(X//5)
      return fx(X//n, n)+X//n
    return 0

N=int(input())
if N%2==1:
  print(0)
else:
  print(fx(N//2,5))

Buggy submission (verdict: Runtime Error):
def fx(X, n):
    if (int(X/n)):
        return fx(int(X/n), n)+(X//n)
    return 0

N=int(input())
if N%2==1:
  print(0)
else:
  print(fx(N/2,0))

Buggy submission (verdict: Runtime Error):
def fx(X, n):
    if (int(X/n)):
        return fx(int(X/n), n)+(X//n)
    return 0

N=int(input())
if N%2==1:
  print(0)
else:
  print(fx(n/2,0))
Problem p02990 (python)

Fixed submission:
import sys
N, B = map(int,input().split())
R = N-B
T = 1000000007
def combination(n, r):
	if r == 0 or r == n:
		return 1
	elif r == 1:
		return n
	else:
		return(combination(n-1, r-1) + combination(n-1, r))
def generating_combination(n):
	T = 1000000007
	C = C = [[0 for i in range(n+1)] for j in range(n+1)]
	C[0][0] = 1
	C[1][0] = 1
	C[1][1] = 1
	for i in range(2,n+1):
		C[i][0] = 1
		C[i][i] = 1
		for j in range(1,i):
			C[i][j] = (C[i-1][j-1] + C[i-1][j])%T
	return(C)

D = generating_combination(2000)
i = 1
for i in range(1,B+1):
	print((D[B-1][i-1]*D[R+1][i])%T)
	i += 1

Buggy submission (verdict: Runtime Error):
import sys
N, B = map(int,input().split())
R = N-B
T = 1000000007
def combination(n, r):
	if r == 0 or r == n:
		return 1
	elif r == 1:
		return n
	else:
		return(combination(n-1, r-1) + combination(n-1, r))
def generating_combination(n):
	T = 1000000007
	C = [[0]*2000]*2000
	C = [1]*(n+1)
	C[0] = [0]
	for i in range(1,n+1):
		C[i] = [1]*(i+1)
		for j in range(1,i):
			C[i][j] = (C[i-1][j-1] + C[i-1][j])%T
	return(C)

C = generating_combination(2000)

i = 1
for i in range(1,B+1):
	print((C[B-1][i-1]*C[R+1][i])%T)
	i += 1

Buggy submission (verdict: Runtime Error):
import sys
N, B = map(int,input().split())
R = N-B
T = 1000000007
def combination(n, r):
	if r == 0 or r == n:
		return 1
	elif r == 1:
		return n
	else:
		return(combination(n-1, r-1) + combination(n-1, r))
def generating_combination(n):
	T = 1000000007
	C = [[]*2000]*2000
	C = [1]*(n+1)
	C[0] = [0]
	for i in range(1,n+1):
		C[i] = [1]*(i+1)
		for j in range(1,i):
			C[i][j] = (C[i-1][j-1] + C[i-1][j])%T
	return(C)

C = generating_combination(2000)

i = 1
for i in range(1,B+1):
	print((C[B-1][i-1]*C[R+1][i])%T)
	i += 1

Buggy submission (verdict: Runtime Error):
import sys
N, B = map(int,input().split())
R = N-B
T = 1000000007

def combination(n, r):
	if r == 0 or r == n:
		return 1
	elif r == 1:
		return n
	else:
		return(combination(n-1, r-1) + combination(n-1, r))

c1 = 1
c2 = R +1

print(c1*c2%T)
d1 = 1
d2 = 1

i = 2
while(i <= B and i <= R+1):
	c1 = combination(B-1, i-1)
	c2 = combination(R+1, i)
	print((c1*c2)%T)
	i += 1

Buggy submission (verdict: Runtime Error):
N, B = map(int,input().split())
R = N-B
T = 1000000007
ans = 1


c1 = 1
c2 = R +1

print(c1*c2%T)

i = 2
while(True):
	c1 = c1 * (B-1-i+2) / (i-1)
	c2 = c2 * (R+1-i +1) / i
	if c1>0 and c2 > 0:
		print(int(c1*c2)%T)
	else:
		break
	i += 1
Problem p03038 (python)

Fixed submission:
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
b = [list(map(int,input().split())) for p in [0]*m]
b.sort(key=lambda q: -q[1])
#print(a)
#print(b)

c = 0
for s in b:
	for t in [0]*s[0]:
		#print(s)
		if c + 1 > n:
			break
		if s[1] <= a[c]:
			break
		a[c] = s[1]
		c += 1
		#print(a)
	else:
		continue
	break
print(sum(a))

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
for k in range(m):
  s, t = map(int,input().split())
  for i in range(s):
    a.append(t)
ans = 0
a.sort(reverse=True)
for v in range(n):
  ans += a[v]
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = int(input().split())
a = map(int,input().split())
for k in range(m):
  a.sort()
  s, t = int(input().split())
  for i in range(s)
  	if a[i] < t:
      a[i] = t
    else:
      break
ans = 0
for v in range(n):
  ans = a[v]
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = input().split()
a = map(int,input().split())
for k in range(m):
  a.sort()
  s, t = input().split()
  for i in range(s)
  	if a[i] < t:
      a[i] = t
    else:
      break
ans = 0
for v in range(n):
  ans = a[v]
print(ans)
Problem p02699 (python)

Fixed submission:
s,w=map(int,input().split())
 
if s>w:
	print("safe")
else:
	print("unsafe")

Buggy submission (verdict: Runtime Error):
s,w=map(int,input().split())
 
if s>w:
	return("safe")
else:
	return("unsafe")

Buggy submission (verdict: Runtime Error):
s,w=map(int(),input().split())
 
if s>w:
	return("safe")
else:
	return("unsafe")

Buggy submission (verdict: Runtime Error):
s,w=map(int(),input().split())
 
if s>w:
  print("safe")
else:
  print("unsafe")

Buggy submission (verdict: Runtime Error):
s,w=map(int(),input().split())
 
if s>w:
  return("safe")
else:
  return("unsafe")

Buggy submission (verdict: Runtime Error):
s,w=map(int(),input().split())

if s>w:
  return "safe"
else:
  return "unsafe"