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
u879674287
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\nimport itertools\n\n\ndef sr():\n return sys.stdin.readline().rstrip()\n\n\ndef ir():\n return int(sr())\n\n\ndef lr():\n return list(map(int, sr().split()))\n\n\nN, Q = lr()\nS = sr()\n\nac = [0] * (N - 1)\nfor i, x in enumerate(zip(S[:], S[1:])):\n if x[0] == 'A' and x[1] ==...
['Wrong Answer', 'Accepted']
['s332360502', 's949174680']
[13524.0, 19812.0]
[338.0, 385.0]
[580, 510]
p03087
u879870653
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['N,Q = map(int,input().split())\nS = input()\nL = [list(map(int,input().split())) for i in range(Q)]\n\nloc = [0 for i in range(N+1)]\nfor i in range(N) :\n if S[i:i+2] == "AC" :\n loc[i+1] = loc[i]+1\n else :\n loc[i+1] = loc[i]\nfor l,r in L :\n l -= 1\n r -= 1\n ans = loc[r] - loc[l]\n ...
['Wrong Answer', 'Accepted']
['s587729833', 's307658126']
[32764.0, 30808.0]
[510.0, 475.0]
[328, 318]
p03087
u881378225
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['n,q=map(int,input().split())\ns=input()\nac=[0]*(n-1)\nfor i in range(1,n-1):\n ac[i]=ac[i-1]+(s[i]=="A" and s[i+1]=="C")\nfor i in range(q):\n l,r=map(int,input().split())\n print(ac[r-1]-ac[l-1])', 'n,q=map(int,input().split())\ns=input()\nac=[0]*(n-1)\nfor i in range(n-1):\n ac[i]=(s[i]=="A" and s[i+1]=="C")\n...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s472889104', 's633870254', 's364379908']
[7156.0, 5384.0, 7668.0]
[113.0, 2104.0, 858.0]
[193, 215, 178]
p03087
u882370611
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
["n, q = map(int, input().split())\ns = input()\n\nfor i in range(q):\n l, r = map(int, input().split())\n print(s[l, r+1].count('AC')", "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, ...
['Runtime Error', 'Accepted']
['s474717885', 's614288748']
[2940.0, 7748.0]
[17.0, 871.0]
[129, 215]
p03087
u883203948
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['\nx = input().split()\nn = int(x[0]) \nq = int(x[1]) \ns = input()\n\ndef ind_Multi(a,b): \n global n\n global s \n index_L = []\n for i in range(a,b):\n if s[i] == "A":\n index_L.append(i)\n return index_L\n\n \n \nt = [0] * n\nif s[0] == "A":\n t[0] = 1\n \nf...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s848542694', 's935517983', 's352361605']
[11548.0, 5548.0, 6188.0]
[2104.0, 69.0, 984.0]
[911, 706, 669]
p03087
u885899351
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). 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())\ns=input()\nl=[0]\nx,y=0,0\nfor i in range(n-1):\n if s[i]=="A" and s[i+1]=="C":x+=1\n l.append(x)\nl.append(x)\nprint(l)\nfor i in range(m):\n a,b=map(int,input().split())\n print(l[b-1]-l[a-1])', 'n,m=map(int,input().split())\ns=input()\nl=[0]\nx,y=0,0\nfor i in range(n-1):\...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s278829928', 's408974009', 's446947017', 's030073101']
[7520.0, 6100.0, 5236.0, 6100.0]
[862.0, 838.0, 2104.0, 834.0]
[225, 214, 203, 216]
p03087
u888610038
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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(N+1):\n L.append(S.count('AC',0,i))\nfor j in range(Q):\n l,r=map(int,input().split())\n print(L[r]-L[l])\nprint(L)", "N,Q=map(int,input().split())\nS=input()\nL=[0]\nT=0\nfor i in range(N-1):\n T+=S.count('AC',i,i+2)\n L.append(T)\nfor j in range(Q):...
['Wrong Answer', 'Accepted']
['s907262355', 's444396936']
[5272.0, 7688.0]
[2104.0, 882.0]
[172, 181]
p03087
u891518152
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
["\nfrom itertools import accumulate\nA = []\nN, Q = map(int, input().split())\nB = [0]*N\nS = list(input())\nans = []\nfor i in range(1, N):\n if S[i-1]=='A' and S[i]=='C':\n B[i] = 1\nA = list(accumulate(B))\nprint(A)\nfor j in range(Q):\n l, r = map(int, input().split())\n ans.append(A[r-1]-A[l-1])\n...
['Wrong Answer', 'Accepted']
['s013144858', 's961922705']
[20092.0, 19520.0]
[356.0, 353.0]
[354, 343]
p03087
u896741788
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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())\nl=[0 for i in range(n)]\nfor i,v in enumerate(list(input().replace("AC","X!"))):\n l[i]=l[i-1]+(v=="!")\nprint(l)\nfor c in range(q):\n h,m=map(int,input().split())\n print(l[m-1]-l[h-1])', 'n,q=map(int,input().split())\nl=[0 for i in range(n)]\nfor i,v in enumerate(list(input()...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s153166357', 's171510993', 's420478044', 's908888296', 's648923219']
[9632.0, 9632.0, 9632.0, 9736.0, 11628.0]
[855.0, 942.0, 935.0, 878.0, 479.0]
[219, 226, 226, 219, 234]
p03087
u896791216
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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()\nlen_s = len(s)\nfor i in range(q):\n l, r = map(int, input().split())\n tmp_len = len(s[l-1:r].replace("AC", ""))\n res = ((r-l+1) - tmp_len) / 2\n print(res)', 'n, q = map(int, input().split())\ns = input()\nans = [0] * (n + 1)\nfor i in range(n):\n ans[i...
['Wrong Answer', 'Accepted']
['s800402358', 's894039673']
[3384.0, 7748.0]
[2104.0, 877.0]
[210, 240]
p03087
u897536433
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\nlr = []\nfor i in range(q): lr.append(list(map(int, input().split())))\nac = [1 if i!=0 and 'AC'==s[i-1:i+1] else 0 for i in range(0,len(s))]\nacc = list(itertools.accumulate(ac))\nfor i in lr: print(acc[i[1]-1], acc[i[0]-1])\n", "import itertools\nn,q = ...
['Wrong Answer', 'Accepted']
['s575131168', 's670357155']
[33716.0, 33056.0]
[512.0, 489.0]
[282, 281]
p03087
u899929023
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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())\n2 S = input()\n3 t = [0] * (N + 1)\n4 for i in range(N):\n5 t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)\n6 for i in range(Q):\n7 l, r = map(int, input().split())\n8 print(t[r-1] - t[l-1])", "N, Q = map(int, input().split())\n2 S = input()\n3 t = [0] * (N + 1)\n4 ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s382094108', 's818552424', 's917922480']
[2940.0, 2940.0, 9284.0]
[17.0, 17.0, 894.0]
[235, 223, 221]
p03087
u901582103
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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]\nc=0\nfor i in range(n-1):\n if S[i:i+2]=='AC':\n c+=1 \n L.append(c)\nprint(L)\nfor j in range(q):\n s,e=map(int,input().split())\n print(L[e-1]-L[s-1])", "n,q=map(int,input().split())\nS=input()\nL=[0]\nc=0\nfor i in range(n-1):\n if S[i:i+2]==...
['Wrong Answer', 'Accepted']
['s499473929', 's954919106']
[7520.0, 6100.0]
[857.0, 888.0]
[211, 202]
p03087
u905203728
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['n,q=map(int,input().split())\ns=input()+" "\nA=[0]*(n+1)\ncnt=0\nfor i in range(1,n+1):\n if s[i-1]+s[i]=="AC":\n cnt +=1\n A[i+1]=cnt\n\nfor i 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]*(n+1)\ncnt=0\nfor i in range(1,n):\n ...
['Runtime Error', 'Accepted']
['s206690656', 's005186542']
[5548.0, 6060.0]
[59.0, 876.0]
[214, 212]
p03087
u905582793
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\nac=[]\nfor i in range(n-1):\n if s[i]=="A" and s[i+1]=="C":\n ac.append(i+1)\nfor i in range(q):\n a,b=map(int,input().split())\n print(bisect.bisect_right(b-1)-bisect.bisect_left(a))', 'import sys\nimport bisect\ninput=sys.stdin.readline\nn,q=map(int,inpu...
['Runtime Error', 'Accepted']
['s747563247', 's733052094']
[5224.0, 6032.0]
[41.0, 391.0]
[236, 278]
p03087
u908349502
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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(Q):\n l, r = map(int,input().split())\n Si = S[l-1:r]\n \n len_Si = len(Si)\n for i in range(len_Si-1):\n if Si[i:i+2] == 'AC'\n count += 1\n print(count)\n count = 0\n", "N, Q = map(int,input().split())\nS = input()\ncount = 0\n...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s538026352', 's572517820', 's689143693', 's858427202']
[2940.0, 3452.0, 3456.0, 7748.0]
[17.0, 2104.0, 2104.0, 915.0]
[243, 245, 245, 208]
p03087
u909162870
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['nq = list(map(int, input().split()))\nn = nq[0]\nq = nq[1]\ns = input()\nac = []\nfor i in range(n - 1):\n if s[i] == "A" and s[i + 1] == "C":\n ac.append(i)\nprint(ac)\nfor i in range(q):\n lr = list(map(int, input().split()))\n l = lr[0]\n r = lr[1]\n ans = 0\n for j in ac:\n if l - ...
['Wrong Answer', 'Accepted']
['s893420041', 's122388039']
[6164.0, 6120.0]
[2104.0, 973.0]
[398, 348]
p03087
u912158215
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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 \ncounts = [0 for i in range(n)]\ncnt = 0\n \nfor i in range(n):\n if (S[i-1:i+1] == "AC"):\n cnt += 1\n counts[i] = cnt\n \nfor i in range(q):\n l, r = map(int, input().split())\n print(counts[r-1] - counts[l-1])', 'n, q = map(int, input().split())\nS =...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s139589083', 's189795233', 's275529844', 's498023680', 's651214291', 's651623269']
[6184.0, 6156.0, 2940.0, 2940.0, 3188.0, 6184.0]
[892.0, 874.0, 17.0, 17.0, 18.0, 865.0]
[264, 262, 67, 264, 257, 260]
p03087
u913110564
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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()\nplace=[0]*(N+1)\nfor i in range(0,len(S)-1):\n if S[i:i+2]=='AC':\n place[i+2]+=1\n \nfor i in range(N):\n place[i+1]=place[i]+place[i+1]\nfor i in range(Q):\n frm,to=list(map(int,input().split()))\n print(place[to]-place[frm-1])\nprint(place)\n...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s175847244', 's297550921', 's733392538', 's903293042']
[9664.0, 9156.0, 6572.0, 9412.0]
[932.0, 926.0, 1147.0, 903.0]
[305, 292, 387, 304]
p03087
u913662443
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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 = input().rstrip()\na = [0]*N\nfor i in range(N):\n if i > 1:\n a[i] = a[i-1]\n if i != 0 and S[i-1]=='A' and S[i] == 'C':\n a[i] += 1\nfor _ in range(Q):\n l, r = map(int,input().rstrip().split())", "N,Q = map(int,input().rstrip().split())\nS = input(...
['Wrong Answer', 'Accepted']
['s691348746', 's210835110']
[11476.0, 11584.0]
[217.0, 481.0]
[254, 279]
p03087
u917733926
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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 = [list(map(int, input().split())) for _ in range(Q)]\n\naccum = [0] * N\n\ndef countAC():\n count = 0\n for i in range(1, N):\n if(S[i-1] == "A" and S[i] == "C"):\n count += 1\n accum[i] = count\n\n\n\ncountAC()\n\nfor i in rang...
['Wrong Answer', 'Accepted']
['s174971493', 's143011141']
[32792.0, 30660.0]
[473.0, 468.0]
[371, 356]
p03087
u919404987
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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(nq) for nq in input().split(" ")]\nS = input()\nfor i in range(Q):\n li, ri = [int(lr) for lr in input().split(" ")]\n print(s[li-1:ri].count("AC"))\n', 'N, Q = input().split(" ")\nN, Q = int(N), int(Q)\nS = input()\ns = S.replace("AC", "__")\ncounts = []\nfor i in range(Q):\n li, ri = [int(lr) f...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s168914112', 's585424592', 's641624405', 's874132240', 's935789419', 's315764499']
[3188.0, 3188.0, 3188.0, 3188.0, 134628.0, 7668.0]
[18.0, 19.0, 18.0, 19.0, 885.0, 870.0]
[163, 228, 208, 235, 219, 246]
p03087
u919734978
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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(q):\n t[i+1] = t[i] + (1 if s[i:i+2] == "AC" else 0)\nfor i in range(q):\n l,r = map(int,input().split())\n print(t[r+1] - t[l-1])\n', 'n,q = map(int,input().split())\ns = str(input())\nfor _ in range(q):\n l,r = map(int,input().split(...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s413770772', 's720277209', 's857821049', 's132465996']
[7108.0, 2940.0, 7748.0, 9412.0]
[115.0, 19.0, 855.0, 844.0]
[206, 128, 206, 206]
p03087
u921811474
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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 _ in range(Q)]\nl =[]\n\ndef get(n):\n ans = 0\n for i in range(n):\n if S[i] =="A" and S[i+1] =="C":\n ans += 1\n return ans\n\nfor i in range(len(S)):\n l.append(get(i))\nprint(l)\nfor i in range(Q):...
['Wrong Answer', 'Accepted']
['s209635136', 's247488248']
[29652.0, 30752.0]
[2105.0, 473.0]
[340, 289]
p03087
u923105140
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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 = []*(N+1)\nfor i in range(N):\n t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)\n\nfor i in range(Q):\n l, r = map(int, input().split())\n print(t[r-1] - t[l-1])", "N, Q = map(int, input().split())\nS = input()\nt = [0]*(N+1)\nfor i in range(N):\n t[i+1] = ...
['Runtime Error', 'Accepted']
['s141984487', 's801379291']
[3188.0, 9540.0]
[17.0, 871.0]
[211, 211]
p03087
u925364229
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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\nacc = [0] * N\nfor i in range(N-1):\n if S[i] == \'A\' and S[i+1] == \'C\':\n a[i] = 1\n acc[i] += a[i]\n acc[i+1] = acc[i]\n\nacc[N-1] = acc[N-2]\nprint(acc)\nfor i in range(Q):\n l,r = map(int,input().split(" "))\n if l > 1:\n ...
['Wrong Answer', 'Accepted']
['s908429713', 's967975210']
[9332.0, 6956.0]
[910.0, 886.0]
[420, 409]
p03087
u931489673
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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\nfor q in range(Q):\n l,r=map(int,input().split())\n for i in range(l-1,r-1):\n #print(S[i:i+2])\n if S[i:i+2]=="AC":\n c+=1\nprint(c)\n\n', 'N,Q=map(int,input().split())\nS=input()\n\n\n\nC=[0]*(N+1)\nfor i in range(N):\n C[i+1]=C[i]+(1 i...
['Wrong Answer', 'Accepted']
['s283242390', 's033570933']
[3188.0, 9156.0]
[2104.0, 869.0]
[203, 379]
p03087
u932465688
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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 += 'J'\nL = []\nfor i in range(Q):\n L.append(list(map(int,input().split())))\ncnt = [0]*(N+1)\nfor i in range(N):\n if S[i] == 'A' and S[i+1] == 'C':\n cnt[i+1] = 1\nfor i in range(1,N+1):\n cnt[i] += cnt[i-1]\nfor j in range(Q):\n print(cnt[L[j][1]-1]-cnt[L[j][0...
['Wrong Answer', 'Accepted']
['s962426877', 's941318008']
[34448.0, 32244.0]
[502.0, 508.0]
[321, 310]
p03087
u932868243
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
["n,q=map(int,input().split())\ns=input()\nlist=[0]\nfor i in range(n-1):\n if s[i]=='A' and s[i+1]=='C':\n list.append(s[i]+1)\n else:\n list.append(s[i])\nfor j in range(q):\n l,r=map(int,input().split())\n print(list[r]-list[l-1])", "n,q=map(int,input().split())\ns=input()\nlist=[0]\nfor i in range(n-1):\n...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s127890780', 's379588443', 's403883371', 's787513692', 's720246185']
[9472.0, 11636.0, 11564.0, 11624.0, 30656.0]
[37.0, 72.0, 71.0, 76.0, 459.0]
[231, 237, 237, 237, 247]
p03087
u934868410
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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 = []\nfor i in range(n+1):\n c.add(s[:i].count("AC"))\n \nfor i in range(q):\n l,r = map(int,input().split())\n print(c[r]-c[l-1])', '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]).cound("AC")', ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s213382319', 's273766057', 's364040597', 's563982984', 's775405525']
[3188.0, 3376.0, 3188.0, 5236.0, 6128.0]
[18.0, 17.0, 39.0, 2104.0, 872.0]
[174, 125, 228, 177, 245]
p03087
u937495656
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
["n, q = map(int, input().split(' '))\ns = input()\nl_r = []\nfor _ in range(q):\n l_r.append(tuple(map(int, input().split(' '))))\n \nfor (l, r) in l_r:\n substr = s[l-1:r]\n print(substr)\n count = 0\n for i in range(len(substr) - 1):\n print(substr[i:i+2])\n if substr[i:i+2] == 'AC':\...
['Wrong Answer', 'Accepted']
['s771631297', 's553279208']
[24704.0, 19772.0]
[2104.0, 468.0]
[345, 278]
p03087
u937529125
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['b = "ACACTACG"\nn, q = map(int, input().split())\nb = input()\na = [[int(x) for x in input().split()] for _ in range(q)]\nfor j in range(len(b)-1):\n if b[j] == "A" and b[j+1] == "C":\n ans.append(1)\n else:\n ans.append(0)\nfor i in a:\n print(sum(ans[i[0]:i[1]]))\n', 'n, q = m...
['Runtime Error', 'Accepted']
['s353827706', 's299597196']
[21240.0, 24496.0]
[306.0, 453.0]
[295, 327]
p03087
u940990031
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
["import bisect\nN, Q = [int(x) for x in input().split()]\nS = str(input())\n\nac_list = []\nfor (idx, (s1, s2)) in enumerate(zip(S[:-1], S[1:])):\n if s1 == 'A' and s2 == 'C':\n ac_list.append(idx+1)\n\nprint(ac_list)\nfor _ in range(Q):\n l, r = [int(x) for x in input().split()]\n index_l = bisect.bisect_left(a...
['Wrong Answer', 'Accepted']
['s601568080', 's983420566']
[6172.0, 5776.0]
[1029.0, 1013.0]
[388, 373]
p03087
u945418216
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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(lambda x: int(x)-1, input().split())) for _ in range(q)]\n\nac = [0]*n\nfor i in range(n-1):\n print(s[i:i+2])\n if s[i:i+2] == 'AC':\n ac[i+1]= ac[i]+1\n else:\n ac[i+1] = ac[i]\nprint(ac)\nfor x in lr:\n print(ac[x[1]] - ac[x[0]]...
['Wrong Answer', 'Accepted']
['s818019757', 's551653585']
[32776.0, 32284.0]
[603.0, 518.0]
[306, 276]
p03087
u948199835
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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(input().split()))\n\nn = len(s)\nary = [0 for i in range(lne(s)+1)]\n\nfor i in range(1, N):\n if s[i-1] == 'A' and s[i] == 'C':\n ary[i+1] = ary[i] + 1\n else:\n ary[i+1] = ary[i]\n\nfor i in range...
['Runtime Error', 'Accepted']
['s250045810', 's733684802']
[26044.0, 29280.0]
[249.0, 419.0]
[363, 373]
p03087
u948524308
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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]*N\n\nfor i in range(1,N):\n if S[i-1:i+1]=="AC":\n C[i]+=1\n\nfor i in range(Q):\n l,r=map(int,input().split())\n print(C[r]-C[i])\n\n', 'N,Q=map(int,input().split())\nS=input()\n\nnum=[0]*N\n\nfor i in range(1,N):\n if S[i-1:i+1]=="AC":\n num[i...
['Runtime Error', 'Accepted']
['s848125623', 's591227800']
[4084.0, 10228.0]
[105.0, 889.0]
[185, 266]
p03087
u948643060
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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\nsum_list = [0]\n\nfor i in range(N):\n if S[i] == 'C' and S[i-1] == 'A' and i:\n sum_list.append(sum_list[-1]+1)\n else:\n sum_list.append(sum_list[-1])\n\nprint(sum_list)\n\nfor l, r in lr_li...
['Wrong Answer', 'Accepted']
['s119674924', 's099633135']
[53432.0, 52200.0]
[532.0, 517.0]
[347, 462]
p03087
u952022797
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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\nimport collections\nimport re\nimport copy\n\ndef main():\n\tN, Q = map(int, input().split(" "))\n\tS = input()\n\tS = list(S)\n\tpattern = r"AC"\n\t\n\tQs = []\n\tfor _ in range(Q):\n\t\tl, r = map(int, input().split(" "))\n\t\tQs.append((l, r))\n\t\n\tans = []\n\tfor i, val in e...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s524857250', 's883626669', 's753301129']
[24484.0, 1466972.0, 24312.0]
[2105.0, 2192.0, 413.0]
[481, 470, 671]
p03087
u952656646
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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 l,r = map(int, input().split())\n print(S[l-1:r].count('AC'))", 'N, Q = map(int, input().split())\nS = input()\nc = [0]*N\nfor i in range(1, N):\n c[i] = c[i-1]\n if S[i-1]=="A" and S[i]=="C":\n c[i] = c[i-1] + 1\nfor l,r i...
['Runtime Error', 'Runtime Error', 'Accepted']
['s356776926', 's422502578', 's872510433']
[3064.0, 5524.0, 31392.0]
[17.0, 60.0, 475.0]
[138, 194, 328]
p03087
u953110527
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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 for i in range(n)]\ncount = 0\nfor i in range(1,n):\n if S[i] == 'C' and S[i-1] == 'A':\n count += 1\n a[i] = count\nfor i in range(q):\n l,r = map(int,input().split())\n print(a[r-1]-a[l-1])\nprint(a)", "n,q = map(int,input().split())\nS = input(...
['Wrong Answer', 'Accepted']
['s741594688', 's909496002']
[8148.0, 6104.0]
[881.0, 863.0]
[261, 252]
p03087
u956194864
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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\nidx = [s[i:i+2] == "AC" for i in range(n-1)]\n', 'n,q = map(int, input().split())\ns = input()\n\n\nidx = [s[i:i+2] == "AC" for i in range(n-1)]\nidx2 = [sum(idx[:i]) for i in range(n)]\n\nfor i in range(q):\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s259558938', 's469964899', 's182360777']
[28348.0, 4444.0, 9668.0]
[349.0, 2104.0, 871.0]
[147, 279, 336]
p03087
u957872856
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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()\nprint(S)\nfor i in range(q):\n l, r = map(int,input().split())\n cnt = S[l-1:r].count("AC")\n print(cnt)\n', '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":\n count[i] += 1\nfor i...
['Wrong Answer', 'Accepted']
['s520195382', 's677947729']
[3444.0, 7700.0]
[2104.0, 865.0]
[148, 231]
p03087
u960171798
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). 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()\ncnt_list = [0]\n\nfor i in range(1,N):\n if S[i]=="C" and S[i-1]=="A":\n cnt_list.append(cnt_list[-1]+1)\n else:\n cnt_list.append(cnt_list[-1])\nprint(cnt_list)\nfor j in range(Q):\n l,r = map(int, input().split())\n ans = cnt_list[r-1]-cnt_...
['Wrong Answer', 'Accepted']
['s401889402', 's132264088']
[7520.0, 6084.0]
[844.0, 851.0]
[354, 275]
p03087
u961674365
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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 for _ in range(n)]\np=''\nd=0\nfor i in range(n):\n x=s[i]\n if p=='A' and x=='C':\n d+=1\n p=x\n c[i]=d\nprint(c)\nfor i in range(q):\n ans=0\n l,r=map(int,input().split())\n ans=c[r-1]-c[l-1]\n\n print(ans)\n", "n,q=map(int,input().split())\ns=input()\nc=[0 f...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s533706099', 's534922913', 's759691522', 's982043730', 's391495543']
[7548.0, 5392.0, 2940.0, 3444.0, 6128.0]
[869.0, 2104.0, 17.0, 2104.0, 872.0]
[249, 244, 243, 290, 240]
p03087
u965033073
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
["N, Q = map(int, input().split())\nS = input()\nt = [0] * (N + 1)\nfor i in range(N):\nt[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)\nfor i in range(Q): 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\tt[i + 1] = ...
['Runtime Error', 'Accepted']
['s807459289', 's814610972']
[2940.0, 7748.0]
[17.0, 858.0]
[209, 213]
p03087
u969077316
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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().strip().split()))\nS = input()\nrangeList = [list(map(int, input().strip().split())) for i in range(Q)]\n\nAccumulation = [0]*N\nflag = False\n\nif (S[0] == "A"):\n flag = True\n\nfor i in range(1,N):\n if (flag):\n if (S[i] == "C"):\n Accumulation[i] = Accumulatio...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s109139727', 's146288395', 's280121012', 's825904025']
[30676.0, 29896.0, 31828.0, 30696.0]
[506.0, 490.0, 482.0, 479.0]
[723, 629, 674, 751]
p03087
u969190727
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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=input().split()\n l_list.append(int(l))\n r_list.append(int(r))\ncount=0\nAC_count=[0]\nfor i in range(1,N+1):\n if S[i-1:i+1]=="AC":\n count+=1\n AC_count.append(count)\nAC_count.append(count)\nk=0\nfor j in range(Q):\n...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s089971826', 's121307802', 's127805313', 's326182440', 's370127852', 's492014679', 's239022395']
[14232.0, 15492.0, 3060.0, 13772.0, 11112.0, 11108.0, 6180.0]
[416.0, 400.0, 18.0, 299.0, 264.0, 255.0, 866.0]
[360, 376, 235, 334, 257, 246, 252]
p03087
u970197315
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
["N,Q = map(int,input().split())\nS = input()\nt = [0] * (N + 1)\n\nfor i in range(N):\n if S[i : i + 2] == 'AC':\n t[i + 1] = t[i] + 1\n else:\n t[i + 1] = t[i]\n\nfor i in range(Q):\n l, r = map(int, input().split())\n\nprint(t[r-1] - t[l-1])", 'n,q=map(int,input().split())\ns=input()\nc=[0]*n\...
['Wrong Answer', 'Accepted']
['s222855163', 's377517560']
[5548.0, 8584.0]
[316.0, 867.0]
[252, 244]
p03087
u973108807
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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()\ncumulative = [0] * (N+1)\nfor i in range(N-1):\n if S[i:i+2] == "AC":\n cumulative[i+2] = cumulative[i+1] + 1\n else:\n cumulative[i+2] = cumulative[i+1]\n\nprint(cumulative) \n \nfor _ in range(Q):\n start, end = map(int, input().split())\n ans = cumulat...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s177852959', 's485430537', 's660419133']
[7568.0, 4212.0, 6164.0]
[941.0, 911.0, 929.0]
[406, 331, 383]
p03087
u977193988
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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]=='A' and s[i]=='C') else 0\n c.append(t)\nfor i in range(q):\n l,r=map(int,input().split())\n print(c[r]-c[l])", "n,q=map(int,input().split())\ns=input()\nc=[0]\nt=0\nfor i in range(1,n+1):\n t+=1 if (s[i-1]=='A...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s195816310', 's546234238', 's575111547', 's789892189']
[2940.0, 9732.0, 9732.0, 7688.0]
[16.0, 856.0, 857.0, 868.0]
[205, 220, 220, 210]
p03087
u977855674
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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()\nappmap = [0] * (n + 1)\nfor i in range(n):\n appmap[i + 1] = appmap[i] + (1 if s[i: i + 2] == "AC" else 0)\nprint(appmap)\nfor i in range(q):\n l, r = map(int, input().split())\n print(appmap[r - 1] - appmap[l - 1])\n', 'n, q = map(int, input().split())\ns = inp...
['Wrong Answer', 'Accepted']
['s671985456', 's415986901']
[9152.0, 7748.0]
[878.0, 894.0]
[264, 250]
p03087
u979362546
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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()\nR = [list(map(int, input().split)) for i in range(Q)]\nans = []\nfor i in range(Q):\n x = R[i][0]-1\n y = R[i][1]\n a=S[x:y].count("AC")\n ans.append(a)\n\nfor i in range(Q):\n print(ans[i])', 'N, Q = map(int, input().split())\nS = input()\nt = [0]*(N+1)\n...
['Runtime Error', 'Accepted']
['s559707218', 's558644768']
[3188.0, 9668.0]
[18.0, 865.0]
[241, 206]
p03087
u980783809
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['n, q = map(int, input().split())\ns = input()\nlis=[]\nfor i in range(q):\n lis.append(list(map(int, input().split())))\nidx=0\nacs=[0]*n\nfor _ in s:\n if s[idx]=="A" and s[idx+1]=="C":\n acs[idx+1] = 1\n idx+=1\n idx+=1\n if idx>=(len(s)-1):\n break\ncnt=0\nprint(acs)\nfor i,el in e...
['Wrong Answer', 'Accepted']
['s415566634', 's403328341']
[32500.0, 30704.0]
[503.0, 517.0]
[454, 457]
p03087
u985963315
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq 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()\narr = []\nfor i in range(N-1):\n if S[i:i+2] == "AC":\n arr.append(i)\nprint(arr)\nfor i in range(Q):\n l, r = map(int, input().split())\n print(bisect.bisect_right(arr, r-2) - bisect.bisect_left(arr, l-1))\n ', 'import bisect\nN, Q = m...
['Wrong Answer', 'Accepted']
['s628350848', 's134996559']
[6268.0, 5748.0]
[998.0, 998.0]
[280, 281]
p03087
u987164499
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['n,q = map(int,input().split())\ns = input()\n\nli = [0]*n\n\nfor i in range(1,n):\n if s[i-1] == "A" and s[i] == "C":\n li[i] += 1\n\nfrom itertools import accumulate\n\nlin = [0]+list(accumulate(li))\nprint(lin)\nfor _ in range(q):\n l,r = map(int,input().split())\n print(lin[r]-lin[l])', 'n,q = map(...
['Wrong Answer', 'Accepted']
['s565577239', 's537316288']
[10364.0, 8716.0]
[858.0, 835.0]
[289, 279]
p03087
u988004923
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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] = (1 if s[i:i + 2] == "AC" else 0) + t[i]\nprint(t)\nfor i in range(q):\n l, r = list(map(int, input().split()))\n print(t[r - 1] - t[l - 1])\n', 'n, q = map(int, input().split())\ns = input()\nt = [0] * (n + 1)\n...
['Wrong Answer', 'Accepted']
['s168461817', 's799650671']
[10384.0, 7748.0]
[909.0, 899.0]
[239, 230]
p03087
u993435350
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many...
['N , Q = map(int,input().split())\nS = input()\nL = [list(map(int,input().split())) for i in range(Q)]\n\ncut = ""\n\nconlist = []\n\nfor i in range(Q):\n\tcut = S[L[i][0]-1:L[i][1]+1]\n\tconlist.append(cut.count("AC"))\n\t\nprint(max(conlist))', 'N , Q = map(int,input().split())\nS = input()\nL = [list(map(int,input(...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s191376910', 's303298411', 's672571502', 's902638327', 's988354375', 's150127302']
[30432.0, 29596.0, 28464.0, 159020.0, 29688.0, 9668.0]
[2105.0, 2105.0, 2105.0, 1046.0, 2105.0, 899.0]
[228, 228, 201, 236, 228, 689]
p03087
u996434204
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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 = []\nfor i in range(q):\n l,r = map(int,input().split())\n buf = s[l-1:r]\n print(buf)\n ans.append(buf.count('AC'))\n\nfor i in range(len(ans)):\n print(ans[i])\n", "n,q = map(int,input().split())\ns = input()\nans = []\nli = [0] * (len(s))\ncount = 0\...
['Runtime Error', 'Accepted']
['s577594577', 's649955329']
[134604.0, 10232.0]
[779.0, 410.0]
[217, 317]
p03087
u997113115
2,000
1,048,576
You are given a string S of length N consisting of `A`, `C`, `G` and `T`. Answer the following Q queries: * Query i (1 \leq i \leq Q): You will be given integers l_i and r_i (1 \leq l_i < r_i \leq N). Consider 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 = True\nR = [0]*N\na = 0\nfor i in range(N):\n s = S[i]\n if s == "A":\n flag = True\n elif s == "C" and flag:\n a += 1\n flag = False\n else:\n flag = False\n R[i] = a\nprint(R)\nfor i in range(Q):\n l, r = map(int, inp...
['Wrong Answer', 'Accepted']
['s850352580', 's603815645']
[7512.0, 6108.0]
[868.0, 859.0]
[342, 333]
p03088
u013408661
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['dp=[0]*101\ndp[3]=61\np=10**9+7\nfor i in range(4,101):\n dp[i]=(dp[i-1]*4-pow(4,i-3,p)*3-pow(4,i-4,p))%p\nprint(dp[100])', 'dp=[[[[0]*4 for i in range(4)] for i in range(4)] for i in range(5)]\nprint(dp)', 'dp=[0]*101\ndp[3]=61\ndp[4]=230\ndp[5]=864\ndp[6]=3232\np=10**9 +7\nfor i in range(4,101):\n dp[i]=(4*dp[i-1...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s238342828', 's544402056', 's765286706', 's422034094']
[2940.0, 2940.0, 3060.0, 3440.0]
[20.0, 17.0, 19.0, 42.0]
[117, 78, 132, 829]
p03088
u038815010
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['n=int(input())\nm=[{}for i in range(n+1)]\nw=10**9+7\ndef f(s):\n for i in range(4):\n t=list(s)\n if i>=1:\n t[i-1],t[i]=t[i],t[i-1]\n if "".join(t).count("AGC")>0:\n return False\n return True\ndef a(p,q):\n if q in m[p]:\n return m[p][q]\n if p==n:\n ...
['Wrong Answer', 'Accepted']
['s950786837', 's156398510']
[4268.0, 3884.0]
[124.0, 131.0]
[454, 446]
p03088
u058186113
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['\n\nusing namespace std;\nconst long long INF = 1000000007ll;\nint k[4];\nvoid ku(int a) {\n for (int i = 3; i >= 0; i --) {\n k[i] = a % 4;\n a /= 4;\n }\n}\nbool ok(int a) {\n for (int i = 0; i < 4; i ++) {\n ku(a);\n if (i >= 1) swap(k[i - 1], k[i]);\n if (k[0] == 0 && k[1] == 1 && k[2] == 2) ret...
['Runtime Error', 'Runtime Error', 'Accepted']
['s784071332', 's794211311', 's343399489']
[2940.0, 2940.0, 3872.0]
[17.0, 17.0, 125.0]
[916, 915, 565]
p03088
u060938295
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['# -*- coding: utf-8 -*-\n"""\nCreated on Sun Mar 24 20:51:04 2019\n\n@author: Yamazaki Kenichi\n"""\n\nN = int(input())\nmod = 10**9+7\n\nres = [[0 for j in range(14)] for i in range(N+1)]\nres[1][0],res[1][1],res[1][2],res[1][3] = 1,1,1,1\n\n\nfor i in range(2,N+1):\n res[i][0] = sum(res[i-1]) - (res[i-1][0]+res[...
['Wrong Answer', 'Accepted']
['s383850107', 's166080662']
[3300.0, 3888.0]
[19.0, 123.0]
[1295, 733]
p03088
u066692421
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['n = int(input())\ndp = [{} for i in range(n + 1)]\ns = "AGCT"\n\nfor c1 in s:\n for c2 in s:\n for c3 in s:\n dp[0][c1 + c2 + c3] = 0\n\ndp[0]["TTT"] = 1\n\nfor l in range(n):\n for c1 in s:\n for c2 in s:\n for c3 in s:\n for p in s:\n if c2 == "A" and c3 == "G" and p == "C":\n ...
['Runtime Error', 'Accepted']
['s420885218', 's993098286']
[3064.0, 3828.0]
[17.0, 58.0]
[758, 891]
p03088
u091051505
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['n = int(input())\nmod = (10 ** 9) + 7\nans = 0\nk = []\nd = []\ndef calc(l, ans):\n if len(l) == n:\n for al in ["AGC", "GAC", "ACG", "AGGC", "ATGC", "ACGC", "AGTC", "AGAC", "AGGC"]:\n if al in l:\n return ans\n return ans + 1\n for alphabet in "AGCT":\n ll = l + a...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s206564824', 's321935601', 's531910355']
[3064.0, 4272.0, 4272.0]
[2104.0, 200.0, 199.0]
[376, 687, 704]
p03088
u105444912
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['ngs4 = ["ATGC", "AGTC","ACGC", "AGCC","AGGC", "AGGC"]\nngs3 = ["AGC", "ACG", "GAC"]\ndef is_valid(b):\n s = b[-4:]\n if s in ngs4:\n return False\n s = s[-3:]\n if s in ngs3:\n return False\n return True\n\nN = int(input())\nmemo = [{} for i in range(N+1)]\nacgt = ["A", "C", "G", "T"]\nMO...
['Wrong Answer', 'Accepted']
['s276470488', 's270146356']
[3064.0, 3808.0]
[17.0, 44.0]
[644, 651]
p03088
u112766430
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
["N, MOD = int(input()), 10**9+7\ncount = 0\ndef dfs(index,last3):\n\tif index == N:\n\t\treturn 1\n\tc_next = 'AT'\n\tif 'AC' in last3[1:]:\n\t\tc_next + 'G'\n\tif 'AG' in last3 == False:\n\t\tif last3[1:] != 'GA':\n\t\t\tif last3[0]+last3[2] != 'AG':\n\t\t\t\tc_next + 'C'\n\n\tfor c in c_next:\n\t\tcount += dfs(inde...
['Runtime Error', 'Accepted']
['s437600845', 's044248753']
[3060.0, 3820.0]
[18.0, 34.0]
[321, 735]
p03088
u223904637
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['n=int(input())\nif n==3:\n print(61)\nif n==4:\n print(230)\nl=[\'A\',\'C\',\'G\',\'T\']\ndic3=dict(\'AGC\'=1,\'ACG\'=1,\'GAC\'=1)\ndic4=dict(\'AGTC\'=1,\'AGGC\'=1,\'ATGC\'=1)\nans=0\nz=[]\nfor a in range(4):\n for b in range(4):\n for c in range(4): \n for d in range(4):\n ...
['Runtime Error', 'Accepted']
['s104566600', 's098950965']
[3064.0, 3824.0]
[20.0, 1499.0]
[1092, 806]
p03088
u239528020
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['#!/usr/bin/env python3\nimport copy\n\nn = int(input())\n\nmod = 10**9+7\n\nmiss = set(["AGC", "ACG", "GAC"])\n# miss = set([])\n\n\nans = {"AA": 1, "AC": 1, "AG": 1, "AT": 1,\n "CA": 1, "CC": 1, "CG": 1, "CT": 1,\n "GA": 1, "GC": 1, "GG": 1, "GT": 1,\n "TA": 1, "TC": 1, "TG": 1, "TT": 1}\n\nans_bas...
['Wrong Answer', 'Accepted']
['s734024848', 's029460815']
[3572.0, 9180.0]
[33.0, 98.0]
[1096, 1251]
p03088
u286955577
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['N, MOD = int(input()), 10 ** 9 + 7\ndp = [ [ [ [0] * 4 ] * 4 ] * 4 ] * 101\n\ndp[0][3][3][3] = 1\n\nfor length in range(N):\n for i in range(4):\n for j in range(4):\n for k in range(4):\n if dp[length][i][j][k] == 0: continue\n for a in range(a):\n if a == 2 and i == 1 and j == 0: con...
['Runtime Error', 'Accepted']
['s159887155', 's600296840']
[3064.0, 3316.0]
[18.0, 43.0]
[867, 1299]
p03088
u292810930
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
["N, MOD = int(input()), 10**9+7\nmemo = [{} fot i in range(N+1)]\n\ndef ok(last4):\n for i in range(4):\n t = list(last4)\n if i >= 1:\n t[i-1], t[i] = t[i], t[i-1]\n if ''.join(t).count('AGC') >= 1:\n return False\n return True\n\ndef dfs(cur, last3):\n \n if la...
['Runtime Error', 'Runtime Error', 'Accepted']
['s316825031', 's554153274', 's114696181']
[2940.0, 3064.0, 3920.0]
[18.0, 17.0, 120.0]
[642, 579, 741]
p03088
u315485238
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
["import re, copy\nimport itertools\nN= int(input())\n\npat='(AGC|ACG|GAC|AGAC|AGTC|AGCC|AAGC|ATGC|AGGC)'\nrepattern = re.compile(pat)\n\nmemo={}\n\nfor s in itertools.product('ATGC', repeat=3):\n if not repattern.search(''.join(s)):\n \tmemo[''.join(s)] = 1\n \nfor _ in range(3,N):\n new_memo={}\n for k,v in memo...
['Runtime Error', 'Accepted']
['s603629309', 's751230332']
[3064.0, 3700.0]
[17.0, 59.0]
[480, 481]
p03088
u326609687
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
["iimport re\nimport functools\n\nN = int(input())\nMOD = 10 ** 9 + 7\n\n\n@functools.lru_cache(maxsize=2**13)\ndef dfs(cur, last3):\n if cur == N:\n return 1\n ret = 0\n for c in 'ACGT':\n if not re.match('.AGC|.ACG|.GAC|A.GC|AG.C', last3 + c):\n ret += dfs(cur + 1, last3[1:] + c)\n ...
['Runtime Error', 'Accepted']
['s394592997', 's978885436']
[2940.0, 6424.0]
[22.0, 163.0]
[344, 343]
p03088
u332906195
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['# -*- coding: utf-8 -*-\n\nN = int(input())\n\ndp = {b: 1 for b in "ACGT"}\nfor _ in range(N - 1):\n dp_new = {}\n for k in dp:\n for b in "ACGT"\n if k[-2:] + b in ("AGC", "ACG", "GAC") or k[-3:4] + b in ("ACGC", "AGGC", "ATGC", "AGCC", "AGGC", "AGTC"):\n continue\n e...
['Runtime Error', 'Accepted']
['s123014110', 's224685358']
[2940.0, 3064.0]
[17.0, 96.0]
[421, 515]
p03088
u371467115
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
["N, MOD = int(input()), 10 ** 9 + 7\nmemo = [{} for i in range(N+1)]\ndef ok(last4):\n for i in range(4):\n t = list(last4)\n if i >= 1:\n t[i-1], t[i] = t[i], t[i-1]\n if ''.join(t).count('AGC') >= 1:\n return False\n return True\ndef dfs(cur, last3):\n if last3 in ...
['Wrong Answer', 'Accepted']
['s200899714', 's447620277']
[3872.0, 3872.0]
[126.0, 137.0]
[566, 565]
p03088
u401487574
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['n = int(input())\nmod = 10**9+7\nA=[1] + [0]*(n-1)\nG=[1] + [0]*(n-1)\nC=[1] + [0]*(n-1)\nfor i in range(1,n):\n t=(2*A[i-1]+G[i-1]+C[i-1])%mod\n A[i]=t\n G[i]=(t-A[i-2]+G[i-3])%mod\n C[i]=(t-A[i-2]-G[i-2]-3*A[i-3])%mod\nprint((2*A[-1]+G[-1]+C[-1])%mod)\n', 'n = int(input())\nmod = 10**9+7\nA=[1] + [0]*(n...
['Wrong Answer', 'Accepted']
['s558790848', 's586578872']
[9000.0, 9044.0]
[30.0, 28.0]
[256, 259]
p03088
u403984573
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['N=int(input())\na=3\ncount=4**N-3*8**N-2*(N-3)\nprint(count)', 'import numpy as np\nN=int(input())\n#AGCT\n#0123\ndp = np.zeros((N+1, 4, 4, 4))\ndp[0][3][3][3]=1\nmod=1000000007\nfor c in range(N):\n for i in range(4):\n for j in range(4):\n for k in range(4):\n for a in range(4):\n if a==1 a...
['Wrong Answer', 'Accepted']
['s976864129', 's193020928']
[2940.0, 12488.0]
[17.0, 269.0]
[57, 648]
p03088
u404710939
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['N, MOD = int(input()), 10**9 + 7\nmemo = [{} for i in range(N+1)]\n\ndef ok(last4):\n for i in range(4):\n t = list(last4)\n if i >= 1:\n t[i-1], t[i] = t[i], t[i-1]\n if "".join(t).count("AGC") >= 1:\n return False\n return True\n\ndef dfs(cur, last3):\n if last3 i...
['Wrong Answer', 'Accepted']
['s573527275', 's629978860']
[4240.0, 3872.0]
[132.0, 127.0]
[578, 566]
p03088
u427344224
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['N = int(input())\n\nmod = 10 ** 9 + 7\n\ndp = [[[[0] * 4 for _ in range(4)] for _ in range(4)] for _ in range(N + 1)]\n\ndp[0][3][3][3] = 1\n\nprint(dp)\nfor i in range(N):\n for j in range(4):\n for k in range(4):\n for m in range(4):\n if dp[i][j][k][m] == 0:\n ...
['Wrong Answer', 'Accepted']
['s982327955', 's280118524']
[3692.0, 3312.0]
[44.0, 43.0]
[1038, 1018]
p03088
u465699806
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['import itertools as it\n\nN=int(input())\ndp=dict()\ndef ok(s):\n return all([\'AGC\' not in t for t in \n [s, s[0:2]+s[3]+s[2], s[0]+s[2]+s[1]+s[3], s[1]+s[0]+s[2:4]]]) \n\ndef n(j, s):\n print(j, s)\n if j == 3:\n return 1 if s not in ["AGC", "ACG", "GAC"] else 0\n if (j, s) in dp:\n ...
['Wrong Answer', 'Accepted']
['s641533443', 's120616975']
[9908.0, 8996.0]
[350.0, 224.0]
[666, 650]
p03088
u476604182
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
["N = int(input())\nans = 0\nM = (10**9)+7\ndic = {}\npdic = {}\npdic['AAA'] = 1\npdic['AAC'] = 1\npdic['AAG'] = 1\npdic['AAT'] = 1\npdic['ACA'] = 1\npdic['ACC'] = 1\npdic['ACG'] = 0\npdic['ACT'] = 1\npdic['AGA'] = 1\npdic['AGC'] = 0\npdic['AGG'] = 1\npdic['AGT'] = 1\npdic['ATA'] = 1\npdic['ATC'] = 1\npdic['ATG'] = 1\n...
['Wrong Answer', 'Accepted']
['s229847583', 's753076478']
[3316.0, 12508.0]
[28.0, 168.0]
[1587, 1036]
p03088
u504836877
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['N = int(input())\n\nC = 10**9+7\nn = 5\nL = [0 for i in range(N+1)]\nX = [0 for i in range(N+1)]\nY = [0 for i in range(N+1)]\nZ = [0 for i in range(N+1)]\nW = [0 for i in range(N+1)]\nG = [0 for i in range(N+1)]\nL[3] = 61\nL[4] = 230\nX[3] = 3\nX[4] = 12\nY[3] = 4\nY[4] = 16\nZ[3] = 4\nZ[4] = 15\nW[3] = 3\nW[4] = 1...
['Runtime Error', 'Accepted']
['s897005674', 's706899838']
[3064.0, 3064.0]
[17.0, 18.0]
[553, 571]
p03088
u512007680
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['n, MOD = int(input()), 10 ** 9 + 7\n\nmemo = [{} for _ in range(n+1)]\ndef ok(last4):\n for i in range(4):\n t = list(last4)\n if i >= 1:\n t[i], t[i-1] = t[i-1], t[i]\n if "".join(t).count("AGC") != 0:\n return False\n return True\n\ndef dfs(cur, last3):\n if last3...
['Runtime Error', 'Runtime Error', 'Accepted']
['s178370483', 's282273898', 's449665539']
[3064.0, 3064.0, 3880.0]
[18.0, 19.0, 124.0]
[565, 565, 565]
p03088
u532966492
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['N = int(input())\nmod = 10**9+7\n\ndef check(s):\n for i in range(4):\n l=list(s)\n if i>0:\n l[i-1],l[i]=l[i],l[i-1]\n if "".join(l).count("AGC"):\n return False\n else:\n return True\n\nmemo=[dict() for _ in range(N)]\ndef dfp(i,seq):\n if i==N:\n re...
['Wrong Answer', 'Accepted']
['s407734885', 's113816543']
[3892.0, 3892.0]
[134.0, 127.0]
[523, 530]
p03088
u537963083
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
["N, MOD = int(input()), 10 ** 9 + 7\nmemo = [{} for i in range(N+1)]\n\ndef ok(last4):\n for i in range(4):\n t = list(last4)\n if i >= 1:\n t[i-1], t[i] = t[i], t[i-1]\n if ''.join(t).count('AGC') >= 1:\n return False\n return True\n\ndef dfs(cur, last3):\n print((c...
['Wrong Answer', 'Accepted']
['s206362632', 's413231811']
[4364.0, 3872.0]
[172.0, 129.0]
[593, 595]
p03088
u542376457
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
["def ok(last4):\n for i in range(4):\n t = list(last4)\n if i >= 1:\n t[i-1], t[i] = t[i], t[i-1]\n if ''.join(t).count('AGC') >= 1:\n return False\n return True\ndef dfs(cur, last3):\n if last3 in memo[cur]:\n return memo[cur][last3]\n if cur == N:\n ...
['Runtime Error', 'Accepted']
['s545824978', 's086353021']
[9080.0, 9476.0]
[21.0, 87.0]
[499, 566]
p03088
u587482466
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
["# -*- coding: utf-8 -*-\nimport itertools\nimport sys\nimport math\nfrom functools import lru_cache\n\n\nn = int(input())\n\ndivide = 1000000007\n\nagct = ['A', 'G', 'C', 'T']\n\nout = set()\nfor c in agct:\n out.add('AGC' + c)\n out.add(c+'AGC')\n out.add( 'A' + c + 'GC')\n out.add('AG' + c + 'C')\n o...
['Runtime Error', 'Runtime Error', 'Accepted']
['s254331198', 's563086543', 's227725764']
[13756.0, 13732.0, 13692.0]
[382.0, 392.0, 387.0]
[1031, 1031, 1069]
p03088
u588081069
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['# AGCT -> 0123\n\n\n\n\n\n\n# S + 0\n\n\n# S + 3\n\n\n\n\n\n\nimport numpy as np\n\nN = int(input())\n\nmod = 10 ** 9 + 7\n\nmemo = np.zeros((N + 1, 4, 4, 4))\nmemo[0][3][3][3] = 1\n\n\nfor c in range(N):\n \n for i in range(4):\n \n for j in range(4):\n \n for k in range(4):...
['Wrong Answer', 'Accepted']
['s788800402', 's783338740']
[12392.0, 13104.0]
[283.0, 265.0]
[2063, 2051]
p03088
u588341295
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
["# -*- coding: utf-8 -*-\n\nimport sys\n\ndef input(): return sys.stdin.readline().strip()\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\ndef ceil(x, y=1): return int(-(-x // y))\ndef INT(): return int(input())\ndef MAP(): retur...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s113397816', 's463242764', 's554235343']
[3064.0, 3064.0, 3572.0]
[17.0, 18.0, 63.0]
[660, 705, 1864]
p03088
u604398799
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['# -*- coding: utf-8 -*-\n"""\nCreated on Sat Feb 16 20:52:46 2019\n\n@author: Owner\n"""\n\n\nimport collections\nimport scipy.misc\nimport sys\nimport numpy as np\nimport math\nfrom operator import itemgetter\nimport itertools\nimport copy\nimport bisect\n\n\ndef prime_decomposition(n):\n i = 2\n table = []\n whi...
['Wrong Answer', 'Accepted']
['s122347301', 's015672825']
[14180.0, 15700.0]
[192.0, 589.0]
[2740, 2796]
p03088
u606045429
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['N = int(input())\n\nmod = 10 ** 9 + 7\n\nresult = 3\nfor i in range(3, N):\n result = (4 * result + 2) % mod\nprint(result)\n\n', 'N = int(input())\nmod = 10 ** 9 + 7\n\nmemo = [{} for _ in range(N + 1)]\n\ndef valid(S):\n for i in range(4):\n t = list(S)\n if i >= 1:\n t[i - 1], t[i] =...
['Wrong Answer', 'Accepted']
['s600205813', 's984918614']
[2940.0, 3884.0]
[17.0, 105.0]
[121, 552]
p03088
u652057333
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['# D\nmod = 10**9+7\nn = int(input())\nans = (4**n - (3*4**(n-3)*(n-2) + 2*4**(n-4)*(n-3))) % mod\nprint(ans)', "n = int(input())\nmod = 10 ** 9 + 7\nmemo = [{} for i in range(n + 1)]\n\n\ndef ok(last4):\n for i in range(4):\n t = list(last4)\n if i >= 1:\n t[i], t[i - 1] = t[i - 1], t[i]\n...
['Wrong Answer', 'Accepted']
['s714289602', 's590015935']
[2940.0, 3880.0]
[17.0, 126.0]
[104, 577]
p03088
u666721654
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['#include <bits/stdc++.h>\n\nusing namespace std;\n\nconst int INF = 0x3f3f3f3f;\nconst int MOD = 1e9 + 7;\ntypedef long long ll;\n\nconst int maxn = 110;\n\nint N;\n\nvector<unordered_map<string, ll>> memo(maxn);\n\nbool check(string last4) {\n if (last4.find("AGC") != string::npos) {\n return false;\n }...
['Runtime Error', 'Accepted']
['s708593973', 's390509195']
[2940.0, 3888.0]
[18.0, 125.0]
[977, 574]
p03088
u686036872
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['N = int(input())\n\nMOD = 10**9 + 7\n\ndp = [[[[0 for _ in range(5)] for _ in range(5)] for _ in range(5)] for _ in range(N+1)]\n\ndp[0][0][0][0] = 1\nA = 1\nC = 2\nG = 3\nT = 4\n\nfor i in range(N):\n for p in range(5):\n for q in range(5):\n for r in range(5):\n for s in range(1,...
['Wrong Answer', 'Accepted']
['s228973749', 's994931518']
[3828.0, 3572.0]
[71.0, 69.0]
[992, 993]
p03088
u720636500
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
["N, MOD = int(input()), 10**9 \nmemo = [{} for x in range(N + 1)]\ndef ok(last4):\n for i in range(4):\n t = list(last4)\n if i >= 1:\n t[i-1], t[i] = t[i], t[i-1]\n if ''.join(t).count('AGC') >= 1:\n return False\n return True\n\ndef dfs(cur, last3):\n if last3 in memo[cur]:\n return memo[cur][last3]...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s156909325', 's255075378', 's488618621', 's755197840', 's973771586']
[3876.0, 4004.0, 3064.0, 3876.0, 3964.0]
[91.0, 97.0, 17.0, 89.0, 127.0]
[499, 500, 523, 502, 555]
p03088
u721316601
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
["import itertools\n\ns = 'ACGT'\ns = [a+b+c for a,b,c in itertools.product(s,s,s)]\nn = {s_:1 for s_ in s}\nn['AGC'] = 0\nn['GAC'] = 0\nn['ACG'] = 0\n\nN = int(input())\n\nfor i in range(N-3):\n count = {s_:0 for s_ in s}\n for _ in s:\n for a in 'ACGT':\n x = _+a\n if 'GAC' in x or ...
['Runtime Error', 'Accepted']
['s755225485', 's933634194']
[3064.0, 3188.0]
[38.0, 38.0]
[594, 676]
p03088
u729133443
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
["a=b=c=d=e=f=0;g=1;exec('a,b,c,d,e,f,g=b,e,e-d,f,g,g-c,g*4-b-c-d-a*3;'*int(input()));print(g%(1e9+7))", "a=b=c=d=e=f=0;g=1;exec('a,b,c,d,e,f,g=b,e,e-d,f,g,g-c,(g*4-b-c-d-a*3))%(10**9+7);'*int(input()));print(g)", "a=b=c=d=e=f=0;g=1;exec('a,b,c,d,e,f,g=b,e,e-d,f,g,g-c,(g*4-b-c-d-a*3)%(10**9+7);'*int(input()));print(g)"...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s686156029', 's960083719', 's216160397']
[4468.0, 3060.0, 4724.0]
[21.0, 18.0, 21.0]
[100, 105, 104]
p03088
u763115743
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['def dfs(index, last, string, memo):\n mod = 10 ** 9 + 7\n if string in memo[index]:\n return memo[index][string]\n if index == last:\n return 1\n\n ret = 0\n for s in "ACGT":\n if check(string + s):\n ret = (ret + dfs(index + 1, last, string[1:] + s, memo)) % mod\n me...
['Wrong Answer', 'Accepted']
['s801099062', 's185043210']
[4196.0, 3872.0]
[131.0, 127.0]
[761, 745]
p03088
u763968347
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
["N = int(input())\nMOD = 10**9+7\nmemo = [{} for _ in range(N+1)]\n\ndef ok(last4):\n for i in range(4):\n t = list(last4)\n if i >= 1:\n t[i-1],t[i] = t[i],t[i-1]\n if ''.join(t).count('AGC') >= 1:\n return False\n return True\n\ndef dfs(cur,last3):\n if...
['Wrong Answer', 'Accepted']
['s743987788', 's904529561']
[3916.0, 3848.0]
[56.0, 123.0]
[565, 553]
p03088
u774539708
2,000
1,048,576
You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7: * The string does not contain characters other than `A`, `C`, `G` and `T`. * The string does not contain `AGC` as a substring. * The condition above cannot be violated by swapping two adjacent...
['#A,G,C,T=0,1,2,3\n\n\nn=int(input())\nA=[[1,1,1,1],[1,1,0,1],[1,0,1,1],[1,1,1,1]] \nB=[[3,3,2,3],[3,3,3,3],[3,3,3,3],[3,3,3,3]] \nmod=10**9+7\n\nfor _ in range(n-3):\n nA=[[0]*4 for i in range(4)]\n nB=[[0]*4 for i in range(4)]\n for i in range(4):\n for j in range(4): \n if j!=3: \n ...
['Wrong Answer', 'Accepted']
['s364711802', 's128827777']
[3192.0, 3444.0]
[21.0, 27.0]
[1327, 1384]