Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#055 B
import functools
import operator
prod = functools.partial(functools.reduce, operator.mul)

N = int(input())
lists = []
for i in range(1,N+1):
    lists.append(i)
ans = prod(lists)
print(ans%((10**9)+7))

Fixed submission:
#055 B
N=int(input())
ans = 1
w = (10**9) +7
for i in range(1,N+1):
    ans *=i
    if ans >=w:
        ans %= w
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#055 B
N = int(input())
ans =1
for i in range(1,N+1):
    if N ==1:
        print(1%((10**9)+7))
        exit()
    else:
        ans =ans * i
print(ans%((10**9)+7))

Fixed submission:
#055 B
N=int(input())
ans = 1
w = (10**9) +7
for i in range(1,N+1):
    ans *=i
    if ans >=w:
        ans %= w
print(ans)
Buggy python submission (verdict: Runtime Error):
# ABC 051 B - Sum of Three Integers　
li = list(map(int,input().split()))
k = li[0]
s = li[1]
cnt =0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0<= z <= k: 
            cnt+=1
print(cnt)

Fixed submission:
# ABC 051 A - Haiku
a,b,c =map(str,input().split(","))
print(a +" "+b+" "+c)
Buggy python submission (verdict: Time Limit Exceeded):
K,S= map(int,input().split())
cnt=0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i+j+k  == S:
                cnt+=1
print(cnt)

Fixed submission:
# ABC 051 B - Sum of Three Integers　
k, s = map(int, input().split())
cnt =0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0<= z <= k: 
            cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
li = list(map(int,input().split()))
k = li[0]
s = li[1]
cnt =0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z==s:
                cnt+=1
print(cnt)

Fixed submission:
# ABC 051 B - Sum of Three Integers　
k, s = map(int, input().split())
cnt =0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0<= z <= k: 
            cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
#049 C

S = input()
A = 'dream'
B = 'dreamer'
C = 'erase'
D = 'eraser'

S=S[::-1]
A=A[::-1]
B=B[::-1]
C=C[::-1]
D=D[::-1]

tmp =""
for i in S:
    tmp +=i
    print(tmp)
    for j in [A,B,C,D]:
        if tmp == j:
            S=S.replace(tmp,"",1)
            print(S)
            tmp=""
if len(S)==0:
    print('YES')
else:
    print('NO')

Fixed submission:
#049 C

S = input()
A = 'dream'
B = 'dreamer'
C = 'erase'
D = 'eraser'

S=S[::-1]
A=A[::-1]
B=B[::-1]
C=C[::-1]
D=D[::-1]

tmp =""
for i in S:
    tmp +=i
    for j in [A,B,C,D]:
        if tmp == j:
            S=S.replace(tmp,"",1)
            tmp=""
if len(S)==0:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
# ABC 044 A - 高橋君とホテルイージー / Tak and Hotels (ABC Edit)
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if K > N:
    ans = N * X
elif N > K:
    ans = K * X
    ans +=(N-K)* Y

print( ans )

Fixed submission:
# ABC 044 A - 高橋君とホテルイージー / Tak and Hotels (ABC Edit)
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if K >= N:
    ans = N * X
elif N > K:
    ans = K * X
    ans +=(N-K)* Y

print( ans )
Buggy python submission (verdict: Runtime Error):
N,K= map(int,input().split())
D = [int(j) for j in input().split()]
D2 = list(set([i for i in range(0,10)])-set(D))
D1 = list(set([i for i in range(1,10)])-set(D))
ans =''
for i in reversed(range(-len(str(N)),0)):
    if int(str(N)[i]) not in D:
        ans+=str(N)[i]
    elif i==-len(str(N)):
        ans+=str(min(D1))
    else:
        ans+=str(min([d for d in D2 if d>int(str(N)[i])]))
print(int(ans[::-1]))

Fixed submission:
N,K= map(int,input().split())
D = [int(j) for j in input().split()]
D2 = list(set([i for i in range(0,10)])-set(D))
def f(N,D):
    if len(set([int(i) for i in list((str(N)))])&set(D))==0:
        return True
    else:
        return False
if len(D2) ==0:
    print(N)
else:
    while not f(N,D):
        N+=1
print(N)
Buggy python submission (verdict: Runtime Error):
X = int(input())
A = [0] * 200
m = 0
n = 0
for i in range(400):
  A[i] = i ** 5
