problem_id stringlengths 6 6 | buggy_code stringlengths 8 526k | fixed_code stringlengths 12 526k | labels listlengths 0 15 ⌀ | buggy_submission_id int64 1 1.54M | fixed_submission_id int64 2 1.54M | user_id stringlengths 10 10 | language stringclasses 8
values |
|---|---|---|---|---|---|---|---|
p02714 | n = int(input())
s = input()
R=[]
G=[]
B=[]
for i in range(n):
if s[i] == "R":
R.append(i)
elif s[i] == "G":
G.append(i)
else:
B.append(i)
ans = len(R)*len(G)*len(B)
for i in range(n-2):
for j in range(i+1,n-1):
k = 2*j-i
if k<n:
if (s[i]==s[j]) an... | n = int(input())
s = input()
R=[]
G=[]
B=[]
for i in range(n):
if s[i] == "R":
R.append(i)
elif s[i] == "G":
G.append(i)
else:
B.append(i)
ans = len(R)*len(G)*len(B)
for i in range(n-2):
for j in range(i+1,n-1):
k = 2*j-i
if k<n:
if (s[i]!=s[j]) an... | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 476,863 | 476,864 | u833738197 | python |
p02714 | n = int(input())
s = str(input())
r = 0
g = 0
b = 0
for i in range(n):
if s[i] == "R":
r += 1
elif s[i] == "G":
g += 1
else:
b += 1
p = r*g*b
for i in range(n-2):
for j in range(int(n/2)):
if i + 2*j >n-1:
break
if s[i] != s[i+j] and s[i] != s[i+2*j] a... | n = int(input())
s = str(input())
r = 0
g = 0
b = 0
for i in range(n):
if s[i] == "R":
r += 1
elif s[i] == "G":
g += 1
else:
b += 1
p = r*g*b
for i in range(n-2):
for j in range(int(n/2)+1):
if i + 2*j >n-1:
break
if s[i] != s[i+j] and s[i] != s[i+2*j]... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 476,868 | 476,869 | u247830763 | python |
p02714 | n = int(input())
s = list(input())
ans = s.count('R')*s.count('G')*s.count('B')
for i in range(n):
if s[i] == 'R':
s[i] = 1
elif s[i] == 'G':
s[i]
elif s[i] == 'B':
s[i] = 4
for i in range(n):
for j in range(i+1, n):
k = 2*j - i
if k >= n:
continue
if s[i]+s[j]+s[k]==7:
a... | n = int(input())
s = list(input())
ans = s.count('R')*s.count('G')*s.count('B')
for i in range(n):
if s[i] == 'R':
s[i] = 1
elif s[i] == 'G':
s[i] = 2
elif s[i] == 'B':
s[i] = 4
for i in range(n):
for j in range(i+1, n):
k = 2*j - i
if k >= n:
continue
if s[i]+s[j]+s[k]==7:
... | [
"assignment.add"
] | 476,874 | 476,875 | u228303592 | python |
p02714 | n = int(input())
s = str(input())
r = s.count('R')
g = s.count('G')
b = s.count('B')
cnt = r * g * b
for i in range(n // 2 - 1):
for j in range(n - (i + 1) * 2):
if s[j] != s[j+i+1] and s[j+i+1] != s[j+2*(i+1)] and s[j] != s[j+2*(i+1)]:
cnt -= 1
print(cnt)
| n = int(input())
s = str(input())
r = s.count('R')
g = s.count('G')
b = s.count('B')
cnt = r * g * b
for i in range(n // 2):
for j in range(n - (i + 1) * 2):
if s[j] != s[j+i+1] and s[j+i+1] != s[j+2*(i+1)] and s[j] != s[j+2*(i+1)]:
cnt -= 1
print(cnt)
| [
"expression.operation.binary.remove"
] | 476,896 | 476,897 | u134019875 | python |
p02714 | N=int(input())
S=input()
rgb={"R":0,"G":0,"B":0}
for s in S:
rgb[s]+=1
ans=rgb["R"]*rgb["G"]*rgb["B"]
for dist in range(N//2):
left=0
while left+dist*2<N:
if len(set([S[left],S[left+dist],S[left+dist*2]]))==3:
ans-=1
left+=1
print(ans)
| N=int(input())
S=input()
rgb={"R":0,"G":0,"B":0}
for s in S:
rgb[s]+=1
ans=rgb["R"]*rgb["G"]*rgb["B"]
for dist in range(1,N//2+1):
left=0
while left+dist*2<N:
if len(set([S[left],S[left+dist],S[left+dist*2]]))==3:
ans-=1
left+=1
print(ans)
| [
"call.arguments.add"
] | 476,904 | 476,905 | u093861603 | python |
p02714 | n = int(input())
s = input()
from collections import Counter
rgb = dict(Counter(s))
if len(dict) < 3:
print('0')
else:
p = rgb['R'] * rgb['G'] * rgb['B']
for i in range(1, (len(s)-1)//2 + 1):
for j in range(len(s) - 2*i):
if {s[j], s[j + i], s[j + 2*i]} == {'R', 'G', 'B'}:
... | n = int(input())
s = input()
from collections import Counter
rgb = dict(Counter(s))
if len(rgb) < 3:
print('0')
else:
p = rgb['R'] * rgb['G'] * rgb['B']
for i in range(1, (len(s)-1)//2 + 1):
for j in range(len(s) - 2*i):
if {s[j], s[j + i], s[j + 2*i]} == {'R', 'G', 'B'}:
... | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 476,906 | 476,907 | u288335507 | python |
p02714 | from collections import Counter
n=int(input())
s_=input()
s=Couter(s_)
rgb = s['R'] * s['G'] * s['B']
cnt=0
for i in range(len(s_)):
for j in range(i+1,len(s_)):
h=j-i+j
if h<n:
if s_[i]!=s_[j] and s_[h]!=s_[j] and s_[i]!=s_[h]:
cnt+=1
print(rgb-cnt)
| from collections import Counter
n=int(input())
s_=input()
s=Counter(s_)
rgb = s['R'] * s['G'] * s['B']
cnt=0
for i in range(len(s_)):
for j in range(i+1,len(s_)):
h=j-i+j
if h<n:
if s_[i]!=s_[j] and s_[h]!=s_[j] and s_[i]!=s_[h]:
cnt+=1
print(rgb-cnt)
| [
"assignment.value.change",
"identifier.change",
"call.function.change"
] | 476,915 | 476,916 | u768256617 | python |
p02714 | N=int(input())
S=str(input())
r=S.count('R')
g=S.count('G')
b=S.count('B')
ans=r*g*b
dib=0
m=0
for i in range(N-2):
m=(N-i)//2+1
for j in range(i+1,m):
dib=j-i
if j+dib<=N-1:
if S[i]!=S[j] and S[i]!=S[j+dib] and S[j]!=S[j+dib]:
ans=ans-1
... | N=int(input())
S=str(input())
r=S.count('R')
g=S.count('G')
b=S.count('B')
ans=r*g*b
dib=0
m=0
for i in range(N-2):
m=(N+i)//2+1
for j in range(i+1,m):
dib=j-i
if j+dib<=N-1:
if S[i]!=S[j] and S[i]!=S[j+dib] and S[j]!=S[j+dib]:
ans=ans-1
... | [
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 476,951 | 476,952 | u111652094 | python |
p02714 | import collections
n = int(input())
s = input()
res = 0
# for i in range(0, n):
# for j in range(i+1,n):
# if s[i] != s[j]:
# for k in range(j+1,n):
# if j-i!=k-j and s[i] != s[k] and s[j] != s[k]:
# res += 1
#
# print(res)
num = collections.Counter(s)
# prin... | import collections
n = int(input())
s = input()
res = 0
# for i in range(0, n):
# for j in range(i+1,n):
# if s[i] != s[j]:
# for k in range(j+1,n):
# if j-i!=k-j and s[i] != s[k] and s[j] != s[k]:
# res += 1
#
# print(res)
num = collections.Counter(s)
# prin... | [
"expression.operation.binary.remove"
] | 476,987 | 476,988 | u167360450 | python |
p02714 |
def main():
n = int(input())
s = input()
r,g,b = 0,0,0
for i in s:
if i == 'r': r += 1
elif i == 'g': g += 1
elif i == 'b': b += 1
ans = r*g*b
for j in range(n):
for i in range(j):
k = j+(j-i)
if k < n:
if s[i] == s[j] or s... |
def main():
n = int(input())
s = input()
r,g,b = 0,0,0
for i in s:
if i == 'R': r += 1
elif i == 'G': g += 1
elif i == 'B': b += 1
ans = r*g*b
for j in range(n):
for i in range(j):
k = j+(j-i)
if k < n:
if s[i] == s[j] or s... | [
"literal.string.change",
"literal.string.case.change",
"control_flow.branch.if.condition.change"
] | 477,021 | 477,022 | u143322814 | python |
p02714 | n = int(input())
s = input()
nr = s.count("R")
ng = s.count("G")
nb = s.count("B")
count = nr * ng * nb
for i in range(n-3):
for j in range(i+1, (n+i+1)//2):
if s[i] == s[j]:continue
else:
k = 2*j - i # k - j = j - i
if s[i] == s[k]:continue
if s[j] == s[k]:con... | n = int(input())
s = input()
nr = s.count("R")
ng = s.count("G")
nb = s.count("B")
count = nr * ng * nb
for i in range(n-2):
for j in range(i+1, (n+i+1)//2):
if s[i] == s[j]:continue
else:
k = 2*j - i # k - j = j - i
if s[i] == s[k]:continue
if s[j] == s[k]:con... | [
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change",
"control_flow.loop.range.bounds.upper.change"
] | 477,025 | 477,026 | u868339437 | python |
p02714 | n=int(input())
s=input()
count=0
r_list=[]
g_list=[]
b_list=[]
for i in range(len(s)):
if s[i]=="R":
r_list.append(i)
elif s[i]=="G":
g_list.append(i)
elif s[i]=="B":
b_list.append(i)
for i in range(1,len(s)-1):
if n%2==0:
if i<n//2:
for j in range(1,i+1):
... | n=int(input())
s=input()
count=0
r_list=[]
g_list=[]
b_list=[]
for i in range(len(s)):
if s[i]=="R":
r_list.append(i)
elif s[i]=="G":
g_list.append(i)
elif s[i]=="B":
b_list.append(i)
for i in range(1,len(s)-1):
if n%2==0:
if i<n//2:
for j in range(1,i+1):
... | [
"expression.operation.binary.remove"
] | 477,050 | 477,051 | u636665812 | python |
p02714 | N = int(input())
S = input()
ans, gap = S.count('R') * S.count('G') * S.count('B'), 1
while gap * 2 + 1 < N:
ans -= sum([1 for i in range(N - gap * 2)
if {'R', 'G', 'B'} == {S[i], S[i + gap], S[i + 2 * gap]}])
gap += 1
print(ans)
| N = int(input())
S = input()
ans, gap = S.count('R') * S.count('G') * S.count('B'), 1
while gap * 2 + 1 <= N:
ans -= sum([1 for i in range(N - gap * 2)
if {'R', 'G', 'B'} == {S[i], S[i + gap], S[i + 2 * gap]}])
gap += 1
print(ans)
| [
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 477,055 | 477,056 | u332906195 | python |
p02714 | n = int(input())
s = input()
count = {"R":0,"G":0,"B":0}
for c in s:
count[c] += 1
r,g,b = count.values()
ans = r*g*b
for i in range(1,(n-1)//2+1): #1から
for rgb in zip(s,s[i:],s[i*2:]): #rgbに連続した三つのリストの要素を入れ込む
if len(set(rgb)) == 3: #リストrgbをセットにまとめ、長さが
ans -=1 | n = int(input())
s = input()
count = {"R":0,"G":0,"B":0}
for c in s:
count[c] += 1
r,g,b = count.values()
ans = r*g*b
for i in range(1,(n-1)//2+1): #1から
for rgb in zip(s,s[i:],s[i*2:]): #rgbに連続した三つのリストの要素を入れ込む
if len(set(rgb)) == 3: #リストrgbをセットにまとめ、長さが
ans -=1
print(ans) | [
"call.add"
] | 477,059 | 477,060 | u951814007 | python |
p02714 | n = int(input())
s = str(input())
ans = s.count("R")*s.count("G")*s.count("B")
for i in range(n-2):
for j in range(i+1, n-1):
k = int(2*j -i )
if k <= n-1:
if s[i] != s[j] and s[k] != s[i] and s[i] != s[k]:
ans -= 1
print(ans) | n = int(input())
s = str(input())
ans = s.count("R")*s.count("G")*s.count("B")
for i in range(n-2):
for j in range(i+1, n-1):
k = int(2*j -i)
if k <= n-1:
if s[i] != s[j] and s[k] != s[i] and s[j] != s[k]:
ans -= 1
print(ans) | [
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 477,068 | 477,069 | u130203301 | python |
p02714 | n = int(input())
s = input()
r = s.count('R')
g = s.count('G')
b = s.count('B')
ans = r*g*b
for i in range(n):
for j in range(i+1, n):
if s[i] != s[j] and s[i] != s[int((i+j)/2)] and s[int((i+j)/2)] != s[j]:
ans -= 1
print(ans) | n = int(input())
s = input()
r = s.count('R')
g = s.count('G')
b = s.count('B')
ans = r*g*b
for i in range(n):
for j in range(i+2, n, 2):
if s[i] != s[j] and s[i] != s[int((i+j)/2)] and s[int((i+j)/2)] != s[j]:
ans -= 1
print(ans) | [
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change",
"control_flow.loop.range.bounds.upper.change",
"call.arguments.add"
] | 477,117 | 477,118 | u209426189 | python |
p02714 | import math
n = int(input())
s = input()
R, G, B = s.count("R"), s.count("G"), s.count("B")
ans = R * G * B
for i in range(n):
for j in range(n // 2):
c1 = i
c2 = i + j
c3 = i + j * 2
if c3 >= n: continue
if c1 == c2 == c3: continue
if s[c1] != s[c2] and s[c2] != s... | import math
n = int(input())
s = input()
R, G, B = s.count("R"), s.count("G"), s.count("B")
ans = R * G * B
for i in range(n):
for j in range(n):
c1 = i
c2 = i + j
c3 = i + j * 2
if c3 >= n: break
if c1 == c2 == c3: continue
if s[c1] != s[c2] and s[c2] != s[c3] and... | [
"expression.operation.binary.remove",
"control_flow.continue.remove",
"control_flow.break.add"
] | 477,125 | 477,124 | u552176911 | python |
p02714 | N = int(input())
S = input()
R = S.count('R')
G = S.count('G')
B = N-R-G
ans = R*G*B
for d in range(1,N//2):
for i in range(N):
if i + d*2 >= N: break
a,b,c = S[i],S[i+d],S[i+d+d]
if a!=b and b!=c and c!=a:
ans -= 1
print(ans) | N = int(input())
S = input()
R = S.count('R')
G = S.count('G')
B = N-R-G
ans = R*G*B
for d in range(1,N//2+1):
for i in range(N):
if i + d*2 >= N: break
a,b,c = S[i],S[i+d],S[i+d+d]
if a!=b and b!=c and c!=a:
ans -= 1
print(ans) | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 477,179 | 477,180 | u761320129 | python |
p02714 | n = int(input())
s = input()
ans = s.count("R") * s.count("G") * s.count("B")
cnt = 0
for i in range(n-3):
i_ = s[i]
for j in range(i+1, n-1):
if s[j] == i_: continue
k = 2 * j - i
j_ = s[j]
if k >= n or s[k] == i_ or s[k] == j_: continue
cnt += 1
print(ans - cnt) | n = int(input())
s = input()
ans = s.count("R") * s.count("G") * s.count("B")
cnt = 0
for i in range(n):
i_ = s[i]
for j in range(i+1, n):
if s[j] == i_: continue
k = 2 * j - i
j_ = s[j]
if k >= n or s[k] == i_ or s[k] == j_: continue
cnt += 1
print(ans - cnt) | [
"expression.operation.binary.remove"
] | 477,195 | 477,196 | u454524105 | python |
p02714 | n=int(input())
s=input()
r=s.count("R")
g=s.count("G")
b=s.count("B")
ans=r*g*b
for i in range(n):
for d in range(n):
j=i+d
k=j+d
if k>=n:
break
if s[i]!=s[j] & s[j]!=s[k] & s[k]!=s[i]:
ans-=1
print(ans) | n=int(input())
s=input()
r=s.count("R")
g=s.count("G")
b=s.count("B")
ans=r*g*b
for i in range(n):
for d in range(n):
j=i+d
k=j+d
if k>=n:
break
if (s[i]!=s[j]) & (s[j]!=s[k]) & (s[k]!=s[i]):
ans-=1
print(ans) | [
"control_flow.branch.if.condition.change"
] | 477,203 | 477,204 | u188226132 | python |
p02714 | N = int(input())
S = input()
r = S.count('R')
g = S.count('G')
b = S.count('B')
max = r * g * b
count = 0
for i in range(N-2):
for j in range(i+1, N-1):
k = 2 * j - i
if k > N - 1:
break
if S[i] != S[j] and S[j] != S[k] and S[i] == S[k]:
count += 1
print(max - count) | N = int(input())
S = input()
r = S.count('R')
g = S.count('G')
b = S.count('B')
max = r * g * b
count = 0
for i in range(N-2):
for j in range(i+1, N-1):
k = 2 * j - i
if k > N - 1:
break
if S[i] != S[j] and S[j] != S[k] and S[i] != S[k]:
count += 1
print(max - count) | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 477,205 | 477,206 | u242393873 | python |
p02714 |
n = int(input())
s = input()
kumikazu = s.count('R')*s.count('B')*s.count('G')
for i in range(n-2):
for j in range(i+1,n-1):
k = 2*j-i
if k >= n:
if (s[i] != s[j]) and (s[i] != s[k]) and (s[j] != s[k]):
kumikazu -= 1 | n = int(input())
s = input()
kumikazu = s.count('R')*s.count('B')*s.count('G')
for i in range(n-2):
for j in range(i+1, n-1):
k = 2*j-i
if k >= n:
break
if (s[i] != s[j]) and (s[i] != s[k]) and (s[j] != s[k]):
kumikazu -= 1
print(kumikazu)
| [
"control_flow.break.add",
"call.add"
] | 477,214 | 477,215 | u455957070 | python |
p02714 | N=int(input())
S=input()
r = len(S.replace("G", "").replace("B", ""))
g = len(S.replace("R", "").replace("B", ""))
b = N - r - g
ans = r * g
ans = ans * b
for i in range( N ):
for j in range(i+1, int((N+i)/2 )):
k = 2 * j - i
if k < N:
s = S[i] + S[j] + S[k]
if ("R" in s) &... | N=int(input())
S=input()
r = len(S.replace("G", "").replace("B", ""))
g = len(S.replace("R", "").replace("B", ""))
b = N - r - g
ans = r * g
ans = ans * b
for i in range( N ):
for j in range(i+1, int((N+i)/2 +1 )):
k = 2 * j - i
if k < N:
s = S[i] + S[j] + S[k]
if ("R" in s... | [
"expression.operation.binary.add"
] | 477,289 | 477,290 | u374018235 | python |
p02714 | n = int(input())
s = input()
r = s.count('R')
g = s.count('G')
b = s.count('B')
ret = r*g*b
for i in range(1,int(n/2)):
for j in range(0,n-2*i):
if(s[j] != s[j+i]) and (s[j+i] != s[j+2*i]) and (s[j+2*i] != s[j]):
ret -= 1
# print("i:%d j:%d " %(i,j), s[j],s[j+i],s[j+2*i]," !!")
# else:
# print("i:%d j:%d ... | n = int(input())
s = input()
r = s.count('R')
g = s.count('G')
b = s.count('B')
ret = r*g*b
for i in range(1,int((n+1)/2)):
for j in range(0,n-2*i):
if(s[j] != s[j+i]) and (s[j+i] != s[j+2*i]) and (s[j+2*i] != s[j]):
ret -= 1
# print(i,j,j+i,j+2*i,s[j],s[j+i],s[j+2*i]," !!")
# else:
# print(i,j,j+i,j+2*i,... | [
"call.arguments.change",
"control_flow.loop.range.bounds.upper.change"
] | 477,297 | 477,298 | u969808621 | python |
p02714 | N=int(input())
S=input()
ans = S.count("R")*S.count("G")*S.count("B")
tmp=0
for i in range(N):
for j in range(i,N):
if j-i+j < N:
if S[i]==S[j] and S[j]==S[j-i+j] and S[i]==S[j-i+j]:
tmp += 1
ans = ans - tmp
print(ans) | N=int(input())
S=input()
ans = S.count("R")*S.count("G")*S.count("B")
tmp=0
for i in range(N):
for j in range(i,N):
if j-i+j < N:
if S[i]!=S[j] and S[j]!=S[j-i+j] and S[i]!=S[j-i+j]:
tmp += 1
ans = ans - tmp
print(ans) | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 477,299 | 477,300 | u821775079 | python |
p02714 | x1 = int(input())
x2 = input()
R_i = [i for i, x in enumerate(x2) if x == "R"]
G_i = [i for i, x in enumerate(x2) if x == "G"]
B_i = [i for i, x in enumerate(x2) if x == "B"]
R = len(R_i)
G = len(G_i)
B = len(B_i)
xs = map(sorted, product(R_i, G_i))
s = 0
for a in xs:
k = a[1]*2 - a[0] # 2j-i
if k in B_i:
... | from itertools import product
x1 = int(input())
x2 = input()
R_i = [i for i, x in enumerate(x2) if x == "R"]
G_i = [i for i, x in enumerate(x2) if x == "G"]
B_i = {i for i, x in enumerate(x2) if x == "B"}
R = len(R_i)
G = len(G_i)
B = len(B_i)
xs = map(sorted, product(R_i, G_i))
s = 0
for a in xs:
k = a[1]*2 -... | [
"assignment.value.change"
] | 477,322 | 477,321 | u668642853 | python |
p02714 | N = int(input())
X = input()
ans = 0
r=0
g=0
b=0
G = []
R = []
B = []
for i in range(0,N):
if(X[i] == 'G'):
G.append(i)
g+=1
for k in range(0,N):
if(X[k] == 'R'):
R.append(k)
r+=1
for j in range(0,N):
if(X[j] == 'B'):
B.append(j)
b+=1
ans = r*b*g
for i in rang... | N = int(input())
X = input()
ans = 0
r=0
g=0
b=0
G = []
R = []
B = []
for i in range(0,N):
if(X[i] == 'G'):
G.append(i)
g+=1
for k in range(0,N):
if(X[k] == 'R'):
R.append(k)
r+=1
for j in range(0,N):
if(X[j] == 'B'):
B.append(j)
b+=1
ans = r*b*g
for i in rang... | [
"expression.operation.binary.remove"
] | 477,371 | 477,372 | u282978698 | python |
p02714 | n=int(input())
s=input()
r=s.count('R')
g=s.count('G')
b=s.count('B')
ans=r*g*b
for i in range(n//2):
for j in range(n-2*i):
if len(set([s[j],s[j+i],s[j+2*i]]))==3:
ans-=1
print(ans) | n=int(input())
s=input()
r=s.count('R')
g=s.count('G')
b=s.count('B')
ans=r*g*b
for i in range(1,(n+1)//2):
for j in range(n-2*i):
if len(set([s[j],s[j+i],s[j+2*i]]))==3:
ans-=1
print(ans) | [
"call.arguments.add"
] | 477,376 | 477,377 | u514894322 | python |
p02714 | import itertools
N = int(input())
S = input()
r = len(list(filter(lambda x: x == "R", S)))
g = len(list(filter(lambda x: x == "G", S)))
b = len(list(filter(lambda x: x == "B", S)))
# print("r:{}, g:{}, b:{}".format(r, g, b))
ans = r * g * b
RGB = list(itertools.permutations(["R", "G", "B"], 3))
# print(RGB)
for i... | import itertools
N = int(input())
S = input()
r = len(list(filter(lambda x: x == "R", S)))
g = len(list(filter(lambda x: x == "G", S)))
b = len(list(filter(lambda x: x == "B", S)))
# print("r:{}, g:{}, b:{}".format(r, g, b))
ans = r * g * b
RGB = list(itertools.permutations(["R", "G", "B"], 3))
# print(RGB)
for i... | [
"call.arguments.change"
] | 477,420 | 477,421 | u357949405 | python |
p02714 | import itertools
N = int(input())
S = input()
r = len(list(filter(lambda x: x == "R", S)))
g = len(list(filter(lambda x: x == "G", S)))
b = len(list(filter(lambda x: x == "B", S)))
# print("r:{}, g:{}, b:{}".format(r, g, b))
ans = r * g * b
RGB = itertools.permutations(["R", "G", "B"], 3)
for i in range(1, N):
... | import itertools
N = int(input())
S = input()
r = len(list(filter(lambda x: x == "R", S)))
g = len(list(filter(lambda x: x == "G", S)))
b = len(list(filter(lambda x: x == "B", S)))
# print("r:{}, g:{}, b:{}".format(r, g, b))
ans = r * g * b
RGB = list(itertools.permutations(["R", "G", "B"], 3))
# print(RGB)
for i... | [
"call.add",
"call.arguments.change"
] | 477,422 | 477,421 | u357949405 | python |
p02714 | def main():
n = int(input())
S = input()
'''
r_inds = []
g_inds = []
b_inds = []
for i in range(len(S)):
if S[i] == "R":
r_inds.append(i)
elif S[i] == "G":
g_inds.append(i)
else:
b_inds.append(i)
total_comb = len(r_inds)*len(g_... | from collections import defaultdict
def main():
n = int(input())
S = input()
'''
r_inds = []
g_inds = []
b_inds = []
for i in range(len(S)):
if S[i] == "R":
r_inds.append(i)
elif S[i] == "G":
g_inds.append(i)
else:
b_inds.append(i... | [] | 477,466 | 477,467 | u411353821 | python |
p02714 | import sys
n = int(input())
s = input()
r = []
g = []
b = []
for i in range(n):
c = s[i]
if c == 'R':
r.append(i)
elif c == 'G':
g.append(i)
else:
b.append(i)
#print(r)
#print(g)
#print(b)
ans = len(r) * len(g) * len(b)
for i in range(n-2):
for d in range(1, n // 2):
j = i + d
k = i +... | import sys
n = int(input())
s = input()
r = []
g = []
b = []
for i in range(n):
c = s[i]
if c == 'R':
r.append(i)
elif c == 'G':
g.append(i)
else:
b.append(i)
#print(r)
#print(g)
#print(b)
ans = len(r) * len(g) * len(b)
for i in range(n-2):
for d in range(1, n):
j = i + d
k = i + 2 * ... | [
"expression.operation.binary.remove"
] | 477,494 | 477,495 | u290563917 | python |
p02714 | import itertools
n = int(input())
s = str(input())
r = {}
b = {}
g = {}
for i in range(len(s)):
if s[i] == 'R':
r[i+1] = s[i]
elif s[i] == 'B':
b[i+1] = s[i]
else:
g[i+1] = s[i]
ans = len(r) * len(b) * len(g)
print(ans)
for i in r.keys():
for j in b.keys():
diff = abs(j-i... | import itertools
n = int(input())
s = str(input())
r = {}
b = {}
g = {}
for i in range(len(s)):
if s[i] == 'R':
r[i+1] = s[i]
elif s[i] == 'B':
b[i+1] = s[i]
else:
g[i+1] = s[i]
ans = len(r) * len(b) * len(g)
for i in r.keys():
for j in b.keys():
diff = abs(j-i)
m... | [
"call.remove"
] | 477,507 | 477,508 | u300579805 | python |
p02714 | n = int(input())
s = list(input())
cnt = 0
cnt = s.count("R") * s.count("B") * s.count("G")
print(cnt)
# j - i = k -j を求める。
sub = 0
for i in range(n):
for j in range(i, n):
k = 2 * j - i
if k <= n - 1:
if (s[i] != s[j]) and (s[j] != s[k]) and (s[i] != s[k]):
sub += 1
p... | n = int(input())
s = list(input())
cnt = 0
cnt = s.count("R") * s.count("B") * s.count("G")
# j - i = k -j を求める。
sub = 0
for i in range(n):
for j in range(i, n):
k = 2 * j - i
if k <= n - 1:
if (s[i] != s[j]) and (s[j] != s[k]) and (s[i] != s[k]):
sub += 1
print(cnt-su... | [
"call.remove"
] | 477,517 | 477,518 | u443872523 | python |
p02714 | import sys
input = sys.stdin.readline
n = int(input())
s = str(input())
r = 0
g = 0
for i in range(n):
if s[i] == "R":
r += 1
elif s[i] == "G":
g += 1
c = r*g*(n-r-g)
for j in range(1,n-1):
for i in range(1,min(n-j-1,j)+1):
if (s[j-i] != s[j]) and (s[j] != s[j+i]) and (s[j+i] != s[j-i]):
c -= 1
... | import sys
input = sys.stdin.readline
n = int(input())
s = str(input())
r = 0
g = 0
for i in range(n):
if s[i] == "R":
r += 1
elif s[i] == "G":
g += 1
c = r*g*(n-r-g)
for j in range(1,n-1):
for i in range(1,min(n-j-1,j)+1):
if (s[j-i] != s[j]) and (s[j] != s[j+i]) and (s[j+i] != s[j-i]):
c -= 1
... | [
"call.remove"
] | 477,519 | 477,520 | u673338219 | python |
p02714 | n = int(input())
s = input()
r = []
g = []
b = []
for i in range(len(s)):
t = s[i]
if t == 'R':
r.append(i+1)
elif t == 'G':
g.append(i+1)
else:
b.append(i+1)
ans = len(r) * len(g) * len(b)
for i in range(1, int((n-1)/2)):
for j in range(n-i-i, 0, -1):
if s[j-1] !=... | n = int(input())
s = input()
r = []
g = []
b = []
for i in range(len(s)):
t = s[i]
if t == 'R':
r.append(i+1)
elif t == 'G':
g.append(i+1)
else:
b.append(i+1)
ans = len(r) * len(g) * len(b)
for i in range(1, int((n-1)/2)+1):
for j in range(n-i-i, 0, -1):
if s[j-1] ... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 477,617 | 477,618 | u693945629 | python |
p02714 | N = int(input())
S = input()
nR = 0
nG = 0
nB = 0
cnt = 0
for i in range(N-1):
if S[i] == 'R':
nR += 1
elif S[i] == 'G':
nG += 1
else:
nB += 1
for j in range(i+1, N):
k = j - i + j
if k < N:
L = [S[i], S[j], S[k]]
if 'R' in L and 'G' in L and 'B' in L:
cnt += 1
else:
... | N = int(input())
S = input()
nR = 0
nG = 0
nB = 0
cnt = 0
for i in range(N):
if S[i] == 'R':
nR += 1
elif S[i] == 'G':
nG += 1
else:
nB += 1
for j in range(i+1, N):
k = j - i + j
if k < N:
L = [S[i], S[j], S[k]]
if 'R' in L and 'G' in L and 'B' in L:
cnt += 1
else:
... | [
"expression.operation.binary.remove"
] | 477,697 | 477,698 | u729008627 | python |
p02714 | ースコード
Copy
Copy
N=int(input())
S=list(input())
m=0
a=S.count("R")
b=S.count("G")
c=S.count("B")
num=a*b*c
for i in range(N-2):
for j in range(i+1,N-1):
k=2*j-i #削る条件
if k>N-1:
break
elif S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
m+=1
print(num-m) | N=int(input())
S=list(input())
m=0
a=S.count("R")
b=S.count("G")
c=S.count("B")
num=a*b*c
for i in range(N-2):
for j in range(i+1,N-1):
k=2*j-i #削る条件
if k>N-1:
break
elif S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
m+=1
print(num-m) | [] | 477,706 | 477,707 | u247680229 | python |
p02714 | N = int(input())
S = str(input())
R,G,B = 0,0,0
for i in range(N):
if S[i] == 'R':
R += 1
elif S[i] == 'B':
B += 1
else:
G += 1
exc = 0
for j in range(2,N-1):
num = 1
while 0 <= j-num and j+num < N:
if S[j-num] != S[j+num] and S[j-num] != S[j] and S[j] != S[j+num]:... | N = int(input())
S = str(input())
R,G,B = 0,0,0
for i in range(N):
if S[i] == 'R':
R += 1
elif S[i] == 'B':
B += 1
else:
G += 1
exc = 0
for j in range(1,N-1):
num = 1
while 0 <= j-num and j+num < N:
if S[j-num] != S[j+num] and S[j-num] != S[j] and S[j] != S[j+num]:... | [
"literal.number.integer.change",
"call.arguments.change",
"control_flow.loop.range.bounds.lower.change"
] | 477,740 | 477,741 | u109396127 | python |
p02714 | N = int(input())
S = str(input())
R,G,B = 0,0,0
for i in range(N):
if S[i] == 'R':
R += 1
elif S[i] == 'B':
B += 1
else:
G += 1
exc = 0
for j in range(2,N-1):
num = 1
while 0 <= j-num and j+num < N:
if S[j-num] != S[j+num] and S[j-num] != S[j] and S[j] != S[j+num]:... | N = int(input())
S = str(input())
R,G,B = 0,0,0
for i in range(N):
if S[i] == 'R':
R += 1
elif S[i] == 'B':
B += 1
else:
G += 1
exc = 0
for j in range(1,N-1):
num = 1
while 0 <= j-num and j+num < N:
if S[j-num] != S[j+num] and S[j-num] != S[j] and S[j] != S[j+num]:... | [
"literal.number.integer.change",
"call.arguments.change",
"control_flow.loop.range.bounds.lower.change",
"call.add"
] | 477,742 | 477,741 | u109396127 | python |
p02714 | import sys
from collections import *
import heapq
import math
from math import gcd
import bisect
import copy
from itertools import permutations,accumulate,combinations,product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) f... | import sys
from collections import *
import heapq
import math
from math import gcd
import bisect
import copy
from itertools import permutations,accumulate,combinations,product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) f... | [
"call.arguments.add"
] | 477,796 | 477,797 | u654470292 | python |
p02714 | length = int(input())
text = input()
r_count = text.count("R")
g_count = text.count("G")
b_count = text.count("B")
answer = r_count * g_count * b_count
for i in range(length-2):
for j in range(i+1, length-1):
k = i + (i-j)*2
if k < length and text[i]!=text[j] and text[i]!=text[k] and text[j]!=tex... | length = int(input())
text = input()
r_count = text.count("R")
g_count = text.count("G")
b_count = text.count("B")
answer = r_count * g_count * b_count
for i in range(length-2):
for j in range(i+1, length-1):
k = i + (j-i)*2
if k < length and text[i]!=text[j] and text[i]!=text[k] and text[j]!=tex... | [
"expression.operation.binary.remove"
] | 477,850 | 477,851 | u884323674 | python |
p02714 | import itertools
N = int(input())
S = input()
R = []
G = []
B = []
RGBs = list(itertools.permutations(['R', 'G', 'B'], 3))
for i, s in enumerate(S):
if s == 'R': R.append(i)
if s == 'G': G.append(i)
if s == 'B': B.append(i)
out = len(R) * len(G) * len(B)
for i in range(1, N//3+6):
for j in range(N-i*2):
... | import itertools
N = int(input())
S = input()
R = []
G = []
B = []
RGBs = list(itertools.permutations(['R', 'G', 'B'], 3))
for i, s in enumerate(S):
if s == 'R': R.append(i)
if s == 'G': G.append(i)
if s == 'B': B.append(i)
out = len(R) * len(G) * len(B)
for i in range(1, N):
for j in range(N-i*2):
if (S... | [
"expression.operation.binary.remove"
] | 477,932 | 477,933 | u875541136 | python |
p02714 | n = int(input())
s = list(input())
R=[0]*n
G=[0]*n
B=[0]*n
for i in range(n):
if s[i]=='R':
R[i]=1
elif s[i]=='G':
G[i]=1
elif s[i]=='B':
B[i]=1
ans=0
for i in range(n):
if R[i]==1:
lG=sum(G[:i])
lB=sum(B[:i])
rG=sum(G[i:])
rB=sum(B[i:])
... | n = int(input())
s = list(input())
R=[0]*n
G=[0]*n
B=[0]*n
for i in range(n):
if s[i]=='R':
R[i]=1
elif s[i]=='G':
G[i]=1
elif s[i]=='B':
B[i]=1
ans=0
for i in range(n):
if R[i]==1:
lG=sum(G[:i])
lB=sum(B[:i])
rG=sum(G[i:])
rB=sum(B[i:])
... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 477,974 | 477,975 | u260216890 | python |
p02714 | n = int(input())
s = list(input())
R=[0]*n
G=[0]*n
B=[0]*n
for i in range(n):
if s[i]=='R':
R[i]=1
elif s[i]=='G':
G[i]=1
elif s[i]=='B':
B[i]=1
ans=0
for i in range(n):
if R[i]==1:
lG=sum(G[:i])
lB=sum(B[:i])
rG=sum(G[i:])
rB=sum(B[i:])
... | n = int(input())
s = list(input())
R=[0]*n
G=[0]*n
B=[0]*n
for i in range(n):
if s[i]=='R':
R[i]=1
elif s[i]=='G':
G[i]=1
elif s[i]=='B':
B[i]=1
ans=0
for i in range(n):
if R[i]==1:
lG=sum(G[:i])
lB=sum(B[:i])
rG=sum(G[i:])
rB=sum(B[i:])
... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 477,976 | 477,975 | u260216890 | python |
p02714 | n = int(input())
s = input()
c = [0, 0, 0]
col1 = []
col2 = []
col3 = []
res = 0
for i in range(n):
if s[i] == "R":
col1.append(i)
elif s[i] == "G":
col2.append(i)
else:
col3.append(i)
res = len(col1) * len(col2) * len(col3)
for i in range((n - 2) // 2):
for j in range(n - (i ... | n = int(input())
s = input()
c = [0, 0, 0]
col1 = []
col2 = []
col3 = []
res = 0
for i in range(n):
if s[i] == "R":
col1.append(i)
elif s[i] == "G":
col2.append(i)
else:
col3.append(i)
res = len(col1) * len(col2) * len(col3)
for i in range((n + 1) // 2):
for j in range(n - (i ... | [] | 478,111 | 478,112 | u887860190 | python |
p02714 | from itertools import product as pro
n = int(input())
s = str(input())
r = [i for i in range(n) if s[i] == 'R']
g = [i for i in range(n) if s[i] == 'G']
b = [i for i in range(n) if s[i] == 'B']
cnt = len(r)*len(g)*len(b)
len = max(len(r), len(g), len(b))
if len == len(r):
max1 = set(r)
min1 = g
min2 = b
... | from itertools import product as pro
n = int(input())
s = str(input())
r = [i for i in range(n) if s[i] == 'R']
g = [i for i in range(n) if s[i] == 'G']
b = [i for i in range(n) if s[i] == 'B']
cnt = len(r)*len(g)*len(b)
length = max(len(r), len(g), len(b))
if length == len(r):
max1 = set(r)
min1 = g
min... | [
"assignment.variable.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 478,119 | 478,120 | u222668979 | python |
p02714 | n=int(input())
s=input()
r,g,b=0,0,0
for i in range(n):
if s[i]=="R":
r+=1
elif s[i]=="G":
g+=1
else:
b+=1
chohuku=0
double=0
for i in range(1,n-1):
for j in range(1,min(i+1,n-i)):
chohuku+=1
k=j+i
l=i-j
if s[i]!=s[k] and s[i]!=s[l] and s[l]!=s[k]:... | n=int(input())
s=input()
r,g,b=0,0,0
for i in range(n):
if s[i]=="R":
r+=1
elif s[i]=="G":
g+=1
else:
b+=1
chohuku=0
double=0
for i in range(1,n-1):
for j in range(1,min(i+1,n-i)):
chohuku+=1
k=j+i
l=i-j
if s[i]!=s[k] and s[i]!=s[l] and s[l]!=s[k]:... | [
"call.arguments.change"
] | 478,121 | 478,122 | u268792407 | python |
p02714 | n = int(input())
s = input()
ans = 0
ans_list = []
R_index = []
G_index = []
B_index = []
for i in range(n):
if s[i] == 'R':
R_index.append(i)
elif s[i] == 'G':
G_index.append(i)
elif s[i] == 'B':
B_index.append(i)
ans = len(R_index) * len(G_index) * len(B_index)
for j in range(1... | n = int(input())
s = input()
ans = 0
ans_list = []
R_index = []
G_index = []
B_index = []
for i in range(n):
if s[i] == 'R':
R_index.append(i)
elif s[i] == 'G':
G_index.append(i)
elif s[i] == 'B':
B_index.append(i)
ans = len(R_index) * len(G_index) * len(B_index)
for j in range(1... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 478,144 | 478,145 | u053035261 | python |
p02714 | import math
n = int(input())
s = list(input())
upper = s.count("R")*s.count("G")*s.count("B")
def counting(x):
count = 0
for i in range(math.ceil(x/2)):
if s[x-1]!=s[x-1-i] and s[x-1-i]!=s[x-1-2*i] and s[x-1-2*i]!=s[x-1]:
count += 1
else:
count += 0
return count
if n>=3:
minus = [0]*(n+1... | import math
n = int(input())
s = list(input())
upper = s.count("R")*s.count("G")*s.count("B")
def counting(x):
count = 0
for i in range(1, math.ceil(x/2)):
if s[x-1]!=s[x-1-i] and s[x-1-i]!=s[x-1-2*i] and s[x-1-2*i]!=s[x-1]:
count += 1
else:
count += 0
return count
if n>=3:
minus = [0]*(... | [
"call.arguments.add",
"literal.number.integer.change",
"call.arguments.change",
"control_flow.loop.range.bounds.lower.change"
] | 478,197 | 478,198 | u747391638 | python |
p02714 | n = int(input())
s = input()
r_num = s.count('R')
g_num = s.count('G')
b_num = s.count('B')
tot = r_num*g_num*b_num
print(tot)
for i in range(n):
for j in range(i+1,n):
k = j+(j-i)
if k<n:
if s[i]!=s[j] and s[i]!=s[k] and s[j] != s[k]:
tot -= 1
print(tot)
| n = int(input())
s = input()
r_num = s.count('R')
g_num = s.count('G')
b_num = s.count('B')
tot = r_num*g_num*b_num
for i in range(n):
for j in range(i+1,n):
k = j+(j-i)
if k<n:
if s[i]!=s[j] and s[i]!=s[k] and s[j] != s[k]:
tot -= 1
print(tot)
| [
"call.remove"
] | 478,203 | 478,204 | u843318346 | python |
p02714 | N = int(input())
S = list(input())
ans = S.count('R')*S.count('G')*S.count('B')
for i in range(N):
if S[i]=='R':
S[i]=1
elif S[i]=='G':
S[i]
elif S[i]=='B':
S[i]=4
for i in range(N):
for j in range(i+1,N):
k=2*j-i
if k>=N :
continue
if S[i]+S[j]+S[k]==7 :
... | N = int(input())
S = list(input())
ans = S.count('R')*S.count('G')*S.count('B')
for i in range(N):
if S[i]=='R':
S[i] =1
elif S[i]=='G':
S[i] =2
elif S[i]=='B':
S[i] =4
for i in range(N):
for j in range(i+1,N):
k=2*j-i
if k>=N :
continue
if S[i]+S[j]+S[k]==7 ... | [
"assignment.add"
] | 478,234 | 478,235 | u744695362 | python |
p02714 | N = int(input())
S = list(input())
ans = S.count('R')*S.count('G')*S.count('B')
for i in range(N):
if S[i]=='R':
S[i]=1
elif S[i]=='G':
S[i]
elif S[i]=='B':
S[i]=4
for i in range(N):
for j in range(i+1,N):
k=2*j-i
if k>N :
continue
if S[i]+S[j]+S[k]==7 :
... | N = int(input())
S = list(input())
ans = S.count('R')*S.count('G')*S.count('B')
for i in range(N):
if S[i]=='R':
S[i] =1
elif S[i]=='G':
S[i] =2
elif S[i]=='B':
S[i] =4
for i in range(N):
for j in range(i+1,N):
k=2*j-i
if k>=N :
continue
if S[i]+S[j]+S[k]==7 ... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 478,236 | 478,235 | u744695362 | python |
p02714 | N = int(input())
S = list(input())
ans = S.count('R')*S.count('G')*S.count('B')
#1番目の条件を満たすものの総数は(Rの個数)*(Gの個数)*(Bの個数)
for i in range(N): #判定を簡単にするためR:=1,G:=2,B:=4と置き換える
if S[i]=='R':
S[i]=1
elif S[i]=='G':
S[i]
elif S[i]=='B':
S[i]=4
for i in range(N):
#すべての(i,j)について(i,j,2*j-i)が1番目の条件を... | N = int(input())
S = list(input())
ans = S.count('R')*S.count('G')*S.count('B')
for i in range(N):
if S[i]=='R':
S[i] =1
elif S[i]=='G':
S[i] =2
elif S[i]=='B':
S[i] =4
for i in range(N):
for j in range(i+1,N):
k=2*j-i
if k>=N :
continue
if S[i]+S[j]+S[k]==7 ... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 478,237 | 478,235 | u744695362 | python |
p02714 | N=input()
S=input()
Sn=[]
R=0
G=0
B=0
for i in range(len(S)):
if S[i]=='R':
R+=1
Sn.append(1)
elif S[i]=='G':
G+=1
Sn.append(2)
else:
B+=1
Sn.append(3)
count=0
for start in range(len(S)):
for diff in range(1,int((len(S)-start+1)/2)):
print... | N=input()
S=input()
Sn=[]
R=0
G=0
B=0
for i in range(len(S)):
if S[i]=='R':
R+=1
Sn.append(1)
elif S[i]=='G':
G+=1
Sn.append(2)
else:
B+=1
Sn.append(3)
count=0
for start in range(len(S)):
for diff in range(1,int((len(S)-start+1)/2)):
#int(... | [
"call.remove"
] | 478,311 | 478,312 | u875049118 | python |
p02714 | N=input()
S=input()
Sn=[]
R=0
G=0
B=0
for i in range(len(S)):
if S[i]=='R':
R+=1
Sn.append(1)
elif S[i]=='G':
G+=1
Sn.append(2)
else:
B+=1
Sn.append(3)
count=0
for start in range(len(S)):
for diff in range(1,int((len(S)-start+1)/2)):
print... | N=input()
S=input()
Sn=[]
R=0
G=0
B=0
for i in range(len(S)):
if S[i]=='R':
R+=1
Sn.append(1)
elif S[i]=='G':
G+=1
Sn.append(2)
else:
B+=1
Sn.append(3)
count=0
for start in range(len(S)):
for diff in range(1,int((len(S)-start+1)/2)):
#int(... | [
"call.remove"
] | 478,311 | 478,313 | u875049118 | python |
p02714 | N = int(input())
S = list(input())
r , g, b = S.count("R"), S.count("G"), S.count("B")
ans = r * g * b
for i in range(N-2):
for j in range(i+1, N-1):
k = 2*(j+1) - (i+1)
if k >= N: break
if S[i] != S[j] and S[j] != S[k-1] and S[k-1] != S[i]:
ans -= 1
print(ans) | N = int(input())
S = input()
r , g, b = S.count("R"), S.count("G"), S.count("B")
ans = r * g * b
for i in range(N-2):
for j in range(i+1, N-1):
k = 2*(j+1) - (i+1) # j > iより k = 2j - i > j
if k <= N:
if S[i] != S[j] and S[j] != S[k-1] and S[k-1] != S[i]:
ans -= 1
print(... | [
"call.remove",
"call.arguments.change",
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"control_flow.break.remove"
] | 478,350 | 478,348 | u250734103 | python |
p02714 | """
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, p... | """
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, p... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 478,356 | 478,357 | u840579553 | python |
p02714 | """
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, p... | """
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, p... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change"
] | 478,358 | 478,357 | u840579553 | python |
p02714 | """
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, p... | """
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, p... | [
"control_flow.loop.for.condition.change",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 478,359 | 478,357 | u840579553 | python |
p02714 | n = int(input())
s = input()
ans = s.count('B') * s.coufnt('G') * s.count('R')
for i in range(n):
for j in range(i, n-1):
k = 2*j - i
if k >= n:
continue
if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
ans -= 1
print(ans)
| n = int(input())
s = input()
ans = s.count('R') * s.count('G') * s.count('B')
for i in range(n):
for j in range(i, n-1):
k = 2*j - i
if k >= n:
continue
if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
ans -= 1
print(ans)
| [
"literal.string.change",
"assignment.value.change",
"call.arguments.change",
"expression.operation.binary.change",
"identifier.change"
] | 478,375 | 478,376 | u209418188 | python |
p02714 | n = int(input())
s = input()
ans = s.count('B') + s.count('G') + s.count('R')
for i in range(n):
for j in range(i, n-1):
k = 2*j - i
if k >= n:
continue
if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
ans -= 1
print(ans) | n = int(input())
s = input()
ans = s.count('R') * s.count('G') * s.count('B')
for i in range(n):
for j in range(i, n-1):
k = 2*j - i
if k >= n:
continue
if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
ans -= 1
print(ans)
| [
"expression.operation.binary.remove"
] | 478,377 | 478,376 | u209418188 | python |
p02714 | import itertools
N = int(input())
S = input()
#Rc1,Gc1,Bc1
out = S.count('R') * S.count('G') * S.count('B')
print(out)
RGBs = list(itertools.permutations(['R', 'G', 'B'], 3))
for i in range(1, N):
for j in range(N-i*2):
#三つ連続であり、RGBで構成されている
if (S[j], S[j+i], S[j+i*2]) in RGBs:
out -= 1
print(out) | import itertools
N = int(input())
S = input()
#Rc1,Gc1,Bc1
out = S.count('R') * S.count('G') * S.count('B')
RGBs = list(itertools.permutations(['R', 'G', 'B'], 3))
for i in range(1, N):
for j in range(N-i*2):
#三つ連続であり、RGBで構成されている
if (S[j], S[j+i], S[j+i*2]) in RGBs:
out -= 1
print(out) | [
"call.remove"
] | 478,380 | 478,381 | u644126199 | python |
p02714 | N = int(input())
S = input()
Sr = Sg = Sb = 0
for c in S:
if c == 'R':
Sr += 1
elif c == 'G':
Sg += 1
else:
Sb += 1
A = Sr * Sg * Sb
for sep in range(1,(N-1)//2):
for i in range(N-2*sep):
if S[i] != S[i+sep] and S[i+sep] != S[i+2*sep] and S[i] != S[i+2*sep]:
A... | N = int(input())
S = input()
Sr = Sg = Sb = 0
for c in S:
if c == 'R':
Sr += 1
elif c == 'G':
Sg += 1
else:
Sb += 1
A = Sr * Sg * Sb
for sep in range(1,(N+1)//2):
for i in range(N-2*sep):
if S[i] != S[i+sep] and S[i+sep] != S[i+2*sep] and S[i] != S[i+2*sep]:
A... | [
"misc.opposites",
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"control_flow.loop.range.bounds.upper.change"
] | 478,388 | 478,389 | u036514535 | python |
p02714 | n=int(input())
s=list(input())
ans=s.count('R')*s.count('G')*s.count('B')
for i in range(n):
if s[i]=='R':
s[i]=1
elif s[i]=='G':
s[i]
elif s[i]=='B':
s[i]=4
for i in range(n):
for j in range(i+1,n):
k=2*j-i
if k>=n:
continue
if s[i]+s[j]+s[k]==7:
ans-=1
p... | n=int(input())
s=list(input())
ans=s.count('R')*s.count('G')*s.count('B')
for i in range(n):
if s[i]=='R':
s[i]=1
elif s[i]=='G':
s[i]=2
elif s[i]=='B':
s[i]=4
for i in range(n):
for j in range(i+1,n):
k=2*j-i
if k>=n:
continue
if s[i]+s[j]+s[k]==7:
ans-=1
print(an... | [
"assignment.add"
] | 478,415 | 478,414 | u004482945 | python |
p02714 | S = list(input())
S_len = len(S)
ans = 0
i = 0
for _ in range(S_len):
if S[0] == 'R':
ans += S[1:].count('B') * S[1:].count('G')
for j in range(int(len(S)/2+1)):
try:
if S[j+1] != S[j*2+2] and S[j*2+2] !='R' and S[j+1] !='R':
ans-=1
except:
pass
if S[0] == 'B':
ans ... | S = input()
S = list(input())
S_len = len(S)
ans = 0
i = 0
for _ in range(S_len):
if S[0] == 'R':
ans += S[1:].count('B') * S[1:].count('G')
for j in range(int(len(S)/2+1)):
try:
if S[j+1] != S[j*2+2] and S[j*2+2] !='R' and S[j+1] !='R':
ans-=1
except:
pass
if S[0] == '... | [
"assignment.add"
] | 478,596 | 478,597 | u614628638 | python |
p02714 | n = int(input())
s = input()
def im(l, x):
return [i for i, _x in enumerate(l) if _x == x]
R = im(s, "R")
G = im(s, "G")
B = im(s, "B")
ext = 0
if n >= 3:
for i in range((n-3)//2):
for j in range(n-(3+2*i)+1):
if s[j] != s[j+i+1] and s[j] != s[j+2*(i+1)] and s[j+i+1] != s[j+2*(i+1)]:
... | n = int(input())
s = input()
def im(l, x):
return [i for i, _x in enumerate(l) if _x == x]
R = im(s, "R")
G = im(s, "G")
B = im(s, "B")
ext = 0
if n >= 3:
for i in range((n-3)//2+1):
for j in range(n-(3+2*i)+1):
if s[j] != s[j+i+1] and s[j] != s[j+2*(i+1)] and s[j+i+1] != s[j+2*(i+1)]:
... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 478,641 | 478,642 | u274841648 | python |
p02714 | n = int(input())
s = str(input())
R, G, B = [], [], []
for i, c in enumerate(s):
if c == 'R': R.append(i)
elif c == 'G': G.append(i)
else: B.append(i)
ans = 0
for r in R:
for g in G:
if r < g: x, y = r, g
else: x, y = g, r
ans += len(X3)
if x*2 - y >= 0:
if s[x*2 - y] == 'B': ans -= 1
... | n = int(input())
s = str(input())
R, G, B = [], [], []
for i, c in enumerate(s):
if c == 'R': R.append(i)
elif c == 'G': G.append(i)
else: B.append(i)
ans = 0
for r in R:
for g in G:
if r < g: x, y = r, g
else: x, y = g, r
ans += len(B)
if x*2 - y >= 0:
if s[x*2 - y] == 'B': ans -= 1
... | [
"identifier.change",
"call.arguments.change"
] | 478,666 | 478,671 | u426764965 | python |
p02714 | n = int(input().strip())
s = '_' + input().strip()
s += ''.join(['_'] * 10 ** 5)
r = []
g = []
b = []
for i in range(1, n + 1):
if s[i] == 'R':
r.append(i)
elif s[i] == 'G':
g.append(i)
elif s[i] == 'B':
b.append(i)
le = len(b)
ans = len(r) * len(g) * le
for x in r:
for y in g:
... | n = int(input().strip())
s = '_' + input().strip()
s += ''.join(['_'] * 10 ** 5)
r = []
g = []
b = []
for i in range(1, n + 1):
if s[i] == 'R':
r.append(i)
elif s[i] == 'G':
g.append(i)
elif s[i] == 'B':
b.append(i)
le = len(b)
ans = len(r) * len(g) * le
for x in r:
for y in g:
... | [
"control_flow.branch.if.condition.change"
] | 478,707 | 478,708 | u523130469 | python |
p02714 | n = int(input())
s = input()
rc = s.count('R')
gc = s.count('G')
bc = s.count('B')
ans = rc*gc*bc
for i in range(n):
if s[i] == 'R':
for j in range(1,min(n-i-1, i-1)+1):
if s[i-j] != s[i+j] and s[i-j] != 'R' and s[i+j] != 'R':
ans -= 1
for j in range(1,int((n-i-1)/2)+1... | n = int(input())
s = input()
rc = s.count('R')
gc = s.count('G')
bc = s.count('B')
ans = rc*gc*bc
for i in range(n):
if s[i] == 'R':
for j in range(1,min(n-i-1, i)+1):
if s[i-j] != s[i+j] and s[i-j] != 'R' and s[i+j] != 'R':
ans -= 1
for j in range(1,int((n-i-1)/2)+1):... | [
"expression.operation.binary.remove",
"call.arguments.change"
] | 478,720 | 478,722 | u134520518 | python |
p02714 | n = int(input())
s = input()
r = s.count("R");g = s.count("G");b = s.count("B")
count = r*g*b
print(count)
for j in range(n):
for i in range(j):
if (k:=2*j-i)<n:
if s[i]!=s[k]!=s[j]!=s[i]:
count-=1
print(count) | n = int(input())
s = input()
r = s.count("R");g = s.count("G");b = s.count("B")
count = r*g*b
for j in range(n):
for i in range(j):
if (k:=2*j-i)<n:
if s[i]!=s[k]!=s[j]!=s[i]:
count-=1
print(count)
| [
"call.remove"
] | 478,447 | 478,448 | u088115428 | python |
p02714 | N = int(input())
S = input()
rList = []
gList = []
bList = []
for indx in range(N):
if S[indx] == 'R':
rList.append(indx)
elif S[indx] == 'G':
gList.append(indx)
elif S[indx] == 'B':
bList.append(indx)
NoSum = 0
fList = rList
sList = gList
remain = 'B'
for fItem in fList:
for... | N = int(input())
S = input()
rList = []
gList = []
bList = []
for indx in range(N):
if S[indx] == 'R':
rList.append(indx)
elif S[indx] == 'G':
gList.append(indx)
elif S[indx] == 'B':
bList.append(indx)
NoSum = 0
fList = rList
sList = gList
remain = 'B'
for fItem in fList:
for... | [] | 478,451 | 478,452 | u161712560 | python |
p02714 | a=int(input())
b=str(input())
sum=0
riron_sum=b.count('R')*b.count('G')*b.count('B')
print(riron_sum)
for i in range(0,a):
for n in range(0,a+1):
j = i+n
k = j+n
#print(j)
#print(k)
if k>=a:
break
if b[i]!=b[j] and b[j]!=b[k] and b[k]!=b[i]:
... | a=int(input())
b=str(input())
sum=0
riron_sum=b.count('R')*b.count('G')*b.count('B')
for i in range(0,a):
for n in range(0,a+1):
j = i+n
k = j+n
#print(j)
#print(k)
if k>=a:
break
if b[i]!=b[j] and b[j]!=b[k] and b[k]!=b[i]:
riron_sum-=1
p... | [
"call.remove"
] | 478,539 | 478,540 | u108898293 | python |
p02714 | n = int(input())
s = input()
r = s.count('R')
g = s.count('G')
b = s.count('B')
ans = r*g*b
for i in range(n-3):
for j in range(i+1,n-1):
k = 2*j-i
if k < n:
if s[i] != s[j] and s[j]!= s[k] and s[i] != s[k]:
ans -= 1
print(ans) | n = int(input())
s = input()
r = s.count('R')
g = s.count('G')
b = s.count('B')
ans = r*g*b
for i in range(n):
for j in range(i+1,n):
k = 2*j-i
if k < n:
if s[i] != s[j] and s[j]!= s[k] and s[i] != s[k]:
ans -= 1
print(ans) | [
"expression.operation.binary.remove"
] | 478,549 | 478,550 | u366369712 | python |
p02714 | N = int(input())
S = input()
RN = S.count('R')
GN = S.sount('G')
BN = S.count('B')
ans = RN * GN * BN
for i in range(N):
for d in range(N):
j = i + d
k = i + 2 * d
if k >= N:
break
if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
ans -= 1
print(ans) | N = int(input())
S = input()
RN = S.count('R')
GN = S.count('G')
BN = S.count('B')
ans = RN * GN * BN
for i in range(N):
for d in range(N):
j = i + d
k = i + 2 * d
if k >= N:
break
if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
ans -= 1
print(ans) | [
"assignment.value.change",
"identifier.change"
] | 478,556 | 478,557 | u515674295 | python |
p02714 | N = int(input())
s = input()
R = s.count('R')
G = s.count('G')
B = s.count('B')
count = R*G*B
print(count)
cnt = 0
for i in range(len(s)):
for d in range(N):
j = i + d
k = j + d
if k >= N:
break
if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
count -= 1
pr... | N = int(input())
s = input()
R = s.count('R')
G = s.count('G')
B = s.count('B')
count = R*G*B
cnt = 0
for i in range(len(s)):
for d in range(N):
j = i + d
k = j + d
if k >= N:
break
if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
count -= 1
print(count) | [
"call.remove"
] | 478,564 | 478,565 | u815304751 | python |
p02714 | import collections
N=int(input())
S=input()
lis=list(S)
C= collections.Counter(lis)
count=list(C.values())
c=0
for i in range(N):
print(i)
for j in range(i,(N+i-1) // 2+1):
if(lis[i]!=lis[j]):
if(lis[j]!=lis[2*j-i]):
if(lis[i]!=lis[2*j-i]):
c+=1
if(len(cou... | import collections
N=int(input())
S=input()
lis=list(S)
C= collections.Counter(lis)
count=list(C.values())
c=0
for i in range(N):
for j in range(i,(N+i-1) // 2+1):
if(lis[i]!=lis[j]):
if(lis[j]!=lis[2*j-i]):
if(lis[i]!=lis[2*j-i]):
c+=1
if(len(count)==3):
... | [
"call.remove"
] | 478,572 | 478,573 | u851125702 | python |
p02714 | # -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
def main():
n = int(input())
s = input()
ans = s.count('R') * s.count('G') * s.count('B')
# print(ans)
for i in range(n - 2):
for j in range(i + 1, n - 1):
k = (j - i) + j
if k > n:
# pri... | # -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
def main():
n = int(input())
s = input()
ans = s.count('R') * s.count('G') * s.count('B')
# print(ans)
for i in range(n - 2):
for j in range(i + 1, n - 1):
k = (j - i) + j
if k >= n:
# pr... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 478,588 | 478,590 | u151037808 | python |
p02714 | n=int(input())
s=input()
r = s.count('R')
g = s.count('G')
b = s.count('B')
ans = r * g * b
for i in range(0,n-2):
for j in range(1,int(n/2)):
if i + j + j <= n-1:
if s[i] != s[i+j] and s[i] != s[i+j+j] and s[i+j] != s[i+j+j] :
ans = ans - 1
print(ans) | n=int(input())
s=input()
r = s.count('R')
g = s.count('G')
b = s.count('B')
ans = r * g * b
for i in range(0,n-2):
for j in range(1,int((n-i)/2)+1):
if i + j + j <= n-1:
if s[i] != s[i+j] and s[i] != s[i+j+j] and s[i+j] != s[i+j+j] :
ans = ans - 1
print(ans) | [
"call.arguments.change",
"control_flow.loop.range.bounds.upper.change"
] | 478,610 | 478,608 | u630554891 | python |
p02714 | from collections import Counter
N = int(input())
S = list(input())
c = Counter(S)
ans = c["R"] * c["G"] * c["B"]
if ans == 0:
print(0)
exit()
for n_skip in range(1, N//3 + 10):
for i in range(N):
try:
if set(["R", "G", "B"]) == set([S[i], S[i+n_skip], S[i + 2*n_skip]]):
... | from collections import Counter
N = int(input())
S = list(input())
c = Counter(S)
ans = c["R"] * c["G"] * c["B"]
if ans == 0:
print(0)
exit()
for n_skip in range(1, N):
for i in range(N):
try:
if set(["R", "G", "B"]) == set([S[i], S[i+n_skip], S[i + 2*n_skip]]):
ans -... | [
"expression.operation.binary.remove"
] | 478,725 | 478,726 | u886747123 | python |
p02714 | # from math import factorial,sqrt,ceil
from itertools import permutations as permus
# from fractions import gcd
from collections import deque,Counter
import re
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)
# import numpy as np
# from scipy.sparse.csgraph import ... | # from math import factorial,sqrt,ceil
from itertools import permutations as permus
# from fractions import gcd
from collections import deque,Counter
import re
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)
# import numpy as np
# from scipy.sparse.csgraph import ... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 478,749 | 478,750 | u114641312 | python |
p02714 | n=int(input())
s=input()
r=[0]*n
b=[0]*n
g=[0]*n
cb=0
cg=0
cr=0
for i in range(n-1,-1,-1):
if s[i]=='R':
cr+=1
elif s[i]=='G':
cg+=1
else:
cb+=1
r[i]=cr
g[i]=cg
b[i]=cb
fr=[0]*n
fb=[0]*n
fg=[0]*n
cb=0
cg=0
cr=0
for i in range(n):
if s[i]=='R':
cr+=1
elif s[i]=='G':
cg+=1
else:
... | n=int(input())
s=input()
r=[0]*n
b=[0]*n
g=[0]*n
cb=0
cg=0
cr=0
for i in range(n-1,-1,-1):
if s[i]=='R':
cr+=1
elif s[i]=='G':
cg+=1
else:
cb+=1
r[i]=cr
g[i]=cg
b[i]=cb
fr=[0]*n
fb=[0]*n
fg=[0]*n
cb=0
cg=0
cr=0
for i in range(n):
if s[i]=='R':
cr+=1
elif s[i]=='G':
cg+=1
else:
... | [
"identifier.change",
"expression.operation.binary.change"
] | 478,757 | 478,758 | u482883507 | python |
p02714 | import math
def solve():
N = int(input())
S = input()
R = []
G = []
B = []
# color separate
for i in range(len(S)):
if S[i] == 'R':
R.append(i)
elif S[i] == 'G':
G.append(i)
elif S[i] == 'B':
B.append(i)
# after color map
... | import math
def solve():
N = int(input())
S = input()
R = []
G = []
B = []
# color separate
for i in range(len(S)):
if S[i] == 'R':
R.append(i)
elif S[i] == 'G':
G.append(i)
elif S[i] == 'B':
B.append(i)
# after color map
... | [
"literal.number.integer.change",
"assignment.value.change"
] | 478,817 | 478,818 | u945228737 | python |
p02714 | n = int(input())
s = input()
count = 0
r=0
g=0
b=0
for i in range(0,n):
if s[i] == 'R':
r = r + 1
if s[i]=='G':
g = g+1
if s[i]=='B':
b = b+1
for i in range(0,n-3):
ii = s[i]
for j in range(i+1, n-1):
jj = s[j]
if ii==jj:
continue
if (2*j-i)<=(n-1):
if ii!=s[2*j-i] an... | n = int(input())
s = input()
count = 0
r=0
g=0
b=0
for i in range(0,n):
if s[i] == 'R':
r = r + 1
if s[i]=='G':
g = g+1
if s[i]=='B':
b = b+1
for i in range(0,n):
ii = s[i]
for j in range(i+1, n):
jj = s[j]
if ii==jj:
continue
if (2*j-i)<=(n-1):
if ii!=s[2*j-i] and jj... | [
"expression.operation.binary.remove"
] | 478,823 | 478,824 | u277641173 | python |
p02714 | ans=0
n=int(input())
k=str(input())
r=k.count("R")
b=k.count("B")
g=k.count("G")
ans+=r*b*g
for i in range(n-2):
ii=k[i]
for j in range(i+1,(n-i)//2):
jj=k[j]
l=j+(j-i)
#print(l)
if jj!=ii and l<n:
#print(i,j)
ll=k[l]
if ii!=ll and jj!=ll:
ans-=1
#print(i,j,l... | ans=0
n=int(input())
k=str(input())
r=k.count("R")
b=k.count("B")
g=k.count("G")
ans+=r*b*g
for i in range(n-2):
ii=k[i]
for j in range(i+1,(n-i)//2+1+i):
jj=k[j]
l=j+(j-i)
#print(l)
if jj!=ii and l<n:
#print(i,j)
ll=k[l]
if ii!=ll and jj!=ll:
ans-=1
#print(i... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 478,832 | 478,833 | u864273141 | python |
p02714 | N = int(input())
S = input()
R = []
G = []
B = []
for i in range(N):
if S[i] == "R":
R.append(i+1)
elif S[i] == "G":
G.append(i+1)
elif S[i] == "B":
B.append(i+1)
ok = len(R) * len(G) * len(B)
for i in range(N):
for j in range(N//2):
if i - j < 0 or i + j >= N:
break
else:
if S... | N = int(input())
S = input()
R = []
G = []
B = []
for i in range(N):
if S[i] == "R":
R.append(i+1)
elif S[i] == "G":
G.append(i+1)
elif S[i] == "B":
B.append(i+1)
ok = len(R) * len(G) * len(B)
for i in range(1,N):
for j in range(N//2+1):
if i - j < 0 or i + j >= N:
break
else:
... | [
"call.arguments.add"
] | 478,834 | 478,835 | u408262366 | python |
p02714 | import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
"""
i-j-k間が等しくなる組み合わせを求めてから、
Rの数*G*B - それ
で求まる?
"""
n = int(readline())
s = readline().rstrip().decode('utf-8')
if n == 3:
print(0)
exit()
dic1 = dict()
for i in s:
if i in dic1:
dic1[i] += 1
else:
di... | import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
"""
i-j-k間が等しくなる組み合わせを求めてから、
Rの数*G*B - それ
で求まる?
"""
n = int(readline())
s = readline().rstrip().decode('utf-8')
if n == 3:
print(0)
exit()
dic1 = dict()
for i in s:
if i in dic1:
dic1[i] += 1
else:
di... | [
"call.remove"
] | 478,928 | 478,929 | u372144784 | python |
p02714 | import collections
import sys
n=int(input())
if n<=2:
print(0)
sys.exit()
s=input()
S=list(s)
t=collections.Counter(S)
R=t['R']
G=t['G']
B=t['B']
num=R*G*B
cnt=0
for i in range(1,n//2):
for j in range(n):
if j+(2*i)>n-1:
continue
if s[j]=='R':
if s[j+i]=='G':
if s[j+(2*i)]=='B':
... | import collections
import sys
n=int(input())
if n<=2:
print(0)
sys.exit()
s=input()
S=list(s)
t=collections.Counter(S)
R=t['R']
G=t['G']
B=t['B']
num=R*G*B
cnt=0
for i in range(1,(n//2)+1):
for j in range(n):
if j+(2*i)>n-1:
continue
if s[j]=='R':
if s[j+i]=='G':
if s[j+(2*i)]=='B':
... | [
"call.arguments.change",
"control_flow.loop.range.bounds.upper.change",
"call.arguments.add"
] | 478,932 | 478,933 | u527261492 | python |
p02714 | N = int(input())
R = []
G = []
B = []
s =input()
ans = 0
for i in range(N):
if s[i] == "R":
R.append(i)
elif s[i] == "G":
G.append(i)
else:
B.append(i)
sB = set(B)
print(sB)
ans = len(R) * len(G) * len(B)
for r in R:
for g in G:
i = min(r,g)
j = max(r,g)
s... | N = int(input())
R = []
G = []
B = []
s =input()
ans = 0
for i in range(N):
if s[i] == "R":
R.append(i)
elif s[i] == "G":
G.append(i)
else:
B.append(i)
sB = set(B)
ans = len(R) * len(G) * len(B)
for r in R:
for g in G:
i = min(r,g)
j = max(r,g)
sa = j - i
... | [
"call.remove"
] | 478,952 | 478,953 | u017050982 | python |
p02714 | N = int(input())
S = input()
memo = {key:[] for key in ("R","G","B")}
ans = 0
for i in range(N):
memo[S[i]].append(i)
for space in range(1,N//2):
j = space + i
k = space + j
if(k<N):
if(S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]):
ans -= 1
ans += len(memo["R"])... | N = int(input())
S = input()
memo = {key:[] for key in ("R","G","B")}
ans = 0
for i in range(N):
memo[S[i]].append(i)
for space in range(1,N+1):
j = space + i
k = space + j
if(k<N):
if(S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]):
ans -= 1
ans += len(memo["R"])*... | [] | 479,044 | 479,045 | u323125813 | python |
p02714 | N=int(input())
S=input()
LEN=len(S)
END='EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE'
S += END
R=S.count('R')
G=S.count('G')
B=S.count('B')
cnt=0
for j in range(1, int((LEN-1)/2)):
for i in range(LEN):
if S[i+j+j]=='E':
break
if (S[i] != S[i+j]) and (S[i+j] != S[i+j+j]) and (S[i] != S[i+j+j]):
... | N=int(input())
S=input()
LEN=len(S)
END='EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE'
S += END
R=S.count('R')
G=S.count('G')
B=S.count('B')
cnt=0
for j in range(1, int((LEN-1)/2)+1):
for i in range(LEN-j*2):
if S[i+j+j]=='E':
break
if (S[i] != S[i+j]) and (S[i+j] != S[i+j+j]) and (S[i] != S[i+j+j... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 479,050 | 479,051 | u401341173 | python |
p02714 | n= int(input())
ss=input()
rs = set()
gs = set()
bs = set()
for i, s in enumerate(ss):
if s == "R":
rs.add(i)
elif s == "G":
gs.add(i)
else:
bs.add(i)
ans = 0
if len(gs) > len(bs) and len(gs) > len(rs):
tmp = gs
gs = bs
bs = tmp
elif len(rs) > len(bs) and len(rs) > len(g... | n= int(input())
ss=input()
rs = set()
gs = set()
bs = set()
for i, s in enumerate(ss):
if s == "R":
rs.add(i)
elif s == "G":
gs.add(i)
else:
bs.add(i)
ans = 0
if len(gs) > len(bs) and len(gs) > len(rs):
tmp = gs
gs = bs
bs = tmp
elif len(rs) > len(bs) and len(rs) > len(... | [
"assignment.value.change",
"identifier.change"
] | 479,103 | 479,104 | u810625173 | python |
p02714 | n = int(input())
s = input()
R = set()
G = set()
B = set()
for i in range(s):
if s[i] == 'R':
R.add(i)
elif s[i] == 'B':
B.add(i)
else:
G.add(i)
ans = 0
for r in R:
for g in G:
ans += len(B)
if 2*r - g in B:
ans -= 1
if 2*g - r in B:
... | n = int(input())
s = input()
R = set()
G = set()
B = set()
for i in range(n):
if s[i] == 'R':
R.add(i)
elif s[i] == 'B':
B.add(i)
else:
G.add(i)
ans = 0
for r in R:
for g in G:
ans += len(B)
if 2*r - g in B:
ans -= 1
if 2*g - r in B:
... | [
"identifier.change",
"call.arguments.change",
"control_flow.loop.range.bounds.upper.change"
] | 479,179 | 479,180 | u145600939 | python |
p02714 | n = int(input())
s = input()
ans = s.count("R")*s.count("G")*s.count("B")
for i in range(1,n//2):
j = 0
while j+2*i <= n-1:
if s[j] != s[j+i] and s[j] != s[j+2*i] and s[j+i] != s[j+2*i]:
ans -= 1
j += 1
print(ans) | n = int(input())
s = input()
ans = s.count("R")*s.count("G")*s.count("B")
for i in range(1,n//2+10):
j = 0
while j+2*i <= n-1:
if s[j] != s[j+i] and s[j] != s[j+2*i] and s[j+i] != s[j+2*i]:
ans -= 1
j += 1
print(ans)
| [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 479,209 | 479,210 | u720636500 | python |
p02714 | N = int(input())
S = input()
D = {"R": [], "G": [], "B": []}
for i in range(N):
D[S[i]].append(i)
print(D)
p = 1
for i in D:
p *= len(D[i])
cnt = 0
for i in range(N):
for j in range(i+1, N):
if 2 * j - i < N:
if S[i] != S[j] and S[j] != S[2*j-i] and S[2*j-i] != S[i]:
cnt += 1
print(p-cnt) | N = int(input())
S = input()
D = {"R": [], "G": [], "B": []}
for i in range(N):
D[S[i]].append(i)
p = 1
for i in D:
p *= len(D[i])
cnt = 0
for i in range(N):
for j in range(i+1, N):
if 2 * j - i < N:
if S[i] != S[j] and S[j] != S[2*j-i] and S[2*j-i] != S[i]:
cnt += 1
print(p-cnt)
| [
"call.remove"
] | 479,224 | 479,225 | u984276646 | python |
p02714 | from collections import Counter
def main(N=None, S=None):
if not N or not S:
N = int(input())
S = input()
c = Counter(S)
ans = c["R"]*c["G"]*c["B"]
for hop in range(1, N//2):
for start in range(N):
i = start
j = start + hop
k = start + hop*2
... | from collections import Counter
def main(N=None, S=None):
if not N or not S:
N = int(input())
S = input()
c = Counter(S)
ans = c["R"]*c["G"]*c["B"]
for hop in range(1, N):
for start in range(N):
i = start
j = start + hop
k = start + hop*2
... | [
"expression.operation.binary.remove"
] | 479,256 | 479,257 | u479719434 | python |
p02714 | from collections import Counter
def main(N=None, S=None):
if not N or not S:
N = int(input())
S = int(input())
c = Counter(S)
ans = c["R"]*c["G"]*c["B"]
for hop in range(1, N//2):
for start in range(N):
i = start
j = start + hop
k = start + h... | from collections import Counter
def main(N=None, S=None):
if not N or not S:
N = int(input())
S = input()
c = Counter(S)
ans = c["R"]*c["G"]*c["B"]
for hop in range(1, N):
for start in range(N):
i = start
j = start + hop
k = start + hop*2
... | [
"call.remove",
"call.arguments.change",
"expression.operation.binary.remove"
] | 479,258 | 479,257 | u479719434 | python |
p02715 | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10 ** 9 + 7
N, K = map(int, readline().split())
d = [0] * (K+1)
for i in range(K,0,-1):
t = K // i
cnt = pow(t,N,MOD)
for j in range(2,t+1):
cnt -= d[i*j]... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10 ** 9 + 7
N, K = map(int, readline().split())
d = [0] * (K+1)
for i in range(K,0,-1):
t = K // i
cnt = pow(t,N,MOD)
for j in range(2,t+1):
cnt -= d[i*j]... | [
"identifier.change"
] | 479,277 | 479,278 | u515740713 | python |
p02715 | # -*- coding: utf-8 -*-
#############
# Libraries #
#############
import sys
input = sys.stdin.readline
import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache
#############
# Constants #
#############
MOD = 10**9+7
INF = fl... | # -*- coding: utf-8 -*-
#############
# Libraries #
#############
import sys
input = sys.stdin.readline
import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache
#############
# Constants #
#############
MOD = 10**9+7
INF = fl... | [
"assignment.change"
] | 479,298 | 479,299 | u493130708 | python |
p02715 | MOD = 10**9+7
n,k = map(int,input().split())
L = [0]*(k+1)
for i in range(k,0,-1):
L[i] = pow(k//i,n,mod)
for j in range(2,k//i+1):
L[i] -= L[i*j]
ans = 0
for i in range(1,k+1):
ans = (ans + i*L[i]) % MOD
print(ans) | MOD = 10**9+7
n,k = map(int,input().split())
L = [0]*(k+1)
for i in range(k,0,-1):
L[i] = pow(k//i,n,MOD)
for j in range(2,k//i+1):
L[i] -= L[i*j]
ans = 0
for i in range(1,k+1):
ans = (ans + i*L[i]) % MOD
print(ans) | [
"assignment.value.change",
"identifier.change",
"call.arguments.change"
] | 479,310 | 479,311 | u898967808 | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.