Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s = list(str(input()))
ans = 0
drop = False
l = 0
while l <= len(s) - 2:
    if drop == False:
        if s[l] != s[l + 1]:
            ans += 2
            del s[l:l + 2]
            drop = True
        else:
            l += 1
    while drop == True and len(s) >= 2:
        if 0 <= l:
            l -= 1
        if s[l] != s[l + 1]:
            ans += 2
            del s[l:l + 2]
        else:
            drop = False
            l += 1
print(ans)

Fixed submission:
s = str(input())
c0 = s.count('0')
c1 = s.count('1')
print(2 * min(c0, c1))

Buggy python submission (verdict: Time Limit Exceeded):
s = list(str(input()))
ans = 0
drop = False
for r in range(1, len(s)):
    if drop == False:
        l = r - 1
        if s[l] != -1 and s[l] != s[r]:
            ans += 2
            s[l], s[r] = -1, -1
            drop = True
    elif drop == True:
        while l >= 0 and s[l] == -1:
            l -= 1
        if l == -1 or s[l] == s[r]:
            drop = False
            continue
        if s[l] != s[r]:
            ans += 2
            s[l], s[r] = -1, -1
print(ans)

Fixed submission:
s = str(input())
c0 = s.count('0')
c1 = s.count('1')
print(2 * min(c0, c1))

Buggy python submission (verdict: Time Limit Exceeded):
s = list(str(input()))
ans = 0
drop = False
for r in range(1, len(s)):
    if drop == False:
        l = r - 1
        if s[l] != -1 and s[l] != s[r]:
            ans += 2
            s[l], s[r] = -1, -1
            drop = True
    elif drop == True:
        while l >= 0 and s[l] == -1:
            l -= 1
        if l == -1 or s[l] == s[r]:
            drop = False
            continue
        if s[l] != s[r]:
            ans += 2
            s[l], s[r] = -1, -1
print(ans)

Fixed submission:
s = str(input())
c0 = s.count('0')
c1 = s.count('1')
print(2 * min(c0, c1))
Buggy python submission (verdict: Runtime Error):
from math import gcd
n = int(input())
a = list(map(int, input().split()))
g = a[0]
for i in range(1, n):
    g = gcd(g, a[i])
print(g)

Fixed submission:
from fractions import gcd
n = int(input())
a = list(map(int, input().split()))
g = a[0]
for i in range(1, n):
    g = gcd(g, a[i])
print(g)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [0 for _ in range(n)]
for i in range(1, n):
    arr = []
    for j in range(1, k + 1):
        if 0 <= i - j <= n:
            arr.append(dp[i - j] + abs(h[i - j] - h[i]))
    dp[i] = min(arr)
print(dp[n - 1])

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [0 for _ in range(n)]
for i in range(1, n):
    arr = []
    for j in range(1, k + 1):
        if 0 <= i - j <= n:
            arr.append(dp[i - j] + abs(h[i - j] - h[i]))
    dp[i] = min(arr)
print(dp[n - 1])

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [0 for _ in range(n)]
for i in range(1, n):
    m = float('inf')
    for j in range(1, k + 1):
        if 0 <= i - j <= n:
            m = min(m, dp[i - j] + abs(h[i - j] - h[i]))
    dp[i] = m
print(dp[n - 1])

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [0 for _ in range(n)]
for i in range(1, n):
    arr = []
    for j in range(1, k + 1):
        if 0 <= i - j <= n:
            arr.append(dp[i - j] + abs(h[i - j] - h[i]))
    dp[i] = min(arr)
print(dp[n - 1])
Buggy python submission (verdict: Time Limit Exceeded):
n, W = map(int, input().split())
dp = [[0 for _ in range(W + 1)] for i in range (n + 1)]
for i in range(1, n + 1):
    w, v = map(int, input().split())
    for j in range(1, W + 1):
        if w > j:
            dp[i][j] = dp[i - 1][j]
        else:
            dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w] + v)
print(dp[-1][-1])

Fixed submission:
n, W = map(int, input().split())
dp = [[0 for _ in range(W + 1)] for i in range (n + 1)]
for i in range(1, n + 1):
    w, v = map(int, input().split())
    for j in range(1, W + 1):
        if w > j:
            dp[i][j] = dp[i - 1][j]
        else:
            dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w] + v)