for i in range(400):
  x = A[i]
  for j in range(400):
    y = A[j]
    if ((x + y) == X):
      m = i
      n = (-1) * j
    elif ((x - y) == X):
      m = i
      n = j
print(m, n)

Fixed submission:
X = int(input())
A = [0] * 400
m = 0
n = 0
for i in range(400):
  A[i] = i ** 5
for i in range(400):
  x = A[i]
  for j in range(400):
    y = A[j]
    if ((x + y) == X):
      m = i
      n = (-1) * j
    elif ((x - y) == X):
      m = i
      n = j
print(m, n)

Buggy python submission (verdict: Runtime Error):
X = int(input())
m = 0
n = 0
tip = 0
for i in range(101):
    if (tip == 0):
        p = i ** 5
        q = X - p
        r = q ** (1/5)
        if ((r - int(r)) == 0):
            m = r
            n = ((-1) * p)
            tip = 1
print(int(m), int(n))

Fixed submission:
X = int(input())
A = [0] * 400
m = 0
n = 0
for i in range(400):
  A[i] = i ** 5
for i in range(400):
  x = A[i]
  for j in range(400):
    y = A[j]
    if ((x + y) == X):
      m = i
      n = (-1) * j
    elif ((x - y) == X):
      m = i
      n = j
print(m, n)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
  x = i + 1
  ans = A.count(x)
  print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0] * N
for i in range(N - 1):
  x = A[i] - 1
  B[x] = B[x] + 1
for i in range(N):
  print(B[i])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
  x = i + 1
  ans = 0
  for j in range(N - 1):
    if A[j] == x:
      ans = ans + 1
  print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0] * N
for i in range(N - 1):
  x = A[i] - 1
  B[x] = B[x] + 1
for i in range(N):
  print(B[i])
Buggy python submission (verdict: Runtime Error):
N = input()
tip = "No"
if (N[0] == 7) or (N[1] == 7) or (N[2] == 7):
  tip = "Yes"
print(tip)

Fixed submission:
N = int(input())

x = N // 3
y = N // 5
z = N // 15

p = N * (N + 1) / 2
q = 3 * x * (x + 1) / 2
r = 5 * y * (y + 1) / 2
s = 15 * z * (z + 1) / 2
Sum = p - q - r + s
print(int(Sum))
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
import math
K = int(input())
Sum = 0
for i in range(K):
  for j in range(K):
    for k in range(K):
      x = math.gcd(i + 1, j + 1)
      y = math.gcd(i + 1, k + 1)
      Sum = Sum + math.gcd(x, y)
print(Sum)

Fixed submission:
import math
K = int(input())
Sum = 0
for i in range(K):
  for j in range(i + 1):
    x = math.gcd(i + 1, j + 1)
    for k in range(j + 1):
      y = math.gcd(j + 1, k + 1)
      if (i == j) and (i == k):
        Sum = Sum + math.gcd(x, y)
      elif (i == j) or (i == k) or (j == k):
        Sum = Sum + 3 * math.gcd(x, y)
      else:
        Sum = Sum + 6 * math.gcd(x, y)
print(Sum)
Buggy python submission (verdict: Runtime Error):
S = input()
print(S[1])
N = len(S)
print(N)

Fixed submission:
L = float(input())
ans = L * L * L / 27.0
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import math
n, a, b = map(int, input().split())

def pow(x, n):
  ans = 1
  while(n > 0):
    if(bin(n & 1) == bin(1)):
      ans = ans*x
    x = x*x
    n = n >> 1 #ビットシフト
  return ans

sum1 = pow(2, n)
sumwhole = sum1 -1

def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod

p = comb(n,a,10**9+7)
q = comb(n,b,10**9+7)

sumf1 = sumwhole - p - q
sumf = sumf1 % (10**9+7)
print(sumf)


Fixed submission:
def cmd(n, r, D):
    r = min(r, n-r)
    upper = 1
    lower = 1
    counter = 1
    while counter <= r:
        upper = (upper * (n - counter +1)) % D
        lower = (lower * counter) % D
        counter = counter + 1
    return (upper * pow(lower, D - 2, D)) % D

D = 10 ** 9 + 7
n, a, b = map(int, input().split())

