Buggy python submission (verdict: Runtime Error):
import numpy as np

N, Q = map(int, input().split())
S = input()
ac_array = np.zeros(N)
ans = []

for i in range(N):
    if S[i] == 'A' and S[i+1] == 'C':
        ac_array[i] += 1
#         ac_array[i+1] += 1
# print(ac_array)
t = []
t.append(0)
for j in range(N):
    t.append(ac_array[:j+1].sum())
#     print(ac_array[:j+1])
# q_list = np.zeros([Q, 2])
# print(ac_array, t)
for q in range(Q):
    q_l, q_r = map(int, input().split())
    ans.append(t[q_r-1]-t[max(q_l-1, 0)])
    
#     q_list[q, 0], q_list[q, 1] = map(int, input().split())
#     ans.append(ac_array[int(q_list[q, 0]-1):int(q_list[q,1]-1)].sum())   

for a in range(Q):
    print(int(ans[a]))

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N+1)
ans = []

for i in range(N):
    t[i+1] += t[i] + ( 1 if S[i:i+2] == 'AC' else 0) 

for i in range(Q):
    l, r = map(int, input().split())
    ans.append(t[r-1] - t[l-1])
    
for i in range(Q):
    print(ans[i])

Buggy python submission (verdict: Runtime Error):
import numpy as np

N, Q = map(int, input().split())
S = input()
ac_array = np.zeros(N)
ans = []

for i in range(N):
    if S[i] == 'A' and S[i+1] == 'C':
        ac_array[i] += 1
#         ac_array[i+1] += 1
# print(ac_array)
q_list = np.zeros([Q, 2])
for q in range(Q):
    q_list[q, 0], q_list[q, 1] = map(int, input().split())
    ans.append(ac_array[int(q_list[q, 0]-1):int(q_list[q,1]-1)].sum())

for a in range(Q):
    print(int(ans[a]))

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N+1)
ans = []

for i in range(N):
    t[i+1] += t[i] + ( 1 if S[i:i+2] == 'AC' else 0) 

for i in range(Q):
    l, r = map(int, input().split())
    ans.append(t[r-1] - t[l-1])
    
for i in range(Q):
    print(ans[i])

Buggy python submission (verdict: Runtime Error):
import numpy as np

N, Q = map(int, input().split())
S = input()
ac_array = np.zeros(N)
ans = []

for i in range(N):
    if S[i] == 'A' and S[i+1] == 'C':
        ac_array[i] += 1
        ac_array[i+1] += 1
#print(ac_array)
q_list = np.zeros([Q, 2])
for q in range(Q):
    q_list[q, 0], q_list[q, 1] = map(int, input().split())
    ans.append(np.trunc(ac_array[int(q_list[q, 0]-1):int(q_list[q,1])].sum()/2))

for a in range(Q):
    print(int(ans[a]))

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N+1)
ans = []

for i in range(N):
    t[i+1] += t[i] + ( 1 if S[i:i+2] == 'AC' else 0) 

for i in range(Q):
    l, r = map(int, input().split())
    ans.append(t[r-1] - t[l-1])
    
for i in range(Q):
    print(ans[i])

Buggy python submission (verdict: Runtime Error):
import numpy as np

N, Q = map(int, input().split())
S = input()
ac_array = np.zeros(N)
ans = []

for i in range(N):
    if S[i] == 'A' and S[i+1] == 'C':
        ac_array[i] += 1
        ac_array[i+1] += 1
print(ac_array)
q_list = np.zeros([Q, 2])
for q in range(Q):
    q_list[q, 0], q_list[q, 1] = map(int, input().split())
    ans.append(np.trunc(ac_array[int(q_list[q, 0]-1):int(q_list[q,1])].sum()/2))

for a in range(Q):
    print(int(ans[a]))

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N+1)
ans = []

for i in range(N):
    t[i+1] += t[i] + ( 1 if S[i:i+2] == 'AC' else 0) 

for i in range(Q):
    l, r = map(int, input().split())
    ans.append(t[r-1] - t[l-1])
    
for i in range(Q):
    print(ans[i])

Buggy python submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = input()
t = [0] * (N+1)
ans = []

for i in range(N):
    t[i+1] += t[i] + ( 1 if S[i:i+2] == 'AC' else 0) 

for i in range(Q):
    l, r = map(int, input().split())
    ans = ans.append(t[r-1] - t[l-1])
    
for i in range(Q):
    print(ans[i])



Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N+1)
ans = []

for i in range(N):
    t[i+1] += t[i] + ( 1 if S[i:i+2] == 'AC' else 0) 

for i in range(Q):
    l, r = map(int, input().split())
    ans.append(t[r-1] - t[l-1])
    
for i in range(Q):
    print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
l = []
r = []
for i in range(Q):
    l_, r_ = map(int, input().split())
    l.append(l_)
    r.append(r_)
    
for i in range(Q):
  print(S[l[i]-1:r[i]].count('AC'))

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N+1)
ans = []

for i in range(N):
    t[i+1] += t[i] + ( 1 if S[i:i+2] == 'AC' else 0) 

for i in range(Q):
    l, r = map(int, input().split())
    ans.append(t[r-1] - t[l-1])
    
for i in range(Q):
    print(ans[i])

Buggy python submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = input()

for i in range:
    l, r = map(int, input().split())
    print(S[l:r+1].count('AC'))

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N+1)
ans = []

for i in range(N):
    t[i+1] += t[i] + ( 1 if S[i:i+2] == 'AC' else 0) 

for i in range(Q):
    l, r = map(int, input().split())
    ans.append(t[r-1] - t[l-1])
    
for i in range(Q):
    print(ans[i])