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
u142032032
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=int(input());\nQ=int(input());\ns = input();\ncharList=list(s);\nAClist=[0]*N;\n\nfor i in range(N-1):\n if charList[i]=='A' and charList[i+1]=='C':\n AClist[i+1]=AClist[i]+1;\n else:\n AClist[i+1]=AClist[i];\n\nresult=[0]*Q;\nfor i in range(Q):\n l, r = map(int, input().split())\n result...
['Runtime Error', 'Accepted']
['s776086095', 's862167491']
[3064.0, 11076.0]
[17.0, 430.0]
[399, 399]
p03087
u143509139
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#include <string>\n\nusing namespace std;\n\nint main() {\n int n, q, l, r, count;\n string s;\n cin >> n >> q;\n cin >> s;\n int L[10100];\n for(int i = 0; i < n - 1; i++) {\n if(s[i] == 'A' && s[i + 1] == 'C') {\n L[i] = 1;\n } else {\n L[i] = 0;\n }\n ...
['Runtime Error', 'Accepted']
['s707458920', 's388844950']
[2940.0, 8572.0]
[17.0, 863.0]
[561, 260]
p03087
u143612492
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\n\nfor i in range(n):\n a[i]=s[:i+1].count('AC')\n\nprint(a)\nfor i in range(q):\n print(a[l[i][1]-1]-a[l[i][0]-1])", "n,q=map(int,input().split())\ns=input()\nl=[list(map(int,input().split())) for _ in range(q)]\...
['Wrong Answer', 'Accepted']
['s527079891', 's877308441']
[30292.0, 31132.0]
[2105.0, 516.0]
[210, 223]
p03087
u144980750
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):\nt[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)\nfor i in range(Q):\nl, r = map(int, input().split())\nprint(t[r-1] - t[l-1])", "N, Q = map(int, input().split())\nS = input()\nt = [0] * (N + 1)\nfor i in range(N):\n t[i + 1] =...
['Runtime Error', 'Accepted']
['s495276740', 's662153641']
[2940.0, 9668.0]
[18.0, 858.0]
[209, 215]
p03087
u146575240
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...
["# C - GeT AC\nN, Q = map(int, input().split())\nS = str(input())\nA = [list(map(int, input().split())) for i in range(Q)]\nS1 = [0]*N\ncount = 0\nfor j in range(1,len(S)):\n if S[j] == 'C' and S[j - 1] == 'A':\n count += 1\n else:\n pass\n S1[j] = count\nprint(S1)\n\nfor k in range(Q):\n pri...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s122083645', 's535239535', 's352793264']
[31816.0, 30952.0, 30684.0]
[467.0, 2106.0, 456.0]
[334, 352, 335]
p03087
u146597538
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\nfor cnt in range(q):\n res =0\n l, r = list(map(int, input().split()))\n cs = s[l-1:r]\n print(cs)\n for tmp in range(len(cs)-1):\n if(cs[tmp] == 'A' and cs[tmp+1] =='C'):\n res += 1\n\n print(res)", "n, q = list(map(int , input()))\ns = input()\n\...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s341723297', 's403336862', 's556783185', 's708780261']
[19984.0, 3060.0, 31832.0, 30700.0]
[2104.0, 17.0, 467.0, 485.0]
[255, 129, 813, 840]
p03087
u148540382
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)]\ns_count = [0 for i in range(n + 1)]\nprint(s_count)\nfor i in range(n):\n s_count[i + 1] = s_count[i] + (1 if s[i:i + 2] == 'AC' else 0)\n\nfor i in range(q):\n print(s_count[lr[i][1] - 1] - s_count[lr[i][0]...
['Wrong Answer', 'Accepted']
['s496948002', 's734698478']
[32560.0, 32272.0]
[502.0, 491.0]
[316, 301]
p03087
u148551245
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\n\ndef inp(l: list) -> list:\n return [int(l[0]) - 1, int(l[1]) - 1]\n\nfor i in range(q):\n lr[i] = tuple(inp(input().split()))\n\ncount = [0]*n\nfor i in range(1, n):\n if s[i-1] == 'A' and s[i] == 'C':\n count[i] = count[i-1] + 1\n else...
['Wrong Answer', 'Accepted']
['s095788666', 's157175922']
[20984.0, 19724.0]
[447.0, 459.0]
[403, 400]
p03087
u159994501
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())\ns = [0 for i in range(Q)]\nt = 0\nfor i in range(Q):\n l,r = map(int,input().split())\n j = l-1\n for j in range(l-1,r-1):\n if S[j] is "A" and S[j+1] is "C":\n t += 1\n s[i] = t\n t = 0\nfor i in range(Q):\n print(s[i])', 'N,Q = m...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s328223837', 's595805667', 's604511545', 's808818352', 's593607158']
[4860.0, 4852.0, 3956.0, 4860.0, 10324.0]
[2104.0, 2104.0, 2104.0, 2104.0, 429.0]
[294, 268, 316, 421, 320]
p03087
u163449343
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 + 1)\nfor i in [0] * n:\n ac[i + 1] = ac[i] + (1 if s[i:i + 2] == "AC" else 0)\nfor i in [0] * 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] * (n + 1)\nfor i in range(n):...
['Wrong Answer', 'Accepted']
['s926361163', 's457220078']
[4836.0, 9796.0]
[826.0, 867.0]
[222, 223]
p03087
u163783894
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\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadline_s = sys.stdin.readline\nreadlines = sys.stdin.buffer.readlines\n\n\ndef main():\n N, Q = map(int, readline().split())\n S = list(readline_s().rstrip())\n ac_check = [0] * (N)\n tsum = [0] * (N + 1)\n\n for i in r...
['Runtime Error', 'Runtime Error', 'Accepted']
['s527773077', 's609358221', 's383862757']
[12720.0, 12720.0, 19608.0]
[179.0, 178.0, 210.0]
[783, 824, 904]
p03087
u166306121
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\ninput = sys.stdin.readline\ndef ii(): return int(input())\ndef mi(): return map(int, input().rstrip().split())\ndef lmi(): return list(map(int, input().rstrip().split()))\ndef li(): return list(input().rstrip())\n# template\n\n\nN, Q = mi()\n# print(N, Q)\nS = li()\nAlist = []\nfor i in range(N - 1):\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s079495071', 's129210825', 's656547841', 's660067684', 's841772338', 's973996102', 's052647206']
[6900.0, 6808.0, 6900.0, 16672.0, 16672.0, 3956.0, 11084.0]
[2104.0, 152.0, 2104.0, 2104.0, 2104.0, 19.0, 333.0]
[692, 702, 589, 887, 877, 544, 707]
p03087
u167523937
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)]\nt=[0]*(n+1)\nfor i in range(n):\n \n t[i+1]=t[i]+(1 if s[i:i+2] == "AC" else 0)\nfor i in range(q):\n l,r=lr[i][0]-1,lr[i][1]-1\n print(t[r-1]-t[l-1])', 'n,q=map(int, input().split())\nS=input()\nlr=[list(map...
['Runtime Error', 'Accepted']
['s746857594', 's083383036']
[28272.0, 32220.0]
[341.0, 492.0]
[297, 293]
p03087
u167647458
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 n, q = map(int, input().split())\n s = input()\n \n t = [0] * n\n pre = s[0]\n t_sum = 0\n for i in range(1, n):\n if pre == 'A' and s[i] == 'C':\n t[i] = t_sum + 1\n t_sum += 1\n else: \n t[i] = t_sum\n pre = s[i]\n print(*t...
['Wrong Answer', 'Accepted']
['s998254067', 's275773827']
[9468.0, 7748.0]
[886.0, 854.0]
[456, 442]
p03087
u169042722
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 bisect\nN,Q=[int(i) for i in input().split()]\nS=input()\nAC=list()\nfor i in range(len(S)-1):\n if S[i]=='A' and S[i+1]=='C':\n AC.append(i)\nprint(AC)\nfor i in range(Q):\n L,R=[int(i)-1 for i in input().split()]\n R-=1\n ll=bisect.bisect_left(AC,L)\n rr=bisect.bisect_right(AC,R)\n p...
['Wrong Answer', 'Accepted']
['s804752145', 's331723041']
[7164.0, 5772.0]
[1189.0, 1046.0]
[323, 318]
p03087
u169138653
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()\nlis=[list(map(int,input().split())) for i in range(q)]\nfor i in range(q):\n print((len(s[lis[i][0]-1:lis[i][1]])-s[lis[i][0]-1:lis[i][1]].replace('AC',''))//2)", "n,q=map(int,input().split())\ns=input()\nlis=[list(map(int,input().split())) for i in range(q)]\ng=[0]*n\ncnt=0\...
['Runtime Error', 'Accepted']
['s671531383', 's704697119']
[27604.0, 30656.0]
[338.0, 456.0]
[198, 268]
p03087
u172111219
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())\nl,r = map(int,input().split())\ncount_list = []\nfor i in range(1,N-1):\n if S[i-1] == "A" and S[i] == "C":\n count_list.append(1)\n else:\n count_list.append(0)\n \nfor j in range(Q):\n sub_count = count_list[l[j]-1:r[j]-1]\n print(sum(su...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s728101192', 's769026908', 's808728836', 's463804819']
[3992.0, 36784.0, 36780.0, 14164.0]
[41.0, 2106.0, 2106.0, 423.0]
[315, 823, 810, 397]
p03087
u177411511
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\n\nstdin = sys.stdin\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\n\nli = []\nn = int(input())\nfor i in range(5):\n li.append(int(input()))\nif n <= min(li):\n print(5)\nelse:\n if n % min(li) ...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s223984901', 's347445778', 's391341851', 's667811900', 's835077715', 's215167833']
[3064.0, 3060.0, 5788.0, 3064.0, 2940.0, 10388.0]
[17.0, 17.0, 2104.0, 17.0, 17.0, 399.0]
[384, 95, 369, 368, 370, 537]
p03087
u182004566
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 get_answer(s):\n count = 0\n for i, c in enumerate(s):\n if i == len(s) - 1:\n return count\n if c == "A" and s[i + 1] == "C":\n count += 1\n\n return count\n\nn, q = map(int, input().split())\ns = str(input())\nquestions = []\nfor _ in range(q):\n a, b = map(int, i...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s243976850', 's741965229', 's961663662', 's687600571']
[17392.0, 18784.0, 18396.0, 19996.0]
[2104.0, 2104.0, 420.0, 449.0]
[436, 437, 559, 587]
p03087
u185249212
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 __future__ import print_function\nimport sys\nimport numpy as np\n\ndef eprint(*args, **kwargs):\n print(*args, file=sys.stderr, **kwargs)\n\nN,Q = map(int,input().split()) \nS = input()\nS=S+"0"\n\ncnt=np.zeros(100000)\nnow_x=0\nfor i in range(1,N+1):\n if S[i-1]==\'A\' and S[i]==\'C\':\n cnt[i]=n...
['Runtime Error', 'Accepted']
['s766957288', 's440934543']
[15712.0, 15716.0]
[1630.0, 1848.0]
[621, 631]
p03087
u186967328
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\ncnt = 0\nn = [0]\nfor i in range(N-1):\n if s[i]+s[i+1] == 'AC':\n cnt += 1\n n.append(cnt)\n\nprint(n)\nfor i in range(Q):\n l,r = map(int,input().split())\n print(n[r-1]-n[l-1])", "N,Q = map(int,input().split())\ns = input()\n\ncnt = 0\nn = [0]\nfor ...
['Wrong Answer', 'Accepted']
['s062400992', 's818519103']
[7520.0, 6100.0]
[859.0, 856.0]
[232, 224]
p03087
u187516587
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\ndef input():\n return sys.stdin.readline()[:-1]\nN,Q=map(int, input().split())\nS=input()\nL=[None]*(N)\nt=0\nfor i in range(N-1):\n L[i]=t\n if S[i]=="A" and S[i+1]=="C":\n t+=1\nL[-1]=t\nfor i in range(Q):\n l,r=map(lambda x:int(x)-1,input().split())\n print(L[r-1]-L[l-1])', 'impor...
['Wrong Answer', 'Accepted']
['s018497644', 's985246571']
[6380.0, 6476.0]
[345.0, 327.0]
[295, 291]
p03087
u188138642
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)\n for 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)\nlr = [tu...
['Runtime Error', 'Accepted']
['s110268032', 's774312626']
[10008.0, 26476.0]
[434.0, 293.0]
[233, 239]
p03087
u188745744
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,M = list(map(int,input().split()))\nl_n = input()\nl_a = [0] * (N+1)\nfor i in range(N):\n l_a[i+1] = l_a[i] + (1 if l_n[i:i+2] == 'AC' else 0)\nprint(l_a)\nfor i in range(M):\n l,r = map(int,input().split())\n print(l_a[r-1]-l_a[l-1])", "N,M = list(map(int,input().split()))\nl_n = input()\nl_a = [0] * (N+...
['Wrong Answer', 'Accepted']
['s812862535', 's562662480']
[9152.0, 7748.0]
[864.0, 858.0]
[238, 227]
p03087
u189487046
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 print(S[i-1:i])\n t[i+1] = t[i] + 1 if S[i-1:i+1] == "AC" else t[i]\n\nlr = []\nfor i in range(Q):\n tmp_lr = list(map(int, input().split()))\n lr.append(tmp_lr)\n\nfor l,r in lr:\n print(t[r]-t[l])\n', 'N, Q = map(int, ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s069297634', 's438410862', 's140261511']
[30840.0, 32480.0, 6176.0]
[562.0, 574.0, 849.0]
[284, 284, 266]
p03087
u193927973
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()\ncount=0\nac=[0]\nfor i in range(N-1):\n if S[i]=="A" and S[i+1]=="C":\n count+=1\n ac.append(count)\nfor _ in range(Q):\n l, r=map(int, input().split())\n l-=1, r-=1\n print(ac[r]-ac[l])', 'N, Q=map(int, input().split())\nS=input()\ncount=0\nac=[0]\nfor i in range(N-...
['Runtime Error', 'Accepted']
['s326844698', 's520791170']
[8980.0, 11644.0]
[24.0, 472.0]
[226, 227]
p03087
u194894739
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\tt[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)\nfor i in range(Q):\n\tl, r = map(int, input().split())\nprint(t[r-1] - t[l-1])", 'n, q = map(int,input().split())\nS = list(input())\nL = []\nR = []\nfor i in range(q):\n l,...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s073084636', 's518567353', 's749123828', 's767719281']
[7108.0, 11860.0, 11864.0, 9156.0]
[312.0, 2108.0, 2108.0, 878.0]
[211, 275, 271, 213]
p03087
u196697332
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())\n\nfor q in range(Q):\n q_list[q] = list(map(int, input().split()))\n\nac_list = [0] * len(S)\ncount = 0\nfor i in range(1, len(S)):\n if S[i - 1] == 'A' and S[i] == 'C':\n count += 1\n ac_list[i] = count\n else:\n ac_list[i] = count\n\n...
['Runtime Error', 'Runtime Error', 'Accepted']
['s468783146', 's849739673', 's448745289']
[3188.0, 3188.0, 30680.0]
[17.0, 18.0, 492.0]
[393, 421, 412]
p03087
u197300773
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[N,Q] = list(map(int,input().split()))\nlocate= [-1]*N\n\nstr=input()\ns = list(str)\n\nk=1\nlocate=[-1]*N\n\nfor i in range (N):\n if s[i]=='A' and s[i+1]=='C':\n locate[k]=i\n k+=1\n\nlocate[k]=100000000\n\nnumL=1\nnumR=k-1\n\nfor i in range(Q):\n a = list(map(int, input().split()))\n L=a[0...
['Runtime Error', 'Runtime Error', 'Accepted']
['s179679135', 's784471919', 's161995880']
[8284.0, 6772.0, 7748.0]
[2104.0, 2104.0, 913.0]
[571, 988, 314]
p03087
u198905553
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\nprint(t[r-1] - t[l-1]) ", "N, Q = map(int, input().split())\nS = input()\nt = [0] * (N + 1)\n \nfor i in range...
['Wrong Answer', 'Accepted']
['s536810191', 's942239712']
[7108.0, 9412.0]
[309.0, 876.0]
[306, 308]
p03087
u203377003
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())\nSD = [0]*N\n\nfor n in range(N - 1):\n print(S[n])\n SD[n] = S[n]+S[n+1]\n\nprint(SD)\nfor q in range(Q):\n l, r = map(int, input().split())\n cnt = 0\n print(SD[l-1:r-1].count("AC"))\n', 'N, Q = map(int, input().split())\nS = str(input())\nSD = {}\n\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s534734301', 's636869426', 's149732305']
[13000.0, 18540.0, 16624.0]
[2108.0, 902.0, 909.0]
[239, 265, 255]
p03087
u203383537
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\na=[0]*(n+1)\nfor i in range(n):\n if s[i]=='A' and s[i+1]=='C':\n a[i+1]=a[i]+1\n else:\n a[i+1]=a[i]\n\nprint(a)\nfor i in range(Q):\n l,r=map(int,input().split())\n print(a[r-1]-a[l-1])", "n,Q=map(int,input().split())\ns=input()\n\na=[0]*(n+1)\nfo...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s665301884', 's876386183', 's251677181']
[7464.0, 6164.0, 6164.0]
[877.0, 865.0, 866.0]
[243, 240, 236]
p03087
u206570055
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 = [list(map(int, input().split())) for _ in range(Q)]\n\nACList = list()\nprevA = False\naccum = 0\nfor i in range(N):\n if prevA:\n if S[i] == 'C':\n accum += 1\n prevA = False\n elif S[i] == 'A':\n prevA = True\n ...
['Wrong Answer', 'Accepted']
['s792369693', 's237075321']
[31896.0, 30636.0]
[483.0, 494.0]
[470, 382]
p03087
u207464563
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\nlr = []\nfor i in range(Q):\n _ = list(map(int,input().split()))\n lr.append(_)\n\nAC = [0]\ncounter = 0\n\nfor j in range(1,N):\n if S[j-1] == 'A' and S[j] == 'C':\n counter += 1\n AC.append(counter)\n\nprint(AC)\n\nfor j in range(Q):\n right...
['Wrong Answer', 'Accepted']
['s294591143', 's120427947']
[32616.0, 31368.0]
[510.0, 545.0]
[364, 353]
p03087
u209918867
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()\ni=[p.span()[0] for p in re.finditer('(AC){1,1}',s)]\nprint(i)\nfor _ in range(q):\n v=0\n l,r=map(int,input().split())\n for c in i:\n v+= l-1<=c and c+1<=r-1\n print(v)", "import re\nn,q=map(int,input().split())\ns=input()\na=[0]*n\nb=[0]*n\ni=[p.span()[0]fo...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s251613950', 's654509983', 's789726694']
[6336.0, 10684.0, 12224.0]
[2104.0, 955.0, 935.0]
[218, 468, 497]
p03087
u210827208
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+1)\ncnt=0\nfor i in range(n):\n A[i]=cnt\n if s[i]=='A' and s[i+1]=='C':\n cnt+=1\nANS=[]\nfor i in range(q):\n l,r=map(int,input().split())\n ANS.append(A[r-1]-A[l-1])\nfor ans in ANS:\n print(ANS)", "n,q=map(int,input().split())\ns=input()\nV=[...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s355187453', 's372193696', 's757735918', 's529786376']
[142500.0, 21876.0, 5384.0, 10232.0]
[2104.0, 2105.0, 2104.0, 402.0]
[257, 288, 225, 261]
p03087
u211160392
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\ninput = sys.stdin.readline\nN,Q = map(int,input().split())\nS = input()\nlr = [[int(i) for i in input().split()] for i in range(Q)]\nC = [0]*(N+1)\n\nterget = "AC"\nindex = -1\nfor i in range(N):\n C[i+1] = C[i] + (S[i:i+2] == "AC")\nprint(C)\nfor l,r in lr:\n print(C[r-1] - C[l-1])', 'import sys\ni...
['Wrong Answer', 'Accepted']
['s188584537', 's064968987']
[27132.0, 26000.0]
[296.0, 295.0]
[317, 278]
p03087
u213497190
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())\ny=input()\narr=[]\nfor i in range(len(y)-1):\n if y[i:i+2]=='AC':\n arr.append(1)\n else:\n arr.append(0)\n \nfor q in range(Q):\n l,r=map(int,input().split())\n print(sum(arr[l-1:r]))", "import numpy as np\n\nN,Q=map(int,input().split())\ny=input()\narr=...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s247873030', 's741007088', 's982991533', 's727963769']
[5340.0, 23592.0, 21536.0, 22272.0]
[2104.0, 1518.0, 1201.0, 1594.0]
[236, 287, 292, 289]
p03087
u217627525
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 operator import itemgetter \nn,q=map(int,input().split())\ns=input()\nac=[0]\nbuf=0\ndata=[]\nfor i in range(1,n):\n if s[i-1:i+1]=="AC":\n buf+=1\n ac.append(buf)\nprint(ac)\nfor i in range(q):\n l,r=map(int,input().split())\n data.append([l,r,i])\nprint(data)\ndata.sort()\nbuf=0\ni=0\nwhile ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s746043311', 's812190527', 's067738986']
[47732.0, 7600.0, 6180.0]
[1210.0, 861.0, 852.0]
[723, 232, 222]
p03087
u219086885
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\n\nn,q = [int(x) for x in input().split()]\ns = input()\nquestions = [list(map(lambda x: int(x),input().split())) for x in range(q)]\n\nprint([s[q[0]-1:q[1]].count('AC') for q in questions])\n", "import re\n\nn,q = [int(x) for x in input().split()]\ns = input()\nquestions = [list(map(lambda x: int(x),input(...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s043678765', 's896737821', 's979283533']
[29472.0, 30964.0, 30312.0]
[2105.0, 2105.0, 608.0]
[195, 205, 463]
p03087
u220345792
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())\ndata = input()\nresult = [0] * N\nfor i in range(N-1):\n if data[i] == "A" and data[i+1]:\n result[i+1] = result[i] + 1\n else:\n result[i+1] = result[i\n\nfor i in range(Q):\n l, r = map(int, input().split())\n print(result[r-1]-result[l-1])\n', 'N, Q = map(int, input().sp...
['Runtime Error', 'Runtime Error', 'Accepted']
['s453088585', 's840011924', 's550939056']
[2940.0, 3188.0, 6060.0]
[17.0, 88.0, 860.0]
[276, 329, 285]
p03087
u221345507
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\natgc_list= []\n\nflag = 0\nmemo =0\n\nfor i in range (len(S)):\n if S[i]=='A':\n flag = 1\n if flag == 1 and S[i] == 'C':\n memo+=1\n if S[i] in ['T','G']:\n flag = 0\n atgc_list.append(memo)\n \natgc_list_np = np.array(atgc_list)...
['Runtime Error', 'Runtime Error', 'Accepted']
['s052319586', 's327197317', 's007530321']
[5632.0, 5632.0, 6132.0]
[66.0, 49.0, 864.0]
[431, 440, 422]
p03087
u224554402
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()\ns_ps=[0]*n\n\na =s[0]\n\nfor i in range(n):\n b = a\n a = s[i]\n if b+a=='AC':\n s_ps[i]=1\n \n#print(s_ps)\n\n\nfor _ in range(q):\n r,l=list(map(int, input().split()))\n #print(s_ps[r-1:l])\n print(sum(s_ps[r-1:l]))", "\nn,q = list(...
['Wrong Answer', 'Accepted']
['s759317644', 's570622944']
[11060.0, 29532.0]
[2206.0, 308.0]
[283, 325]
p03087
u226912938
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())\nW = [0] * (N+1)\nL = []\nR = []\nfor q in range(Q):\n l, r = map(int, input().split())\n L.append(l)\n R.append(r)\n\nfor n in range(N-1):\n W[n+1] = W[n] + (1 if S[n:n+2] == 'AC' else 0) \n\nfor q in range(Q):\n print(W[L[q]-1]-W[R[q]-1])", "N, Q ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s703992564', 's871206884', 's487381411']
[15844.0, 12644.0, 15808.0]
[444.0, 427.0, 442.0]
[295, 295, 295]
p03087
u228232845
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_counts = [0 for _ in range(n + 1)]\n\nfor i in range(n):\n ac_counts[i + 1] = ac_counts[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(l,r)\n print(ac_counts[r - 1] - ac_counts[l - 1])", "n, q = ma...
['Wrong Answer', 'Accepted']
['s322515920', 's344971877']
[8796.0, 9564.0]
[987.0, 891.0]
[294, 279]
p03087
u239204773
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 countAC(s):\n index = []\n for i in range(len(s)):\n if i == len(s)-1:\n break\n if s[i] == 'A':\n if s[i+1] == 'C':\n index.append(1)\n continue\n index.append(0)\n return index\n\nN,Q = (int(_) for _ in input().split())\nS = input...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s077631574', 's555701567', 's991108382']
[6300.0, 87424.0, 6100.0]
[2104.0, 2104.0, 1122.0]
[493, 514, 447]
p03087
u239316561
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...
['l = []\nr = []\nn,q = input().split()\nN = int(n)\nQ = int(q)\nS = input()\nfor i in range(Q):\n L,R = input().split()\n l.append(int(L)-1)\n r.append(int(R)-1)\nflag = [0 for i in S]\nfor i in range(len(S)-1):\n if((S[i] == "A")&(S[i+1] == "C")):\n flag[i] = 1\nprint(S)\nprint(flag)\nfor j in rang...
['Wrong Answer', 'Accepted']
['s304778899', 's536782275']
[12928.0, 14244.0]
[2104.0, 490.0]
[492, 393]
p03087
u243572357
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()\nlst = [s[i:i+2] for i in range(n-1)]\nfor i in range(q):\n l, r = map(int, input().split())\n m = lst[l-1:r-2].count('AC')\n print(m)", "n, q = map(int, input().split())\ns = input()\ncount = 0\nfor i in range(q):\n l, r = map(int, input().split())\n count += s[l-1:...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s366864042', 's720809527', 's933757856', 's865144679']
[10896.0, 3188.0, 4212.0, 6140.0]
[2104.0, 2104.0, 838.0, 879.0]
[177, 153, 227, 226]
p03087
u246820565
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(str, [input() for i in range(q)]))\n\nac = [0]*n\n\n\nfor i in range(1,n):\n\tif s[i] =='C':\n\t\tif s[i-1] == 'A':\n\t\t\tac[i] = ac[i-1] + 1\n\telse:\n\t\tac[i] = ac[i-1]\nprint(ac)\n\nfor i in range(q):\n\tl,r = map(int, lr[i].split())\n\tanswer = ac[r-1]...
['Wrong Answer', 'Accepted']
['s470059191', 's454562364']
[15144.0, 13432.0]
[386.0, 399.0]
[316, 354]
p03087
u247830763
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())\nls = [list(map(int,input().split())) for _ in range(q)]\na = [0]\nfor i in range(1,n):\n if s[i-1] == "A":\n if s[i] == "C":\n a.append(a[-1]+1)\n else:\n a.append(a[-1])\nprint(a)\nfor j in range(q):\n (u,t) = (ls[j][0],ls[j][1])\n ...
['Runtime Error', 'Accepted']
['s854260376', 's751671444']
[31868.0, 6100.0]
[510.0, 870.0]
[327, 253]
p03087
u253681061
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()\n\nt = [0]*(n+1)\nfor i in range(n):\n t[i+1] = t[i] + (1 if s[i:i+2] == "AC" else 0)\n\nprint(t)\nfor _ in range(q):\n l,r = [int(x) for x in input().split()]\n print(t[r-1]-t[l-1])\n\n', 'n,q = [int(x) for x in input().split()]\ns = input()\nlr = []\nfor...
['Wrong Answer', 'Accepted']
['s161940221', 's054031655']
[9152.0, 24472.0]
[898.0, 450.0]
[236, 302]
p03087
u255067135
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())\n\ncount = [0]*(N)\nfor i in range(1, N):\n if S[i]=='C' and S[i-1]=='A':\n count[i] = count[i-1] + 1\n else:\n count[i] = count[i-1]\nprint(count)\nLR = [list(map(int, input().split())) for _ in range(Q)]\nfor l, r in LR:\n print(count[r-1]-co...
['Wrong Answer', 'Accepted']
['s501450188', 's097825973']
[31368.0, 30664.0]
[458.0, 460.0]
[347, 334]
p03087
u256031597
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\n\nN, Q = map(int, input().split())\n\nS = input()\n\nfor i in range(Q):\n cnt = 0\n l, r = map(int, input().split())\n T = S[l-1:r]\n for t in list(T):\n if t=="A":\n flag = True\n elif t=="T" and flag:\n cnt += 1\n flag = False\n else:\n ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s310282981', 's314212224', 's340176808', 's574228959', 's791997607', 's043502353']
[4760.0, 3064.0, 7108.0, 13180.0, 13260.0, 6060.0]
[2104.0, 17.0, 61.0, 2104.0, 2104.0, 889.0]
[336, 336, 179, 325, 337, 246]
p03087
u259418313
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()\nnlis = [0]\ncnt = 0\nfor i in range(len(s)-1):\n if(s[i:i+2] == "AC"): \n cnt += 1\n nlis.append(cnt)\nprint(nlis)\nfor i in range(Q):\n in0, in1 = map(int, input().split())\n print(nlis[in1-1]-nlis[in0-1])', 'N, Q = map(int, input().split())\ns = inpu...
['Wrong Answer', 'Accepted']
['s469348228', 's527988519']
[7520.0, 6100.0]
[858.0, 839.0]
[261, 262]
p03087
u261646994
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\n\nN, Q = [int(item) for item in re.split(r"\\s", input())]\nS = input()\n\nl = [0] * Q\nr = [0] * Q\nfor i in range(Q):\n l_i, r_i = [int(item) for item in re.split(r"\\s", input())]\n l.append(l_i)\n r.append(r_i)\n\n\np_list = [0] * (N - 1)\ni = 0\nwhile i < N - 1:\n if S[i:i + 2] == "AC":\n ...
['Wrong Answer', 'Accepted']
['s535593623', 's672818852']
[20636.0, 29688.0]
[652.0, 1183.0]
[549, 683]
p03087
u261891508
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()\nhantei=[0]\nfor i in range(1,len(s)):\n if s[i-1]=="A" and s[i]=="C":\n hantei.append(hantei[i-1]+1)\n else:\n hantei.append(hantei[i-1])\n\n\n\nfor i in range(q):\n l,r=map(int,input().split())\n if l==1:\n l+=1\n if hantei[l-1]!=hantei[l-2]:\n print(hantei[r...
['Wrong Answer', 'Accepted']
['s816672215', 's091748795']
[6208.0, 6076.0]
[905.0, 881.0]
[410, 312]
p03087
u262084284
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\nn, q = map(int, input().split())\ns = input()\n\n[0]*(n+1)\nfor i in range(n):\n if s[i:i+2] == 'AC':\n i[i+1] = i[i] + 1\n else:\n i[i+1] = i[i]\n\nfor i in range(q):\n l,r = (map(int, input().split()))\n ans = t[r-1] - t[l-1]\n print(ans)\n", "# coding: utf-8\n\nn, q ...
['Runtime Error', 'Accepted']
['s463248817', 's299199312']
[3956.0, 6060.0]
[18.0, 868.0]
[274, 278]
p03087
u262204831
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()\nlr = [list(map(int,input().split())) for i in range(Q)]\n\ncount = 0\ncountList = [0 for i in range(N)]\nfor i in range(1, N):\n if S[i - 1] == 'A' and S[i] == 'C':\n count += 1\n countList[i] = count\n\nprint(countList)\n\nfor i in range(Q):\n l = lr...
['Wrong Answer', 'Accepted']
['s578761829', 's773563261']
[30892.0, 29728.0]
[322.0, 324.0]
[414, 396]
p03087
u262597910
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(1,n):\n a[i] = a[i-1]\n if (s[i]=="C"):\n if (s[i-1]=="A"):\n a[i] += 1\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 = inp...
['Wrong Answer', 'Accepted']
['s807092865', 's550118382']
[7464.0, 6060.0]
[850.0, 879.0]
[262, 254]
p03087
u262869085
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\nimput =sys.stdin.readline\nN, Q =map(int,input().split())\nS =[i for i in input()]\nq = [[int(i) for i in input().split()] for _ in range(Q)]\nnum = 0\nfor i in range(N-1):\n if S[i]+S[i+1]=="AC":\n num += 1\n S[i] = num\nS[-1] = num\nS.append(0)\nprint(q)\nprint(S)\nfor lr in q:\n print(S[l...
['Wrong Answer', 'Accepted']
['s026598696', 's175521087']
[28264.0, 24348.0]
[499.0, 470.0]
[323, 305]
p03087
u263188345
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\nN, Q = map(int, input().split())\nS = input()\n\n\nindex = [0] * N\ni = 0\nwhile i < len(S)-1:\n if S[i]=='A' and S[i+1]=='C':\n index[i] = 1\n i += 2\n else:\n i += 1\nnum = [sum(index[i]) for i in range(N)]\n\n#print('\\n')\n#print(index)\n\nfor i in range(Q):\n l, r...
['Runtime Error', 'Accepted']
['s211595911', 's135453529']
[3956.0, 6188.0]
[52.0, 879.0]
[435, 330]
p03087
u266569040
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...
['S = input()\nACGT = ["A","C","G","T"]\nindex = []\nfor i in range(len(S)):\n if S[i] not in ACGT:\n index.append(i)\n\n\nif index:\n diff = [index[0]]\n for j in range(len(index)-1):\n diff.append(index[j+1] - index[j] - 1)\n print(max(diff))\n \nelse:しない\n print(len(S))\n\n', 'import ...
['Wrong Answer', 'Accepted']
['s247617473', 's969303201']
[3060.0, 6184.0]
[17.0, 850.0]
[364, 264]
p03087
u271469978
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\nlines = sys.stdin.readlines()\nfor line in lines[2:]:\n l, r = map(int, line.split())\n match = re.findall("(AC)", lines[1][l-1:r])\n print(len(match))', '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)\n\...
['Runtime Error', 'Accepted']
['s483928459', 's767336127']
[3188.0, 9540.0]
[19.0, 856.0]
[166, 220]
p03087
u274635633
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,0]\ng=[0]\nx=0\nfor i in range(n-1):\n if s[i:i+2]=='AC':\n x+=1\n f.append(x)\n g.append(x)\ng.append(x)\nfor i in range(q):\n l,r=map(int,input().split())\n print(f[r]-g[l-1])\nprint(f,g)", "n,q=map(int,input().split())\ns=input()\nf=[0,0]\ng=[0]\nx=0\nfor i in ...
['Wrong Answer', 'Accepted']
['s713002738', 's337882681']
[10120.0, 6968.0]
[891.0, 859.0]
[229, 219]
p03087
u276204978
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 solve():\n N, Q = map(int, input().split())\n S = input()\n \n t = [0] * (N+1)\n for i in range(N):\n t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)\n \n print(t)\n for _ in range(Q):\n l, r = map(int, input().split())\n print(t[r-1]-t[l-1])\n \nsolve()", "def...
['Wrong Answer', 'Accepted']
['s900845420', 's940594852']
[9152.0, 7748.0]
[845.0, 837.0]
[298, 285]
p03087
u277104886
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\nL = [0]*len(s)\nfor i in range(1,len(s)):\n L[i] = L[i-1]\n if s[i-1] == "A" and s[i] == "C":\n L[i] += 1\n\nprint(L)\n\nfor _ in range(q):\n l, r = map(int, input().split())\n print(L[r-1]-L[l-1])\n ', 'n, q = map(int, input().split())\ns = input...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s360709967', 's440211457', 's176296238']
[12704.0, 11460.0, 11620.0]
[463.0, 472.0, 471.0]
[257, 248, 248]
p03087
u277312083
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 t[i] = t[i - 1] + (1 if s[i - 1:i + 1] == "AC" else 0)\nfor i in range(q):\n l, r = map(int, input().split())\n print(t[r - 1] - t[l - 2])', 'n, q = map(int, input().split())\ns = input()\nt = [0] * n\nfor i in range(1, n):\n...
['Wrong Answer', 'Accepted']
['s859407976', 's543993705']
[7748.0, 7748.0]
[848.0, 880.0]
[224, 224]
p03087
u277665747
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(0, N):\n if S[i:i+2] == 'AC':\n t[i+1] = t[i] + 1\n else:\n t[i+1] = t[i]\ninputList = []\nfor i in range(1, Q+1):\n inputList.append(input())\nprint(t)\nfor i in range(Q):\n x, y = map(int, inputList[i].split())\...
['Wrong Answer', 'Accepted']
['s320331473', 's650137429']
[14664.0, 13428.0]
[395.0, 389.0]
[346, 338]
p03087
u278356323
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\n\ni = input().split()[1]\ns = input()\nk = 0\nresult = []\n\nwhile k < i:\n ft, et = [int(n) for n in input().split()]\n result.append(len(re.findall("AC", s[ft - 1:et])))\n k += 1\n\nfor kekka in result:\n print(kekka)', 'import sys\ninput = sys.stdin.readline\nn, q = map(int, input().split())...
['Runtime Error', 'Accepted']
['s822539458', 's291275773']
[3316.0, 6340.0]
[22.0, 295.0]
[229, 302]
p03087
u279266699
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\nfrom bisect import bisect_left, bisect_right\n\n\nstdin = sys.stdin\ndef ns(): return stdin.readline().rstrip()\ndef ni(): return int(stdin.readline().rstrip())\ndef nm(): return map(int, stdin.readline().split())\ndef nl(): return list(map(int, stdin.readline().split()))\n\n\ndef main():\n n, q = nm()...
['Wrong Answer', 'Accepted']
['s183014537', 's432126327']
[18688.0, 18636.0]
[227.0, 234.0]
[669, 668]
p03087
u284363684
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\na = [0] * N\nc = [False] * N\nfor i in range(1, N):\n if S[i - 1:i + 1] == "AC":\n a[i] = a[i - 1] + 1\n a[i] = True\n else:\n a[i] = a[i - 1]\n\nfor i in range(Q):\n l, r = map(int, input().split())\n if l - 1 == 0:\n print(a[r ...
['Wrong Answer', 'Accepted']
['s182213555', 's397077579']
[5236.0, 6908.0]
[880.0, 898.0]
[419, 415]
p03087
u285443936
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 bisect\n\nN, Q = map(int, input().split())\nS = input()\nidx = []\n\nfor i in range(N-1):\n if S[i] == "A" and S[i+1] == "C":\n idx.append(i+1)\n\nprint(idx)\nfor i in range(Q):\n l, r = map(int, input().split())\n lid = bisect.bisect_left(idx, l)\n rid = bisect.bisect_right(idx, r-1)\n print(rid-lid)\...
['Wrong Answer', 'Accepted']
['s141429522', 's636647602']
[6244.0, 5724.0]
[1032.0, 1028.0]
[305, 294]
p03087
u292810930
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()\nLRlist = []\nfor i in range(Q):\n LRlist.append(list(map(int,input().split())))\nindexlist = []\nfor i in range(len(S)-1):\n if S[i] == 'A':\n if S[i+1] == 'C':\n indexlist.append(i)\nfor LR in LRlist:\n L = LR[0]\n R = LR[1]\n answer = 0\...
['Wrong Answer', 'Accepted']
['s237324023', 's724593715']
[30360.0, 32196.0]
[2105.0, 486.0]
[444, 338]
p03087
u294385082
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\nn,q = map(int,input().split())\ns = input() + 'A' \nli = [0]*(n+1)\n\nfor i in range(n):\n li[i+1] = li[i] + (1 if s[i] + s[i+1] == 'AC' else 0)\n \nprint(li)\nfor j in range(q):\n l,r = map(int,input().split())\n print(li[r-1] - li[l-1])", "\n\nn,q = map(int,input().split())\ns = input() + 'A' \nli = [0]*(n+...
['Wrong Answer', 'Accepted']
['s938567264', 's048432908']
[9152.0, 7748.0]
[873.0, 868.0]
[250, 241]
p03087
u298297089
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 = [1 if S[i] == 'A' and S[i+1] == 'C' else 0 for i in range(N-1)]\nprint(S)\nfor i in range(Q):\n l, r = map(int, input().split())\n print(sum(S[l-1:r-1]))\n\n", "N, Q = map(int, input().split())\nS = input()\nS = [1 if i > 0 and S[i-1] == 'A' and S[i] == 'C' else 0 ...
['Wrong Answer', 'Accepted']
['s353657188', 's296477777']
[5644.0, 8460.0]
[2104.0, 875.0]
[202, 296]
p03087
u299840026
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(i) for i in input().split()]\ns = input()\nl =[]\nr =[]\nfor i in range(q):\n l1, r1 = [int(i) for i in input().split()]\n l.append(l1)\n r.append(r1)\n\nSum = [0]\nfor i in range(len(s)):\n if s[i-1]=="A" and s[i]=="C":\n Sum.append(Sum[i]+1)\n else:\n Sum.append(Sum[i])\n\np...
['Wrong Answer', 'Accepted']
['s729805312', 's386877444']
[15420.0, 14228.0]
[444.0, 444.0]
[362, 363]
p03087
u300968187
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 pip._vendor.pep517.check import ansi\nn, q = map(int, input().split())\ns = input()\nans = []\nfor i in range(0, q):\n l, r = map(int, input().split())\n ans.append(s[l-1: r].replace('AC', ' ').count(' '))\nfor i in ans:\n print(i)", 'n, q = map(int, input().split())\ns = input()\nq_list = [list(map(int...
['Runtime Error', 'Accepted']
['s349294329', 's200856287']
[3060.0, 30704.0]
[17.0, 485.0]
[237, 318]
p03087
u301302814
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()\nl = [0] * N\nfor i in range(N - 1):\n if S[i] == 'A' and S[i + 1] == 'C':\n l[i + 1] = 1\nfor _ in range(Q):\n ans = 0\n a, b = map(int, input().split())\n ans = sum(l[a - 1: b])\n if l[a - 1] == 1:\n ans -= 1\n print(ans,...
['Wrong Answer', 'Accepted']
['s167265491', 's542111700']
[103224.0, 6060.0]
[2104.0, 858.0]
[308, 268]
p03087
u309141201
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())\n print(t[r-1] - r[l-1])", "n, q = map(int, input().split())\ns = input()\nt = [0]*(n + 1)\nfor i in range(n):\n t[i+1]...
['Runtime Error', 'Accepted']
['s647655993', 's031861974']
[7108.0, 7748.0]
[64.0, 878.0]
[213, 213]
p03087
u310233294
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)\nnl = set(range(nl))\nfor i in nl:\n t[i + 1] = t[i] + (1 if s[i:i + 2] == 'AC' else 0)\nql = set(range(q))\nfor i in ql:\n l1, l2 = map(int, input().split())\n ans = t[l2-1] - t[l1-1]\n print(ans)", "N, Q = map(int, input().split())\nS = in...
['Runtime Error', 'Accepted']
['s384648073', 's944974860']
[3956.0, 30664.0]
[18.0, 481.0]
[264, 262]
p03087
u311379832
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...
['8 3\nACACTACG\n3 7\n2 3\n1 8', "N, Q = map(int, input().split())\nS = input()\nmLst = [0] * N\nfor i in range(N - 1):\n if S[i: i + 2] == 'AC':\n mLst[i + 1] = mLst[i] + 1\n else:\n mLst[i + 1] = mLst[i]\n\nlLst = [list(map(int, input().split())) for i in range(Q)]\n\nfor i in range(Q):\n print...
['Runtime Error', 'Accepted']
['s780331579', 's195943821']
[2940.0, 30668.0]
[16.0, 500.0]
[24, 319]
p03087
u314050667
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()\nQ = [list(map(int ,input().split())) for _ in range(q)]\n\ncnt = [0] * (N+1)\ntmp = S[0]\nfor i in range(2,N+1):\n\tif tmp == "A" and S[i-1] == "C":\n\t\tcnt[i] = cnt[i-1] + 1\n\telse:\n\t\tcnt[i] = cnt[i-1]\n\n\ttmp = S[i-1]\n\nfor l,r in Q:\n\tans = cnt[r] - cnt[l-1]\n...
['Wrong Answer', 'Accepted']
['s768675067', 's738152022']
[32804.0, 30632.0]
[494.0, 489.0]
[367, 356]
p03087
u314906167
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 = "0" + input()\nLR = []\nfor _ in range(Q):\n l, r = map(int, input().split())\n LR.append((l, r))\n\nnum = [0] * (N + 1)\nfor i in range(2, N + 1):\n if S[i - 1] == "A" and S[i] == "C":\n num[i] = num[i - 1] + 1\n else:\n num[i] = num[i - 1]\n\nprint(num...
['Wrong Answer', 'Accepted']
['s783595751', 's086796479']
[21156.0, 19888.0]
[449.0, 426.0]
[349, 338]
p03087
u316233444
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 itertools import accumulate\n\nN, Q = map(int, input().split())\nS = input()\nA = [list(map(int, input().split())) for i in range(Q)]\n\n#print(A)\n\nflg = []\nfor i in range(N-1):\n tmp_S = S[i:i+2]\n if tmp_S == 'AC':\n flg.append(1)\n else:\n flg.append(0)\n\n\nans = []\nans = [0] + flg...
['Runtime Error', 'Accepted']
['s004364504', 's446272067']
[33172.0, 33172.0]
[374.0, 489.0]
[509, 509]
p03087
u316386814
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\nsys.setrecursionlimit(10**7)\nINF = 10 ** 18\nMOD = 10 ** 9 + 7\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 LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().s...
['Runtime Error', 'Accepted']
['s587043719', 's192838117']
[3188.0, 26952.0]
[18.0, 283.0]
[1270, 736]
p03087
u319818856
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 get_ac(N: int, Q: int, S: str, queries: list)->list:\n before = \'\'\n cum = [0] * (N+1)\n for i, c in enumerate(S):\n cum[i+1] = cum[i]\n if before + c == \'AC\':\n cum[i+1] += 1\n before = c\n\n print(cum)\n\n res = []\n for l, r in queries:\n res.append(...
['Wrong Answer', 'Accepted']
['s651771156', 's355380755']
[23464.0, 22876.0]
[508.0, 473.0]
[574, 572]
p03087
u323011274
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 python3\n\n\ndef main():\n n, q = map(int, input().split())\n s = input()\n x = [0] * n\n if s[0:2] == 'AC':\n x[0] = 1\n for i in range(n - 1):\n if s[i+1:i+3] == 'AC':\n x[i+1] = x[i] + 1\n else:\n x[i+1] = x[i]\n\n print(x)\n result = [...
['Wrong Answer', 'Accepted']
['s989433911', 's364460544']
[11472.0, 7676.0]
[439.0, 856.0]
[579, 503]
p03087
u324314500
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\n\ns2nn = lambda s: [int(c) for c in s.split(' ')]\n\nss2nn = lambda ss: [int(s) for s in list(ss)]\nss2nnn = lambda ss: [s2nn(s) for s in list(ss)]\n\ni2s = lambda: sys.stdin.readline().rstrip()\ni2n = lambda: int(i2s())\ni2nn = lambda: s2nn(i2s())\n\nii2ss = lambda n: [sys.stdin.readline() for _ in range...
['Runtime Error', 'Accepted']
['s527407777', 's487388832']
[29188.0, 29188.0]
[279.0, 275.0]
[653, 820]
p03087
u326609687
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\n\nN, Q = map(int, input().split())\nS = sys.stdin.readline()\nP = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]\n\na = [0] * N\na[0] = int(S[0] == 'A' and S[1] == 'C')\nfor i in range(1, N):\n a[i] = a[i - 1] + int(S[i] == 'A' and S[i + 1] == 'C')\n\nfor q in P:\n print(a[q[1] - 2...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s766559778', 's826653926', 's918555614']
[32196.0, 32204.0, 32276.0]
[336.0, 338.0, 335.0]
[322, 318, 283]
p03087
u329036729
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...
['s = input()\n\nma = 0\nfor i in range(0,len(s)):\n for j in range(i,len(s)):\n sbstr = s[i:j+1]\n # print(i,j,sbstr)\n is_good = True\n for c in sbstr:\n if c not in "AGCT":\n is_good = False\n break\n if is_good:\n if (len(sbst...
['Wrong Answer', 'Accepted']
['s992453125', 's122864289']
[3060.0, 6104.0]
[17.0, 859.0]
[359, 332]
p03087
u337626942
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 if s[i:i+2]=="AC":\n c=1\n else:\n c=0\n\n t[i+1]=t[i]+c\n\nfor i in range(q):\n l, r=map(int, input().split())\n print(t[r]-t[l])', 'n ,q=map(int, input().split())\ns=input()\nt=[0]*(n+1)\n\nfor i in range(n):...
['Wrong Answer', 'Accepted']
['s489946854', 's436908917']
[9412.0, 7748.0]
[890.0, 888.0]
[224, 228]
p03087
u338824669
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\nplc=[0]*N\n\nfor i in range(len(S)-1):\n if S[i] == 'A' and S[i+1] == 'C':\n plc[i+1] = 1\n else:\n plc[i+1] = 0\n\nfor i in range(len(S)-1):\n plc[i+1]=plc[i]+plc[i+1]\n \nfor i in range(Q):\n l,r=list(map(int,input().split()))\n \nprint(plc[r-1]-plc[l-1])", "N,...
['Wrong Answer', 'Accepted']
['s168376553', 's744812994']
[9028.0, 7748.0]
[364.0, 854.0]
[295, 188]
p03087
u339550873
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 python3\n# -*- coding: utf-8 -*-\n\nN,Q = [int(x) for x in input().split()]\nS = list(input())\nlrlist =[]\nfor _ in range(Q):\n l,r = [int(x) for x in input().split()]\n lrlist.append((l,r))\n\nsumls =[0]*(N+1)\nfor i in range (N-1):\n if S[i] == 'A' and S[i+1] == 'C':\n sumls[i+1] = ...
['Runtime Error', 'Accepted']
['s403722693', 's485517633']
[19716.0, 20488.0]
[352.0, 479.0]
[477, 472]
p03087
u343523393
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=[0]\n\nfor i in range(len(S)):\n s.append(s[-1]+(1 if(S[i:i+2]=="AC") else 0))\n\nfor i in range(Q):\n r,l=list(map(int,input().split()))\n print(s[r-1]-s[l-1])', 'N,Q=map(int,input().split())\nS=input()\n\ns=[0]\n\nfor i in range(len(S)):\n s.append(s[-1]+(1 i...
['Wrong Answer', 'Accepted']
['s131276218', 's027163323']
[7828.0, 7700.0]
[899.0, 934.0]
[204, 205]
p03087
u343977188
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())\nAC_list=[0]*N\nt=0\nfor i in range(1,N):\n if S[i]=='C' and S[i-1]=='A':\n t+=1\n AC_list[i]=t\nprint(AC_list)\nfor i in range(Q):\n l,r=map(int,input().split())\n print(AC_list[r-1]-AC_list[l-1])", "N,Q=map(int,input().split())\nS=str(input())\nAC_list=[0]*N\nt=0\...
['Wrong Answer', 'Accepted']
['s538893343', 's811372616']
[7488.0, 6084.0]
[866.0, 847.0]
[238, 229]
p03087
u346395915
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\nli = [0]*(n)\nans = 0\n\nfor i in range(n-1):\n if s[i:i+2] == "AC":\n ans += 1\n li[i] = ans\n\nfor i in range(q):\n x,y = map(int,input().split())\n print(li[y-2] - li[x-2])\n \nprint(li)', 'n,q = map(int,input().split())\ns = input()\n\nli = [0]*...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s319785277', 's873345596', 's309589589']
[8128.0, 8104.0, 6188.0]
[910.0, 856.0, 876.0]
[243, 245, 231]
p03087
u347640436
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 sys import stdin\ndef main():\n readline = stdin.readline\n n, q = map(int, readline().split())\n s = input()\n c = [0] * (n + 1)\n pch = ''\n pc = 0\n for i in range(2, n + 1):\n cch = s[i - 1]\n if cch == 'C' and pch == 'A':\n t = pc + 1\n else:\n t = pc\n c[i] = t\n pc = t\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s111010933', 's934909064', 's166490420']
[6380.0, 8424.0, 9588.0]
[273.0, 291.0, 968.0]
[470, 483, 331]
p03087
u347912669
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...
["# C - GeT AC\n\nimport sys\nn, q = list(map(int, sys.stdin.readline().split()))\n\ns = input()\n\nseparators = [list(map(int, sys.stdin.readline().split())) for _ in range(q)]\n\n# n = 8\n\n\n# separators = [[3, 7],[2, 3],[1, 8]]\n\ncnt = []\n\nfor index in range(0, len(separators)):\n cnt.append(s[separators[inde...
['Wrong Answer', 'Accepted']
['s235173902', 's419553805']
[29880.0, 31388.0]
[2105.0, 326.0]
[443, 940]
p03087
u348868667
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())\nnum = list(range(N))\ndic1 = dict(zip(num,S))\nq = [list(map(lambda x: int(x)-1,input().split())) for _ in range(Q)]\ndic2 = {}\nfor i in range(N-1):\n if dic1[i]+dic1[i+1] == "AC":\n dic2[i] = i\nprint(dic1)\nprint(dic2)\nprint(q)\nfor i in range(Q):\n ...
['Wrong Answer', 'Accepted']
['s786240523', 's866447591']
[54408.0, 7748.0]
[2106.0, 857.0]
[435, 210]
p03087
u349091349
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=[0]*Q\nr=[0]*Q\nfor i in range(0,Q):\n l[i],r[i]=map(int,input().split())\n print(S[l-1:r].count('AC'))\n ", "N,Q=map(int,input().split())\nS=input()\ncount = [1 for i in range(0,N) if S[i:i+1] =='AC' else 0]\nfor i in range(0,Q):\n l,r=map(int,input().split())\n print(...
['Runtime Error', 'Runtime Error', 'Accepted']
['s550815997', 's891496250', 's078573644']
[4724.0, 2940.0, 9540.0]
[20.0, 17.0, 873.0]
[145, 178, 199]