Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
inp = list(map(str,input().split()))
a = int(inp[0])
b = float(inp[1])
#print(a)
#print(b)
bb = int(b * 100)
print(int(a * bb / 100))
#prod = 1
#overflow = False
#
#a = list(map(int,input().split()))
#
#for aa in a:
#  if prod * aa > 1000000 * 1000000 * 1000000:
#    overflow = True
#  else:
#    prod = prod * aa
#
#for aa in a:
#  if aa == 0:
#    overflow = False
#
#if overflow:
#  print(-1)
#else:
#  print(prod)



Fixed submission:
import sys
n = int(input())
#print(n)
prod = 1
overflow = False

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

for aa in a:
  if prod * aa > 1000000 * 1000000 * 1000000:
    overflow = True
  else:
    prod = prod * aa

for aa in a:
  if aa == 0:
    overflow = False

if overflow:
  print(-1)
else:
  print(prod)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
arr=list(map(int,input().split()))
temp=[0]*n
temp[n-2]=abs(arr[n-2]-arr[n-1])
if n>=3:
    i=n-3
    while i>=0:
        idx=i
        count=0
        min1=999999999999
        for j in range(idx+1,n):
            min1=min(min1,abs(arr[j]-arr[idx])+temp[j])
            count+=1
            if count==k:
                break
        temp[idx]=min1
        i-=1
print(temp[0])

Fixed submission:
n,k=map(int,input().split())
arr=list(map(int,input().split()))
temp=[0]*n
temp[n-2]=abs(arr[n-2]-arr[n-1])
if n>=3:
    i=n-3
    while i>=0:
        idx=i
        count=0
        temp1=[]
        for j in range(idx+1,n):
            temp1.append(abs(arr[j]-arr[idx])+temp[j])
            count+=1
            if count==k:
                break
        temp[idx]=min(temp1)
        i-=1
print(temp[0])

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
arr=list(map(int,input().split()))
temp=[0]*n
temp[n-2]=abs(arr[n-2]-arr[n-1])
if n>=3:
    i=n-3
    while i>=0:
        idx=i
        count=0
        temp1=[]
        for j in range(idx+1,n):
            temp1.append(abs(arr[j]-arr[idx])+temp[j])
            count+=1
            if count==k:
                break
        temp[idx]=min(temp1)
        i-=1
print(temp[0])

Fixed submission:
n,k=map(int,input().split())
arr=list(map(int,input().split()))
temp=[0]*n
temp[n-2]=abs(arr[n-2]-arr[n-1])
if n>=3:
    i=n-3
    while i>=0:
        idx=i
        count=0
        temp1=[]
        for j in range(idx+1,n):
            temp1.append(abs(arr[j]-arr[idx])+temp[j])
            count+=1
            if count==k:
                break
        temp[idx]=min(temp1)
        i-=1
print(temp[0])
Buggy python submission (verdict: Runtime Error):
N = input()
if N % 10 == 3:
  print('bon')
elif N % 10 == 0:
  print('pon')
elif N % 10 == 1:
  print('pon') 
elif N % 10 == 6:
  print('pon')
elif N % 10 == 8:
  print('pon')  
else:
  print('hon')
 

Fixed submission:
N = int(input())
if N % 10 == 3:
  print('bon')
elif N % 10 == 0:
  print('pon')
elif N % 10 == 1:
  print('pon') 
elif N % 10 == 6:
  print('pon')
elif N % 10 == 8:
  print('pon')  
else:
  print('hon')

Buggy python submission (verdict: Runtime Error):
N = input()
if N % 10 == 3:
  print('bon')
elif N % 10 ==0:
  print('pon')
elif N % 10 ==1:
  print('pon') 
elif N % 10 ==6:
  print('pon')
elif N % 10 ==8:
  print('pon')  
else:
  print('hon')
 

Fixed submission:
N = int(input())
if N % 10 == 3:
  print('bon')
elif N % 10 == 0:
  print('pon')
elif N % 10 == 1:
  print('pon') 
elif N % 10 == 6:
  print('pon')
elif N % 10 == 8:
  print('pon')  
else:
  print('hon')
Buggy python submission (verdict: Runtime Error):
a,b,c = list(map(int, input(),split()))
print(c,a,b)

Fixed submission:
a,b,c = list(map(int, input().split()))
print(c,a,b)