N = pow(2, n, D)
P = cmd(n, a, D)
Q = cmd(n, b, D)
Ans = (N - 1 - P - Q) % D
print(Ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list0 = []
list1 = []
for i in range(N):
  x = input()
  if x in list0:
    t = list0.index(x)
    list1[t] += 1
  else:
    list0.append(x)
    list1.append(1)
l = len(list0)
counter = 0
list2 = []
for i in range(l):
  if list1[i] > counter:
    counter = list1[i]
for i in range(l):
  if list1[i] == counter:
    list2.append(list0[i])
list2 = sorted(list2)
l_2 = len(list2)
for i in range(l_2):
  print(list2[i])

Fixed submission:
N = int(input())
list0 = {}
for i in range(N):
  x = input()
  if x in list0:
    list0[x] = list0[x] + 1
  else:
    list0[x] = 1
m = max(list0.values())
k_m = [key for key in list0 if list0[key] == m]
k_m.sort()
for i in range(len(k_m)):
  print(k_m[i])
Buggy python submission (verdict: Runtime Error):
import itertools
N,M,X = map(int,input().split())
book =[]
for x in range(N):
    A_list =  list(map(int, input().split()))
    book.append(A_list)
conbination =[]
for i, _ in enumerate(book, 1):     
    for j in itertools.conbination(book, r=i):  # rには1、2、3と渡される
        conbination.append(j)
minn =100000000
for x in conbination:
    A = [0]*M
    m = 0
    for y in x:
        for z in range(len(y)):
            if z ==0:
                m +=y[z]
            else:
                A[z-1] +=y[z]
    if minn >m and X<=min(A):
        minn =m
        
if minn != 100000000:
    print(minn)
else:
    print(-1)

Fixed submission:
import itertools
N,M,X = map(int,input().split())
book =[]
for x in range(N):
    A_list =  list(map(int, input().split()))
    book.append(A_list)
conbination =[]
for i, _ in enumerate(book, 1):     
    for j in itertools.combinations(book, r=i):  # rには1、2、3と渡される
        conbination.append(j)
minn =100000000
for x in conbination:
    A = [0]*M
    m = 0
    for y in x:
        for z in range(len(y)):
            if z ==0:
                m +=y[z]
            else:
                A[z-1] +=y[z]
    if minn >m and X<=min(A):
        minn =m
        
if minn != 100000000:
    print(minn)
else:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N,M,X = map(int,input().split())
book =[]
for x in range(N):
    A_list =  list(map(int, input().split()))
    book.append(A_list)
conbination =[]
for i, _ in enumerate(book, 1):     
    for j in itertools.permutations(book, r=i):  # rには1、2、3と渡される
        conbination.append(j)
minn =100000000
for x in conbination:
    A = [0]*M
    m = 0
    for y in x:
        for z in range(len(y)):
            if z ==0:
                m +=y[z]
            else:
                A[z-1] +=y[z]
    if minn >m and X<=min(A):
        
        minn =m
        
if minn != 100000000:
    print(minn)
else:
    print(-1)

Fixed submission:
import itertools
N,M,X = map(int,input().split())
book =[]
for x in range(N):
    A_list =  list(map(int, input().split()))
    book.append(A_list)
conbination =[]
for i, _ in enumerate(book, 1):     
    for j in itertools.combinations(book, r=i):  # rには1、2、3と渡される
        conbination.append(j)
minn =100000000
for x in conbination:
    A = [0]*M
    m = 0
    for y in x:
        for z in range(len(y)):
            if z ==0:
                m +=y[z]
            else:
                A[z-1] +=y[z]
    if minn >m and X<=min(A):
        minn =m
        
if minn != 100000000:
    print(minn)
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N =int(input())
A = list(map(int,input().split()))
x=0
y=0
ans =0
while x <N:
    y =x+A[x]
    while y <N:
        t = A[x]+A[y]
        if t == y-x:
            ans +=1
        y+=1
    x+=1
print(ans)

Fixed submission:
N =int(input())
A = list(map(int,input().split()))
d ={}
r ={}
ans =0
for x in range(N):
    d[x] =0
    r[x] =0
for x in range(N):
    dt = A[x]+x
    rt = x-A[x]
    if dt<N:
        d[dt] +=1
    if rt >-1:
        r[rt] +=1
for x in range(N):
    if d[x] !=0 and r[x]!=0:
        ans = ans + d[x]*r[x]
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
A,B,N = map(int,input().split())
maxn = 0
sec =False
for x in range(1,N+1):
    tmp = math.floor((A*x)/B)-A*(math.floor(x/B))
    if maxn < tmp:
        maxn = tmp
    if tmp == 0:
        if sec ==True:
            break
        else:
            sec =True
    
print(maxn)

Fixed submission:
#A
N = int(input())
A,B = map(int,input().split())
ans =0

for x in range(A,B+1):
    if x%N ==0:
        ans =1
        break
if ans ==1:
    print("OK")
else:
    print("NG")
Buggy python submission (verdict: Runtime Error):
A,B,N = map(int,input().split())
maxn =0
if A<B:
    if B/2 <N:
        t = math.ceil(B/2)-1
        ans = tmp = math.floor((A*t)/B)-A*(math.floor(t/B))
    else:
        ans = tmp = math.floor((A*N)/B)-A*(math.floor(N/B))
else:
    for x in range(1,B+1):
        tmp = math.floor((A*x)/B)-A*(math.floor(x/B))
        if maxn < tmp:
            maxn = tmp
    ans =maxn
print(ans)

Fixed submission:
import math
A,B,N = map(int,input().split())
s = min(B-1,N)
print(math.floor((A*s)/B)-A*(math.floor(s/B)))

Buggy python submission (verdict: Time Limit Exceeded):
import math
A,B,N = map(int,input().split())
maxn = 0
sec =False
pp =False
for x in range(1,N+1):
    tmp = math.floor((A*x)/B)-A*(math.floor(x/B))
    if maxn < tmp:
        maxn = tmp
    if sec == True and tmp != 0:
        pp =True
    if tmp == 0:
        if sec ==True and pp ==True:
            break
        else:
            sec =True
    
print(maxn)

Fixed submission:
import math
A,B,N = map(int,input().split())
s = min(B-1,N)
print(math.floor((A*s)/B)-A*(math.floor(s/B)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())
S2=[]
R = 0
G = 0
B = 0

for x in range(N):
    if S[x] =="R":
        R +=1
        S2.append(["R",R])
    elif S[x] =="G":
        G +=1
        S2.append(["G",G])
    else:
        B +=1
        S2.append(["B",B])
ans =0
a = 0
b =0
for x in range(N):
    i = S2[x][0]
    for y in range(x,N):
        j = S2[y][0]
        if j != i:
            if j =="R":
                a =R-S2[y][1]+1
            elif j =="G":
                a =G-S2[y][1]+1
            else:
                a =B-S2[y][1]+1
            for z in range(x,N):
                k = S2[z][0]
                if k != i and k != j:
                    if k =="R":
                        b =R-S2[z][1]+1
                    elif k =="G":
                        b =G-S2[z][1]+1
                    else:
                        b =B-S2[z][1]+1
                    break
            else:
                b = 0
            break
    else:
        a = 0
    ans +=a*b
subn =0
for x in range(N):
    i = S2[x][0]
    for y in range(x,N):
        j = S2[y][0]   
        if j != i:
            d = y-x
            if y+d<N:
                if i!= S2[y+d][0] and j!=S2[y+d][0]:
                    subn +=1
            else:
                break
print(ans-subn)

Fixed submission:
N = int(input())
S = list(input())
S2=[]
R = 0
G = 0
B = 0

for x in range(N):
    if S[x] =="R":
        R +=1
        S2.append(["R",R])
    elif S[x] =="G":
        G +=1
        S2.append(["G",G])
    else:
        B +=1
        S2.append(["B",B])
ans =0
a = 0
b =0
for x in range(N):
    i = S2[x][0]
    for y in range(x,N):
        j = S2[y][0]
        if j != i:
            if j =="R":
                a =R-S2[y][1]+1
            elif j =="G":
                a =G-S2[y][1]+1
            else:
                a =B-S2[y][1]+1
            for z in range(x,N):
                k = S2[z][0]
                if k != i and k != j:
                    if k =="R":
                        b =R-S2[z][1]+1
                    elif k =="G":
                        b =G-S2[z][1]+1
                    else:
                        b =B-S2[z][1]+1
                    break
            else:
                b = 0
            break
    else:
        a = 0
    ans +=a*b
subn =0
for x in range(N):
    i = S2[x][0]
    for y in range(x,N):
        j = S2[y][0]   
        if j != i:
            d = y-x
            if y+d<N:
                if i!= S2[y+d][0] and j!=S2[y+d][0]:
                    subn +=1
            else:
                break
print(ans-subn)
Buggy python submission (verdict: Runtime Error):
N , M =map(int,input())

keta_list=[]
num_list=[]
for x in range(M):
    s,c =map(int,input().split())
    keta_list.append(s)
    num_list.append(c)
siteilist=[0]*N
siteilist[0]=1
errer =0
apperlist =[]

for i,x in enumerate(keta_list):
    siteilist[x-1]=num_list[i]
    if x == 1 and num_list[i]==0:
        errer= 1
    if x in apperlist:
        z =[]
        z = [l for l,i in enumerate(keta_list) if x == i ]
        if len(z)!=0:
            firest = num_list[z[0]]
            for b in z:
                if num_list[b] != firest:
                    errer = 1
                    
    apperlist.append(x)
out =0
if errer ==1:
    out =-1
else:
    for x in range(N):
        out += siteilist[x]*10**(N-x-1)
print(out)

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

keta_list=[]
num_list=[]
for x in range(M):
    s,c =map(int,input().split())
    keta_list.append(s)
    num_list.append(c)
siteilist=[0]*N
if len(siteilist)!=1:
    siteilist[0]=1
errer =0
apperlist =[]

for i,x in enumerate(keta_list):
    siteilist[x-1]=num_list[i]
    if x == 1 and num_list[i]==0 and len(siteilist)!=1:
        errer= 1
    if x in apperlist:
        z =[]
        z = [l for l,i in enumerate(keta_list) if x == i ]
        if len(z)!=0:
            firest = num_list[z[0]]
            for b in z:
                if num_list[b] != firest:
                    errer = 1
                    
    apperlist.append(x)
out =0
if errer ==1:
    out =-1
else:
    for x in range(N):
        out += siteilist[x]*10**(N-x-1)
print(out)
Buggy python submission (verdict: Runtime Error):
from scipy.special import comb
def solve(i,k,smaller):
    print("i="+str(i))
    if i == len(S):
        if k == 0:
            #0以外の個数がkと等しいので答えとしてカウントできる
            return 1
        else:
            #0以外の個数がkと等しくないので答えとしてカウント不可
            return 0 
    
    if k ==0:
        #kの個数を使い切りこれ以上下の桁は0で埋まり1通りの為
        return 1
    
    if smaller :
        return comb(len(S)-i,k)*pow(9,k)
    else:
        if S[i] =="0":
            return solve(i+1,k,False)
        else:
            zero = solve(i+1,k,True)
            aida = solve(i+1,k-1,True)*(int(S[i])-1)
            ici  = solve(i+1,k-1,False)
            return zero+aida+ici
            
N = int(input())
S = str(N)
K = int(input())

ans = solve(0,K,False)
print(ans)

Fixed submission:
from scipy.misc import comb
def solve(i,k,smaller):
    if i == len(S):
        if k == 0:
            #0以外の個数がkと等しいので答えとしてカウントできる
            return 1
        else:
            #0以外の個数がkと等しくないので答えとしてカウント不可
            return 0 
    
    if k ==0:
        #kの個数を使い切りこれ以上下の桁は0で埋まり1通りの為
        return 1
    
    if smaller :
        return comb(len(S)-i,k)*pow(9,k)
    else:
        if S[i] =="0":
            return solve(i+1,k,False)
        else:
            zero = solve(i+1,k,True)
            aida = solve(i+1,k-1,True)*(int(S[i])-1)
            ici  = solve(i+1,k-1,False)
            
            return zero+aida+ici
            
N = int(input())
S = str(N)
K = int(input())

ans = round(solve(0,K,False))

print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
H,N = map(int,input().split())
magicL =[]
for x in range(N):
    magic = list(int(i) for i in input().split())
    magicL.append(magic)

ml = magicL
dp = [10**9 for i in range(H +1)]
dp [0] = 0
for i in range(N):
    for w in range(H +1):
        dp[min(w+ml[i][0],H)] = min(dp[min(w+ml[i][0],H)],dp[w]+ml[i][1])
print(dp[H])

Fixed submission:
H,N = map(int,input().split())
magicL =[]
for x in range(N):
    magic = list(int(i) for i in input().split())
    magicL.append(magic)
 
ml = magicL
dp = [10**9 for i in range(H +1)]
dp [0] = 0
for i in range(N):
    for w in range(H +1):
        dp[min(w+ml[i][0],H)] = min(dp[min(w+ml[i][0],H)],dp[w]+ml[i][1])
print(dp[H])

Buggy python submission (verdict: Time Limit Exceeded):

H,N = map(int,input().split())
magicL =[]
for x in range(N):
    magic = list(int(i) for i in input().split())
    magicL.append(magic)
magicE = []
for x in range(N):
    magicE.append(magicL[x][0]/magicL[x][1])
c = list(zip(magicE,magicL))
mel , ml = zip(*c)
dp =[[10000000000 for x in range(N+1)]for y in range(H+1)]
dp[0][0] = 0
for i in range(len(dp[0])-1):
    for w in range(H+1):
        dp[w][i+1] = min(dp[w][i],dp[w][i+1])
        dp[min(w+ml[i][0],H)][i+1] = min(dp[min(w+ml[i][0],H)][i+1],dp[w][i+1]+ml[i][1])
print(dp[H][N])


Fixed submission:
H,N = map(int,input().split())
magicL =[]
for x in range(N):
    magic = list(int(i) for i in input().split())
    magicL.append(magic)
 
ml = magicL
dp = [10**9 for i in range(H +1)]
dp [0] = 0
for i in range(N):
    for w in range(H +1):
        dp[min(w+ml[i][0],H)] = min(dp[min(w+ml[i][0],H)],dp[w]+ml[i][1])
print(dp[H])
Buggy python submission (verdict: Runtime Error):
N ,M= map(int,input())
#S = int(input())
if N== M:
    print("Yes")
else:
    print("No")

Fixed submission:
N ,M= map(int,input().split())
#S = int(input())
if N== M:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a ,b= map(int,input().split())
#S = int(input())

if a > b:
    ans = [str(b)]*a
    ans = "".join(ans)
else:
    ans = [str(a)]*b
    ans = "".join(ans)
print(ans)

Fixed submission:
N = int(input())
P = list(map(int,input().split()))
c = 1
minN =P[0]
for x in range(1,N):
    if P[x]<= minN:
        c +=1
        minN = P[x]
print(c)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
sys.setrecursionlimit(10000)
def culc(s,x,m,F_array,eat_time):
   
    K_sum = eat_time/F_array
    must_del = K_sum[K_sum > x]
    must_del = must_del - x
    sum_del = int(np.sum(must_del))
    print(x)
    print(sum_del)
    if sum_del == x:
        return x

    if sum_del > x:
        s = x
        x = int((x+m)/2)
        return culc(s,x,m,F_array,eat_time)
    else:
        m = x
        x = int((x+s)/2)
        return culc(s,x,m,F_array,eat_time)


import numpy as np
N,K = map(int,input().split())
A_list =  list(map(int, input().split()))
F_list =  list(map(int, input().split()))
s = 0
m = 1.0e+18
x = 5.0e+17
eat_time = []
A_list.sort() #min max
F_list.sort(reverse=True) #max -min

A_array = np.array(A_list)
F_array = np.array(F_list)
eat_time =A_array*F_array

print(culc(s,x,m,F_array,eat_time))

Fixed submission:
x,y=map(int,input().split())
if x<10 and y<10:
    print(x*y)
else:
    print("-1")

Buggy python submission (verdict: Runtime Error):
x = int(input())
flag = 0
if x < 10:
    print("Yes")
for l in range(1,10,1):
    num =x/l
    mod = x % l
    if num < 10 and mod == 0:
        flag =1
        break
if flag == 1:
    print("Yes")
else:
    print("No")

Fixed submission:
x,y=map(int,input().split())
if x<10 and y<10:
    print(x*y)
else:
    print("-1")
Buggy python submission (verdict: Runtime Error):
x = int(input())
flag = 0
if x < 10:
    print("Yes")
    sys.exit(0)
for l in range(1,10,1):
    num =x/l
    mod = x % l
    if num < 10 and mod == 0:
        flag =1
        break
if flag == 1:
    print("Yes")
else:
    print("No")


Fixed submission:
x = int(input())
flag = 0
for l in range(1,10,1):
    num =x/l
    mod = x % l
    if num < 10 and mod == 0:
        flag =1
        break
if flag == 1:
    print("Yes")
else:
    print("No")