Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n,q=map(int,input().split())
s=str(input())

line = np.ones([n,])
for i in range(n-1):
    if (s[i:i+2]=="AC"): 
        line[i]=1
    else:
        line[i]=0
        

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

Fixed submission:
import numpy as np

n,q=map(int,input().split())
s=str(input())

line = np.zeros([n,])
count = 0
for i in range(1,n):
    if (s[i-1:i+1]=="AC"): 
        count += 1
    line[i]=count 
        
for i in range(q):
    l,r = map(int,input().split())
    target = line[r-1] - line[l-1]
    print(int(target))

Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=str(input())
import numpy as np

grid = np.ones([q,2])
for i in range(q):
    l,r = map(int,input().split())
    grid[i,:] = [l,r] 

line = np.ones([n,])
for i in range(n-1):
    if (s[i:i+2]=="AC"): 
        line[i]=1
    else:
        line[i]=0
    
for i in range(0,q):
    target = line[int(grid[i,0])-1:int(grid[i,1]-1)]
    print(int(sum(target)))

Fixed submission:
import numpy as np

n,q=map(int,input().split())
s=str(input())

line = np.zeros([n,])
count = 0
for i in range(1,n):
    if (s[i-1:i+1]=="AC"): 
        count += 1
    line[i]=count 
        
for i in range(q):
    l,r = map(int,input().split())
    target = line[r-1] - line[l-1]
    print(int(target))

Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=str(input())
grid = []
for i in range(q):
    array = list(map(int, input().strip().split()))
    grid.append(array)

line = []
for i in range(n-1):
    if (s[i:i+2]=="AC"): 
        line.append(1)
    else:
        line.append(0)
    
for i in range(0,q):
    target = line[grid[i][0]-1:grid[i][1]-1]
    print(sum(target))

Fixed submission:
import numpy as np

n,q=map(int,input().split())
s=str(input())

line = np.zeros([n,])
count = 0
for i in range(1,n):
    if (s[i-1:i+1]=="AC"): 
        count += 1
    line[i]=count 
        
for i in range(q):
    l,r = map(int,input().split())
    target = line[r-1] - line[l-1]
    print(int(target))

Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=str(input())
grid = []
for i in range(q):
    array = list(map(int, input().strip().split()))
    grid.append(array)

line = []
for i in range(n-1):
    if (s[i]=="A")&(s[i+1]=="C"): 
        line.append(1)
    else:
        line.append(0)
    
for i in range(0,q):
    target = line[grid[i][0]-1:grid[i][1]-1]
    print(sum(target))

Fixed submission:
import numpy as np

n,q=map(int,input().split())
s=str(input())

line = np.zeros([n,])
count = 0
for i in range(1,n):
    if (s[i-1:i+1]=="AC"): 
        count += 1
    line[i]=count 
        
for i in range(q):
    l,r = map(int,input().split())
    target = line[r-1] - line[l-1]
    print(int(target))

Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=str(input())
grid = []
for i in range(q):
    array = list(map(int, input().strip().split()))
    grid.append(array)


for i in range(0,q):
    target = s[grid[i][0]-1:grid[i][1]]
    count = 0
    flag = False
    for j in range(0,len(target)):
        if (flag == False)&(target[j]=="A"):
            flag = True
        elif (flag == True)&(target[j]=="C"):
            count += 1
            flag = False
    print(count)

Fixed submission:
import numpy as np

n,q=map(int,input().split())
s=str(input())

line = np.zeros([n,])
count = 0
for i in range(1,n):
    if (s[i-1:i+1]=="AC"): 
        count += 1
    line[i]=count 
        
for i in range(q):
    l,r = map(int,input().split())
    target = line[r-1] - line[l-1]
    print(int(target))