Buggy python submission (verdict: Runtime Error):
a = list(map(str, input(),split()))
print(a[2],a[0],a[1])

Fixed submission:
a,b,c = list(map(int, input().split()))
print(c,a,b)

Buggy python submission (verdict: Runtime Error):
a = list(map(int, input(),split()))
print(a[2],a[0],a[1])

Fixed submission:
a,b,c = list(map(int, input().split()))
print(c,a,b)
Buggy python submission (verdict: Runtime Error):
A = input()
B = print(A.count('o'))
print(700+int(B)*100)

Fixed submission:
A = input()
B = A.count('o')
print(700+int(B)*100)

Buggy python submission (verdict: Runtime Error):
N = input()
s = 0
 for i in range(0,len(N)):
  if N[i] == "o":
    s = s + 1
print(700 + 100 * s)    


Fixed submission:
A = input()
B = A.count('o')
print(700+int(B)*100)

Buggy python submission (verdict: Runtime Error):
N = input()
s = 0
 for i in range(0,2):
  if N[i] == "o":
    s = s + 1
print(700+100*int(s))    


Fixed submission:
A = input()
B = A.count('o')
print(700+int(B)*100)

Buggy python submission (verdict: Runtime Error):
N = input()
s = 0
 for i in range(0,2):
  if N[i] == "o":
    s = s + 1
print(700+100*s)    

Fixed submission:
A = input()
B = A.count('o')
print(700+int(B)*100)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=int(input())
if N % 500 <== A:
  print("Yes")
else:
  print("No")

Fixed submission:
N=int(input())
A=int(input())
if N % 500 <= A:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N = list(map(int,input().split()))
math = N[0] * N[1]
 if math % 2 == 1:
  print("Odd")
 else:
  print("Even")

Fixed submission:
N = list(map(int,input().split()))
math = N[0] * N[1]
if math % 2 == 1:
  print("Odd")
else:
  print("Even")

Buggy python submission (verdict: Runtime Error):
N = list(map(int,input().split()))
math = N[0] * N[1]
 if math % 2 == 1:
  return "Odd"
 else:
  return "Even"

Fixed submission:
N = list(map(int,input().split()))
math = N[0] * N[1]
if math % 2 == 1:
  print("Odd")
else:
  print("Even")

Buggy python submission (verdict: Runtime Error):
N = list(map(int,input().split()))
math = N[0] * N[1]
 if math % 2 == 1:
  return Odd
 else: 
  return Even

Fixed submission:
N = list(map(int,input().split()))
math = N[0] * N[1]
if math % 2 == 1:
  print("Odd")
else:
  print("Even")

Buggy python submission (verdict: Runtime Error):
N = list(map(int,input().split()))
math = N[0] * N[1]
 if math % 2 == 1
 return Odd
 else 
 return Even

Fixed submission:
N = list(map(int,input().split()))
math = N[0] * N[1]
if math % 2 == 1:
  print("Odd")
else:
  print("Even")

Buggy python submission (verdict: Runtime Error):
N = list(map(int,input().split()))
math = N[0] * N[1]
 if math % 2 = 1
  return Odd
 else 
  return Even

Fixed submission:
N = list(map(int,input().split()))
math = N[0] * N[1]
if math % 2 == 1:
  print("Odd")
else:
  print("Even")

Buggy python submission (verdict: Runtime Error):
N = list(map(int,input().split()))
math = N[0] * N[1]
 if math % 2 == 1
  return Odd
 else 
  return Even

Fixed submission:
N = list(map(int,input().split()))
math = N[0] * N[1]
if math % 2 == 1:
  print("Odd")
else:
  print("Even")

Buggy python submission (verdict: Runtime Error):
N = list(map(int,input().split))
math = N[0] * N[1]
 if math % 2 == 1
  return Odd
 else 
  return Even

Fixed submission:
N = list(map(int,input().split()))
math = N[0] * N[1]
if math % 2 == 1:
  print("Odd")
else:
  print("Even")
Buggy python submission (verdict: Runtime Error):
A = list(map(int,input().split))
B = (A[0]+A[1])/2
if B >= int(B):
  print(int(B)+1)
else:
  print(int(B))

Fixed submission:
A = list(map(int,input().split()))
B = (A[0]+A[1])/2
if B > int(B):
  print(int(B)+1)
