problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p03087
u699628901
2,000
1,048,576
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...
['n,q = map(int,input().split())\n#s=list(input())\t\ns = input()\nindex = -1\nindexes = []\nwhile True:\n index = s.find("AC", index + 1)\n if index == -1:\n break\n indexes.append(index)\nprint(indexes)\n\nfor i in range(q):\n l,r = map(int,input().split())\n ans1 = 0\n ans2 = len(indexes) + ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s082461452', 's326884672', 's807546182', 's934783487', 's802371316']
[6164.0, 5144.0, 5144.0, 5144.0, 7744.0]
[2104.0, 2104.0, 2104.0, 2104.0, 1213.0]
[497, 523, 519, 482, 401]
p03087
u699752889
2,000
1,048,576
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...
["N, Q = map(int, input().split())\nS = input()\n\nc = [0] * N\n\nfor i in range(N-1):\n if S[i:i+2] == 'AC':\n c[i+1] = c[i] + 1\n else:\n c[i+1] = c[i]\n\nprint(c)\nfor _ in range(Q):\n l, r = map(int, input().split())\n print(c[r-1] - c[l-1])", "N, Q = map(int, input().split())\nS = input()...
['Wrong Answer', 'Accepted']
['s859152216', 's655645287']
[7464.0, 6060.0]
[875.0, 856.0]
[255, 246]
p03087
u703391033
2,000
1,048,576
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...
['n,q=map(int,input().split())\ns=input()\nl=[list(map(int,input().split())) for _ in range(q)]\na=[0]*(n-1)\nfor i in range(n-1):\n if s[i]=="A" and s[i+1]=="C":\n a[i]=1\nb=[0]*n\nfor i in range(n-1):\n b[i+1]=b[i]+a[i]\nprint(b)\nfor i in range(q):\n print(b[l[i][1]-1]-b[l[i][0]-1])', 'n,q=map(int,input().spli...
['Wrong Answer', 'Accepted']
['s403775570', 's889889134']
[34212.0, 33080.0]
[504.0, 486.0]
[278, 269]
p03087
u703890795
2,000
1,048,576
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...
['N, Q = map(int, input().split())\nS = input()\nAClst = []\nc = 0\n\nfor i in range(N-1):\n if S[i:i+2]=="AC":\n c += 1\n AClst.append(c)\nAClst.append(c)\n\nfor q in range(Q):\n l, r = map(int, input().split())\n print(AClst[r]-AClst[l])', 'N, Q = map(int, input().split())\nS = input()\nAClst = [] \n\nfor i in...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s027763721', 's085060749', 's297184019', 's616702887', 's785064217', 's826604352', 's870442284', 's957787740', 's505855337']
[5608.0, 5340.0, 6104.0, 3188.0, 3188.0, 7520.0, 3188.0, 3188.0, 6100.0]
[116.0, 2104.0, 864.0, 18.0, 18.0, 856.0, 17.0, 18.0, 848.0]
[231, 278, 235, 261, 235, 233, 266, 278, 220]
p03087
u705007443
2,000
1,048,576
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...
['tg="AC"\nn,q=map(int,input().split())\ntext=input()\nans=[]\n\ndef check():\n l,r=map(int,input().split())\n text_=text[l-1:][:r-1]\n count=re.findall(tg,text_)\n ans.append(len(count))\n \nfor i in range(q):\n check()\n\nfor i in ans:\n print(i)', "n,q=map(int,input().split())\ntext=input()\nsum...
['Runtime Error', 'Accepted']
['s436157067', 's911360375']
[3188.0, 6104.0]
[18.0, 838.0]
[252, 239]
p03087
u705418271
2,000
1,048,576
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...
['n,q=map(int,input().split())\ns=input()\nt=[0 for _ in range(len(s)+1)]\nfor i in range(n):\n t[i+1]=t[i]+(i if s[i:i+2]=="AC" else 0)\n\nfor i in range(q):\n l,r=map(int,input().split())\n print(t[r-1]-t[l-1])', 'n,q = map(int,input().split())\ns = input()\ncnt = [0]*n\nfor i in range(1,n):\n cnt[i] += cnt[i-1...
['Wrong Answer', 'Accepted']
['s347941617', 's422928872']
[13636.0, 12952.0]
[492.0, 491.0]
[205, 226]
p03087
u706414019
2,000
1,048,576
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...
["\tdef ss():\n N,Q = list(map(int,input().split()))\n s = input()\n lis=[0]*N\n \n count = 0\n for i in range(1,len(s)):\n if s[i-1] == 'A' and s[i] == 'C':\n count +=1\n lis[i]+=count\n for i in range(Q):\n l,r = list(map(int,input().split()))\n print(lis[r...
['Runtime Error', 'Runtime Error', 'Accepted']
['s370007435', 's665251681', 's363301352']
[8896.0, 13092.0, 13084.0]
[25.0, 52.0, 183.0]
[325, 298, 307]
p03087
u707498674
2,000
1,048,576
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...
['N, Q = map(int, input().split())\nS = input()\nwa = [0] * (N + 1)\nflag = "X"\nfor i in range(N):\n if S[i] == "A":\n flag = "A"\n wa[i+1] = wa[i]\n elif flag == "A" and S[i] == "C":\n wa[i+1] = wa[i] + 1\n flag = "X"\n else:\n flag = "X"\n wa[i+1] = wa[i]\n\nprint(w...
['Wrong Answer', 'Accepted']
['s631071909', 's134071337']
[7488.0, 6084.0]
[868.0, 850.0]
[401, 399]
p03087
u707870100
2,000
1,048,576
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...
['# -*- coding: utf-8 -*-\n#ABC122C\nimport sys\nimport copy\ntmp = input().split()\nhoge = list(map(lambda a: int(a), tmp))\nn=hoge[0]\nq=hoge[1]\n\ns = input()\n\nans=[]\nsum=0\nprint(s)\n\nfor j in range(0,n-1):\n\tif(s[j]=="A")and(s[j+1]=="C"):\n\t\tsum+=1\n\tans.append(sum)\n\t#print(s[j])\nans.append(sum)\nans.ap...
['Wrong Answer', 'Accepted']
['s064212446', 's596898851']
[8440.0, 6596.0]
[1168.0, 997.0]
[517, 479]
p03087
u708019102
2,000
1,048,576
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...
['N,Q = [int(x) for x in input().split()]\ns = input()\nl = list(s)\nrui = [0] * (N+1)\nfor i in range(2,len(l)+1):\n if l[i-2] == "A" and l[i-1] == "C":\n rui[i] = rui[i-1] + 1\n else:\n rui[i] = rui[i-1]\nfor i in range(Q):\n a,b = [int(x) for x in input().split()]\n print(rui[b]-rui[a])\npr...
['Wrong Answer', 'Accepted']
['s356515739', 's358714905']
[8952.0, 6932.0]
[893.0, 868.0]
[314, 303]
p03087
u710789518
2,000
1,048,576
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...
["N, Q = map(int, input().split())\nS = input()\nf = [0] * N\nfor i in range(N-1):\n if S[i:i+2] == 'AC':\n f[i] = 1\n\nfor i in range(Q):\n l, r = map(int, input().split())\n print(sum(f[l-1:r]))\n", "N, Q = map(int, input().split())\nS = input()\nAC = []\nfor i in range(N-1):\n if S[i:i+2] == 'AC':\n AC.app...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s351303543', 's475899413', 's743328761']
[5384.0, 5224.0, 9412.0]
[2104.0, 2104.0, 859.0]
[192, 296, 273]
p03087
u711539583
2,000
1,048,576
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...
["n, q = map(int, input().split())\ns = input()\nfor _ in range(q):\n l, r = map(int, input().split())\n print(s[l:r].count('AC'))\n", "n, q = map(input().split())\ns = input()\nfor _ in range(q):\n l, r = map(input().split())\n print(s[l:r].count('AC'))", "n, q = map(int, input().split())\ns = input()\nfor _ in ra...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s176888638', 's542752414', 's855948213', 's987691201']
[3444.0, 3060.0, 3444.0, 6180.0]
[2104.0, 18.0, 2104.0, 852.0]
[127, 116, 139, 288]
p03087
u712082626
2,000
1,048,576
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...
['n, q = map(int, input().split())\ns = input()\ns1 = s\nlist = [0]*q\n\nstart = []\nend = []\nc = s.count("AC")\n\nfor i in range(q):\n s1, e1 = [int(i) for i in input().split()]\n start.append(s1)\n end.append((e1))\n\nfor i in range(c):\n list[i] = s.find("AC")\n s = s.replace("AC", "XX", 1)\n\nresult...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s204776954', 's774019715', 's455206420']
[13496.0, 3188.0, 7748.0]
[2104.0, 18.0, 877.0]
[448, 212, 213]
p03087
u712975113
2,000
1,048,576
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...
["N,Q=map(int,input().split())\nS=input()\nl,r=[],[]\nfor i in range(Q):\n l0,r0=map(int,input().split())\n l.append(l0)\n r.append(r0)\nc={}\nfor i in range(Q):\n for i in range(l[i]-1,r[i]-1):\n if (S[i]=='A') and (S[i+1]=='C'):\n c[i]=1\n d=int(c.count(1))\n print(d)", "N,Q=map(in...
['Runtime Error', 'Accepted']
['s575890511', 's575604119']
[14548.0, 7748.0]
[321.0, 887.0]
[291, 189]
p03087
u716649090
2,000
1,048,576
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...
['N,Q=map(int,input().split())\nS=list(input())\nprint(S)\nk=0\nfor i in range(Q):\n a,b=map(int,input().split())\n for j in range(a,b):\n if S[j-1]=="A"and S[j]=="C":\n k+=1\n print(k)\n k=0', 'N, Q = map(int, input().split())\ns = input()\na = [0] * (N + 1)\n\nfor i in range(N):\n\ta[i + 1] = a[i] + (1 if...
['Wrong Answer', 'Accepted']
['s509321033', 's883724982']
[5488.0, 7748.0]
[2104.0, 860.0]
[191, 219]
p03087
u718949306
2,000
1,048,576
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...
["N, Q = map(int, input().split())\nS = input()\nB = []\nfor s in range(len(S)):\n B.append(S[s])\nA = []\nfor q in range(Q):\n l, r = map(int, input().split())\n cnt = 0\n C = []\n C = S[l-1:r]\n for c in range(len(C)-1):\n if C[c] + C[c+1] == 'AC':\n cnt += 1\n A.append(cnt)\np...
['Wrong Answer', 'Accepted']
['s508027438', 's769319447']
[3992.0, 15416.0]
[2104.0, 274.0]
[310, 321]
p03087
u720384347
2,000
1,048,576
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...
['N,Q = input().split()\nN,Q = int(N),int(Q)\nS = input()\nl,r = [],[]\nfor i in range(Q):\n l_,r_ = input().split()\n l_,r_ = int(l_)-1,int(r_)-1\n l.append(l_)\n r.append(r_)\n \nA = [0]\nsum_ = 0\nfor i in range(1,N):\n if(S[i-1]=="A" and S[i]=="C"):\n sum_ += 1\n A.append(sum_)\n\nfor i ...
['Wrong Answer', 'Accepted']
['s975642240', 's776818378']
[14228.0, 14224.0]
[418.0, 424.0]
[431, 429]
p03087
u720829795
2,000
1,048,576
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...
["N, Q = map(int, input().split())\nS = input()\nt = [0] * (N+1)\n\nfor i in range(1, N+1):\n t[i] = t[i-1] + (1 if S[i-1:i+1] == 'AC' else 0)\n\nprint(t)\n \nfor i in range(Q):\n l, r = map(int, input().split())\n print(t[r-1]-t[l-1])", "N, Q = map(int, input().split())\nS = input()\nt = [0] * (N+1)\n\nfor i in ra...
['Wrong Answer', 'Accepted']
['s684972463', 's792127369']
[9152.0, 7748.0]
[883.0, 905.0]
[226, 216]
p03087
u727025296
2,000
1,048,576
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...
["# -*- coding: utf-8 -*-\nN, Q = map(int, input().split())\nS = input()\nquestion_list = []\n\nfor i in range(Q):\n l, r = map(int, input().split())\n question_list.append((l, r))\n\ntotal_list = [0] * N\nfor i in range(N - 1):\n if S[i] == 'A' and S[i + 1] == 'C':\n total_list[i + 1] = total_list[i] +...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s415162101', 's721527589', 's711991802']
[21016.0, 19736.0, 19740.0]
[435.0, 424.0, 438.0]
[476, 457, 478]
p03087
u728047357
2,000
1,048,576
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...
['# -*- coding: utf-8 -*-\ndef main():\n n, q = inputAsIntArr()\n s = input()\n\n idxes = []\n for i in range(n):\n if s[i] != \'A\':\n continue\n if s[i+1] == \'C\':\n idxes.append(i)\n i += 1\n\n num_acs = ""\n for i in range(q):\n li, ri = input...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s204506137', 's318018294', 's425803474', 's622644190', 's630396526', 's656467170', 's732077073', 's736833237', 's759566962', 's836395265', 's917036277', 's091076263']
[5224.0, 5224.0, 2940.0, 3188.0, 3188.0, 3188.0, 2940.0, 5224.0, 3188.0, 3188.0, 5732.0, 7748.0]
[296.0, 32.0, 17.0, 35.0, 297.0, 2104.0, 18.0, 32.0, 2104.0, 32.0, 2104.0, 838.0]
[551, 534, 609, 458, 468, 460, 444, 558, 463, 457, 617, 505]
p03087
u728615412
2,000
1,048,576
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...
["N,Q = map(int,input().split())\nS = list(input())\ncount = 0\nans = []\nfor i in range(Q):\n r,l = map(int,input().split())\n for k in range(r,l):\n if S[k] == 'A' and S[k+1] == 'C':\n count += 1\n ans.append(count)\n count = 0\nfor j in range(len(ans)):\n print(ans[j])\n", "N,Q = map(int,input().split()...
['Runtime Error', 'Runtime Error', 'Accepted']
['s269240979', 's746603742', 's456330531']
[3956.0, 3060.0, 10992.0]
[2104.0, 17.0, 412.0]
[272, 324, 283]
p03087
u729008627
2,000
1,048,576
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...
["N, Q = map(int, input().split())\nS = input()\nT = [0]*N\nfor i in range(1, N):\n if S[i-1:i+1] == 'AC':\n T[i] = T[i-1] + 1\n else:\n T[i] = T[i-1]\nfor j in range(Q):\n left, right = map(int, input().split())\n print(T[right]-T[left-1])", "N, Q = map(int, input().split())\nS = input()\nT =...
['Runtime Error', 'Accepted']
['s938536539', 's226301196']
[5628.0, 6140.0]
[114.0, 857.0]
[254, 256]
p03087
u729133443
2,000
1,048,576
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...
["I=input\nn,q=map(int,I())\ns=I()\na=[0]\nfor i in range(n):a+=[a[i]+(s[i-1:i+1]=='AC')]\nfor _ in[0]*q:l,r=map(int,I());print(a[r]-a[l])", "I=lambda:map(int,input().split());n,q=I();s=input();a=[0]\nfor i in range(n):a+=a[i]+(s[i-1:i+1]=='AC'),\nwhile q:l,r=I();print(a[r]-a[l]);q-=1"]
['Runtime Error', 'Accepted']
['s631184297', 's500234633']
[3060.0, 7768.0]
[17.0, 908.0]
[131, 141]
p03087
u729938879
2,000
1,048,576
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...
['n, q = map(int, input().split())\ns = input()\nfor i in range(q):\n l, r = map(int, input().split())\n start = s[l-1:r].find(\'A\')\n end = s[l-1:r].rfind("C")\n if start == -1 or end== -1:\n print(0)\n pass\n cand = s[l-1:r][start:end+1]\n print(cand.count("AC"))', 'n, q = map(int, i...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s384361471', 's492433423', 's883809210', 's244065664']
[2940.0, 2940.0, 3644.0, 7748.0]
[17.0, 17.0, 2104.0, 857.0]
[285, 633, 300, 213]
p03087
u730476362
2,000
1,048,576
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...
["\n# if a_i='C', a_(i-1)='A':\n# dp[i]=dp[i-1]+1\n# else:\n# dp[i]=dp[i-1]\n", "\nN, Q = map(int, input().strip().split())\nS = input()\nl = [0] * Q\nr = [0] * Q\nfor i in range(Q):\n l[i], r[i] = map(int, input().strip().split())\n\n\ncum_sum = [0] * N\nfor i in range(N):\n if i == 0:\n cum_sum[i...
['Wrong Answer', 'Accepted']
['s351470645', 's783129044']
[2940.0, 14256.0]
[17.0, 435.0]
[162, 441]
p03087
u731362892
2,000
1,048,576
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...
['n,q = map(int,input().split())\ns=input()\na=[0]*n\nfor i in range(n-1):\n a[i+1]=a[i]+(1 if s[i:i+2]=="AC" else 0)\nprint(a)\n\nfor i in range(q):\n l,r=map(int,input().split())\n print(a[r-1]-a[l-1])\n', 'n,q = map(int,input().split())\ns=input()\na=[0]*n\nfor i in range(n-1):\n a[i+1]=a[i]+(1 if s[i:i+...
['Wrong Answer', 'Accepted']
['s087389995', 's118696070']
[14276.0, 13080.0]
[455.0, 499.0]
[202, 192]
p03087
u733608212
2,000
1,048,576
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...
['n, q = map(int, input().split())\ns = input()\nli = [i for i in s]\npos = []\nfor i in range(len(li)-1):\n if li[i ]== "A" and li[i+1] == "C":\n pos.append(i)\n\nprint(pos)\nfor i in range(q):\n l, r = map(int, input().split())\n pos_copy=pos.copy()\n pos_copy.append(l-1)\n pos_copy.append(r-1)\...
['Wrong Answer', 'Accepted']
['s200635447', 's958330015']
[7120.0, 30808.0]
[2104.0, 467.0]
[382, 268]
p03087
u735008991
2,000
1,048,576
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...
['N, Q = map(int, input().split())\nS = input()\nacc = []\nfor i in range(1, Q+2):\n acc.append(S[0:i].count("AC"))\n\nfor i in range(Q):\n l, r = map(int, input().split())\n print(acc[r] - acc[l-1])\n', 'N, Q = map(int, input().split())\nS = input()\nfor i in range(Q):\n l, r = map(int, input().split())\n ...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s164517890', 's320103273', 's461292209', 's741461769', 's685993210']
[5236.0, 3188.0, 5236.0, 7108.0, 7748.0]
[2104.0, 17.0, 2104.0, 53.0, 866.0]
[199, 134, 204, 228, 240]
p03087
u738898077
2,000
1,048,576
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...
['n,q = map(int,input().split())\ns = input()\nlr=[list(map(int,input().split())) for i in range(q)]\nl=[0]*n\nr=[0]*n\nlcnt=0\nrcnt=0\nfor i in range(n-1):\n if s[i]=="A" and s[i+1] == "C":\n # lcnt+=1\n rcnt+=1\n l[i+1]=1\n r[i+1]=rcnt\nprint(l)\nprint(r)\nfor i in lr:\n # print(max(0,r[...
['Wrong Answer', 'Accepted']
['s900788618', 's854249324']
[33224.0, 31496.0]
[514.0, 491.0]
[369, 401]
p03087
u741397536
2,000
1,048,576
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...
['N, Q = map(int, input().split())\nS = input()\n\nS_sub = S\n\nS = S.replace("AC", "__")\n\nans_arr = []\nfor i in range(Q):\n l, r = map(int, input().split())\n \n ans_arr.append(S[l-1:r].count("__"))\n\nfor i in range(Q):\n print(ans_arr[i])', 'N, Q = map(int, input().split())\nS = list(input())\n\narr =...
['Wrong Answer', 'Accepted']
['s941354697', 's058667629']
[5108.0, 10992.0]
[2104.0, 428.0]
[240, 483]
p03087
u745087332
2,000
1,048,576
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...
["# coding:utf-8\n\nimport sys\n# from collections import Counter, defaultdict\n\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().split()\ndef II(): retur...
['Wrong Answer', 'Accepted']
['s268751062', 's081820499']
[25656.0, 24476.0]
[271.0, 265.0]
[696, 682]
p03087
u745561510
2,000
1,048,576
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...
['n,q = map(int,input().split())\ns = input()\n\n\nt = [0] * n\nfor i in range(n-1):\n if s[i] == "A" and s[i+1] == "C":\n t[i+1] = t[i] + 1\n else:\n t[i+1] = t[i]\n\nprint(t)\n\nfor i in range(q):\n l, r = map(int,input().split())\n print(t[r-1] - t[l-1])', 'n,q = map(int,input().split())\ns...
['Wrong Answer', 'Accepted']
['s496227671', 's504796823']
[7592.0, 6060.0]
[861.0, 849.0]
[266, 258]
p03087
u746627216
2,000
1,048,576
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...
["import numpy as np\n\nN, Q = map(int, input().split())\n\nS = input()\n\nac = np.zeros(N-1)\n\nfor i in range(Q):\n\tl, r = map(int, input().split())\n print(S.count('AC'))\n\t#print(int(sum(ac[l-1:r-2])))", "import numpy as np\n \nN, Q = map(int, input().split())\n \nS = input()\n \nac = np.zeros(N-1)\n \nfor i i...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s221961159', 's621007869', 's794862175', 's711684003']
[2940.0, 14792.0, 15560.0, 14004.0]
[17.0, 2109.0, 2108.0, 1195.0]
[195, 174, 252, 266]
p03087
u750783400
2,000
1,048,576
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...
["N,Q = map(int,input().split())\nS = input()\n\nfor i in range(Q):\n lq,rq = map(int,input().split())\n s = S[lq-1:rq]\n count = 0\n while(s.find('A') != -1):\n j = s.find('A')\n if(s[j+1] == 'C'):\n count+=1\n s = s[j+2:]\n else:\n s = s[j+1:]\n pri...
['Runtime Error', 'Accepted']
['s935322851', 's911242632']
[3360.0, 8436.0]
[2104.0, 863.0]
[315, 1091]
p03087
u753803401
2,000
1,048,576
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...
['n, q = map(int, input().split())\ns = input()\na = [0] * n\nt = 0\nfor i in range(1, n):\n if s[i-1] == "A" and s[i] == "C":\n t += 1\n a[i] += t\nprint(a)\nfor i in range(q):\n l, r = map(int, input().split())\n print(a[r-1] - a[l-1])\n', 'n, q = map(int, input().split())\ns = input()\na = [0] * n...
['Wrong Answer', 'Accepted']
['s293693980', 's005277799']
[9072.0, 9204.0]
[885.0, 852.0]
[244, 235]
p03087
u754727115
2,000
1,048,576
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...
["n,q=map(int,input().split())\ns=input()\na=[0]\nfor l in range(n):\n if s[l]=='A' and s[l+1]=='C':\n for j in range(1,2):\n a.append(a[l]+1)\n l+=1\n else :\n a.append(a[l])\nfor k in range(q):\n x,y=map(int,input().split())\n print(a[y-1]-a[x-1])\nprint(a)", "n,q=map(int,i...
['Runtime Error', 'Runtime Error', 'Accepted']
['s227248794', 's301815651', 's857551793']
[12476.0, 10324.0, 11448.0]
[485.0, 468.0, 465.0]
[288, 279, 233]
p03087
u757117214
2,000
1,048,576
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...
['N,Q=map(int,input().split())\nS=input()\ns_cnt=[]\nfor i in range(N):\n s_cnt.append(S[:i+2].count("AC"))\nfor i in range(Q):\n l,r=map(int,input().split())\n print(s_cnt[r-1] - s_cnt[l-1])', 'N,Q=map(int,input().split())\nS=input()\ns_cnt=[]\ncnt=0\nfor i in range(N-1):\n if S[i]=="A" and S[i+1]=="C":\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s865566616', 's990689992', 's071326359']
[5236.0, 6104.0, 6104.0]
[2104.0, 874.0, 863.0]
[191, 340, 340]
p03087
u758649177
2,000
1,048,576
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...
['N, Q = map(int, input().split())\nS = str(input())\nleng=len(S)\nfor i in range(Q):\n l, r = map(int, input().split())\n slice = S[l-1:r]\n po=slice.replace("AC","")\n le=len(po)\n\n print(int((leng-(r-l+1)+le)/2))', 'N, Q = map(int, input().split())\nS = str(input())\nlen=len(S)\nfor i in range(Q):\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s118975885', 's827874377', 's718840345']
[3596.0, 3188.0, 6084.0]
[2104.0, 18.0, 815.0]
[220, 213, 279]
p03087
u762420987
2,000
1,048,576
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...
['max_num = 0\nnum = 0\nfor c in input():\n if c in {"A", "C", "G", "T"}:\n num += 1\n else:\n max_num = max(max_num, num)\n num = 0\nmax_num = max(max_num, num)\nprint(max_num)\n', 'N, Q = map(int, input().split())\nS = input()\nlr = [tuple(map(int, input().split())) for _ in range(Q)]\nac_i...
['Wrong Answer', 'Accepted']
['s584582937', 's072735769']
[3060.0, 19804.0]
[17.0, 422.0]
[194, 296]
p03087
u768896740
2,000
1,048,576
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...
["n, q = map(int, input().split())\ns = list(input())\n\nl = [0]\nll = []\ncount = 0\n\nfor i in range(n):\n if s[i] == 'A' and s[i+1] == 'C':\n count += 1\n l.append(count)\n\n\nfor i in range(q):\n array = list(map(int, input().split()))\n ll.append(array)\n\nfor i in range(q):\n print(l[ll[i][1...
['Runtime Error', 'Accepted']
['s074991325', 's500930633']
[33428.0, 6188.0]
[489.0, 849.0]
[332, 243]
p03087
u769698512
2,000
1,048,576
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...
['n, q = map(int, input().split())\ns = input()\nac = [0]*n\n\nfor i in range(1, n):\n if s[i]=="C" and s[i-1]=="A":\n ac[i]=1\n else:\n ac[i]=0\n\ncnt = [0]*n\nfor i in range(1, n):\n cnt[i] += cnt[i-1] + ac[i]\nprint(cnt)\nfor i in range(q):\n l, r = map(int, input().split())\n print(cnt[...
['Wrong Answer', 'Accepted']
['s538187405', 's276975708']
[10796.0, 8436.0]
[885.0, 865.0]
[317, 306]
p03087
u770009793
2,000
1,048,576
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...
['N,Q = map(int, input().split())\nS = input()\nfor i in range(Q):\n l, r = map(int, input().split())\n print(l + r)\n', 'N,Q = map(int, input().split())\nS = input()\nfor i in range(Q):\n l, r = map(int, input().split())\n s = S.copy()[l-1, r]\n print(s)\n', 'N,Q = map(int, input().split())\nS = input()\nfor i in...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s059640375', 's206649179', 's373304295', 's790353505', 's897734457', 's855451335']
[3828.0, 3188.0, 134488.0, 134440.0, 3188.0, 13572.0]
[813.0, 17.0, 216.0, 213.0, 17.0, 262.0]
[113, 132, 124, 124, 141, 300]
p03087
u773686010
2,000
1,048,576
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...
['N,K = map(int,input().split())\nmoji = str(input())\nans = [0]\nfor i in range(N-1):\n if moji[i] == "A" and moji[i+1] == "C":\n ans.append(ans[i]+1)\n else:\n ans.append(ans[i])\n\n \nfor i in range(K):\n st,sp = map(int,input().split())\n print(ans[sp]-ans[st])\n ', 'N,K = map(in...
['Runtime Error', 'Accepted']
['s046028862', 's324167160']
[11504.0, 11500.0]
[84.0, 466.0]
[289, 289]
p03087
u774539708
2,000
1,048,576
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...
['import math\n\nn,q=map(int,input().split())\nS=input()\nA=[]\nflag=0\nfor i in range(n):\n if S[i]=="A":\n flag=1\n elif S[i]=="C":\n if flag==1:\n A.append(i-1)\n flag=0\n else:\n flag=0\na=len(A)\n \nfor i in range(q):\n l,r=map(int,input().split())\n l-=...
['Runtime Error', 'Runtime Error', 'Accepted']
['s376197452', 's596478119', 's790212969']
[5844.0, 6268.0, 6128.0]
[2104.0, 2104.0, 881.0]
[918, 927, 321]
p03087
u775681539
2,000
1,048,576
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...
["import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n \ndef main():\n n, q = map(int, readline().split())\n s = readline().rstrip().decode()\n ac = [] \n cnt = 0\n for i in range(1, n+1):\n if (s[i-1] == 'A') and (s[i] == 'C')...
['Runtime Error', 'Accepted']
['s329068001', 's000113729']
[6416.0, 6316.0]
[234.0, 238.0]
[575, 574]
p03087
u777028980
2,000
1,048,576
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...
['n,q=map(int,input().split())\nhoge=input()\nhuga=[0]\nfor i in range(n-1):\n flag=0\n if(hoge[i]=="A" and hoge[i+1]=="C"):\n flag=1\n huga.append(huga[-1]+flag)\n \nprint(huga)\n\nfor i in range(q):\n a,b=map(int,input().split())\n print(huga[b-1]-huga[a-1])', 'n,q=map(int,input().split())\nhoge=input()\nhug...
['Wrong Answer', 'Accepted']
['s996679192', 's987285768']
[9104.0, 7688.0]
[866.0, 889.0]
[254, 239]
p03087
u779455925
2,000
1,048,576
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...
['N,Q=map(int,input().split())\nS=input()\nLR=[map(int,input().split()) for i in range(Q)]\n\ndata=[0 for i in range(N)]\nfor i in range(N-1):\n data[i+1]=data[i]\n if S[i]+S[i+1]=="AC":\n data[i+1]+=1\n\n\nprint(data)\n\nfor l,r in LR:\n print(data[r-1]-data[l-1])\n', 'N,Q=map(int,input().split())\nS=i...
['Wrong Answer', 'Accepted']
['s645194630', 's326410248']
[53340.0, 52832.0]
[568.0, 564.0]
[266, 251]
p03087
u780962115
2,000
1,048,576
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...
['n,q=map(int,input().split())\nsome=input()\nlists=[]\n\nfor _ in range(q):\n add=list(map(int,input().split()))\n lists.append(add)\nprint(lists)\nfor j in range(q):\n nums=some[lists[j][0]-1:lists[j][1]].count("AC")\n print(nums)\n', 'n,q=map(int,input().split())\nsome=input()\nlists=[]\n \nfor _ in r...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s476594895', 's602681295', 's625250189']
[32096.0, 32096.0, 30596.0]
[2105.0, 2105.0, 506.0]
[233, 249, 427]
p03087
u784022244
2,000
1,048,576
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...
['N, Q=map(int, input().split())\nS=list(input())\nL=[0]*(N)\ns=[0]*(N+1)\nfor i in range(1,N):\n if S[i-1]=="A" and S[i]=="C":\n L[i]=1\n \nfor i in range(N):\n s[i+1]=s[i]+L[i]\nfor i in range(Q):\n l,r=map(int, input().split())\n print(s[l]-s[r-1])', 'N, Q=map(int, input().split())\nS=list(input())\nL=[0]*...
['Wrong Answer', 'Accepted']
['s918625368', 's841954762']
[10612.0, 9204.0]
[868.0, 866.0]
[247, 249]
p03087
u785610726
2,000
1,048,576
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...
['x = input()\ny = x.split()\ny = [int (i) for i in y]\nhaha = input()\n\nresult = 0\nnum = y[1]\ncount = 0\nlength = y[0]\narr = [0] * (length + 1)\narr[0] = 0\n\nfor i in range(length-1):\n if haha[i] == "A" and haha[i+1] == "C":\n arr[i+1] = count\n\n count +=1\n else:\n arr[i+1] =...
['Wrong Answer', 'Accepted']
['s224136696', 's990979730']
[6188.0, 6188.0]
[900.0, 920.0]
[506, 491]
p03087
u788023488
2,000
1,048,576
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...
['n, q = map(int, input().split()) # input:"2 2"\ns = str(input())\n\nans=[0]*n\nfor i in range(n):\n if s[i]==\'A\' and s[i+1]==\'C\':\n ans[i]=1\nfor i in range(q):\n l, r = map(int, input().split()) \n print(sum(ans[L[i]-1:R[i]-1]))', "N, Q = map(int, input().split())\nS = input()\nt = [0] * (N + 1)\nfor i in ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s008991420', 's204860062', 's026512636']
[3956.0, 3956.0, 6060.0]
[37.0, 19.0, 1145.0]
[346, 244, 593]
p03087
u789339072
2,000
1,048,576
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...
['N, Q = map(int,input().split())\nS = input()\nmemo = [0 for _ in [0]*(N+1)]\nfor i in range(2,N+1):\n memo[i] = memo[i-1] + int(S[i-2:i]=="AC")\nfor _ in range(Q):\n l, r = map(int,input().split())\n print(memo[r]-memo[l-1])', 'N, Q = map(int,input().split())\nS = input()\nmemo = [0 for _ in [0]*(N+1)]\nfor ...
['Wrong Answer', 'Accepted']
['s252345926', 's558837428']
[7688.0, 7788.0]
[891.0, 877.0]
[226, 224]
p03087
u794173881
2,000
1,048,576
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...
['n,q = map(int,input().split())\ns = "n"+input()\ninfo = [list(map(int,input().split())) for i in range(q)]\n\nruiseki = [0]*(n+1)\nfor i in range(1,n+1):\n if s[i-1]+s[i] == "AC" :\n ruiseki[i] = ruiseki[i-1] + 1\n else:\n ruiseki[i] = ruiseki[i-1]\nprint(ruiseki)\nfor i in range(q):\n print(ruiseki[info[i][...
['Wrong Answer', 'Accepted']
['s673091828', 's784219879']
[31784.0, 30752.0]
[488.0, 488.0]
[330, 316]
p03087
u794448346
2,000
1,048,576
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...
['N,Q = map(int,input().split())\nS = input()\nc = [0]\ncount = 0\nfor i in range(N-1):\n if S[i] == "A" and S[i+1] == "C":\n count += 1\n c.append(count)\nprint(c)\nfor i in range(Q):\n l,r = map(int,input().split())\n print(c[r-1]-c[l-1])', 'N,Q = map(int,input().split())\nS = input()\nc = []\ncoun...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s065613592', 's859875134', 's972508742', 's312996967']
[12820.0, 12496.0, 12700.0, 11492.0]
[477.0, 476.0, 469.0, 448.0]
[246, 298, 246, 289]
p03087
u798316285
2,000
1,048,576
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...
['n,q=map(int,input().split())\ns=input()\nfor i in range(q):\n l,r=map(int,input().split())\n print(s[l:r+1].count("AC"))', 'n,q=map(int,input().split())\ns=input()\nT=[0]*(n+1)\nfor i in range(n-1):\n T[i+2]=T[i+1]+[0,1][s[i:i+2]=="AC"]\nfor _ in range(q):\n l,r=map(int,input().split())\n print(T[r]-T[l-1]-[0,1]...
['Wrong Answer', 'Accepted']
['s063169324', 's028632997']
[3444.0, 7748.0]
[2104.0, 945.0]
[118, 202]
p03087
u799691369
2,000
1,048,576
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...
["n, q = map(int, input().split())\n\nword = input()\n\ncounter = [0] * n\n\nfor i in range(1, len(word)):\n counter[i] = counter[i-1]\n if word[i-1] + word[i] == 'AC':\n counter[i] += 1\n\nprint(counter)\nfor i in range(q):\n start, end = map(int, input().split())\n print(counter[end-1] - counter[st...
['Wrong Answer', 'Accepted']
['s146625722', 's498014309']
[7464.0, 6060.0]
[869.0, 878.0]
[311, 297]
p03087
u803617136
2,000
1,048,576
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...
["N, Q = map(int, input().split())\nS = list(input())\ncnt = [0] * (N - 1)\n\nlast = ''\nfor i in range(N):\n c = S[i]\n if (last + c) == 'AC':\n cnt[i] = 1\n last = c\n\nfor _ in range(Q):\n l, r = map(int, input().split())\n ans = sum(cnt[l - 1:r - 1])\n print(ans)", "N, Q = map(int, input()....
['Runtime Error', 'Accepted']
['s933253842', 's333879007']
[6060.0, 6872.0]
[2104.0, 945.0]
[276, 298]
p03087
u806855121
2,000
1,048,576
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...
["import sys\nimport numpy as np\ninput = sys.stdin.readline\n\nN, Q = map(int, input().split())\nS = input()\nindex = []\n\nfor i in range(0, len(S)-1):\n if S[i] == 'A' and S[i+1] == 'C':\n index.append(i)\nprint(index)\n\nfor i in range(Q):\n a, b = map(int, input().split())\n num1 = -1\n for x in...
['Wrong Answer', 'Accepted']
['s658126776', 's591566769']
[16904.0, 8436.0]
[2109.0, 902.0]
[552, 326]
p03087
u807701563
2,000
1,048,576
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...
["N, Q = map(int, input().split())\nS = input()\nAC = [0]\nn = 0\nfor i in range(1,len(S)):\n if S[i-1] == 'A' and S[i] == 'C':\n n += 1\n AC.append(n)\nprint(AC)\nfor _ in range(Q):\n l, r = map(int, input().split())\n print(AC[r-1]-AC[l-1])", "N, Q = map(int, input().split())\nS = input()\nAC = [0]...
['Wrong Answer', 'Accepted']
['s362166122', 's189911889']
[7520.0, 6100.0]
[855.0, 859.0]
[248, 238]
p03087
u811132356
2,000
1,048,576
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...
['#!/usr/bin/env python\n# coding: utf-8\n\n# In[78]:\n\n\nN,Q=map(int,input().split())\nS=input()\nlr=[list(map(int,input().split())) for l in range(Q)]\nct=0\nl=list()\nimport re\ni = 0\npAC=re.compile("AC")\nwhile i >= 0:\n m = pAC.search(S, i)\n if m:\n l.append(m.start()+1)\n #l.append(m.end())...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s413615162', 's415152590', 's019060822']
[32112.0, 29720.0, 30756.0]
[2105.0, 2105.0, 475.0]
[450, 450, 347]
p03087
u811436126
2,000
1,048,576
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...
['def main(): \n \tN, Q = map(int, input().split())\n S = input()\n\n list = [0] * (N + 1)\n\n for i in range(N):\n list[i + 1] = list[i] + (1 if S[i:i + 2] == "AC" else 0)\n\n for i in range(Q):\n a, b = map(int, input().split())\n output = list[b - 1] - list[a - 1]\n print(...
['Runtime Error', 'Runtime Error', 'Accepted']
['s234638920', 's671882136', 's442120028']
[2940.0, 2940.0, 32196.0]
[17.0, 17.0, 511.0]
[353, 351, 328]
p03087
u811512248
2,000
1,048,576
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...
['import re\nN, Q = map(int, input().split())\nS = input()\nl = []\nr = []\nfor i in range(Q):\n li, ri = map(int, input().split())\n l += [li]\n r += [ri]\n\nfor ind in range(Q):\n substr = S[max(0, l[ind]-1) : min(r[ind], N)]\n #print(substr.count("AC"))\n print(len(re.findall("AC", S)))\n', 'N, Q =...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s364097576', 's736950820', 's244264203']
[14660.0, 11120.0, 15808.0]
[2108.0, 332.0, 501.0]
[294, 252, 330]
p03087
u813098295
2,000
1,048,576
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...
["n, q = map(int, input().split())\ns = input()\nruisekiwa = [0]\nfor i in range(len(s)-2):\n if s[i:i+2] == 'AC':\n ruisekiwa += [ ruisekiwa[-1] + 1 ]\n else:\n ruisekiwa += [ ruisekiwa[-1] ]\n\nruisekiwa += [ ruisekiwa[-1] ]\n\nfor _ in range(q):\n l, r = map(int, input().split())\n l -= 1; ...
['Wrong Answer', 'Accepted']
['s659895904', 's838897382']
[7252.0, 6100.0]
[1063.0, 879.0]
[390, 352]
p03087
u814608389
2,000
1,048,576
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...
["import sys\nimport math\n\nn,q = map(int, input().split())\ns = input()\nl = [0] * q\nr = [0] * q\nfor i in range(q):\n l[i], r[i] = map(int, input().split())\n\nleft = [0] * n\nright = [0] * n\nsum = s.count('AC')\nfor i in range(n):\n left[i] = s[:i].count('AC')\n right[i] = s[i:].count('AC')\n\nprint(left...
['Wrong Answer', 'Accepted']
['s325852927', 's497757430']
[13428.0, 6140.0]
[2108.0, 887.0]
[382, 325]
p03087
u814781830
2,000
1,048,576
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...
['N, Q = map(int, input().split())\nS = input()\narray = [0,0]\nfor i in range(len(S)-2):\n s = S[i]+S[i+1]\n array.append(array[i]+s.count("AC"))\narray.append(array[i+1])\nfor i in range(Q):\n s, e = map(int, input().split())\n print(array[e] - array[s])\n', 'N, Q = map(int, input().split())\nS = input()\...
['Runtime Error', 'Runtime Error', 'Accepted']
['s796744082', 's821013477', 's911162099']
[7688.0, 7684.0, 6140.0]
[892.0, 880.0, 863.0]
[258, 262, 243]
p03087
u814986259
2,000
1,048,576
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...
["N, Q = map(int, input().split())\nS = input()\nlr = [tuple(map(int, input().split())) for i in range(Q)]\n\ns = [0]*(N)\nfor i in range(1, N):\n s[i] = s[i-1]\n if S[i-1:i+1] == 'AC':\n s[i] += 1\n\n\nfor l, r in lr:\n l -= 1\n r -= 1\n if S[l] == 'C':\n print(s[r] - s[l])\n else:\n ...
['Wrong Answer', 'Accepted']
['s714308258', 's982497758']
[21920.0, 19740.0]
[480.0, 505.0]
[346, 337]
p03087
u821588465
2,000
1,048,576
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...
["N, Q = map(int, input().split())\nS = input()\nt = [0] * (N+1)\nfor i in range(N):\n t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)\nprint(t)\nfor i in range(Q):\n l,r = map(int, input().split())\n print(t[r-1] - t[l-1]) \n \n", "N, Q = map(int, input().split())\nS = input()\nt = [0] * (N+1)\nfor i in ran...
['Wrong Answer', 'Accepted']
['s741336713', 's036586957']
[14288.0, 13036.0]
[489.0, 482.0]
[228, 215]
p03087
u826263061
2,000
1,048,576
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...
[" n, q = list(map(int, input().split()))\ns = input()\n\ndef f(i):\n cnt = 0\n for j in range(i-1):\n \n if s[j:j+2] == 'AC':\n cnt += 1\n return cnt\n\nfor _ in range(q):\n l, r = list(map(int, input().split()))\n #print(s[l-1:r])\n print(f(r) - f(l))\n", "n, q = list(map(in...
['Runtime Error', 'Accepted']
['s178655627', 's295239057']
[2940.0, 6188.0]
[17.0, 908.0]
[297, 419]
p03087
u826929627
2,000
1,048,576
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...
["N,Q = map(int,input().split())\nS = input()\n\ncheck_point = []\ncheck = 0\ninf = 10\n\n\nfor i in range(inf):\n out = S.find('AC')\n if out < 0:\n break\n else:\n S = S[out+2:]\n check_point.append(out + len(check_point) * 2)\n \n\n\nfor i in range(Q):\n start, end = map(int,input().split())\n list_m...
['Wrong Answer', 'Accepted']
['s060213637', 's054694542']
[3572.0, 30712.0]
[973.0, 320.0]
[484, 616]
p03087
u829416877
2,000
1,048,576
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...
["N, Q = map(int, input().split())\nS = input()\nt = [0] * (N + 1)\nfor i in range(N):\n t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)\nfor i in range(Q):\n l, r = map(int, input().split())\nprint(t[r-1] - t[l-1])\n ", "N, Q = map(int, input().split())\nS = input()\nt = [0] * (N + 1)\nfor i in range(N):\n ...
['Wrong Answer', 'Accepted']
['s823830058', 's225469228']
[13028.0, 13040.0]
[211.0, 488.0]
[218, 215]
p03087
u833492079
2,000
1,048,576
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...
['N, Q = map(int, input().split())\t\t# 5 7\nS = input()\n\n#print(N,Q,S)\n\na=[0]*N\n\nfor i in range(N):\n\tif i==0: continue;\n\ts = S[i:i+2]\n\ta[i] = a[i-1] + (1 if s=="AC" else 0)\n\n\nfor q in range(1,Q+1):\n\tl, r = map(int, input().split())\t\t# 5 7\n\tprint(a[r-1]-a[l-1])\n\t', 'N, Q = map(int, input().split(...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s024204562', 's410841404', 's611040259', 's722745990', 's407191316']
[9460.0, 7156.0, 9460.0, 3956.0, 6084.0]
[877.0, 67.0, 871.0, 18.0, 887.0]
[258, 244, 262, 246, 246]
p03087
u833543158
2,000
1,048,576
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...
['import re\nN, Q = map(int, input().split())\nS = input()\nindices = [(m.start(0), m.end(0)) for m in re.finditer("AC", S)]\n\nfor _ in range(Q):\n li, ri = map(int, input().split())\n print(len([x for x in indices if x[0] >= li - 1 and x[0] <= ri - 1]))\n', 'import re\nN, Q = map(int, input().split())\nS = inpu...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s261166552', 's856185293', 's915301336', 's806147029']
[10736.0, 6420.0, 12400.0, 6180.0]
[2104.0, 2104.0, 2104.0, 850.0]
[253, 248, 267, 341]
p03087
u835482198
2,000
1,048,576
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...
["n, q = map(int, input().split())\ns = input()\n\nac = [0 for i in range(n)]\nfor i in range(1, n - 1):\n if s[i - 1] == 'A' and s[i] == 'C':\n ac[i] = 1\n\nfor i in range(n - 1):\n ac[i + 1] += ac[i]\nac = [0] + ac\nfor i in range(q):\n l, r = map(int, input().split())\n l -= 1\n r -= 1\n pri...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s415168127', 's453377918', 's672417494', 's229837995']
[7960.0, 9200.0, 9108.0, 7692.0]
[897.0, 937.0, 889.0, 891.0]
[325, 388, 327, 317]
p03087
u838772890
2,000
1,048,576
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...
["AC = 'AC'\nqlist = []\nS = input()\nN, Q = map(int, input().split())\n\nfor i in range(Q):\n s, e = map(int, input().split())\n qlist.append([s-1, e])\n\nfor q in qlist:\n tmp = S[q[0]:q[1]]\n print(tmp.count(AC))", "N, Q = map(int, input().split())\nS = input()\nt = [0] * (N + 1)\nfor i in range(N):\n ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s179540267', 's379612493', 's601594056', 's448615506']
[3188.0, 3064.0, 24876.0, 8692.0]
[18.0, 17.0, 369.0, 907.0]
[215, 221, 337, 293]
p03087
u841222846
2,000
1,048,576
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...
['n, q = list(map(int, input().split(" ")))\ns = input()\nl = q*[0]\nr = q*[0]\nfor i in range(q):\n l[i], r[i] = list(map(int, input().split(" ")))\n\n\nAC = (n)*[0]\nfor i in range(len(s)-1):\n if(s[i:i+2] == "AC"): AC[i+1] += AC[i] + 1\n else: AC[i+1] = AC[i]\n\nprint(AC)\nfor i in range(q):\n print(AC[r...
['Wrong Answer', 'Accepted']
['s632900750', 's701584984']
[15472.0, 14212.0]
[490.0, 471.0]
[321, 311]
p03087
u844789719
2,000
1,048,576
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...
["N, Q = [int(_) for _ in input().split()]\nS = input()\nLR = [[int(_) for _ in input().split()] for _ in range(Q)]\n\ncumsum = [0] * (N + 10)\nfor i in range(N - 1):\n cumsum[i] = cumsum[i - 1]\n if S[i:i + 2] == 'AC':\n cumsum[i] += 1\n\nprint(cumsum)\nfor l, r in LR:\n print(cumsum[r - 2] - cumsum[l ...
['Wrong Answer', 'Accepted']
['s790514313', 's179483904']
[25604.0, 24472.0]
[445.0, 443.0]
[312, 298]
p03087
u844902298
2,000
1,048,576
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...
['n,q = list(map(int,input().split()))\ns = list(input())\nnum = list()\ncheck = [0]*n\nfor i in range(0,n-1):\n if s[i] == "A" and s[i+1] == "C":\n check[i] = check[i-1]+1\n else:\n check[i] =check[i-1] \nans = 0\nfor i in range(0,q):\n num = list(map(int,input().split(...
['Wrong Answer', 'Accepted']
['s498512026', 's285730747']
[6944.0, 6944.0]
[921.0, 888.0]
[375, 375]
p03087
u848654125
2,000
1,048,576
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...
['N, Q = map(int, input().split())\nstring = input()\n \ncounter = [0]*N\n\nfor i in range(Q):\n counter[i+1] = counter[i]\n if string[i:i+2] == "AC":\n counter[i+1] += 1\n \nfor i in range(Q):\n l, r = map(int, input().split())\n print(counter[l-1] - counter[r-1])', 'N, Q = map(int, input().s...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s337414799', 's404568654', 's194679803']
[6132.0, 3188.0, 7748.0]
[801.0, 273.0, 883.0]
[277, 107, 255]
p03087
u850390157
2,000
1,048,576
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...
["N, Q = input().split()\nS = input()\nfor i in range(int(Q)):\n l, r = (int(x) for x in input().split())\n sub_S = S[l-1:r]\n count = 0\n\tprint('test')", "N, Q = map(int, input().split())\nS = input()\n\nAC_appearance = [0] * len(S)\ncounter = 0\nfor i in range(1, len(S)):\n if S[i-1] == 'A' and S[i] == '...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s192782499', 's862763593', 's589146053']
[2940.0, 7488.0, 6084.0]
[17.0, 866.0, 869.0]
[153, 358, 336]
p03087
u851706118
2,000
1,048,576
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...
["N, Q = map(int, input().split())\nS = list(input())\n\nmark = [0]*(N+1)\n\nfor i in range(2, N+1):\n if S[i-2] == 'A' and S[i-1] == 'C':\n mark[i] = mark[i-1] + 1\n else:\n mark[i] = mark[i-1]\n\nfor i in range(Q):\n l,r = map(int,input().split())\n print(l, r)\n print(mark[r]-mark[l])", ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s030132235', 's417810785', 's719080326', 's033524199']
[7872.0, 7876.0, 7876.0, 31376.0]
[1008.0, 966.0, 983.0, 445.0]
[301, 301, 405, 307]
p03087
u852798899
2,000
1,048,576
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...
['n, q = map(int, input().split())\ns = input()\n\nfor i in range(q):\n l, r = map(int, input().split())\n tmp = s[l-1:r]\n print(tmp)\n if len(tmp) > 0:\n count = 0\n for j in range(0, len(tmp)-1):\n if s[i] == "A" and s[i+1] == "C":\n count+=1\n print(count//2)\n else:\n print(0)\n \n\n'...
['Wrong Answer', 'Accepted']
['s465677157', 's609250204']
[19228.0, 10476.0]
[2104.0, 871.0]
[300, 365]
p03087
u854962015
2,000
1,048,576
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...
['N,Q=map(int,input().split())\nS=input()\nL=[]\nR=[]\nC=[0]*N\nc=0\nfor i in range(Q):\n A=list(map(int,input().split()))\n L.append(A[0])\n R.append(A[1])\nfor i in range(N-1):\n if S[i]=="A" and S[i+1]=="C":\n c+=1\n C[i]=c\n else:\n C[i]=c\nC[N-1]=c\nfor i in range(Q):\n if S[...
['Runtime Error', 'Accepted']
['s657315538', 's097470167']
[20784.0, 19496.0]
[315.0, 352.0]
[423, 483]
p03087
u856169020
2,000
1,048,576
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...
["N, Q = map(int, input().split())\nS = list(str(input()))\n\nans_list = []\nfa = 0\nans = 0\nfor index, s in enumerate(S):\n if s == 'A' and fa == 0:\n fa = 1\n ans_list.append(ans)\n elif s == 'A' and fa == 1:\n ans_list.append(ans)\n elif s == 'C' and fa == 1:\n fa = 0\n a...
['Wrong Answer', 'Accepted']
['s490360138', 's932876684']
[8316.0, 6800.0]
[866.0, 844.0]
[507, 491]
p03087
u857070771
2,000
1,048,576
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...
["n,q=map(int,input().split())\ns=input()\nlr=[list(map(int,input().split())) for _ in range(q)]\nL=[0,0]\nc=0\nfor i in range(1,n+1):\n\tif s[i-1]=='A' and s[i]=='C':\n\t\tc += 1\n\tL.append(c)\nprint(L)\nfor l,r in lr:\n\tprint(L[r]-L[l])", "n,q=map(int,input().split())\ns=input()\nlr=[list(map(int,input().split())) ...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s156514319', 's308811497', 's427180874', 's881935753', 's954565960']
[31872.0, 31964.0, 31964.0, 30228.0, 30704.0]
[451.0, 449.0, 457.0, 353.0, 452.0]
[222, 222, 220, 209, 213]
p03087
u860002137
2,000
1,048,576
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...
['n, q = map(int, input().split())\ns = input()\n\nans = []\n\nfor i in range(q):\n l, r = map(int, input().split())\n S = s[l - 1:r]\n print(S)\n ans.append(S.count("AC"))\n\nprint(*ans, sep="\\n")', 'import numpy as np\nn, q = map(int, input().split())\ns = input()\nans = np.zeros(n, dtype=int)\n\nfor i i...
['Runtime Error', 'Accepted']
['s196425445', 's187194031']
[134580.0, 20020.0]
[772.0, 903.0]
[196, 324]
p03087
u861466636
2,000
1,048,576
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...
['import re\nimport sys\ns = sys.stdin.readlines()\nN, Q = map(int, s[0].split())\nS = s[1]\nfor i in s[2:]:\n lr.append(tuple(map(int, i.split())))\n \nfor i in lr:\n print(len(re.findall("AC", S[i[0]-1:i[1]])))', 'N, Q = map(int, input().split())\nS = input()\n\nacl = [0]*(N+1)\n\nfor i in range(N):\n acl...
['Runtime Error', 'Accepted']
['s401700571', 's240888187']
[11380.0, 7748.0]
[31.0, 846.0]
[210, 224]
p03087
u863397945
2,000
1,048,576
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...
['#! python3\n# solve_122C.py\n\nN,Q = map(int,input().split())\nS = input()\n\nl = [0]*N \nans = 0\n\nfor i in range(N-1):\n if S[i] == "A" and S[i+1] == "C":\n l[i] = 1\nprint(l)\n\nfor i in range(Q):\n lef,rig = map(int,input().split())\n print(l[lef-1:rig-1].count(1))', '#! python3\n# solve_122C.p...
['Wrong Answer', 'Accepted']
['s641909806', 's691571458']
[11112.0, 11604.0]
[2206.0, 486.0]
[314, 323]
p03087
u863442865
2,000
1,048,576
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...
["N, Q = map(int, input().split())\nS = input()\nt = [0] * N\nfor i in range(N):\n t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)\nfor i in range(Q):\n l, r = map(int, input().split())\n print(t[r-1] - t[l-1])\n", "N, Q = map(int, input().split())\nS = input()\nt = [0] * N\nfor i in range(N):\n \tt[i + 1] = t[...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s008066150', 's381157573', 's396027971', 's026604543']
[7236.0, 7108.0, 4404.0, 6732.0]
[62.0, 62.0, 2104.0, 233.0]
[210, 208, 706, 678]
p03087
u864013199
2,000
1,048,576
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...
['from functools import lru_cache\nN,Q = map(int,input().split())\nS = list(input())\nLR = [list(map(int,input().split())) for _ in range(Q)]\nlis = []\n\n@lru_cache(maxsize=None)\nfor i in range(N-1):\n if S[i] == "A" and S[i+1] == "C":\n lis.append(i)\nfor i in range(Q):\n ans = 0\n for j in lis:\n ...
['Runtime Error', 'Accepted']
['s875475180', 's521590056']
[2940.0, 34496.0]
[17.0, 371.0]
[432, 538]
p03087
u865413330
2,000
1,048,576
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...
["n, q = map(int, input().split())\ns = input()\n\nimport re\nlis = [m.start() for m in re.finditer('AC', s)]\nprint(lis)\n\nfor i in range(q):\n l, r = map(int, input().split())\n s = [i for i in lis if (l-1 <= i) & (i < r-1)]\n print(len(s))", 'N, Q = map(int, input().split())\nS = input()\n\nnums = [0] * (N...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s003054645', 's412744904', 's445746672']
[6708.0, 5700.0, 6084.0]
[2104.0, 47.0, 865.0]
[240, 273, 279]
p03087
u866769581
2,000
1,048,576
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...
["N,Q = map(int,input().split())\nS = input()\nlr = [list(map(int,input().split())) for _ in range(Q)]\nprint(lr)\nfor q in range(Q):\n q_lis = S[lr[q][0]-1:lr[q][1]]\n try:\n #print(q_lis)\n print(q_lis.count('AC'))\n except:\n print(0)", "N,Q = map(int,input().split())\nS = input()\nlr =...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s186316014', 's212439437', 's676262905', 's172763975']
[32112.0, 30580.0, 29748.0, 9540.0]
[2105.0, 2105.0, 2105.0, 851.0]
[255, 418, 179, 235]
p03087
u867848444
2,000
1,048,576
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...
["n,q=map(int,input().split())\nS=input()\nL=[list(map(int,input().split())) for i in range(q)]\n\ns=[0]*(n+1)\nfor i in range(1,n+1):\n if S[i-1]=='A' and S[i]=='C':\n s[i]=s[i-1]+1\n else:\n s[i]=s[i-1]\n\n#print(s)\nfor l,r in L:\n ans=s[r]-s[l-1]\n print(ans)", "n,q=map(int,input().split()...
['Runtime Error', 'Runtime Error', 'Accepted']
['s446127960', 's640450325', 's886194180']
[30664.0, 31788.0, 30640.0]
[475.0, 472.0, 473.0]
[273, 271, 286]
p03087
u870178975
2,000
1,048,576
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...
['n, q = map(int, input().split())\ns=input()\nd=[0]*n\nc=0\nfor i in range(n-1):\n if s[i:i+2]=="AC":\n c+=1\n d[i+1]=c\nd[n-1]=d[n-2]\nprint(d)\nfor i in range(q):\n l,r= map(int, input().split())\n print(d[r-1]-d[l-1])', 'n, q = map(int, input().split())\ns=input()\nfor i in range(n):\n l[i],r[i] = map(int, ...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s181401090', 's323197669', 's665906383', 's170462788']
[7464.0, 3188.0, 3188.0, 6060.0]
[899.0, 18.0, 17.0, 866.0]
[214, 149, 149, 191]
p03087
u870793476
2,000
1,048,576
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...
["n, q = map(int, input().split())\ns = input()\n\nm = []\ntotal = 0\nb = False\n\nfor c in s:\n if c == 'A':\n b = True\n elif c == 'C' and b:\n total += 1\n b = False\n else:\n b = False\n m.append(total)\n\nprint(m)\n\nfor _ in range(q):\n l, r = map(int, input().split())\n...
['Wrong Answer', 'Accepted']
['s291501431', 's908069694']
[7572.0, 6152.0]
[835.0, 865.0]
[324, 314]
p03087
u872887731
2,000
1,048,576
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...
['N,Q = list(map(int,input().split()))\nS = input()\nL = []\nR = []\nfor i in range(Q):\n a = list(map(int,input().split()))\n L.append(a[0])\n R.append(a[1])\n\nS_count = []\ncount = 0\nA_flag = False\n\nfor i in range(len(S)):\n if A_flag == True:\n if S[i] == "C" :\n count += 1\n els...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s119092647', 's423735413', 's565124197', 's209689867']
[11404.0, 11152.0, 13768.0, 14240.0]
[364.0, 372.0, 372.0, 479.0]
[464, 479, 482, 471]
p03087
u876705760
2,000
1,048,576
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...
["N, Q = map(int, input().split())\nS = input()\nlr = [0] * Q\nfor i in range(Q):\n lr[i] = list(map(int, input().split()))\n\nb, t = 0, [0]*N\nfor i in range(1, N):\n if S[i-1:i+1] == 'AC':\n t[i] += 1\n else: t[i] = t[i-1]\n\nfor i in range(Q):\n print(t[lr[i][1]] - t[lr[i][0]])", "N, Q = map(int, input().spli...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s510226568', 's512796142', 's791110353', 's838126420']
[28912.0, 28268.0, 15332.0, 32200.0]
[401.0, 2105.0, 2104.0, 565.0]
[273, 238, 216, 276]
p03087
u877220920
2,000
1,048,576
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...
["N,Q = map(int, input.split())\nS = input()\nt = [0] * (N+1)\n\nfor i in range(N):\n t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)\n\nfor i in range(Q):\n l,r = map(int, input.split())\n print(t[r-1] - t[l-1])\n", "N,Q = map(int, input().split())\nS = input()\nt = [0] * (N+1)\n\nfor i in range(N):\n t[i+1...
['Runtime Error', 'Accepted']
['s548097550', 's933100868']
[2940.0, 7748.0]
[17.0, 874.0]
[210, 214]
p03087
u877470159
2,000
1,048,576
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...
["n,q=map(int,input().split())\ns=input()\nlist_ac=[0]\nnumber=0\nfor i in range(0,n):\n if s[i:i+2]=='AC':\n number=number+1\n list_ac.append(number)\n else:\n list_ac.append(number)\nprint(list_ac)\nfor i in range(0,q):\n l,r=map(int,input().split())\n print(list_ac[r-1]-list_ac[l-1])...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s138867259', 's980211533', 's405605374']
[7520.0, 7548.0, 6128.0]
[869.0, 852.0, 852.0]
[306, 441, 439]
p03087
u879266613
2,000
1,048,576
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...
['N,Q = map(int, input().split())\nS = input()\nSUM = [0] * (N + 1)\nL = [0]*Q\nR = [0]*Q\n\n\nfor i in range(N):\n if S[i] == "A" and S[i+1] == "C":\n SUM[i+1] = SUM[i] + 1\n else:\n SUM[i+1] = SUM[i]\nprint(SUM)\nfor i in range(Q):\n L[i], R[i] = list(map(int, input().split()))\n \n print...
['Runtime Error', 'Accepted']
['s424771465', 's456158333']
[14652.0, 14024.0]
[930.0, 918.0]
[354, 346]
p03087
u879309973
2,000
1,048,576
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...
['import numpy as np\n\ndef count(s):\n prev = ""\n cnt = 0\n dp = np.zeros(len(s)+1, dtype=int)\n for i, c in enumerate(s):\n if (prev == "A") and (c == "C"):\n cnt += 1\n prev = c\n dp[i+1] = cnt\n return dp\n\ndef solve(n, q, s, l, r):\n dp = count(s)\n for i in r...
['Runtime Error', 'Accepted']
['s143479704', 's879753987']
[15856.0, 15848.0]
[979.0, 979.0]
[536, 529]