Harryxun/stf_run huggingface dataset:
import math
N = int(input())
a_list = [int(x) for x in input().split()]
b_list = [0] * N
for i in range(len(a_list), 0, -1):
    if (a_list[i-1] != b_list[i-1]):
        b_list[i-1] ^= 1
        if (i >= 2):
            b_list[0] ^= 1
            for j in range(2, int(math.sqrt(i)+1)):
                if i % j == 0:
                    b_list[j-1] ^= 1
                    b_list[i//j-1] ^= 1
ans = []
cnt = 0
for i, b in enumerate(b_list):
    if (b):
        cnt += 1
        ans.append(str(b))
print(cnt)
if (cnt):
    print(" ".split(ans))


### FIXED CODE ###

N = int(input())
a_list = [int(x) for x in input().split()]
cnt = 0
b_list = set()
for i in range(len(a_list), 0, -1):
    tmp = 0
    for j in range(i*2, N+1, i):
        tmp ^= (j in b_list)
    if (tmp != a_list[i-1]):
        b_list.add(i)
M = len(b_list)
print(M)
if (M>0):
    print(" ".join([str(b) for b in b_list]))
n = int(input())
a = list(map(int, input().split()))
b = list(set(a))

if sum(a) == 0:
    pass
elif a.count(max(b)) == 2*n/3 and a.count(0) == n/3:
    pass
elif b[0] ^ b[1] == b[2]:
    pass
else:
    print("No")
    exit()
    
print("Yes")

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = list(set(a))

if len(b) != 3:
    if sum(a) == 0:
        pass
    elif a.count(max(b)) == 2*n/3 and a.count(0) == n/3:
        pass
    else:
        print("No")
        exit()
else:
    if b[0] ^ b[1] == b[2] and a.count(b[0]) == a.count(b[1]) == a.count(b[2]):
        print("Yes")
        exit()
    else:
        print("No")
        exit()
        
print("Yes")
A,B=map(int,input().split())
print((A-1)*(B-1)))


### FIXED CODE ###

A,B=map(int,input().split())
print((A-1)*(B-1))
from sys import stdin
input = stdin.readline

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

ans = 100 ** D * N

if N == 100:
    ans += 100　** D

print(ans)


### FIXED CODE ###

from sys import stdin
input = stdin.readline

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

ans = 100 ** D * N

if N == 100:
    ans += 100 ** D

print(ans)
class SegTree:

    def __init__(self, init_val, n, ide_ele, seg_func):
        self.segfunc = seg_func
        self.num = 2**(n-1).bit_length()
        self.ide_ele = ide_ele
        self.seg=[self.ide_ele]*2*self.num
        for i in range(n):
            self.seg[i+self.num-1]=init_val[i]    
        for i in range(self.num-2,-1,-1) :
            self.seg[i]=self.segfunc(self.seg[2*i+1],self.seg[2*i+2]) 
        
    def update(self, k, x):
        k += self.num-1
        self.seg[k] = x
        while k+1:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[k*2+1],self.seg[k*2+2])
        
    def query(self, p, q):
        if q<=p:
            return self.ide_ele
        p += self.num-1
        q += self.num-2
        res=self.ide_ele
        while q-p>1:
            if p&1 == 0:
                res = self.segfunc(res,self.seg[p])
            if q&1 == 1:
                res = self.segfunc(res,self.seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res,self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res,self.seg[p]),self.seg[q])
        return res

n = int(input())
xs = list(map(int, input().split()))
x2i = {}
for i, x in enumerate(xs):
    x2i[x] = i
ss1 = SegTree([n] * n, n, n, min)
ss2 = SegTree([-1] * n, n, -1, max)

r = 0
for x in range(n):
    x = n - x
    rmi2 = ss1.query(x2i[x]+1, n)
    if rmi2 != n:
        ss1.update(rmi2, n)
    rmi = ss1.query(x2i[x]+1, n)
    if rmi2 != n:
        ss1.update(rmi2, rmi2)

    lmi = ss2.query(0, x2i[x])
    if lmi != -1:
        ss2.update(lmi, -1)
    lmi2 = ss2.query(0, x2i[x])
    if lmi != -1:
        ss2.update(lmi, lmi)
    a,b,c,d =(x2i[x] - lmi), (lmi - lmi2), (rmi - rmi2), (rmi2 - x2i[x])
    r += (a*c + b*d) * x
