Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
t_N = input().split()
list_Time = []
for id in range(n):
    list_Time.append(int(t_N[id]))
sum = sum(list_Time)
m = int(input())
for id in range(m):
    p, x = map(int, input().split())
    answer = sum + x - list_Time[p - 1]
    print(answer)

Fixed submission:
A,op,B=input().split()
a=int(A)
b=int(B)
 
if op == "+" :
    print(a+b)
  
elif op == "-" :
    print(a-b)

Buggy python submission (verdict: Runtime Error):
N=int(input())
T_N=int(input().split())
list_time = []
for i in range(N):
    list_time.append(T_N[i])
#Ti秒の総和を求める
sum=sum(list_time)
print(sum)
M=int(input())
for i in range(M):
    p,x=map(int,input().split())
    #ドリンク飲んだ時と飲まないときの差を元の合計に足す。
    ans=sum+x-list_time[p-1]
    print(ans)

Fixed submission:
A,op,B=input().split()
a=int(A)
b=int(B)
 
if op == "+" :
    print(a+b)
  
elif op == "-" :
    print(a-b)

Buggy python submission (verdict: Runtime Error):
N=int(input())
T_N=int(input().split())
list_time = []
for i in range(N):
    list_time.append(T_N[i])
#Ti秒の総和を求める
sum=sum(list_time)
M=int(input())
for i in range(M):
    p,x=map(int,input().split())
    #ドリンク飲んだ時と飲まないときの差を元の合計に足す。
    ans=sum+x-list_time[p-1]
print(ans)


Fixed submission:
A,op,B=input().split()
a=int(A)
b=int(B)
 
if op == "+" :
    print(a+b)
  
elif op == "-" :
    print(a-b)

Buggy python submission (verdict: Runtime Error):
N=int(input())
T_N=int(input().split())
list_time=[]
for i in range(N):
    list_time.append(T_N[i])
#Ti秒の総和を求める
sum=sum(list_time)
M=int(input())
for i in range(M):
    p,x=map(int,input.split())
    #ドリンク飲んだ時と飲まないときの差を元の合計に足す。
    ans=sum+x-list_time[p-1]
print(ans)

Fixed submission:
A,op,B=input().split()
a=int(A)
b=int(B)
 
if op == "+" :
    print(a+b)
  
elif op == "-" :
    print(a-b)

Buggy python submission (verdict: Runtime Error):
N=int(input())
T_N=int(input().split())
list_time=[]
for i in range(N):
    list_time.append(T_N[i])
#Ti秒の総和を求める
sum=sum(list_time)
M=int(input())
for i in range(M):
    p,x=map(int,input.split())
    #ドリンク飲んだ時と飲まないときの差を元の合計に足す。
    ans=sum+(x-list_time[p-1])
    print(ans)

Fixed submission:
A,op,B=input().split()
a=int(A)
b=int(B)
 
if op == "+" :
    print(a+b)
  
elif op == "-" :
    print(a-b)
Buggy python submission (verdict: Runtime Error):
N=int(input())
T_N=int(input().split())
list_time = []
for i in range(N):
    list_time.append(T_N[i])
#Ti秒の総和を求める
sum=sum(list_time)
M=int(input())
for i in range(M):
    p,x=map(int,input().split())
    #ドリンク飲んだ時と飲まないときの差を元の合計に足す。
    ans=sum+x-list_time[p-1]
print(ans)

Fixed submission:
n = int(input())
t_N = input().split()
list_Time = []
for id in range(n):
    list_Time.append(int(t_N[id]))
sum = sum(list_Time)
m = int(input())
for id in range(m):
    p, x = map(int, input().split())
    answer = sum + x - list_Time[p - 1]
    print(answer)

Buggy python submission (verdict: Runtime Error):
N=int(input())
T_N=int(input().split())
list_time=[]
for i in range(N):
    list_time.append(T_N[i])
#Ti秒の総和を求める
sum=sum(list_time)
M=int(input())
for i in range(M):
    p,x=map(int,input.split())
    #ドリンク飲んだ時と飲まないときの差を元の合計に足す。
    ans=sum+(x-list_time[p-1])
    print(ans)

