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 | u541921833 | 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... | ["a, loop = input().split()\nstring = input()\n\nfor i in range(int(loop)):\n j, k = input().split()\n print(string[int(j)-1:int(k)-1].count('AC'))", "a, loop = input().split()\nstring = input()\n\nimport re\nfor i in range(int(loop)):\n j, k = input().split()\n #print(string[int(j)-1:int(k)].count('AC')) # TLE\n ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s784632877', 's856317147', 's973186728', 's688777319'] | [3444.0, 2940.0, 3444.0, 7748.0] | [2104.0, 17.0, 2104.0, 863.0] | [142, 208, 138, 216] |
p03087 | u544050502 | 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(Q):\n l[i],r[i]=map(int,input().split())\ncounter=[0]*N\nfor i in range(len(S)-1):\n if S[i]=="A":\n counter[i]+=counter[i-1]+(S[i+1]=="C")\n else:counter[i]=counter[i-1]\nfor j in range(Q):\n print(counter[r[j-1]]-counter[l[j-1]])', 'N,... | ['Runtime Error', 'Accepted'] | ['s316373865', 's136059515'] | [13700.0, 14128.0] | [324.0, 416.0] | [300, 294] |
p03087 | u547167033 | 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()\ncnt=[0]*(n+1)\nfor i in range(1,n+1):\n cnt[i]=s.count('AC',0,i)\nfor _ in range(q):\n l,r=map(int,input().split())\n print(cnt[r]-cnt[l-1])", "n,q=map(int,input().split())\ns=input()\ncnt=[0]*n\nfor i in range(1,n):\n if s[i-1]=='A' and s[i]=='C':\n cnt[i]=cnt[i-1]+1\n... | ['Wrong Answer', 'Accepted'] | ['s675151566', 's672892289'] | [5620.0, 6188.0] | [2104.0, 882.0] | [177, 228] |
p03087 | u549497563 | 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()\nx = [list(map(int,input().split())) for i in range(q)]\nfor i in range(q):\n cnt = 0\n t = s[x[i][0]-1:x[i][1]]\n for i in range(len(t)-1):\n if t[i:i+2]=="AC"\n cnt += 1\n print(cnt)', 'n,q = map(int,input().split())\ns = input()\nx = [list(m... | ['Runtime Error', 'Accepted'] | ['s004300526', 's888682073'] | [2940.0, 30612.0] | [19.0, 460.0] | [249, 272] |
p03087 | u551692187 | 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)]\n\nfor i in range(Q):\n s_tmp = S[max(lr[i][0] - 1, 0):lr[i][1]]\n s_tmp_aft = S[lr[i][1]:]\n s_tmp_aft_2 = S[lr[i][1] - 1:]\n print(s_tmp.count('AC') - max(s_tmp_aft.count('AC'), s_tmp_aft_2.count('AC'))... | ['Wrong Answer', 'Accepted'] | ['s796754775', 's429433270'] | [28380.0, 32220.0] | [2105.0, 476.0] | [313, 401] |
p03087 | u552357043 | 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())\nposition = [0] * (N)\ncount = 0\nfor i in range(N):\n if S[i] == "A" and S[i + 1] == "C":\n count += 1\n position[i] = count\n\nfor i in range(Q):\n l, r = map(int, input().split())\n l -= 1\n r -= 1\n answer = position[r] - position[l]\n ... | ['Runtime Error', 'Accepted'] | ['s697116883', 's734432757'] | [5572.0, 10300.0] | [47.0, 436.0] | [318, 382] |
p03087 | u556225812 | 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 = list(input())\ncnt = 0\nfor i in range(len(s)-1):\n if s[i] == 'A':\n if s[i+1] == 'C':\n cnt += 1\nprint(cnt)", "n, q = map(int, input().split())\ns = list(input())\ns.append('END')\na_lst = [0]*n\nfor i in range(1, n):\n if s[i-1] == 'A' and s[i] == 'C':\n a_lst[i] = a_lst[i-1] + ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s060461262', 's346801184', 's655807909', 's303594966'] | [3060.0, 108424.0, 3064.0, 6060.0] | [17.0, 2104.0, 17.0, 858.0] | [129, 334, 217, 273] |
p03087 | u556326496 | 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... | ['word_number, questions_number = map(int, input().split())\nwords = list(input())\nquestions = []\nfor question in range(questions_number):\n a,b = map(int, input().split())\n questions.append([a-1, b-1])\n\nfor i in range(len(questions)):\n counter = 0\n for j in range(questions[i][0], questions[i][1]):\n... | ['Wrong Answer', 'Accepted'] | ['s270592107', 's480509317'] | [20336.0, 22900.0] | [2105.0, 475.0] | [438, 805] |
p03087 | u557792847 | 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()\nqn = [list(map(int, input().split())) for _ in range(Q)]\nS = "0" + S\ncnt = []\ncnt.append(0)\nfor i in range(1, N+1):\n if (S[i-1:i+1] == "AC"):\n cnt.append(cnt[i-1] + 1)\n else:\n cnt.append(cnt[i-1])\nfor q in qn:\n ans = cnt[q[1]] - cnt[q[0]-... | ['Wrong Answer', 'Accepted'] | ['s628358334', 's759949956'] | [29992.0, 29684.0] | [306.0, 322.0] | [377, 317] |
p03087 | u565204025 | 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()\nlr = []\nfor i in range(0,q):\n lr.append(input().split())\nmap(int,lr)\n\nei = []\nfor index, item in enumerate(s):\n if index == n - 1:\n break\n if s[index] == "A" and s[index + 1] == "C":\n ei.append(index)\n ce.... | ['Runtime Error', 'Accepted'] | ['s209807360', 's897078085'] | [32280.0, 14844.0] | [2105.0, 431.0] | [518, 382] |
p03087 | u565387531 | 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())\na = []\nb = []\nfor i in range(q):\n x, y = map(int, input().split())\n a.append(x)\n b.append(y)\n\nss = []\nll = []\nfor i in range(q):\n c = s[a[i]:b[i]]\n d = c.count('AC')\n print(d)", "n, q = map(int, input().split())\ns = str(input())\na = [... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s522662409', 's525151264', 's574649287', 's917114434', 's696653997'] | [12000.0, 11108.0, 5236.0, 11920.0, 30708.0] | [2104.0, 300.0, 2104.0, 2104.0, 472.0] | [243, 255, 198, 243, 261] |
p03087 | u566264434 | 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()\n\na = [0] * n\nnum = 0\n\nfor i in range(1, n):\n if s[i]=='C' and s[i-1]=='A':\n num += 1\n\n a[i] = num\nprint(a)\nfor _ 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\nnum = 0... | ['Wrong Answer', 'Accepted'] | ['s500019556', 's114001365'] | [7488.0, 7748.0] | [853.0, 841.0] | [285, 224] |
p03087 | u568576853 | 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)\nfor i in range(n-1):\n a[i+1]=a[i]\n if s[i]=='A' and s[i+1]=='C':\n a[i+1]+=1\nfor i in range(q):\n l,r=map(int,input().split())\n if l==0:\n print(a[r])\n else:\n print(a[r]-a[l-1])", "n,q=map(int,input().split())\ns=input()\na=[0]*(n)\nfor i in ra... | ['Wrong Answer', 'Accepted'] | ['s000959825', 's706118048'] | [7540.0, 6132.0] | [866.0, 871.0] | [239, 202] |
p03087 | u569322757 | 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, 0]\nfor i in range(2, n + 1):\n a.append(a[i - 1] + (s[i - 2:i] == 'AC'))\n\n\nfor _ in range(q):\n li, ri = map(int, input().split())\n print(a[ri] - a[li - 1])", "n, q = map(int, input().split())\ns = input()\n\na = [0, 0]\nfor i in range(2, n + 1):\... | ['Wrong Answer', 'Accepted'] | ['s285901611', 's095173263'] | [7684.0, 7812.0] | [865.0, 885.0] | [217, 213] |
p03087 | u570018655 | 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 print(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)... | ['Wrong Answer', 'Accepted'] | ['s285836570', 's319285930'] | [107688.0, 9156.0] | [2104.0, 879.0] | [240, 227] |
p03087 | u572193732 | 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_list = list(S)\ncount_list = [0]*N\nprint(S_list)\n\nfor i in range(1, N):\n count_list[i] += count_list[i-1] \n if S_list[i-1] == "A" and S_list[i] == "C":\n count_list[i] += 1\n \nprint(count_list)\n\nfor i in range(Q):\n start, end = map(int, ... | ['Wrong Answer', 'Accepted'] | ['s047476870', 's478316758'] | [12068.0, 8516.0] | [875.0, 855.0] | [389, 348] |
p03087 | u573970531 | 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()\nli=[0]\nc=0\nfor i in range(1,n-1):\n if s[i-1]=="A" and s[i]=="C":\n c+=1\n li.append(c)\n\nfor i in range(q):\n l,r=list(map(int,input().split()))\n l-=1\n r-=1\n print(li[r]-li[l])', 'n,q=list(map(int,input().split()))\ns=input()\nli=[0]\nc=0\nfor i in range(... | ['Runtime Error', 'Accepted'] | ['s438703474', 's224983268'] | [5604.0, 6116.0] | [112.0, 919.0] | [226, 224] |
p03087 | u574189773 | 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\nt = [0] * (N + 1) \n\nfor i in range(N):\n\tt[i+1] = t[i] + (1 if S[i:i+2] == "AC" else 0)\n\nprint(t)\nfor i in range(Q):\n\tl, r = map(int, input().split())\n\tprint(t[r-1] - t[l-1])\n', 'S = input() \ndata = [ tuple(map(int, input().split())) for _ in range(Q) ] \n... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s015205020', 's279525356', 's611662649', 's244687976'] | [9872.0, 3060.0, 4212.0, 9412.0] | [871.0, 17.0, 884.0, 881.0] | [221, 304, 214, 212] |
p03087 | u575431498 | 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()\ndp = [0] * N\nfor i in range(N-2, -1, -1):\n dp[i] = dp[i+1]\n if S[i:i+2] == 'AC':\n dp[i] += 1\nfor _ in range(Q):\n l, r = map(int, input().split()) print(dp[l-1] - dp[r-1])", "N, Q = map(int, input().split())\nS = input()\ndp = [0] * N\nfor i in ra... | ['Runtime Error', 'Accepted'] | ['s200520028', 's339225368'] | [2940.0, 6060.0] | [17.0, 893.0] | [234, 235] |
p03087 | u576432509 | 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()\ncnt=[0]*n\nfor i in range(n-1):\n if s[i:i+1]=="AC":\n cnt[i+1]=cnt[i]+1\n# else:\n# cnt[i+1]=cnt[i]\n\nfor i in range(q):\n li,ri=map(int,input().split())\n# print(s[li-1:ri].count("AC"))\n# print(sum(cnt[li-1:ri-1]))\n print(cnt[ri]-cnt[li])', 'n,... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s106611782', 's238225182', 's526563922', 's967667044', 's053252898'] | [3956.0, 4760.0, 5556.0, 5340.0, 6060.0] | [94.0, 43.0, 847.0, 2112.0, 875.0] | [299, 261, 360, 261, 241] |
p03087 | u578489732 | 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 -*-\nimport sys\n# ----------------------------------------------------------------\n# Use Solve Function\n\ndef solve(lines):\n N,Q = map(int, lines.pop(0).split(' '))\n S = lines.pop(0)\n NLIST = []\n for i in range(Q):\n a,b = map(int, lines.pop(0).split(' '))\n NLIST.... | ['Wrong Answer', 'Accepted'] | ['s517650510', 's139059946'] | [21476.0, 19780.0] | [1797.0, 1819.0] | [648, 632] |
p03087 | u580093517 | 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]*n\nfor i in range(1,n):\n count[i] += count[i-1]\n if s[i-1:i+1] == "AC":count += 1\nfor i in range(q):\n l,r = map(int,input().split())\n print(count[r-1]-count[l-1])', 'N,Q = map(int,input().split())\nS = input()\nT = [0]*N\nfor i in range(1,N):\n... | ['Runtime Error', 'Accepted'] | ['s967031791', 's172028745'] | [4212.0, 6140.0] | [807.0, 864.0] | [228, 206] |
p03087 | u580258754 | 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()\nquestions = [[i-1 for i in map(int,input().split())] for j in range(Q)]\nindexes = []\nfor i in range(len(S)-1):\n if S[i]=='A' and S[i+1]=='C':\n indexes.append(i)\n \nprint(indexes)\nimport bisect\nfor question in questions:\n left = bisect.bisect_left(indexes, q... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s236348165', 's617030012', 's799920411', 's292515176'] | [24328.0, 27260.0, 27200.0, 26068.0] | [2105.0, 2105.0, 485.0, 459.0] | [403, 381, 257, 246] |
p03087 | u580362735 | 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 = [[int(x) for x in input().split()] for i in range(Q)]\nzz = S.count('AC')\nfor i in range(Q):\n l = lr[i][0]\n r = lr[i][1]\n z = r-l\n if z < N-z:\n tmp = S[l-1:r]\n print(tmp.count('AC'))\n else:\n tmp1 = S[:l-2]\n tmp2 = S[r:]\n print(zz-tmp1.co... | ['Wrong Answer', 'Accepted'] | ['s138445391', 's714507525'] | [23932.0, 7748.0] | [2105.0, 854.0] | [332, 215] |
p03087 | u580697892 | 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()\nT = [0]\nfor i in range(N):\n if S[i] == "A" and S[i+1] == "C":\n T.append(T[i] + 1)\n else:\n T.append(T[i])\nfor j in range(Q):\n l, r = map(int, input().split())\n print(T[r] - T[l-1])', '#coding: utf-8\nN, Q = map(int, input(... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s550551761', 's607715574', 's654306730', 's600640196'] | [6100.0, 7520.0, 134448.0, 30704.0] | [839.0, 872.0, 1075.0, 443.0] | [265, 276, 198, 270] |
p03087 | u581403769 | 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())\nfor i in range(n - 1):\n if s[i] == 'A' and s[i + 1] == 'C':\n s[i] = 'O'\nfor i in range(q):\n l, r = map(int, input().split())\n t = s[l - 1:r]\n ans = 0\n for j in range(len(t) - 2):\n if t[j] == 'O':\n ans += 1\n print... | ['Wrong Answer', 'Accepted'] | ['s014286932', 's908536315'] | [11972.0, 12116.0] | [2206.0, 470.0] | [311, 284] |
p03087 | u581483013 | 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 = input().split()\ns = input()\nans = 0\ntable = [0]\nfor i in range(len(s)):\n if s[i:i+2] == 'AC':\n ans += 1\n table.append(ans)\n \nfor i in range(int(m)):\n a,b = input().split()\n a = int(a)\n b = int(b)\n print(table[b-a])\n ans = 0", '# -*- coding: utf-8 -*-\n"""\nCreate... | ['Wrong Answer', 'Accepted'] | ['s358907338', 's275048906'] | [6228.0, 6100.0] | [815.0, 828.0] | [264, 356] |
p03087 | u581511366 | 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())\na = [0]*n\n\nfor i in range(1,n):\n a[i] = a[i-1]\n if (S[i-1]=='A')and(S[i]=='C'):\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 = list(input())\na = [0]*n... | ['Wrong Answer', 'Accepted'] | ['s670891718', 's094101483'] | [8360.0, 8536.0] | [897.0, 858.0] | [242, 233] |
p03087 | u589432040 | 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())\nLR = []\nfor i in range(Q):\n LR.append(list(map(int, input().split())))\n\nfor i in range(Q):\n L = S[LR[i][0]-1:LR[i][1]]\n cnt = 0\n for j in range(len(L)-1,2):\n if L[j:j+2] == 'AC':\n cnt += 1\n print(cnt)", "N, Q = map(int, inp... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s015906728', 's876954987', 's061438777'] | [30384.0, 31868.0, 30992.0] | [1152.0, 521.0, 550.0] | [283, 455, 439] |
p03087 | u591016708 | 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):\n T[i+1] = T[i] + (1 if S[i-1:i+1]=='AC' else 0)\nans = []\nfor _ in range(Q):\n l, r = map(int, input().split())\n ans.append(T[r] - T[l])\nprint(T)\nprint(*ans, sep='\\n')", "N, Q = map(int, input().split())\nS = input()\... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s062587346', 's711946740', 's937908595', 's827367951'] | [14104.0, 7700.0, 5468.0, 15028.0] | [391.0, 869.0, 2104.0, 383.0] | [256, 213, 224, 247] |
p03087 | u591287669 | 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()\nfor _ in range(q):\n\tl,r=map(int,input().split())\n print(len(re.findall('AC',s[l-1:r],re.S)))", "n,q=map(int,input().split())\ns=input()\na=[0]\ntotal=0\nfor i in range(1,len(s)):\n if s[i]=='C':\n if s[i-1]=='A':\n total+=1\n a.append(t... | ['Runtime Error', 'Accepted'] | ['s588260987', 's093193050'] | [2940.0, 6100.0] | [17.0, 837.0] | [144, 257] |
p03087 | u594803920 | 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())\ndp = [0]*(n+10)\nfor i in range(n):\n if i == 0:\n continue\n else:\n if s[i]=='C' and s[i-1]=='A':\n dp[i+1] = dp[i] + 1\n else:\n dp[i+1] = dp[i]\nfor i in range(q):\n l, r = map(int, input().split())\n if l == 0:\n print(dp[r])\n else:... | ['Wrong Answer', 'Accepted'] | ['s893166801', 's435890685'] | [6876.0, 6872.0] | [834.0, 893.0] | [328, 405] |
p03087 | u597374218 | 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 m=S[l-1:r]\n M=0\n count=0\n for s in m:\n if s in "A":count+=1\n elif s in "C":count+=1\n elif s in "G":count+=1\n elif s in "T":count+=1\n else:\n count=0\n ... | ['Wrong Answer', 'Accepted'] | ['s038528819', 's445084350'] | [3472.0, 7700.0] | [2104.0, 860.0] | [333, 217] |
p03087 | u598229387 | 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 ss=s[l-1:r]\n n=len(ss)\n ans=0\n for i in range(n-1):\n if s[i]=="A" and s[i+1]==\'C\':\n ans+=1\n print(ans)', "import bisect\nn,q=map(int,input().split())\ns=input()\nlr=[[int(i) for i i... | ['Wrong Answer', 'Accepted'] | ['s292763136', 's188086839'] | [3464.0, 24392.0] | [2104.0, 429.0] | [227, 311] |
p03087 | u600195339 | 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 = []\nt = [0]*len(s)\n\nfor i in range(q):\n temp1, temp2 = map(int, input().split())\n l.append(temp1)\n r.append(temp2)\n\nfor i in range(1, len(s)):\n if s[i-1] + s[i] ==\t'AC':\n\tt[i] = t[i-1] + 1\n else:\n t[i] = t[i-1]\n\n#print(t)\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s761694234', 's857195733', 's370163552'] | [2940.0, 2940.0, 14200.0] | [17.0, 17.0, 462.0] | [427, 428, 433] |
p03087 | u600896094 | 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 time\n\n\ndef main():\n\n N, Q = map(int, input().split())\n S = input()\n\n sum = [0] * (N + 100)\n\n for i in range(N+1):\n if S[i] == 'A' and S[i+1] == 'C': sum[i+1] = sum[i] + 1\n else: sum[i+1] = sum[i]\n\n for i in range(Q):\n l, r = map(int, input().split())\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s087917785', 's369439039', 's445823300', 's388287944'] | [5544.0, 3064.0, 3184.0, 6184.0] | [38.0, 17.0, 18.0, 831.0] | [458, 447, 444, 458] |
p03087 | u602677143 | 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()\nls = [0]\nfor i in range(n-1):\n if s[i] == "A" and s[i+1] == "C":\n ls.append(ls[i]+1)\n else:\n ls.append(ls[i])\nprint(ls)\nfor i in range(q):\n l,r = map(int,input().split())\n print(ls[r-1]-ls[l-1])', 'n,q = map(int,input().split())\ns = inpu... | ['Wrong Answer', 'Accepted'] | ['s068560689', 's206240169'] | [7520.0, 6100.0] | [873.0, 852.0] | [263, 254] |
p03087 | u603253967 | 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 = [int(q) for q in input().split()]\n S = input()\n lr = [\n [int(q) - 1 for q in input().split()]\n for _ in range(Q)\n ]\n\n ttt = [0]\n res = 0\n for i in range(1, len(S)):\n if S[i - 1] == "A" and S[i] == "C":\n res += 1\n ttt.append(r... | ['Wrong Answer', 'Accepted'] | ['s728075821', 's143520330'] | [25724.0, 24464.0] | [418.0, 405.0] | [416, 401] |
p03087 | u609061751 | 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 import sys\n input = sys.stdin.readline\n N,Q = list(map(int, input().split()))\n S = list(input())\n L = []\n for _ in range(Q):\n temp = list(map(int, input().split()))\n L.append(temp)\n I = []\n for i in range(len(S)-1):\n if S[i] == "A" and S[i+1] == "C":\n I... | ['Runtime Error', 'Accepted'] | ['s536124438', 's885850419'] | [2940.0, 31556.0] | [17.0, 277.0] | [535, 510] |
p03087 | u610473220 | 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().split()\nrList = list()\nlList = list()\nfor i in range(Q):\n l, r = map(int, input().split())\n lList.append(l - 1)\n rList.append(r)\ndef AcNum(List):\n c = 0\n for i in range(len(List) - 1):\n if List[i] == "A" and List[i + 1] == "C":\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s346814594', 's577820110', 's708267396'] | [11916.0, 8464.0, 6084.0] | [439.0, 875.0, 850.0] | [384, 428, 413] |
p03087 | u614314290 | 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... | ['\nimport heapq\nclass heapque:\n def __init__(self, *args):\n self.que = []\n for arg in args:\n self.push(arg)\n def push(self, v):\n heapq.heappush(self.que, v)\n def pop(self):\n return heapq.heappop(self.que)\n\n\nINF = float("inf")\nMOD = int(1e9 + 7)\ndef int1(n):... | ['Wrong Answer', 'Accepted'] | ['s147426678', 's144502427'] | [55120.0, 53732.0] | [626.0, 627.0] | [712, 693] |
p03087 | u617515020 | 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 _ in range(q)]\nfor i in range(q):\n temp = s[lr[i][0]-1:lr[i][1]]\n cnt =0\n j = -1\n while True:\n j = temp.find('AC', j+1)\n if j == -1:\n break\n cnt += 1", "n,q = map(int,input().split())\ns = input()\n\nac =... | ['Wrong Answer', 'Accepted'] | ['s313054438', 's186449598'] | [16824.0, 22176.0] | [2104.0, 477.0] | [252, 337] |
p03087 | u618107373 | 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,0]\nfor i in range(0,n-1):\n l.append(l[i+1]+(s[i]+s[i+1]=="AC"))\nfor i in range(q):\n x,y = map(int,input().split())\n if l[x-1]+1==l[x]:\n print(l[y] - l[x - 1]-1)\n else:\n print(l[y] - l[x - 1])\nprint(l)', 'n,q = map(int,input().split... | ['Wrong Answer', 'Accepted'] | ['s826359682', 's404451982'] | [9732.0, 7684.0] | [930.0, 924.0] | [276, 267] |
p03087 | u620846115 | 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... | ['a,b=map(int,input().split())\nn = input()\nm = []\nfor i in range(b-1):\n if n[i:i+2]=="AC":\n m.append("1")\n else:\n m.append("0")\nfor i in range(b-2):\n s,t=map(int,input().split())\n print(m[s-1:t-1].count("1"))', 'a,b=map(int,input().split())\nn = input()\nfor i in range(b):\n s,t=input().split()\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s904779393', 's950628705', 's757658532'] | [11176.0, 9276.0, 11336.0] | [2206.0, 25.0, 467.0] | [216, 172, 209] |
p03087 | u622570247 | 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().rstrip()\n\npos = []\nfor i in range(n - 1):\n if s[i] == 'A' and s[i + 1] == 'C':\n pos.append(i)\n\nprint(pos)\nfor i in range(q):\n l, r = map(int, input().split())\n l -= 1\n r -= 1\n\n ans = 0\n for j in range(len(pos)):\n if l <= pos[... | ['Wrong Answer', 'Accepted'] | ['s234542669', 's881757250'] | [6164.0, 6188.0] | [2104.0, 868.0] | [350, 289] |
p03087 | u623687794 | 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\nfor i in range(n-1):\n if s[i:i+2]=="AC":\n ac[i]=ac[i-1]+1\n else:\n ac[i]=ac[i-1]\nfor i in range(q):\n l,r=map(int,input().split())\n print(ac[r-2]-ac[l-1])\n', 'n,q=map(int,input().split())\ns=input()\nac=[0]*n\nfor i in range(n-1):\n if s[i:i+2]=="AC"... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s439790047', 's512881964', 's939592560', 's622047206'] | [6060.0, 5548.0, 18256.0, 6060.0] | [860.0, 2104.0, 2104.0, 882.0] | [211, 229, 240, 251] |
p03087 | u625554679 | 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\nimport re\n\ndef find_AC(S):\n ret = []\n for i in range(len(S)-1):\n if S[i] == 'A' and S[i+1] == 'C':\n ret.append(i)\n return re\n\nN, Q = [int(x) for x in input().split()]\nS = input()\nresult = find_AC(S)\n#pos = np.array([res.start()+1 for res in result])\npos = [res.start()+1 for... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s109658487', 's950547612', 's979684856', 's116045927'] | [14572.0, 7768.0, 15580.0, 22032.0] | [165.0, 2104.0, 2108.0, 1829.0] | [461, 387, 307, 339] |
p03087 | u626337957 | 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)]\n\nP = [0] * (N+1)\nbefore_a = False\ncnt = 0\nfor i in range(N):\n if before_a and S[i] == 'C':\n cnt += 1\n before_a = False\n elif S[i] == 'A':\n before_a = True\n else:\n before_a = False\n P[i]... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s075614992', 's344420163', 's521525841', 's686769324', 's920218131', 's551063783'] | [30732.0, 3572.0, 3060.0, 3700.0, 30736.0, 30704.0] | [462.0, 22.0, 17.0, 23.0, 468.0, 457.0] | [367, 421, 397, 421, 370, 365] |
p03087 | u626881915 | 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_list = [0]*len(s)\n\n\'\'\'while True:\n ac_index = s[i:].find("AC")\n if ac_index == -1:\n break\n else:\n ac_list[ac_index+i] = 1\n i = ac_index + i + 2\'\'\'\n\nfor i in range(len(s)-1):\n if s[i:i+2] == \'AC\':\n ac_list[i+1... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s133418233', 's363736268', 's572289292', 's441786801'] | [4212.0, 21624.0, 3956.0, 6188.0] | [833.0, 2108.0, 18.0, 858.0] | [427, 475, 429, 471] |
p03087 | u627143908 | 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 = [-1] * q\nr = [-1] * q\nfor i in range(q):\n l[i], r[i] = map(int, input().split())\nsum = [0] * (n+1)\nflag_a = False\nfor i in range(1, n+1):\n if s[i-1] == 'A':\n flag_a = True\n sum[i] = sum[i-1]\n elif s[i-1] == 'C' and flag_a:\n ... | ['Wrong Answer', 'Accepted'] | ['s664054556', 's238403979'] | [16720.0, 14228.0] | [431.0, 442.0] | [475, 465] |
p03087 | u627886394 | 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())\nlr = [tuple(map(int, input().split(\' \'))) for _ in range(Q)]\nsave = [0] * N\nprint(N)\nprint(Q)\nprint(S)\ni = 0\nwhile i < len(S):\n if S[i] == "A":\n if S[i+1] == "C":\n save[i] = 1\n i += 1\n elif S[i] == "C":\n i ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s026779018', 's468157132', 's575495508', 's886935384'] | [18908.0, 20320.0, 3064.0, 18340.0] | [2105.0, 2108.0, 17.0, 952.0] | [393, 393, 786, 807] |
p03087 | u628285938 | 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"""\nCreated on Mon Sep 14 00:57:13 2020\n\n@author: liang\n"""\n\nN, Q = map(int, input().split())\nS = input()\nS += "a"\nd = [0]*(N+1)\ncount = 0\nfor i in range(len(S)-1):\n if S[i:i+2] == "AC":\n count += 1\n #print(i)\n d[i+1] = count\n#print(lis)\nprint(d)\nfor i in ran... | ['Wrong Answer', 'Accepted'] | ['s363678243', 's200159295'] | [12704.0, 11464.0] | [492.0, 485.0] | [383, 385] |
p03087 | u628538573 | 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 = []\nfor i in range(q):\n\tb = input().split()\n\tb[0] = int(b[0]) - 1\n\tb[1] = int(b[1]) - 1\n\ta.append(b)\ncounter = [0]\nfor i in range(1,len(s)):\n\tif s[i - 1] == "A" and s[i] == "C":\n\t\tcounter.append(counter[i - 1] + 1)\n\telse:\n\t\tcounter.append(counter[... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s157945036', 's320703770', 's187063991'] | [31920.0, 31920.0, 30660.0] | [471.0, 501.0, 470.0] | [418, 418, 403] |
p03087 | u628581330 | 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())\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]=t[i]+(1 if S[i:i+2] == ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s116813591', 's440068788', 's642367274', 's983233863'] | [9152.0, 7108.0, 9152.0, 7748.0] | [329.0, 313.0, 872.0, 885.0] | [198, 189, 202, 193] |
p03087 | u642528832 | 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 = [lr[i][0] for i in range(Q)]\nr = [lr[i][1] for i in range(Q)]\n#print(lr)\n#print(l)\n#print(r)\n\nc = [0] * N\ncnt = 0\n\nfor i in range(N-1):\n if S[i:i+2] == 'AC':\n c[i+1]=c[i]+1\n else:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s266777596', 's843193924', 's240430673'] | [32376.0, 32560.0, 31376.0] | [315.0, 314.0, 312.0] | [471, 699, 700] |
p03087 | u642874916 | 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 = [list(map(int, input().split())) for i in range(q)]\n\ncum=[0]*n\nfor i in range(1, n):\n cum[i] = cum[i - 1]\n if s[i-1:i+1] == 'AC':\n cum[i]+=1\n print(cum)\n\nfor i in range(q):\n print(cum[a[i][1]-1]-cum[a[i][0]-1])", "import math\nfrom iterto... | ['Wrong Answer', 'Accepted'] | ['s613233248', 's657604845'] | [117932.0, 16884.0] | [2105.0, 475.0] | [278, 457] |
p03087 | u643679148 | 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()\nls = [list(map(int, input().split())) for i in range(q)]\nd = [0]\npre = 0\nc = 0\n\nfor i in range(len(s)-1):\n if s[i:i+2] == 'AC':\n d.append(d[i]+1)\n else:\n d.append(d[i])\n\nprint(d)\n\nfor start, end in ls:\n print(d[end-1]-d[start-1])\n", ... | ['Wrong Answer', 'Accepted'] | ['s003726056', 's809524807'] | [30936.0, 29588.0] | [313.0, 316.0] | [298, 290] |
p03087 | u644360640 | 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,q = map(int,input().split())\ns = input()\nl = [list(map(int,input().split())) for i in ra... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s314728693', 's896936800', 's723163364'] | [9152.0, 27480.0, 7748.0] | [858.0, 329.0, 869.0] | [213, 506, 204] |
p03087 | u645250356 | 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()\nans = []\nrl = []\nfor i in range(Q):\n a,b = map(int,input().split())\n rl += [[a,b]]\n\nfor i in range(Q):\n count = 0\n S_temp = [ S[j] for j in range(rl[i][0]-1,rl[i][-1]) ]\n count = S_temp.count("AC")\n ans.append(count)\n \nfor i in range(Q):\n ... | ['Wrong Answer', 'Accepted'] | ['s876112512', 's596445832'] | [23140.0, 22868.0] | [2105.0, 476.0] | [320, 376] |
p03087 | u650622056 | 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()\nl_r_list = [[int(_) for _ in input().split()] for _ in range(Q)]\n\nAC_accumulation = [0]\n\nfor i in range(1, N + 1):\n if S[i] == "C":\n if S[i - 1] == "A":\n AC_accumulation.append(AC_accumulation[-1] + 1)\n else:\n AC_accumulati... | ['Runtime Error', 'Accepted'] | ['s848293959', 's482305059'] | [23720.0, 31656.0] | [344.0, 416.0] | [463, 447] |
p03087 | u652286295 | 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()\ncnt = [0] * (N)\n\nfor i in range(N - 1):\n cnt[i + 1] = cnt[i] + (1 if S[i:i + 2] == "AC" else 0)\n\nprint(cnt)\n\nfor i in range(Q):\n l, r = map(int, input().split())\n print(cnt[r - 1] - cnt[l - 1])', 'N, Q = map(int, input().split())\nS = input()\ncnt = [0]... | ['Wrong Answer', 'Accepted'] | ['s081325150', 's086865387'] | [9152.0, 9540.0] | [891.0, 861.0] | [247, 237] |
p03087 | u652569315 | 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 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 for i in range(q):\n l, r = map(int, input().split())\n print(t[r-1] - t[l-1])\nif __name__=='__main__':\n main()", "def main():\n n,q=map(int,input().... | ['Wrong Answer', 'Accepted'] | ['s861435530', 's059609195'] | [7108.0, 7748.0] | [276.0, 863.0] | [269, 272] |
p03087 | u652583512 | 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\ndp = [[0 for i in range(N + 1)] for j in range(N + 1)]\n\nfor i in range(N - 1):\n for j in range(i + 1, N):\n print(i, j)\n if S[j] == 'C' and S[j - 1] == 'A':\n dp[i][j] = dp[i][j - 1] + 1\n else:\n dp[i][j] = dp[i][j - 1... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s268161513', 's787211857', 's513604825'] | [502900.0, 6352.0, 6976.0] | [2134.0, 599.0, 916.0] | [394, 403, 407] |
p03087 | u652656291 | 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 A = S[l,r+1]\n cnt = A.count('AC')\n print(cnt)\n ", "n,q = map(int,input().split())\nS = input()\nfor _ in range(q):\n l,r = map(int,input().split())\n A = S[l:r+1]\n cnt = A.count('AC')\n print(cnt)\n \n", "... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s324091040', 's834988034', 's826019155'] | [3188.0, 3584.0, 17576.0] | [18.0, 2107.0, 820.0] | [147, 148, 346] |
p03087 | u655110382 | 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\ncc = []\n\nfor idx in range(len(S) - 1):\n if S[idx:idx + 2] == "AC":\n cc.append(1)\n else:\n cc.append(0)\n\nfor _ in range(Q):\n l, r = map(int, input().split())\n print(sum(cc[l - 1:r]) - cc[r - 1])\n', 'N, Q = map(int, input().split())\nS... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s347614525', 's813390908', 's367258742'] | [5384.0, 6104.0, 6184.0] | [1983.0, 854.0, 884.0] | [265, 242, 251] |
p03087 | u655834330 | 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... | ['\nimport bisect\n\n\ndef read_input():\n n, q = map(int, input().split())\n s = list(input().strip())\n queries = []\n for _ in range(q):\n st, ed = map(int, input().split())\n queries.append((st - 1, ed - 1))\n\n return n, s, queries\n\n\ndef submit():\n n, s, queries = read_input()\n... | ['Wrong Answer', 'Accepted'] | ['s851298652', 's221987489'] | [20444.0, 20124.0] | [516.0, 502.0] | [630, 612] |
p03087 | u656995812 | 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)]\n\nfor i in range(q):\n print(s[lr[i][0] - 1:lr[i][1]])\n print(s[lr[i][0] - 1:lr[i][1]].count('AC'))", "n, q = map(int, input().split())\ns = input()\nlr = [list(map(int, input().split())) for _ in range(q)]... | ['Runtime Error', 'Accepted'] | ['s239384057', 's923516250'] | [158864.0, 32308.0] | [1091.0, 482.0] | [205, 294] |
p03087 | u657994700 | 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, len(S)):\n if S[i-1] == 'A' and S[i] == 'C':\n AC[i] = AC[i-1] + 1\n else:\n AC[i] = AC[i-1]\n\nprint(AC)\n\nfor i in range(Q):\n start, end = map(lambda x:int(x)-1, input().split())\n print(AC[end] - AC[start])... | ['Wrong Answer', 'Accepted'] | ['s219197031', 's503222226'] | [7464.0, 6060.0] | [937.0, 903.0] | [304, 294] |
p03087 | u660750079 | 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()\nlist1=[list(map(int,input().split())) for _ in range(Q)]\nlist2=[0]*(N+1)\ncount=0\nfor i in range(N):\n if i>0:\n list2[i+1]=list2[i]\n if i==N-1:\n continue\n elif S[i:i+2]=="AC":\n list2[i+1]+=1\nprint(list2)\nfor tmp in list1:\n print(list2... | ['Wrong Answer', 'Accepted'] | ['s521589128', 's087840698'] | [31832.0, 30700.0] | [497.0, 496.0] | [331, 318] |
p03087 | u662449766 | 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\ndef main():\n input = sys.stdin.readline\n n, q = [int(i) for i in input().split()]\n s = input()\n qs = [[int(i) for i in input().split()] for _ in range(q)]\n hoges = [False] + [s[i : i + 2] == "AC" for i in range(n - 1)]\n for (l, r) in qs:\n print(sum(hoges[l : r - 1]))\n\n\... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s197789314', 's251312844', 's602321532', 's877662006', 's936486842', 's791501641'] | [24840.0, 3060.0, 23692.0, 22876.0, 24132.0, 27384.0] | [2105.0, 17.0, 2105.0, 2105.0, 2105.0, 253.0] | [345, 213, 341, 221, 228, 484] |
p03087 | u664610890 | 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)\n\nfor i in range(Q):\n l, r = map(int, input.split())\n\tprint(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\tt[i+1]... | ['Runtime Error', 'Accepted'] | ['s990397684', 's949537545'] | [2940.0, 7748.0] | [17.0, 875.0] | [209, 208] |
p03087 | u664652300 | 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 = [[int(i) for i in input().split()] for i in range(q)]\nc = [0 for i in range(n)]\ncc = 0\nf = False\nfor i in range(n):\n if f:\n if s[i] == "C":\n cc += 1\n f = False\n else:\n f = False\n if s[i] == "A":\n ... | ['Wrong Answer', 'Accepted'] | ['s027329515', 's412389024'] | [25660.0, 24400.0] | [449.0, 438.0] | [391, 342] |
p03087 | u666198201 | 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=[]\nAC=[0]*100001\ncount=0\ntotal=0\nfor i in range (Q):\n A.append(list(map(int, input().split())))\n\nfor i in range(1,N):\n if S[i]=='C' and S[i-1]=='A':\n count +=1\n AC[i]=count\nprint(A)\nprint(AC)\n\nfor i in range(Q):\n total+=AC[int(A[i][1])-1... | ['Wrong Answer', 'Accepted'] | ['s849379090', 's266362915'] | [34604.0, 30660.0] | [566.0, 518.0] | [412, 331] |
p03087 | u670567845 | 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()\nquestion = []\nfor i in range(Q):\n question.append(list(map(int, input().split())))\n\n\nindex = []\nfor i in range(N-1):\n if S[i]+S[i+1] == "AC":\n index.append(i)\n\nfor i, q in enumerate(question):\n ans = 0\n for j in range(len(index)):\n if index[j] >= q[0]-1 and index[j]+1 <= q[1]-1:\n ... | ['Runtime Error', 'Accepted'] | ['s564987350', 's473116920'] | [3064.0, 32644.0] | [18.0, 549.0] | [408, 608] |
p03087 | u673559119 | 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... | ['#conding utf-8\nN,Q=map(int,input().split())\nS=input()\nlr=[[int(i) for i in input().split()] for i in range(Q)]\nprint(lr)\n\nAC=[0 for i in range(N)]\n\nfor i in range(N-1):\n if S[i:i+2]=="AC":\n AC[i]=1\n\nprint(AC)\n\nfor i in range(Q):\n print(sum(AC[lr[i][0]-1:lr[i][1]-1]))', '#conding utf-8\nN,Q=map(int... | ['Wrong Answer', 'Accepted'] | ['s275125738', 's815813766'] | [25844.0, 24464.0] | [2105.0, 451.0] | [272, 256] |
p03087 | u674885198 | 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 = str(input())\nlr=[]\nfor i in range(Q):\n lr.append(list(map(int, input().split())))\n\n\ncount=[0 for i in range(N)]\nind=0\nfor i in range(N-1):\n if S[i]=="A" and S[i+1]=="C":\n \tind+=1\n count[i+1]+=count[i+1]+ind\n\nfor i,j in lr:\n print(count[j-1... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s160687077', 's763968023', 's889623002'] | [2940.0, 2940.0, 32288.0] | [17.0, 17.0, 546.0] | [316, 305, 314] |
p03087 | u677121387 | 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)]\n\naclist = [0]\nacsum = 0\n\nfor i in range(1,n):\n if s[i-1] == "A" and s[i] == "C":\n acsum += 1\n aclist.append(acsum)\n\nfor i in range(q):\n ans = aclist [lr[i][1]-1] - aclist [lr[i][0]-2]\n i... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s085672817', 's507362511', 's771556953'] | [31144.0, 30720.0, 30704.0] | [521.0, 498.0, 496.0] | [385, 386, 383] |
p03087 | u677267454 | 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\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 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()\n\nt = [0] * (n + 1)\nfo... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s104409675', 's294048171', 's831139804'] | [9152.0, 4212.0, 11876.0] | [886.0, 818.0, 406.0] | [233, 222, 266] |
p03087 | u677440371 | 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\nS = str(input())\n\nL = []\nfor i in range(Q):\n l,r = map(int, input().split())\n L.append((l-1,r-1))\n \n \ncheck = []\nfor i in range(N-1):\n if S[i:i+2] == "AC":\n check.append(i)\n \nfor i in L:\n print(bisect_right(check, i[1]-1)-bisect_left(ch... | ['Runtime Error', 'Accepted'] | ['s121509429', 's003260382'] | [18640.0, 19424.0] | [337.0, 542.0] | [313, 352] |
p03087 | u679888753 | 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# pattern = r'[ACGT]+'\n# ans = 0\n\n# text = input()\n# match_list = re.findall(pattern, text)\n#\n# # print(match_list)\n# if match_list:\n# match_list_len = [len(x) for x in match_list]\n# ans = max(match_list_len)\n#\n# print(ans)\n\nn, q = map(int, input().split())\ntext = input()\nl = [0] * q... | ['Wrong Answer', 'Accepted'] | ['s391915780', 's427234697'] | [15688.0, 9364.0] | [2104.0, 874.0] | [797, 606] |
p03087 | u680851063 | 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 = list(input())\n#print(s)\nz = []\nfor i in range(n-1):\n if s[i] + s[i+1] == 'AC':\n z.append(1)\n else:\n z.append(0)\nprint(z)\n\nz = [0] + list(accumulate(z))\nprint(z)\n\nfor j in range(q):\n l, r = map(int, input().... | ['Wrong Answer', 'Accepted'] | ['s771549860', 's395647545'] | [10792.0, 9496.0] | [866.0, 865.0] | [337, 339] |
p03087 | u681110193 | 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())\na=[0]*n\n\nfor i in range(1,n):\n if s[i-1]==A and s[i]==C:\n a[i]=a[i-1]+1\n else:\n a[i]=a[i-1]\n \nfor i in range(q):\n sita,ue=map(int,input().split())\n if sita==1:\n print(a[ue-1])\n elif s[sita-2]=='A' and s[sita-1]=='C':\n print(a[ue-1]-a[sita... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s246037418', 's577402365', 's624817968'] | [4852.0, 8712.0, 6876.0] | [20.0, 925.0, 897.0] | [348, 409, 352] |
p03087 | u682730715 | 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 import sys\n \n import heapq\n import re\n import bisect\n import random\n import math\n import itertools\n from collections import defaultdict, deque\n from copy import deepcopy\n from decimal import *\n \n n, q = map(int, input().split())\n s = list(i... | ['Runtime Error', 'Accepted'] | ['s272732256', 's506173353'] | [2940.0, 10836.0] | [17.0, 898.0] | [825, 629] |
p03087 | u686036872 | 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())\nlist=[]\nfor i in range(0, N-1):\n if S[i] == "A" and S[i+1] == "C":\n list.append(i)\ncount=0\nfor j in range(Q):\n l, r = map(int, input().split())\n for i in list:\n if l-1 <= j < r-1:\n count+=1\n else:\n count+... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s127845612', 's198841573', 's248141795', 's263740085', 's267542120', 's282610066', 's285275553', 's604506119', 's689461124', 's713160598', 's721183062', 's850582394', 's947837213', 's995079918', 's385429136'] | [6012.0, 23128.0, 4972.0, 3064.0, 3956.0, 6120.0, 6012.0, 8692.0, 3536.0, 6120.0, 24436.0, 23000.0, 4972.0, 6120.0, 6132.0] | [2104.0, 2104.0, 2104.0, 17.0, 30.0, 2104.0, 2104.0, 2104.0, 2104.0, 2104.0, 2104.0, 2104.0, 2104.0, 2104.0, 864.0] | [324, 298, 315, 236, 307, 244, 324, 305, 159, 244, 297, 296, 315, 242, 272] |
p03087 | u687044304 | 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\ndef solve():\n N, Q = list(map(int, input().split()))\n S = input()\n\n dp = [0]*(N)\n dp[0] = 0\n for i in range(0, N-1):\n if S[i]=="A" and S[i+1]=="C":\n dp[i+1] = dp[i] + 1\n else:\n dp[i+1] = dp[i]\n \n for i in range(Q):\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s453236023', 's939223252', 's911396315'] | [5548.0, 5548.0, 6188.0] | [39.0, 39.0, 855.0] | [418, 418, 422] |
p03087 | u687923925 | 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().strip().split(' '))\ns = input()\nac = []\nkazu = 0\nfor i in range(n-1):\n if s[i:i+2] == 'AC':\n kazu = kazu + 1\n ac.append(kazu)\n else:\n ac.append(kazu)\nac.append(0)\nprint(ac)\nfor i in range(q):\n num = 0\n l, r = map(int, input().strip().split(' '))\n... | ['Wrong Answer', 'Accepted'] | ['s058778483', 's767443356'] | [7524.0, 6104.0] | [884.0, 893.0] | [329, 319] |
p03087 | u688126754 | 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()\ncumurative_sum_lst = np.zeros(N)\nfor i in range(N-2):\n if S[i] == "A" and S[i+1] == "C":\n cumurative_sum_lst[i+2:] += 1\n\n\n\noutputs = []\nfor i in range(Q):\n l, r = map(int, input().split())\n l, r = l - 1, r - 1\n# print... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s597067177', 's957817409', 's145169619'] | [17712.0, 17868.0, 10316.0] | [2109.0, 2109.0, 437.0] | [466, 464, 476] |
p03087 | u688522869 | 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, 0]\nfor i in range(len(S) - 1):\n if S[i] == "A" and S[i + 1] == "C":\n ac.append(ac[-1] + 1)\n else:\n ac.append(ac[-1])\nfor _ in range(Q):\n l, r = map(int, input().split())\n print(ac[r] - ac[l - 1])', 'N, Q = map(int, input().split())\nS = input()... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s469937267', 's780326288', 's739365985'] | [6100.0, 6096.0, 6096.0] | [848.0, 835.0, 825.0] | [259, 259, 255] |
p03087 | u690781906 | 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]\ncount = 0\nfor i in range(1, n):\n if s[i-1] + s[i] == 'AC':\n count += 1\n t.append(count)\nans = []\nfor le, ri in lr:\n ans.append(t[ri-1] - t[le-1])\nprint(ans)\n", "n, q = map(int, in... | ['Wrong Answer', 'Accepted'] | ['s790422156', 's987420206'] | [35612.0, 30704.0] | [416.0, 476.0] | [283, 257] |
p03087 | u691018832 | 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 counts(s, l, r):\n ans = s[l-1:r].count('AC')\n print(ans)\n\nn, q = map(int, input().split())\ns = input()\nfor i in xrange(q):\n l, r = map(int, input().split())\n counts(s, l, r)", "import sys\ninput = sys.stdin.readline\n\nn, q = map(int, input().split())\ns = input()\nmemo = [0] * n\ncnt = 0\n\nf... | ['Runtime Error', 'Accepted'] | ['s736889673', 's595886023'] | [3188.0, 6380.0] | [17.0, 255.0] | [189, 299] |
p03087 | u692453235 | 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]\ncnt = 0\n\nfor i in range(1, N):\n if S[i-1] == "A" and S[i] == "C":\n cnt += 1\n L.append(cnt)\n\nprint(L)\n\nfor _ in range(Q):\n l, r = map(int, input().split())\n print(L[r-1] - L[l-1])', 'N, Q = map(int, input().split())\nS = list(input())\nL =... | ['Wrong Answer', 'Accepted'] | ['s156305414', 's295595672'] | [8388.0, 6872.0] | [861.0, 851.0] | [244, 234] |
p03087 | u692514846 | 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 = map(int, input().split())\nS = list(input())\nlr = [list(map(int, input().split())) for i in range(Q)]\n\nlst=[]\nfor i in range(N-1):\n if S[i]=="A" and S[i+1]=="C":\n lst.append(i)\n\nans=[]\nfor j in range(Q):\n l,r = lr[j][0]-1, lr[j][1]-1\n ans.append(bisect.bisect_right(lst... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s074504941', 's201193502', 's199125821'] | [34840.0, 30384.0, 32980.0] | [587.0, 2105.0, 619.0] | [366, 369, 378] |
p03087 | u692746605 | 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]\nt = 0\nfor i in range(1,N):\n t += 1 if S[i-1:i+1]=='AC' else 0\n c.append(t)\nprint(c)\nfor _ in range(Q):\n l,r=map(int, input().split())\n print(c[r-1]-c[l-1])\n", "N,Q=[int(i) for i in input().split()]\nS=input()\n\nc=[0]\nt = 0\nfor i in range(1,N):\n ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s111342051', 's227728523', 's758666817', 's353267391'] | [9184.0, 7688.0, 2940.0, 7864.0] | [894.0, 914.0, 17.0, 875.0] | [214, 247, 201, 205] |
p03087 | u693391925 | 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\nA=[0]*(N)\n\nfor i in range(N-1):\n if S[i:i+2]=='AC':\n A[i+1]=A[i]+1\n else:\n A[i+1]=A[i]\n\nprint(A)\n\nfor k in li:\n l=k[0]-1\n r=k[1]-1\n print(A[r]-A[l])", "N, Q = map(int, inp... | ['Wrong Answer', 'Accepted'] | ['s673729086', 's951349798'] | [31796.0, 30664.0] | [514.0, 497.0] | [278, 268] |
p03087 | u694649864 | 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... | ['\nNQ = input().split()\nN,Q = int(NQ[0]), int(NQ[1])\nS = input()\nP = [input().split() for i in range(Q)]\n\n\nruiseki = [0]*N\nfor i in range(1,N):\n if(S[i] == "C" and S[i-1] == "A"):\n print(i)\n ruiseki[i] = ruiseki[i-1] + 1\n else:\n ruiseki[i] = ruiseki[i-1]\n\nfor j in range(Q):\n ... | ['Wrong Answer', 'Accepted'] | ['s305091210', 's428083564'] | [35808.0, 35428.0] | [424.0, 379.0] | [382, 367] |
p03087 | u694810977 | 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())\ncount = [0]*(N+1)\nlists = []\nfor i in range(1, N):\n if S[i-1] == "A" and S[i] == "C":\n count[i + 1] = count[i] + 1\n else:\n count[i + 1] = count[i]\nfor i in range(Q):\n l, r = map(int, input().split())\n ans = count[r-1] - count[l-1]\... | ['Wrong Answer', 'Accepted'] | ['s737656004', 's451346567'] | [10208.0, 10208.0] | [438.0, 438.0] | [377, 373] |
p03087 | u695857481 | 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()\nplaces = []\nfor i in range(1, n):\n if (s[i - 1:i + 1] == 'AC'):\n places.append(i)\nprint(places)\nfor j in range(q):\n l, r = map(int, input().split())\n print(len([p for p in places if ((l <= p) and (p <= r - 1))]))\n ", "n, q = map(int, input().split())\ns = ... | ['Wrong Answer', 'Accepted'] | ['s782295392', 's637923917'] | [6220.0, 7748.0] | [2107.0, 892.0] | [266, 219] |
p03087 | u698771758 | 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... | ['a,b=map(int,input().split())\na=input()\ne=""\nfor i in range(b):\n c,d=map(int, input().split())\n e=e+str(a[c-1:d].count("AC"))+"\\n"\nprint(e)', 'a,b=map(int,input().split())\na=input()\nc=[0]*len(a)\nfor i in range(len(a)-1):\n if (a[i]+a[i+1])=="AC":c[i+1]=c[i]+1\n else:c[i+1]=c[i]\nfor i in range(b)... | ['Time Limit Exceeded', 'Accepted'] | ['s381261541', 's059993243'] | [3692.0, 6188.0] | [2104.0, 876.0] | [144, 216] |
p03087 | u698868214 | 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 = []\nfor i in range(N-1):\n if S[i]+S[i+1] == "AC":\n AC.append(i+1.5)\n\nprint(AC)\n\nfor j in range(Q):\n l,r = map(int,input().split())\n cnt = 0\n for k in AC:\n if l < k < r:\n cnt += 1\n if r < k:\n break\n print(cnt)', 'N,Q = map(int,inpu... | ['Wrong Answer', 'Accepted'] | ['s243833947', 's899169179'] | [11868.0, 13200.0] | [2206.0, 474.0] | [279, 205] |
p03087 | u698919163 | 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\ncsum = [0,0]\nfor i in range(1, N):\n if S[i-1] + S[i] == 'AC':\n csum.append(csum[i-1] + 1)\n else:\n csum.append(csum[i])\nprint(csum)\n\nfor i in range(Q):\n l, r = map(int, input().split())\n print(csum[r]-csum[l])", "N,Q = map(int,input().s... | ['Wrong Answer', 'Accepted'] | ['s139977062', 's587991695'] | [7620.0, 6176.0] | [871.0, 854.0] | [278, 324] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.