Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import sys
input = sys.stdin.readline


x = int(input().strip())
abs_x = abs(x)

def X(a, b):
    return a**5 - b**5

def X_plus(a, b):
    return a**5 + b**5

a = 2
b = 1

while True:
    #print(a, b)
    if X(a, b) == abs_x:
        if x < 0:
            a = -a
            b = -b
        print(a,b)
        exit()

    if (a-b) > 1:
        b += 1
    elif a-b == 1:
        if X(a, b) < abs_x:
            a += 1
        else:
            #print("引き算では無理")
            break
    else:
        print("Error")
        exit()

#print("足し算を判定")

a = 0
b = 0

while True:
    if X_plus(a, b) == abs_x:
        b = -b
        if x < 0:
            a = -a
            b = -b
        print(a, b)
        exit()

    if X_plus(a+1, b) <= abs_x:
        a += 1
        b = 0
    else:
        if X_plus(a, b+1) <= abs_x:
            b += 1
        else:
            a -= 1
            b -= 1

Fixed submission:
from collections import deque
import sys
input = sys.stdin.readline


x = int(input().strip())
abs_x = abs(x)

def X(a, b):
    return a**5 - b**5

def X_plus(a, b):
    return a**5 + b**5

a = -118
b = -119


for a in range(-118, 119):
    #print(a)
    for b in range(-119, 118):
        #print(b)
        if X(a,b) == x:
            print(a,b)
            exit()

#print("not found")

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import sys
input = sys.stdin.readline


x = int(input().strip())
abs_x = abs(x)

def X(a, b):
    return a**5 - b**5

def X_plus(a, b):
    return a**5 + b**5

a = 2
b = 1

while True:
    #print(a, b)
    if X(a, b) == abs_x:
        if x < 0:
            a = -a
            b = -b
        print(a,b)
        exit()

    if (a-b) > 1:
        b += 1
    elif a-b == 1:
        if X(a, b) < abs_x:
            a += 1
        else:
            #print("引き算では無理")
            break
    else:
        print("Error")
        exit()

#print("足し算を判定")

a = 0
b = 0

while True:
    if X_plus(a, b) == abs_x:
        b = -b
        if x < 0:
            a = -a
            b = -b
        print(a, b)
        exit()

    if X_plus(a+1, b) <= abs_x:
        a += 1
        b = 0
    else:
        if X_plus(a, b+1) <= abs_x:
            b += 1
        else:
            a -= 1
            b = 0

Fixed submission:
from collections import deque
import sys
input = sys.stdin.readline


x = int(input().strip())
abs_x = abs(x)

def X(a, b):
    return a**5 - b**5

def X_plus(a, b):
    return a**5 + b**5

a = -118
b = -119


for a in range(-118, 119):
    #print(a)
    for b in range(-119, 118):
        #print(b)
        if X(a,b) == x:
            print(a,b)
            exit()

#print("not found")
Buggy python submission (verdict: Runtime Error):
S = input()
if S == "ABC:
	print("ARC")
else:
  print("ABC")

Fixed submission:
S = input()
if S == "ABC":
	print("ARC")
else:
  print("ABC")
Buggy python submission (verdict: Runtime Error):
import sys
n = list(map(int, input().split()))
s = list(input())
for i in s:
    if i == n[1]:
        print(s[i].lower(),end='')
        break
    print(s[i],end='')

Fixed submission:
import sys
n = list(map(int, input().split()))
s = list(input())
for i in range(len(s)):
    if i == n[1]-1:
        print(s[i].lower(),end='')
        continue
    print(s[i],end='')
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = list(input().split())
for i in range(n,n+10001):
    chk = True
    
    for st in list(str(i)):
        if st in l:
            chk = False
    if chk:
        print(i)
        exit()

Fixed submission:
import sys
a = list(map(int,input().split()))
seven = a.count(7)
five = a.count(5)
if five==2 and seven==1:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
list=[]
for _ in range(K):
    d = int(input())
    S = input().split()
    list.extend(S)
