Problem: You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries:    * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does `AC` occurs as a substring?

Submission attempts (in order):
import numpy as np
N, Q = list(map(int, input().split()))
S = input()
for i in range(Q):
  l, r = list(map(int, input().split()))
  print(int(np.sum([1 for j in range(l-1, r-2) if S[j:j+2] == "AC"])))

import numpy as np
N, Q = list(map(int, input().split()))
S = input()
for i in range(Q):
  l, r = list(map(int, input().split()))
  print(int(np.sum([1 for j in range(l-1, r) if S[j:j+2] == "AC"])))

import numpy as np
N, Q = list(map(int, input().split()))
S = input()
t = [1 if S[j:j+2] == "AC" else 0 for j in range(N)]
for i in range(Q):
  l, r = list(map(int, input().split()))
  print(t[r-1]-t[l-1])

N, Q = list(map(int, input().split()))
S = input()
for i in range(Q):
  l, r = list(map(int, input().split()))
  print(np.sum([1 for i in range(len(S)) if S[i:i+1] == "AC"])

import numpy as np
N, Q = list(map(int, input().split()))
S = input()
for i in range(Q):
  l, r = list(map(int, input().split()))
  print(int(np.sum([1 for i in range(len(S[l:r])) if S[i:i+2] == "AC"])))

import numpy as np
N, Q = list(map(int, input().split()))
S = input()
for i in range(Q):
  l, r = list(map(int, input().split()))
  print(np.sum([1 for i in range(len(S)) if S[i:i+1] == "AC"]))

import numpy as np
N, Q = list(map(int, input().split()))
S = input()
for i in range(Q):
  l, r = list(map(int, input().split()))
  print(int(np.sum([1 for i in range(len(S)) if S[i:i+1] == "AC"])))

import numpy as np
N, Q = list(map(int, input().split()))
S = input()
for i in range(Q):
  l, r = list(map(int, input().split()))
  print(int(np.sum([1 for i in range(len(S[l:r+1])) if S[i:i+2] == "AC"])))

import numpy as np
N, Q = list(map(int, input().split()))
S = input()
for i in range(Q):
  l, r = list(map(int, input().split()))
  print(int(np.sum([1 for i in range(len(S[l-1:r])) if S[i:i+2] == "AC"])))

import numpy as np
N, Q = list(map(int, input().split()))
S = input()
t = [1 if S[j:j+2] == "AC" else 0 for j in range(N)]
for i in range(Q):
  l, r = list(map(int, input().split()))
  print(int(np.sum(t[l-1:r])))

import numpy as np
N, Q = list(map(int, input().split()))
S = input()
t = [1 if S[j:j+2] == "AC" else 0 for j in range(N)]
for i in range(Q):
  l, r = list(map(int, input().split()))
  print(np.sum(t[l-1:r]))

import numpy as np
N, Q = list(map(int, input().split()))
S = input()
for i in range(Q):
  l, r = list(map(int, input().split()))
  print(int(np.sum([1 for i in range(len(S)) if S[i:i+2] == "AC"])))

import numpy as np
N, Q = list(map(int, input().split()))
S = input()
for i in range(Q):
  l, r = list(map(int, input().split()))
  print(np.sum([1 for i in range(len(S)) if S[i:i+1] == "AC"])

import numpy as np
N, Q = list(map(int, input().split()))
S = input()
t = [0] * N
for j in range(1, N):
  t[j] = t[j-1] + 1 if S[j-1:j+1] == "AC" else t[j-1]
for i in range(Q):
  l, r = list(map(int, input().split()))
  print(t[r-1]-t[l-1])

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Accepted