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 |
|---|---|---|---|---|---|---|---|---|---|---|
p02713 | u840958781 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['k = int(input())\n \ndef gcd2(a,b):\n if b == 0:\n return a\n return gcd2(b,a%b)\n\ndef gcd3(a,b,c):\n return gcd2(gcd2(a,b), c)\n\nans = 0\nfor a in range(1,k+1):\n for b in range(i,k+1):\n for c in range(j, k+1):\n if a == b == c:\n ans += gcd3(a,b,c)\n ... | ['Runtime Error', 'Accepted'] | ['s166597595', 's485584825'] | [9216.0, 9200.0] | [23.0, 1367.0] | [429, 430] |
p02713 | u845573105 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['function GCM(x, y):\n if x == y:\n return x\n if x < y:\n s = x\n x = y\n y = s\n \n a = x%y\n if a == 0:\n return y\n return GCM(y, a)\n\nk = int(input())\nres = 0\nsame1 = 0\nsame2 = 0\nrate = [6,3,1]\nfor p in range(1,k+1):\n for q in range(p, k+1):\n same1 = int(p==q)\n gcm = GCM(q,p)\... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s211461919', 's775197255', 's823127146'] | [9040.0, 9240.0, 9236.0] | [19.0, 703.0, 765.0] | [438, 616, 617] |
p02713 | u845650912 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['def euclidean(a, b):\n r = a % b\n if r == 0:\n return b\n return euclidean(b,r)\n\n\n\nN = int(input())\n\ns = 0\n\nfor i in range(N):\n for j in range(N):\n for k in range(N):\n s +=euclidean(euclidean(i+1,j+1),k+1)', 'import math\n\n\nN = int(input())\n\ns = 0\n\nfor i in range... | ['Wrong Answer', 'Accepted'] | ['s519491721', 's802732140'] | [9096.0, 9164.0] | [2205.0, 1536.0] | [239, 182] |
p02713 | u848654125 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import scipy as sp\nfrom itertools import combinations_with_replacement as com\n\ndef tri_gcd(a, b, c):\n return sp.gcd(a, sp.gcd(b, c))\n\ndef make_divisors(n):\n divisors = []\n for i in range(2, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s132776560', 's768277391', 's111711420'] | [31200.0, 31120.0, 31140.0] | [125.0, 1477.0, 1410.0] | [831, 226, 235] |
p02713 | u849756457 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['\ndef q3():\nimport math\n k = int(input())\n sum_n = 0\n gcd_2_dict = {}\n def gcd(n1, n2):\n if n1 < n2:\n sorted_nums = tuple([n1, n2])\n else:\n sorted_nums = tuple([n2, n1])\n if sorted_nums in gcd_2_dict:\n return gcd_2_dict[sorted_nums]\n ... | ['Runtime Error', 'Accepted'] | ['s724680739', 's873451215'] | [8944.0, 9168.0] | [20.0, 1078.0] | [654, 195] |
p02713 | u851125702 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['mport math\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n\n\nN=int(input())\nS=0\nT=0\nfor i in range(1,N+1):\n for j in range(i+1,N+1):\n for k in range(j+1,N+1):\n S+=gcd(i,j,k)\nfor i in range(1,N+1):\n for j in range(i+1,N+1):\n T+=gc... | ['Runtime Error', 'Accepted'] | ['s883882332', 's320811001'] | [9012.0, 9632.0] | [23.0, 640.0] | [362, 363] |
p02713 | u854992222 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\nk = int(input())\nsum =0\nfor a in range(1, k+1):\n for b in range(1, k+1):\n x = gcd(a, b)\n for c in range(1, k+1):\n sum += gcd(x, c)\nprint(sum)', 'import math\nk = int(input())\nsum =0\nfor a in range(1, k+1):\n for b in range(1, k+1):\n x = math.gcd(a, b)... | ['Runtime Error', 'Accepted'] | ['s047413451', 's934752491'] | [9188.0, 9184.0] | [22.0, 1498.0] | [185, 195] |
p02713 | u856282038 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['def gcd(a,b):\n if a<b:\n tmp = a\n a = b\n b = tmp\n r = a % b\n while r!=0:\n a = b\n b = r\n r = a % b\n return b\n \ndef main():\n K = int(input())\n list_ = []\n sum_ = 0\n for i in range(K):\n for j in range(K):\n a = gcd(i,j)\n ... | ['Runtime Error', 'Accepted'] | ['s620953610', 's979208798'] | [9192.0, 9444.0] | [22.0, 1323.0] | [442, 454] |
p02713 | u863964720 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\nfrom functools import reduce\nfrom math import gcd\nK = int(input())\nA=[]\nB=[]\nfor a in range(1,K+1):\n for b in range(1,K+1):\n A.append(gcd(a,b))\nfor x in range(len(A)):\n for c in range(1,K+1):\n B.append(gcd(A[x],c))\nfor i in range(len(B)):\n sum +=B[i]\nprint(sum)\n', 'im... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s229619997', 's568173049', 's732930231', 's968289505'] | [72012.0, 9748.0, 9056.0, 9168.0] | [1476.0, 32.0, 23.0, 1456.0] | [297, 280, 279, 186] |
p02713 | u864273141 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\nfrom functools import reduce\nk=int(input())\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\nans=0\nfor i in range(1,k+1):\n for j in range(i,k+1):\n for l in range(j,k+1):\n if l==i:\n ans+=gcd(i,j,l)\n elif i==j or j==l:\n ans+=2*gcd(i,j,l)\n else:\n a... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s372891419', 's496171203', 's351025516'] | [9624.0, 9596.0, 9656.0] | [784.0, 25.0, 814.0] | [331, 330, 335] |
p02713 | u868628468 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['K = int(input())\nans = 0\nfor i in range(1,K+1):\n for j in range(1,K+1):\n for k in range(1,K+1):\n if j < k:\n j,k = k,j\n temp = gcd(j,k)\n if i < temp:\n i,temp = temp,i\n ans += gcd(i,temp)\nprint(ans)', 'import math\n \nk = int... | ['Runtime Error', 'Accepted'] | ['s350111505', 's732908961'] | [9196.0, 9112.0] | [22.0, 1388.0] | [280, 196] |
p02713 | u870297120 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\nfrom functools import reduce\nimport itertools\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n\nk = int(input())\nans = 0\n\nseq = [i for i in range(1, k+1)]\nb = list(itertools.combinations_with_replacement(seq,3))\n\nfor a in b:\n if a[0] == a[1] == a[2]:\n ans += gcd(a[0], a[1]... | ['Runtime Error', 'Accepted'] | ['s532529760', 's179328246'] | [105980.0, 9180.0] | [189.0, 1884.0] | [374, 173] |
p02713 | u872704421 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['n=int(input())\n\ntotal=0\nfor nn in range(1,n+1):\n for k in range(1,n+1):\n for l in range(1,n+1):\n total+=math.gcd(nn,math.gcd(k,l))\n\nprint(total)', 'import math\n\nn=int(input())\n \ndef diffs(n):\n total=0\n for k in range(1,n):\n for l in range(k+1,n):\n total+=math.gcd(n,math.gcd(k,l))*6\... | ['Runtime Error', 'Accepted'] | ['s837648972', 's324059062'] | [9180.0, 9200.0] | [20.0, 342.0] | [153, 282] |
p02713 | u878291720 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import fractions\nK = int(input())\nA = [i for i in range(1, K+1)]\nB = [i for i in range(1, K+1)]\nC = [i for i in range(1, K+1)]\n \ncnt = 0\nfor a in A:\n for b in B:\n for c in C:\n N = [a,b,c]\n ans = N[0]\n for i in range(1, 3):\n ans = fractions.gcd(ans, N[i])\n cnt += ans\nprint... | ['Time Limit Exceeded', 'Runtime Error', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Runtime Error', 'Accepted'] | ['s009204546', 's725584971', 's749425821', 's767342761', 's960055987', 's672526284'] | [10616.0, 10456.0, 21616.0, 10620.0, 8952.0, 71724.0] | [2205.0, 30.0, 2206.0, 2205.0, 24.0, 1350.0] | [308, 301, 157, 218, 219, 220] |
p02713 | u881816188 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['from math import gcd\n\nk=int(input())\nans=0\nfor i in range(1,k+1):\n for j in range(1,k+1):\n for l in range(1,k+1):\n ans+=gcd(math.gcd(i,j), l)\n #print(gcd(i,j,l))\nprint(ans)', 'import math\nfrom functools import reduce\n\n\ndef gcd(*numbers):\n return reduce(math.gcd, number... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s921390460', 's925215995', 's614143373'] | [9204.0, 9564.0, 9180.0] | [24.0, 2205.0, 1920.0] | [204, 271, 199] |
p02713 | u884323674 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['\nmax_codiv = []\n \n\nn = int(input())\n \nimport math\n\nfor i in range(1, n+1):\n for j in range(1, n+1):\n \ti_j = math.gcd(i, j)\n for k in range(1, n+1):\n i_j_k = math.gcd(i_j, k)\n max_codiv.append(i_j_k)\nprint(sum(max_codiv))', '\nmax_codiv = []\n \n\nn = int(input())\n \n... | ['Runtime Error', 'Accepted'] | ['s683892544', 's258787459'] | [9028.0, 71656.0] | [24.0, 1681.0] | [395, 365] |
p02713 | u884601206 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\nn=int(input())\nans=0\nfor i in range(1,k+1):\n\t\n for j in range(1,k+1):\n\t\t\n for l in range(1,k+1):\n\t\t\t\n ans+=math.gcd(i,math.gcd(j,l))\n\nprint(ans)', 'import math\n\nK = int(input())\n\nans = 0\nfor i in range(1, K+1):\n for j in range(1, K+1):... | ['Runtime Error', 'Accepted'] | ['s636935554', 's935069204'] | [9176.0, 9116.0] | [20.0, 1377.0] | [201, 196] |
p02713 | u891687930 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['from math import gcd\nimport itertools\nn = int(input())\nans = 0\n\nfor C in itertools.combinations_with_replacement(range(1,n+1),3):\n ans += gcd(gcd(C[0],C[1]),C[2])\nprint(ans)', 'from math import gcd\n \nn = int(input())\nans = 0\n\nfor a in range(1,n+1):\n for b in range(1,n+1):\n for c in range(1,... | ['Wrong Answer', 'Accepted'] | ['s992633486', 's947530884'] | [9184.0, 9168.0] | [422.0, 1890.0] | [176, 175] |
p02713 | u892487306 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ["def gcd(a, b):\n # `a >= b` is sopposed\n if b == 0:\n return a\n else:\n return gcd(b, a % b)\n\n\ndef main():\n K = 200\n answer = 0\n for a in range(1, K + 1):\n for b in range(a, K + 1):\n gcd_ab = gcd(b, a)\n for c in range(b, K + 1):\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s235535499', 's604308600', 's054848458'] | [9148.0, 9324.0, 9512.0] | [415.0, 91.0, 84.0] | [640, 645, 654] |
p02713 | u892882715 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\n\nK = int(input())\n\ndef gcd(a, b, c):\n g = math.gcd(a, b)\n return math.gcd(g, c)\n\nresult = sum((gcd(a, b, c) for a in range(1, K + 1) for b in range(1, K + 1) for c in range(1, K + 1)))', 'import math\n\nK = 200 #int(input())\n\ntotal = 0\nfor a in range(1, K + 1):\n for b in range(1, K + ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s192714284', 's550650299', 's791776654'] | [9192.0, 9100.0, 9184.0] | [2195.0, 1457.0, 608.0] | [202, 214, 274] |
p02713 | u896726004 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['from itertools import (\n accumulate, \n groupby, \n permutations, \n combinations, \n product, \n combinations_with_replacement, \n)\n\nimport fractions\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(fractions.gcd, numbers)\n\ndef gcd_list(numbers):\n return reduce(... | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s613116110', 's677377258', 's351004069'] | [10700.0, 10724.0, 10528.0] | [2205.0, 2206.0, 888.0] | [618, 821, 775] |
p02713 | u896741788 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['k=int(input())+1\nfrom math import gcd\nprint(sum(gcd(gcd(i,j),r) for i in range(1,k) for j in range(1,k) for r in range(1,k) )\nk=int(input())+1\nfrom math import gcd\nprint(sum( gcd(gcd(i,j),r) for i in range(1,k) for j in range(1,k) for r in range(1,k) ))\n', 'k=int(input())+1\nfrom math import gcd\nprint(su... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s614441011', 's768787468', 's596018105'] | [9016.0, 9020.0, 9168.0] | [22.0, 20.0, 1254.0] | [260, 129, 131] |
p02713 | u896838289 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import io\n\n\ndef gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a % b)\n\n\ndef __main__():\n K = int(input())\n\n ans = 0\n for a in range(1,K+1):\n for b in range(1,K+1):\n for c in range(1,K+1):\n ans += gcd(c, gcd(a, b))\n\n print(ans)', 'import nump... | ['Wrong Answer', 'Accepted'] | ['s370031687', 's858827434'] | [9124.0, 27168.0] | [23.0, 1714.0] | [285, 260] |
p02713 | u901598613 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['n=int(input())\nimport math\nans=0\nfor i in range(2,n+1):\n for j in range(1,n+1):\n ij=math.gcd(i,j)\n if ij==1:\n ans+=n\n else:\n for k in range(1,n+1):\n ans+=math.gcd(ij,k)\nprint(ans)', 'n=int(input())\nimport math\nans=0\nfor i in range(1,n+1):\n ... | ['Wrong Answer', 'Accepted'] | ['s165922580', 's258433250'] | [9180.0, 9172.0] | [590.0, 617.0] | [240, 240] |
p02713 | u906501980 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['def main():\n k = int(input())\n gcds = list(sorted([gcd(i, j) for i in range(1, k+1) for j in range(1, k+1)]))\n j = 0\n s = list(set(gcds))\n m = k**2-1\n gcdss = [0]*len(s)\n for i, l in enumerate(s):\n while gcds[j] == l:\n j += 1\n gcdss[i] += 1\n if j == ... | ['Runtime Error', 'Accepted'] | ['s958479963', 's597326422'] | [9712.0, 9372.0] | [71.0, 44.0] | [600, 457] |
p02713 | u907223098 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n \nk=int(input())\nr=0\nl=[]\n\nfor i in range(k):\n for j in range(k):\n for l in range(k):\n if i<=j and j<=k:\n l.append([i+1,j+1,k+1])\nfor s in l:\n r+=gcd(s[0],s[1],s[2])\nprint(r)\n', 'impor... | ['Runtime Error', 'Accepted'] | ['s797151378', 's460268181'] | [9480.0, 9172.0] | [23.0, 1494.0] | [291, 161] |
p02713 | u907446975 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['a=str(input())\nif \'7\' in a:\n print("Yes")\nelse:\n print("No")', 'from math import gcd\nk=int(input())\nre=0\nfor i in range(1,k+1):\n for j in range(1,k+1):\n v=gcd(i,j)\n for l in range(1,k+1):\n re+=gcd(v,l)\nprint(re)\n'] | ['Wrong Answer', 'Accepted'] | ['s233734696', 's994719272'] | [9092.0, 9088.0] | [20.0, 1181.0] | [66, 176] |
p02713 | u914948583 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\n\nk = int(input())\nans = 0\nfor a in range(1, k+1):\n for b in range(1, k+1):\n ab = math.gcd(a, b)\n if ab == 1:\n ans += k\n continue\n for k in range(1, k+1):\n ans += math.gcd(ab,k)\n\nprint(ans)', '\nimport math\n\nk = int(input())\nans = 0\nfor a in... | ['Wrong Answer', 'Accepted'] | ['s619380498', 's489302276'] | [9140.0, 9188.0] | [35.0, 598.0] | [249, 258] |
p02713 | u915879510 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\nfrom functools import reduce\n \nk = int(input())\nk+=1\n\nsum = 0\nfor c in range(1,k):\n for b in range(1,k):\n for a in range(1,k):\n sum+=reduce(math.gcd, [a,b,c])', 'import math\nfrom functools import reduce\n \nk = int(input())\nk+=1\n\nsum = 0\nfor a in range(1,k):\n for b in range(a,k... | ['Wrong Answer', 'Accepted'] | ['s591997482', 's472534571'] | [9564.0, 9632.0] | [2206.0, 1073.0] | [180, 351] |
p02713 | u916662650 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import fractions\n\nK = int(input())\nresult = 0\nsum = 0\n\nfor a in range(1,K+1):\n for b in range(1,K+1):\n for c in range(1,K+1):\n result = fractions.gcd(a, b)\n result = fractions.gcd(result, c)\n sum = sum + result\n\nprint(sum) ', 'import math\nK = int(input())\nres... | ['Time Limit Exceeded', 'Accepted'] | ['s253355898', 's381535544'] | [10656.0, 9172.0] | [2206.0, 1407.0] | [267, 225] |
p02713 | u922172470 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['k = int(input())\n\nsum = 0\nfor a in range(1, k+1):\n for b in range(1, k+1):\n for c in range(1,k+1):\n sum += gcd(gcd(a,b), c)\n\nprint(sum)', 'def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\ndef resolve():\n k = int(input())\n\n tmp = []\n for a in range(1, k+1... | ['Runtime Error', 'Accepted'] | ['s587713433', 's434859812'] | [9172.0, 9300.0] | [22.0, 1427.0] | [156, 334] |
p02713 | u924717835 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\nK = int(input())\nsum = 0\nfor a in range(1,K+1):\n for b in range(1,K+1):\n for c in range(1,K+1):\n ans+=math.gcd(math.gcd(a,b),c)\nprint(sum(list))\n', 'import math\nK = int(input())\nsum = 0\nfor a in range(1,K+1):\n for b in range(1,K+1):\n x = math.gcd(a,b)\n f... | ['Runtime Error', 'Accepted'] | ['s715219975', 's173122892'] | [9136.0, 9132.0] | [22.0, 1286.0] | [178, 185] |
p02713 | u927282564 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\nfrom functools import reduce\nimport itertools\nimport numpy as np\n\n\ndef gcd_list(numbers):\n return reduce(math.gcd, numbers)\n\n\nK = int(input())\n\nl = [i for i in range(1, K + 1)]\n\ntemp_1 = np.array([])\nfor j in itertools.combinations(l, 3):\n temp_1=np.append(temp_1,gcd_list(list(j)))\n... | ['Runtime Error', 'Accepted'] | ['s739017278', 's973114907'] | [27996.0, 27040.0] | [2206.0, 768.0] | [647, 436] |
p02713 | u928784113 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import itertools\nfrom collections import deque,defaultdict,Counter\nfrom itertools import accumulate\nimport bisect\nfrom heapq import heappop,heappush,heapify\nfrom fractions import gcd\nfrom copy import deepcopy\nimport math\nimport queue\n\nMod = 1000000007\nimport sys\nsys.setrecursionlimit(100000) \n \ndef sie... | ['Time Limit Exceeded', 'Runtime Error', 'Wrong Answer', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Runtime Error', 'Accepted'] | ['s020772100', 's334718329', 's401086591', 's571070558', 's591845037', 's739374196', 's780703436', 's848606297'] | [11044.0, 9172.0, 11024.0, 10952.0, 123636.0, 10628.0, 9120.0, 9184.0] | [2206.0, 21.0, 2206.0, 2206.0, 2209.0, 2206.0, 22.0, 1309.0] | [1749, 340, 1743, 1749, 1831, 366, 365, 361] |
p02713 | u932868243 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\nk=int(input())\nlist=[]\nfor a in range(1,k+1):\n for b in range(1,k+1):\n for c in range(1,k+1):\n list.append(math.gcd((a,b),c))\nprint(sum(list))', 'import math\nk=int(input())\nlist=[]\nfor a in range(1,k+1):\n for b in range(1,k+1):\n for c in range(1,k+1):\n list.append(math.gcd(g... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s108036620', 's851671502', 's503994370'] | [9184.0, 9180.0, 71496.0] | [24.0, 21.0, 1509.0] | [163, 166, 179] |
p02713 | u934788990 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['from math import math\n\nk = int(input())\ncount = 0\nfor i in range(1,k+1):\n for j in range(1,k+1):\n for l in range(1,k+1):\n count += gcd(gcd(j,l),i)\nprint(count)\n', 'from math import gcd\nK=int(input())\nans=0 \n \nfor i in range(1,K+1):\n for j in range(1,K+1):\n for l in range(1,K+1)... | ['Runtime Error', 'Accepted'] | ['s942908614', 's294611228'] | [9044.0, 9168.0] | [19.0, 1915.0] | [181, 161] |
p02713 | u941438707 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['n=int(input())\na=0\nfor i in range(n+1):\n for j in range(n+1):\n for k in range(n+1):\n a+=g[g[i][j]][k]\nprint(a)', 'from math import *\ng=[[0]*202 for _ in range(202)]\nfor i in range(1,201):\n for j in range(1,201):\n g[i][j]=gcd(i,j)\nn=int(input())\na=0\nfor i in range(n+1):\n ... | ['Runtime Error', 'Accepted'] | ['s392921091', 's723897774'] | [9164.0, 9516.0] | [24.0, 1400.0] | [131, 257] |
p02713 | u941645670 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['n = int(input())\nresult = [0]*n**3\nfor a in range(n):\n for b in range(n):\n for c in range(n):\n if a > b:\n result[n*n*a +n*b + c]= result[n*n*b +n*a + c]\n elif b > c:\n result[n*n*a +n*b + c]= result[n*n*a +n*c + b]\n else:\n ... | ['Runtime Error', 'Accepted'] | ['s438371212', 's146111990'] | [71376.0, 9140.0] | [102.0, 1580.0] | [376, 243] |
p02713 | u947327691 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['from fractions import gcd\nk=int(input())\nsum=0\nfor l in range(1,k+1):\n for m in range(1,k+1):\n for n in range(1,k+1):\n sum += gcd(gcd(l,m),n)\n\nprint(sum)', 'from fractions import gcd\nk=int(input())\nr1=[]\nr2=[]\nfor l in range(1,k+1):\n for m in range(1,k+1):\n r1.append(gcd(l... | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s344903645', 's397422752', 's505394384'] | [10652.0, 30244.0, 9176.0] | [2206.0, 2206.0, 1930.0] | [174, 231, 171] |
p02713 | u948233576 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\n\nK=2\ncount = 0\nfor a in range(1,K+1):\n for b in range(1,a+1):\n for c in range(1,b+1):\n print(a,b,c)\n _z=math.gcd(a,b)\n if a==b and b==c:\n k=1\n else:\n k=3\n count += k * math.gcd(_z,c)\nprint(count)\n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s457555960', 's983391313', 's023197906'] | [9060.0, 9172.0, 9212.0] | [20.0, 450.0, 657.0] | [303, 178, 347] |
p02713 | u953110527 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\nK = int(input())\ncount = 0\nfor i in range(1,K+1):\n for j in range(i,K+1):\n for k in range(1,K+1):\n if i != j:\n count += math.gcd(math.gcd(i,j),k)\n else:\n count += math.gcd(math.gcd(i,j),k)\nprint(count)', 'import math\nK = int(input())... | ['Wrong Answer', 'Accepted'] | ['s263634859', 's698927203'] | [9192.0, 9064.0] | [1332.0, 1359.0] | [275, 279] |
p02713 | u955123468 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['from math import gcd\nkey = int(input())\nsin = 0\nfor i in range(1,k+1):\n for j in range(1,k+1):\n tmp = gcd(i,j)\n for m in range(1,k+1):\n sin += gcd(m,tmp)\nprint(sin)', 'from math import gcd\nkey = int(input())\nsin = 0\nfor i in range(1,key+1):\n for j in range(1,key+1):\n ... | ['Runtime Error', 'Accepted'] | ['s634918145', 's059740081'] | [9108.0, 9184.0] | [22.0, 1126.0] | [192, 200] |
p02713 | u961674365 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['def gcd(a,b):\n if b == 0:\n return a\n else:\n return gcd(b,a%b)\n\n\nk=input()\nans=0\nfor i in range(1,k+1):\n for j in range(1,k+1):\n d=gcd(i,j)\n for l in range(1,k+1):\n if d!=1:\n ans+=gcd(d,l)\n else:\n ans+=1\n\n\nprint(ans)', 'import sys\nsys.setrecursionlimit(4100000... | ['Runtime Error', 'Accepted'] | ['s654396266', 's274743551'] | [9128.0, 9196.0] | [21.0, 1894.0] | [254, 303] |
p02713 | u961945062 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n\nN = int(input())\ni = 0\n\nfor a in range(1, N+1):\n for b in range(1, N+1):\n for c in range(1, N+1):\n i += gcd(a, b, c)\n', 'from math import gcd \nN = int(input())\ni = 0\n \nfor a in rang... | ['Wrong Answer', 'Accepted'] | ['s810815684', 's948368582'] | [9628.0, 9176.0] | [2205.0, 1889.0] | [237, 187] |
p02713 | u964299793 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['k=int(input())\nans=0\nfrom fractions import gcd\nimport functools \nfor a in range(1,k+1):\n for b in range(1,k+1):\n for c in range(1,k+1):\n @functools.lru_cache(None) \n def gc(x,y):\n if x>y:\n x,y=y,x\n return gcd(x,y)\n\n ... | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s069678845', 's239113918', 's901201686', 's117031255'] | [10752.0, 10616.0, 10668.0, 9172.0] | [2206.0, 2205.0, 2206.0, 1117.0] | [341, 185, 199, 180] |
p02713 | u966311314 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n\nK = int(input())\nsum = 0\nfor i in range(1, K+1):\n for j in range(1, K+1):\n for k in range(1, K+1):\n sum += gcd(i,j,k)\nprint(sum)', 'import math\nK=int(input())\nans=0\nfor i in range(1,K+1):\n for j in range(1,K+1):\n ... | ['Runtime Error', 'Accepted'] | ['s589155362', 's505058876'] | [9168.0, 9184.0] | [23.0, 1392.0] | [207, 192] |
p02713 | u966880389 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import numpy as np\nimport math\n\nnum = int(input())\na = 1\nsum = 0\n\ndef gcd(a, b, c):\n num = np.array([a, b, c])\n return np.gcd(np.gcd.reduce(num))\n\ndef loopC(a, b, num):\n c = 1\n sum = 0\n while c <= num:\n ans = gcd(a, b, c)\n sum += ans\n c += 1\n return sum\n\ndef loopB(a, num):\n ... | ['Runtime Error', 'Accepted'] | ['s764182172', 's667061094'] | [27180.0, 9128.0] | [108.0, 1345.0] | [469, 203] |
p02713 | u968404618 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\nk = int(input())\n\nans = 0\nfor a in range(k+1, 1, -1):\n for b in range(k+1, 1, -1):\n for c in range(k+1, 1, -1):\n ans += math.gcd(a, math.gcd(b, c))\nprint(ans)', 'import math\n\nk = int(input())\n\nans = 0\nfor a in range(1, k+1):\n for b in range(1, k+1):\n tmp = mat... | ['Wrong Answer', 'Accepted'] | ['s540386231', 's253682728'] | [9184.0, 9184.0] | [2205.0, 1338.0] | [191, 198] |
p02713 | u973972117 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['N = int(input())\ns = 0\nfor i in range(0,N):\n if (i+1) % 3 1= 0 or (i+1) % 5 != 0:\n s = s + (i+1)\nprint(s)', 'K = int(input())\nS = 0\n\ndef gcd(a,b):\n while b != 0:\n a, b = b, a % b\n if b ==0:\n return a\nA1 = [0,0]\nA2 = [0,0,0]\nfor i in range(1, K):\n S = S + i\n\nif K > 1:\n... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s458517860', 's664214740', 's571420563'] | [9004.0, 9252.0, 9240.0] | [22.0, 971.0, 899.0] | [109, 713, 694] |
p02713 | u975445930 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\nfrom functools import reduce\n\nk = int(input())\nans = 0\n\ndef gcd(numbers):\n return reduce(math.gcd, numbers)\n\nfor i in range(k):\n for j in range(k):\n for k in range(k):\n ans += gcd([i+1, j+1, k+1])\n\nprint(ans)', 'from math import gcd\n\ndef solve():\n K = int(input())+1\n an... | ['Wrong Answer', 'Accepted'] | ['s004453983', 's843211935'] | [9628.0, 9176.0] | [32.0, 1402.0] | [232, 227] |
p02713 | u982152304 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import numpy as np\nimport math\nK = int(input())\nmemo = np.zeros((K,K),int)\ns = 0\nfor i in range(K):\n for j in range(i,K+1):\n for k in range(j,K+1):\n if memo[i][j] != 0:\n if memo[memo[i][j]-1][k] != 0:\n s += memo[memo[i][j]-1][k]\n else:\n memo[memo[i][j]-1][k] = math... | ['Runtime Error', 'Accepted'] | ['s251235154', 's061579417'] | [27292.0, 27204.0] | [106.0, 778.0] | [763, 337] |
p02713 | u982749462 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['import math\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n\ndef gcd_list(numbers):\n return reduce(math.gcd, numbers)\n \nk = int(input())\ns = 0\nfor i in range(k):\n for j in range(k):\n for h in range(k):\n s += gcd(i,j,h)\nprint(s)', 'import math\nfrom fun... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s782656090', 's790405359', 's291048121'] | [9640.0, 9580.0, 9848.0] | [2205.0, 23.0, 1414.0] | [278, 300, 332] |
p02713 | u983327168 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['k=int(input())\n ans=0\n for x in range(1,k+1):\n for y in range(1,k+1):\n for z in range(1,k+1):\n if math.gcd(x,y)==1:\n ans+=1\n \n elif math.gcd(math.gcd(x,y),z)==1: \n ans+=1\n else: \n ... | ['Runtime Error', 'Accepted'] | ['s981003200', 's088247560'] | [8952.0, 89112.0] | [24.0, 214.0] | [363, 118] |
p02713 | u984276646 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['K = int(input())\ndef gcd(x, y):\n a, b = x, y\n while b != 0:\n a, b = b, a % b\n return a\ngcds = [[0 for j in range(K)] for i in range(K)]\nfor i in range(K):\n for j in range(K):\n gcds[i][j] = gcd(i+1, j+1)\nS = 0\nfor i in range(K):\n for j in range(K):\n for k in range(K):\n S += gcds[gcds[i... | ['Runtime Error', 'Accepted'] | ['s161042541', 's613636542'] | [9484.0, 9164.0] | [1310.0, 22.0] | [321, 413] |
p02713 | u986025116 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['from math import gcd\nN = int(input())\nsum = 0\nfor i in range(1, N+1):\n for j in range(1, N+1):\n\t\ttmp=gcd(j,k);\n for k in range(1, N+1):\n sum += gcd(i, tmp)\nprint(sum)', 'from math import gcd\nN = int(input())\nsum = 0\nfor i in range(1, N+1):\n for j in range(1, N+1):\n\t\ttmp=gcd(j,... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s011833412', 's862163959', 's124025819'] | [8960.0, 9028.0, 9176.0] | [22.0, 22.0, 1204.0] | [187, 187, 191] |
p02713 | u991269553 | 2,000 | 1,048,576 | Find \displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}. Here \gcd(a,b,c) denotes the greatest common divisor of a, b, and c. | ['k = int(input())\n\n#acd_list = []\nall_num = [i for i in range(1,k + 1)]\nans = 0 \n\n#comb_list = list(itertools.combinations(all_num, 3))\n#print(comb_list)\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n\ndef gcd_list(numbers):\n return reduce(math.gcd, numbers)\n\nresult = []\nfor i in all_num:... | ['Runtime Error', 'Accepted'] | ['s370346280', 's376553403'] | [482856.0, 9180.0] | [2218.0, 1431.0] | [466, 196] |
p02714 | u004482945 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["n=int(input())\ns=list(input())\nans=s.count('R')*s.count('G')*s.count('B')\nfor i in range(n):\n if s[i]=='R':\n s[i]=1\n elif s[i]=='G':\n s[i]=2\n elif s[i]=='B':\n s[i]=4\nfor i in range(n):\n for j in range(i+1,n):\n k=2*j-i\n if k>=n:\n continue\n if s[i]+s[j]+s[k]==7... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s010979186', 's158219774', 's936458208', 's734710205'] | [8948.0, 9032.0, 9220.0, 9148.0] | [21.0, 24.0, 24.0, 1691.0] | [331, 328, 329, 323] |
p02714 | u017050982 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['N = int(input())\nR = []\nG = []\nB = []\ns =input()\nans = 0\nfor i in range(N):\n if s[i] == "R":\n R.append(i)\n elif s[i] == "G":\n G.append(i)\n else:\n B.append(i)\nsB = set(B)\nprint(sB)\nans = len(R) * len(G) * len(B)\nfor r in R:\n for g in G:\n i = min(r,g)\n j... | ['Wrong Answer', 'Accepted'] | ['s208372647', 's273006827'] | [9328.0, 9340.0] | [1261.0, 1311.0] | [483, 473] |
p02714 | u030726788 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["n = int(input())\ns = input()\n\nr = [0] * n\ng = [0] * n\nb = [0] * n\ndc = {'R':[0]*n,'G':[0]*n,'B':[0]*n}\nfor i in range(n-1):\n dc['R'][i] = dc['R'][i + 1]\n dc['G'][i] = dc['G'][i + 1]\n dc['B'][i] = dc['B'][i + 1]\n dc[s[i]] += 1\n# print(r)\n# print(g)\n# print(b)\ndcc = {('R','G'):'B',('R','B'):'... | ['Runtime Error', 'Accepted'] | ['s135307225', 's543877125'] | [9284.0, 9216.0] | [23.0, 1884.0] | [659, 384] |
p02714 | u033524082 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['n=int(input())\ns=input()\nans=0\nr=[]\ng=[]\nb=[]\nfor i in range(n):\n tmp=s[i]\n if tmp=="R":\n r.append(i+1)\n elif tmp=="G":\n g.append(i+1)\n else:\n b.append(i+1)\nfor i in r:\n for j in g:\n for k in b:\n if (i<j and j<k and i<k) or (i<k and k<j and i<j):\... | ['Wrong Answer', 'Accepted'] | ['s257772468', 's475850915'] | [9260.0, 9212.0] | [2205.0, 1760.0] | [427, 285] |
p02714 | u036514535 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["N = int(input())\nS = input()\nSr = Sg = Sb = 0\nfor c in S:\n if c == 'R':\n Sr += 1\n elif c == 'G':\n Sg += 1\n else:\n Sb += 1\nA = Sr * Sg * Sb\nfor sep in range(1,(N-1)//2):\n for i in range(N-2*sep):\n if S[i] != S[i+sep] and S[i+sep] != S[i+2*sep] and S[i] != S[i+2*sep]... | ['Wrong Answer', 'Accepted'] | ['s133073953', 's718184076'] | [9200.0, 9184.0] | [1352.0, 1395.0] | [335, 335] |
p02714 | u038613676 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['# -*- coding: utf-8 -*-\n\nimport sys\nargs = sys.argv\n\ndebug_flg = False\ndef debug(val1,val2="",val3="",val4=""):\n global debug_flg\n if debug_flg:\n print(val1,val2,val3,val4,sep=" , ")\n\nif len(args) != 2:\n n= int(input())\n s= input()\nelse:\n debug_flg = True\n if args[1] == "2":\n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s039042564', 's548407187', 's548426615'] | [9244.0, 9204.0, 9128.0] | [2205.0, 2205.0, 1064.0] | [821, 931, 457] |
p02714 | u049679412 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["import collections\nn = int(input())\na = list(input())\nb = collections.Counter(a)\nans =b['R']*b['G']*b['B']\nprint(b,ans)\nfor i in range(n-2):\n for j in range(i+1,n-1):\n if a[i] == a[j]:\n continue\n c = j*2 -i\n if c < n:\n if a[i] != a[j] and a[i] != a[c] and a[j]... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s571719402', 's825305893', 's501119685'] | [9440.0, 9276.0, 9424.0] | [2110.0, 24.0, 1186.0] | [351, 587, 424] |
p02714 | u050805798 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['from sys import stdin\nn = int(input())\ns = stdin.readline()\nrind = []\ngind = []\nbind = []\nans = 0\nfor i in range(n):\n if s[i] == "R":\n rind.append(i+1)\n elif s[i] == "G":\n gind.append(i+1)\n else:\n bind.append(i+1)\nprint(rind,gind,bind)\nfor i in range(len(rind)):\n for j... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s333178127', 's425816750', 's553064342', 's506779649'] | [9224.0, 9220.0, 9284.0, 9248.0] | [2206.0, 1983.0, 21.0, 1996.0] | [505, 416, 475, 416] |
p02714 | u052244548 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["import itertools\nfrom collections import Counter\n\nN = int(input())\nS = input()\n\nC=Counter(S)\nr = C['R']\ng = C['G']\nb = C['B']\n\n\ncnt = r * g * b\n\nfor i in range(0,N-2):\n for j in range(i,N-1):\n k = j + j - i\n if k < N:\n if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]):\n... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s022584843', 's446252140', 's890981153'] | [8924.0, 9052.0, 9484.0] | [26.0, 22.0, 1055.0] | [335, 346, 398] |
p02714 | u053035261 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["n = int(input())\ns = input()\nans = 0\nans_list = []\n\nR_index = []\nG_index = []\nB_index = []\n\nfor i in range(n):\n if s[i] == 'R':\n R_index.append(i)\n elif s[i] == 'G':\n G_index.append(i)\n elif s[i] == 'B':\n B_index.append(i)\n\nans = len(R_index) * len(G_index) * len(B_index... | ['Wrong Answer', 'Accepted'] | ['s251118573', 's118664237'] | [9328.0, 9264.0] | [1162.0, 1223.0] | [463, 589] |
p02714 | u061566631 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['import sys\nimport collections\n\n\ndef main():\n input = sys.stdin.readline\n N = int(input())\n S = input()\n A = S.count(\'R\')*S.count(\'G\')*S.count(\'B\')\n total = 0\n for j in range(1, N-1):\n for i in range(j):\n k = 2*j-i\n order += 1\n if k < len(S)... | ['Runtime Error', 'Accepted'] | ['s069615126', 's518396221'] | [9368.0, 9148.0] | [23.0, 1449.0] | [812, 474] |
p02714 | u088115428 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['n = int(input())\ns = input()\nr = s.count("R");g = s.count("G");b = s.count("B")\ncount = r*g*b\nprint(count)\nfor j in range(n):\n for i in range(j):\n if (k:=2*j-i)<n:\n if s[i]!=s[k]!=s[j]!=s[i]:\n count-=1 \nprint(count)', 'n = int(input())\ns = input()\nr,g,b = 0,0,0\nr = s.count("R");g = s.co... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s603727295', 's620585152', 's699383982', 's880776392'] | [9196.0, 9144.0, 9200.0, 9192.0] | [1688.0, 1804.0, 2206.0, 1725.0] | [233, 247, 255, 221] |
p02714 | u094191970 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['k=int(input())\nl=[1, 9, 30, 76, 141, 267, 400, 624, 885, 1249, 1590, 2208, 2689, 3411, 4248, 5248, 6081, 7485, 8530, 10248, 11889, 13687, 15228, 17988, 20053, 22569, 25242, 28588, 31053, 35463, 38284, 42540, 46581, 50893, 55362, 61824, 65857, 71247, 76884, 84388, 89349, 97881, 103342, 111528, 120141, 128047, 134580,... | ['Runtime Error', 'Accepted'] | ['s399931659', 's292405314'] | [9384.0, 9408.0] | [22.0, 1304.0] | [1670, 250] |
p02714 | u104282757 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['def solve(n, s):\n\n r_list = [i for i in range(n) if s[i] == "R"]\n g_list = [i for i in range(n) if s[i] == "G"]\n \n b_dict = {i: 1 for i in range(n) if s[i] == "B"}\n\n res = len(r_list) * len(g_list) * len(b_list)\n for i in r_list:\n for j in g_list:\n # candidate\n ... | ['Runtime Error', 'Accepted'] | ['s267667014', 's963998589'] | [9120.0, 9196.0] | [22.0, 1173.0] | [890, 897] |
p02714 | u108898293 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["a=int(input())\nb=str(input())\nsum=0\n\nriron_sum=b.count('R')*b.count('G')*b.count('B')\nprint(riron_sum)\nfor i in range(0,a):\n for n in range(0,a+1):\n j = i+n\n k = j+n\n #print(j)\n #print(k)\n if k>=a:\n \tbreak\n\n if b[i]!=b[j] and b[j]!=b[k] and b[k]!=b[i... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s252448593', 's609339312', 's716847572'] | [9204.0, 9132.0, 9200.0] | [1410.0, 22.0, 1389.0] | [351, 301, 333] |
p02714 | u111652094 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["\nN=int(input())\nS=str(input())\n\nR=[0]\nG=[0]\nB=[0]\n\nfor i in range(N):\n if S[i]=='R':\n R.append(i)\n elif S[i]=='G':\n G.append(i)\n elif S[i]=='B':\n B.append(i)\n\nr=len(R)\ng=len(G)\nb=len(B)\n\nans=r*g*b\n\nfor i in range(r):\n for j in range(g):\n for k in range(b... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s008865449', 's575665720', 's671243603'] | [9224.0, 9168.0, 9148.0] | [2205.0, 529.0, 1495.0] | [371, 332, 334] |
p02714 | u113991073 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['print(sum([x for x in range(a,int(input())+1) if (x%3!=0)and(x%5!=0)]))', 'n=int(input())\ns=input()\n\nr_cnt=s.count("R")\ng_cnt=s.count("G")\nb_cnt=s.count("B")\n\nans=r_cnt*g_cnt*b_cnt\n\nfor i in range(n):\n for d in range(n):\n j=i+d\n k=j+d\n if k>=n:break\n if s[i]!=s[j] and s[j]... | ['Runtime Error', 'Accepted'] | ['s461833071', 's906913823'] | [9108.0, 9144.0] | [21.0, 1487.0] | [71, 284] |
p02714 | u116038906 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['\nN= int(input())\nS =input()\n\n\n#\nR_index=[]\nG_index=[]\nB_index=[]\nfor i,v in enumerate(S):\n if v =="R":\n R_index.append(i)\n if v =="G":\n G_index.append(i)\n if v =="B":\n B_index.append(i)\n\n\nR_B =[]\nB_G =[]\ncount_ij_jk_onaji =0\nfor r in R_index:\n for g in G_index:\n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s053335472', 's708939360', 's609558671'] | [17272.0, 10768.0, 9312.0] | [1985.0, 2242.0, 973.0] | [1077, 964, 672] |
p02714 | u116233709 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['n = 39\ns = str(input())\nr = []\ng = []\nb = []\nfor i in range(n):\n if s[i] == "R":\n r.append(i+1)\n elif s[i] == "G":\n g.append(i+1)\n else:\n b.append(i+1)\ncnt = 0\nfor i in r:\n for j in g:\n if (i+j)%2==0:\n if (i + j) // 2 in b:\n cnt += 1\n... | ['Runtime Error', 'Accepted'] | ['s154876919', 's222207537'] | [9164.0, 9224.0] | [22.0, 1835.0] | [437, 418] |
p02714 | u119947188 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["N = int(input())\nS = input()\ncount_R = 0\ncount_G = 0\ncount_B = 0\ncount = 0\nfor i in range(N):\n if S[i] == 'R':\n count_R = count_R+1\n elif S[i] == 'G':\n count_G = count_G+1\n else:\n count_B = count_B+1\ncount = count_R*count_G*count_B\n\nfor i in range(N):\n for j in range(i+1... | ['Runtime Error', 'Accepted'] | ['s443485962', 's454529811'] | [9080.0, 9184.0] | [602.0, 1132.0] | [464, 465] |
p02714 | u123648284 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['N = int(input())\nS = list(input())\n\nres = 0\nfor i in range(N-2):\n for j in range(i+1, N-1):\n for k in range(j+1, N):\n if j - i == k - j:\n continue\n if S[i] != S[j] and S[j] != S[k] and S[i] != S[k]:\n res += 1\n', 'N = int(input())\nS = list(input... | ['Wrong Answer', 'Accepted'] | ['s748373462', 's447600649'] | [9180.0, 9220.0] | [2205.0, 1254.0] | [271, 366] |
p02714 | u125545880 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['import sys\n#import copy\nimport numpy as np\n#import itertools\n#import collections\n#from collections import deque\n#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson\n#from scipy.sparse import csr_matrix\n\nsys.setrecursionlimit(10**6)\nreadline = sys.stdin.readline\nr... | ['Runtime Error', 'Accepted'] | ['s999914903', 's446976369'] | [27076.0, 9468.0] | [137.0, 801.0] | [884, 845] |
p02714 | u127499732 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["def main():\n n, s = int(input()), input()\n r, g, b = 0, 0, 0\n for i in s:\n if i == 'R':\n r += 1\n if i == 'G':\n g += 1\n if i == 'b':\n b += 1\n\n ans = r * g * b\n s = tuple(s)\n v = {'R', 'G', 'B'}\n for i in range(n - 2):\n for... | ['Wrong Answer', 'Accepted'] | ['s101136041', 's636300822'] | [9148.0, 9084.0] | [1343.0, 1390.0] | [498, 509] |
p02714 | u132687480 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["def binary_search(target, left, right, nums):\n if(left > right):\n return -1\n mid = (right-left)//2 + left\n if(nums[mid] == target):\n return mid\n elif(nums[mid] < target):\n return binary_search(target, mid+1, right, nums)\n else:\n return binary_search(target, left, mi... | ['Wrong Answer', 'Accepted'] | ['s397788005', 's108936171'] | [9288.0, 26980.0] | [2206.0, 1206.0] | [808, 643] |
p02714 | u135116520 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['import collections\nN=int(input())\nS=list(input())\ns=collections.Counter(S)\nm=0\nm+=s["R"]*s["G"]*s["B"]\nfor i in range(N-2):\n for j in range(i+1,N-1):\n k=2*j-i\n if k>=N:\n break\n if s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]:\n m-=1', 'import collections\nN=int(input())\nS=list(input())\ns=... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s003266981', 's270215355', 's313246048', 's314376008', 's326755990', 's507853451', 's857914341', 's318916176'] | [9464.0, 9440.0, 9440.0, 9464.0, 9476.0, 9444.0, 9472.0, 9208.0] | [1871.0, 1965.0, 26.0, 1901.0, 1913.0, 1839.0, 1912.0, 1379.0] | [247, 256, 230, 242, 251, 244, 259, 330] |
p02714 | u135346354 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['N = int(input())\ns = input()\n\n\n\n# for j in range(i+1, N-1):\n# if s[i] == s[j]:\n# continue\n# for k in range(j+1, N):\n\n# continue\n# if s[i] == s[k] or s[j] == s[k]:\n# continue\n# cnt += 1\n\nr = 0\ng = 0\nb = 0\n\nfor t ... | ['Wrong Answer', 'Accepted'] | ['s469243010', 's990620595'] | [9172.0, 9168.0] | [1929.0, 1917.0] | [654, 637] |
p02714 | u135847648 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['# n = int(input())\n\n\n\n\n\n# st = s[i]\n# if st == "R":\n# r_pos.append(i)\n\n# if st == "G":\n# g_pos.append(i)\n\n# if st == "B":\n# b_pos.append(i)\n\n\n\n\n\n# ans = r_num * g_num * b_num\n\n# for r in r_pos:\n# for g in g_pos:\n# for b in b_pos:\n\n# ... | ['Wrong Answer', 'Accepted'] | ['s094385630', 's536751873'] | [9252.0, 9272.0] | [2205.0, 1594.0] | [1566, 1111] |
p02714 | u135961419 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["n = int(input())\ns = input()\n\nanswer = s.count('R') * s.count('G') * s.count('B')\n\nfor i in range(n - 2):\n j = 0\n while((i + 1) + (j - i) * 2 <= n):\n if s[i] != s[j] and s[j] != s[(i + 1) + (j - i) * 2] and s[i] != s[(i + 1) + (j - i) * 2]:\n answer -= 1\n j += 1\n\nprint(answer)", "n = int(inp... | ['Time Limit Exceeded', 'Accepted'] | ['s993813262', 's546312027'] | [9120.0, 9200.0] | [2205.0, 1820.0] | [291, 283] |
p02714 | u143322814 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['\ndef main():\n n = int(input())\n s = input()\n r,g,b = 0,0,0\n for i in s:\n if i == \'r\': r += 1\n elif i == \'g\': g += 1\n elif i == \'b\': b += 1\n ans = r*g*b\n for j in range(n):\n for i in range(j):\n k = j+(j-i)\n if k < n:\n ... | ['Wrong Answer', 'Accepted'] | ['s580668157', 's540205112'] | [9196.0, 9204.0] | [1091.0, 923.0] | [455, 513] |
p02714 | u145582359 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['import collections\n\nN=int(input())\nS=input()\n\nlenR=S.count("R")\nlenG=S.count("G")\nlenB=S.count("B")\n\ncount=0\nfor i in range(N-2):\n for j in range(i,N-1):\n if 2*j-i>N:\n continue\n if (S[i] != S[j]) and (S[i]!=S[2*j-i]) and (S[j]!=S[2*j-i]):\n count+=1\n \nprint(le... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s012425772', 's546091307', 's043668247'] | [9480.0, 9468.0, 9460.0] | [26.0, 25.0, 1899.0] | [320, 328, 347] |
p02714 | u145600939 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["n = int(input())\ns = input()\nR = set()\nG = set()\nB = set()\nfor i in range(s):\n if s[i] == 'R':\n R.add(i)\n elif s[i] == 'B':\n B.add(i)\n else:\n G.add(i)\nans = 0\nfor r in R:\n for g in G:\n ans += len(B)\n if 2*r - g in B:\n ans -= 1\n if 2*g ... | ['Runtime Error', 'Accepted'] | ['s307107453', 's185662817'] | [9212.0, 9540.0] | [24.0, 916.0] | [405, 405] |
p02714 | u151037808 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["# -*- coding: utf-8 -*-\nimport sys\ninput = sys.stdin.readline\n\n\ndef main():\n n = int(input())\n s = input()\n\n ans = s.count('R') * s.count('G') * s.count('B')\n # print(ans)\n for i in range(n - 2):\n for j in range(i + 1, n - 1):\n k = (j - i) + j\n if k > n:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s145911663', 's919622734', 's343730761'] | [9196.0, 9288.0, 9200.0] | [786.0, 791.0, 789.0] | [499, 495, 500] |
p02714 | u156591744 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['n=int(input())\ns=input()\ncompte=0\nr=[]\ng=[]\nb=[]\nfor i in range(n):\n if s[i]=="R":\n r.append(i)\n elif s[i]=="G":\n g.append(i)\n elif s[i]=="B":\n b.append(i)\n \nfor i in range(1,n-1):\n if n%2==0:\n if i<n//2:\n for j in range(1,i+1):\n if s... | ['Runtime Error', 'Accepted'] | ['s042869404', 's130082804'] | [9312.0, 9144.0] | [1167.0, 1899.0] | [1096, 270] |
p02714 | u161712560 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["N = int(input())\nS = input()\n\nrList = []\ngList = []\nbList = []\n\nfor indx in range(N):\n if S[indx] == 'R':\n rList.append(indx)\n elif S[indx] == 'G':\n gList.append(indx)\n elif S[indx] == 'B':\n bList.append(indx)\n\nNoSum = 0\nfList = rList\nsList = gList\nremain = 'B'\n\nfor f... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s061783523', 's286395616', 's884291217'] | [9220.0, 9320.0, 9212.0] | [1733.0, 145.0, 1638.0] | [865, 945, 846] |
p02714 | u163320134 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["n=int(input())\ns=list(input())\nfor i in range(n):\n if s[i]=='R':\n s[i]=1\n elif s[i]=='G':\n s[i]=2\n elif s[i]=='B':\n s[i]=4\nans=s.count('R')*s.count('G')*s.count('B')\nfor i in range(n):\n for j in range(i+1,n):\n k=2*j-i\n if k>=n:\n continue\n if s[i]+s... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s556195486', 's678520056', 's705334157', 's739901992'] | [9200.0, 9000.0, 9216.0, 9120.0] | [1652.0, 23.0, 2063.0, 1633.0] | [343, 461, 408, 343] |
p02714 | u167360450 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['import collections\n\nn = int(input())\ns = input()\nres = 0\n\n# for j in range(i+1,n):\n# if s[i] != s[j]:\n# for k in range(j+1,n):\n# if j-i!=k-j and s[i] != s[k] and s[j] != s[k]:\n# res += 1\n#\n# print(res)\nnum = collections.Counter(s)\n# print(num)\... | ['Runtime Error', 'Accepted'] | ['s538125072', 's484134654'] | [9400.0, 9404.0] | [28.0, 1719.0] | [805, 803] |
p02714 | u168832623 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["N = int(input())\ns = input()\n \nr_cnt = s.count('R')\ng_cnt = s.count('G')\nb_cnt = s.count('B')\n\nans = r_cnt * g_cnt * b_cnt\n \nfor i in range(N):\n for j in range(i,N):\n k = 2*j - i\n if k >= N:\n break\n elif S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:\n ans -= 1\n... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s288967903', 's642292888', 's759055650', 's940097759'] | [9136.0, 31036.0, 9204.0, 9184.0] | [25.0, 2281.0, 22.0, 1313.0] | [313, 331, 312, 334] |
p02714 | u185405877 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['n=int(input())\ns=input()\ncnt=0\na=["R","G","B"]\nfor i in range(n):\n x=a.remove(s[i])\n for j in range(i+1,n):\n if s[i]!=s[j]:\n qw=s\n x.remove(s[j])\n k=j-1\n if j+k<n:\n qw[j+k]="P"\n q=x.pop(0)\n cnt+=qw.count(q)\npri... | ['Runtime Error', 'Accepted'] | ['s641389940', 's911753241'] | [9208.0, 9128.0] | [22.0, 1814.0] | [310, 253] |
p02714 | u189056821 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["n = int(input())\ns = str(input())\ncount = {'R': 0, 'G': 0, 'B': 0}\nfor c in s:\n count[c] += 1\nR, G, B = count.values()\nans = R * G * B\n\nfor i in range(n - 1):\n for j in range(i + 1, n): \n k = j + j - i\n\n print(i,j,k)\n if k >= n:\n continue\n\n if (s[i] != s[j]... | ['Wrong Answer', 'Accepted'] | ['s601379787', 's512151829'] | [33868.0, 9208.0] | [2254.0, 1846.0] | [383, 303] |
p02714 | u197457087 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['n = int(input())\ns = str(input())\n\nR = []\nG = []\nB = []\nfor i in range(n):\n if s[i] == "R":\n R.append(i+1)\n elif s[i] == "G":\n G.append(i+1)\n else:\n B.append(i+1)\n\n \nans = 0\n\nfor i in range(len(R)):\n for j in range(len(G)):\n test += len(B)\n temp = 0\n if 2*R[i] - G[j] in B:\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s030374281', 's264569988', 's255944824'] | [9228.0, 9276.0, 9296.0] | [21.0, 24.0, 1854.0] | [435, 592, 574] |
p02714 | u199830845 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['import sys\nsys.setrecursionlimit(10 ** 6) \nto_index = lambda x: int(x) - 1 \nprint_list_in_2D = lambda x: print(*x, sep="\\n") \n\n\ndef input_int():\n return int(input())\n\ndef map_int_input():\n return map(int, input())\n\nMII = map_int_input\n\ndef MII_split():\n return map(int, input().split())\n\n... | ['Runtime Error', 'Accepted'] | ['s612936782', 's585034748'] | [9140.0, 9308.0] | [25.0, 1742.0] | [1337, 1742] |
p02714 | u202634017 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ['from math import gcd\nk = int(input())\ngcdl = [[0 for i in range(k + 1)] for i in range(k + 1)]\nfor i in range(1, k + 1):\n for j in range(1, k + 1):\n gcdl[i][j] = gcd(i, j)\ns = 0\nfor i in range(1, k + 1):\n for j in range(1, k + 1):\n for l in range(1, k + 1):\n s += gcdl[i][gcdl[... | ['Wrong Answer', 'Accepted'] | ['s648120782', 's815881876'] | [142216.0, 9208.0] | [2209.0, 1878.0] | [325, 370] |
p02714 | u209418188 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["n = int(input())\ns = input()\nans = s.count('B') + s.count('G') + s.count('R')\nfor i in range(n):\n for j in range(i, n-1):\n k = 2*j - i\n if k >= n:\n continue\n if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:\n ans -= 1\n\nprint(ans)", "n = int(input())\ns = input()\nans = s.count('B') * s... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s654882483', 's833768258', 's325728866'] | [9204.0, 9180.0, 9048.0] | [1861.0, 22.0, 1893.0] | [250, 252, 251] |
p02714 | u211236379 | 2,000 | 1,048,576 | We have a string S of length N consisting of `R`, `G`, and `B`. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: * S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. * j - i \neq k - j. | ["#from operator import itemgetter\n#from collections import Counter\n#import heapq\nN = int(input())\nS = input()\n#N, M = map(int, input().split())\n#A = list(map(lambda x: int(x)*(-1), input().split()))\n\n\nR =[]\nG =[]\nB =[]\n\nSTART_TIME = time.time()\nfor i, s in enumerate(S):\n if s == 'R':\n R.ap... | ['Runtime Error', 'Accepted'] | ['s747518242', 's957688765'] | [9220.0, 9208.0] | [22.0, 1860.0] | [759, 635] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.