num = collections.Counter(list)
print(N-num)

    

Fixed submission:
from collections import Counter
N, K = map(int, input().split())
list=[]
for _ in range(1,K+1):
    d = int(input())
    S = input().split()
    list.extend(S)
num = Counter(list)
print(N-len(num))
Buggy python submission (verdict: Runtime Error):
a, b, c d = map(int, input().split())
aa=a
cc=c
for i in range(a//d+1):
    cc = cc - b
    print(cc)
    if cc<1:
      print("Yes")
      break;
    aa = aa - d
    print(aa)
    if aa <1:
      print("No")
      break;

Fixed submission:
a, b, c,d = map(int, input().split())
aa=a
cc=c
for i in range(a//d+1):
    cc = cc - b

    if cc<1:
      print("Yes")
      break;
    aa = aa - d

    if aa <1:
      print("No")
      break;
Buggy python submission (verdict: Runtime Error):
N = int(input())
sum=0
import math
for i in range(N):
  for j in range(N):
       t=gcd(i+1,j+1)
       for k in range(N):
          sum =sum + gcd(t, k+1)
print(sum)


Fixed submission:
N = int(input())
sum=0
import math
for i in range(N):
  for j in range(N):
       t=math.gcd(i+1,j+1)
       for k in range(N):
          sum =sum + math.gcd(t, k+1)
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
sum=0
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
from itertools import product
pools = product(range(N),range(N),range(N))
for i, j ,k in pools:
  sum =sum + gcd(i+1, j+1, k+1)
print(sum)

Fixed submission:
N = int(input())
sum=0
import math
for i in range(N):
  for j in range(N):
       t=math.gcd(i+1,j+1)
       for k in range(N):
          sum =sum + math.gcd(t, k+1)
print(sum)

Buggy python submission (verdict: Runtime Error):
N = int(input())
sum=0
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
from itertools import product
pools = product(N,N,N)
for i, j ,k in pools:
  sum =sum + gcd(i, j, k)

Fixed submission:
N = int(input())
sum=0
import math
for i in range(N):
  for j in range(N):
       t=math.gcd(i+1,j+1)
       for k in range(N):
          sum =sum + math.gcd(t, k+1)
print(sum)
Buggy python submission (verdict: Runtime Error):
N = input()
A = [int(x) for x in input().split()]
x=0
for i in A:
  if A%2==0:
    if not A%3==0 or A%5==0:
      print("DENIED")
      x=1
      break
    
  else:
   	continue
  break
if x !=0:
	print("APPROVED")
  

Fixed submission:
N = int(input())
A = [int(x) for x in input().split()]
 
x=0
for i in A:

  if i%2==0:
    if not i%3==0 and not i%5==0:
      print("DENIED")
      x=1
      break
    else:
      continue
    
  else:
   	continue
  break
if x ==0:
	print("APPROVED")
Buggy python submission (verdict: Runtime Error):
A, B= input().split()
num = [int(x) for x in input().split()]
C = input()

if C == A:
  num[0]=num[0]-1
else:
  num[1]= num[1]-1
  
print(num[0]+" "+num[1])

Fixed submission:
S = input().split()
num = [int(x) for x in input().split()]
A = input()
 
if A == S[0]:
  num[0]=num[0]-1
else:
  num[1]= num[1]-1
  
print(str(num[0])+" "+str(num[1]))
Buggy python submission (verdict: Runtime Error):
S = input()
i= len(S)
for j in  range(i):
  S[j]="x"
print(S)

Fixed submission:
S= input()
t= len(S)
print("x" * t)

Buggy python submission (verdict: Runtime Error):
S = input()
T = S.replace("*","x")[
print(T)


Fixed submission:
S= input()
t= len(S)
print("x" * t)
Buggy python submission (verdict: Runtime Error):
N = input()
A = input().split()
if n in A:
  print("YES")
else:
  print("NO")

Fixed submission:
N = input()
A = input().split()
if int(N) == len(set(A)):
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
N = input()
A = input().split()
if n in A:
  print("YES")
else:
  print("NO")
N = int(input())
A = [int(x) for x in input().split()]

if n in A:
  print("YES")
else:
  print("NO")
提出情報
提出日時

Fixed submission:
N = input()
A = input().split()
if int(N) == len(set(A)):
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(x) for x in input().split()]

if n in A:
  print("YES")
else:
  print("NO")

Fixed submission:
N = input()
A = input().split()
if int(N) == len(set(A)):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n,total = map(int,input().split())

a = b = c = -1

for i in range(0,n+1):
    for j in range(0,n+1):
        x = i
        y = j
        z = n - i - j
        if n >= x >=0 and n >= y >=0 and n >= z >=0:
            sum = 10000*int(x) + 5000*int(y) + 1000*int(z) 
            if total == sum:
                a = x
                b = y
                c = z
                break
            else:
                continue
            break
print(a,b,c)            
        
            

Fixed submission:
n,total = map(int,input().split())

a = b = c = -1

for i in range(0,n+1):
    x = i
    for j in range(0,n+1-x):
        
        y = j
        z = n - i - j
        if n >= x >=0 and n >= y >=0 and n >= z >=0:
            if total == 10000*int(x) + 5000*int(y) + 1000*int(z):
                a = x
                b = y
                c = z
                break
            else:
                continue
            break
print(a,b,c)

Buggy python submission (verdict: Time Limit Exceeded):
n,total = map(int,input().split())

a = b = c = -1

for i in range(0,n+1):
    for j in range(0,n+1):
        x = i
        y = j
        z = n - i - j
        if n >= x >=0 and n >= y >=0 and n >= z >=0:
            sum = 10000*int(x) + 5000*int(y) + 1000*int(z) 
            if total == sum:
                a = x
                b = y
                c = z
                break
        
print(a,b,c)            
        
            

Fixed submission:
n,total = map(int,input().split())

a = b = c = -1

for i in range(0,n+1):
    x = i
    for j in range(0,n+1-x):
        
        y = j
        z = n - i - j
        if n >= x >=0 and n >= y >=0 and n >= z >=0:
            if total == 10000*int(x) + 5000*int(y) + 1000*int(z):
                a = x
                b = y
                c = z
                break
            else:
                continue
            break
print(a,b,c)
Buggy python submission (verdict: Runtime Error):
import math
A,B = [int(i) for i in input().split()] 
 
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
list_a = prime_factorize(A)
list_b = prime_factorize(B)
list_a = set(list_a)
list_b = set(list_b)
ans = [x for x in list_a if x in list_b]
print(len(ans)+1)

Fixed submission:
# -*- coding: utf-8 -*-
N= input()
N = int(N)
x = -( - N // 2) / N
print(x)
Buggy python submission (verdict: Runtime Error):
N=int(input())
M=int(input())
array = list(map(int, input().strip().split()))
if(N>=sum(array)):
    print(N-sum(array))
else:
    print('-1')

Fixed submission:
N, M = map(int, input().split())
a = list(map(int, input().split()))
if(N>=sum(a)):
    print(N-sum(a))
else:
    print('-1')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy
k=int(input())
d=0
for a in range(1,k+1) :
    for b in range(1,k+1):
        x=numpy.gcd(a,b)
        for c in range(1,k+1):
            d+=numpy.gcd(x,c)
print(d)

Fixed submission:
import math
d=0
k=int(input())
for a in range(1,k+1) :
    for b in range(1,k+1):
        x=math.gcd(a,b)
        for c in range(1,k+1):
            d+=math.gcd(x,c)
print(d)

Buggy python submission (verdict: Runtime Error):
k=int(input())
d=0
for a in range(1,k+1) :
    for b in range(1,k+1):
        i=gcd(a,b)
        for c in range(1,k+1):
            d+=gcd(i,c)
print(d)


Fixed submission:
import math
d=0
k=int(input())
for a in range(1,k+1) :
    for b in range(1,k+1):
        x=math.gcd(a,b)
        for c in range(1,k+1):
            d+=math.gcd(x,c)
print(d)

Buggy python submission (verdict: Runtime Error):
k=int(input())
d=0
for a in range(1,k+1) :
    for b in range(1,k+1):
        for c in range(1,k+1):
            d+=gcd(a,b,c)
print(d)

Fixed submission:
import math
d=0
k=int(input())
for a in range(1,k+1) :
    for b in range(1,k+1):
        x=math.gcd(a,b)
        for c in range(1,k+1):
            d+=math.gcd(x,c)
print(d)

Buggy python submission (verdict: Runtime Error):
import numpy as np
k=int(input())
d=0
for a in range(1,k+1) :
    for b in range(1,k+1):
        for c in range(1,k+1):
            d+=gcd(a,b,c)
print(d)

Fixed submission:
import math
d=0
k=int(input())
for a in range(1,k+1) :
    for b in range(1,k+1):
        x=math.gcd(a,b)
        for c in range(1,k+1):
            d+=math.gcd(x,c)
print(d)

Buggy python submission (verdict: Time Limit Exceeded):
import math

k = int(input())
sum = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            sum += math.gcd(math.gcd(a,b),c)
print(sum)


Fixed submission:
import math

k = int(input())
sum = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        ab = math.gcd(a,b)
        for c in range(1,k+1):
            sum += math.gcd(ab,c)
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
import math

k = int(input())
sum = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            sum += math.gcd(math.gcd(a,b),c)
print(sum)

Fixed submission:
import math

k = int(input())
sum = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        ab = math.gcd(a,b)
        for c in range(1,k+1):
            sum += math.gcd(ab,c)
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
import math

k = int(input())
sum = 0
box = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            box = math.gcd(a,b)
            sum += math.gcd(box,c)
print(sum)

Fixed submission:
import math

k = int(input())
sum = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        ab = math.gcd(a,b)
        for c in range(1,k+1):
            sum += math.gcd(ab,c)
print(sum)
Buggy python submission (verdict: Runtime Error):
a,b,c,x = input().strip().split()
a,b,c,x = [int(a),int(b),int(c),int(x)]
counter = 0

for i in range(a+1):
    #if 500*i > x:
        #break
    for j in range(b+1):
        #if 500*i+100*j > x:
            #break
        for k in range(c+1):
            if 500*i+100*j+50*k == x:
                counter += 1
print(counter)


Fixed submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
counter = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k == x:
                counter += 1
print(counter)

Buggy python submission (verdict: Runtime Error):
a,b,c,x = input().strip().split()
a,b,c,x = [int(a),int(b),int(c),int(x)]
counter = 0

for i in range(a+1):
    if 500*i > x:
        break
    for j in range(b+1):
        if 500*i+100*j > x:
            break
        for k in range(c+1):
            if 500*i+100*j+50*k == x:
                counter += 1
print(counter)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
counter = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k == x:
                counter += 1
print(counter)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b = int(input())
sum = 0

for i in range(1,n+1):
    if a<=(i//10000 + i//1000%10 + i//100%10 + i//10%10 + i%10)<=b:
        sum += i
print(sum)


Fixed submission:
n,a,b = input().strip().split()
n,a,b = [int(n),int(a),int(b)]
sum = 0

for i in range(1,n+1):
    if a<=(i//10000 + i//1000%10 + i//100%10 + i//10%10 + i%10)<=b:
        sum += i
print(sum)
Buggy python submission (verdict: Runtime Error):
a,b,c = int(input(),input(),input()).split()
if(a + b + c)==17:
  print("YES")
else:
  print("NO")

Fixed submission:
a,b,c = list(map(int,input().split()))
if(a + b + c)==17:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
if(a + b + c)==17:
  print("YES")
else:
  print("NO")

Fixed submission:
a,b,c = list(map(int,input().split()))
if(a + b + c)==17:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
c = input()
if (a + b + c)==(5+7+5):
  print("YES")
else:
  print("NO")

Fixed submission:
a,b,c = list(map(int,input().split()))
if(a + b + c)==17:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = list(map(int, input().split()))

m = min(X)
M = max(X)

min_val = 100 * 100 * 100 * 100
for p in range(m, M+1):
    score = 0
    for x in X:
         score += (x-p)*(x-p)
    if score < min_val: min_val = score
print(min_val)


Fixed submission:
N, R_disp = map(int, input().split())
print(R_disp + 100 * (10 - N) if N < 10 else R_disp)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input() for _ in range(N))

S_set= list(set(S))

dic = dict(zip(S_set, [0 for _ in range(len(S_set))]))

for s in S: dic[s] += 1

K_max = max(list(dic.values()))

for (k, v) in dic.items():
    if K_max != v:
        S_set.pop(S_set.index(k))
        
for s in sorted(S_set): print(s)

Fixed submission:
N = int(input())
S = list(input() for _ in range(N))

S_set= sorted(list(set(S)))

dic = dict(zip(S_set, [0 for _ in range(len(S_set))]))

for s in S: dic[s] += 1

K_max = max(list(dic.values()))
        
for (i,s) in enumerate(sorted(S_set)): 
    if dic[s] == K_max: 
        print(s)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input() for _ in range(N))

S_sorted = sorted(list(set(S)))

dic = dict(zip(S_sorted, [0 for _ in range(len(S_sorted))]))

for s in S: dic[s] += 1

K_max = max(list(dic.values()))

for (k, v) in dic.items():
    if K_max != v:
        S_sorted.pop(S_sorted.index(k))
        
for s in S_sorted: print(s)

Fixed submission:
N = int(input())
S = list(input() for _ in range(N))

S_set= sorted(list(set(S)))

dic = dict(zip(S_set, [0 for _ in range(len(S_set))]))

for s in S: dic[s] += 1

K_max = max(list(dic.values()))
        
for (i,s) in enumerate(sorted(S_set)): 
    if dic[s] == K_max: 
        print(s)
Buggy python submission (verdict: Runtime Error):
H = int(input())
cnt = 0
n = math.floor(math.log2(H))
ans = 0
for i in range(n+1):
    cnt += int(math.pow(2,i))
print(cnt)

Fixed submission:
import math
H = int(input())
cnt = 0
n = math.floor(math.log2(H))
ans = 0
for i in range(n+1):
    cnt += int(math.pow(2,i))
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = [int(l) for l in input().split()]
num=0

for i in range(0,N-2):
    for j in range(i+1,N-1):
        for k in range(j+1, N):
            if (L[i]<L[j]+L[k]) and (L[j]<L[k]+L[i]) and (L[k]<L[i]+L[j]):
                num += 1
print(num)

Fixed submission:
import bisect
N = int(input())
L = list(int(l) for l in input().split())
L.sort()
num=0

for i in range(N-2):
    for j in range(i+1,N-1):
        a = L[i]
        b = L[j]
        idx = bisect.bisect_left(L, a+b)
#        print("(a,b)=(%d,%d) : idx=%d : (i,j)=(%d,%d)"%(a,b,idx-(j+1),i,j))
        num += idx-(j+1)
print(num)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
H,W,A,B = (int(n) for n in input().split())

S = np.array([[0 for i in range(W)] for j in range(H)])
S = S.astype(int)

if A > W/2 or B > H/2:
    print('No')
else:
    for i in range(H):
        for j in range(W):
            if (i<B and j<A) or (B<=i and A<=j):
                S[i,j] = 0
            else:
                S[i,j] = 1
#    for i in range(H):
#        print(' '.join(map(str,S[i])))
    for s in S:
        print(''.join(map(str,s)))

Fixed submission:
H,W,A,B = (int(n) for n in input().split())

S = [[0 for i in range(W)] for j in range(H)]

if A > W/2 or B > H/2:
    print('No')
else:
    for i in range(H):
        for j in range(W):
            if (i<B and j<A) or (B<=i and A<=j):
                S[i][j] = 1

#    for i in range(H):
#        print(' '.join(map(str,S[i])))
    for s in S:
        print(''.join(map(str,s)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
from fractions import gcd
import math
import functools
t = []
ans = 0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            t.append([i,j,k])
for i in range(len(t)):
    gcd = functools.reduce(math.gcd, t[i])
    ans += gcd
print(ans)



    

Fixed submission:
n = int(input())
from fractions import gcd
import math
import functools
t = []
ans = 0
for i in range(1,n+1):
    for j in range(i,n+1):
        for k in range(j,n+1):
            #t.append([i,j,k])
            t = [i,j,k]
            if i==j==k:
                gcd = functools.reduce(math.gcd, t)
                ans += gcd
            elif i!=k and j!=k and i!=j:
                gcd = functools.reduce(math.gcd, t)
                ans += gcd*6
            else:

                gcd = functools.reduce(math.gcd, t)
             
                ans += gcd*3
            #print(t,ans)

print(ans)
Buggy python submission (verdict: Runtime Error):
mport sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from numba import njit
 
MOD = 10**9 + 7
 
N = int(readline())
S = np.array(list(read().rstrip()), np.int8)
 
R = np.sum(S == ord('R'))
B = np.sum(S == ord('B'))
G = np.sum(S == ord('G'))
 
@njit
def f(S):
    N = len(S)
    ret = 0
    for i in range(N):
        for j in range(i + 1, N):
            k = j + j - i
            if k >= N:
                break
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                ret += 1
    return ret
 
answer = R * B * G - f(S)
print(answer)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from numba import njit
 
MOD = 10**9 + 7
 
N = int(readline())
S = np.array(list(read().rstrip()), np.int8)
 
R = np.sum(S == ord('R'))
B = np.sum(S == ord('B'))
G = np.sum(S == ord('G'))
 
@njit
def f(S):
    N = len(S)
    ret = 0
    for i in range(N):
        for j in range(i + 1, N):
            k = j + j - i
            if k >= N:
                break
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                ret += 1
    return ret
 
answer = R * B * G - f(S)
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = 0
for i in range(n):
    for j in range(i,n):
        for k in range(j,n):
            if s[i] !=s[j] and s[i]!= s[k] and s[j] != s[k]:
                if j-i != k-j:
                    ans+=1
                   # print(s[i],s[j],s[k])
print(ans)


Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
from numba import njit
 
MOD = 10**9 + 7
 
N = int(readline())
S = np.array(list(read().rstrip()), np.int8)
 
R = np.sum(S == ord('R'))
B = np.sum(S == ord('B'))
G = np.sum(S == ord('G'))
 
@njit
def f(S):
    N = len(S)
    ret = 0
    for i in range(N):
        for j in range(i + 1, N):
            k = j + j - i
            if k >= N:
                break
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                ret += 1
    return ret
 
answer = R * B * G - f(S)
print(answer)
Buggy python submission (verdict: Runtime Error):
str = input().split()
#print(str)
n = int(str[0])
k = int(str[1])
a = list(map(int, input().split()))
sum = 0
a.sort()
for i in range(k):a.pop()
#print(a)
for i in range(n-k):
    sum += a[i]
print(sum)


Fixed submission:
n,k = list(map(int,input().split()))

#print(n)
a = list(map(int, input().split()))

sum = 0
a.sort()
#print(a)
for i in range(min(n,k)): a.pop()
#print(a)
for i in range(len(a)):
    sum += a[i]
print(sum)