else:
  print(int(B))

Buggy python submission (verdict: Runtime Error):
A = list(map(int,input().split))
B = (A[0]+A[1])/2
if B >= int(B):
  print(int(B)+1)
else:
  print(B)

Fixed submission:
A = list(map(int,input().split()))
B = (A[0]+A[1])/2
if B > int(B):
  print(int(B)+1)
else:
  print(int(B))

Buggy python submission (verdict: Runtime Error):
A = list(map(int,input().split))
B = (A[0]+A[1])/2
if B <= int(B):
  print(int(B)+1)
else:
  print(B)

Fixed submission:
A = list(map(int,input().split()))
B = (A[0]+A[1])/2
if B > int(B):
  print(int(B)+1)
else:
  print(int(B))
Buggy python submission (verdict: Runtime Error):
A = input()
s = 0
for i in range(1,3):
  if A[i]="1":
    s = s + 1
print(s)    

Fixed submission:
A = input()
s = 0
for i in range(len(A)):
  if A[i]=="1":
    s = s + 1
print(s)

Buggy python submission (verdict: Runtime Error):
A = input()
s = 0
for i in range(0,3):
  if A[i]="1":
    s = s + 1
print(s)    

Fixed submission:
A = input()
s = 0
for i in range(len(A)):
  if A[i]=="1":
    s = s + 1
print(s)

Buggy python submission (verdict: Runtime Error):
A = input()
s = 0
for i in range(0,2):
  if A[i]="1":
    s = s + 1
print(s)    

Fixed submission:
A = input()
s = 0
for i in range(len(A)):
  if A[i]=="1":
    s = s + 1
print(s)

Buggy python submission (verdict: Runtime Error):
A = int(input())
s = 0
for i in range(0,2):
  if A[i]==1:
    s = s +1
print(s)    

Fixed submission:
A = input()
s = 0
for i in range(len(A)):
  if A[i]=="1":
    s = s + 1
print(s)

Buggy python submission (verdict: Runtime Error):
N = input()
s = 0
for i in range(0,2):
  if N[i] = 1:
    s = s + 1
print(s)

Fixed submission:
A = input()
s = 0
for i in range(len(A)):
  if A[i]=="1":
    s = s + 1
print(s)

Buggy python submission (verdict: Runtime Error):
N = int(input())
s = 0
for i in range(0,2):
if N[i] = 1:
    s = s + 1
print(s)
   

Fixed submission:
A = input()
s = 0
for i in range(len(A)):
  if A[i]=="1":
    s = s + 1
print(s)

Buggy python submission (verdict: Runtime Error):
N = int(input())
s = 0
for i in range(0,2):
  if N[i] = 1:
    s = s + 1
print(s)
   

Fixed submission:
A = input()
s = 0
for i in range(len(A)):
  if A[i]=="1":
    s = s + 1
print(s)

Buggy python submission (verdict: Runtime Error):
N = str(input())
s = 0
for i in range(0,2):
  if N[i] = 1:
    s = s + 1
print(s)
   


Fixed submission:
A = input()
s = 0
for i in range(len(A)):
  if A[i]=="1":
    s = s + 1
print(s)
Buggy python submission (verdict: Runtime Error):
N = int(input())
M = list(map(int,input().split()))for _ in range(N)
sum = o
for i in range(N):
  sum = sum + M[i][1]-M[i][0]+1
print(sum)  

Fixed submission:
N = int(input())
M = [list(map(int,input().split()))for _ in range(N)]
sum = 0
for i in range(N):
  sum = sum + M[i][1]-M[i][0]+1
print(sum)
Buggy python submission (verdict: Runtime Error):
S = input()
print(S[0]+ len(S) + S[-1])

Fixed submission:
S = input()
T = len(S)-2
print(S[0]+ str(T) + S[-1])

Buggy python submission (verdict: Runtime Error):
S = int()
print(S[0]+ len(S) + S[-1])

Fixed submission:
S = input()
T = len(S)-2
print(S[0]+ str(T) + S[-1])