Fixed submission:
n = int(input())
t_N = input().split()
list_Time = []
for id in range(n):
    list_Time.append(int(t_N[id]))
sum = sum(list_Time)
m = int(input())
for id in range(m):
    p, x = map(int, input().split())
    answer = sum + x - list_Time[p - 1]
    print(answer)

Buggy python submission (verdict: Runtime Error):
N=int(input())
T_N=int(input().split())
list_time=[]
for i in range(N)
    list_time.append(T_N[i])
sum=sum(list_time)
M=int(input())
for i in range(M):
    p,x=map(int,input.split())
    ans=sum+(x-list_time[p-1])
    print(ans)

Fixed submission:
n = int(input())
t_N = input().split()
list_Time = []
for id in range(n):
    list_Time.append(int(t_N[id]))
sum = sum(list_Time)
m = int(input())
for id in range(m):
    p, x = map(int, input().split())
    answer = sum + x - list_Time[p - 1]
    print(answer)

Buggy python submission (verdict: Runtime Error):
N=int(input())
T_N=int(input().split())
list_time=[]
for i in range(N)
    list_time.append(T_N[i])
#Ti秒の総和を求める
sum=sum(list_time)
M=int(input())
for i in range(M):
    p,x=map(int,input.split())
    #ドリンク飲んだ時と飲まないときの差を元の合計に足す。
    ans=sum+(x-list_time[p-1])
    print(ans)

Fixed submission:
n = int(input())
t_N = input().split()
list_Time = []
for id in range(n):
    list_Time.append(int(t_N[id]))
sum = sum(list_Time)
m = int(input())
for id in range(m):
    p, x = map(int, input().split())
    answer = sum + x - list_Time[p - 1]
    print(answer)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N, A, B = map(int, input().split())
ab_max = np.amax(np.array([A, B]))
ab_min = np.amin(np.array([A, B]))

if (A - B) % 2 == 0:
    print(int((ab_max - ab_min) / 2))
else:
    print(int(np.amin([(ab_max - 1), (N - ab_min)])))


Fixed submission:
import numpy as np
from decimal import Decimal

N, A, B = map(Decimal, input().split())
ab_max = np.amax(np.array([A, B]))
ab_min = np.amin(np.array([A, B]))

if (A - B) % 2 == 0:
    print(int((ab_max - ab_min) / 2))
else:
    print(int(np.amin([ab_min - 1, N - ab_max]) + (ab_max - ab_min + 1) / 2))
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
print(a/b)

Fixed submission:
a,b=map(int,input().split())
print(a/b)
Buggy python submission (verdict: Runtime Error):

N, K=map(int,input().split())
arr = list(map(int,input().split()))
if(K>= N):
  print('0')
else:
  if (K > 0):
    new_arr = sorted(arr)
    ans = new_arr[:-K]
  elif (K ==0):
    ans = arr
print(sum(ans))

Fixed submission:
N, K=map(int,input().split())
arr = list(map(int,input().split()))
if(K>= N):
  print('0')
else:
  if (K > 0):
    new_arr = sorted(arr)
    arr = new_arr[:-K]
  print(sum(arr))

Buggy python submission (verdict: Runtime Error):

N, K=map(int,input().split())
arr = list(map(int,input().split()))
if(K>= N):
  print('0')
else:
  if (K > 0):
    new_arr = sorted(arr)
    ans = new_arr[:-K]
  else:
    ans = arr
print(sum(ans))


Fixed submission:
N, K=map(int,input().split())
arr = list(map(int,input().split()))
if(K>= N):
  print('0')
else:
  if (K > 0):
    new_arr = sorted(arr)
    arr = new_arr[:-K]
  print(sum(arr))

Buggy python submission (verdict: Runtime Error):

N, K=map(int,input().split())
arr = list(map(int,input().split()))
if(K>= N):
  print('0')
else:
  if (K > 0):
    # for i in range(K):
      # arr.remove(max(arr))
    new_arr = sorted(arr)
    ans = new_arr[:-K]
  print(sum(ans))

