Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

n = int(input())
a = []
b = []
b2 = []
c = []
count = 0

for i in range(n):
    x,y = list(map(int,input().split()))
    a.append([x,y,x+y])

a.sort(key=lambda x: x[2])

for i in a:
    c = b.copy()
    if len(b) > 0:
        if i[0]-i[1] <= max(b):
            #b.extend(list(range(i[0]-i[1], i[0]+i[1])))
            #b2 = b.copy()
            #b = list(set(b))
            #if len(b2) != len(b):
                #b = c.copy()
            count += 1
        else:
            b = []
            b.extend(list(range(i[0]-i[1], i[0]+i[1])))
    else:
        b.extend(list(range(i[0]-i[1], i[0]+i[1])))
        
    
print(n - count)

Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
a = []
b = []
b2 = []
c = []
count = 0
max = 0

for i in range(n):
    x,y = list(map(int,input().split()))
    a.append([x,y,x+y])

a.sort(key=lambda x: x[2])

for i in a:
    if max != 0 and i[0]-i[1] < max:
        count += 1
    else:
        max = i[2]
    
print(n - count)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

n = int(input())
a = []
b = []
b2 = []
c = []
count = 0

for i in range(n):
    x,y = list(map(int,input().split()))
    a.append([x,y,x+y])

a.sort(key=lambda x: x[2])

for i in a:
    c = b.copy()
    if len(b) > 0:
        if i[0]-i[1] <= max(b):
            b.extend(list(range(i[0]-i[1], i[0]+i[1])))
            b2 = b.copy()
            b = list(set(b))
            if len(b2) != len(b):
                b = c.copy()
                count += 1
        else:
            b = []
            b.extend(list(range(i[0]-i[1], i[0]+i[1])))
    else:
        b.extend(list(range(i[0]-i[1], i[0]+i[1])))
        
    
print(n - count)

Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
a = []
b = []
b2 = []
c = []
count = 0
max = 0

for i in range(n):
    x,y = list(map(int,input().split()))
    a.append([x,y,x+y])

a.sort(key=lambda x: x[2])

for i in a:
    if max != 0 and i[0]-i[1] < max:
        count += 1
    else:
        max = i[2]
    
print(n - count)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

n = int(input())
a = []
b = []
b2 = []
c = []
count = 0

for i in range(n):
    x,y = list(map(int,input().split()))
    a.append([x,y,x+y])

a.sort(key=lambda x: x[2])

for i in a:
    c = b.copy()
    b.extend(list(range(i[0]-i[1], i[0]+i[1])))
    b2 = b.copy()
    b = list(set(b))
    if len(b2) != len(b):
        b = c.copy()
        count += 1
    
print(n - count)

Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
a = []
b = []
b2 = []
c = []
count = 0
max = 0

for i in range(n):
    x,y = list(map(int,input().split()))
    a.append([x,y,x+y])

a.sort(key=lambda x: x[2])

for i in a:
    if max != 0 and i[0]-i[1] < max:
        count += 1
    else:
        max = i[2]
    
print(n - count)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

n,k,s = list(map(int,input().split()))
a = []
count = 0
st = ""

for i in range(k):
    a.append(s)

for i in range(n-k):
    a.append(s-1)

if s-1 == 0:
    a = [1]

for i in range(n):
    if st == "":
        st = str(a[count])
    else:
        st += " " + str(a[count])
    count += 1

print(st)

Fixed submission:
# -*- coding: utf-8 -*-

n,k,s = list(map(int,input().split()))
a = []
count = 0
st = ""

for i in range(k):
    a.append(s)

for i in range(n-k):
    if s < 2:
        a.append(s+1)
    else:
        a.append(s-1)
    
for i in range(n):
    if st == "":
        st = str(a[count])
    else:
        st += " " + str(a[count])
    count += 1

print(st)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

n,k,s = list(map(int,input().split()))
a = []
count = 0
st = ""

for i in range(k):
    a.append(s)