Buggy python submission (verdict: Runtime Error):
s=input()
print(s[0]+str((len(s)-2)+s[-1])
               

Fixed submission:
S = input()
T = len(S)-2
print(S[0]+ str(T) + S[-1])
Buggy python submission (verdict: Runtime Error):
S=input()
print("A"+s[0]+"C")

Fixed submission:
a,b,c = map(str,input().split())
print(a[0]+b[0]+c[0])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
limit = 10**18
A = list(map(int, input().split()))
ans = 1
for i in A:
    ans = ans*i
print(ans if ans <= limit else -1)

Fixed submission:
# %%time
from numba import njit
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))


@njit
def f(A):
    ans = 1
    limit = 10**18
    if np.sum(A == 0) > 0:
        return 0
    elif np.sum(np.log10(A)) > 18:
        return -1
    for i in A:
        ans = ans*i
    return ans if ans<=limit else -1



print(int(f(A)))
Buggy python submission (verdict: Time Limit Exceeded):

import numpy as np
N, K = map(int, input().split())
dst = np.array(list(map(int, input().split())),dtype=int)

# N = 200000
# K = 10**18
# dst = np.array(list(range(2, N+1))+[1], dtype=int)

log = np.full(N, -1, dtype=int)
log[0] = 1
current = 1
for i in range(1, K+1):
    current = dst[current-1]
    if np.count_nonzero(log == current) != 0:
        loop_start_ind = np.where(log == current)[0][0]
        loop_len = i-loop_start_ind
        current = log[loop_start_ind+(K-i) % loop_len]
        break
    else:
        log[i] = current
print(current)

Fixed submission:
N, K = map(int, input().split())
dst = list(map(int, input().split()))
log = [1]
log_set=set(log)
current = 1
for i in range(1, K+1):
    current = dst[current-1]
    if current in log_set:
        loop_start_ind = log.index(current)
        loop_len = i-loop_start_ind
        current = log[loop_start_ind+(K-i) % loop_len]
        break
    else:
        log.append(current)
        log_set.add(current)
print(current)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
dst = list(map(int, input().split()))
log = [1]
current = 1
for i in range(1, K+1):
    current = dst[current-1]
    if current in log:
        loop_start_ind = log.index(current)
        loop_len = i-loop_start_ind
        current = log[loop_start_ind+(K-i) % loop_len]
        break
    else:
        log.append(current)
print(current)

Fixed submission:
N, K = map(int, input().split())
dst = list(map(int, input().split()))
log = [1]
log_set=set(log)
current = 1
for i in range(1, K+1):
    current = dst[current-1]
    if current in log_set:
        loop_start_ind = log.index(current)
        loop_len = i-loop_start_ind
        current = log[loop_start_ind+(K-i) % loop_len]
        break
    else:
        log.append(current)
        log_set.add(current)
print(current)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
peaks = list(map(int, input().split()))
ng_peaks = set([])
for j in range(M):
    A_j, B_j = map(int, input().split())
    if peaks[A_j-1] >= peaks[B_j-1]:
        ng_peaks.add(B_j)
    if peaks[A_j-1] =< peaks[B_j-1]:
        ng_peaks.add(A_j)
print(N-len(ng_peaks))

Fixed submission:
N, M = map(int, input().split())
peaks = list(map(int, input().split()))
ng_peaks = set([])
for j in range(M):
    A_j, B_j = map(int, input().split())
    if peaks[A_j-1] >= peaks[B_j-1]:
        ng_peaks.add(B_j)
    if peaks[A_j-1] <= peaks[B_j-1]:
        ng_peaks.add(A_j)
print(N-len(ng_peaks))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
lst = [0]*N
for i in A:
    joushi = A[i]
    lst[joushi-1] += 1
for syainn in lst:
    print(syainn)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
lst = [0]*N
for i in A:
    lst[i-1] += 1
for syainn in lst:
    print(syainn)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
sentense = input()
ans = 0
for i, s_i in enumerate(sentense):
    for j, s_j in enumerate(sentense[i+1:]):
        if s_j == s_i:
            continue
        else:
            for k, s_k in enumerate(sentense[i+j+2:]):
                if s_k == s_i or s_k == s_j:
                    continue
                else:
                    if j != k:
                        ans += 1
print(ans)

Fixed submission:
N = int(input())
sentense = input()
count_1 = sentense.count("R")*sentense.count("G")*sentense.count("B")
count_1_and_not_2 = 0
for i in range(N):
    for j in range(i+1, N):
        k = (j-i)+j
        if k >= N:
            break
        if sentense[i] != sentense[j] and sentense[j] != sentense[k] and sentense[k] != sentense[i]:
            count_1_and_not_2 += 1