Fixed submission:
N, K=map(int,input().split())
arr = list(map(int,input().split()))
if(K>= N):
  print('0')
else:
  if (K > 0):
    new_arr = sorted(arr)
    arr = new_arr[:-K]
  print(sum(arr))

Buggy python submission (verdict: Time Limit Exceeded):

N, K=map(int,input().split())
arr = list(map(int,input().split()))
if(K>= N):
  print('0')
else:
  if (K > 0):
    for i in range(K):
      arr.remove(max(arr))

  print(sum(arr))


Fixed submission:
N, K=map(int,input().split())
arr = list(map(int,input().split()))
if(K>= N):
  print('0')
else:
  if (K > 0):
    new_arr = sorted(arr)
    arr = new_arr[:-K]
  print(sum(arr))

Buggy python submission (verdict: Time Limit Exceeded):

N, K=map(int,input().split())
arr = list(map(int,input().split()))
if(K>= N):
  print('0')
else:
  if (K > 0):
    while(K):
      arr.remove(max(arr))
      K -= 1;

  print(sum(arr))

Fixed submission:
N, K=map(int,input().split())
arr = list(map(int,input().split()))
if(K>= N):
  print('0')
else:
  if (K > 0):
    new_arr = sorted(arr)
    arr = new_arr[:-K]
  print(sum(arr))
Buggy python submission (verdict: Runtime Error):
k = input()
x = input()
if (k * 500) > x:
  print ("yes")
else:
  print("no")

Fixed submission:
k,x = [int(x) for x in input().split()]

k = k * 500 

if k >= x:
  print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
k,x = [int(x) for x in input().split()]

k = k * 500 

if k >= x:
  print("Yes")
else:
	print("No")

Fixed submission:
s, t = input().split()
print(t+s)
Buggy python submission (verdict: Time Limit Exceeded):
a = input()
l = len(a)
blk = a
i = 0
rem = 0
while i < (l - 1):
    if(blk[i] != blk[i+1]):
        blk = blk[:i] + blk[i+2:]
        l -= 2
        rem += 2
        i = 0
    else:
        i += 1
    
print(rem)

Fixed submission:
a = input()
l = len(a)
blk = a
i = 0
rem = 0
num0 = 0
num1 = 0
while i < l:
    if blk[i] == "0":
        num0 += 1
    else:
        num1 += 1
    i += 1
rem = min(num0, num1)
print(rem * 2)

Buggy python submission (verdict: Time Limit Exceeded):
a = input()
a = str(a)
l = len(a)
blk = a
i = 0
rem = 0
while i < (l - 1):
    if(int(blk[i]) + int(blk[i+1]) == 1):
        blk = blk[:i] + blk[i+2:]
        l -= 2
        rem += 2
        i = 0
    else:
        i += 1
    
print(rem)

Fixed submission:
a = input()
l = len(a)
blk = a
i = 0
rem = 0
num0 = 0
num1 = 0
while i < l:
    if blk[i] == "0":
        num0 += 1
    else:
        num1 += 1
    i += 1
rem = min(num0, num1)
print(rem * 2)
Buggy python submission (verdict: Time Limit Exceeded):
d1 = int(input())
d = input().split()
d2 = [int(x) for x in d]
count=0
for n in range(d1):

    for m in range(n+1,d1):
        if d2[n] == d2[m]:
            count+=1


if count==0  :
    print("YES")
else:
    print("NO")

    

Fixed submission:
N = int(input())
A = map(int, input().split())
if N == len(set(A)):
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
d1 = int(input())
d = input().split()
d2 = [int(x) for x in d]
count=0
for n in range(d1):

    for m in range(d1):
        if d2[n] == d2[m]:
            if n != m:
                count+=1


if count!=2 :
    print("YES")
else:
    print("NO")


Fixed submission:
N = int(input())
A = map(int, input().split())
if N == len(set(A)):
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
d1 = int(input())
d = input().split()
d2 = [int(x) for x in d]
count=0
for n in range(d1):

    for m in range(d1):
        if d2[n] == d2[m]:
            if n != m:
                count+=1


