Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = input().rstrip()
k = int(input())
result = []
for i in range(len(s)):
  for j in range(i+1,i+k):
    if i+k <= len(s):
      result.append(s[i:j])
result.sort()
print(result[k-1])

Fixed submission:
s = input().rstrip()
k = int(input())
result = []
for i in range(len(s)):
  for j in range(i+1,i+k+1):
    if j <= len(s) and s[i:j] not in result:
      result.append(s[i:j])
result.sort()
print(result[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input().rstrip()
k = int(input())
slist = []
for i in range(len(s)):
    for j in range(i,len(s)):
        if s[i:j+1] not in slist:
            slist.append(s[i:j+1])
slist.sort()
print(slist[k-1])

Fixed submission:
s = input().rstrip()
k = int(input())
result = []
for i in range(len(s)):
  for j in range(i+1,i+k+1):
    if j <= len(s) and s[i:j] not in result:
      result.append(s[i:j])
result.sort()
print(result[k-1])
Buggy python submission (verdict: Runtime Error):
import math

n=int(input())

primes = list(range(2, 400))
root_n = int(400 ** (1/2)) + 1
i = j = 0
for p, q in enumerate(primes):
    if q >= root_n:
        break
    elif q:
        for r in range(p + q, 400 - 2, q):
            if primes[r]:
                primes[r] = 0
result = [str(2)]
Plist = [primes[x] for x in range(len(primes)) if primes[x] > 0 and primes[x]%3 == 1]
for i in range(n-1):
    result.append(str(Plist[i]))
print(' '.join(result))

Fixed submission:
import math

n=int(input())

# create a list of 2 ... n
primes = list(range(2, 2000))
root_n = int(2000 ** (1/2)) + 1
# check each of numbers
i = j = 0
for p, q in enumerate(primes):
    if q >= root_n:
        break
    elif q:
        for r in range(p + q, 2000 - 2, q):
            if primes[r]:
                primes[r] = 0
result = [str(2)]
Plist = [primes[x] for x in range(len(primes)) if primes[x] > 0 and primes[x]%5 == 1]
for i in range(n-1):
    result.append(str(Plist[i]))
print(' '.join(result))
Buggy python submission (verdict: Time Limit Exceeded):
import copy
n = int(input())
nums = list(map(int,input().split()))
for i in range(n):
    tmp = copy.deepcopy(nums)
    tmp.pop(i)
    tmp.sort()
    print(tmp[(n-1)//2])

Fixed submission:
import copy
n = int(input())
nums = list(map(int,input().split()))
tmp = copy.deepcopy(nums)
tmp.sort()
cand1 = tmp[n//2]
cand2 = tmp[(n//2)-1]
for i in range(n):
    if nums[i] < cand1:
        print(cand1)
    else:
        print(cand2)
Buggy python submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
nums = list(range(A,B+1))
result = []
L = min(B-A+1,K)
for i in range(L):
    if nums[i] not in result:
        result.append(nums[i])
nums.sort(reverse=True)
for j in range(L):
    if nums[j] not in result:
        result.append(nums[j])
result.sort()
for x in result:
    print(x)

Fixed submission:
A,B,K=map(int,input().split())
result = []
L = min(B-A+1,K)
for i in range(A,A+L):
    if i not in result:
        result.append(i)
for j in range(B,B-L,-1):
    if j not in result:
        result.append(j)
result.sort()
for x in result:
    print(x)

Buggy python submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
nums = list(range(A,B+1))
result = set()
L = min(B-A+1,K)
for i in range(L):
    result.add(nums[i])
nums.sort(reverse=True)
for j in range(L):
    result.add(nums[j])
for x in result:
    print(x)

Fixed submission:
A,B,K=map(int,input().split())
result = []
L = min(B-A+1,K)
for i in range(A,A+L):
    if i not in result:
        result.append(i)
for j in range(B,B-L,-1):
    if j not in result:
        result.append(j)
result.sort()
for x in result:
    print(x)

Buggy python submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
nums = list(range(A,B+1))
result = set()
L = min(B-A+1,K)
for i in range(L):
    result.add(nums[i])
for j in range(1,L+1):
    result.add(nums[-j])
for x in result:
    print(x)

Fixed submission:
A,B,K=map(int,input().split())
result = []
L = min(B-A+1,K)
for i in range(A,A+L):
    if i not in result:
        result.append(i)
for j in range(B,B-L,-1):
    if j not in result:
        result.append(j)
result.sort()
for x in result:
    print(x)
Buggy python submission (verdict: Runtime Error):
tmp =input().split()
H,W,D=int(tmp[0]),int(tmp[1]),int(tmp[2])

list = [[0 for x in range(W)] for y in range(H)]
dict = {}
for i in range(H):
    tmp = input().split()
    for d in range(W):
        dict[tmp[d]] = str(i)+' '+str(d)
result ={}
cost ={}

def calcost(L,R,D):
    if int(R)<=D:
        cost[R] = 0
        return 0
    else:
        posi1 = dict[R].split()
        posi2 = dict[str(int(R)-D)].split()
        costs = abs(int(posi2[0])-int(posi1[0])) + abs(int(posi2[1])-int(posi1[1]))
        if str(int(R)-D) in cost:
            cost[R] = costs + cost[str(int(R)-D)]
            return cost[R]
        else:
            cost[R] = costs + calcost(L,str(int(R)-D),D)
            return cost[R]

for n in range(D+1,H*W+1):
    calcost(str(1),str(n),D)

Q = int(input())
for j in range(Q):
    tmpx = input()
    if tmpx in result:
        print(result[tmpx])
    else:
        tmp = tmpx.split()
        result[tmpx] = cost[tmp[1]]-cost[tmp[0]]
        print(result[tmpx])

Fixed submission:
N=int(input())
print(int(N/3))
Buggy python submission (verdict: Runtime Error):
sum = 0
zero = 0
for i in range(3):
	tmp = input().split()
	for j in range(3):
    	if int(tmp[j]) == 0:
    		zero += 1
        else:
        	sum += int(tmp[j])    
if sum%3 ==0 and zero%3 ==0:
  print('Yes')
else:
  print('No')


Fixed submission:
sum = 0
list = [[0 for x in range(3)] for y in range(3)]
for i in range(3):
    tmp = input().split()
    list[i] = tmp
    sum += int(tmp[0]) + int(tmp[1]) + int(tmp[2])

flg = True
if sum%3 ==0:
    for n in range(2):
        for m in range(2):
            if (int(list[n][m]) + int(list[n+1][m+1]))!=(int(list[n+1][m])+int(list[n][m+1])):
                flg = False
                break
    if flg:
        print('Yes')
    else:
        print('No')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
sum = 0
for i in range(3)
	tmp = input().split()
	sum += int(tmp[0])+int(tmp[1])int(tmp[2])
if sum%3 ==0:
  print('Yes')
else:
  print('No')

Fixed submission:
sum = 0
list = [[0 for x in range(3)] for y in range(3)]
for i in range(3):
    tmp = input().split()
    list[i] = tmp
    sum += int(tmp[0]) + int(tmp[1]) + int(tmp[2])

flg = True
if sum%3 ==0:
    for n in range(2):
        for m in range(2):
            if (int(list[n][m]) + int(list[n+1][m+1]))!=(int(list[n+1][m])+int(list[n][m+1])):
                flg = False
                break
    if flg:
        print('Yes')
    else:
        print('No')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(str,input().split())
list = ['DEFAULT']*400
tmp = 3
while tmp*tmp<=int(a+b):
  list[tmp] = str(tmp*tmp)
if (a+b) in list:
  print('Yes')
else:
  print('No')

Fixed submission:
a,b = map(str,input().split())
c = int(a+b)
list = ['DEFAULT']*400
tmp = 3
while tmp*tmp<=c:
  list[tmp] = tmp*tmp
  tmp +=1
if c in list:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
flg = True
now,posx,posy=0,0,0
while flg==True:
  t,x,y=map(int,input().split())
  if abs(x-posx)+abs(y-posy) > (t-now):
    flg = False
    print('No')
  elif (t-now)%2==0 and ((abs(x-posx)+abs(y-posy))%2 ==1):
    flg =False
    print('No')
  elif (t-now)%2==1 and ((abs(x-posx)+abs(y-posy))%2 ==0):
    flg =False
    print('No')
  else:
    now = t
    posx = x
    posy = y
if flg:
  print('Yes')

Fixed submission:
N = int(input())
flg = True
cnt,now,posx,posy=0,0,0,0
while cnt < N and flg:
  t,x,y=map(int,input().split())
  if abs(x-posx)+abs(y-posy) > (t-now):
    flg = False
    print('No')
  elif (t-now)%2==0 and ((abs(x-posx)+abs(y-posy))%2 ==1):
    flg =False
    print('No')
  elif (t-now)%2==1 and ((abs(x-posx)+abs(y-posy))%2 ==0):
    flg =False
    print('No')
  else:
    now = t
    posx = x
    posy = y
    cnt += 1
if flg:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
N = int(input())
flg = True
now,posx,posy=0,0,0
while flg==True:
  t,x,y=map(int,input().split())
  if abs(x-posx)+abs(y-posy) > (t-now):
    flg = False
    print('No')
  elif (t-now)%2==0 and ((abs(x-posx)+abs(y-posy))%2 ==1):
    flg =False
    print('No')
  elif (t-now)%2==1 and ((abs(x-posx)+abs(y-posy))%2 ==0):
    flg =False
    print('No')
  else:
    now = n
    posx = x
    posy = y
if flg:
  print('Yes')

Fixed submission:
N = int(input())
flg = True
cnt,now,posx,posy=0,0,0,0
while cnt < N and flg:
  t,x,y=map(int,input().split())
  if abs(x-posx)+abs(y-posy) > (t-now):
    flg = False
    print('No')
  elif (t-now)%2==0 and ((abs(x-posx)+abs(y-posy))%2 ==1):
    flg =False
    print('No')
  elif (t-now)%2==1 and ((abs(x-posx)+abs(y-posy))%2 ==0):
    flg =False
    print('No')
  else:
    now = t
    posx = x
    posy = y
    cnt += 1
if flg:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
N = int(input())
flg = True
#start
now,posx,posy=0,0,0
while flg:
  t,x,y=map(int,input().split())
  if abs(x-posx)+abs(y-posy) > (t-now):
    flg = false
    print('No')
  elif (t-now)%2==0 and ((abs(x-posx)+abs(y-posy))%2 ==1):
    flg =false
    print('No')
  elif (t-now)%2==1 and ((abs(x-posx)+abs(y-posy))%2 ==0):
    flg =false
    print('No')
  else:
    now = n
    posx = x
    posy = y
if flg:
  print('Yes')

Fixed submission:
N = int(input())
flg = True
cnt,now,posx,posy=0,0,0,0
while cnt < N and flg:
  t,x,y=map(int,input().split())
  if abs(x-posx)+abs(y-posy) > (t-now):
    flg = False
    print('No')
  elif (t-now)%2==0 and ((abs(x-posx)+abs(y-posy))%2 ==1):
    flg =False
    print('No')
  elif (t-now)%2==1 and ((abs(x-posx)+abs(y-posy))%2 ==0):
    flg =False
    print('No')
  else:
    now = t
    posx = x
    posy = y
    cnt += 1
if flg:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
N,Y=map(int,input().split())
Y = Y/1000
a,b,c =0,0,0
if 10*N < Y:
  a,b,c = -1,-1,-1
elif Y/10 + Y%5 > float(N):
  a,b,c = -1,-1,-1
else:
    flg = True
    for n in range(int(N/5)+1):
        c = int(Y%5 + 5*n)
        for i in range(N-c+1):
            if (5*i + 5*N) == (Y + 4*c):
                flg = False
                a , b = i , (N-c-i)
                break
        if flg==False:
            break
if flg:
    a,b,c = -1,-1,-1
print(a,b,c)

Fixed submission:
N,Y=map(int,input().split())
Y = Y/1000
a,b,c =0,0,0
flg = True
if 10*N < Y:
  a,b,c = -1,-1,-1
#elif float(Y/10 + Y%5) > float(N):
#  a,b,c = -1,-1,-1
else:
    for n in range(int(N/5)+1):
        c = int(Y%5 + 5*n)
        for i in range(N-c+1):
            if (5*i + 5*N) == (Y + 4*c):
                flg = False
                a , b = i , (N-c-i)
                break
        if not flg:
            break
if flg:
    a,b,c = -1,-1,-1
print(a,b,c)
Buggy python submission (verdict: Runtime Error):
import math
import bisect
Q=int(input())

querys = [list(map(int,input().split())) for x in range(Q)]

def siever(x):
  nums = [a for a in range(2,x+1)]
  primes = []
  while nums[0] <= int(math.sqrt(x))+1:
    tmp = nums.pop(0)
    primes.append(tmp)
    for num in nums:
      if num%tmp == 0:
        nums.remove(num)
        continue
  
  return (primes+nums)

L = 0
for query in querys:
  L = max(L,query[1])
primes = siever(L)
L2017= []
for prime in primes:
  if (prime+1)//2 in primes:
    L2017.append(prime)
result = [0]*(max(L2017)+1)
for l in L2017:
  result[l] = 1
for i in range(1,len(result)):
  result[i] += result[i-1]
for query in querys:
  if query[0] == query[1] and query[0] in L2017:
    print(1)
  else:
    if len(result) <= query[0]:
      print(0)
    elif len(result) <= query[1]:
      print(result[-1]-result[query[0]-1])
    else:
      print(result[query[1]]-result[query[0]-1])

Fixed submission:
N = int(input())
print(48-N)

Buggy python submission (verdict: Runtime Error):
N = int(input())
print(48-M)

Fixed submission:
N = int(input())
print(48-N)
Buggy python submission (verdict: Runtime Error):
X,Y=map(int,input().split())
dev = int(Y/X)
work = 1
for i in range(74):
  tmp = pow(2,i)
  if tmp <= dev and dev < tmp*2:
    work +=i
    break
print(work)

Fixed submission:
A,B,C,D=map(int,input().split())
if A+B==C+D:
  print('Balanced')
elif A+B>C+D:
  print('Left')
else:
  print('Right')

Buggy python submission (verdict: Runtime Error):
X,Y=map(int,input().split())
dev = int(Y/X)
work = 1
for i in range(108):
  tmp = pow(2,i)
  if tmp <= dev and dev < tmp*2:
    work +=i
    break
print(work)

Fixed submission:
A,B,C,D=map(int,input().split())
if A+B==C+D:
  print('Balanced')
elif A+B>C+D:
  print('Left')
else:
  print('Right')
Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input())
sum = 0
for i in range(1,N+1):
  work = 0
  for j in range(len(str(i))):
    work += int(str(i)[j])
  if A <= work and work <=B:
    sum +=1
print(sum)

Fixed submission:
N,A,B=map(int,input().split())
sum = 0
for i in range(1,N+1):
  work = 0
  for j in range(len(str(i))):
    work += int(str(i)[j])
  if A <= work and work <=B:
    sum += i
print(sum)
Buggy python submission (verdict: Runtime Error):
n = input()
count=0
for i in range(len(n)-1):
    if n[i] = n[i+1]:
        count +1

if count >=3:
    print("Yes")
else:
    print("No")

Fixed submission:
n = input()
if (n[0]==n[1] and n[1]==n[2]) or (n[1]==n[2] and n[2]==n[3]):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
cand = []
if len(s) < len(t):
  print('UNRESTORABLE')
else:
  for i in range(len(s)):
    if s[i] != t[0] and s[i] != '?':
      continue
    else:
      for j in range(len(t)):
        if s[i+j] != t[j] and s[i+j] != '?':
          break
        elif j == (len(t)-1):
          cand.append(i)
  if len(cand) > 0:
    result = max(cand)
    S = s[:result]+t+s[result+len(t):]
    S = S.replace('?','a')
    print(S)
  else:
    print('UNRESTORABLE')

Fixed submission:
s = input()
t = input()
cand = []
if len(s) < len(t):
  print('UNRESTORABLE')
else:
  for i in range(len(s)-len(t)+1):
    if s[i] != t[0] and s[i] != '?':
      continue
    else:
      for j in range(len(t)):
        if s[i+j] != t[j] and s[i+j] != '?':
          break
        elif j == (len(t)-1):
          cand.append(i)
  if len(cand) > 0:
    result = max(cand)
    S = s[:result]+t+s[result+len(t):]
    S = S.replace('?','a')
    print(S)
  else:
    print('UNRESTORABLE')

Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
cand = []
if len(s) < len(t):
  print('UNRESTORABLE')
else:
  for i in range(len(s)):
    if s[i] != t[0] and s[i] != '?':
      continue
    else:
      for j in range(len(t)):
        if s[i+j] != t[j] and s[i+j] != '?':
          break
        elif j == (len(t)-1):
          cand.append(i)
  if len(cand) > 0:
    result = max(cand)
    S = s[:result]+t+s[result+len(t):]
    S = S.replace('?','a')
    print(S)
  else:
    print('UNRESTORABLE')

Fixed submission:
s = input()
t = input()
cand = []
if len(s) < len(t):
  print('UNRESTORABLE')
else:
  for i in range(len(s)-len(t)+1):
    if s[i] != t[0] and s[i] != '?':
      continue
    else:
      for j in range(len(t)):
        if s[i+j] != t[j] and s[i+j] != '?':
          break
        elif j == (len(t)-1):
          cand.append(i)
  if len(cand) > 0:
    result = max(cand)
    S = s[:result]+t+s[result+len(t):]
    S = S.replace('?','a')
    print(S)
  else:
    print('UNRESTORABLE')
Buggy python submission (verdict: Runtime Error):
A,B,C,D,E,F=map(int,input().split())
conc = 0.0
liq,sug=0,0
for a in range(31):
  for b in range(16):
    for c in range(31):
      for d in range(16):
        if 100*a+100*b+c+d <= F and  c+d <= (a+b)*E:
          if conc < 100*(c+d)/(100*(a+b)+c+d):
            conc = 100*(c+d)/(100*(a+b)+c+d)
            liq = 100*(a+b)
            sug = c+d
print(liq,sug)

Fixed submission:
A,B,C,D,E,F=map(int,input().split())
conc = 0.0
liq,sug = 100*A,0
for a in range(1 + F//(100*A)):
  for b in range(1 + (F-100*A*a)//(100*B)):
    if a + b < 1 or F <= 100*(A*a + B*b):
      break
    for c in range(1 + min(((A*a+B*b)*E)//C,F-100*(A*a+B*b))):
      for d in range(1 + min(((A*a+B*b)*E-C*c)//D,F-100*(A*a+B*b)-C*c)):
        tmp_sug = C*c+D*d
        tmp = 100*(A*a+B*b)+tmp_sug
        if tmp <= F and tmp_sug <= (A*a+B*b)*E and conc < (100*tmp_sug/tmp):
          conc = (100*tmp_sug/tmp)
          liq = tmp
          sug = tmp_sug
print(liq,sug)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
paper = []
for i in range(n):
  tmp = input().rstrip()
  if tmp not in paper:
    paper.append(tmp)
  else:
    paper.pop(paper.index(tmp))
print(len(paper))

Fixed submission:
n = int(input())
paper = set()
for i in range(n):
  tmp = input().rstrip()
  if tmp not in paper:
    paper.add(tmp)
  else:
    paper.remove(tmp)
print(len(paper))
Buggy python submission (verdict: Time Limit Exceeded):
s = input().rstrip()

trans = set()
trans.add(s)
for i in range(len(s)-1):
  for j in range(i+1,len(s)):
    if i == 0 and j == len(s)-1:
      trans.add(s[::-1])
    elif i == 0:
      trans.add((s[0:j+1])[::-1]+s[j+1::])
    elif j == len(s)-1:
      trans.add(s[:i]+s[i::][::-1])
    else:
      trans.add(s[:i]+s[i:j+1:][::-1]+s[j+1:])
print(len(trans))

Fixed submission:
s = input().rstrip()
total = 0
for i in range(ord('a'),ord('z')+1):
  tmp = s.count(chr(i))
  total += tmp*(tmp-1)//2
print(1 + len(s)*(len(s)-1)//2 - total)
Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input())
if abs(x-a)<abs(x-b):
  print('A')
else:
  print('B')


Fixed submission:
x,a,b=map(int,input().split())
if abs(x-a)<abs(x-b):
  print('A')
else:
  print('B')

Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if abs(x-a)<abs(x-b):
  print('A'):
else:
  print('B')


Fixed submission:
x,a,b=map(int,input().split())
if abs(x-a)<abs(x-b):
  print('A')
else:
  print('B')

Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input())
if abs(x-a)<abs(x-b):
  print('A'):
else:
  print('B')

Fixed submission:
x,a,b=map(int,input().split())
if abs(x-a)<abs(x-b):
  print('A')
else:
  print('B')
Buggy python submission (verdict: Runtime Error):
N = int(input())
N2 = [64,32,16,8,4,2]
for i in range(len(N)):
  if N2[i] <=N:
    print(N2[i])
	break

Fixed submission:
N = int(input())
N2 = [64,32,16,8,4,2,1]
for i in range(len(N2)):
	if N2[i] <=N:
		print(N2[i])
		break
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input().split()
b = []
for i in range(n):
  if n%2 == 0:
    if i%2== 1:
      b.insert(0,a[i])
    else:
      b.append(a[i])
  else:
    if i%2== 0:
      b.insert(0,a[i])
    else:
      b.append(a[i])
result= ' '.join(b)
print(result)

Fixed submission:
n = int(input())
num = list(map(str,input().split()))
a,b = [],[]
result = ''
for i in range(n):
  if i%2 == 0:
    a.append(num[i])
  else:
    b.append(num[i])
if n%2 ==1:
  result = ' '.join(a[::-1])
  result += ' ' + ' '.join(b)
else:
  result = ' '.join(b[::-1])
  result += ' ' + ' '.join(a)
print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = input().split()
b = []
for i in range(n):
  if n%2 == 0:
  	if i%2== 1:
      b.insert(0,a[i])
    else:
      b.append(a[i])
  else:
    if i%2== 0:
      b.insert(0,a[i])
    else:
      b.append(a[i])
result= map(b)
print(result)

Fixed submission:
n = int(input())
num = list(map(str,input().split()))
a,b = [],[]
result = ''
for i in range(n):
  if i%2 == 0:
    a.append(num[i])
  else:
    b.append(num[i])
if n%2 ==1:
  result = ' '.join(a[::-1])
  result += ' ' + ' '.join(b)
else:
  result = ' '.join(b[::-1])
  result += ' ' + ' '.join(a)
print(result)
Buggy python submission (verdict: Runtime Error):
tmp = input().split()

if tmp[1] == '+':
  print(tmp[0]+tmp[2])
else:
  print(tmp[0]-tmp[2])

Fixed submission:
tmp = input().split()

if tmp[1] == '+':
  print(int(tmp[0])+int(tmp[2]))
else:
  print(int(tmp[0])-int(tmp[2]))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input())
color = [a]
if b not in color:
  color.append(b)
if c not in color:
  color.append(c)
print(len(color))


Fixed submission:
a,b,c=map(int,input().split())
color = [a]
if b not in color:
  color.append(b)
if c not in color:
  color.append(c)
print(len(color))

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input())
color = [a]
if b not in color:
  color.append(b)
if c not in color:
  color.append(c)
print(color)

Fixed submission:
a,b,c=map(int,input().split())
color = [a]
if b not in color:
  color.append(b)
if c not in color:
  color.append(c)
print(len(color))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
t,a = map(int,input().split())
for i in range(n-1):
  T,A=map(int,input().split())
  count = 0
  while (A*count < a) or (T*count < t):
    count += 1
  a = count * A
  t = count * T
print(a+t)

Fixed submission:
n = int(input())
t,a = map(int,input().split())
for i in range(n-1):
  T,A=map(int,input().split())
  count = max(a//A,t//T)
  while (A*count < a) or (T*count < t):
    count += 1
  a = count * A
  t = count * T
print(a+t)
Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
s = input().rstrip()
count = 0
countB = 0
for i in range(N):
  if A+B <= count:
    print('No')
  else:
    if s[i] == 'a':
      print('Yes')
      count += 1
    elif s[i] =='b'"
      if countB <= B:
        print('Yes')
        countB += 1
        count += 1
      else:
        print('No')
    else:
      print('No')

Fixed submission:
N,A,B=map(int,input().split())
s = input().rstrip()
count = 0
countB = 0
for i in range(N):
  if A+B <= count:
    print('No')
  else:
    if s[i] == 'a':
      print('Yes')
      count += 1
    elif s[i] =='b':
      if countB < B:
        print('Yes')
        countB += 1
        count += 1
      else:
        print('No')
    else:
      print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int,input().split()))
count = 0
for i in range(n):
  if i < nums[i] and (i+1) == nums[nums[i]]:
    count += 1
print(count)

Fixed submission:
n = int(input())
nums = list(map(int,input().split()))
count = 0
for i in range(n):
  if i < nums[i] and (i+1) == nums[nums[i]-1]:
    count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int,input().split()))
count += 1
for i in range(n):
  if i < nums[i] and (i+1) == nums[nums[i]]:
    count += 1
print(count)

Fixed submission:
n = int(input())
nums = list(map(int,input().split()))
count = 0
for i in range(n):
  if i < nums[i] and (i+1) == nums[nums[i]-1]:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
a,b = int(input()).strip().split()
p = 500 * a
if p >= b:
  print("Yes")
else:
  print("No")

Fixed submission:
a,b = input().strip().split()
a = int(a)
b = int(b)
p = 500 * a
if p >= b:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a,b = int(input().strip().split())
p = 500 * a
if p >= b:
  print("Yes")
else:
  print("No")

Fixed submission:
a,b = input().strip().split()
a = int(a)
b = int(b)
p = 500 * a
if p >= b:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = str(input())
p = "abc"
print(len(re.findall("abc", S)))


Fixed submission:
N = int(input())
S = str(input())
S = S.replace("ABC","ab")
print(N - len(S))

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = str(input())
p = "abc"
print(N.count(p))

Fixed submission:
N = int(input())
S = str(input())
S = S.replace("ABC","ab")
print(N - len(S))

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = str(input())
p = "abc"
print(s.count(p))

Fixed submission:
N = int(input())
S = str(input())
S = S.replace("ABC","ab")
print(N - len(S))

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
p = "abc"
print(s.count(p))

Fixed submission:
N = int(input())
S = str(input())
S = S.replace("ABC","ab")
print(N - len(S))
Buggy python submission (verdict: Runtime Error):
a,b = input().strip().split()
if b * 2 >= a:
  print(0)
else:
  print(a - (b * 2))

Fixed submission:
a,b = input().strip().split()
a = int(a)
b = int(b)
if b * 2 >= a:
  print(0)
else:
  print(a - (b * 2))