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

Fixed submission:
n,q=map(int,input().split())
s=input()
c=[0]
t=0

for i in range(0,n-1):
    if s[i]=="A" and s[i+1]=="C":
        t+=1
        c.append(t)
    else:
        c.append(t)

for i in range(q):
    l,r=map(int,input().split())
    print(c[r-1]-c[l-1])

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

Fixed submission:
n,q=map(int,input().split())
s=input()
c=[0]
t=0

for i in range(0,n-1):
    if s[i]=="A" and s[i+1]=="C":
        t+=1
        c.append(t)
    else:
        c.append(t)

for i in range(q):
    l,r=map(int,input().split())
    print(c[r-1]-c[l-1])

Buggy python submission (verdict: Runtime Error):
n, q = map(int,input().split())
s = list(input())
x = []
ans = 0
for i in range(n-1):
	if s[i] == "A" and s[i+1] == "C":
		ans += 1
		x.append(ans)
	else:
		x.append(ans)

for j in range(q):
	l, r = map(int,input().split())
	print(x[r-1]-x[l-1])

Fixed submission:
n,q=map(int,input().split())
s=input()
c=[0]
t=0

for i in range(0,n-1):
    if s[i]=="A" and s[i+1]=="C":
        t+=1
        c.append(t)
    else:
        c.append(t)

for i in range(q):
    l,r=map(int,input().split())
    print(c[r-1]-c[l-1])

Buggy python submission (verdict: Runtime Error):
n, q = map(int,input().split())
s = list(input())
x = []

ans = 0
for i in range(n):
	if s[i] == "A" and s[i+1] == "C":
		ans += 1
		x.append(ans)
	else:
		x.append(ans)

for j in range(q):
	l, r = map(int,input().split())
	print(x[r-1]-x[l-1])

Fixed submission:
n,q=map(int,input().split())
s=input()
c=[0]
t=0

for i in range(0,n-1):
    if s[i]=="A" and s[i+1]=="C":
        t+=1
        c.append(t)
    else:
        c.append(t)

for i in range(q):
    l,r=map(int,input().split())
    print(c[r-1]-c[l-1])

Buggy python submission (verdict: Runtime Error):
n, q = map(int,input().split())
s = list(input())
x = []

ans = 0
for i in range(n):
	if s[i] == "A" and s[i+1] == "C":
		ans += 1
		x.append(ans)
	else:
		x.append(ans)
x.append(ans)

for j in range(q):
	l, r = map(int,input().split())
	print(x[r-1]-x[l-1])

Fixed submission:
n,q=map(int,input().split())
s=input()
c=[0]
t=0

for i in range(0,n-1):
    if s[i]=="A" and s[i+1]=="C":
        t+=1
        c.append(t)
    else:
        c.append(t)

for i in range(q):
    l,r=map(int,input().split())
    print(c[r-1]-c[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int,input().split())
s = list(input())

for i in range(q):
	l, r =map(int,input().split())
	x = s[l-1:r]
	ans = 0
	for i in range(len(x)-1):
		if x[i] == "A" and x[i+1] == "C":
			ans += 1
		else:
			pass
	print(ans)

Fixed submission:
n,q=map(int,input().split())
s=input()
c=[0]
t=0

for i in range(0,n-1):
    if s[i]=="A" and s[i+1]=="C":
        t+=1
        c.append(t)
    else:
        c.append(t)

for i in range(q):
    l,r=map(int,input().split())
    print(c[r-1]-c[l-1])

Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
a=[int(i) for i in input().split()]

L=[0]*(n+1)
R=[0]*(n+1)
ans=0
for i in range(n):
    L[i]=math.gcd(L[i-1],a[i])
for i in reversed(range(n)):
    R[i]=math.gcd(R[i-1],a[i])
for i in range(n):
    if math.gcd(L[i-1],R[i+1]) > ans:
        ans=math.gcd(L[i-1],R[i-1])

print(ans)


Fixed submission:
n,q=map(int,input().split())
s=input()
c=[0]
t=0

for i in range(0,n-1):
    if s[i]=="A" and s[i+1]=="C":
        t+=1
        c.append(t)
    else:
        c.append(t)

for i in range(q):
    l,r=map(int,input().split())
    print(c[r-1]-c[l-1])