if count==0:
    print("YES")
else:
    print("NO")


Fixed submission:
N = int(input())
A = map(int, input().split())
if N == len(set(A)):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
//最小公倍数を求めるプログラム

value = input().split()
value_1 = [int(n) for n in value]

sea = value_1[0]
mou = value_1[1]

while sea != mou:
    if sea<mou:
        sea = sea+value_1[0]
    else:
        mou = mou+value_1[1]

print(sea)


Fixed submission:

value = input().split()
value_1 = [int(n) for n in value]

sea = value_1[0]
mou = value_1[1]

while sea != mou:
    if sea<mou:
        sea = sea+value_1[0]
    else:
        mou = mou+value_1[1]

print(sea)
Buggy python submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split()]
submissions = {str(i):[] for i in range(1,N+1)}
AC,WA = 0,0
for i in range(M):
    P,S = [j for j in input().split()]
    submissions[P].append(S)
for i in submissions:
    if 'AC' not in submissions[i]:
        continue
    for j in submissions[i]:
        if j == 'AC':
            AC+=1
            break
        WA +=1
print(AC,WA)

Fixed submission:
C = input()
alphs = "abcdefghijklmnopqrstuvwxyz"
print(alphs[alphs.find(C)+1])

Buggy python submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split()]
submissions = {str(i):[] for i in range(1,N+1)}
AC,WA = 0,0
for i in range(M):
    P,S = [j for j in input().split()]
    submissions[P].append(S)
for i in submissions:
    if 'AC' not in submissions[i]:
        continue
    for j in submissions[i]:
        if j == 'AC':
            AC+=1
            break
        WA +=1
print(AC,WA)

Fixed submission:
C = input()
alphs = "abcdefghijklmnopqrstuvwxyz"
print(alphs[alphs.find(C)+1])

Buggy python submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split()]
submissions = {str(i):[] for i in range(1,N+1)}
AC,WA = 0,0
for i in range(M):
    P,S = [j for j in input().split()]
    submissions[P].append(S)
for i in submissions:
    if(not 'AC' in submissions[i]):
        continue
    for j in submissions[i]:
        if j == 'AC':
            AC+=1
            break
        WA +=1
print(AC,WA)

Fixed submission:
C = input()
alphs = "abcdefghijklmnopqrstuvwxyz"
print(alphs[alphs.find(C)+1])

Buggy python submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split()]
submissions = {str(i):[] for i in range(1,N+1)}
AC,WA = 0,0
for i in range(M):
    P,S = [j for j in input().split()]
    submissions[P].append(S)
for i in submissions:
    for j in submissions[i]:
        if not 'AC' in j:
            break
        if j == 'AC':
            AC+=1
            break
        WA +=1
print(AC,WA)



Fixed submission:
C = input()
alphs = "abcdefghijklmnopqrstuvwxyz"
print(alphs[alphs.find(C)+1])
Buggy python submission (verdict: Runtime Error):
A,B,K = [int(i) for i in input().split()]
a = A - (K - (K -A))
b = B - (K - A)
print(f"{a} {b}")

Fixed submission:
a,b = [i for i in input().split()]
print("".join([b,a]))
Buggy python submission (verdict: Runtime Error):
A,B,K = [int(i) for i in input().split()]
a = A - (K - (K -A))
b = B - (K - A)
print(f"{a} {b}")

Fixed submission:
a,b,k = map(int,input().split())
if (a-k>=0):
    print(a-k,b)
else:
    c = b-abs(a-k)
    if c <= 0:
        c = 0
    print(0,c)
Buggy python submission (verdict: Runtime Error):
HA = input()

HA = HA.split(" ")

H = HA[0]
A = HA[1]

hit = 0

while H < 0:
  H = H - A
  hit = hit + 1

print(hit)

Fixed submission:
S = input().split(" ") #標準入力

H = int(S[0]) #モンスターのHP
A = int(S[1]) #サーバルの攻撃力

atCount = 0 #攻撃回数

while H > 0:
  H = H - A
  atCount = atCount + 1