print(dp[-1][-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dp = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
plist = list(map(float, input().split()))
dp[1][0], dp[1][1] = 1 - plist[0], plist[0]
for i in range(1, n):
    p = plist[i]
    for j in range(i + 1):
        dp[i + 1][j] += dp[i][j] * (1 - p)
        dp[i + 1][j + 1] += dp[i][j] * p
print(sum(dp[-1][n // 2 + 1:]))

Fixed submission:
n = int(input())
dp = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
plist = list(map(float, input().split()))
dp[1][0], dp[1][1] = 1 - plist[0], plist[0]
for i in range(1, n):
    p = plist[i]
    for j in range(i + 1):
        dp[i + 1][j] += dp[i][j] * (1 - p)
        dp[i + 1][j + 1] += dp[i][j] * p
print(sum(dp[-1][n // 2 + 1:]))
Buggy python submission (verdict: Runtime Error):
n, i = map(int, input())
print(n - i + 1)

Fixed submission:
n, i = map(int, input().split())
print(n - i + 1)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
s,t,u=a+b,a-b,a*b
if s>t and s>u:
  print(s)
elif t>s and t>u:
  print(t)
else:
  print(u)


Fixed submission:
a,b = map(int, input().split())
s,t,u=a+b,a-b,a*b
if s>=t and s>=u:
  print(s)
elif t>=s and t>=u:
  print(t)
else:
  print(u)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
s,t,u=a+b,a-b,a*b
if s>t and s>u:
  print(s)
elif t>s and t>u:
  print(t)
else:
  print(u)

Fixed submission:
a,b = map(int, input().split())
s,t,u=a+b,a-b,a*b
if s>=t and s>=u:
  print(s)
elif t>=s and t>=u:
  print(t)
else:
  print(u)

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
s,t,u=a+b,a-b,a*b
if s>t and s>u:
  print(s)
elif t>s and t>u:
  print(t)
else:
  print(u)


Fixed submission:
a,b = map(int, input().split())
s,t,u=a+b,a-b,a*b
if s>=t and s>=u:
  print(s)
elif t>=s and t>=u:
  print(t)
else:
  print(u)
Buggy python submission (verdict: Runtime Error):
m,n = int(input())
li = list(map(int,input().split()))
if sum(li)>m:
  print(-1)
else:
  print(m - sum(li))

Fixed submission:
m,n = list(map(int,input().split()))
li = list(map(int,input().split()))
if sum(li)>m:
  print(-1)
else:
  print(m - sum(li))
Buggy python submission (verdict: Runtime Error):
from sys import stdin,stdout
size = int(stdin.readline())
li = list(map(int,stdin.readline().split()))
"""ans = [0]*size
for i in li:
    if i not in ans:
        ans[i-1] = 1
    else:
        ans[i-1] += 1
for i in ans:
    print(i)
"""
from collections import Counter
c1 = Counter(li)
ans2 = [0] * size
for i,j in c1.items():
    ans2[i-1] = j
for i in ans2:
    stdout.write(i)


Fixed submission:
size = int(input())
li = list(map(int,input().split()))
from collections import Counter
c1 = Counter(li)
ans2 = [0] * size
for i,j in c1.items():
    ans2[i-1] = j
for i in ans2:
    print(i)
Buggy python submission (verdict: Runtime Error):
a = input()
print(chr(ord(a)+1)

Fixed submission:
a = input()
print(chr(ord(a)+1))
Buggy python submission (verdict: Runtime Error):
size = int(input())
a,b = list(map(int,input().split()))
ans = ""
for i in range(size):
  ans += a[i]
  ans += b[i]
print(ans)


Fixed submission:
size = int(input())
a,b = list(map(str,input().split()))
ans = ""
for i in range(size):
  ans += a[i]
  ans += b[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
size = int(input())
a,b = list(map(int,input().split()))
ans = ""
for i in size:
  ans += a[i]
  ans += b[i]
print(ans)

Fixed submission:
size = int(input())
a,b = list(map(str,input().split()))
ans = ""
for i in range(size):
  ans += a[i]
  ans += b[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
import math
def lcm(a,b): 
    return (a*b) / math.gcd(a,b) 
a,b = list(map(int,input().split()))
print(int(lcm(a,b)))



Fixed submission:
def gcd(a,b): 
    if a == 0: 
        return b 
    return gcd(b % a, a) 

def lcm(a,b): 
    return (a*b) / gcd(a,b) 
a,b = list(map(int,input().split()))
print(int(lcm(a,b)))

Buggy python submission (verdict: Time Limit Exceeded):
def lcm(x, y):
   """This function takes two
   integers and returns the L.C.M."""

   # choose the greater number
   if x > y:
       greater = x
   else:
       greater = y

   while(True):
       if((greater % x == 0) and (greater % y == 0)):
           lcm = greater
           break
       greater += 1

   return lcm
a,b = list(map(int,input().split()))
print(lcm(a,b))



Fixed submission:
def gcd(a,b): 
    if a == 0: 
        return b 
    return gcd(b % a, a) 

def lcm(a,b): 
    return (a*b) / gcd(a,b) 
a,b = list(map(int,input().split()))
print(int(lcm(a,b)))

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
import math
def lcm(a, b):
    return int(abs(a*b) / math.gcd(a, b))
a,b = list(map(int,input().split()))
print(lcm(a,b))



Fixed submission:
def gcd(a,b): 
    if a == 0: 
        return b 
    return gcd(b % a, a) 

def lcm(a,b): 
    return (a*b) / gcd(a,b) 
a,b = list(map(int,input().split()))
print(int(lcm(a,b)))

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
import math
def lcm(a, b):
    return abs(a*b) // math.gcd(a, b)
a,b = list(map(int,input().split()))
print(lcm(a,b))



Fixed submission:
def gcd(a,b): 
    if a == 0: 
        return b 
    return gcd(b % a, a) 

def lcm(a,b): 
    return (a*b) / gcd(a,b) 
a,b = list(map(int,input().split()))
print(int(lcm(a,b)))

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
def lcm(a, b):
    return abs(a*b) // math.gcd(a, b)
a,b = list(map(int,input().split()))
print(lcm(a,b))

Fixed submission:
def gcd(a,b): 
    if a == 0: 
        return b 
    return gcd(b % a, a) 

def lcm(a,b): 
    return (a*b) / gcd(a,b) 
a,b = list(map(int,input().split()))
print(int(lcm(a,b)))
Buggy python submission (verdict: Runtime Error):
from collections import Counter
a = input()
c1 = Counter(a)
flag = False
for i,j in c1.items():
  if(len(set(j))==1:
     flag=True
  else:
     flag= False
if(flag):
     print('Yes')
else:
     print('No')

Fixed submission:
size = int(input())
a = input()
if a[0:size//2] == a[size//2:]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
print n//2

Fixed submission:
n = int(input())
print((n-1)//2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = []
for i in range(1,int(n**0.5)):
    if n%i==0:
        ans.append(i-1+((n//i)-1))
print(min(ans))


Fixed submission:
n = int(input())
ans = []
for i in range(1,int(n**0.5)+1):
    if n%i==0:
        ans.append(i-1+((n//i)-1))
print(min(ans))

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
ans = []
for i in range(1,int(math.sqrt(n))):
    if n%i==0:
        ans.append(i-1+((n//i)-1))
print(min(ans))


Fixed submission:
n = int(input())
ans = []
for i in range(1,int(n**0.5)+1):
    if n%i==0:
        ans.append(i-1+((n//i)-1))
print(min(ans))

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
ans = []
for i in range(1,int(math.sqrt(n))):
    if n%i==0:
        ans.append(i-1+((n//i)-1))
print(min(ans))


Fixed submission:
n = int(input())
ans = []
for i in range(1,int(n**0.5)+1):
    if n%i==0:
        ans.append(i-1+((n//i)-1))
print(min(ans))
Buggy python submission (verdict: Time Limit Exceeded):
size = int(input())
ans = []
li = list(map(int,input().split()))
for i in range(1,size+1):
    print(li.index(i)+1,end=" ")
   

Fixed submission:
size = int(input())
ans = []
li = list(map(int,input().split()))
a = list(enumerate(li))
list2 = sorted(a, key=lambda x:x[1])
for i,j in list2:
    print(i+1,end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
size = int(input())
ans = []
li = list(map(int,input().split()))
for i in range(1,size+1):
    ans.append(li.index(i)+1)
for i in ans:
    print(i,end =" ")

Fixed submission:
size = int(input())
ans = []
li = list(map(int,input().split()))
a = list(enumerate(li))
list2 = sorted(a, key=lambda x:x[1])
for i,j in list2:
    print(i+1,end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
size,init,query= list(map(int,input().split()))
health = []
ans = []
for i in range(size):
    health.append(init)
for i in range(query):
    attack = int(input())
    for i in range(0,len(health)):
        health[i] -= 1
    health[attack-1] += 1
for i in health:
    if i<1:
        ans.append('No')
    else:
        ans.append('Yes')
for i in ans:
    print(i)

Fixed submission:
n, k, q = map(int, input().split())
# a = []
point = [k-q] * n
for i in range(q):
    input_num = int(input())
    point[input_num - 1] += 1
    # a.append(input_num)
 
for i in range(n):
    if point[i] <= 0:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
size = int(input())
li = list(map(int,input().split()))
s = 0
for i in li:
  s += 1/i
print(1/s  


Fixed submission:
size = int(input())
li = list(map(int,input().split()))
s = 0
for i in li:
    s += (1/i)
print(1/s)
Buggy python submission (verdict: Runtime Error):
n = input()
return n.count('1');

Fixed submission:
n = input()
print(n.count('1'))
Buggy python submission (verdict: Runtime Error):


N = int(input())
S = input()
#N = 12
#S = 'WEWEWEEEWWWE'


min = 1000000
e = S.count('E')
w = 0

for i in range(0,N-1):
    flag = 0
    now = S[i]
    if now == 'E':
        e = e - 1
    else:
        flag = 1
    sum = w + e
    if min > sum:
        min = sum
    if flag:
        w = w + 1
print(min)


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

n_sum = n[0] + n[1]
n_sub = n[0] - n[1]
n_mul = n[0] * n[1]

ans = max(n_sum,n_sub,n_mul)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):


N = int(input())
S = input()
#N = 8
#S = 'WWWWWEEE'


min = 1000000
for i in range(1,N-1):
    if S[i:i+1] == 'EE':
        continue
    if S[i-1:i] == 'WW':
        continue
    l = S[i]
    if l == 'W':
        left = S[0:i-1].count('W')
        right = S[i+1:].count('E')
    else:
        left = S[0:i-1].count('W')
        right = S[i+1:].count('E')
    sum = right + left
    #print(l, sum, left, right)
    if min > sum:
        min = sum
print(min)


Fixed submission:


N = int(input())
S = input()
#N = 12
#S = 'WEWEWEEEWWWE'


min = 1000000
e = S.count('E')
w = 0

for i in range(0,N):
    flag = 0
    now = S[i]
    if now == 'E':
        e = e - 1
    else:
        flag = 1
    sum = w + e
    if min > sum:
        min = sum
    if flag:
        w = w + 1
print(min)

Buggy python submission (verdict: Time Limit Exceeded):


N = int(input())
S = input()
#N = 8
#S = 'WWWWWEEE'


min = 1000000
for i in range(1,N-1):
    l = S[i]
    if l == 'W':
        left = S[0:i-1].count('W')
        right = S[i+1:].count('E')
    else:
        left = S[0:i-1].count('W')
        right = S[i+1:].count('E')
    sum = right + left
    #print(l, sum, left, right)
    if min > sum:
        min = sum
print(min)



Fixed submission:


N = int(input())
S = input()
#N = 12
#S = 'WEWEWEEEWWWE'


min = 1000000
e = S.count('E')
w = 0

for i in range(0,N):
    flag = 0
    now = S[i]
    if now == 'E':
        e = e - 1
    else:
        flag = 1
    sum = w + e
    if min > sum:
        min = sum
    if flag:
        w = w + 1
print(min)

Buggy python submission (verdict: Time Limit Exceeded):


N = int(input())
S = input()
#N = 8
#S = 'WWWWWEEE'


min = 1000000
for i in range(1,N):
    l = S[i]
    if l == 'W':
        left = S[0:i-1].count('W')
        right = S[i+1:].count('E')
    else:
        left = S[0:i-1].count('W')
        right = S[i+1:].count('E')
    sum = right + left
    #print(l, sum, left, right)
    if min > sum:
        min = sum
print(min)



Fixed submission:


N = int(input())
S = input()
#N = 12
#S = 'WEWEWEEEWWWE'


min = 1000000
e = S.count('E')
w = 0

for i in range(0,N):
    flag = 0
    now = S[i]
    if now == 'E':
        e = e - 1
    else:
        flag = 1
    sum = w + e
    if min > sum:
        min = sum
    if flag:
        w = w + 1
print(min)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(2000)

n, k = map(int, input().split())
an = list(map(int, input().split()))

mod = 10**9 + 7

als = []
test = True
for i in an:
    if i > 0:
        test = False
    als.append([abs(i), i])
if test and k % 2 == 1:
    an.sort(reverse=True)
    ans = 1
    for i in range(k):
        ans = ans * an[i] % mod
    print(ans)
    exit()

als.sort(reverse=True)

ans = 1
min_p = 10**9 + 1
min_m = - 10**9 + 1
cnt = 0
for i in range(k):
    x, y = als[i]
    ans = ans * x % mod
    if y > 0:
        min_p = x
    if y < 0:
        min_m = x
        cnt += 1

if cnt % 2 == 0:
    print(ans)
    exit()

max_p = 0
max_m = 0
for j in range(k, n):
    if als[j][1] > 0:
        max_p = max(max_p, als[j][0])
    if als[j][1] < 0:
        max_m = max(max_m, als[j][0])
    if max_p != 0 and max_m != 0:
        break

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y/2)**2 % mod
    else            : return power(x, y/2)**2 * x % mod

if max_m == 0 or max_p / min_m >= max_m / min_p:
    print(ans * max_p * power(min_m, mod-2) % mod)
else:
    print(ans * max_m * power(min_p, mod-2) % mod)



Fixed submission:
n = int(input())

x = n // 1000
if n % 1000 == 0:
    print(1000 * x - n)
else:
    print(1000 * (x + 1) - n)
Buggy python submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
an = list(map(int, input().split()))
bn = list(map(int, input().split()))

a_sum = [0]
b_sum = [0]
for i in range(1, n+1):
  a_sum.append(a_sum[i-1] + an[i-1])
for j in range(1, m+1):
  b_sum.append(b_sum[j-1] + bn[j-1])

ans = len(bn)
idx = len(bn)
for j in range(m+1):
  if k - b_sum[j] < 0:
    ans = j - 1
    idx = j - 1
    break
for i in range(1, n+1):
  if a_sum[i] + b_sum[idx] > k:
    idx -= 1
  else:
    ans += 1

print(ans)

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

a_sum = [0]
b_sum = [0]
for i in range(1, n+1):
  a_sum.append(a_sum[i-1] + an[i-1])
for j in range(1, m+1):
  b_sum.append(b_sum[j-1] + bn[j-1])

idx = len(bn)
ans = 0
for i in range(n+1):
  while a_sum[i] + b_sum[idx] > k:
    idx -= 1
    if idx == -1:
      break
  if idx == -1:
    break
  ans = max(ans, i + idx)

print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(input())
an = list(map(int, input().split()))

an.sort()
an = deque(an)
ls = deque()
same = -1
while an:
    a = an.popleft()
    t = True
    if same == a:
      continue
    for i in ls:
        if i > a ** (1/2):
            t = False
            break
        if a == i:
            ls.pop()
            same = a
            t = False
            break
        if a % i == 0:
            t = False
            break
    if t:
        ls.append(a)

print(len(ls))


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

for i in range(5):
    if x[i] == 0:
        print(i + 1)
        exit()

Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(input())
an = list(map(int, input().split()))

an.sort()
an = deque(an)
ls = deque()
same = -1
while an:
    a = an.popleft()
    t = True
    if same == a:
      continue
    for i in ls:
        if a == i:
            ls.pop()
            same = a
            t = False
            break
        if a % i == 0:
            t = False
            break
    if t:
        ls.append(a)

print(len(ls))


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

for i in range(5):
    if x[i] == 0:
        print(i + 1)
        exit()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

r = []
g = []
b = []
counter = 0

for x in range(n):
  if s[x] == 'R':
    r.append(x)
  elif s[x] == 'G':
    g.append(x)
  else:
    b.append(x)
    
for i in range(len(r)):
  for j in range(len(g)):
    for k in range(len(b)):
      if r[i]-g[j] != g[j]-b[k] and g[j]-b[k] != b[k]-r[i] and b[k]-r[i] != r[i]-g[j]:
        counter += 1
print(counter)


Fixed submission:
n = int(input())
s = input()

r = s.count('R')
g = s.count('G')
b = s.count('B')
counter = 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[k] != s[i]:
      counter += 1
      
print(r*g*b - counter)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
counter = 0

for i in range(0, n-2):
  for j in range(i+1, n-1):
    if s[i] == s[j]:
      continue
    for k in range(j+1, n):
      if s[j] == s[k] or s[k] == s[i]:
        continue
      if j-i != k-j:
        counter += 1
    
print(counter)


Fixed submission:
n = int(input())
s = input()

r = s.count('R')
g = s.count('G')
b = s.count('B')
counter = 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[k] != s[i]:
      counter += 1
      
print(r*g*b - counter)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
counter = 0

for i in range(0, n-2):
  for j in range(i+1, n-1):
    for k in range(j+1, n):
      if j-i != k-j:
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
          counter += 1
    
print(counter)


Fixed submission:
n = int(input())
s = input()

r = s.count('R')
g = s.count('G')
b = s.count('B')
counter = 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[k] != s[i]:
      counter += 1
      
print(r*g*b - counter)
Buggy python submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())
pn = list(map(int, input().split()))
qn = list(map(int, input().split()))
rn = list(map(int, input().split()))

pn.sort(reverse=True)
qn.sort(reverse=True)

pqr = pn[:x] + qn[:y] + rn
pqr.sort(reverse=True)
  
print(sum(pqr[:x+y]))


Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
  print('Yes')
else:
  print('No')