for i in range(n-k):
    a.append(s-1)

if s-1 == 0:
    a = []
    a.append(1)

for i in range(n):
    if st == "":
        st = str(a[count])
    else:
        st += " " + str(a[count])
    count += 1

print(st)

Fixed submission:
# -*- coding: utf-8 -*-

n,k,s = list(map(int,input().split()))
a = []
count = 0
st = ""

for i in range(k):
    a.append(s)

for i in range(n-k):
    if s < 2:
        a.append(s+1)
    else:
        a.append(s-1)
    
for i in range(n):
    if st == "":
        st = str(a[count])
    else:
        st += " " + str(a[count])
    count += 1

print(st)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

from collections import OrderedDict

n = int(input())
dic = OrderedDict()

for i in range(n):
    l,d = list(map(str,input().split()))
    dic[l] = d

a = str(input())

flag = False
time = 0

for key,value in dic.items():
    if flag == False:
        if key == a:
            flag = True
    else:
        time += int(value)

print(time)

Fixed submission:
# -*- coding: utf-8 -*-

a = str(input())

alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

print(alpha[alpha.index(a)+1])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import itertools

n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))

a = list(range(1,n+1,1))
count = 1

for i in itertools.permutations(a, n):
    if (i[0] == p[0]) and (i[1] == p[1]) and (i[2] == p[2]):
        res1 = count
    if (i[0] == q[0]) and (i[1] == q[1]) and (i[2] == q[2]):
        res2 = count
    count += 1

print(abs(res1-res2))

Fixed submission:
# -*- coding: utf-8 -*-

import itertools

n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))

a = list(range(1,n+1,1))
count = 1

res1 = 0
res2 = 0

temp = []

for i in itertools.permutations(a):
    for j in range(n):
        temp.append(i[j])
    if temp == p and (res1 == 0):
        res1 = count
    if temp == q and (res2 == 0):
        res2 = count
    count += 1
    temp = []

print(abs(res1-res2))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

A_list = list(map(int, input().split()))

import numpy as np

B_list = A_list.copy()

A_list = [np.max(A_list[0:i+1]) for i in range(1, len(A_list)) ]

A_list = [B_list[0]] + A_list

A_array = np.array(A_list)
B_array = np.array(B_list)

print(np.sum(A_array - B_array))   

Fixed submission:
N = int(input())

A_list = list(map(int, input().split()))

import numpy as np

B_list = A_list.copy()

for i in range(1, len(A_list)):
    if A_list[i] < A_list[i-1]:
        A_list[i] = A_list[i-1]
        
A_array = np.array(A_list)
B_array = np.array(B_list)

print(np.sum(A_array - B_array))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

A_list = list(map(int, input().split()))

import numpy as np

A_array = np.array(A_list)

A_max_list = list()
for i in range(len(A_array)):
    max_value = np.max(A_array[:i+1])
    A_max_list.append(max_value)
    
A_max_array = np.array(A_max_list)   

print(np.sum(A_max_array - A_array))


Fixed submission:
N = int(input())

A_list = list(map(int, input().split()))

import numpy as np

B_list = A_list.copy()

for i in range(1, len(A_list)):
    if A_list[i] < A_list[i-1]:
        A_list[i] = A_list[i-1]
        
A_array = np.array(A_list)
B_array = np.array(B_list)

print(np.sum(A_array - B_array))
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = [0 for _ in range(10050)]

for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            v = i*i+j*j+k*k+i*j+j*k+k*i;
            
            if v<10050:
            ans[v]+=1

for i in range(n):
    print(ans[i+1])

Fixed submission:
n = int(input())
ans = [0 for a in range(10050)]


for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i*i+j*j+k*k+i*j+j*k+k*i;
      
      if v<10050:
        ans[v]+=1

for i in range(n):
  print(ans[i+1])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

import numpy as np