#    print(x, r)
#    print(rmi, rmi2, lmi, lmi2)
    ss1.update(x2i[x], x2i[x])
    ss2.update(x2i[x], x2i[x])
print(r)


### FIXED CODE ###

print(pow(int(input()), 3))
n = int(input()) 
lst = [int(i) for i in input().split()]
while(1):
    hps = sorted(hps)
    #print(hps)
    if(hps[0]==0): break
    hps[1] = hps[1] - hps[0]
print(hps[1])

### FIXED CODE ###

def gcd(a,b):
    r = a%b
    #print(a,b,r)
    if(r==0): return b
    return gcd(b,r)
n = int(input()) 
#n=4
hps = [int(i) for i in input().split()]
#lst = [2, 2, 8, 40]
#lst = [5, 13, 8, 1000000000]
#lst = [0, 1, 0]
    ##2 4 5 -> 1
    ## minと全ての要素のgcd
hps = sorted(hps)
for i in range(1,n):
    hps[0] = gcd(hps[i], hps[0])
#print(hps)
for i in range(len(hps)):
    if(hps[i]==0): continue
    print(hps[i])
    break
#D
n, k = map(int(), input().split())
r, s, p = map(int(), input().split())
t = list(input())
# g=r点 t=s点 p=p点
ans = 0
for i in range(n):
    if t[i] == "r":
        if i >= k and t[i - k] == "r":
            t[i] = 'm'#iの手以外の手
        else:
            ans += p
    if t[i] == "t":
        if i >= k and t[i - k] == "t":
            t[i] = 'm'
        else:
            ans += r
    if t[i] == "p":
        if i >= k and t[i - k] == "p":
            t[i] = 'm'
        else:
            ans += s
print(ans)

### FIXED CODE ###

#D
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())

# r=r点 s=s点 p=p点
ans = 0
for i in range(n):
    if t[i] == "r":
        if i >= k and t[i - k] == "r":
            t[i] = 'm'#iの手以外の手
        else:
            ans += p
    if t[i] == "s":
        if i >= k and t[i - k] == "s":
            t[i] = 'm'
        else:
            ans += r
    if t[i] == "p":
        if i >= k and t[i - k] == "p":
            t[i] = 'm'
        else:
            ans += s
print(ans)
from functools import reduce
import math

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input().rstrip())
    T = []
    for i in range(N):
        T.append(int(input().rstrip()))    
    print(lcm_list(T))
    
if __name__ == '__main__':
    main()


### FIXED CODE ###

from functools import reduce
import fractions

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input().rstrip())
    T = []
    for i in range(N):
        T.append(int(input().rstrip()))    
    print(lcm_list(T))
    
if __name__ == '__main__':
    main()
#!/usr/bin/python

import math
import sys

pi =3.141592653589

r = int(raw_input())

area = r * r * pi
length = 2 * r * pi

print str(area) + " " + str(length) + "\n"

sys.exit()

### FIXED CODE ###

import math
n = input()
S = '%.6f' % (float(n)**2 * math.pi)
L = '%.6f' % (float(n) * 2 * math.pi)
print "{} {}".format(S,L)
import queue

N = int(input())

# Adjacency matrix
e = [[] for i in range(N+1)]
for i in range(N-1):
    a, b = map(int, input().split())
    e[a].append(b)
    e[b].append(a)

even_v = []
odd_v = []

is_reached = [False] * (N+1)
q = queue.Queue()
# [start vertex, total distance]
q.put([1, 0])

# BFS
while not q.empty():
    v, d = q.get()
    if is_reached[v]:
        continue
    is_reached[v] = True
    
    if d%2 == 0:
        even_v.append(v)
    else:
        odd_v.append(v)

    for tv in e[v]:
        q.put([tv, d+1])

# Remainder lists [1..N] mod 3
r1 = list(range(1, N+1, 3))
r2 = list(range(2, N+1, 3))
r3 = list(range(3, N+1, 3))

p = [0] * N
if len(even_v) <= len(r3):
    # Embed r3 in even_v
    for v in even_v:
        p[v-1] = r3.pop()
elif len(odd_v) <= len(r3):
    # Embed r3 in odd_v
    for v in odd_v:
        p[v-1] = r3.pop()
