s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s957757901
p03495
u247830763
1592083092
Python
PyPy3 (2.4.0)
py
Runtime Error
359
106568
466
import collections import sys n,k = map(int,input().split()) ls = list(map(int,input().split())) a = list(set(ls)) c = collections.Counter(ls) p = 0 if len(a) > k: di = [0]*(len(a)) new = c.most_common()[::-1] for i in range(len(a)): di[i] = new[i][1] import numpy new_ls = numpy.cumsum(nump...
s427278726
p03495
u549383771
1591700218
Python
Python (3.4.3)
py
Runtime Error
24
6012
243
n,k = map(int,input().split()) from collections import defaultdict d = defaultdict(int) for i in range(5): tmp = input() d[tmp] += 1 v_list = sorted(list(d.values())) while len(v_list) > k: v_list.pop(0) print(n - sum(v_list))
s283282472
p03495
u029000441
1590239185
Python
Python (3.4.3)
py
Runtime Error
17
3060
191
n,k=MI() lis=LI() cou=Counter(lis) u=cou.most_common() #print(u) ans=0 for i in range(len(u)-k): j=len(u)-i-1 #print(j) ans+=u[j][1] #print(cou.most_common()[j][1]) print(ans)
s139490114
p03495
u998679483
1589665720
Python
Python (3.4.3)
py
Runtime Error
2104
33312
768
def main(): n, k = map(int, input().split()) A = list(map(int, input().split())) res = 0 balls = {} for ball in A: if ball in balls: balls[ball] += 1 else: balls[ball] = 1 while True: minValue = 200000 maxValue = 0 for ...
s869541359
p03495
u686036872
1589074431
Python
Python (3.4.3)
py
Runtime Error
95
32540
189
from collections import Counter N, K = map(int, input().split()) A = list(map(int, input().split())) c = Counter(A) for i in range(len(A)-K): ans += c.most_common()[i][1] print(ans)
s593044764
p03495
u423665486
1589055876
Python
PyPy3 (2.4.0)
py
Runtime Error
249
76112
208
def resolve(): n, k = map(int, input().split()) a = list(map(int, input().split())) c = Counter(a) lc = len(c.keys()) if lc > k: v = sum(sorted(c.values())[:k-1]) print(v) else: print(0) resolve()
s752171366
p03495
u586212264
1588890120
Python
PyPy3 (2.4.0)
py
Runtime Error
179
38256
242
import collections n, k = map(int, input().split()) a = list(map(int, input().split())) cnt = collections.Counter(a) ans = 0 t=cnt.most_common() if len(t) <= k: print(0) exit() if for i in range(k): ans += t[i][1] print(n - ans)
s121891091
p03495
u852790844
1587759974
Python
Python (3.4.3)
py
Runtime Error
308
32980
234
import sys import numpy as np readline = sys.stdin.readline n, k = map(int, input().split()) a = np.array(readline().split(), dtype=np.int64) b = np.sort(np.array(np.unique(a, return_counts=True))[1]) ans = np.sum(b[:-k]) print(ans)
s409187705
p03495
u519939795
1586983865
Python
Python (3.4.3)
py
Runtime Error
18
2940
101
n,k=map(int,input().split()) l = list(map(int,input().split())) if set(l)<=k: print(0) break
s497128080
p03495
u440161695
1586957929
Python
Python (3.4.3)
py
Runtime Error
64
24744
191
m,k=map(int,input().split()) A=list(map(int,input().split())) d=Counter(A) l=d.most_common()[::-1] s=set(A) ans=0 i=0 while len(s)>k: ans+=l[i][1] del d[l[i]] s=len(d) i+=1 print(ans)
s597875936
p03495
u834450722
1586929495
Python
Python (3.4.3)
py
Runtime Error
2104
35996
186
import collections N,K = map(int , input().split()) c=collections.Counter(list(input().split())) result = N for i in range(K): result = result - c.most_common(K)[i][1] print(result)
s185817806
p03495
u834450722
1586929095
Python
Python (3.4.3)
py
Runtime Error
2104
35996
186
import collections N,K = map(int , input().split()) c=collections.Counter(list(input().split())) result = K for i in range(K): result = result - c.most_common(K)[i][1] print(result)
s803680573
p03495
u834450722
1586928981
Python
Python (3.4.3)
py
Runtime Error
2109
35996
186
import collections N,K = map(int , input().split()) c=collections.Counter(list(input().split())) result = 0 for i in range(K): result = result - c.most_common(K)[i][1] print(result)
s487700451
p03495
u834450722
1586928474
Python
Python (3.4.3)
py
Runtime Error
165
36000
167
import collections N,K = map(int , input().split()) c=collections.Counter(list(input().split())) R1=c.most_common(2)[0][1] R2=c.most_common(2)[1][1] print(N-R1-R2)
s328818713
p03495
u679520304
1586912960
Python
PyPy3 (2.4.0)
py
Runtime Error
392
101576
255
N,K = map(int,input().split()) A = list(map(int,input().split())) import collections A_c = collections.Counter(A) A_A = A_c.most_common() ans = 0 for i in range(len(A_A)): if i >K-1: ans += list(A_A[i])[1] if A_A<=K: print(0) else: print(ans)
s960940917
p03495
u744034042
1583360773
Python
Python (3.4.3)
py
Runtime Error
17
3060
230
n, k = map(int, input().split()) d = collections.defaultdict(int) b = map(int, input().split()) for e in b: d[e] += 1 ret = 0 a = sorted([v for v in d.values()], reverse = True) while len(a) > k: ret += a.pop() print(ret)
s737466645
p03495
u744034042
1583344025
Python
Python (3.4.3)
py
Runtime Error
2105
40884
308
n, k = map(int, input().split()) array = list(map(int, input().split())) count = [0] * n from collections import Counter lis = sorted((Counter(array)).items(), key = lambda x: x[1]) count2 = 0 for i in range(len(lis)): if len(lis) > k: count2 += lis[i][1] lis.remove(lis[i]) print(count2)
s209085381
p03495
u744034042
1583343576
Python
Python (3.4.3)
py
Runtime Error
2104
40884
312
n, k = map(int, input().split()) array = list(map(int, input().split())) count = [0] * n from collections import Counter lis = sorted((Counter(array)).items(), key = lambda x: x[1])[:n] count2 = 0 for i in range(len(lis)): if len(lis) > k: count2 += lis[i][1] lis.remove(lis[i]) print(count2)
s036332964
p03495
u796708718
1583078374
Python
Python (3.4.3)
py
Runtime Error
85
25552
415
N, K = [int(x) for x in input().split(" ")] lst = [int(x) for x in input().split(" ")] dic= {} cnt = 0 swap = 0 prep = len(set(lst))-K for i in range(1,N+1): dic["{}".format(i)] = 0 dic["{}".format(lst[i-1])] += 1 sorted_dic = sorted(dic.items(), key = lambda x : x[1]) for i in range(0,N): swap += sorted_d...
s553566149
p03495
u281610856
1582947097
Python
Python (3.4.3)
py
Runtime Error
264
41260
235
import collections n, k = map(int, input().split()) a = list(map(int, input().split())) k, v = zip(*collections.Counter(a).most_common()[::-1]) v_list = [i for i in v] diff = max(0, len(v_list - k)) ans = sum(v_list[:diff]) print(ans)
s987065756
p03495
u488934106
1582907667
Python
PyPy3 (2.4.0)
py
Runtime Error
248
76368
331
def NotsoDiverse(n , k , al): lis = [0]*n for i in range(n): lis[al[i]] += 1 lis.sort(reverse=True) ans = sum(lis[k:]) return ans def main(): n , k = map(int , input().split()) al = list(map(int , input().split())) print(NotsoDiverse(n , k , al)) if __name__ == '__main__': ...
s741374532
p03495
u716043626
1582751107
Python
Python (3.4.3)
py
Runtime Error
69
26628
400
from collections import OrderedDict n,k = map(int,input().split()) a = list(map(int,input().split())) b = collections.Counter(a) ans = 0 num_keys = len(b.keys()) if num_keys > k: c = sorted(b.items(),key=lambda x:x[1]) for i in range(len(c)): num_keys -= c[i][1] c[-1][1] += c[i][1] ans...
s364770052
p03495
u716043626
1582751071
Python
Python (3.4.3)
py
Runtime Error
69
26500
437
from collections import OrderedDict n,k = map(int,input().split()) a = list(map(int,input().split())) b = collections.Counter(a) ans = 0 num_keys = len(b.keys()) if num_keys > k: if k != 0: c = sorted(b.items(),key=lambda x:x[1]) for i in range(len(c)): num_keys -= c[i][1] a...
s991280603
p03495
u716043626
1582751022
Python
Python (3.4.3)
py
Runtime Error
69
26756
469
from collections import OrderedDict n,k = map(int,input().split()) a = list(map(int,input().split())) b = collections.Counter(a) ans = 0 num_keys = len(b.keys()) if num_keys > k: if k != 0: c = sorted(b.items(),key=lambda x:x[1]) for i in range(len(c)): num_keys -= c[i][1] # c...
s064656930
p03495
u757030836
1582384437
Python
Python (3.4.3)
py
Runtime Error
33
18984
277
n,k = map(int,input().split()) a = [input().split() for i in range(n)] d = {} for i in a: if i in d: d[a] += 1 else: d[a] = 1 d = sorted(d,values()) if len(d) > k: ans = 0 for i in range(len(d)-k): ans += d[i] print(ans) else: print(0)
s856332856
p03495
u627803856
1582176177
Python
PyPy3 (2.4.0)
py
Runtime Error
234
75472
245
n,k=map(int,input().split()) a=list(map(int,input().split())) c=collections.Counter(a) num_kind=len(set(a)) #種類の数 diff = num_kind-k #変更すべき数 values, counts = zip(*c.most_common()[::-1]) #少ない順 print(sum(counts[:diff]))
s100350706
p03495
u757030836
1581785483
Python
Python (3.4.3)
py
Runtime Error
17
2940
270
n,k = map(int, input().split()) A = [int(x) for x in input().split()] d = {} for a in A: if a in d: d[a] +=1 eles: d[a] =1 d =sorted(d.values()) if len(d) > k: ans = 0 for i in range(len(d)-k): ans += d[i] print(ans) else: print(0)
s450399697
p03495
u757030836
1581785429
Python
Python (3.4.3)
py
Runtime Error
17
2940
262
N,K = map(int, input().split()) A = [int(x) for x in input().split()] d = {} for a in A: if a in d: d[a] +=1 eles: d[a] =1 d =sorted(d.values()) if len(d) > K: ans = 0 for i in range(len(d)-K): ans += d[i] print(ans) else: print(0)
s735258087
p03495
u757030836
1581785347
Python
Python (3.4.3)
py
Runtime Error
17
2940
261
n,k = map(int, input().split()) A = [int(x) for x in input().split()] d = {} for a in A: if a in d: d[a] +=1 eles: d[a] =1 d =sorted(d.values()) if len(d) > k: ans = 0 for i in range(len(d)-k): ans += d[i] print(ans) else: print(0)
s233266704
p03495
u764000168
1581563944
Python
Python (3.4.3)
py
Runtime Error
106
25748
175
n, k = map(int, input().split()) aList = list(map(int, input().split())) num = [0 for _ in range(n)] for i in aList: num[i] += 1 num.sort() num = num[:-k] print(sum(num))
s475024187
p03495
u134712256
1581472129
Python
Python (3.4.3)
py
Runtime Error
128
28804
296
n,k = map(int,input().split()) a = [int(i) for i in input().split()] hash = [0 for i in range(n+1)] #dic = {a[i]:count} if len(set(a))<=k: print(0) exit() else: ans=0 for i in a: hash[i]+=1 L = list(set(hash)) x = len(set(a)) - k for i in range(x+1): ans+=L[i] print(ans)
s543803185
p03495
u414458988
1581390472
Python
PyPy3 (2.4.0)
py
Runtime Error
240
89684
136
from collections import Counter n,k=map(int,input().split()) c=Counter(input().split()) pritn(sum(sorted(a.values(), reverse=True)[k:]))
s926021924
p03495
u826771152
1581224383
Python
Python (3.4.3)
py
Runtime Error
2104
24996
259
n,k = list(map(int, input().split())) A = list(map(int, input().split())) kinds = [] for i in A: if i not in kinds: kinds.append(i) print(kinds) if len(kinds) >= K: moves = len(kinds) - K moves = 5 - 3 print(moves) else: print(0)
s732238835
p03495
u355322985
1580830162
Python
PyPy3 (2.4.0)
py
Runtime Error
2107
91220
276
n, k = input().split() n, k = int(n), int(k) balls = input().split() dic = {} for x in balls: if x not in dic: dic[x] = 1 else: dic[x] += 1 change = 0 qnt = list(dic.values()) qnt.sort() dif = len(qnt) - k while dif: change += qnt[0] qnt.pop(0) dif -= 1 print(change)
s446192612
p03495
u293198424
1580626536
Python
PyPy2 (5.6.0)
py
Runtime Error
36
27628
361
n,k = map(int,input().split()) a = [int(i) for i in input().split()] c = list(set(a)) count = 0 if len(c) <= k: print(0) else: while len(c) > k: minv = 10**3 for i in c: o = a.count(i) if minv > o: minv = o atai = i c.remove(atai)...
s343975556
p03495
u293198424
1580626468
Python
PyPy2 (5.6.0)
py
Runtime Error
36
28012
361
n,k = map(int,input().split()) a = [int(i) for i in input().split()] c = list(set(a)) count = 0 if len(c) <= k: print(0) else: while len(c) > k: minv = 10**3 for i in c: o = a.count(i) if minv > o: minv = o atai = i c.remove(atai)...
s956908624
p03495
u202570162
1580229571
Python
Python (3.4.3)
py
Runtime Error
195
36752
288
N,K=map(int,input().split()) A=[int(i) for i in input().split()] cnt=[0 for i in range(N)] for a in A: cnt[a-1]+=1 knd=[] for i,c in enumerate(cnt): if c!=0: knd.append((i+1,c)) knd.sort(key=lambda x: x[1],reverse=True) ans=0 while len(knd)<=K: j,d=knd.pop() ans+=d print(ans)
s767114556
p03495
u934868410
1579801285
Python
Python (3.4.3)
py
Runtime Error
64
25644
197
n,k = map(int,input().split()) a = list(map(int, input().split())) s = set() for x in a: if x in s: s[x] += 1 else: s[x] = 1 s_l = sorted(s.values())[0:max(0, len(s)-k)] print(sum(s_l))
s797505900
p03495
u508405635
1579110715
Python
Python (3.4.3)
py
Runtime Error
30
6772
677
import sys input = sys.stdin.readline N, K = map(int, input().split()) A = [int(input()) for _ in range(N)] ## 種類数の求め方 # 1. A内の要素を取り出して、それがA内に存在するとき:種類+1 # 2. その要素を重複数だけAから削除してループ kinds = 0 A = sorted(A) duplicatedList = [] while len(A) > 0: if A[0] in A: kinds += 1 duplicatedList.append(A.count(A...
s407579983
p03495
u508405635
1579110686
Python
Python (3.4.3)
py
Runtime Error
17
3064
677
import sys input = sys.stdin.readline N, K = map(int, input().split()) A = [int(input() for _ in range(N))] ## 種類数の求め方 # 1. A内の要素を取り出して、それがA内に存在するとき:種類+1 # 2. その要素を重複数だけAから削除してループ kinds = 0 A = sorted(A) duplicatedList = [] while len(A) > 0: if A[0] in A: kinds += 1 duplicatedList.append(A.count(A...
s851515478
p03495
u747220349
1578555759
Python
Python (3.4.3)
py
Runtime Error
2104
25644
124
n,k=map(int,input().split()) l=list(map(int,input().split())) f=[l.count(i) for i in range(0,n)].sort() print(sum(f[0:n-k]))
s823551410
p03495
u747220349
1578554615
Python
Python (3.4.3)
py
Runtime Error
20
6772
189
n,k=map(int,input().split()) l=list(map(int,input())) f=[] for i in range(0,n): a=l.count("i") f.append(a) f.sort() total=0 for j in range (0,n-k): total=total+f[j] print(total)
s408341389
p03495
u553919982
1577250422
Python
Python (3.4.3)
py
Runtime Error
67
25748
184
N, K = map(int,input().split()) A = list(map(int,input().split())) ans = 0 B = [0]*20 for i in A: B[i] += 1 B.sort(reverse = True) for i in range(K,N): ans += B[i] print(ans)
s434523312
p03495
u553919982
1576993667
Python
Python (3.4.3)
py
Runtime Error
89
25644
155
n, k = map(int, input().split()) A = list(map(int,input().split())) b = [0]*200002 for a in A: b[a] += 1 b.sort(reverse = Ture) print(n-sum(b[:k]))
s354436418
p03495
u225388820
1576701852
Python
Python (3.4.3)
py
Runtime Error
17
2940
92
n,k=map(int,input().split()) a=list(map(int,input().split())) a=set(a) print(max(0,len(a)-k)
s871594491
p03495
u225388820
1576701806
Python
Python (3.4.3)
py
Runtime Error
17
2940
82
n,k=map(int,input().split()) a=set(map(int,input().split())) print(max(0,len(a)-k)
s614546415
p03495
u626467464
1576269022
Python
Python (3.4.3)
py
Runtime Error
87
27172
433
n,k = map(int,input().split()) setted_line = list(set(list(map(int,input().split())))) origin_num = len(setted_line) pairs = {} for i in range(len(setted_line)): count = line.count(setted_line[i]) pairs[setted_line[i]] = count sorted_pairs = sorted(pairs.items(), key = lambda x:x[1]) answer = 0 if origin_num <= k:...
s342710812
p03495
u626467464
1576268978
Python
Python (3.4.3)
py
Runtime Error
91
34308
427
n,k = map(int,input().split()) setted_line = list(set(map(int,input().split()))) origin_num = len(setted_line) pairs = {} for i in range(len(setted_line)): count = line.count(setted_line[i]) pairs[setted_line[i]] = count sorted_pairs = sorted(pairs.items(), key = lambda x:x[1]) answer = 0 if origin_num <= k: ans...
s369980077
p03495
u133566678
1576102856
Python
Python (3.4.3)
py
Runtime Error
135
25748
240
N, K = map(int, input().split()) A = list(map(int, input().split())) #print(N, K, A) A2 = [0] * N for i in range(len(A)): A2[A[i]] += 1 A2.sort(reverse = True) print(A2) count = 0 for i in range(K): count += A2[i] print(N - count)
s976390776
p03495
u363995337
1575832968
Python
Python (3.4.3)
py
Runtime Error
2104
25276
340
N,K = map(int,input().split()) numbers = list(map(int,input().split())) num_set = set(numbers) KindNum = len(num_set) if KindNum < K: print(0) else: numCount = [] count = 0 for num_kind in num_set: numCount.append(numbers.count(num_kind)) numCount.sort() count = sum(numCount[:KindNum ...
s924061988
p03495
u363995337
1575831232
Python
Python (3.4.3)
py
Runtime Error
2108
25276
349
N,K = map(int,input().split()) numbers = list(map(int,input().split())) num_set = set(numbers) if len(num_set) < K: print(0) else: numCount = [] count = 0 KindNum = len(num_set) for num_kind in num_set: numCount.append(numbers.count(num_kind)) numCount.sort() count = sum(numCount[...
s921183775
p03495
u034663022
1574561868
Python
Python (3.4.3)
py
Runtime Error
350
59668
300
from collections import Counter N, K = map(int, input().split()) A = list(map(int, input().split())) size=len(Counter(A).most_common()) if K >= size: print(0) else: values, counts = zip(*Counter(A).most_common()[::-1]) ans=0 for i in range(size-K): ans += counts[i] print(ans)
s835928711
p03495
u798731634
1574495335
Python
Python (3.4.3)
py
Runtime Error
158
39320
194
import collections n, k = map(int, input().split()) a_list = list(map(int, input().split())) b = collections.Counter(a_list) d = b.most_common()[:k] sum = 0 for i in d: sum += i print(n-sum)
s778647632
p03495
u798731634
1574495172
Python
Python (3.4.3)
py
Runtime Error
160
39344
193
import collections n, k = map(int, input().split()) a_list = list(map(int, input().split())) b = collections.Counter(a_list) d = b.most_common()[:k] sum = 0 for i in d: sum += i print(n-i)
s499866714
p03495
u798731634
1574495106
Python
Python (3.4.3)
py
Runtime Error
154
39348
194
from collections import Counter n, k = map(int, input().split()) a_list = list(map(int, input().split())) b = Counter(a_list) d = b.most_common()[:k] sum = 0 for i in d: sum += i print(n-i)
s417790423
p03495
u798731634
1574494890
Python
Python (3.4.3)
py
Runtime Error
249
53680
220
from collections import Counter n, k = map(int, input().split()) a_list = list(map(int, input().split())) b = Counter(a_list) key, values = zip(*b.most_common()) sum=0 for i in values.range(k): d = sum + i print(n-i)
s131521748
p03495
u798731634
1574493957
Python
Python (3.4.3)
py
Runtime Error
172
39352
211
from collections import Counter n, k = map(int, input().split()) a_list = list(map(int, input().split())) b = Counter(a_list) b_list = sorted(b.items(), key=lambda x:x[1])[:k] d = sum(b_list.values()) print(n-d)
s698123130
p03495
u798731634
1574493779
Python
Python (3.4.3)
py
Runtime Error
169
39344
227
from collections import Counter n, k = map(int, input().split()) a_list = list(map(int, input().split())) b = Counter(a_list) b_list = sorted(b.items(), key=lambda x:x[1])[:k] for i in b_list.values(): d = sum(i) print(n-d)
s982684911
p03495
u798731634
1574493663
Python
Python (3.4.3)
py
Runtime Error
166
39352
225
from collections import Counter n, k = map(int, input().split()) a_list = list(map(int, input().split())) b = Counter(a_list) b_list = sorted(b.items(), key=lambda x:x[1]) for i in b_list.values[:k]: d = sum(i) print(n-d)
s106901233
p03495
u798731634
1574493642
Python
Python (3.4.3)
py
Runtime Error
166
39352
225
from collections import Counter n, k = map(int, input().split()) a_list = list(map(int, input().split())) b = Counter(a_list) b_list = sorted(b.items(), key=lambda x:x[1]) for i in b_list.values[:k]: d = sum(i) print(n-i)
s980413724
p03495
u798731634
1574492166
Python
Python (3.4.3)
py
Runtime Error
65
24748
247
n, k = map(int, input().split()) a_list = list(map(int, input().split())) b_list = [] for i in range(1,n+1): if i == a_list[i]: b_list[i] += 1 else: b_list[i] = 1 b_list.sort(reverse = True) f = sum(b_list[:k:]) print(n-f)
s895070000
p03495
u798731634
1574492091
Python
Python (3.4.3)
py
Runtime Error
65
25376
245
n, k = map(int, input().split()) a_list = list(map(int, input().split())) b_list = [] for i in range(n+1): if i == a_list[i]: b_list[i] += 1 else: b_list[i] = 1 b_list.sort(reverse = True) f = sum(b_list[:k:]) print(n-f)
s412093729
p03495
u798731634
1574490347
Python
Python (3.4.3)
py
Runtime Error
66
24740
152
n, k = map(int, input().split()) b_list = sorted([list(map(int, input().split())).count(i) for i in range(n+1)],reverse = True)[:k] print(n-sum(b_list))
s032503011
p03495
u798731634
1574489853
Python
Python (3.4.3)
py
Runtime Error
18
3056
167
n, k = map(int, input().split()) a_list = list(map(int, input().split())) b_list = sorted(a_list.count(i) for i in range(n+1),reverse = True) print(n-sum(b_list[:k:]))
s003679720
p03495
u798731634
1574489811
Python
Python (3.4.3)
py
Runtime Error
17
3056
173
n, k = map(int, input().split()) a_list = list(map(int, input().split())) b_list = list(sorted(a_list.count(i) for i in range(n+1),reverse = True)) print(n-sum(b_list[:k:]))
s575040077
p03495
u798731634
1574487179
Python
Python (3.4.3)
py
Runtime Error
2104
27316
302
n, k = map(int, input().split()) a_list = list(map(int, input().split())) ans = 0 while True: if len(set(a_list)) > k: if len(set(a_list)) == k+1: a_list.pop() ans += 1 else: a_list = set(a_list).pop() ans += 1 print(ans)
s482773958
p03495
u662613022
1573568482
Python
Python (3.4.3)
py
Runtime Error
2104
25644
204
N,K = map(int,input().split()) a = list(map(int,input().split())) b = set(a) c = [a.count(i) for i in b] d = len(b) ans = 0 for i in c: if K >= d: break ans += i d -= 1 print(c[i]) print(ans)
s980012919
p03495
u633548583
1573479917
Python
Python (3.4.3)
py
Runtime Error
20
3316
179
import collections n,k=int(input()) a=list(map(int,input().split())) a_counter=collections.Counter(a) li=a_counter.most_common()[k:] ans=0 for i in li: ans+=i[1] print(ans)
s280289945
p03495
u633548583
1573479803
Python
Python (3.4.3)
py
Runtime Error
21
3316
183
import collections n,k=int(input()) a=list(map(int,input().split())) a_counter=collections.Counter(a) li=a_counter.most_common()[k:] ans=0 for i in li: ans+=li(i)[1] print(ans)
s714261781
p03495
u633548583
1573479726
Python
Python (3.4.3)
py
Runtime Error
44
3956
163
import collections n,k=int(input()) a=list(map(int,input().split())) a_counter=collections.Counter(a) li=a_counter.most_common()[k:] ans=0 ans+=li[1] print(ans)
s719815984
p03495
u840310460
1573175220
Python
Python (3.4.3)
py
Runtime Error
17
3060
338
N, K = [int(i) for i in input().split()] B = [int(i) for i in input().split()] C = list(set(B)) D ={} for i in C: D[i] = 0 for j in B: if i == j: D[i] += 1 if len(D) <= K: print(0) else: LLL = list(D.values()) AA = len(D) - K bag = 0 for i in range(-AA, 0): bag += LLL...
s112365748
p03495
u814986259
1573093376
Python
Python (3.4.3)
py
Runtime Error
256
37808
311
import collections N,K=map(int,input().split()) a=list(map(int,input().split())) table=collections.defaultdict(int) for i in range(N): table[a[i]]+=1 table= list(table.items()) if len(table)<=K: print(0) else: ans=0 table.sort(key =lambda x:x[1]) for i in range(N-K): ans+=table[i][1] print(ans)
s317120791
p03495
u814986259
1573093343
Python
Python (3.4.3)
py
Runtime Error
243
37808
315
import collections N,K=map(int,input().split()) a=list(map(int,input().split())) table=collections.defaultdict(int) for i in range(N): table[a[i]]+=1 ana=0 table= list(table.items()) if len(table)<=K: print(0) else: ans=0 table.sort(key =lambda x:x[1]) for i in range(N-K): ans+=table[i][1] print(ans)
s744427687
p03495
u469953228
1573074549
Python
PyPy2 (5.6.0)
py
Runtime Error
36
28012
241
n,k = map(int,input().split()) A = list(map(int,input().split())) sum = 0 import collections c = collections.Counter(A) c = c.most_common() for i in range(n): if len(c) > k: sum += c[-1][1] c = c[:-1] else: break print(sum)
s049557324
p03495
u568595296
1571811057
Python
Python (3.4.3)
py
Runtime Error
17
2940
25
10 3 5 1 3 2 4 1 1 2 3 4
s502477212
p03495
u117348081
1571411702
Python
Python (3.4.3)
py
Runtime Error
101
25876
222
n,k = map(int, input().split()) a = list(map(int, input().split())) number = [0]*n for i in range(n): number[a[i]-1]+=1 number.sort(reversed=True) ans = 0 for i in range(k): ans += number[i] ans = n-ans print(ans)
s276582633
p03495
u117348081
1571411534
Python
PyPy3 (2.4.0)
py
Runtime Error
259
76368
276
n,k = map(int, input().split()) a = list(map(int, input().split())) number = [0]*n for i in range(n): number[a[i]-1]+=1 number.remove(0) number.sort() ans = 0 if len(number)<=k: print(0) else: for i in range(len(number)-k): ans += number[i] print(ans)
s570863875
p03495
u117348081
1571411141
Python
Python (3.4.3)
py
Runtime Error
130
25644
276
n,k = map(int, input().split()) a = list(map(int, input().split())) number = [0]*n for i in range(n): number[a[i]-1]+=1 number.remove(0) number.sort() ans = 0 if len(number)<=k: print(0) else: for i in range(len(number)-k): ans += number[i] print(ans)
s993112631
p03495
u111392182
1570930691
Python
Python (3.4.3)
py
Runtime Error
2104
39320
181
from collections import Counter n,k = list(map(int,input().split())) a = list(map(int,input().split())) c = Counter(a) x = 0 for i in range(k): x+=c.most_common()[i][1] print(n-x)
s782173624
p03495
u527261492
1570142749
Python
Python (3.4.3)
py
Runtime Error
94
32568
189
from collections import Counter n,k=map(int,input().split()) a=list(map(int,input().split())) b=Counter(a).values() b.sort() c=set(a) num=0 for i in range(len(c)-k): num+=b[i] print(num)
s031699504
p03495
u119655368
1569606405
Python
Python (3.4.3)
py
Runtime Error
65
25748
143
n, k = map(int, input().split()) l = list(map(int, input().split())) S = collections.Counter(l) S = sorted(S.values()) print(sum(S[:len(S)-k]))
s342093838
p03495
u077291787
1568989339
Python
Python (3.4.3)
py
Runtime Error
96
33556
256
# ABC081C - Not so Diverse (ARC086C) from collections import Counter def main(): N, K, *A = map(int, open(0).read().split()) C = Counter(A).values() C.sort(reverse=1) ans = sum(C[K:]) print(ans) if __name__ == "__main__": main()
s589744579
p03495
u066253157
1568580897
Python
Python (3.4.3)
py
Runtime Error
98
32540
217
N, K = map(int, input().split()) A = list(map(int, input().split())) from collections import Counter ac = Counter(A) cnt = 0 if len(c) > K: for a in ac.most_common()[K:]: cnt += a[1] print(cnt)
s147240177
p03495
u799479335
1568225552
Python
Python (3.4.3)
py
Runtime Error
2109
27532
327
import numpy as np N,K = map(int, input().split()) As = input().split() for i in range(N): As[i] = int(As[i]) As = np.array(As) As_uni = np.unique(As) if len(As_uni) <= K: ans = 0 else: for i,a in enumerate(As_uni): As_uni[i] = (As==a).sum() As_uni = np.sort(As_uni) ans = As_uni[:K2-K].sum() print(in...
s581069580
p03495
u572142121
1568208099
Python
Python (3.4.3)
py
Runtime Error
2104
27012
241
N,K=map(int,input().split()) A=list(map(int,input().split())) U=len(set(A)) S=[] for i in range(1,N+1): S.append(A.count(i)) T=sorted(S)[::-1] if U > K: ans = 0 for j in range(0,K): ans+= T[j] print(N-ans) if U <= K: print(0)
s233551731
p03495
u572142121
1568206965
Python
Python (3.4.3)
py
Runtime Error
2104
25276
241
N,K=map(int,input().split()) A=list(map(int,input().split())) U=len(set(A)) S=[] for i in range(1,N+1): S.append(A.count(i)) T=sorted(S)[::-1] if U > K: ans = 0 for j in range(0,K): ans+= T[j] print(N-ans) if U <= K: print(0)
s017251216
p03495
u733738237
1567632723
Python
PyPy2 (5.6.0)
py
Runtime Error
37
28012
195
from collections import* n,k=[int(i) for i in input().split()] l=input().split() a=Counter(l) ca=a.most_common() val=len(set(l)) s=0 if val < k: k=val for i in range(k): s +=ca[i][1] print(n-s)
s088296181
p03495
u248670337
1567629995
Python
Python (3.4.3)
py
Runtime Error
204
37780
166
from collections import Counter n,k=map(int,input().split()) A=sorted(Counter(list(map(int,input().split()))).most_common()) print(n-sum([A[i][1] for i in range(k)]))
s327405052
p03495
u928385607
1567093251
Python
Python (3.4.3)
py
Runtime Error
2104
25876
288
nk = list(map(int,input().split())) a = list(map(int,input().split())) sa = list(set(a)) if len(sa) > nk[1]: c = [] for i in range(len(sa)): c.append(a.count(sa[i])) sortc = sorted(c, reverse = True) for i in range(nk[1]): m += sc[i] ans = n - m else: ans = 0 print(ans)
s730679435
p03495
u640603056
1566955014
Python
Python (3.4.3)
py
Runtime Error
96
32556
700
"""################################################################# 【ABC081】 C - Not so Diverse #################################################################""" #インポート import sys from collections import Counter #入力用 def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) #リスト(int型) def MI(): retu...
s514878163
p03495
u940449872
1566774983
Python
Python (3.4.3)
py
Runtime Error
346
53432
449
N, K = map(int, input().split()) A = list(map(int, input().split())) A_dict = {str(i):0 for i in set(A)} for a in A: A_dict[str(a)] += 1 def get_A_key_from_value(dic, value): keys = [i for i, j in dic.items() if j == value] if len(keys) != 1: keys = keys[0] return keys[0] ans = 0 while True: if len(A...
s140903085
p03495
u527925554
1566497749
Python
Python (3.4.3)
py
Runtime Error
119
41120
267
N, K = map(int, input().split()) A = map(int, input().split()) count = {} for a in A: count[a] = count.get(a, 0) + 1 tmp = [] for k, v in count: tmp.appned(v) tmp = sorted(tmp) total = 0 for i in range(len(sorted_) - K): total += tmp[i] print(total)
s453214320
p03495
u527925554
1566497669
Python
Python (3.4.3)
py
Runtime Error
134
41244
301
N, K = map(int, input().split()) A = map(int, input().split()) count = {} for a in A: count[a] = count.get(a, 0) + 1 tmp = [] for k, v in count: tmp.appned(v) tmp = sorted(tmp) total = 0 while K < len(sorted_): k, v = sorted_[0] sorted_ = sorted_[1:] total += v print(total)
s935167097
p03495
u835482198
1566420879
Python
Python (3.4.3)
py
Runtime Error
19
3060
135
n, k = map(int, input().split()) a = list(set([int(input) for _ in range(n)])) if k >= len(a): print(0) else: print(k - len(a))
s191326570
p03495
u033606236
1566162360
Python
Python (3.4.3)
py
Runtime Error
250
24996
463
nums , types = map(int, input().split()) array = list(map(int,input().split())) array.sort() type_count = 0 count = 0 result = 0 ary_count = [] array.append(1000000000) for i in range (nums): if array[i] == array[i + 1]: count += 1 elif array[i] < array[i+1]: ary_count.append(count) typ...
s119327190
p03495
u728566015
1565963457
Python
Python (3.4.3)
py
Runtime Error
2104
25748
202
N, K = map(int, input().split()) A = list(map(int, input().split())) c = [0] * N for i in range(N): c[i] = A.count(i + 1) c = sorted(c) n = len(c) if n - K > 0: cnt = sum(c[:n - K]) print(cnt)
s455257654
p03495
u126232616
1565962078
Python
Python (3.4.3)
py
Runtime Error
110
32564
229
from collections import Counter n,k = map(int,input().split()) a = list(map(int,input().split())) cnt = Counter(a) mo = sorted(cnt,reverse=True) #print(mo) ans = 0 for i in range(max(0,len(mo)-k)): ans += mo[i][1] print(ans)
s346267983
p03495
u296150111
1565739588
Python
Python (3.4.3)
py
Runtime Error
351
32960
275
n,k=map(int,input().split()) a=list(map(int,input().split())) a.sort() b=a[0] cnt=1 x=[] for i in range(1,n): if b==a[i]: cnt+=1 else: x.append([a[i-1],cnt]) cnt=1 b=a[i] x.append([a[-1],cnt]) x.sort(key=lambda x:-x[1]) y=0 for i in range(k): y+=x[i][1] print(n-y)
s733490460
p03495
u908763441
1565737890
Python
Python (3.4.3)
py
Runtime Error
2104
27012
309
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 N, K = map(int, input().split()) A = list(map(int, input().split())) L = [] B = set(A) for i in B: L.append(A.count(i)) L.sort() if len(B) <= K: print('0') else: print(str(sum(L[0:len(B)-K]))) if __name__ == "__main__": main()
s679475816
p03495
u611562941
1563738428
Python
PyPy2 (5.6.0)
py
Runtime Error
40
28396
341
N,K = map(int,input().split()) A = list(map(int,input().split())) A.sort() num = [] cnt = [] for a in A: if a not in num: num.append(a) cnt.append(1) else: cnt[-1] += 1 cnt.sort() #print(num,cnt) res = 0 M = len(cnt) if M <= K: res = 0 else: for i in range(M-K): res +=...