for i in range(1,N+1):

    right = 2 * i


    er = int(np.ceil(np.sqrt(right)))

    count = 0

    for x in range(1,er):
        
        if right - x**2 < 1:
            continue
        
        for y in range(1, int(np.ceil(np.sqrt(right - x**2))) + 1):
          
            if right - x**2 - y**2 < 1:
                continue
          
            for z in range(1,int(np.ceil(np.sqrt(right - x**2 - y**2))) + 1):
                if (x + y + z) % 2 != 0:
                    continue
                  
                elif (x ** 2 + y ** 2 + z ** 2 == 2 * i) & (x + y > z) & (y + z > x) & (z + x > y):
                    count += 1
            
    print(count)        

Fixed submission:
n = int(input())
ans = [0 for a in range(10050)]


for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i*i+j*j+k*k+i*j+j*k+k*i;
      
      if v<10050:
        ans[v]+=1

for i in range(n):
  print(ans[i+1])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

import numpy as np

for i in range(1,N+1):

    right = 2 * i


    er = int(np.ceil(np.sqrt(right)))

    count = 0

    for x in range(1,er):
        for y in range(1,er):
    
            if x + y > np.sqrt(right):
                continue
      
            else:
                for z in range(1,er):
            
                    if (x + y > np.sqrt(right)) | (y + z > np.sqrt(right)) | (x + z > np.sqrt(right)):
                        continue
                    
                    else:
                        if (x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2 == 2*i:
                            count += 1
            
    print(count)     

Fixed submission:
n = int(input())
ans = [0 for a in range(10050)]


for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i*i+j*j+k*k+i*j+j*k+k*i;
      
      if v<10050:
        ans[v]+=1

for i in range(n):
  print(ans[i+1])
Buggy python submission (verdict: Runtime Error):
import numpy as np

X,N = map(int,input().split())

p_list = [int(n) for n in input().split()]

X_near = np.array(list(range(int(np.ceil(X - N/2)), int(np.floor(X + N/2)) + 1)))

remain_list = []

for i in X_near:
    if i not in p_list:
        remain_list.append(i)
        
remain_array = np.array(remain_list)
min_bool = np.abs(X - remain_array).min() == np.abs(X - remain_array)
print(remain_array[min_bool].min())

Fixed submission:
n_list = input().split()

print(n_list.index('0') + 1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
 
A_list = [int(n) for n in input().split()]
 
import numpy as np
 
A_array = np.array(A_list)
sort_A = np.sort(A_array)
 
XX = list()
 
for n in range(len(sort_A) - 1):
    
    r_list = list()
    
    for m in range(n+1):
        r_list.append(sort_A[n + 1] % sort_A[m] == 0)
       
    XX.append(np.array(r_list).sum() == 0)
    
XX_array = np.array(XX)        

if sort_A[0] == sort_A[1]:
    print(XX_array.sum())
    
else:
    print(XX_array.sum()+1)

Fixed submission:
N = int(input())
 
A_list = [int(n) for n in input().split()]
 
import numpy as np
 
A_array = np.array(A_list)
sort_A = np.sort(A_array)

n_array = np.zeros(10**6)
  
for a in sort_A:
    
    if n_array[a - 1] >= 2:
        continue
        
    a_times = np.array(range(a, 10**6+1, a))
    
    n_array[(a_times -1).astype(int)] += 1

print((n_array[sort_A - 1] == 1).sum())
Buggy python submission (verdict: Runtime Error):
import numpy as np 
 
N,K = map(int, input().split())
 
A_array = np.array(list(map(int, input().split())))
 
if K > 500:
   K = 500

for k in range(K):
 
    B_list = list()
 
    inf_array = np.array(range(N)) + 0.5 - A_array
    sup_array = np.array(range(N)) + 1.5 + A_array
        
    B_list = [((inf_array <= m+1) & (m+1<=sup_array)).sum() for m in range(N)]
 
    A_array = np.array(B_list)
    
print(' '.join(map(str, A_array)))    

Fixed submission:
S = input()
nick = str()
for n in range(3):
  nick = nick + S[n]    

print(nick)

Buggy python submission (verdict: Runtime Error):
import numpy as np 
 
N,K = map(int, input().split())
 
A_array = np.array(list(map(int, input().split())))
 
if K > 1000:
   K = 1000

for k in range(K):
 
    B_list = list()
 
    inf_array = np.array(range(N)) + 0.5 - A_array
    sup_array = np.array(range(N)) + 1.5 + A_array
        
    B_list = [((inf_array <= m+1) & (m+1<=sup_array)).sum() for m in range(N)]
 
    A_array = np.array(B_list)
    
print(' '.join(map(str, A_array)))    

Fixed submission:
S = input()
nick = str()
for n in range(3):
  nick = nick + S[n]    

print(nick)

Buggy python submission (verdict: Runtime Error):
import numpy as np 

N,K = map(int, input().split())

A_array = np.array(list(map(int, input().split())))

if K > 1000:
  K = 1000

for k in range(K):

    B_list = list()

    inf_array = np.array(range(N)) + 0.5 - A_array
    sup_array = np.array(range(N)) + 1.5 + A_array
        
    B_list = [((inf_array <= m+1) & (m+1<=sup_array)).sum() for m in range(N)]

    A_array = np.array(B_list)
    
print(' '.join(map(str, A_array)))    

Fixed submission:
S = input()
nick = str()
for n in range(3):
  nick = nick + S[n]    

print(nick)
Buggy python submission (verdict: Runtime Error):
d = int(input())

c = list(map(int,input().split()))

s = []

for _ in range(d):
    temp = list(map(int,input().split()))

    s.append(temp)

last = [0] * 26

for i in range(d):
    temp = [x - c[i] * day for i, (x, day) in  enumerate(zip(s[i], last))]

    print(temp.index(max(temp)) + 1)

    last = [x + 1 for x in last]

    last[i] = 0

Fixed submission:
d = int(input())

c = list(map(int,input().split()))

s = []

for _ in range(d):
    temp = list(map(int,input().split()))

    s.append(temp)

for i in range(d):
    print(s[i].index(max(s[i])) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())

a = list(map(int,input().split()))

q = int(input())

num_dict = dict(collections.Counter(a))
num_dict = {key : key * value for key, value in num_dict.items()}

for _ in range(q):
    b, c = map(int,input().split())

    num_dict[c] = int((c * num_dict.get(b, default=0) / b) + num_dict.get(c, default=0))

    if num_dict.get(b, default=0) != 0:
        del(num_dict[b])

    print(sum(num_dict.values()))

Fixed submission:
import collections

n = int(input())

a = list(map(int,input().split()))

q = int(input())

num_dict = dict(collections.Counter(a))

temp = [key * value for key, value in num_dict.items()]

ans = sum(temp)

for _ in range(q):
    b, c = map(int,input().split())

    if num_dict.get(b):
        num_dict[c] = num_dict[b] + num_dict.get(c, default=0)

        ans = ans - num_dict[b] * b + num_dict[b] * c

        del(num_dict[b])

    print(ans)
Buggy python submission (verdict: Runtime Error):
1, n = map(int,input().split())

if n != 0:
    p = list(map(int,input().split()))
else:
    p = []

result = []

i = 0

while len(result) == 0:
    if not (x - i in p):
        result.append(x - i)
    if not (x + i in p):
        result.append(x + i)
    
    i += 1

print(int(min(result)))

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

if n != 0:
    p = list(map(int,input().split()))
else:
    p = []

result = []

i = 0

while len(result) == 0:
    if not (x - i in p):
        result.append(x - i)
    if not (x + i in p):
        result.append(x + i)
    
    i += 1

print(int(min(result)))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate

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

a = list(map(int,input().split()))

for j in range(k):
    if j > 41:
        break

    b = [0] * n

    for i in range(n):
        b[max(0, i - a[i])] += 1
        
        if i + a[i] + 1 < n:
            b[i + a[i] + 1] -= 1

    a = list(accumulate(b))

print(*a)

Fixed submission:
from itertools import accumulate

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

a = list(map(int,input().split()))

for j in range(k):
    if j > 41:
        break

    b = [0] * n

    for i in range(n):
        b[max(0, i - a[i])] += 1
        
        if i + a[i] + 1 < n:
            b[i + a[i] + 1] -= 1

    a = list(accumulate(b))

print(*a)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

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

a = np.array(list(map(int,input().split())))

for j in range(k):
    if j > 41:
        break

    new_a = np.zeros(n, dtype=int)

    for i, x in enumerate(a):
        new_a[i-x if i-x >= 0 else 0:i+x + 1] += 1
   
    a = new_a

print(*a)

Fixed submission:
from itertools import accumulate

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

a = list(map(int,input().split()))

for j in range(k):
    if j > 41:
        break

    b = [0] * n

    for i in range(n):
        b[max(0, i - a[i])] += 1
        
        if i + a[i] + 1 < n:
            b[i + a[i] + 1] -= 1

    a = list(accumulate(b))

print(*a)

Buggy python submission (verdict: Runtime Error):
import numpy as np

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

a = list(map(int,input().split()))

light = np.zeros((n, n), dtype=int)

for _ in range(k):
    for i, arr in enumerate(light):
        x_1, x_2 = i - a[i], i + a[i] + 1

        if x_1 < 0:
            x_1 = 0

        arr[x_1:x_2] = 1
    a = light.sum(axis=0)

print(*list(a))

Fixed submission:
from itertools import accumulate

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

a = list(map(int,input().split()))

for j in range(k):
    if j > 41:
        break

    b = [0] * n

    for i in range(n):
        b[max(0, i - a[i])] += 1
        
        if i + a[i] + 1 < n:
            b[i + a[i] + 1] -= 1

    a = list(accumulate(b))

print(*a)

Buggy python submission (verdict: Runtime Error):
import numpy as np

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

a = list(map(int,input().split()))

light = np.zeros((n, n))

for _ in range(k):
    for i, arr in enumerate(light):
        x_1, x_2 = i - a[i], i + a[i] + 1

        if x_1 < 0:
            x_1 = 0

        arr[x_1:x_2] = 1
    a = light.sum(axis=0).astype(int)

print(*list(a))

Fixed submission:
from itertools import accumulate

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

a = list(map(int,input().split()))

for j in range(k):
    if j > 41:
        break

    b = [0] * n

    for i in range(n):
        b[max(0, i - a[i])] += 1
        
        if i + a[i] + 1 < n:
            b[i + a[i] + 1] -= 1

    a = list(accumulate(b))

print(*a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

a = list(map(int,input().split()))

result = 1

for x in a:
    result *= x

if result > 10 ** 18:
    result = -1

print(result)

Fixed submission:
n = int(input())

a = list(map(int,input().split()))

result = 1

if 0 in a:
    result = 0
else:
    for x in a:
        result *= x
        if result > 10 ** 18:
            result = -1
            break

print(result)
Buggy python submission (verdict: Runtime Error):
a_s, b_s = input().split()

a = int(a_s)
b = int(float(b_s) * 100)

print(int(str(a*b)[:-2]))

Fixed submission:
a_s, b_s = input().split()

b_s = b_s.replace(".", "")

s = str(int(a_s) * int(b_s))
if len(s) > 2:
    print(str(int(a_s) * int(b_s))[:-2])
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
a, b = map(int,input().split())

print(int(a * b))

Fixed submission:
a_s, b_s = input().split()

b_s = b_s.replace(".", "")

s = str(int(a_s) * int(b_s))
if len(s) > 2:
    print(str(int(a_s) * int(b_s))[:-2])
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())

a = list(map(int,input().split()))

tel_list = []

next_city = 0

city_have_been_to = set([0])

way = [0]

while k > 0:
    k -= 1
    temp = city_have_been_to.copy()

    next_city = a[next_city] - 1
    city_have_been_to.add(next_city)
    way.append(next_city)

    if temp == city_have_been_to:
        break

if k == 0:
    print(way[-1] + 1)
else:
    temp_index = way.index(next_city)
    print(way[temp_index:-1][k % len(way[temp_index:-1])] + 1)


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

a = list(map(int,input().split()))

tel_list = []

next_city = 0

city_have_been_to = set([0])

way = [0]

while k > 0:
    k -= 1
    temp = len(city_have_been_to)

    next_city = a[next_city] - 1
    city_have_been_to.add(next_city)
    way.append(next_city)

    if temp == len(city_have_been_to):
        break

if k == 0:
    print(way[-1] + 1)
else:
    temp_index = way.index(next_city)
    print(way[temp_index:-1][k % len(way[temp_index:-1])] + 1)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int,input().split())

h = list(map(int,input().split()))

a = {}

for _ in range(m):
    x1, x2 = map(int,input().split())

    if a.get(x1) is None:
        a[x1] = {x2}
    else:
        temp = a[x1].copy()
        temp.add(x2)
        a[x1] = temp
    
    if a.get(x2) is None:
        a[x2] = {x1}
    else:
        temp = a[x2].copy()
        temp.add(x1)
        a[x2] = temp

res = 0

for i in range(n):
    if a.get(i + 1) is None:
        res += 1
        continue

    flag = True

    temp = a[i + 1].copy()

    for j in temp:
        if h[i] <= h[j - 1]:
            flag = False

    if flag:
        res += 1

print(res)

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

h = list(map(int,input().split()))

res =  [True] * n

for _ in range(m):
    x1, x2 = map(int,input().split())

    if h[x1 - 1] <= h[x2 - 1]:
        res[x1 - 1] = False
    if h[x2 - 1] <= h[x1 - 1]:
        res[x2 - 1] = False

print(sum(res))
Buggy python submission (verdict: Runtime Error):
x = int(input())

n = 100

i = 0

while n < x:
    n = math.floor(n * 1.01)
    i += 1

print(i)

Fixed submission:

import math

x = int(input())

n = 100

i = 0

while n < x:
    n = math.floor(n * 1.01)
    i += 1

print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

dict_x = {"R":0, "G":1, "B":2}
s = [dict_x[s] for s in s]

result = 0

for i in range(n):
    for j in range(i + 1, n):
        if s[i] == s[j]:
            continue
        sum_ij = s[i] + s[j]
        for k in range(j + 1, n):
            if (j - i) != (k - j):
                if sum_ij + s[k] == 3:
                    result += 1

print(result)

Fixed submission:
n = int(input())
s = input()
 
r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')
 
ans = r_cnt * g_cnt * b_cnt
 
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] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
 
print(ans)

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

dict_x = {"R":1, "G":2, "B":3}
s = [dict_x[s] for s in s]

result = 0

for i in range(n):
    for j in range(i + 1, n):
        if s[i] == s[j]:
            continue
        for k in range(j + 1, n):
            if (j - i) != (k - j):
                if s[i] * s[j] * s[k] == 6:
                    result += 1

print(result)

Fixed submission:
n = int(input())
s = input()
 
r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')
 
ans = r_cnt * g_cnt * b_cnt
 
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] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
 
print(ans)

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

dict_x = {"R":1, "G":2, "B":3}
s = [dict_x[s] for s in s]

result = 0

for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if (j - i) != (k - j):
                if s[i] * s[j] * s[k] == 6:
                    result += 1

print(result)


Fixed submission:
n = int(input())
s = input()
 
r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')
 
ans = r_cnt * g_cnt * b_cnt
 
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] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
 
print(ans)
Buggy python submission (verdict: Runtime Error):
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())

print(l[k])

Fixed submission:
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input()) - 1

print(l[k])