else:
    # Embed r1 in even_v
    for v in even_v:
        if not r1:
            break
        p[v-1] = r1.pop()
    # Embed r2 in odd_v
    for v in odd_v:
        if not r2:
            break
        p[v-1] = r2.pop()

# Collect unused vertexes
rv = []
rv.extend(r1)
rv.extend(r2)
rv.extend(r3)
for i in enumerate(p):
    if p[i] == 0:
        p[i] = rv.pop()

ans = ' '.join(list(map(str, p)))
print(ans)


### FIXED CODE ###

import queue

N = int(input())

e = [[] for i in range(N+1)]
for i in range(N-1):
    a, b = map(int, input().split())
    e[a].append(b)
    e[b].append(a)

even_v = []
odd_v = []

is_reached = [False] * (N+1)
q = queue.Queue()
# [start vertex, total distance]
q.put([1, 0])

# BFS
while not q.empty():
    v, d = q.get()
    if is_reached[v]:
        continue
    is_reached[v] = True
    
    if d%2 == 0:
        even_v.append(v)
    else:
        odd_v.append(v)

    for tv in e[v]:
        q.put([tv, d+1])

r1 = list(range(1, N+1, 3))
r2 = list(range(2, N+1, 3))
r3 = list(range(3, N+1, 3))

ans = [0] * N
if len(even_v) <= len(r3):
    for v in even_v:
        ans[v-1] = r3.pop()
elif len(odd_v) <= len(r3):
    for v in odd_v:
        ans[v-1] = r3.pop()
else:
    for v in even_v:
        if not r1:
            break
        ans[v-1] = r1.pop()
    for v in odd_v:
        if not r2:
            break
        ans[v-1] = r2.pop()
rv = []
rv.extend(r1)
rv.extend(r2)
rv.extend(r3)
for i, p in enumerate(ans):
    if p == 0:
        ans[i] = rv.pop()

print(' '.join(list(map(str, ans))))
size = input()
sum = 0
for i in range(int(size)):
    x = input()
    x = float(x)
    u = input()
    if(u == "BTC"):
        x *= 380000
    sum += x
print(sum)

### FIXED CODE ###

size = input()
sum = 0
for i in range(int(size)):
    x,u = input().split()
    x = float(x)
    if(u == "BTC"):
        x *= 380000
    sum += x
print(sum)
n = int(input())
values = list(map(int, input().split()))
minv = min(vs)+1
print(1)
i = 2
ng_value = [1]*minv
while i < minv:
    if not 0 in [1 if values[k] % i == 0 else 0 for k in range(n)]:
        print(i)
    else:
        for j in range(i, minv, i):
            ng_value[j] = 0
    b = True
    for j in range(i+1, minv):
        if ng_value[j]:
            i = j
            b = False
            break
    if b: break

### FIXED CODE ###

n = int(input())
values = list(map(int, input().split()))
minv = min(values)+1
print(1)
i = 2
ng_value = [1]*minv
while i < minv:
    if not 0 in [1 if values[k] % i == 0 else 0 for k in range(n)]:
        print(i)
    else:
        for j in range(i, minv, i):
            ng_value[j] = 0
    b = True
    for j in range(i+1, minv):
        if ng_value[j]:
            i = j
            b = False
            break
    if b: break
import heapq

#dg = 10**7#ノード数より多く取る

n,m, S = map(int,input().split()) #n:頂点数　m:辺の数

edge = [[] for i in range(n)]
#edge[i] : iから出る道の[重み,行先]の配列


Cs=[]
Ds=[]
amax=0
for _ in range(m):
    u, v, a, b = map(int,input().split())
    edge[u-1].append([v-1,a,b])
    edge[v-1].append([u-1,a,b])#有向グラフの場合コメント
    amax=max(a,amax)

for _ in range(n):
    c, d = map(int,input().split())
    Cs.append(c)
    Ds.append(d)

dg=(n-1)*amax

def cut(S): 
    return min(S,dg)

S=cut(S)

