Buggy python submission (verdict: Runtime Error):
n,q = map(int,input().split())
s = input()
m = [list(map(int,input().split())) for i in range(q)]
count = [0]*(n+1)
 
for i in range(n):
    if s[i:i+2] == 'AC':
        count[i+1] = count[i] + 1
    else:
        count[i+1] = count[i]
 
for l,r in m:
    print(count[r-1]-count[l-1]

Fixed submission:
n,q = map(int,input().split())
s = input()
m = [list(map(int,input().split())) for i in range(q)]
count = [0]*(n+1)
 
for i in range(n):
    if s[i:i+2] == 'AC':
        count[i+1] = count[i] + 1
    else:
        count[i+1] = count[i]
 
for l,r in m:
    print(count[r-1]-count[l-1])

Buggy python submission (verdict: Runtime Error):
n,q = map(int,input().split())
s = input()
m = [list(map(int,input().split())) for i in range(q)]
count = [0]*(n+1)
 
for i in range(n):
    if S[i:i+2] == 'AC':
        count[i+1] = count[i] + 1
    else:
        count[i+1] = count[i]
 
for l,r in m:
    print(count[r-1]-count[l-1]

Fixed submission:
n,q = map(int,input().split())
s = input()
m = [list(map(int,input().split())) for i in range(q)]
count = [0]*(n+1)
 
for i in range(n):
    if s[i:i+2] == 'AC':
        count[i+1] = count[i] + 1
    else:
        count[i+1] = count[i]
 
for l,r in m:
    print(count[r-1]-count[l-1])

Buggy python submission (verdict: Runtime Error):
n,q = map(int,input().split())
s = input()
m = [list(map(int,input().split())) for i in range(q)]
count = [0]*(n+1)
 
for i in range(n):
    if S[i:i+2] == 'AC':
        comu[i+1] = comu[i] + 1
    else:
        comu[i+1] = comu[i]
 
for l,r in m:
    print(count[r-1]-count[l-1]

Fixed submission:
n,q = map(int,input().split())
s = input()
m = [list(map(int,input().split())) for i in range(q)]
count = [0]*(n+1)
 
for i in range(n):
    if s[i:i+2] == 'AC':
        count[i+1] = count[i] + 1
    else:
        count[i+1] = count[i]
 
for l,r in m:
    print(count[r-1]-count[l-1])

Buggy python submission (verdict: Runtime Error):
n,q = map(int,input().split())
s = input()
m = [list(map(int,input().split())) for i in range(q)]
count = [0]*(N+1)
 
for i in range(n):
    if S[i:i+2] == 'AC':
        comu[i+1] = comu[i] + 1
    else:
        comu[i+1] = comu[i]
 
for l,r in m:
    print(count[r-1]-count[l-1])

Fixed submission:
n,q = map(int,input().split())
s = input()
m = [list(map(int,input().split())) for i in range(q)]
count = [0]*(n+1)
 
for i in range(n):
    if s[i:i+2] == 'AC':
        count[i+1] = count[i] + 1
    else:
        count[i+1] = count[i]
 
for l,r in m:
    print(count[r-1]-count[l-1])

Buggy python submission (verdict: Runtime Error):
n,q = map(int,input().split())
s = input()
m = [list(map(int,input().split())) for i in range(q)]
count = [0]*(N+1)
 
for i in range(n):
    if S[i:i+2] == 'AC':
        comu[i+1] = comu[i] + 1
    else:
        comu[i+1] = comu[i]
 
for l,r in list:
    print(count[r-1]-count[l-1])

Fixed submission:
n,q = map(int,input().split())
s = input()
m = [list(map(int,input().split())) for i in range(q)]
count = [0]*(n+1)
 
for i in range(n):
    if s[i:i+2] == 'AC':
        count[i+1] = count[i] + 1
    else:
        count[i+1] = count[i]
 
for l,r in m:
    print(count[r-1]-count[l-1])

Buggy python submission (verdict: Runtime Error):
n,q = map(int,input().split())
s = input()
m = list(map(int,input().split for i in range(q)))
count = [0]*(N+1)

for i in range(n):
    if S[i:i+2] == 'AC':
        comu[i+1] = comu[i] + 1
    else:
        comu[i+1] = comu[i]

for l,r in list:
    print(count[r-1]-count[l-1])
~


Fixed submission:
n,q = map(int,input().split())
s = input()
m = [list(map(int,input().split())) for i in range(q)]
count = [0]*(n+1)
 
for i in range(n):
    if s[i:i+2] == 'AC':
        count[i+1] = count[i] + 1
    else:
        count[i+1] = count[i]
 
for l,r in m:
    print(count[r-1]-count[l-1])

Buggy python submission (verdict: Runtime Error):
n,q = map(int,(input().split()))
s = input()
m = list(map(int,input().split for i in range(q)))
count = [0]*(N+1)

for i in range(n):
    if S[i:i+2] == 'AC':
        comu[i+1] = comu[i] + 1
    else:
        comu[i+1] = comu[i]

for l,r in list:
    print(count[r-1]-count[l-1])
~


Fixed submission:
n,q = map(int,input().split())
s = input()
m = [list(map(int,input().split())) for i in range(q)]
count = [0]*(n+1)
 
for i in range(n):
    if s[i:i+2] == 'AC':
        count[i+1] = count[i] + 1
    else:
        count[i+1] = count[i]
 
for l,r in m:
    print(count[r-1]-count[l-1])

Buggy python submission (verdict: Runtime Error):
n,q = map(int(input().split()))
s = input()
m = list(map(int,input().split for i in range(q)))
count = [0]*(N+1)

for i in range(n):
    if S[i:i+2] == 'AC':
        comu[i+1] = comu[i] + 1
    else:
        comu[i+1] = comu[i]

for l,r in list:
    print(count[r-1]-count[l-1])
~


Fixed submission:
n,q = map(int,input().split())
s = input()
m = [list(map(int,input().split())) for i in range(q)]
count = [0]*(n+1)
 
for i in range(n):
    if s[i:i+2] == 'AC':
        count[i+1] = count[i] + 1
    else:
        count[i+1] = count[i]
 
for l,r in m:
    print(count[r-1]-count[l-1])