print(atCount)
Buggy python submission (verdict: Runtime Error):
S_nk = input().split(" ") #標準入力（N, K）
S_h = input().split(" ") #標準入力（Hi）

N = int(S_nk[0]) #モンスターの種類
K = int(S_nk[1]) #必殺技の制限回数
H = [] #モンスターのヒットポイント
for i in range(N):
  H.append(int(S_h[i]))

#ヒットポイントの大きい順にソート
H.sort(reverse=True)

for i in range(K):
  H[i] = 0

print(sum(H))

Fixed submission:
S_nk = input().split(" ") #標準入力（N, K）
S_h = input().split(" ") #標準入力（Hi）

N = int(S_nk[0]) #モンスターの種類
K = int(S_nk[1]) #必殺技の制限回数
H = [] #モンスターのヒットポイント
for i in range(N):
  H.append(int(S_h[i]))

#ヒットポイントの大きい順にソート
H.sort(reverse=True)

if K < len(H):
  for i in range(K):
  	H[i] = 0
  print(sum(H))
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
C = input()

print(C++)

Fixed submission:
C = input()

print(chr(ord(C) + 1))
Buggy python submission (verdict: Runtime Error):
A = map(int, input().split())

if A[0] + A[1] + A[2] > 22:
  print("bust")
else:
  print("win")

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

if sum(A) <= 21:
  print('win')
else:
  print('bust')

Buggy python submission (verdict: Runtime Error):
A = input().split()

if A[0] + A[1] + A[2] > 22:
  print("bust")
else:
  print("win")

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

if sum(A) <= 21:
  print('win')
else:
  print('bust')
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
road = [0] * n

for i in m:
    a, b = map(int, input().split())
    road[a-1] =+ 1
    road[b-1] =+ 1

for i in road:
    print(i)

Fixed submission:
n, m = map(int, input().split())
road = [0] * n

for i in range(0, m):
    a, b = map(int, input().split())
    road[a-1] = road[a-1] + 1
    road[b-1] = road[b-1] + 1

for i in road:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
M=0
for i in range(0,n-k+1):
  M=max(M,sum(p[i:i+k]))
print((M+k)/2)

Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
M=sum(p[0:k])
if(n>k):
  m=M
  for i in range(1,n-k+1):
    m=m+p[i+k-1]-p[i-1]
    M=max(M,m)
print((M+k)/2)
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input())
if(x==y==1):
  print(1000000)
else:
  ans=max(4-x,0)*100000+max(4-y,0)*100000
  print(ans)

Fixed submission:
x,y=map(int,input().split())
if(x==y==1):
  print(1000000)
else:
  ans=max(4-x,0)*100000+max(4-y,0)*100000
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
  x=a.index(i+1)
  b.append(str(x+1))
print(" ".join(b))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
  b[a[i]-1]=str(i+1)
print(" ".join(b))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
  x=a.index(i+1)
  b.append(str(x+1))
print(" ".join(b))

  

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
  b[a[i]-1]=str(i+1)