print(count_1-count_1_and_not_2)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
sentense = input()
ans = 0
for i, s_i in enumerate(sentense):
    for j, s_j in enumerate(sentense):
        if j <= i:
            continue
        else:
            if s_j == s_i:
                continue
            else:
                for k, s_k in enumerate(sentense):
                    if k <= j:
                        continue
                    else:
                        if s_k ==s_i or s_k==s_j:
                            continue
                        else:
                            if j-i != k-j:
                                ans += 1
print(ans)

Fixed submission:
N = int(input())
sentense = input()
count_1 = sentense.count("R")*sentense.count("G")*sentense.count("B")
count_1_and_not_2 = 0
for i in range(N):
    for j in range(i+1, N):
        k = (j-i)+j
        if k >= N:
            break
        if sentense[i] != sentense[j] and sentense[j] != sentense[k] and sentense[k] != sentense[i]:
            count_1_and_not_2 += 1

print(count_1-count_1_and_not_2)
Buggy python submission (verdict: Time Limit Exceeded):
def aoki_fun(x, k):
    return x-k if x-k >= 0 else k-x


N, K = map(int, input().split())
min_N = N
while(1):
    N = aoki_fun(N, K)
    if N < min_N:
        min_N = N

    else:
        break
print(min_N)


Fixed submission:
N,K=map(int, input().split())
tmp=N%K
print(min(tmp,K-tmp))
Buggy python submission (verdict: Runtime Error):
from numba import njit
import numpy as np
N, X, Y = map(int, input().split())
@njit
def f(N,X,Y):
    k_list = np.zeros(shape=N-1,dtype=np.int8)
    for i in range(1, N+1):
        for j in range(i+1, N+1):
            min_dst = min((j-i, abs(i-X)+1+abs(j-Y), abs(i-Y)+1+abs(j-X)))
            k_list[min_dst-1] += 1
    return k_list
ans=f(N,X,Y)
for i in ans:
    print(i)

Fixed submission:
N, X, Y = map(int, input().split())
k_list = [0]*(N-1)
for i in range(1, N+1):
    for j in range(i+1, N+1):
        min_dst = min((j-i, abs(i-X)+1+abs(j-Y), abs(i-Y)+1+abs(j-X)))
        k_list[min_dst-1] += 1
for i in k_list:
    print(i)

Buggy python submission (verdict: Runtime Error):
from numba import njit
import numpy as np
N, X, Y = map(int, input().split())
@njit
def f(N,X,Y):
    k_list = np.zeros(shape=N-1,dtype=np.int8)
    for i in range(1, N+1):
        for j in range(i+1, N+1):
            min_dst = min((j-i, abs(i-X)+1+abs(j-Y), abs(i-Y)+1+abs(j-X)))
            k_list[min_dst-1] += 1
    for i in k_list:
        print(i)
f(N,X,Y)

Fixed submission:
N, X, Y = map(int, input().split())
k_list = [0]*(N-1)
for i in range(1, N+1):
    for j in range(i+1, N+1):
        min_dst = min((j-i, abs(i-X)+1+abs(j-Y), abs(i-Y)+1+abs(j-X)))
        k_list[min_dst-1] += 1
for i in k_list:
    print(i)
Buggy python submission (verdict: Runtime Error):
# %%time
import numpy as np
# N = 200000
# A_npa = np.arange(N, dtype=np.int32)
N = int(input())
A_npa = np.array(list(map(int, input().split())))
total = 0
A_unique, inverse, counts = np.unique(
    A_npa, return_inverse=True, return_counts=True)
