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
u351363308
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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_list = []\nfor i in range(len(S)):\n if S[i:i+1] == "AC":\n AC_list.append(i)\n else:\n pass\n \nfor i in range(Q):\n l, r = map(int,input().split())\n ans = 0\n for j in AC_list:\n if l-1 <= j <= r-2:\n ans += 1\n...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s223813328', 's960193058', 's696490551']
[3444.0, 5548.0, 6188.0]
[825.0, 62.0, 878.0]
[356, 268, 280]
p03087
u352048883
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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, k = map(int, input().split())\ns = input()\nrr = (list(map(int, input().split())) for _ in range(k))\n\nfrom collections import Counter\n\ndc = [0, 0]\nc = 0\nfor i in range(1, len(s)):\n if s[i-1]+s[i] == 'AC':\n c += 1\n dc.append(c)\nfor a, b in rr:\n print(dc[b] - ...
['Wrong Answer', 'Accepted']
['s247470666', 's172610379']
[6628.0, 6728.0]
[323.0, 318.0]
[312, 309]
p03087
u358957649
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['ii = lambda:int(input())\nmi = lambda:list(map(int,input().split()))\nix = lambda x:list(input() for _ in range(x))\nmix = lambda x:list(mi() for _ in range(x))\niix = lambda x:list(int(input()) for _ in range(x))\n##########\ndef main(n,q,s,l):\n lst_ac = [0]*(len(s))\n for i in range(len(s)-1):\n if s[...
['Wrong Answer', 'Accepted']
['s081606258', 's866428940']
[31848.0, 30716.0]
[480.0, 484.0]
[627, 609]
p03087
u360090862
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\nlr=[]\nfor i in range(Q):\n lr.append([int(i) for i in input().split()])\n\nacn=[0 for i in range(N)]\ncount=0\nfor i in range(1,N):\n if S[i-1]+S[i]=="AC":\n count+=1\n acn[i]=count\nfor i in range(Q):\n l=lr[i][0]\n r=lr[i][1]\n print(l,r)\n print(acn[r-1]...
['Wrong Answer', 'Accepted']
['s846996560', 's461348986']
[25588.0, 24464.0]
[594.0, 470.0]
[312, 299]
p03087
u370721525
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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())\nli = []\ncnt = 0\n\nfor i in range(N-1):\n if S[i]=='A' and S[i+1]=='C':\n cnt += 1\n li.append(cnt)\n else:\n li.append(cnt)\n\nfor i in range(Q):\n l, r = map(int, input().split())\n ans = li[r-1] - li[:l-1]\n print(ans)\n", "N, Q = map(int, input()....
['Runtime Error', 'Accepted']
['s911085655', 's875530520']
[11656.0, 11324.0]
[48.0, 486.0]
[274, 313]
p03087
u371467115
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\na=[0]*n\n\nfor i in range(n-1):\n if s[i:i+2]=='AC':\n cnt+=1\n a[i+1]=cnt\n print(a)\n else:\n a[i+1]=cnt\n\nfor _ in range(q):\n l,r=map(int,input().split())\n c=a[r-1]-a[l-1]\n print(c)", "n,q=map(int,input().split())\ns=input()\na=[0]*n\n\nfor i in ...
['Wrong Answer', 'Accepted']
['s364208175', 's090101830']
[105140.0, 7748.0]
[2104.0, 866.0]
[237, 185]
p03087
u373047809
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['n, q = map(int, input().split())\ns = input()\nt = [0] * n\nfor i in range(n):\n t[i + 1] = t[i] + (1 if s[i:i+2] == "AC" else 0)\nfor _ in range(q):\n l, r = map(int, input().split())\n print(t[r-1] - t[l-1])', '#!/usr/bin/env python3\nn, q = map(int, input().split())\ns = input()\nt = [0] * -~n\nfor i in r...
['Runtime Error', 'Accepted']
['s870755968', 's323578416']
[7108.0, 7748.0]
[64.0, 868.0]
[211, 236]
p03087
u373529207
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 = [0 for i in range(N)]\nT = ""\nfor i in range(len(S)):\n c = S[i]\n if c == \'A\':\n A = True\n elif A and c == \'C\':\n x[i] += 1\n A = False\n else:\n A = False\n T += c\ns = [0 for i in range(N+1)]\nfor i in range(N):...
['Runtime Error', 'Accepted']
['s699784894', 's262198674']
[9956.0, 8540.0]
[939.0, 913.0]
[484, 463]
p03087
u374051158
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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(N)]\n\nfor lr_ in lr:\n l, r = lr_[0], lr_[1]\n \n print(S[l - 1: r].count('AC'))", "n, q = map(int, input().split())\ns = input()\ndp = [0 for _ in range(len(s))]\n\nfor i in range(1, len(s)):\n if(s[i-1: ...
['Runtime Error', 'Accepted']
['s246105853', 's369577966']
[29788.0, 6160.0]
[2105.0, 885.0]
[183, 265]
p03087
u374671031
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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())\nLsub = [0] * N\nRsub = [0] * N\nL = 0\nR = 0\n\n\nfor k in range(1,N):\n if SS[k-1] == "A" and SS[k] == "C":\n L += 1\n Lsub[k] = L\n\nfor j in (0,N-1)[::-1]:\n if SS[j] == "A" and SS[j+1] == "C":\n R += 1\n Rsub[j] = R\n\n\nfor i in range(Q):\n L, R = ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s157409460', 's189285386', 's383534903', 's992024762']
[5620.0, 5620.0, 5620.0, 9256.0]
[21.0, 22.0, 21.0, 914.0]
[364, 424, 375, 365]
p03087
u375006224
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\na=[0]\nfor i in range(1,n+1):\n if c[i]=="C" and c[i-1]=="A":\n a.append(a[i-1]+1)\n else:\n a.append(a[i-1])\nfor i in range(q):\n l,r=list(map(int,input().split()))\n print(a[r]-a[l])', 'n,q=list(map(int,input().split()))\ns=" "+input()\na=[0]\nfor i in r...
['Runtime Error', 'Accepted']
['s497854804', 's404125249']
[3188.0, 6220.0]
[17.0, 909.0]
[236, 236]
p03087
u375172966
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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.readlines()\nn,q = map(int,input().split())\ns = input()\nl = []\nr = []\ncnt = []\nfor i in range(q):\n _l,_r = [int(i) for i in input().split()]\n l.append(_l)\n r.append(_r)\nfor i in range(q):\n cnt.append(s[l[i]-1:r[i]].count('AC'))\nfor i in range(len(cnt)):\n print(...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s512619448', 's787347383', 's855944138', 's819395809']
[10484.0, 10484.0, 3064.0, 7916.0]
[29.0, 29.0, 17.0, 283.0]
[312, 312, 348, 246]
p03087
u379959788
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['# ABC122-C\nimport numpy as np\nN, Q = map(int, input().split())\nS = input()\nlr = [list(map(int, input().split())) for _ in range(Q)]\nind = []\nfor i in range(N-1):\n if S[i] == "A" and S[i+1] == "C":\n ind.append(i+1)\nprint(ind)\nind = np.array(ind)\nprint(ind)\nfor i in range(Q):\n print(np.count_n...
['Wrong Answer', 'Accepted']
['s394391672', 's002013225']
[39672.0, 30768.0]
[2110.0, 469.0]
[355, 373]
p03087
u382431597
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['n,q= list(map(int, input().split()))\nS=list(input())\n\nfor i in range(q):\n a,b=list(map(int, input().split()))\n counter=0\n \n for j in range(len(s)-1):\n if S[a-1:b][j] == "A":\n if S[a-1:b][j+1] == "C":\n counter +=1\n\n print(counter)', 'n,q=list(map(int, input().split()))\ns=input()\n\nt=[0...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s529754787', 's766267169', 's223997064']
[3956.0, 7488.0, 6084.0]
[19.0, 905.0, 901.0]
[248, 394, 395]
p03087
u385644001
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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())\ns=str(input())\n\nline = np.zeros([n,])\ncount = 0\nfor i in range(1,n):\n if (s[i-1:i+1]=="AC"): \n count += 1\n line[i]=count \n \nprint(line)\nfor i in range(q):\n l,r = map(int,input().split())\n target = line[r-1] - line[l-1]\n prin...
['Wrong Answer', 'Accepted']
['s031179737', 's348019480']
[14044.0, 14044.0]
[1208.0, 1192.0]
[316, 304]
p03087
u386089355
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 = [[int(_) for _ in input().split()] for _ in range(q)]\n\nflag = [0] * (n - 1)\n\nfor i in range(n - 1):\n\tif s[i:i+2] == 'AC':\n\t\tflag[i] = 1\n\t\nfor j in range(q):\n\tprint(sum(flag[ls[j][0] - 1:ls[j][1] - 2]))", "n, q = map(int, input().split())\ns = input()\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s251150531', 's822076298', 's060268113']
[23512.0, 25732.0, 24468.0]
[2105.0, 454.0, 440.0]
[251, 275, 263]
p03087
u386249594
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
["N,Q = input().split()\nQ = int(Q)\nS = input()\n\nlist1 = []\n\nfor i in range(Q):\n l,r = input().split()\n list1.append([int(l)-1,int(r)])\n print(list1)\n\nfor i in range(Q):\n print(S[list1[i][0]:list1[i][1]].count('AC'))\n", "N,Q = input().split()\nQ = int(Q)\nS = input()\n\nlist1 = []\n\nfor i in ra...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s026133226', 's063511971', 's570255440', 's951149036', 's986620396']
[81684.0, 3188.0, 107676.0, 7108.0, 8904.0]
[2104.0, 19.0, 2104.0, 314.0, 866.0]
[226, 298, 259, 218, 239]
p03087
u390883247
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\nQList = []\nData = [0]*N\nfor _ in range(Q):\n l,r = map(int,input().split())\n QList.append([l,r])\n\nCFound = False\nAFound = False\n\nfor i in range(N):\n if AFound == False:\n if S[i] == 'A':\n AFound = True\n else:\n if S[i] == 'C...
['Wrong Answer', 'Accepted']
['s646056108', 's321274361']
[24064.0, 25224.0]
[463.0, 538.0]
[549, 471]
p03087
u391731808
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 _ in range(Q)]\n\ncnt = [0]*N\ntmp = 0\nfor i,c in enumerate(S):\n if tmp == 0 and c == "A":\n tmp =1\n cnt[i] = cnt[i-1]\n elif tmp == 1 and c == "C":\n tmp =0\n cnt[i] = cnt[i-1]+1\n el...
['Runtime Error', 'Accepted']
['s455695602', 's562946817']
[161140.0, 30680.0]
[557.0, 478.0]
[425, 407]
p03087
u393481615
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 = []\nfor i in range(Q):\n lr.append(list(map(int, input().split())))\n\nfor idx in lr:\n sub = S[idx[0] - 1:idx[1]]\n cnt = sub.count("AC")\n print("cnt = {}, sub = {}".format(cnt, sub))\n print(str(cnt))\n', 'N, Q = map(int, input().split())\nS = inpu...
['Runtime Error', 'Accepted']
['s419154674', 's999627296']
[158832.0, 30636.0]
[1125.0, 507.0]
[261, 333]
p03087
u395202850
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\nsACList = [0] * (n-1)\nfor i in range(n-1):\n if s[i:i+2] == "AC":\n sACList[i] = 1\nprint(sACList)\nfor j in range(q):\n l, r = map(int, input().split())\n print(sum(sACList[l-1:r-1]))', "import math\nimport sys\nimport collections\nimport bisect\nreadli...
['Wrong Answer', 'Accepted']
['s396501327', 's156314984']
[5688.0, 29860.0]
[2104.0, 202.0]
[239, 548]
p03087
u398983698
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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=[0]*(n+1)\na[0]=0\nfor i in range(n):\n if s[i:i+2]=="AC":\n a[i+1]=a[i]+1\n else:\n a[i+1]=a[i]+0\nb=[0]*q\nc=[0]*q\nfor i in range(q):\n b[i],c[i]=map(int,input().split())\n print(int(a[c[i-1]]-a[b[i-1]]))', 'n,q=map(int,input().split())\ns=s...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s244323279', 's801855456', 's785408851']
[15520.0, 15600.0, 7748.0]
[919.0, 901.0, 876.0]
[268, 266, 240]
p03087
u401452016
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
["#ABC122C\ndef main():\n import sys\n S = sys.stdin.readline().rstrip()\n #print(S)\n cnt = 0\n ans = 0\n for s in S:\n if s in ['A', 'G', 'C', 'T']:\n cnt +=1\n else:\n ans = max(ans, cnt)\n cnt=0\n \n ans = max(ans, cnt)\n print(ans) \n ...
['Wrong Answer', 'Accepted']
['s608631821', 's648606813']
[3060.0, 21548.0]
[17.0, 299.0]
[372, 483]
p03087
u401686269
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\nindices=[0]*(N+1)\nfor i in range(1,N+1):\n if S[i-1:i+1]=='AC':\n indices[i] += indices[i-1] + 1\n else:\n indices[i] += indices[i-1]\n\nprint(indices)\nfor i in range(Q):\n l,r=lr[i]\n print(indices[r-1]-in...
['Wrong Answer', 'Accepted']
['s451915828', 's947801619']
[32600.0, 31204.0]
[331.0, 321.0]
[315, 300]
p03087
u403551852
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\ndata = [0] * (N+1)\nfor i in range(N):\n data[i+1] = data[i] + (1 if S[i:i+2] == 'AC' else 0)\nfor i in range(Q):\n l, r =map(int, input().split())\n print(data[r-1] - t[l-1])\n", "N, Q = map(int, input().split())\nS = input()\ndata = [0] * (N+1)\nfor i in range...
['Runtime Error', 'Runtime Error', 'Accepted']
['s311063963', 's615857783', 's439411354']
[7108.0, 7108.0, 7748.0]
[58.0, 65.0, 878.0]
[225, 222, 228]
p03087
u403984573
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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]\nres=0\nfor i in range(N-1):\n A.append(S[i:i+1].count("AC"))\nfor i in range(Q):\n l,r=map(int,input().split())\n print(A[r-1]-A[l-1])\n', 'N,Q=map(int,input().split())\nS=input()\nfor i in range(N):\n A.append(S[0:i+1].count("AC"))\nfor i in range(Q):\n l,r=map(in...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s051333170', 's281595756', 's590809315', 's908980712']
[4228.0, 3188.0, 3188.0, 6100.0]
[847.0, 18.0, 17.0, 851.0]
[178, 163, 169, 251]
p03087
u405256066
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\nN,Q=[int(x) for x in stdin.readline().rstrip().split()]\nS=(stdin.readline().rstrip())\nfor i in range(Q):\n n1,n2=[int(x) for x in stdin.readline().rstrip().split()]\n print(S[n1-1:n2])', 'from sys import stdin\nN,Q=[int(x) for x in stdin.readline().rstrip().split()]\nS=(stdin.readline()...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s166886943', 's325202663', 's412257665']
[134504.0, 4508.0, 6364.0]
[214.0, 297.0, 298.0]
[210, 205, 421]
p03087
u406755737
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\ndef solve1():\n N, Q = map(int, input().split())\n # print(N, Q)\n acgt_string = input()\n sub_str_ith = []\n for _ in range(Q):\n start, end = map(int, input().split())\n sub_str_ith.append((start, end))\n\n t = [0] * (N)\n for i in range(N):\n t[i+1] = t[i] + (...
['Runtime Error', 'Accepted']
['s977249034', 's263321476']
[20876.0, 21532.0]
[325.0, 402.0]
[1038, 1040]
p03087
u415154163
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\ncount_sum_list = [0]*(N+1)\nstart_A_pointa = [0]*(N+1)\n\nfor i in range(1,N+1):\n if i != N and S[i-1] == 'A' and S[i] == 'C':\n count_sum_list[i] = count_sum_list[i-1] + 1\n start_A_pointa[i] = 1\n else:\n count_sum_list[i] = count_sum_lis...
['Wrong Answer', 'Accepted']
['s222941253', 's692592538']
[12248.0, 11104.0]
[449.0, 439.0]
[627, 628]
p03087
u416758623
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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] + (1if s[i:i+2] == "AC" else 0)\n \nfor i in range(q):\n l,r = map(int, input().split())\n print(t[r-1] - t[l-1])', 'n,q = map(int, input().split())\ns = input()\n\nt = [0] * (n +1)\nfor i in range(n):\n ...
['Runtime Error', 'Accepted']
['s817499966', 's340877505']
[3956.0, 7748.0]
[18.0, 859.0]
[215, 217]
p03087
u419963262
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\nkeep = [0]*(n)\n\nfor i in range(1, n):\n keep[i] = keep[i-1]\n l, r = i-1, i+1\n if s[l:r] == "AC":\n keep[i] += 1\nprint(keep)\n\nfor j in range(q):\n l, r = map(int, input().split())\n print(keep[r-1]-keep[l-1])\n', 'n, q = map(int, input().split...
['Wrong Answer', 'Accepted']
['s126243746', 's141397706']
[12620.0, 11536.0]
[492.0, 486.0]
[271, 259]
p03087
u422886513
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\n\nAC_list = [0] * N\n\nfor i in range(N-1):\n if(S[i+1]=="C"):\n if(S[i]=="A"):\n AC_list[i+1] = 1\n\nfor j in range(Q):\n l, r = (int(i) for i in input().split())\n print(sum(AC_list[l-1: r]))\n\n', 'N, Q = (int(i) for i in input().spl...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s607506608', 's777233809', 's794691422', 's925255795']
[5384.0, 5572.0, 5572.0, 6188.0]
[2104.0, 46.0, 47.0, 993.0]
[265, 352, 352, 482]
p03087
u425177436
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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, 0]\nc = 0\nfor i in range(1,N):\n if S[i-1:i+1] == "AC":\n c += 1\n A.append(c)\nprint(A)\nfor _ in range(Q):\n l, r = map(int, input().split())\n print(A[r]-A[l])', 'N, Q = map(int, input().split())\nS = input()\nA = [0, 0]\nc = 0\nfor i in ra...
['Wrong Answer', 'Accepted']
['s695187166', 's368045826']
[7596.0, 6176.0]
[860.0, 847.0]
[226, 217]
p03087
u426108351
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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]\nfor i in range(len(s)):\n if s[i] == 'A' and s[i] == 'C':\n ac.append(ac[i]+1)\n else:\n ac.append(ac[i])\nfor i in range(q):\n l, r = map(int, input().split())\n print(ac[r-1]-ac[l-1])\n ", "n, q = map(int, input().split())\ns = input()\nac = [0]\nf...
['Wrong Answer', 'Accepted']
['s172774936', 's064696281']
[4228.0, 6100.0]
[838.0, 872.0]
[245, 250]
p03087
u427485170
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 os, sys, re, math\n\n(N, Q) = [int(n) for n in input().split()]\nS = input()\n\noc = []\nfor i in range(len(S) - 1):\n if S[i:i+2] == 'AC':\n oc.append(i)\n\nfor i in range(Q):\n (l, r) = [int(n) for n in input().split()]\n print('')", "import os, sys, re, math\n\n(N, Q) = [int(n) for n in inpu...
['Wrong Answer', 'Accepted']
['s776393585', 's743471342']
[5460.0, 6332.0]
[830.0, 879.0]
[244, 295]
p03087
u431981421
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 n in range(Q)]\n\nt = [0] * len(S)\n\nfor index, s in enumerate(S):\n if index+1 > len(S)-1:\n break\n\n if s == 'A' and S[index+1] == 'C':\n t[index+1] = t[index] + 1\n \n else:\n t[index+1] = t[index]\n \nprin...
['Wrong Answer', 'Accepted']
['s946701339', 's597937164']
[31800.0, 30668.0]
[478.0, 477.0]
[353, 339]
p03087
u432356156
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 have_AC(str):\n count=0\n for i in range(len(str)-1):\n if(str[i:i+1]=="AC"):\n count=count+1\n return count\n\nn,q=input().split() \ns=input() \nn=int(n)\nq=int(q)\nnum=[]\n\nfor i in range(q):\n a,b=input().split()\n a=int(a) -1\n b=int(b)\n num.append(have_AC(s[a:b]))\n\n...
['Wrong Answer', 'Accepted']
['s131989664', 's523914532']
[3188.0, 10304.0]
[2104.0, 383.0]
[392, 482]
p03087
u436982376
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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]-t[l-1])', "n,q=map(int,input().split())\ns=list(input())\nans_list=[]\nlength=[]\n\nfor i in range(q):\n ans=0\n l,r=map(int,inp...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s377971231', 's949042117', 's192351535']
[3956.0, 60356.0, 8436.0]
[19.0, 2104.0, 881.0]
[188, 323, 256]
p03087
u437351386
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\nn,q=list(map(int,input().split()))\ns=list(input())\nl=[0]*q\nr=[0]*q\nfor i in range(q):\n l[i],r[i]=list(map(int,input().split()))\nA=[]\nfor i in range(n-1):\n if s[i]=="A" and s[i+1]=="C":\n A.append(1)\n else:\n A.append(0)\ncheck=[0]+A+[0]\ncheck=list(accumulate(check)...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s467839649', 's535924604', 's759150098']
[17808.0, 5620.0, 23116.0]
[480.0, 21.0, 312.0]
[359, 332, 403]
p03087
u437638594
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 = [list(map(int, input().split())) for q in range(Q)]\n\n\n\nwhere_ac = [0] * N\n\nfor i in range(N-1):\n print(i)\n if S[i] == 'A' and S[i+1] == 'C':\n where_ac[i+1] += 1\n\ncount = [sum(where_ac[0:i+1]) for i in range(N)]\n\nfor lr in lr_list:\n ...
['Wrong Answer', 'Accepted']
['s589901238', 's207236124']
[31616.0, 6060.0]
[2105.0, 854.0]
[462, 304]
p03087
u440161695
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['N,Q=map(int,input().split())\ns=input()\nfor i in range(Q):\n l,r=map(int,input().split())\n print(s[l-1:r].count("AC")', '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[i]+=1\nfor i in range(Q):\n l,r=map(int,input().split())\n...
['Runtime Error', 'Accepted']
['s729937348', 's341611546']
[2940.0, 9236.0]
[17.0, 911.0]
[117, 217]
p03087
u442030035
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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().rstrip().split())\nS = [i for i in input()]\n\nfor i in range(len(S)-1):\n if S[i] == 'A' and S[i+1] == 'C':\n S[i], S[i+1] = 2, -1\n else:\n if type(S[i]) != int:\n S[i] = 0\n\nif type(S[-1]) == str:\n S[-1] = 0\n\nprint(S)\n\nlist_lr = [map(int, input().rstr...
['Wrong Answer', 'Accepted']
['s839143330', 's601724069']
[132816.0, 6060.0]
[2107.0, 846.0]
[656, 268]
p03087
u451017206
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\nac = [0] * N\nfor i in range(N-1):\n if S[i:i+2] == 'AC':\n ac[i] = 1\n\nac = [0] + ac\nacc = list(accumulate(ac))\nprint(ac)\nprint(acc)\nfor i in range(Q):\n l, r = map(int, input().split())\n print(acc[r-1] - acc[l-1...
['Wrong Answer', 'Accepted']
['s800348142', 's682555298']
[10724.0, 9188.0]
[867.0, 862.0]
[305, 285]
p03087
u452913314
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\nlr = []\nfor _ in range(Q):\n lr.append(list(map(int,input().split(' '))))\n\nindex_list = []\n#index_list = [0] * N\nstart = 0\nfor i in range(N):\n if S[i-1] == 'A' and S[i] == 'C':\n start += 1\n #index_list[i] = index_list[i-1] + 1\n #else:\...
['Wrong Answer', 'Accepted']
['s458820266', 's358249567']
[31872.0, 30612.0]
[502.0, 471.0]
[452, 434]
p03087
u454524105
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\ns = [s[i] for i in range(n)]\nlr = []\nfor i in range(q):\n lr.append([int(x) for x in input().split()])\nac = [0 for _ in range(n)]\ni, c = 0, 0\nwhile i < n:\n if s[i] == "A":\n ac[i] = c\n i += 1\n if s[i] == "C":\n c += 1...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s268640955', 's609149914', 's632275817']
[26424.0, 26340.0, 25132.0]
[491.0, 489.0, 486.0]
[528, 477, 390]
p03087
u456566864
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\nn, q = stdin.readline().split()\ns = stdin.readline().strip()\ncount = 0\nfor i in range(q):\n l, r = map(int, stdin.readline().split())\n for j in range(l-1, r-1):\n if s[j] + s[j+1] == 'AC':\n count += 1\n \n print(count)\n", "from sys import stdin\n\nn, q = map(int, stdin.rea...
['Runtime Error', 'Accepted']
['s567162292', 's133403620']
[3188.0, 6368.0]
[17.0, 289.0]
[253, 328]
p03087
u459590249
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 bisect import bisect\n\nn,q=map(int,input().split())\ns=input()\nl=[]\nr=[]\nfor i in range(q):\n\tL,R=map(int,input().split())\n\tl.append(L)\n\tr.append(R)\n\na=[]\nc=[]\nfor i in range(n-1):\n\tif s[i:i+2]=='AC':\n\t\ta.append(i)\n\t\tc.append(i)\n\nfor i in range(q):\n\tprint(bisect(c,r[i])-bisect(a,l[i])+1)...
['Wrong Answer', 'Accepted']
['s875142960', 's360859047']
[14244.0, 15832.0]
[553.0, 564.0]
[290, 312]
p03087
u462976050
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\nr=list()\nfor i in range(Q):\n L,R=map(int, input().split())\n S2=S[L-1:R].split("AC")\n print(S[L-1:R])\n print(len(S2)-1)', 'N, Q = map(int, input().split())\nS=list(input())\nSnum=list()\nSnum.append(0)\nSnum.append(0)\nfor i in range(1,N):\n if S[i]=="C"...
['Runtime Error', 'Accepted']
['s369931988', 's787592127']
[135440.0, 6876.0]
[1990.0, 825.0]
[174, 279]
p03087
u466143662
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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())\na=input()\n\nlist=[0]*N\n\nfor i in range(N):\n list[i+1]=list[i]+1 if a[i:i+2]=="AC" else list[i]\n \nfor i in range(N):\n l,r = map(int, input().split())\n print(list[r-1]-list[l-1])\n ', 'N, Q = map(int, input().split())\na=input()\n\nlist=[0]*N+1\n\nfor i in range(...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s003675793', 's466468949', 's910165182', 's576689996']
[5548.0, 3956.0, 38768.0, 6060.0]
[60.0, 18.0, 223.0, 889.0]
[225, 227, 168, 229]
p03087
u466331465
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\nfrom collections import Counter\nimport collections\nimport numpy as np \nfrom scipy import sqrt, power, exp, log10\nfrom scipy.fftpack import fft, ifft, fftfreq\nimport tarfile\nimport re\nimport os\nimport glob\nfrom datetime import datetime\nimport time\nimport numpy.linalg as LA\n\nround = lam...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s045283225', 's286814780', 's772131841', 's979559220', 's815809990']
[15700.0, 2940.0, 13496.0, 15192.0, 15816.0]
[2108.0, 17.0, 165.0, 167.0, 1409.0]
[577, 489, 483, 488, 274]
p03087
u470560351
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 \n#ac = [1 if S[i] == 'A' and S[i+1] == 'C' else 0 for i in range(N-1) ]\na = 0\nlst = [0]\nfor i in range(1, N):\n if S[i-1] == 'A' and S[i] == 'C':\n a += 1\n lst.append(a)\nprint(lst)\nfor _ in range(Q):\n l, r = map(int, input().split())\n print(lst[r-1]...
['Wrong Answer', 'Accepted']
['s184422079', 's657811832']
[7520.0, 6100.0]
[863.0, 860.0]
[317, 306]
p03087
u471181540
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 itertools\nn,q = map(int, input().split())\ns = input()\ncalc = [0]*n\nprev = None\nfor i,c in enumerate(s):\n if prev == 'A' and c == 'C':\n calc[i] = 1\n prev = c\ncalc = list(itertools.accumulate(calc))\nprint(calc)\nfor _ in range(q):\n l,r = map(int,input().split())\n print(calc[r-1]-ca...
['Wrong Answer', 'Accepted']
['s816642826', 's513974561']
[9592.0, 7944.0]
[860.0, 860.0]
[313, 301]
p03087
u472696272
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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())\nmark = [0]*(n+1)\nfor i in range(2,n+1):\n if s[i-2]=='A' and s[i-1]=='C':\n mark[i] = mark[i-1]+1\n else:\n mark[i] = mark[i-1]\nprint(mark)\nfor i in range(q):\n l,r = map(int,input().split())\n l = l-1\n r = r-1\n print(mark[r+1]-mark[l+1])", "n,q = ma...
['Wrong Answer', 'Accepted']
['s367753122', 's133198910']
[8336.0, 6876.0]
[889.0, 886.0]
[293, 281]
p03087
u475675023
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['N,Q=map(int,input().split())\nS=input()\na=[0]*N\nfor i in range(N-1):\n a[i+1]=a[i]+(1 if S[i:i+2]=="AC" else 0)\nfor i in range(Q):\n l,r=map(int,input().split())\n print(a[l-1]-a[r-1])\n', 'N,Q=map(int,input().split())\nS=input()\na=[0]*N\nfor i in range(N-1):\n a[i+1]=a[i]+(1 if S[i:i+2]=="AC" else 0)\nfor i ...
['Wrong Answer', 'Accepted']
['s444501580', 's546229956']
[7748.0, 9412.0]
[859.0, 885.0]
[184, 184]
p03087
u476124554
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
["N,Q = map(int,input().split())\nS = input()\nl,r = [],[]\nindex = []\nfor i in range(Q):\n tmp1,tmp2 = map(int,input().split())\n l.append(tmp1)\n r.append(tmp2)\ncounter = 0\nindex.append(counter)\nfor i in range(1,len(S)):\n if(S[i-1] == 'A' and S[i] == 'C'):\n counter += 1\n index.append(coun...
['Wrong Answer', 'Accepted']
['s192762598', 's305861973']
[15504.0, 14168.0]
[455.0, 450.0]
[412, 399]
p03087
u477977638
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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())\nli=[0]*n\n\nfor i in range(n):\n if i==0:\n continue\n if s[i-1]=="A" and s[i]=="T":\n li[i]=1\n\nfor i in range(q):\n l,r=map(int,input())\n tmp=li[l:r]\n print(sum(temp))\n', 'n,q=map(int,input().split())\ns=list(input())\nli=[0]*n\ncnt=0\nans=0\n\nfor i in ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s103193514', 's828688647', 's629756420']
[4724.0, 6340.0, 8308.0]
[41.0, 112.0, 856.0]
[218, 253, 256]
p03087
u478719560
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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#from collections import defaultdict, deque, Counter\n\n#import heapq\n#import math\n#from itertools import accumulate\n#from itertools import permutations as perm\n#from itertools import combinations as comb\n#from itertools import combinations_with_replacement as combr\n#from fractions import gcd\n#impo...
['Wrong Answer', 'Accepted']
['s773558751', 's571487519']
[7544.0, 6308.0]
[296.0, 271.0]
[1143, 1128]
p03087
u480200603
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\nflag = False\ncount = 0\nli = [0]\n\nfor i in s:\n if i == "A":\n flag = True\n if i == "C" and flag is True:\n count += 1\n flag = False\n li.append(count)\n print(li)\n\nfor i in range(q):\n l, r = map(int, input().split())\n prin...
['Runtime Error', 'Runtime Error', 'Accepted']
['s181115398', 's283041244', 's207486693']
[134516.0, 134388.0, 6128.0]
[2104.0, 2104.0, 822.0]
[318, 334, 353]
p03087
u484948364
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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())\nS = input()\nt = np.zeros(N+1)\nfor i in range(N):\n t[i+1] = t[i]+(1 if S[i-1:i+1]=='AC' else 0)\n\nfor i in range(Q):\n l, r = map(int, input().split())\n print(int(t[r]-t[l-1]))", "import numpy as np\n\nN, Q = map(int, input().split())\nS = input()\n...
['Wrong Answer', 'Accepted']
['s293452203', 's815560250']
[15416.0, 14004.0]
[1295.0, 1283.0]
[235, 233]
p03087
u486990800
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 itertools import accumulate\ninput = sys.stdin.readline \n\nN, Q = list(map(int, input().split()))\nS = input()\n\nl = [None]*Q\nr = [None]*Q\nfor i in range(Q):\n l[i], r[i] = list(map(int, input().split()))\n\ns = list(S)\nac = [0] * N\n\nfor i in range(N-1):\n if s[i] == \'A\':\n i...
['Wrong Answer', 'Accepted']
['s806128192', 's861275048']
[13532.0, 17588.0]
[303.0, 315.0]
[516, 463]
p03087
u489762173
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\n\ndef main():\n N, Q = map(int, input().split())\n S = list(input().rstrip())\n\n dec_a = [0] * (N)\n for x in range(1, N):\n if S[x] == 'C' and S[x-1] == 'A':\n S[x-1] = 'a'\n dec_a[x] = S[:x+1].count('a')\n\n\n L = [0] * Q\n R = [0] ...
['Wrong Answer', 'Accepted']
['s317498789', 's742486929']
[5364.0, 6356.0]
[2104.0, 250.0]
[470, 381]
p03087
u490489966
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\ndef f(x):\n return int(x) - 1\n\nn, 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])', '#C\ndef f(x):\n return int(x) -...
['Wrong Answer', 'Accepted']
['s898581943', 's959888946']
[9152.0, 7748.0]
[873.0, 884.0]
[268, 270]
p03087
u492447501
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\nQuery = []\nfor _ in range(Q):\n l,r = map(int, input().split())\n Query.append([l, r])\n\nA = [0]*N\nfor i in range(N-1):\n if S[i]=="A" and S[i+1]=="C":\n A[i] = 1\nprint(A)\ns = [0]*(N+1)\nfor i in range(N):\n s[i+1] = s[i] + A[i]\n\nfor l,r in Que...
['Wrong Answer', 'Accepted']
['s488740558', 's642930297']
[25592.0, 25228.0]
[468.0, 463.0]
[330, 321]
p03087
u494058663
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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.append(0)\npar = [0]*(N+1)\nAns = []\nfor i in range(N):\n par [i+1]=par[i]+(1 if (S[i]=='A') & (S[i+1]=='C') else 0)\n print(par)\nfor i in range(Q):\n x,y = map(int,input().split())\n print(par[y]-par[x-1])\n \n", "n,q = map(in...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s022656786', 's484379688', 's591833224']
[108116.0, 13404.0, 12336.0]
[2104.0, 498.0, 482.0]
[306, 429, 420]
p03087
u500783798
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 = int(input().split()[1])\ns = input()\nfor i in range(n):\n l, r = map(int, input().split())\n ls = [len(i) for i in re.findall('AC', s[l-1: r])] + [0]\n print(max(ls))\n", "import re\nn = int(input().split()[1])\ns = input()\n\ncounts = [0]\nfor i in range(len(s)):\n counts.append(counts[i] + (1 if...
['Wrong Answer', 'Accepted']
['s950201671', 's195925392']
[7700.0, 7916.0]
[2104.0, 864.0]
[180, 245]
p03087
u501952592
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 = list(map(int, input().split()))\nS = input()\nT = [list(map(int, input().split())) for _ in range(Q)]\n\nS = re.sub('[^AC]+', 'X', S)\nprint(S)\n\nfor i in range(Q):\n l, r = T[i][0], T[i][1]\n s = S[l-1:r]\n count = 0\n if r-l == 0:\n count = 0\n else:\n for j in range(r-l):\n if ...
['Runtime Error', 'Accepted']
['s187334551', 's763556985']
[30092.0, 30604.0]
[2109.0, 472.0]
[365, 369]
p03087
u502283124
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\nfrom sys import stdin\n\nN, Q = [int(x) for x in stdin.readline().rstrip().split()]\nS = stdin.readline().rstrip()\n\ndef func(Str):\n idx = Str.find("AC")\n return idx\n\ni = 0\nac_idx = []\nwhile i<N:\n a = func(S[i:])\n if a != -1:\n ac_idx.append(a+i)\n i = a+i+2\n else:\...
['Wrong Answer', 'Accepted']
['s190889543', 's894698457']
[15604.0, 6384.0]
[2108.0, 294.0]
[515, 342]
p03087
u503228842
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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())\nraw_list = list(input())\ndef count_ac(l,r):\n cnt = 0\n sliced_list = raw_list[l-1:r+1]\n for idx,char in enumerate(sliced_list):\n if idx == len(sliced_list)-1:\n break\n if sliced_list[idx] == "A":\n if sliced_list[idx+1] =="C":\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s077479709', 's317116889', 's353170199']
[5304.0, 5304.0, 6084.0]
[2104.0, 2104.0, 885.0]
[420, 515, 400]
p03087
u504053832
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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())\nfor i in range(q):\n l, r = map(int, input().split())\n ans = s[l - 1: r - 1].count('AC')\n print(ans)", "n, q = map(int, input().split())\ns = str(input())\nls = [list(map(int, input().split())) for i in range(q)]\nt = [0] * (n + 1)\nfor i in range(n):\n ...
['Wrong Answer', 'Accepted']
['s486613865', 's829156114']
[3444.0, 32216.0]
[2104.0, 499.0]
[158, 292]
p03087
u504562455
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 = [0] * q\nr = [0] * q\nans = ""\ntable = [1 if s[i:i+2] == "AC" else 0 for i in range(n)] \nfor i in range(q):\n l[i], r[i] = [int(j) for j in input().split()]\n ans = ans+str(sum(table[l[i]-1:r[i]-1]))+"\\n"\nprint(ans)', 'n, q = [int(i) for i in input()....
['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s091209426', 's330821912', 's770743401', 's441880189']
[7428.0, 9108.0, 5040.0, 6060.0]
[2104.0, 2104.0, 2104.0, 874.0]
[272, 219, 302, 256]
p03087
u504836877
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 = []\nfor i in range(Q):\n L.append([int(a) for a in input().split()])\n\nTemp = [0 for i in range(N)]\nnum = 0\nac = 0\nwhile num <= N-2:\n if S[num] == "A" and S[num+1] == "C":\n Temp[num] = ac\n Temp[num+1] = ac\n num += 2\n ac += 1\...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s249016695', 's665603417', 's699992555', 's959915033']
[26460.0, 3064.0, 27304.0, 9332.0]
[480.0, 18.0, 496.0, 840.0]
[485, 548, 580, 258]
p03087
u505830998
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 io_generator():\n\treturn input()\n\n#+++++++++++++++++++\n\ndef main(io):\n\tn,q=map(int, io().split())\n\ts=list(io())\n\t\n\tss=[0 for _ in s]\n\tsss=ss.copy()\n\tfor i, c in enumerate(s[1:]):\n\t\tif s[i-1]==\'A\' and s[i]==\'C\':\n\t\t\tss[i]=1\n\t\tsss[i] = ss[i] + sss[i-1]\n\t\n...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s110511508', 's227720710', 's274847571', 's330655629', 's489489558', 's893637516', 's737362287']
[9496.0, 5768.0, 5876.0, 5656.0, 6216.0, 5656.0, 9496.0]
[886.0, 2104.0, 1915.0, 1968.0, 1916.0, 1968.0, 870.0]
[526, 483, 482, 508, 493, 506, 529]
p03087
u506287026
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\ntmp = [0] * N\nfor i in range(1, N):\n if S[i-1] + S[i] == 'AC':\n tmp[i] += 1\n\nfor _ in range(Q):\n l, r = map(int, input().split())\n # print(tmp[l-1:r])\n print(sum(tmp[l-1:r]))\n", "N, Q = map(int, input().split())\nS = input()\nl_r_list = [[int(...
['Wrong Answer', 'Accepted']
['s981264266', 's939375408']
[5384.0, 24400.0]
[2104.0, 457.0]
[239, 273]
p03087
u506910932
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 = input()\nt = [0] * (N + 1)\nfor i in range(N):\n\tt[i + ...
['Wrong Answer', 'Accepted']
['s315914697', 's125269806']
[13064.0, 13040.0]
[210.0, 484.0]
[211, 213]
p03087
u512007680
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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] * q\nr = [0] * q\n\nfor i in range(0,q):\n l[i], r[i] = map(int,input().split())\n l[i] = l[i] -1\n r[i] = r[i] -1\n\ns_list = list(s)\n\nac_list = [0] * (n-1)\n\nfor i in range(0,n-1):\n if s_list[i] == "A" and s_list[i+1] == "C":\n ac_list[i...
['Runtime Error', 'Accepted']
['s307929802', 's370288535']
[3064.0, 17412.0]
[17.0, 478.0]
[328, 535]
p03087
u513844316
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
["N,Q=map(int,input().split())\nS=input()\n\nc=0\ns=[0]\nfor i in range(1,N):\n if S[i-1]=='A' and S[i]=='C':\n c+=1\n s.append(c)\n\n print(s)\n \nfor i in range(Q):\n l,r=map(int,input().split())\n out=s[r-1]-s[l-1]\n\n print(out)", "N,Q=map(int,input().split())\nS=input()\n\nc=0\ns=[0]\nf...
['Runtime Error', 'Accepted']
['s536712742', 's625570471']
[134516.0, 6100.0]
[2104.0, 848.0]
[242, 229]
p03087
u513900925
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\nm = list(map(int,input().split for i in range(q)))\ncount = [0]*(N+1)\n\nfor i in range(n):\n if S[i:i+2] == 'AC':\n comu[i+1] = comu[i] + 1\n else:\n comu[i+1] = comu[i]\n\nfor l,r in list:\n print(count[r-1]-count[l-1])\n~\n", "n,q = map(int,inpu...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s038186596', 's194697492', 's319185463', 's329716653', 's407253883', 's665947309', 's877031002', 's934415523', 's570045791']
[3060.0, 27512.0, 3064.0, 3064.0, 3060.0, 3064.0, 27500.0, 3060.0, 30664.0]
[17.0, 327.0, 18.0, 18.0, 17.0, 17.0, 335.0, 18.0, 465.0]
[282, 283, 279, 283, 281, 283, 280, 280, 284]
p03087
u517152997
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['# -*- coding: utf-8 -*-\n# \nimport math\nimport sys\nimport itertools\nimport numpy as np\n\n\nn,q = map(int, input().split())\n\n\ns = list(input())\n\n\nx = [[int(i) for i in input().split()] for i in range(q)] \nc = [0]\n\n\n\ncount = 0\nfor i in range(1,n):\n if s[i-1] == "A" and s[i] == "C":\n count +...
['Wrong Answer', 'Accepted']
['s889737331', 's278185484']
[35420.0, 34108.0]
[1507.0, 1525.0]
[655, 656]
p03087
u517447467
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\nN, Q = list(map(int, input().split()))\nS = input()\nfor i in range(Q):\n l, r = list(map(int, input().split()))\n print(int(np.sum([1 for j in range(l-1, r-2) if S[j:j+2] == "AC"])))', 'import numpy as np\nN, Q = list(map(int, input().split()))\nS = input()\nfor i in range(Q):\n l, r = list(ma...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s042739072', 's109044183', 's169474640', 's295228814', 's451689630', 's453571691', 's544765464', 's687905383', 's783952334', 's893052280', 's895773400', 's938811204', 's985644310', 's297555236']
[15016.0, 15436.0, 14056.0, 2940.0, 15088.0, 14692.0, 14696.0, 14788.0, 20656.0, 16748.0, 16168.0, 15128.0, 2940.0, 15804.0]
[2108.0, 2109.0, 1048.0, 17.0, 2109.0, 2108.0, 2109.0, 2108.0, 2108.0, 2109.0, 2109.0, 2108.0, 17.0, 1089.0]
[200, 198, 205, 173, 203, 193, 198, 205, 205, 213, 208, 198, 192, 240]
p03087
u518042385
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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=map(int,input().split())\nl=list(input())\ncount=0\nclist=[0]\nfor i in range(1,n):\n if l[i-1]=="A" and l[i]=="C":\n count+=1\n clist.append(count)\nfor i in range(m):\n i1,i2=map(int,input().split())\n if l[i1-1]=="C" and l[i1-2]=="A":\n ans=clist[i2-1]-clist[i1-1]-1\n else:\n ans=clist[i2-1]-clis...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s422689017', 's487153770', 's701665768', 's799979104', 's910219268']
[6872.0, 8460.0, 6872.0, 6900.0, 6872.0]
[887.0, 879.0, 892.0, 857.0, 911.0]
[325, 235, 359, 234, 360]
p03087
u518987899
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\n_ = input()\nS = input().strip()\nidx = [i+1 for i in range(len(S)-1) if S[i:i+2] == 'AC']\nprint(idx)\n\nfor line in sys.stdin:\n l,r = list(map(int, line.strip().split(' ')))\n print(sum([1 for i in idx if l <= i <= r-1]))", "import sys\n_ = input()\nS = input().strip()\n\nps = [0]*(len(S)+1)\nfor i...
['Wrong Answer', 'Accepted']
['s878867743', 's564602199']
[6244.0, 7964.0]
[2104.0, 302.0]
[231, 219]
p03087
u519968172
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['n,q=map(int,input().split())\ns=input()\nd=[0]*(n+1)\nfor i in range(1,n):\n if s[i]=="C" and s[i-1]=="A":\n d[i]=d[i-1]+1\n else:\n d[i]=d[i-1]\nd[n-1]=d[n-2]\nprint(d)\nfor j in range(q):\n l,r=map(int,input().split())\n print(d[r-1]-d[l-1])\n', 'n,q=map(int,input().split())\ns=input()\nd=[0]*(n+1)\nfor i...
['Wrong Answer', 'Accepted']
['s825964105', 's750868778']
[12628.0, 11444.0]
[485.0, 480.0]
[242, 220]
p03087
u522726434
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['N, Q = list(map(int, input().split()))\nS = input()\n\ndef gen_idx_list(S):\n result_list = []\n for i in range(len(S) - 1):\n if S[i] == "A" and S[i+1] == "C":\n result_list.append(i+1)\n return result_list\n\nidx_list = gen_idx_list(S)\nprint(idx_list)\n\nfor _ in range(Q):\n l, r = list(map(int, input(...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s087702829', 's858936133', 's978234745']
[6244.0, 6164.0, 9540.0]
[2104.0, 2104.0, 900.0]
[371, 373, 297]
p03087
u524287956
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 for i in range(q)]\nr = [ 0 for i in range(q)]\nfor i in range(q):\n _l,_r = map(int,input().split())\n l[i] = _l\n r[i] = _r\n\ncounter = 0\nlis = [0]*len(s)\nfor i in range(len(s)-1):\n if s[i:i+2] == 'AC':\n counter+=1\n lis[i+1]=counter\np...
['Wrong Answer', 'Accepted']
['s786675954', 's497008392']
[15516.0, 14260.0]
[442.0, 420.0]
[362, 351]
p03087
u524870111
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\nstdin = sys.stdin\n\nmod = 10**9 + 7\n\nns = lambda: stdin.readline().rstrip()\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\n\nn, q = na()\ns = ns()\nac = [0]\nnow = 0\nf = False\nfor si in s:\n if si == "C" and f:\n now += 1\n f = False\n elif si == "...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s613599470', 's864570056', 's680747826']
[6332.0, 6336.0, 6336.0]
[327.0, 323.0, 338.0]
[429, 443, 449]
p03087
u525227429
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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_list = []\ncnt = 0\nfor i in range(N):\n if i != 0 and S[i - 1] == "A" and S[i] == "C":\n cnt += 1\n AC_list.append(cnt)\nprint(AC_list)\nfor _ 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()...
['Wrong Answer', 'Accepted']
['s809556212', 's007030802']
[7524.0, 6104.0]
[873.0, 869.0]
[279, 265]
p03087
u527261492
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
["n,q=map(int,input().split())\ns=input()\nt=[0]*n\nfor i in range(n):\n t[i+1]=t[i]+(1 if s[i:i+2]=='AC' else 0)\nfor j in range(q):\n l,r=map(int,input().split())\n print(t[r-1]-t[l-1])\n \n \n\n \n", "n,q=map(int,input().split())\ns=input()\nt=[]\nfor i in range(n-1):\n if t[i:i+2]=='AC':\n t.append(1)...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s006084073', 's436907138', 's546734850', 's632424383', 's786203305', 's816872271', 's943431541', 's481965947']
[7108.0, 5392.0, 5392.0, 5340.0, 6064.0, 5392.0, 5340.0, 7748.0]
[60.0, 2108.0, 2104.0, 2104.0, 853.0, 2104.0, 2104.0, 864.0]
[196, 213, 213, 213, 266, 213, 205, 200]
p03087
u527867336
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\nmemo = []\n\ndef main():\n N,Q = map(int,input().split())\n S = input()\n for i in range(N-1):\n if S[i:i+2] == "AC":\n memo.append(i)\n print(memo)\n for i in range(Q):\n li,ri = map(int,input().split())\n count = len(memo)\n \n start = -...
['Wrong Answer', 'Accepted']
['s794996390', 's699182339']
[6268.0, 6060.0]
[2104.0, 821.0]
[1092, 1825]
p03087
u528748570
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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())\nstr = input()\nlength = [list(map(int, input().split())) for _ in range(Q)]\n\nans = [0 for _ in range(N)]\nfor i in range(1, N):\n if (str[i-1] == "A")\n if (str[i] == "C"):\n ans[i] = ans[i-1] + 1\n else:\n ans[i] = ans[i-1]\n else:\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s467718531', 's864305705', 's224673597']
[2940.0, 30636.0, 30636.0]
[17.0, 472.0, 481.0]
[442, 443, 445]
p03087
u529012223
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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())\nS = input()\nac_array = np.zeros(N)\nans = []\n\nfor i in range(N):\n if S[i] == 'A' and S[i+1] == 'C':\n ac_array[i] += 1\n ac_array[i+1] += 1\n#print(ac_array)\nq_list = np.zeros([Q, 2])\nfor q in range(Q):\n q_list[q, 0], q_list[q, 1] = ma...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s275949299', 's311071003', 's534025523', 's564450489', 's700734658', 's756589370', 's064142716']
[15540.0, 15512.0, 3444.0, 3188.0, 7156.0, 11832.0, 21080.0]
[2108.0, 2108.0, 2104.0, 17.0, 63.0, 2104.0, 607.0]
[451, 450, 133, 130, 282, 212, 305]
p03087
u529180657
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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())\ncount = 0\nc_sum = [0]*n\nfor i in range(n-1):\n if s[i] == 'A' and s[i+1] == 'C':\n count += 1\n c_sum[i] = count\nprint(c_sum)\nfor i in range(q):\n print(c_sum[r[i]-2] - c_sum[l[i]-...
['Wrong Answer', 'Accepted']
['s392586158', 's571473096']
[15416.0, 14156.0]
[463.0, 427.0]
[307, 294]
p03087
u532966492
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\tl,r=map(int,input().split())\n\tprint(S[l:r+1].count("AC"))', 'N,Q=map(int,input().split())\nS="#"+input()+"#"\naccum=[0]\nfor i in range(1,N+1):\n\tif (S[i]=="A" and S[i+1]=="C") or (S[i-1]=="A" and S[i]=="C"):\n\t\taccum.append(accum[i-1]+1)\n\telse:\n\...
['Wrong Answer', 'Accepted']
['s792905000', 's853013737']
[3444.0, 7828.0]
[2104.0, 907.0]
[116, 297]
p03087
u533232830
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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]*(n)\n\nplus = 0\nfor i in range(n-1):\n if s[i:i+2] == "AC":\n plus += 1\n cnt[i+1] = plus\nprint(cnt)\n\nfor j 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()\n\nc...
['Wrong Answer', 'Accepted']
['s872863922', 's826133168']
[7592.0, 6060.0]
[866.0, 863.0]
[250, 239]
p03087
u534953209
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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)]\nC = [0]*N\nfor i in range(1,N):\n\tif S[i-1] == 'A' and S[i] == 'C':\n\t\tC[i] = C[i-1] + 1\n\telse:\n\t\tC[i] = C[i-1]\nprint(C)\nfor i in range(Q):\n\tprint(C[L[i][1] - 1]- C[L[i][0] - 1])\n", "N, Q = map(int, in...
['Wrong Answer', 'Accepted']
['s367102315', 's378666865']
[31784.0, 30652.0]
[501.0, 478.0]
[277, 268]
p03087
u537782349
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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())\nc = input()\nd = [0] * len(c)\ne = 0\nfor i in range(1, len(c)):\n if c[i] == "C" and c[i-1] == "A":\n e += 1\n d[i] = e\nprint(d)\nfor i in range(b):\n f, g = map(int, input().split())\n print(d[g-1] - d[f-1])\n', 'a, b = map(int, input().split())\nc = input()\nd ...
['Wrong Answer', 'Accepted']
['s168691376', 's548061684']
[7488.0, 6084.0]
[857.0, 874.0]
[253, 231]
p03087
u538381753
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\nlr = [[int(x) for x in input().split(' ')] for _ in range(q)]\n\nindexes = []\nfor i in range(1, len(s)):\n if s[i-1] == 'A' and s[i] == 'C':\n indexes.append([i-1, i])\n\nprint('\\n'.join([len([x for x in indexes if l-1 <= x[0] and x[1] <= r-1]) for...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s162814914', 's398009658', 's246453180']
[30252.0, 25608.0, 24476.0]
[2105.0, 451.0, 438.0]
[323, 354, 338]
p03087
u538632589
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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_list = []\nr_list = []\nfor i in range(q):\n l, r = [int(i) for i in input().split()]\n l_list.append(l)\n r_list.append(r)\n\nac_map = [0 for i in range(n+1)]\nfor i in range(1, n+1):\n if s[i-1:i+1] == "AC":\n ac_map[i] = ac_map[i-1] +1\n ...
['Wrong Answer', 'Accepted']
['s684832909', 's424366903']
[15468.0, 14228.0]
[467.0, 490.0]
[444, 430]
p03087
u538774896
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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, os\nimport collections\n\ndef solve(input_stream):\n n, q = [int(char) for char in input_stream.readline().strip().split()]\n target = input_stream.readline().strip()\n ans = []\n\n dp = [0 for i in range(len(target) + 1)]\n is_a = False\n for index, char in enumerate(target):\n dp[index + 1] = d...
['Wrong Answer', 'Accepted']
['s514484709', 's339347117']
[12816.0, 12256.0]
[290.0, 282.0]
[700, 688]
p03087
u539874256
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['Q=input()\nS=input()\nN,Q_num = int(Q.split(" ")[0]),int(Q.split(" ")[1])\nAC=[]\nfor i in range(N):\n if N == i+1:\n AC.append(0)\n elif S[i]=="A" and S[i+1]=="C":\n AC.append(1)\n else:\n AC.append(0)\nprint(AC)\n \nfor q in range(int(Q_num)):\n qu = input().split(" ")\n print(sum(AC[int(qu[0])-1:i...
['Wrong Answer', 'Accepted']
['s528502688', 's959934313']
[5724.0, 6100.0]
[2104.0, 799.0]
[317, 277]
p03087
u540761833
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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 = input()\nlista = []\nfor j in range(N-1):\n if S[j:j+2] == 'AC':\n lista.append(j)\nprint(lista)\nfor i in range(Q):\n l,r = map(int,input().split())\n l,r = l-1,r-1\n lind = bisect.bisect_left(lista,l)\n rind = bisect.bisect_right(lista,r-1)\n ...
['Wrong Answer', 'Accepted']
['s682631051', 's419220672']
[6268.0, 5748.0]
[1036.0, 1056.0]
[324, 311]