def dijkstra(start):

    #dijkstra
    # d : minimum distance from s
    d = [[10**20]*(dg+1) for _ in range(n)]
    d[start][cut(S)] = 0
    edgelist = []

    heapq.heappush(edgelist,[Ds[0], 0, cut(S+Cs[0]])

    for e in edge[start]:
        if S-e[1]>=0:
            heapq.heappush(edgelist,[e[2],e[0],S-e[1]])

    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        t,ce,cs = minedge[0],minedge[1],minedge[2]
        #print(t,ce,cs)
        if  d[ce][cs]== 10**20:
            d[ce][cs] = t
            ns=cut(cs+Cs[ce])
            #print(ce,ns)
            if d[ce][ns]==10**20:
                #d[ce][ns]=t+Ds[ce]
                heapq.heappush(edgelist, [t+Ds[ce],ce,ns])

            for e in edge[ce]:
                if cs>=e[1]:
                    #print(e)
                    ne=e[0]
                    ns=cs-e[1]
                    if d[ne][ns]==10**20:
                        #print(ne)
                        heapq.heappush(edgelist, [t+e[2],ne,ns])
    return d

d=dijkstra(start=0)
for x in d[1:]:
    print(min(x))
#print(d)


### FIXED CODE ###

import heapq

#dg = 10**7#ノード数より多く取る

n,m, S = map(int,input().split()) #n:頂点数　m:辺の数

edge = [[] for i in range(n)]
#edge[i] : iから出る道の[重み,行先]の配列


Cs=[]
Ds=[]
amax=0
for _ in range(m):
    u, v, a, b = map(int,input().split())
    edge[u-1].append([v-1,a,b])
    edge[v-1].append([u-1,a,b])#有向グラフの場合コメント
    amax=max(a,amax)

for _ in range(n):
    c, d = map(int,input().split())
    Cs.append(c)
    Ds.append(d)

dg=(n-1)*amax

def cut(S): 
    if S>dg:
        return dg
    else: return S

S=cut(S)

def dijkstra(start):

    #dijkstra
    # d : minimum distance from s
    d = [[10**20]*(dg+1) for _ in range(n)]
    d[start][cut(S)] = 0
    edgelist = []

    heapq.heappush(edgelist,(Ds[0], 0, cut(S+Cs[0])))

    for e in edge[start]:
        if S-e[1]>=0:
            heapq.heappush(edgelist,(e[2],e[0],S-e[1]))

    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        t,ce,cs = minedge[0],minedge[1],minedge[2]
        #print(t,ce,cs)
        if  d[ce][cs]== 10**20:
            d[ce][cs] = t
            ns=cut(cs+Cs[ce])
            #print(ce,ns)
            if d[ce][ns]==10**20:
                #d[ce][ns]=t+Ds[ce]
                heapq.heappush(edgelist, (t+Ds[ce],ce,ns))

            for e in edge[ce]:
                if cs>=e[1]:
                    #print(e)
                    ne=e[0]
                    ns=cs-e[1]
                    if d[ne][ns]==10**20:
                        #print(ne)
                        heapq.heappush(edgelist, (t+e[2],ne,ns))
    return d

d=dijkstra(start=0)
for x in d[1:]:
    print(min(x))
#print(d)
N = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

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

d = prime_factorize(N)

import math
ans = math.inf

A = d

for i in range(1 << len(A)):
    a = []
    b = []
    ao = 1
    bo = 1
    for j in range(len(A)):
        if ((i >> j) & 1) == 1:
            a.append(A[j])
        else:
            b.append(A[j])
            
    for j in range(len(a)):
        ao *= a[j]
    for j in range(len(b)):
        bo *= b[j]
        
    ans = min(ans, ao+bo-2)
    print(ans)



### FIXED CODE ###

N = int(input())

a = 1
ans = 2**64
while a*a<=N:
    b = N/a
    if b!=int(b):
        a += 1
        continue
    b = int(b)
    ans = min(ans, a+b-2)

    a += 1

print(ans)
import itertools
from pprint import pprint
import sys 
sys.setrecursionlimit(100*10*1024)
#基本的に10*100*len(bonus_masterlist)回ループを回せばよい
#len(bonus_masterlist)は最大で2**10=1024

d,g = map(int,input().split())

plist=[]
clist=[]

bonus_masterlist=[]

for _ in range(d):
    p_temp,c_temp = map(int,input().split())
    plist.append(p_temp)
    clist.append(c_temp)


bonus_masterlist = list(itertools.product(range(2), repeat=5))
#bit全探索をやらなくても、itertoolsを使えば一瞬でできちゃう。(タプルのリスト)
#for i in range(2**d):
#    bonus_templist = [0] * d
#    for j in range(d):
#        if i >> j & 1:
#            bonus_templist[d-1-j] = 1
#    bonus_masterlist.append(bonus_templist)

#point_list = [100,200,300, ... ,d*100]
#max_list: plist = [p[0],p[1],p[2], ... ,p[d]]
#bonuspoint_list: clist = [c[0],c[1],c[2], ... ,c[d]]

count_list = [0] * d

mincount = 100 * 10

def dfs(i):
    global mincount
    if sum([count_list[i] * 100*(i+1) for i in range(d)]) + sum([bonus_list[j] * clist[j] for j in range(d)]) >= g:
        if sum(count_list) < mincount:
            mincount = sum(count_list)
    elif plist[i] == count_list[i]:
        bonus_list[i] = 1
        dfs(i-1)
    elif plist[i] > count_list[i]:
        count_list[i] += 1
        dfs(i)
    return

for bonus_tuple in bonus_masterlist:
    bonus_list = list(bonus_tuple)
    count_list = [x * y for (x, y) in zip(bonus_list, plist)]
    dfs(d-1)

print(mincount)

### FIXED CODE ###

import itertools
from pprint import pprint


d,g = map(int,input().split())

plist=[]
clist=[]

bonus_masterlist=[]

for _ in range(d):
    p_temp,c_temp = map(int,input().split())
    plist.append(p_temp)
    clist.append(c_temp)


bonus_masterlist = list(itertools.product(range(2), repeat=d))
#bit全探索をやらなくても、itertoolsを使えば一瞬でできちゃう。(タプルのリスト)
#for i in range(2**d):
#    bonus_templist = [0] * d
#    for j in range(d):
#        if i >> j & 1:
#            bonus_templist[d-1-j] = 1
#    bonus_masterlist.append(bonus_templist)

#point_list = [100,200,300, ... ,d*100]
#max_list: plist = [p[0],p[1],p[2], ... ,p[d]]
#bonuspoint_list: clist = [c[0],c[1],c[2], ... ,c[d]]

count_list = [0] * d

mincount = 100 * 10

"""
def dfs(i):
    global mincount
    if sum([count_list[i] * 100*(i+1) for i in range(d)]) + sum([bonus_list[j] * clist[j] for j in range(d)]) >= g:
        if sum(count_list) < mincount:
            mincount = sum(count_list)
    elif plist[i] == count_list[i]:
        bonus_list[i] = 1
        dfs(i-1)
    elif plist[i] > count_list[i]:
        count_list[i] += 1
        dfs(i)
    return
"""

for bonus_tuple in bonus_masterlist:
    bonus_list = list(bonus_tuple)
    count_list = [x * y for (x, y) in zip(bonus_list, plist)]
    i = d-1
    while True:
        if sum([count_list[i] * 100*(i+1) for i in range(d)]) + sum([bonus_list[j] * clist[j] for j in range(d)]) >= g:
            if sum(count_list) < mincount:
                mincount = sum(count_list)
            break
        elif plist[i] == count_list[i]:
            bonus_list[i] = 1
            i -= 1
            continue
        elif plist[i] > count_list[i]:
            count_list[i] += 1
            continue


print(mincount)
import queue

n, m = map(int, input().split())
maze = [[] for _ in range(m)]
for i in range(m):
    a, b = map(int, input().split())
    maze[a-1].append(b-1)
    maze[b-1].append(a-1)

ans = [-1 for _ in range(n)]
ans[0] = 0
q = queue.Queue()
q.put(0)
while not q.empty():
    start = q.get()
    for end in maze[start]:
        if ans[end] == -1:
            q.put(end)
            ans[end] = start

if -1 in ans[1:]:
    print('No')
else:
    print('Yes')
    for i in range(1,n):
        print(ans[i]+1)


### FIXED CODE ###

import queue

n, m = map(int, input().split())
maze = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    maze[a-1].append(b-1)
    maze[b-1].append(a-1)

ans = [-1 for _ in range(n)]
ans[0] = 0
q = queue.Queue()
q.put(0)
while not q.empty():
    start = q.get()
    for end in maze[start]:
        if ans[end] == -1:
            q.put(end)
            ans[end] = start

if -1 in ans[1:]:
    print('No')
else:
    print('Yes')
    for i in range(1,n):
        print(ans[i]+1)
for i,n in enumerate(int(input())):
  if n!= 1:
    break
print(n if i<int(input()) else 1)

### FIXED CODE ###

for i,n in enumerate(input()):
  if n!= '1':
    break
print(n if i<int(input()) else 1)
#coding:UTF-8

x = input()

y = x**3

print int(y)

### FIXED CODE ###

x = int(input())
print(x*x*x)
import math
A, B = map(int,input().split())

ans = (A * B) // math.gcd(A, B)
print(ans)

### FIXED CODE ###

A, B = map(int,input().split())
 
n = max(A,B)
m= min(A,B)
count = 1
while True:
    if (n*count)%m == 0:
        print(n*count)
        break
    else:
        count += 1
import sys
from operator import mul
from functools import reduce

sys.setrecursionlimit(100000000000)
MOD = 10**9 + 7


def cmb(n,r):
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
A.sort()
A_rev = list(reversed(A))


ans = 0
C = cmb(N-1, K-1)
for i, j in zip(A, A_rev):
    if N < K:
        break
    ans += C * j
    ans -= C * i
    ans %= MOD
    try:
        C = C * (N - K) / (N - 1)
    except:
        break
    N -= 1
print(int(ans % MOD))


### FIXED CODE ###

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
A.sort()
MOD = 10 ** 9 + 7


def combination(mod=MOD):
    fact = [1] * (N + 1)
    inv_fact = [1] * (N + 1)
    r = 1
    for i in range(1, N + 1):
        fact[i] = r = r * i % mod
    inv_fact[N] = r = pow(fact[N], mod - 2, mod)
    for i in range(N, 0, -1):
        inv_fact[i - 1] = r = r * i % mod

    def _wrapper(n, k):
        nonlocal fact, inv_fact, mod
        if n == 0 or k == 0:
            return 1
        return fact[n] * inv_fact[k] * inv_fact[n - k] % mod

    return _wrapper


def main():
    if K == 1:
        print(0)
        exit()
    comb = combination()
    sum_max = 0
    sum_min = 0
    for i, A_i in enumerate(A):
        if i >= K - 1:
            sum_max += comb(i, K - 1) * A_i % MOD
        if N - i >= K:
            sum_min += comb(N - i - 1, K - 1) * A_i % MOD
    ans = (sum_max - sum_min) % MOD
    print(ans)


if __name__ == '__main__':
    main()
a,b = map(int, input().split())  
res = 1
while 1:
  if a *res - (res -1 ) =< b:
    res = res + 1
    #print(a,"個口を",res,"つ使うと未使用は、",a *res - (res -1 ))
  else:
    break
print(res)
    
    

    


### FIXED CODE ###

a,b = map(int, input().split())
res = 1
if b == 1:
    print(0)
    exit(0)
while a *res - (res -1 ) < b  :
 res = res + 1
 #print(a,"個口を",res,"つ使うと未使用は、",a *res - (res -1 ))
print(res)
d = {}
ans = 0;
N = int(input())
for i in range(N):
    key = input()
    if key not in d:
        ans++
        d[key] = 0
        
        
print(ans)

### FIXED CODE ###

d = {}
ans = 0;
N = int(input())
for i in range(N):
    key = input()
    if key not in d:
        ans+=1
        d[key] = 0
        
        
print(ans)
n, k=map(int, input().split())
a=list(map(int, input().split()))
table=[0]*(n+1)

for num in a:
    table[num]+=1

table.sort()
now_length=[]
for count in table:
    if count!=0:
        now_length.append(count)

if len(now_length)<=k:
    print(0)
else:
    ans=0
    i=0
    while len(now_length)!=k:
        ans+=now_length[i]
        now_length.remove(now_length[i])
        i+=1

    print(ans)

### FIXED CODE ###

n, k=map(int, input().split())
a=list(map(int, input().split()))
table=[0]*(n+1)

for i in range(n):
    table[a[i]]+=1

l=sorted(table, reverse=True)
get=0
for i in range(k):
    get+=l[i]

print(sum(l)-get)