counts = np.sum(counts*(counts-1)//2)-(counts-1)
for i in inverse:
    print(counts[i])

Fixed submission:
import collections
N = int(input())
A_list = list(map(int, input().split()))
A_collection=collections.Counter(A_list)
total=0
for i in A_collection.values():
    total+=i*(i-1)//2
for k in A_list:
    print(total-(A_collection[k]-1))

Buggy python submission (verdict: Time Limit Exceeded):
# %%time
# N = 20000
# A_list = list(range(N))
N = int(input())
A_list = list(map(int, input().split()))
total = 0
A_counts = []
for i in range(1, N+1):
    i_count = A_list.count(i)
    A_counts.append(i_count)
    total += i_count*(i_count-1)//2
for k in range(N):
    A_k_count = A_counts[A_list[k]-1]
    print(total-(A_k_count-1))

Fixed submission:
import collections
N = int(input())
A_list = list(map(int, input().split()))
A_collection=collections.Counter(A_list)
total=0
for i in A_collection.values():
    total+=i*(i-1)//2
for k in A_list:
    print(total-(A_collection[k]-1))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
S = deque(input())
Q = int(input())
for i in range(Q):
    Q_i = list(input().split())
    if Q_i[0] == "1":
        S.reverse()
    elif Q_i[1] == "1":
        S.appendleft(Q_i[2])
    else:
        S.append(Q_i[2])
print("".join(S))

Fixed submission:
from collections import deque
S = deque(input())
Q = int(input())
reverse_count = 0
for i in range(Q):
    Q_i = list(input().split())
    if Q_i[0] == "1":
        reverse_count += 1
    elif ((Q_i[1] == "1" and reverse_count % 2 == 0) or
          (Q_i[1] == "2" and reverse_count % 2 == 1)):
        S.appendleft(Q_i[2])
    else:
        S.append(Q_i[2])
if reverse_count%2==1:
    S.reverse()
print("".join(S))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
keihinn_list = []
for i in range(n):
    keihinn_list.append(input())
keihinn_list.sort()
count = 0

while True:
    if len(keihinn_list) == 0:
        break
    else:
        keihinn = keihinn_list[0]
        a = keihinn_list.count(keihinn)
        keihinn_list = keihinn_list[a:]
        count += 1

print(count)


Fixed submission:
n = int(input())
keihinn_list = []
for i in range(n):
    keihinn_list.append(input())
keihinn_list = set(keihinn_list)

print(len(keihinn_list))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = list(map(int, input().split()))
a_list2 = a_list

c = a_list2.count(1)
a_list2 = a_list2[c:]
print(c)

for i in range(n-1):
    a_buka = a_list[i] + 1
    count = a_list2.count(a_buka)
    a_list2 = a_list2[count:]
    print(count)


Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
ans = [0] * n

for a in a_list:
    ans[a-1] += 1

for i in ans:
    print(i)

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

c = a_list2.count(1)
a_list2 = [i for i in a_list2 if i != 1]
print(c)

for i in range(n-1):
    a_buka = a_list[i] + 1
    count = a_list2.count(a_buka)
    a_list2 = [j for j in a_list2 if j != a_buka]
    print(count)


Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
ans = [0] * n

for a in a_list:
    ans[a-1] += 1

for i in ans:
    print(i)

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

ans = [0] * n
c = a_list2.count(1)
a_list2 = [i for i in a_list2 if i != 1]
ans[0] = c

for i in range(n-1):
    a_buka = a_list[i] + 1
    count = a_list2.count(a_buka)
    a_list2 = [j for j in a_list2 if j != a_buka]
    ans[i+1] = count

for x in ans:
    print(x)


Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
ans = [0] * n

for a in a_list:
    ans[a-1] += 1

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

count = 0

for i in range(n-3):
    for j in range(i+1, n-1):
        if s[i] == s[j]:
            continue
        else:
            for k in range(j+1, n):
                if j - i == k - j:
                    continue
                else:
                    if s[i] == s[k] or s[j] == s[k]:
                        continue
                    else:
                        count += 1

print(count)


Fixed submission:
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]:continue
            count -= 1

print(count)

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

count = 0

for i in range(n-3):
    for j in range(i+1, n-1):
        if s[i] == s[j]:
            continue
        for k in range(j+1, n):
            if s[i] == s[k] or s[j] == s[k]:
                continue
            else:
                if j - i == k - j:
                    continue
                else:
                    count += 1

print(count)


Fixed submission:
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]:continue
            count -= 1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
min = n + 1

while True:
    if n < min:
        min = n
        n = abs(n - k)
    else:
        break

print(min)


Fixed submission:
n,k = map(int, input().split())
min = n + 1
if n >= k:
    n = n % k
    
while True:
    if n < min:
        min = n
        n = abs(n - k)
    else:
        break

print(min)