print(" ".join(b))
Buggy python submission (verdict: Runtime Error):
n=int(input())
print(n*(n-1)//2)


Fixed submission:
import heapq

n,m=map(int,input().split())
a=list(map(int,input().split()))
a=list(map(lambda x: int(x)*(-1) , a))
heapq.heapify(a)
for i in range(m):
  x=heapq.heappop(a)*(-1)
  heapq.heappush(a,-1*(x//2))
print(-sum(a))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
hap=0
for i in range(n):
  if(i==0):
    if(s[0]==s[1]=='R'):
      hap+=1
  elif(i==n-1):
    if(s[n-2]==s[n-1]=='L'):
      hap+=1
  else:
    if(s[i]==s[i+1]=='R' or s[i-1]==s[i]=='L'):
      hap+=1
print(min(hap+2*k,n-1))

Fixed submission:
n,k=map(int,input().split())
s=input()
hap=0
if(n>1):
  for i in range(n):
    if(i==0):
      if(s[0]==s[1]=='R'):
        hap+=1
    elif(i==n-1):
      if(s[n-2]==s[n-1]=='L'):
        hap+=1
    else:
      if(s[i]==s[i+1]=='R' or s[i-1]==s[i]=='L'):
        hap+=1
print(min(hap+2*k,n-1))
Buggy python submission (verdict: Time Limit Exceeded):
import collections

n=int(input())
a=[]
for i in range(n):
  s=list(input())
  s.sort()
  t="".join(s)
  a.append(t)
c=collections.Counter(a)
l=len(c)
ans=0
for i in range(l):
  m=c.most_common()[i][1]
  ans += int(m*(m-1)/2)
print(ans)

Fixed submission:
n=int(input())
dic={}
ans=0
for i in range(n):
  s="".join(sorted(input()))
  if s in dic.keys():
    ans+=dic[s]
    dic[s]+=1
  else:
    dic[s]=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
print(max(a[1:]))
for j in range(1,n-1):
  b=a[:j]+a[j+1:]
  print(max(b))
print(max(a[:n]))

Fixed submission:
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
m=max(a)
x=[i for i, x in enumerate(a) if x == m]
if(len(x)>=2):
  for i in range(n):
    print(m)
else:
  a.remove(m)
  M=max(a)
  for i in range(n):
    if(i==x[0]):
      print(M)
    else:
      print(m)
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,n=map(int,input().split())
i=0
ans=0
while(R*i<=n):
  j=0
  while(R*i+G*j<=n):
    if((n-R*i-G*j)%B==0):
      ans+=1
    j+=1
  i+=1
print(ans)

Fixed submission:
R,G,B,n=map(int,input().split())
i=0
ans=0
for i in range(int(n/R)+1):
  for j in range(int((n-i*R)/G)+1):
    if((n-R*i-G*j)%B==0):
      ans+=1

print(ans)
Buggy python submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
a=[0]*n
k=0
for i in range(n):
  if(s[i]=='A' and s[i+1]=='C'):
    k+=1
  a[i]=k
for j in range(q):
  l,r=map(int,input().split())
  if(l==1):
    print(a[r-2])
  else:
    print(a[r-2]-a[l-2])

Fixed submission:
n,q=map(int,input().split())
s=input()
a=[0]*n
k=0
for i in range(n-1):
  if(s[i]=='A' and s[i+1]=='C'):
    k+=1
  a[i]=k
for j in range(q):
  l,r=map(int,input().split())
  if(l==1):
    print(a[r-2])
  else:
    print(a[r-2]-a[l-2])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
s=input()
A=[]
for i in range (0,N-1):
  if s[i]=="A" and s[i+1]=="C":
    A.append(i+1)
    i += 2
  elif s[i]=="A" and (s[i+1]=="G" or s[i+1]=="T"):
    i += 2
  else:
    i += 1
    
for j in range (0,Q):
  l,r=map(int,input().split())
  print(len([k for k in A if k >= l and k <= r-1]))

Fixed submission:
n,q=map(int,input().split())
s=input()
a=[0]*n
k=0
for i in range(n-1):
  if(s[i]=='A' and s[i+1]=='C'):
    k+=1
  a[i]=k
for j in range(q):
  l,r=map(int,input().split())
  if(l==1):
    print(a[r-2])
  else:
    print(a[r-2]-a[l-2])
Buggy python submission (verdict: Runtime Error):
s=input()
print(s.strip(,))

Fixed submission:
a,b,c=map(str,input().split(","))
print(a+" "+b+" "+c)
Buggy python submission (verdict: Runtime Error):
a=list(map(int,input().split()))
ans=3
　for i in range(0,2):
    for j in range(i+1,3):
      if a[i]==a[j]:
        ans -= 1
      else:
        j += 1

print(ans)
      

Fixed submission:
a=list(map(int,input().split()))
ans=3
if a[0]==a[1] and a[1]==a[2]:
  ans=1
else:  
  for i in range(0,2):
    for j in range(i+1,3):
      if a[i]==a[j]:
        ans = 2
        break
      else:
        j += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  b=a[i]
  if a[b] = i:
    ans += 1
  else:
    i += 1
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  b=a[i]
  if a[b-1] == i+1:
    ans += 1
  else:
    i += 1
print(int(ans/2))
Buggy python submission (verdict: Runtime Error):
a=input()
ans=[]
count=0
for i in range(len(a)):
  if a[i] == "0" or a[i] == "1":
    ans.append(a[i])
    count += 1
  elif a[i] == "B" and count >= 1:
    ans.remove(a[count-1])
    count -= 1
  else:
    i += 1

print("".join(ans))

Fixed submission:
s=input()
l=len(s)
a=[]
for i in range(l):
  if(s[i]=='B'):
    if(len(a)>=1):
      a=a[:len(a)-1]
  else:
    a.append(s[i])
x=("").join(a)
print(x)
Buggy python submission (verdict: Runtime Error):
#①自分より左側に自分より小さい数字がいてはいけない。

N = int(input())
P = list(map(int, input().split()))  # 入力のときに N を使う必要はありません
count=0#①を満たさない個数をカウント

for i in  range(len(P)):
 for j in range (i):
  if P[j]<P[i]:
   count+=1
   break

print(len(P)-count)#①を満たす個数を算出
                        

Fixed submission:
s=list(input().split())

a=int(s[0])
b=int(s[1])

if a==b:
        d='Yes'
else:
        d='No' 
print(d)

Buggy python submission (verdict: Runtime Error):
#①自分より左側に自分より小さい数字がいてはいけない。

N = int(input())
P = list(map(int, input().split()))  # 入力のときに N を使う必要はありません
count=0#①を満たさない個数をカウント

for i in  range(len(P)):
 for j in range (i):
  if P[j]<P[i]:
   count+=1
   break

print(len(P)-count)#①を満たす個数を算出
                        

Fixed submission:
s=list(input().split())

a=int(s[0])
b=int(s[1])

if a==b:
        d='Yes'
else:
        d='No' 
print(d)

Buggy python submission (verdict: Runtime Error):
#①自分より左側に自分より小さい数字がいてはいけない。

N = int(input())
P = list(map(int, input().split()))  # 入力のときに N を使う必要はありません
count=0#①を満たさない個数をカウント

for i in  range(len(P)):
 for j in range (i):
  if P[j]<P[i]:
   count+=1
   break

print(len(P)-count)#①を満たす個数を算出
                        

Fixed submission:
s=list(input().split())

a=int(s[0])
b=int(s[1])

if a==b:
        d='Yes'
else:
        d='No' 
print(d)
Buggy python submission (verdict: Runtime Error):
import math
S = input()
s = list(S) #文字を一文字ずつリスト格納
count=0
N=math.ceil(len(s)/2)

for i in N:
 if not s[i]==s[N-i-1]:
  count+=1

print(count)

Fixed submission:

import math
S = input()
s = list(S) #文字を一文字ずつリスト格納
count=0
N=int(math.ceil(len(s)/2))

for i in range(N):
 if not s[i]==s[len(s)-i-1]:
  count+=1

print(count)
Buggy python submission (verdict: Runtime Error):
N = float(input())
x = N/1.08
x = int(x)
print(x)


Fixed submission:
a,b = map(int, input().split())
m,n = map(int, input().split())
c=0
d=1

if a==m:
 print(c)
else: 
 print(d)
Buggy python submission (verdict: Runtime Error):
X = float(input())
p = int(N/100) #xが何百以上か判別する。
T=1 #TRUE
F=0 #FALSE
if p==0
 print(F)
 return 0

if X<=p*100:
 print(T)
else:
 print(F)

Fixed submission:
X = float(input())
p = int(X/100) #xが何百以上か判別する。
T=1 #TRUE
F=0 #FALSE
if p==0:
 print(F)

else:
 if X<=p*105:
  print(T)
 else:
  print(F)
Buggy python submission (verdict: Runtime Error):
r=int(input())
s=list(input())
t=int(input())
i=0
for i in range(r):
    if s[i]!=s[t]:
        s[i]=s[t]
          
print(s)

Fixed submission:
N = int(input())
S = input()
K = int(input())
for i in range(N):
  if S[i] != S[K-1]:
    S = S.replace(S[i],'*')
print(S)