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
p02714
u213498391
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 quest_d():\n N = int(input())\n S = input()\n\n index_dict = {\n 'R':0,\n 'G':0,\n 'B':0\n }\n for index in range(len(S)):\n index_dict[S[index]] = index_dict[S[index]] + 1\n\n if index_dict['R'] * index_dict['G'] * index_dict['B'] == 0:\n print(0)\n ret...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s000885537', 's803642906', 's379267647']
[9288.0, 8964.0, 9284.0]
[25.0, 2206.0, 1279.0]
[1049, 875, 1111]
p02714
u222668979
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 itertools import product as pro\n\nn = int(input())\ns = str(input())\n\nr = [i for i in range(n) if s[i] == 'R']\ng = [i for i in range(n) if s[i] == 'G']\nb = [i for i in range(n) if s[i] == 'B']\ncnt = len(r)*len(g)*len(b)\n\nlen = max(len(r), len(g), len(b))\nif len == len(r):\n max1 = set(r)\n min1 = ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s072274460', 's940958036', 's296089746']
[9288.0, 9444.0, 9380.0]
[22.0, 314.0, 652.0]
[607, 496, 548]
p02714
u227082700
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(map(ord,input().split()))\nR=[0]\nG=[0]\nB=[0]\nfor i in s:\n R.append(R[-1])\n G.append(G[-1])\n B.append(B[-1])\n if i==82:R[-1]+=1\n elif i=="71":G[-1]+=1\n else:B[-1]+=1\nans=0\nfor i in range(n-2):\n for j in range(i+1,n-1):\n if s[i]==s[j]:continue\n if 82 not in [s[i],s[j]]:...
['Runtime Error', 'Runtime Error', 'Accepted']
['s065253161', 's306763747', 's151702624']
[9204.0, 9300.0, 9156.0]
[23.0, 21.0, 1453.0]
[581, 578, 251]
p02714
u227550284
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\ninput = sys.stdin.readline\n\ndef main():\n n = int(input())\n s_li = list(input().rstrip())\n\n r_li = []\n g_li = []\n b_li = []\n\n for i in range(n):\n if s_li[i] == 'R':\n r.append(i)\n elif s_li[i] == 'G':\n g.append(i)\n elif s_li[i] == '...
['Runtime Error', 'Accepted']
['s461272016', 's973726270']
[9256.0, 9336.0]
[22.0, 1012.0]
[791, 800]
p02714
u228303592
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')\n\nfor i in range(n):\n if s[i] == 'R':\n s[i] = 1\n elif s[i] == 'G':\n s[i]\n elif s[i] == 'B':\n s[i] = 4\n \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[...
['Runtime Error', 'Runtime Error', 'Accepted']
['s240322272', 's777341254', 's587285619']
[9204.0, 9032.0, 9232.0]
[24.0, 22.0, 1669.0]
[338, 320, 342]
p02714
u237513745
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')\ng = s.count('G')\nb = s.count('B')\nc = 0\nfor i in range(n-1):\n for j in range(i+1, (n+1)//2):\n k = j*2-i\n if k >= n:\n continue\n if len(set([s[i], s[j], s[k]]))==3:\n c += 1\nprint(r*g*b-c)", "N = int(input())\nS = input()\nr = S.count('R')\...
['Wrong Answer', 'Accepted']
['s111778604', 's267983116']
[9212.0, 9184.0]
[1018.0, 1963.0]
[253, 222]
p02714
u241159583
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 bisect\nN = int(input())\nS = list(input())\nR_i = []\nG_i = []\nB_i = []\nfor i in range(N):\n if S[i] == "R": R_i.append(i)\n elif S[i] == "G": G_i.append(i)\n else: B_i.append(i)\n\nr = len(R_i)\ng = len(G_i)\nb = len(B_i)\n\nans = 0\nfor i in range(N):\n for j in range(1, N-i):\n if S[i] == "R":\n ...
['Runtime Error', 'Accepted']
['s252077368', 's871229925']
[9356.0, 9204.0]
[72.0, 749.0]
[1359, 365]
p02714
u247680229
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\nS=list(input())\nm=0\n\na=S.count("R")\nb=S.count("G")\nc=S.count("B")\n\nnum=a*b*c\n\nfor i in range(N-2):\n for j in range(i+1,N):\n k=2*j-i\n if k>=n-1:\n break\n elif S[i]!=S[j]!=S[k]:\n m+=1\n \nprint(num-m)', 'ースコード \n\nCopy\nCopy\nN=int(input())\n \nS=list(input())\nm...
['Runtime Error', 'Runtime Error', 'Accepted']
['s329319203', 's901180727', 's566387098']
[9172.0, 9216.0, 9232.0]
[23.0, 22.0, 1328.0]
[236, 307, 279]
p02714
u248670337
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=g=b=0\nR=[0 for _ in range(n)]\nG=[0 for _ in range(n)]\nB=[0 for _ in range(n)]\nfor i in range(i):\n if s[i]='R':r+=1\n elif s[i]='G':g+=1\n else:b+=1\n R[i]=r\n G[i]=g\n B[i]=b\nfor i in range(n):\n if s[i]='R':ans+=G[i]*(B[-1]-B[i])+B[i]*(G[-1]-G[i])\n e...
['Runtime Error', 'Accepted']
['s312997459', 's362813371']
[8980.0, 9260.0]
[22.0, 1782.0]
[416, 244]
p02714
u249218427
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 -*-\nN = int(input())\nS = input()\n\nR = []\nG = []\nB = []\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 else:\n B.append(i)\n \ncount = 0\n\nfor r in R:\n for g in G:\n for b in B:\n S = sorted([r,g,b])\n if S[0]+S[2]!=2*S...
['Wrong Answer', 'Accepted']
['s608786470', 's130880468']
[9120.0, 9248.0]
[2205.0, 1603.0]
[319, 363]
p02714
u250734103
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\nr , g, b = S.count("R"), S.count("G"), S.count("B")\nans = r * g * b\n\nfor i in range(N-2):\n for d in range(N//2+1):\n j = i + d\n k = j + d\n if k < N:\n \tif s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:\n \tans -= 1\nprint(ans)', ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s353817580', 's653220583', 's251082555']
[9048.0, 9236.0, 9056.0]
[20.0, 1607.0, 1919.0]
[300, 303, 283]
p02714
u252828980
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")\ng = s.count("G")\nb = s.count("B")\nnum = r*g*b\nfor i in range(n):\n for d in range(n):\n j = i + d\n k = j + d\n if k >=n:\n break\n if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:\n n', 'n = int(input())\ns = i...
['Wrong Answer', 'Accepted']
['s322576491', 's610724472']
[9204.0, 9216.0]
[1634.0, 1464.0]
[278, 295]
p02714
u266014018
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\nans = 0\nfor i in range(n-2):\n\ts1 = s[i]\n\tfor j in range(i+1,n-1):\n \ts2 = s[j]\n if s1 == s2:\n \tpass\n else:\n \ts[2*j-i] != s1 and s[2*j-i] != s2:\n ans += 1\nprint(ans)', "n = int(input())\ns = input()\nans = s.count('R')*s.count('G'...
['Runtime Error', 'Accepted']
['s577600592', 's524603962']
[9008.0, 9188.0]
[25.0, 1628.0]
[280, 245]
p02714
u268792407
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,g,b=0,0,0\nfor i in range(n):\n if s[i]=="R":\n r+=1\n elif s[i]=="G":\n g+=1\n else:\n b+=1\nchohuku=0\ndouble=0\nfor i in range(1,n-1):\n for j in range(1,min(i+1,n-1-i)):\n chohuku+=1\n k=j+i\n l=i-j\n if s[i]==s[k] or s[i]==...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s168702276', 's240140698', 's870939763', 's986082746']
[9224.0, 9308.0, 9148.0, 9160.0]
[1598.0, 2205.0, 1394.0, 1529.0]
[378, 846, 376, 370]
p02714
u274635633
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=[]\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 else:\n b.append(i)\nans=len(r)*len(g)*len(b)\nfor i in g:\n for j in b:\n i+j=a\n if a%2==0 and (a//2 in r):\n ans-=1\nfor i in r:\n for j in b:\n i+j=a\n if ...
['Runtime Error', 'Accepted']
['s264786511', 's191289648']
[9092.0, 9336.0]
[21.0, 1712.0]
[425, 557]
p02714
u274841648
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\ndef im(l, x):\n return [i for i, _x in enumerate(l) if _x == x]\nR = im(s, "R")\nG = im(s, "G")\nB = im(s, "B")\n\next = 0\nif n >= 3:\n for i in range((n-3)//2):\n for j in range(n-(3+2*i)+1):\n if s[j] != s[j+i+1] and s[j] != s[j+2*(i+1)] and s[j+i+1] != s[j+...
['Wrong Answer', 'Accepted']
['s143501093', 's436429488']
[9320.0, 9240.0]
[1525.0, 1596.0]
[385, 387]
p02714
u277641173
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\ncount = 0\nr=0\ng=0\nb=0\nfor i in range(0,n):\n if s[i] == 'R':\n r = r + 1\n if s[i]=='G':\n g = g+1\n if s[i]=='B':\n b = b+1\n \nfor i in range(0,n-3):\n ii = s[i]\n for j in range(i+1, n-1):\n jj = s[j]\n if ii==jj:\n continue\n if (2*j-i)<=(n-1):\n...
['Wrong Answer', 'Accepted']
['s979865157', 's154629319']
[9136.0, 9184.0]
[2002.0, 1977.0]
[381, 377]
p02714
u289162337
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\nfor i in range(n-2):\n for j in range(i+1, n-1):\n if s[i] != s[j]:\n for k in range(j+1, n):\n if s[j] != s[k] and s[k]!= s[i]:\n if j-i != k-j:\n ans +=1\nprint(ans)', 'import statistics as st\nn = int(input())\ns = input()\nNGs = 0\nr = set()\ng =...
['Runtime Error', 'Accepted']
['s723043862', 's843113053']
[8968.0, 11176.0]
[23.0, 1946.0]
[225, 625]
p02714
u289288647
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\nnum = len(s)\nans = 0\nfor i in range(num):\n a = set(s[i])\n for j in range(i+1, num):\n if s[j] in a:\n continue\n a.add(s[j])\n for k in range(j+1, num):\n if s[k] in a or j-i == k-j:\n continue\n ans += 1\n...
['Runtime Error', 'Accepted']
['s946868456', 's324385531']
[9188.0, 9124.0]
[27.0, 1955.0]
[334, 276]
p02714
u297046168
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 = str(input())\ncount = S.count('R') * S.count('G') * S.count('B')\nfor i in range(N-1):\n for j in range(i,(N+i)//2):\n k = 2*j - i\n if S[i] == S[j] or S[i] == S[k] or S[j] == S[k]:\n pass\n else:\n count -= 1\nprint(count)", "N =...
['Wrong Answer', 'Accepted']
['s991801034', 's568860043']
[9448.0, 9204.0]
[1260.0, 1948.0]
[300, 318]
p02714
u300579805
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\nn = int(input())\ns = str(input())\nr = {}\nb = {}\ng = {}\nfor i in range(len(s)):\n if s[i] == 'R':\n r[i+1] = s[i]\n elif s[i] == 'B':\n b[i+1] = s[i]\n else:\n g[i+1] = s[i]\nans = len(r) * len(b) * len(g)\nprint(ans)\nfor i in r.keys():\n for j in b.keys():\n ...
['Wrong Answer', 'Accepted']
['s346883878', 's500813571']
[9400.0, 9236.0]
[1696.0, 1670.0]
[576, 565]
p02714
u308684517
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 = 4000\ns = "RGB" * 1333 + "R"\nrgb = s.count("R") * s.count("G") * s.count("B")\nfor i in range(n-2):\n for j in range(i+1, n-1):\n d = j - i\n k = j + d\n if n <= k: break\n if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:\n rgb -= 1\nprint(rgb) \n', 'n = int(input())\ns = input()\nrgb = ...
['Wrong Answer', 'Accepted']
['s556038562', 's762266156']
[9040.0, 9076.0]
[1637.0, 1448.0]
[266, 263]
p02714
u319589470
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\nli_r = []\nli_g = []\nli_b = []\nfor i in range(n):\n if li[i] == "R":\n li_r.append(i+1)\n elif li[i] == "G":\n li_g.append(i+1)\n elif li[i] == "B":\n li_b.append(i+1)\nfor i in li_r:\n for j in li_g:\n if 2*j - i in li_b:\n ans += len(li_b) -1\n else:\...
['Runtime Error', 'Accepted']
['s823718437', 's791999781']
[9204.0, 9972.0]
[22.0, 1874.0]
[334, 1552]
p02714
u329709276
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()) # 1 <= N <= 4000\nS = input() # [RGB]{N}\nL = {\n 'R': tuple(i for i, v in enumerate(S) if v == 'R'),\n 'G': tuple(i for i, v in enumerate(S) if v == 'G'),\n 'B': tuple(i for i, v in enumerate(S) if v == 'B')\n}\nprint(type(L['R']))\n\nans = 0\nfor i in range(N):\n for j in range(i+1, N...
['Wrong Answer', 'Accepted']
['s906785257', 's756860474']
[9036.0, 9096.0]
[2206.0, 1412.0]
[509, 541]
p02714
u345483150
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()\ns=list(s)\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 else:\n b.append(i)\nprint(r) \nprint(g) \nprint(b) \ncnt=0 \nfor j in r:\n for l in g:\n if (2*l-j) or (2*j-l) in b:\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s730702210', 's862233658', 's391876729']
[9160.0, 9200.0, 9188.0]
[273.0, 808.0, 1265.0]
[349, 256, 211]
p02714
u347452770
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 \nstr = input()\nsum = 0\npointer = n\nfor i in range(n-2):\n if i == poitner:\n break\n for j in range(i+1, n-1):\n for k in range(j+1, n):\n if str[i] == str[j]:\n pointer = j\n break\n elif str[i] != str[k] and str[j] != str[k] and j - i != k - j:\n sum += ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s035881461', 's381159787', 's899063276']
[9196.0, 8964.0, 9076.0]
[21.0, 23.0, 1883.0]
[316, 253, 290]
p02714
u352402050
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())\nA = S.count("R") * S.count("G") * S.count("B")\n\nfor i in range(N-3):\n for j in range(i+1, N-1):\n k = j-i+j\n if k<N and S[k] != S[j] and S[k] != S[i] and S[i] !=S[j]:\n A -= 1\n\nprint(A)\n', 'N = int(input())\nS = list(input())\nA = S.count("R") * S.count("G") * S...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s098779934', 's771321681', 's962570399']
[9096.0, 9120.0, 9112.0]
[1918.0, 2206.0, 1846.0]
[231, 235, 231]
p02714
u371132735
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")\ng = s.count("G")\nb = s.count("B")\ncnt= 0\nfor i in range(n):\n for j in range(i,n):\n if s[i] != s[j] and s[i] != s[2*j-i] and s[j] != s[2*j-i] and 2*j-i<n:\n cnt += 1\nprint(r*g*b-cnt)', '# abc162_d.py\nn = int(input())\ns = input()\nr = s.count...
['Runtime Error', 'Accepted']
['s369345620', 's649723077']
[9200.0, 9200.0]
[21.0, 1956.0]
[247, 277]
p02714
u374018235
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 = len(S.replace("G", "").replace("B", ""))\ng = len(S.replace("R", "").replace("B", ""))\nb = N - r - g\n\nans = r * g\nans = ans * b\n\nfor i in range( N ):\n for j in range(i, int((N+i)/2 + 1)):\n k = 2 * j - i\n if k < N:\n s = S[i] + S[j] + S[k]\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s341561008', 's790353160', 's029292578']
[9048.0, 9236.0, 9188.0]
[22.0, 1685.0, 1710.0]
[399, 382, 385]
p02714
u379720557
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 = s.count('R')\nG = s.count('G')\nB = s.count('B')\nans = R*G*B\n\nfor i in range(n):\n for d in range(1, n):\n print(i, i+d, i+2*d)\n if i+2*d > n-1: break\n if s[i] != s[i+d] and s[i+d] != s[i+2*d] and s[i] != s[i+2*d]:\n ans -= 1\n\nprint(ans)",...
['Wrong Answer', 'Accepted']
['s345492424', 's921688048']
[27616.0, 9080.0]
[2236.0, 1653.0]
[301, 286]
p02714
u391725895
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.
["l = [input() for _ in range(2)]\nS = l[1]\nN = int(l[0])\ncount = 0\n\nindexR = []\nindexG = []\nindexB = []\n\ni = 0\nj = 0\nk = 0\n\nfor a in range(N):\n character = S[a:a+1]\n\n if character == 'R':\n indexR.append(a+1)\n elif character == 'G':\n indexG.append(a+1)\n elif character == 'B'...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s197146720', 's657696946', 's818350234', 's146941709']
[9236.0, 9248.0, 9236.0, 9360.0]
[24.0, 2205.0, 22.0, 1907.0]
[542, 755, 542, 577]
p02714
u409306788
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 clipboard\n\n\n\n\n\nif sys.platform == 'ios':\n\tsample = clipboard.get()\n\tfile = open('input_file.txt', 'w')\n\tfile.write(sample)\n\tfile.close()\n\tsys.stdin = open('input_file.txt')\n# -----------------------------\n\t\t\t\t\t\t\n\n# D - RGB Triplets\n\nN = int(input())\nS = input()\n\nr, g,...
['Runtime Error', 'Accepted']
['s823839224', 's380503354']
[9096.0, 9148.0]
[18.0, 1833.0]
[849, 355]
p02714
u411353821
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 = int(input())\n S = input()\n \'\'\'\n r_inds = []\n g_inds = []\n b_inds = []\n for i in range(len(S)):\n if S[i] == "R":\n r_inds.append(i)\n elif S[i] == "G":\n g_inds.append(i)\n else:\n b_inds.append(i)\n\n total_comb ...
['Runtime Error', 'Accepted']
['s200401114', 's332976017']
[9232.0, 9448.0]
[20.0, 1393.0]
[1479, 1517]
p02714
u414430923
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 numpy as np\n\nin_list = []\nfor i in range(2):\n in_list.append(input())\nN,S = in_list\nN = int(N)\nres = 0\nfind_ind = []\nfor i in ['R','G','B']:\n find = (np.array(list(S)) == i)\n find_ind.append(find.argsort()[::-1][:sum(find)])\n # print(len(find_ind[-1]))\n\nfind_ind = np.array(find_ind)\n...
['Time Limit Exceeded', 'Accepted']
['s264269958', 's693071513']
[84028.0, 9116.0]
[2207.0, 1786.0]
[1112, 298]
p02714
u426764965
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, G, B = [], [], []\nfor i, c in enumerate(s):\n if c == 'R': R.append(i)\n elif c == 'G': G.append(i)\n else: B.append(i)\n\nans = 0\nfor r in R:\n for g in G:\n if r < g: x, y = r, g\n else: x, y = g, r\n\n ans += len(X3)\n if x*2 - y >= 0:\n if s[x*2 - y]...
['Runtime Error', 'Accepted']
['s943396246', 's137076051']
[9232.0, 9284.0]
[24.0, 1308.0]
[455, 454]
p02714
u429029348
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 d in range(n):\n j=i+d\n k=j+d\n if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:\n ans-=1\n\nprint(ans)', 'n=int(input())\ns=input()\n\nr_cnt=s.c...
['Runtime Error', 'Accepted']
['s568387691', 's026915457']
[9196.0, 9152.0]
[24.0, 1406.0]
[260, 298]
p02714
u431484963
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.
["mport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport numpy as np\nfrom numba import njit\n \nMOD = 10**9 + 7\n \nN = int(readline())\nS = np.array(list(read().rstrip()), np.int8)\n \nR = np.sum(S == ord('R'))\nB = np.sum(S == ord('B'))\nG = np.s...
['Runtime Error', 'Accepted']
['s758128880', 's988378519']
[9012.0, 109668.0]
[24.0, 639.0]
[639, 640]
p02714
u437727817
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\ncount = 0\nfor i in range(n-2):\n\tlis = []\n\tlis.append(s[i])\n\tfor j in range(i+1,n-1):\n\t\tif not s[j] in lis :\n\t\t\tlis.append(s[j])\n\t\t\tfor k in range(j+1,n):\n\t\t\t\tif not s[k] in lis :\n\t\t\t\t\tcount += 1\n\nprint(count)', 'n = int(input())\ns = input()\n\nr = s.cou...
['Wrong Answer', 'Accepted']
['s091275178', 's329117153']
[9056.0, 9140.0]
[2206.0, 1922.0]
[238, 258]
p02714
u439176910
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 = []\nRD = {}\nGD = {}\nBD = {}\n\nS = input().rstrip()\nS = "".join([S for i in range(100)])\nfor i, s in enumerate(S):\n if s == "R":\n R.append(i)\n RD[i*2] = 1\n if s == "G":\n G. append(i)\n GD[i*2] = 1\n if s == "B":\n B.append(i)\n...
['Wrong Answer', 'Accepted']
['s289703022', 's387055697']
[56088.0, 9412.0]
[2207.0, 564.0]
[581, 545]
p02714
u440161695
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 itertools import accumlate\nN=int(input())\ns=input()\nR=[]\nG=[]\nB=[]\nans=0\n\nfor i in range(N):\n if s[i]=="R":\n R.append(s[i])\n elif s[i]=="G":\n G.append(s[i])\n else:\n B.append(s[i])\nR.accumlate()\nG.accumlate()\nB.accumlate()\n\n\n\nfor i in range(N):\n a=s[i]\n for j in range(i+1,N):\...
['Runtime Error', 'Accepted']
['s156750912', 's760687789']
[9032.0, 9136.0]
[21.0, 1834.0]
[653, 290]
p02714
u443872523
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())\ncnt = 0\n\ncnt = s.count("R") * s.count("B") * s.count("G")\nprint(cnt)\n\nsub = 0 \nfor i in range(n):\n for j in range(i, n):\n k = 2 * j - i\n if k <= n - 1:\n if (s[i] != s[j]) and (s[j] != s[k]) and (s[i] != s[k]):\n sub += 1\n\nprin...
['Wrong Answer', 'Accepted']
['s967817155', 's599547643']
[9204.0, 9200.0]
[1864.0, 1851.0]
[343, 333]
p02714
u449473917
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=s.count('R')\ng=s.count('G')\nb=s.count('B')\n\nans=r*g*b\n\nfor i in range(n):\n for d in range(n):\n j=i+d\n k=j+d\n if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i] and k<n:\n ans-=1\n\nprint(ans)", "n=int(input())\ns=input()\n\nr=s.count('R')\ng=s.count...
['Runtime Error', 'Accepted']
['s807475426', 's571217478']
[9216.0, 9128.0]
[21.0, 1471.0]
[244, 260]
p02714
u454524105
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("R") * s.count("G") * s.count("B")\ncnt = 0\nfor i in range(n-3):\n i_ = s[i]\n for j in range(i+1, n-1):\n if s[j] == i_: continue\n k = 2 * j - i\n j_ = s[j]\n if k >= n or s[k] == i_ or s[k] == j_: continue\n cnt += 1\nprint(ans ...
['Wrong Answer', 'Accepted']
['s006482352', 's554382077']
[9168.0, 9132.0]
[1989.0, 1998.0]
[312, 308]
p02714
u455957070
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\nkumikazu = s.count('R')*s.count('B')*s.count('G')\n\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 if (s[i] != s[j]) and (s[i] != s[k]) and (s[j] != s[k]):\n kumikazu -= 1", "n = int(input())\ns = input()\n\nkumikazu ...
['Runtime Error', 'Accepted']
['s814845103', 's154359600']
[9116.0, 9088.0]
[22.0, 1291.0]
[261, 298]
p02714
u461454424
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.
['#input\nN = int(input())\nS = str(input())\n\n#output\nfrom collections import Counter\nanswer = 0\nif N <= 3:\n continue\nelse:\n for i in range(N-2):\n for j in range(i+1, N-1):\n k = 2*j-i\n if S[i] == "R":\n if S[j] == "G":\n answer += Counter(S...
['Runtime Error', 'Accepted']
['s746881100', 's526323974']
[9132.0, 27136.0]
[20.0, 1220.0]
[1492, 1329]
p02714
u461833298
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 numba import njit\nN = int(input())\nS = input()\n\nR = S.count('R')\nG = S.count('G')\nB = S.count('B')\n\n@njit\ndef f(S, N):\n tmp = 0\n for i in range(N):\n for j in range(i+1, N):\n k = j + (j - i)\n if k >= N:\n break\n if S[i]!=S[j] and S[j]!=S[...
['Time Limit Exceeded', 'Accepted']
['s188719222', 's818294106']
[114104.0, 9144.0]
[2208.0, 1269.0]
[397, 287]
p02714
u469254913
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 numpy as np\n# import math\n# import copy\n# from collections import deque\nimport sys\ninput = sys.stdin.readline\n\n\n\ndef main():\n N = int(input())\n S = input().rstrip()\n\n R = set([])\n G = set([])\n B = set([])\n\n for i in range(N):\n temp = S[i]\n if temp == 'R':\n ...
['Wrong Answer', 'Accepted']
['s469800860', 's387839507']
[9344.0, 9496.0]
[564.0, 604.0]
[1051, 1036]
p02714
u478646901
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\nrs = []\ngs = []\nbs = []\nfor i, e in enumerate(s):\n if e == 'R':\n rs.append(i)\n if e == 'G':\n gs.append(i)\n if e == 'B':\n bs.append(i)\n \nsaidai = len(rs) * len(gs) * len(bs)\nif saidai == 0:\n print('0')\nelse:\n if len(rs) <= len(bs) and len(gs) <= len(bs...
['Wrong Answer', 'Accepted']
['s433330055', 's339285553']
[9340.0, 9304.0]
[2205.0, 1803.0]
[1129, 594]
p02714
u479674982
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 functools import lru_cache\n\n@lru_cache(maxsize=1000)\nN = int(input())\nS =input()\na = 0\nfor i in range(N-2):\n for j in range(i,N-1):\n for k in range(j,N):\n if S[i] != S[j] and S[i] != S[k] and S[k] != S[j] and j -i != k-j:\n a+= 1\n print(a)', 'n = int(input())\ns = input()\n\nr = ...
['Runtime Error', 'Accepted']
['s863192461', 's954619036']
[8956.0, 9200.0]
[19.0, 1719.0]
[266, 355]
p02714
u479719434
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 collections import Counter\n\n\ndef main(N=None, S=None):\n if not N or not S:\n N = int(input())\n S = int(input())\n c = Counter(S)\n ans = c["R"]*c["G"]*c["B"]\n for hop in range(1, N//2):\n for start in range(N):\n i = start\n j = start + hop\n ...
['Runtime Error', 'Accepted']
['s330675350', 's855383248']
[9472.0, 9472.0]
[21.0, 903.0]
[669, 661]
p02714
u482743994
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(0)', 'n=int(input())\ns=input()\nr=s.count("R")\ng=s.count("G")\nb=s.count("B")\nans=r*g*b\nfor i in range(n-2):\n for j in range(i+1,n):\n k=2*j-i\n if k>(n-1):\n break\n if s[i]!=s[j]!=s[k]!=s[i]:\n ans-=1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s003705911', 's718290965']
[9076.0, 9196.0]
[22.0, 1277.0]
[8, 220]
p02714
u485319545
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\nfrom collections import Counter\n\nc=Counter(s)\n\nans = 1\nfor i in list(c.values()):\n ans*=i\n\nfor i in range(n):\n for j in range(i+1,n):\n if i+2*j<n:\n if s[i]!=s[i+j] and s[i+j]!=s[i+2*j] and s[i]!=s[i+2*j]:\n ans-=1\n else:\n ...
['Wrong Answer', 'Accepted']
['s379561511', 's510951799']
[9440.0, 9412.0]
[638.0, 1302.0]
[322, 392]
p02714
u489762173
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 = [i for i, x in enumerate(S) if x == 'R']\nG = [j for j, y in enumerate(S) if y == 'G']\nB = [k for k, z in enumerate(S) if z == 'B']\nprint(R, G, B)\n\ncnt=0\nfor r in R:\n for g in G:\n for b in B:\n if abs(g-r) != abs(b-g) and \\\n abs(b-r) !=...
['Wrong Answer', 'Accepted']
['s591652809', 's088993151']
[9216.0, 9300.0]
[2205.0, 1352.0]
[393, 399]
p02714
u496009935
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')\ng=s.count('G')\nb=s.count('B')\ncnt=0\nfor i in range(n-2):\n for j in range(1, min(i+1, n-i)):\n if (s[i] != s[i-j]) and (s[i] != s[i+j]) and (s[i-j] != s[i+j]):\n cnt += 1\nprint(r*g*b-cnt)", "n=int(input())\ns=input()\nr=s.count('R')\ng=s.coun...
['Wrong Answer', 'Accepted']
['s726399496', 's161866861']
[9088.0, 9132.0]
[1294.0, 1170.0]
[253, 253]
p02714
u496687522
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(1,N+1):\n for d in range(1, N+1):\n j = i+d\n k = j+d\n if k > N:\n break\n if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:\n ...
['Runtime Error', 'Accepted']
['s546312347', 's280296756']
[9208.0, 9160.0]
[21.0, 1477.0]
[332, 324]
p02714
u496821919
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"""\nCreated on Wed May 6 02:13:01 2020\n\n@author: shinba\n"""\n\nN = int(input())\nS = input()\n\nR = []\nG = []\nB = []\n\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\nans = len(R)*len(G)*...
['Wrong Answer', 'Accepted']
['s214896419', 's168581368']
[9108.0, 9176.0]
[2206.0, 1100.0]
[552, 761]
p02714
u506910932
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\nans = s.count('R') * s.count('G') * s.count('B')\nprint(ans)\nfor i in range(n):\n for j in range(i + 1, n):\n k = 2 * j - i\n \n if k < n and (s[i] != s[j] and s[j] != s[k]\n and s[i] != s[k]) and j - i == k - j:\n ans -= 1\n\np...
['Wrong Answer', 'Accepted']
['s256886667', 's770337242']
[9220.0, 9136.0]
[1851.0, 1862.0]
[393, 383]
p02714
u509739538
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 math\nimport queue\nfrom collections import defaultdict\n \ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\ndef factorization(n):\n\tres = []\n\tif n%2==0:\n\t\tres.append(2)\n\tfor ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s459134611', 's834435882', 's704695756']
[9828.0, 9932.0, 9836.0]
[29.0, 1534.0, 1917.0]
[1398, 1423, 1434]
p02714
u510722570
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())\nrn = s.count("R")\ngn = s.count("G")\nbn = s.count("B")\n\nct=0\nfor i in range(n):\n for j in range(i+1,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[i]!=s[k]:\n ct += 1\n \nprint(rn*gn*bn-ct)', 'n = int(input())\ns = str(input())\...
['Runtime Error', 'Accepted']
['s020475764', 's600090344']
[9032.0, 9208.0]
[24.0, 1346.0]
[264, 266]
p02714
u512212329
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 = int(input())\n s = input()\n # Positions for each character.\n r = []\n g = []\n b = []\n for ind, c in enumerate(s):\n if c == 'R':\n r.append(ind)\n elif c == 'G':\n g.append(ind)\n else:\n b.append(ind)\n ans = 0\n p...
['Wrong Answer', 'Accepted']
['s656802002', 's938339538']
[9244.0, 9156.0]
[2205.0, 1037.0]
[548, 687]
p02714
u514894322
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')\ng=s.count('G')\nb=s.count('B')\nans=r*g*b\nfor i in range(1,(n+1)//2):\n for j in range(n-2*i):\n print(s[j],s[j+i],s[j+2*i])\n if len(set([s[j],s[j+i],s[j+2*i]]))==3:\n print(j,j+i,j+2*i)\n ans-=1\nprint(ans)", "n=int(input())\ns=input()\nr=s.count('R')\ng=...
['Wrong Answer', 'Accepted']
['s502623680', 's910710794']
[17424.0, 9028.0]
[2221.0, 1863.0]
[257, 200]
p02714
u515674295
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\nRN = S.count('R')\nGN = S.sount('G')\nBN = S.count('B')\n\nans = RN * GN * BN\n\nfor i in range(N):\n for d in range(N):\n j = i + d\n k = i + 2 * d\n if k >= N:\n break\n if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:\n ans -= ...
['Runtime Error', 'Accepted']
['s486885865', 's971020469']
[9216.0, 9176.0]
[24.0, 1546.0]
[315, 315]
p02714
u519939795
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.
['Npt', "n = int(input())\ns = list(input())\n\nnum_r = s.count('R')\nnum_g = s.count('G')\nnum_b = s.count('B')\n\nans = num_r*num_g*num_b\n\nfor i in range(n):\n for j in range(i, n):\n k = j+(j-i)\n if (k < n) and (s[i] != s[j]) and (s[j] != s[k]) and (s[k] != s[i]):\n ans -= 1\nprint(ans...
['Runtime Error', 'Accepted']
['s571517054', 's896472216']
[9116.0, 9172.0]
[25.0, 1921.0]
[3, 298]
p02714
u529106146
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#sys.exit()\n\nN = int(input())\n#S,T = map(int, input().split())\n#A = list(map(int, input().split()))\n#print(N)\n#print(S,T)\n#print(A)\nS = str(input())\nr = S.count("R")\ng = S.count("G")\nb = S.count("B")\nans = (r*g*b)\n#r2 = [i for i, x in enumerate(S) if x == \'R\']\n#g2 = [i for i, x in enumerat...
['Runtime Error', 'Runtime Error', 'Accepted']
['s610325482', 's800898576', 's450259161']
[9208.0, 9204.0, 9168.0]
[25.0, 22.0, 1864.0]
[635, 635, 360]
p02714
u536034761
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 = int(input())\n S = input()\n R = set()\n G = set()\n B = set()\n for i,s in enumerate():\n if s == "R":\n R.add(i)\n elif s == "B":\n B.add(i)\n else:\n G.add(i)\n ans = 0\n for r in R:\n for b in B:\n fo...
['Runtime Error', 'Accepted']
['s227560164', 's414369178']
[9156.0, 9124.0]
[25.0, 1060.0]
[533, 379]
p02714
u558717347
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.
['total = 0\nfor i in range(0,n-2):\n for j in range(i+1,n-1):\n for k in range(j+1,n):\n if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:\n if j!= (k+i)/2:\n # if j<3:\n # print(i,j,k)\n total += 1\nprint(total)', "n = ...
['Runtime Error', 'Accepted']
['s389667401', 's396421502']
[9116.0, 9192.0]
[22.0, 1795.0]
[301, 531]
p02714
u585348179
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 numpy as np\nN=int(input())\nS = input()\n\nr = S.count('R')\ng = S.count('G')\nb = S.count('B')\n\n\nans = r*g*b\n\nfor i in range(N):\n for d in range(N):\n j = i+d\n k = j+d\n if k >= N:\n break\n if S[i] != S[j] and S[j] != S[k] and S[i] != S[i]:\n ans -= 1\n \nprint(ans)", "impor...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s429360429', 's513567602', 's556386536', 's982383573', 's138933001']
[27024.0, 27132.0, 27040.0, 27104.0, 9204.0]
[1479.0, 110.0, 103.0, 106.0, 1468.0]
[289, 275, 275, 275, 331]
p02714
u585963734
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())\na=[0]*4\n\nfor i in range(N):\n if S[i]=='R':a[0]+=1\n if S[i]=='G':a[1]+=1\n if S[i]=='B':a[2]+=1\n \nfor i in range(N):\n for j in range(i+1,N):\n k=j+(j-i)\n if k>=N:\n break\n else:\n if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i] and j-i==k-j:\n a[3]...
['Wrong Answer', 'Accepted']
['s278760072', 's982778415']
[9252.0, 9188.0]
[1462.0, 1327.0]
[342, 333]
p02714
u614628638
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.
["S = list(input())\nS_len = len(S)\nans = 0\ni = 0\nfor _ in range(S_len):\n if S[0] == 'R':\n ans += S[1:].count('B') * S[1:].count('G')\n for j in range(int(len(S)/2+1)):\n try:\n if S[j+1] != S[j*2+2] and S[j*2+2] !='R' and S[j+1] !='R':\n ans-=1\n except:\n pass\n if S[0] =...
['Wrong Answer', 'Accepted']
['s278312547', 's231614538']
[9224.0, 9236.0]
[20.0, 1454.0]
[765, 777]
p02714
u619084943
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())\t\ns=input()\n\nc = collections.Counter(s)\n\nans_count = c['R'] * c['G'] * c['B']\n\nfor i in range(1, (n-1)//2):\n for j in range(n):\n if j+(2*i) >= n:\n break\n\n if s[j] != s[j+i] and s[j+i] != s[j+(2*i)] and s[j] != s[j+(2*i)]:\n ans_co...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s843807696', 's865993005', 's122272236']
[9460.0, 9468.0, 9412.0]
[1730.0, 1669.0, 1761.0]
[330, 327, 330]
p02714
u619398783
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\nfor i in range(n-2):\n for j in range(i+1,n-1):\n if s[i] == s[j]:\n break\n for k in range(j+1,n):\n if s[k] in (s[i],s[j]):\n break\n if j-i != k-j:\n cnt +=1\nprint(cnt)\n', "n = int(input())\ns ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s616464200', 's759324565', 's169545645']
[9176.0, 9244.0, 9200.0]
[27.0, 105.0, 1381.0]
[281, 590, 277]
p02714
u629454253
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 = 0\n\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 else:\n b.append(i)\nmcount = 0\nfor i in range((n-1)/2-1):\n for j in range(i+1, n-1-1-i):\n if s[j] != s[j-i-1] and s[j] != s[j+i+1] and s[j-i-1]...
['Runtime Error', 'Accepted']
['s565532377', 's563310296']
[9308.0, 9188.0]
[25.0, 1308.0]
[1039, 250]
p02714
u630554891
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\n\nfor i in range(n):\n for j in range(n):\n for k in range(n):\n if s[i] != s[j] and s[i] != s[k] and s[j] != s[k] and i < j and j < k and j-i != k-j:\n print(i,j,k)\n ans = ans + 1\n\nprint(ans)', "n=int(input())\ns=input()\n\nr =...
['Wrong Answer', 'Accepted']
['s288422979', 's267419419']
[14680.0, 9208.0]
[2238.0, 1861.0]
[271, 302]
p02714
u631755487
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())\nstring = input()\n\nresult = string.count('R')*string.count('G')*string.count('B')\n\nfor i in range(N-2):\n for j in range(i+1, N):\n k = 2*j-1\n if k>=N:\n break\n if string[i] != string[j] != string[k]:\n result -= 1\nprint(result)", "N = int(input())\nstring = input()\n \nres...
['Wrong Answer', 'Accepted']
['s339459989', 's416200387']
[9192.0, 9172.0]
[587.0, 1325.0]
[260, 305]
p02714
u634934338
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_count = s.count('R')\ng_count = s.count('G')\nb_count = s.count('B')\n\ndiscount = 0\nfor i in range(n-2):\n for j in range(i+1, n-1):\n k = i + 2*(j-i)\n if k > n-1:\n break\n if s[i] == s[j] and s[i] == s[k]:\n discount += 1\n\nprint(r...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s153766805', 's603113949', 's864534888', 's197279314']
[9100.0, 9240.0, 18616.0, 9212.0]
[1223.0, 2205.0, 2225.0, 1455.0]
[334, 1132, 393, 351]
p02714
u644126199
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\nN = int(input())\nS = input()\n#Rc1,Gc1,Bc1\nout = S.count('R') * S.count('G') * S.count('B')\nprint(out)\n\nRGBs = list(itertools.permutations(['R', 'G', 'B'], 3))\n\nfor i in range(1, N):\n for j in range(N-i*2):\n \n if (S[j], S[j+i], S[j+i*2]) in RGBs:\n out -= 1\nprint(out)", "impor...
['Wrong Answer', 'Accepted']
['s686185890', 's314739267']
[9204.0, 9200.0]
[1666.0, 1628.0]
[347, 336]
p02714
u645436608
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\nN = int(input())\nS = input()\nC = np.array(list(itertools.combinations_with_replacement(range(1, N + 1), 3)))\ncount = 0\nfor i, j, k in C:\n if (i != 2 * j - k) and (S[i - 1] != S[j - 1] and S[i - 1] != S[k - 1] and S[j - 1] != S[k - 1]):\n count += 1\nprint(count)\n', 'N = int(input())\...
['Runtime Error', 'Accepted']
['s208274313', 's509458201']
[9200.0, 9156.0]
[22.0, 1935.0]
[288, 286]
p02714
u658915215
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()\ns=collections.Counter(S)\nprint(s)\nans=s['R']*s['G']*s['B']\nfor i in range(n):\n for d in range(n):\n j=i+d\n k=j+d\n if k>n-1:\n break\n if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:\n ans-=1\nprint(ans)", "#162D\n...
['Wrong Answer', 'Accepted']
['s226023565', 's029430246']
[9452.0, 9316.0]
[1446.0, 1489.0]
[292, 304]
p02714
u666351996
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\nRs = 0\nGs = 0\nBs = 0\nfor i, il in enumerate(S):\n if il == 'R':\n Rs += 1\n if il == 'G':\n Gs += 1\n if il == 'B':\n Bs += 1\nnum = 0\nfor i in range(N):\n for step in range(1, N):\n j = i + step\n k = i + 2*step\n if k > N - 1...
['Wrong Answer', 'Accepted']
['s720300370', 's783421230']
[23688.0, 9176.0]
[2262.0, 1600.0]
[448, 408]
p02714
u667084803
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\nans = S.count('R') * S.count('G') * S.count('B')\nfor i in range(N):\n a = S[i]\n for j in range(i+1,N):\n b = S[j]\n if (i+j)%2 :\n continue\n k = (i+j)//2\n if [a,S[k],b].sort() == ['B','G','R']\n ans -= 1\n \nprint(ans)", "N = int(input())\nS = input()\...
['Runtime Error', 'Accepted']
['s346731961', 's206665708']
[9056.0, 9168.0]
[23.0, 1815.0]
[270, 242]
p02714
u668642853
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.
['x1 = input()\nx2 = input()\nRGB = {"R", "G", "B"}\n_sum = 0\nfor i, rgb in zip(itertools.combinations(range(x1), 3), itertools.combinations(x2, 3)):\n if set(rgb) == RGB and (i[1] - i[0]) != (i[2] - i[1]):\n _sum += 1\nprint(_sum)', 'from itertools import product\n\nx1 = int(input())\nx2 = input()\n\nR_i = ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s515660578', 's517904236', 's653004100', 's670607404', 's725033687', 's916518187', 's322996535']
[9132.0, 9268.0, 9128.0, 9420.0, 9284.0, 9120.0, 9272.0]
[23.0, 1233.0, 25.0, 1183.0, 24.0, 26.0, 1079.0]
[233, 551, 251, 551, 518, 280, 562]
p02714
u673338219
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\ninput = sys.stdin.readline\nn = int(input())\ns = str(input())\nr = 0\ng = 0\nfor i in range(n):\n if s[i] == "R":\n r += 1\n elif s[i] == "G":\n g += 1\nc = r*g*(n-r-g)\nfor j in range(1,n-1):\n for i in range(1,min(n-j-1,j)+1):\n if (s[j-i] != s[j]) and (s[j] != s[j+i]) and (s[j+i] != s[j-i]...
['Wrong Answer', 'Accepted']
['s569984629', 's310325733']
[9196.0, 9216.0]
[1212.0, 1257.0]
[347, 328]
p02714
u685684561
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())\nt=N*(N-1)*(N-2)//6\nprint (t)\nfor i in range(N):\n for j in range(i+1,N):\n if S[i]==S[j]:\n t=t-(N-j-1)\n else:\n for k in range(j+1,N):\n if S[j]!=S[k] and S[i]!=S[k] and (i-j)!=(j-k):\n continue\n ...
['Wrong Answer', 'Accepted']
['s896377315', 's549533970']
[9076.0, 9248.0]
[2205.0, 1148.0]
[350, 471]
p02714
u686390526
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\nR=[]\nG=[]\nB=[]\n\n\nfor i in range(0,N):\n if S[i]=="R":\n R += [i]\n elif S[i]=="G":\n G += [i]\n else:\n B += [i]\n\ndef search(ind, col):\n n=0\n useable_col = ["R","G","B"]\n useable_col.remove(col)\n for i,j in [[0,1],[1,0]]:\n l_col=useable_col[i]\n r_c...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s221978253', 's536343135', 's539624120', 's706481144', 's825361777', 's255918309']
[9304.0, 9308.0, 9544.0, 9260.0, 9536.0, 9192.0]
[2205.0, 2206.0, 2206.0, 652.0, 2206.0, 1114.0]
[1083, 1103, 1093, 1298, 1101, 340]
p02714
u693173434
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\nrcount=0\ngcount=0\nbcount=0\nfor i in range(n):\n if s[i]=="R":\n rcount+=1\n elif s[i]=="G":\n gcount+=1\n else:\n bcount+=1\n\nal=rcount*bcount*gcount\n\nfor i in range(n-2):\n for k in range(i+1,n):\n dis=k-i\n l=k+dis\n if k+d...
['Runtime Error', 'Accepted']
['s049998125', 's327405349']
[9148.0, 9152.0]
[32.0, 1949.0]
[407, 261]
p02714
u698849142
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=[]\ng=[]\nb=[]\nfor i,c in enumerate(s):\n if 'R' == c:\n r.append(i+1)\n elif 'G' == c:\n g.append(i+1)\n elif 'B' == c:\n b.append(i+1)\nprint(r,g,b)\ncount=0\nfor i in r:\n for j in g:\n for k in b:\n if j*2-i-k != 0:\n ...
['Wrong Answer', 'Accepted']
['s635311586', 's744896000']
[9208.0, 9468.0]
[2205.0, 1349.0]
[323, 366]
p02714
u698868214
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\nI = []\nJ = []\nK = []\n\nfor n in range(1,N+1):\n if S[n-1] == "R":\n I.append(n)\n elif S[n-1] == "G":\n J.append(n)\n else:\n K.append(n)\n \ncnt = 0\nfor a in I:\n for b in J:\n for c in K:\n ls = [a,b,c]\n ls.sort()a\n if ls[1] - ls[0] != ls[2] -...
['Runtime Error', 'Accepted']
['s966365719', 's892691001']
[8768.0, 9192.0]
[28.0, 1781.0]
[337, 271]
p02714
u699296734
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.
['\na=int(input())\nmoji=input()\nr=[]\ng=[]\nb=[]\nfor i in range(a):\n if moji[i]=="R":\n r.append(i)\n elif moji[i]=="G":\n g.append(i)\n elif moji[i]=="B":\n b.append(i)\nres=len(r)*len(g)*len(b)\nif len(r)==0 or len(g)==0 or len(b)==0:\n print(0)\nelse:\n min_len={len(r):r,len(g...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s454903628', 's781053337', 's847438840', 's449781866']
[9188.0, 9104.0, 9284.0, 9492.0]
[2205.0, 23.0, 21.0, 1785.0]
[675, 1033, 679, 1012]
p02714
u699944218
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()\nls = list(S)\ncount = 0\nfor k in range(2,N):\n for j in range(1,k):\n for i in range(0,j):\n if ls[i] != ls[j] and ls[j] != ls[k] and ls[k] != ls[i]:\n count += 1\nprint(count)', "N = int(input())\nS = input()\nls = list(S)\n\nnr = len([r for r in S if r == 'R'])\nnb = ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s713651130', 's841473655', 's754949479']
[9116.0, 9212.0, 9200.0]
[2206.0, 2206.0, 1617.0]
[215, 318, 386]
p02714
u704563784
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())\nstring = input()\n\nr=g=b=0\n\nfor idx, s in enumerate(string):\n if s == 'R':\n r+=1\n elif s == 'B':\n b+=1\n elif s == 'G':\n g+=1\n\nans = r*g*b\n\nfor i in range(n):\n for k in range(i+1, n):\n if string[i] != string[k]:\n if (k+i)%2 == 0 and l...
['Runtime Error', 'Runtime Error', 'Accepted']
['s552587178', 's752209523', 's198995237']
[8932.0, 9168.0, 9152.0]
[23.0, 23.0, 1553.0]
[388, 404, 399]
p02714
u706786134
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 numba import njit\nimport numpy as np\nimport sys\nread = sys.stdin.read\nreadline = sys.stdin.readline\n\nN = int(input())\nS = np.array(list(read().rstrip()), np.int8)\n\nR = np.sum(S == ord('R'))\nB = np.sum(S == ord('B'))\nG = np.sum(S == ord('G'))\n\n\n@njit\ndef f(S):\n N = len(S)\n ret = 0\n for ...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s539563647', 's566181402', 's648129240', 's569873830']
[91532.0, 109532.0, 109628.0, 109668.0]
[391.0, 714.0, 695.0, 752.0]
[565, 579, 554, 625]
p02714
u709304134
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 collections import Counter\nN = int(input())\nS = input()\n#c = Counter(S)\n#print (c.most_common())\n#ls = list(c.values())\nans = S.count('R') * S.count('G') * S.count('B')\n\n\nfor i in range(N):\n for j in range(1,N):\n a = i + j\n b = i + j + j\n if (b >= N):\n break\n ...
['Runtime Error', 'Accepted']
['s965515036', 's456946050']
[8876.0, 9468.0]
[21.0, 1631.0]
[626, 326]
p02714
u720636500
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("R")*s.count("G")*s.count("B")\nfor i in range(1,n//2+10):\n j = 0\n while j+2*i <= n-1:\n print([j, j+i, j+2*i])\n if s[j] != s[j+i] and s[j] != s[j+2*i] and s[j+i] != s[j+2*i]:\n ans -= 1\n j += 1\nprint(ans)', 'n = int(input())\ns = input()\nans = s.coun...
['Wrong Answer', 'Accepted']
['s203033875', 's245680286']
[39564.0, 9192.0]
[2302.0, 1707.0]
[261, 235]
p02714
u725993280
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,s = input().split()\ns = list(s)\n\ncount = 0\n\nfor i in range(0,len(s)):\n for j in range(i,len(s)):\n for k in range(j,len(s)):\n if(j-i != k-j) and (s[i] != s[j] and s[i] != s[k] and s[j] != s[k]):\n count += 1\n\n\nprint(count)\n', 'n = int(input())\ns = input()\n\ns = list(...
['Runtime Error', 'Accepted']
['s279621932', 's504976416']
[9036.0, 9220.0]
[24.0, 1869.0]
[259, 304]
p02714
u726285999
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\nsum = 0\nfor i in range(N):\n for j in range(i+1, N):\n if S[i] == S[j]:\n continue\n\n RGB = ['R','G','B']\n RGB.remove(S[j])\n RGB.remove(S[i])\n sum += S[(j+1):].count(RGB[0])\n\n # S[k]\n k = 2 * j ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s259691570', 's789369892', 's086424037']
[8912.0, 9348.0, 9472.0]
[22.0, 22.0, 1347.0]
[408, 299, 339]
p02714
u727057618
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 math\nfrom itertools import combinations\n\ndef main():\n k = int(input())\n res = 0\n memo = [[0 for _ in range(k+1)] for _ in range(k+1)]\n for i ian range(1, k+1):\n for j in range(i, k+1):\n tmp = math.gcd(i,j)\n memo[i][j] = tmp\n memo[j][i] = tmp\n\n ...
['Runtime Error', 'Accepted']
['s398222453', 's665677322']
[9024.0, 9228.0]
[24.0, 1170.0]
[626, 630]
p02714
u729008627
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()\nnR = 0\nnG = 0\nnB = 0\ncnt = 0\nfor i in range(N-1):\n if S[i] == 'R':\n nR += 1\n elif S[i] == 'G':\n nG += 1\n else:\n nB += 1\n for j in range(i+1, N):\n k = j - i + j\n if k < N:\n L = [S[i], S[j], S[k]]\n if 'R' in L and 'G' in L and 'B' in L:\n ...
['Wrong Answer', 'Accepted']
['s297657606', 's685979650']
[9208.0, 9208.0]
[1793.0, 1558.0]
[352, 350]
p02714
u732061897
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()\nresult = 0\n'''\nfor i in range(N):\n print(result)\n for j in range(i+1,N):\n if S[i] != S[j]:\n for k in range(j ,N):\n if k- j == j - i:\n continue\n if S[j] != S[k] and S[i] != S[k]:\n result...
['Runtime Error', 'Accepted']
['s804524983', 's763159065']
[9192.0, 9152.0]
[994.0, 1943.0]
[575, 575]
p02714
u744695362
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]\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[...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s155741589', 's274450706', 's298093806', 's657441472', 's701690294', 's721333055']
[9208.0, 9192.0, 9216.0, 9204.0, 9176.0, 9120.0]
[23.0, 22.0, 23.0, 24.0, 22.0, 1696.0]
[346, 765, 347, 349, 765, 351]
p02714
u745687363
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()\na = s.count("R")\nb = s.count("G")\nc = s.count("B")\nz = a*b*c\nif z ==0:\n print(0)\nelse:\n R=[]\n G=[]\n B=[]\n for 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)\n x = 0\n for i in R:\n for j in G...
['Runtime Error', 'Accepted']
['s553319516', 's611147871']
[9236.0, 9236.0]
[2205.0, 1041.0]
[411, 418]