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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s781555456 | p03495 | u416758623 | 1563243702 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 26568 | 331 | n,k = map(int, input().split())
binary = [0 for _ in range(n)]
ls = list(map(int, input().split()))
for i in ls:
binary[i-1] += 1
binary = sorted(binary)
binary.pop(binary.index(0))
ans = 0
i = 0
while k < len(binary) - binary.count(0):
if binary[i] != 0:
ans += binary[i]
binary.pop(i)
i+=1... |
s885805622 | p03495 | u416758623 | 1563243668 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 26344 | 344 | n,k = map(int, input().split())
binary = [0 for _ in range(n)]
ls = list(map(int, input().split()))
for i in ls:
binary[i-1] += 1
binary = sorted(binary)
binary.pop(binary.index(0))
print(binary)
ans = 0
i = 0
while k < len(binary) - binary.count(0):
if binary[i] != 0:
ans += binary[i]
binary.po... |
s390569433 | p03495 | u007550226 | 1562851783 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 193 | ,K = map(int,input().split())
a = list(map(int,input().split()))
adic = {}
for c in a:adic[c] = adic.get(c,0) + 1
alist = sorted([adic[c] for c in adic.keys()])
print(sum(alist[:len(alist)-K])) |
s483846173 | p03495 | u198062737 | 1562250108 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 923 | import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeSet;
class ball implements Comparable<ball>{
int num, id;
public ball(int n, int i) {
num = n; id = i;
}
public int compareTo(ball o) {
if(num == o.num) return id - o.id;
return num - o.num;
}
}
class Main{
... |
s318831392 | p03495 | u927534107 | 1561491238 | Python | Python (3.4.3) | py | Runtime Error | 66 | 25748 | 221 | n,k = map(int,input().split())
lst = list(map(int,input().split()))
lst_com = collections.Counter(lst).most_common()
if len(lst_com)<=k:
print(0)
exit()
ans=n
for i in range(k):
ans -= lst_com[i][1]
print(ans) |
s377198977 | p03495 | u298975656 | 1560388609 | Python | Python (3.4.3) | py | Runtime Error | 64 | 24836 | 160 | N, K = map(int, input().split())
A = list(map(int, input().split()))
count_li = Counter(A)
li = sorted(list(count_li.values()), reverse=True)
print(sum(li[K:])) |
s575799256 | p03495 | u543894008 | 1559449233 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 26628 | 255 | n, k = map(int, input().split())
a = list(map(int, input().split()))
seta = set(a)
dic = {}
for i in seta:
dic[i] = a.count(i)
dic = sorted(dic.items(), key=lambda x:x[1], reverse=True)
cnt = 0
for i in range(k):
cnt = cnt + dic[i][1]
print(n - cnt) |
s200657185 | p03495 | u543894008 | 1559449154 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 25276 | 266 | n, k = map(int, input().split())
a = list(map(int, input().split()))
seta = set(a)
dic = {}
for i in seta:
dic[i] = a.count(i)
dic = sorted(dic.items(), key=lambda x:x[1], reverse=True)
print(dic)
cnt = 0
for i in range(k):
cnt = cnt + dic[i][1]
print(n - cnt) |
s498239720 | p03495 | u039360403 | 1559201076 | Python | PyPy3 (2.4.0) | py | Runtime Error | 480 | 118728 | 177 | import collections
N,K=map(int,input().split())
A=list(map(int,input().split()))
B=collections.Counter(A).most_common()
print(sum(B[::-1][:K][i][1] for i in range(len(B[K:])))) |
s290555565 | p03495 | u039360403 | 1559200960 | Python | PyPy3 (2.4.0) | py | Runtime Error | 491 | 118728 | 175 | import collections
N,K=map(int,input().split())
A=list(map(int,input().split()))
B=collections.Counter(A).most_common()
print(sum(B[::-1][:K][i][1] for i in range(len(B)-K))) |
s877020219 | p03495 | u761529120 | 1559181693 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 24748 | 316 | N, K = map(int, input().split())
A = list(map(int, input().split()))
TMP = [0] * N
for i in A:
TMP[i-1] += 1
filter_TMP = sorted([i for i in TMP if i > 0])
n = sum( x > 0 for x in filter_TMP)
cnt = 0
ans = 0
while n > K:
ans += filter_TMP[cnt]
del filter_TMP[cnt]
cnt += 1
n -= 1
print(ans) |
s015799555 | p03495 | u623687794 | 1558584891 | Python | Python (3.4.3) | py | Runtime Error | 282 | 25736 | 541 | N,K = map(int,input().split())
nums = list(map(int,input().split()))
nums.sort()
dif = []
cnt=[]
for i in range(N-1):
if nums[i] != nums[i+1]:
dif.append(i+1) #玉の番号の変わり目を記録する
for i in range(len(dif)+1):
if i == 0:
cnt.append(dif[0])
if i == len(dif):
cnt.append(N-dif[-1])
break
cnt.append(dif[i]... |
s173340349 | p03495 | u623687794 | 1558584772 | Python | Python (3.4.3) | py | Runtime Error | 294 | 25732 | 530 | N,K = map(int,input().split())
nums = list(map(int,input().split()))
nums.sort()
dif = []
cnt=[]
for i in range(N-1):
if nums[i] != nums[i+1]:
dif.append(i+1) #玉の番号の変わり目を記録する
for i in range(len(dif)+1):
if i == 0:
cnt.append(dif[0])
if i == len(dif):
cnt.append(N-dif[-1])
cnt.append(dif[i]-dif[i-1])... |
s630831966 | p03495 | u698176039 | 1558370411 | Python | Python (3.4.3) | py | Runtime Error | 99 | 24852 | 229 | N,K = map(int,input().split())
A = list(map(int,input().split()))
nlist = [0] * N
for i in A:
nlist[i] += 1
nlist.sort(reverse = True)
cnt = 0
for i in range(K,N):
if nlist[i] == 0: break
cnt += nlist[i]
print(cnt) |
s552768416 | p03495 | u204800924 | 1558242651 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 24996 | 438 | N, K = map(int, input().split())
A = list( map(int, input().split()) ) #ここでN個受け取る
flags = [0] * 21000
nums = [0] * 21000
for i in range(N):
flags[A[i]] = 1
nums[A[i]] += 1
s_nums = sorted(nums)
count = 0
ans = 0
if sum(flags) - K > 0:
for j in range(len(s_nums)):
if count < sum(flags)-K:
... |
s534098553 | p03495 | u204800924 | 1558240022 | Python | Python (3.4.3) | py | Runtime Error | 66 | 25876 | 328 | N, K = map(int, input().split())
A = list( map(int, input().split()) ) #ここでN個受け取る
var = [0] * N+1
for i in A:
var[i] += 1
var = sorted(var, reverse = True )
count = 0
for j in range( K, N+1 ):
if var[j] == 0:
break
if var[j] != 0:
count += var[j]
print(count) |
s567352707 | p03495 | u204800924 | 1558239881 | Python | Python (3.4.3) | py | Runtime Error | 66 | 24852 | 319 | N, K = map(int, input().split())
A = list( map(int, input().split()) ) #ここでN個受け取る
var = [0] * N+1
for i in A:
var[i] += 1
var.sort( reverse = True )
count = 0
for j in range( K, N+1 ):
if var[j] == 0:
break
if var[j] != 0:
count += var[j]
print(count) |
s430389428 | p03495 | u204800924 | 1558239671 | Python | Python (3.4.3) | py | Runtime Error | 66 | 26012 | 329 | N, K = map(int, input().split())
A = list( map(int, input().split()) ) #ここでN個受け取る
var = [0] * 21000
for i in range(N):
var[A[i]] += 1
var.sort( reverse = True )
count = 0
for j in range( K, N ):
if var[j] == 0:
break
if var[j] != 0:
count += var[j]
print(count) |
s403428970 | p03495 | u204800924 | 1558236350 | Python | Python (3.4.3) | py | Runtime Error | 65 | 24748 | 399 | N, K = map(int, input().split())
A = list( map(int, input().split() ) )
nums=[0] * 21000
var = [0] * 21000
for i in range(N):
nums[A[i]] += 1
var[A[i]] = 1
VAR = sum(var)
s_nums = sorted(nums, reverse = True)
ans = 0
# flag = 0
# for j in range(N):
if VAR <= K:
print(0)
if VAR > K:
... |
s276608079 | p03495 | u204800924 | 1558219154 | Python | Python (3.4.3) | py | Runtime Error | 65 | 24996 | 458 | N, K = map(int, input().split())
A = list( map(int, input().split()) ) #ここでN個受け取る
flags = [0] * 21000
nums = [0] * 21000
for i in range(N):
flags[A[i]] = 1
nums[A[i]] += 1
s_nums = sorted(nums)
count = 0
ans = 0
if sum(flags) - K > 0:
for j in range(len(s_nums)):
if s_nums[j] != 0 and count ... |
s468183961 | p03495 | u204800924 | 1558218178 | Python | Python (3.4.3) | py | Runtime Error | 65 | 24996 | 456 | N, K = map(int, input().split())
A = list( map(int, input().split()) ) #ここでN個受け取る
flags = [0] * 21000
nums = [0] * 21000
for i in range(N):
flags[A[i]] = 1
nums[A[i]] += 1
s_nums = sorted(nums)
count = 0
ans = 0
if sum(flags) - K > 0:
for j in range(len(s_nums)):
if s_nums[j] != 0 and count ... |
s577405868 | p03495 | u416758623 | 1558094069 | Python | Python (3.4.3) | py | Runtime Error | 82 | 27004 | 290 | n,k = map(int, input().split())
a = list(map(int, input().split()))
setA = set(a)
c = Counter(A)
ans = 0
for w, v in sorted(c.items(), key=lambda x: x[1]):
if k < len(set(a)):
while w in a:
aIndex = a.index(w)
a.pop(aIndex)
ans+=1
print(ans) |
s320954531 | p03495 | u416758623 | 1558093931 | Python | Python (3.4.3) | py | Runtime Error | 80 | 25644 | 292 | n,k = map(int, input().split())
a = list(map(int, input().split()))
setA = set(a)
c = Counter(A)
ans = 0
for w, v in sorted(c.items(), key=lambda x: x[1]):
if k < len(set(a)):
while w in a:
aIndex = a.index(w)
a.pop(aIndex)
ans+=1
print(ans)
|
s174995262 | p03495 | u425016634 | 1556826614 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 209 | N,K=map(int,input().split())
A=list(map(int,input().split()))
b=list(set(A))
ans=0
count=[]
for i in range(len(b):
count.append(A.count(b[i]))
count.sort()
for i in range(c-K):
ans+=count[i]
print(ans) |
s166074221 | p03495 | u542932305 | 1555649143 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 32184 | 380 | N, K = map(int, input().split())
A = list(map(int, input().split()))
buckets = {}
for i in A:
if i in buckets:
buckets[i] += 1
else:
buckets[i] = 1
kinds = sorted(buckets.values())
if K < len(kinds):
mini = 0
for i in range(len(kinds)):
mini += kinds.pop(i)
if len(kinds... |
s538017288 | p03495 | u837565838 | 1555517723 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 208 | s = list(set(l))
num = range(len(s))
if len(s) <= K: print 0
else:
for i in range(len(s)):
num[i] = len([j for j in l if j == s[i]])
sousa = len(s)-K
num.sort()
print sum(num[:sousa])
|
s882236021 | p03495 | u145889196 | 1555372946 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 25276 | 293 | N,K=map(int,input().split())
A=list(map(int,input().split()))
As=list(set(A))
sa=max(0,len(As)-K)
if sa==0:
print(0)
exit
else:
count=[0]*len(As)
for i in As:
count[i]=A.count(i)
num=sorted(count)
ans=0
for i in range(sa):
ans+=num[i]
print(ans) |
s051643839 | p03495 | u145889196 | 1555366727 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 290 | N,K=map(int,input().split())
A=list(map(int,input().split()))
As=list(set(A))
sa=max(0,len(As)-K)
if sa==0:
print(0)
break
else:
count=[]
for i in As:
count.append(A.count(i))
num=sorted(count)
ans=0
for i in range(sa):
ans+=num[i]
print(ans) |
s895433628 | p03495 | u013629972 | 1554578921 | Python | Python (3.4.3) | py | Runtime Error | 2105 | 35212 | 877 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI()... |
s760409133 | p03495 | u013629972 | 1554578857 | Python | Python (3.4.3) | py | Runtime Error | 162 | 35212 | 877 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI()... |
s669297045 | p03495 | u013629972 | 1554578781 | Python | Python (3.4.3) | py | Runtime Error | 169 | 35212 | 876 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI()... |
s682004736 | p03495 | u013629972 | 1554578462 | Python | Python (3.4.3) | py | Runtime Error | 133 | 35208 | 817 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI()... |
s622660212 | p03495 | u001687078 | 1554413010 | Python | Python (3.4.3) | py | Runtime Error | 95 | 41500 | 189 | import collections
n, k = map(int, input().split())
a = map(int, input().split())
c = collections.Counter(a)
if len(c) <= K:
print(0)
else:
c = c.most_common()
print(sum(c[:K-1][0])) |
s430906193 | p03495 | u013408661 | 1554145083 | Python | Python (3.4.3) | py | Runtime Error | 83 | 26812 | 401 | n,k=map(int,input().split())
stack=[0]*(2*10**5+1)
a=list(map(int,input().split()))
num=len(set(a))
for i in a:
stack[a]+=1
stack.sort()
def binarysearch():
ng=-1
ok=2*10**5+1
while abs(ng-ok)>1:
mid=(ng+ok)//2
if stack[mid]==0:
ng=mid
else:
ok=mid
return ok
p=binarysearch()
ans=0
if n... |
s449703930 | p03495 | u013408661 | 1554145044 | Python | Python (3.4.3) | py | Runtime Error | 83 | 26812 | 370 | n,k=map(int,input().split())
stack=[0]*(2*10**5+1)
a=list(map(int,input().split()))
num=len(set(a))
for i in a:
stack[a]+=1
stack.sort()
def binarysearch():
ng=-1
ok=2*10**5+1
while abs(ng-ok)>1:
mid=(ng+ok)//2
if stack[mid]==0:
ng=mid
else:
ok=mid
return ok
p=binarysearch()
ans=0
for ... |
s703285914 | p03495 | u235905557 | 1551558132 | Python | Python (3.4.3) | py | Runtime Error | 76 | 34212 | 267 | N, K = map(int, input().split())
args = map(int, input().split())
count = len(set(args))
balls = {}
for ball in count:
balls[ball] = 0
for i in args:
balls[i] += 1
if count <= K:
print (0)
else:
print (sum(sorted(balls.values())[0:max(count-K, 0)]))
|
s212197019 | p03495 | u235905557 | 1551557926 | Python | PyPy3 (2.4.0) | py | Runtime Error | 257 | 94032 | 267 | N, K = map(int, input().split())
args = map(int, input().split())
count = len(set(args))
balls = {}
for ball in count:
balls[ball] = 0
for i in args:
balls[i] += 1
if count <= K:
print (0)
else:
print (sum(sorted(balls.values())[0:max(count-K, 0)]))
|
s510135637 | p03495 | u338225045 | 1551545978 | Python | Python (3.4.3) | py | Runtime Error | 105 | 25644 | 268 | N, K = map( int, input().split() )
A = list( map( int, input().split() ) )
numAppeared = [0] * (N+1)
for i in A:
numAppeared[i] += 1
numAppeared.sort( reverse=True )
# print( sum( numAppeared[i] for i in range(K,N) ) )
print( sum( numAppeared( range(K,N) ) ) ) |
s756334133 | p03495 | u083960235 | 1551392935 | Python | Python (3.4.3) | py | Runtime Error | 54 | 19244 | 168 | n,k=map(int,input().split())
a=list(map(str,input().split()))
a_c=collections.Counter(a)
l=sorted(a_c.values())
ans=0
for i in range(len(l)-k):
ans+=l[i]
print(ans) |
s592818553 | p03495 | u392029857 | 1551392449 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 27172 | 172 | N, K = map(int, input().split())
a = list(map(int, input().split()))
if N == K:
print(0)
else:
print(sum(sorted([a.count(i) for i in set(a)])[0:len(bucket) - K:])) |
s380389213 | p03495 | u266569040 | 1550955549 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 915 | B
�����j\_������������������@���s����d�dl�Z�d�dlmZ�eee������\ZZdd��e�����D��Z e
e��e ��Ze
e�ekr`ed���nJee���ed�d�Zd�Zx(ee
e�e��D�]Zeee�d�7�Zq�W�ee��dS�)�����N)�
itemgetterc�������������C���s���g�|�]}t�|��qS���)�int)�.0�jr���r����
ABC081C... |
s338802543 | p03495 | u286955577 | 1550465236 | Python | Python (3.4.3) | py | Runtime Error | 113 | 18436 | 153 | N,K = map(int,input().split())
A = map(int, input().split())
count = [0] * N
for a in A:
count[a] += 1
count.sort(reverse=True)
print(sum(count[K:]))
|
s309770948 | p03495 | u734876600 | 1549512005 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 253 | import collections
N, K = map(int, input().split())
a = list(map(int, input().split())
import collections
def solve():
c = list(collections.Counter(a).values())
c.sort()
if(len(c)<=k):
print(0)
else:
print(sum(c[:len(c)-k]))
solve() |
s707661110 | p03495 | u734876600 | 1549511886 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 232 | N, K = map(int, input().split())
a = list(map(int, input().split())
import collections
def solve():
c = list(collections.Counter(a).values())
c.sort()
if(len(c)<=k):
print(0)
else:
print(sum(c[:len(c)-k]))
solve() |
s634325120 | p03495 | u077075933 | 1549426483 | Python | Python (3.4.3) | py | Runtime Error | 2105 | 25644 | 251 | n, k = map(int, input().split())
a = list(map(int, input().split()))
def solve():
a.sort()
c = [a.count(i) for i in range(1,n+1) if a.count(i)>0]
c.sort()
if(len(count)<=k):
print(0)
else:
print(sum(count[:len(c)-k]))
solve()
|
s435250129 | p03495 | u444732068 | 1548219602 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 25276 | 291 | N,K = map(int,input().split())
A = list(map(int,input().split()))
A_unique = list(set(A))
N_unique = len(A_unique)
a = [A.count(A_unique[i]) for i in range(N_unique)]
a_sort = sorted(a)
M = A_unique-K
if M <= 0:
print(0)
exit()
ans = 0
for i in range(0,M):
ans += a_sort[i]
print(ans)
|
s141829250 | p03495 | u444732068 | 1548219531 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 25276 | 284 | N,K = map(int,input().split())
A = list(map(int,input().split()))
A_unique = list(set(A))
N_unique = len(A_unique)
a = [A.count(A_unique[i]) for i in range(N_unique)]
a_sort = sorted(a)
M = N-K
if M <= 0:
print(0)
exit()
ans = 0
for i in range(0,M):
ans += a_sort[i]
print(ans)
|
s930228447 | p03495 | u189575640 | 1547304296 | Python | Python (3.4.3) | py | Runtime Error | 133 | 27684 | 434 | import sys
# A,B,C = [int(n) for n in input().split()]
N,K = [int(n) for n in input().split()]
# S = str(input())
# T = str(input())
bucket = [0]*(N+1)
A = [int(n) for n in input().split()]
s = set(A)
for a in A:
bucket[a]+=1
bucket = [n for n in bucket if n != 0]
rc = len(s) - K
ans = 0
for r in range(rc):
tmi... |
s273434594 | p03495 | u575431498 | 1544678338 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 32284 | 315 | N, K = map(int, input().split())
A = [int(a) for a in input().split()]
summary = {}
for a in A:
if a not in summary.keys():
summary[a] = 1
else:
summary[a] += 1
s_list = list(summary.values())
s_list.sort()
res = 0
i = 0
while len(s_list) > K:
res += s_list.pop(i)
i += 1
print(res) |
s219810501 | p03495 | u138486156 | 1544130443 | Python | Python (3.4.3) | py | Runtime Error | 155 | 37784 | 177 | from collections import Counter
n, k = map(int, input().split())
c = Counter(list(map(int, input().split()))).most_common()
m = 0
for i in range(k):
m += c[i][1]
print(n-m)
|
s644638616 | p03495 | u661066442 | 1543974704 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 25644 | 296 | n, k = map(int, input().split())
a = list(map(int, input().split()))
count = 0;
def cnt_uniq(li):
ret = []
for i in li:
if i not in ret:
ret.append(i)
return ret
uniq = sorted(cnt_uniq(a))
while k < len(uniq):
count += uniq[0]
uniq.pop[0]
print(count)
|
s318132416 | p03495 | u652150585 | 1541734336 | Python | Python (3.4.3) | py | Runtime Error | 69 | 24748 | 178 | n,k=map(int,input().split())
l=list(map(int,input().split()))
#print(l)
s=collections.Counter(l)
s=s.most_common()
#print(s)
a=0
for i in range(k,len(s)):
a+=s[i][1]
print(a) |
s251777497 | p03495 | u247366051 | 1540075939 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 436 | #include<bits/stdc++.h>
using namespace std;
int a[2000010];
int main(){
int l=100000,r=0;
int n,k;
cin>>n>>k;
int d;
for(int i=1;i<=k;i++)
{
cin>>d;
a[d]++;
l=min(l,d);
r=max(r,d);
}
if(r-i+1<=k) {
cout<<0;
return 0;
}
sort(a+l,... |
s931753656 | p03495 | u365375535 | 1539919145 | Python | Python (3.4.3) | py | Runtime Error | 262 | 39292 | 429 | import sys
N, K = map(int, input().split())
A_list = sorted(map(int,input().split()))
A_index = list(set(A_list))
A_len = len(A_index)
if K >= A_len:
print(0)
sys.exit()
ANumDict = {}
i = 0
num = 0
for A in A_list:
if A == A_index[i]:
num += 1
else:
ANumDict[A_index[i]] = num
num = 1
i += 1
ANum... |
s624129303 | p03495 | u365375535 | 1539918486 | Python | Python (3.4.3) | py | Runtime Error | 264 | 38328 | 379 | N, K = map(int, input().split())
A_list = sorted(map(int,input().split()))
A_index = list(set(A_list))
ANumDict = {}
i = 0
num = 0
for A in A_list:
if A == A_index[i]:
num += 1
else:
ANumDict[A_index[i]] = num
num = 1
i += 1
ANumDict[A_index[i]] = num
A_count = sorted(ANumDict.values())
A_len = len(... |
s398583860 | p03495 | u790877102 | 1538982622 | Python | Python (3.4.3) | py | Runtime Error | 38 | 18820 | 221 | import collections
n,k = map(int,input().split())
a = list(map(input().split()))
a = collections.Counter(a)
a = a.most_common()
if k<len(a):
x = 0
for i in range(k,len(a)):
x += a[i][1]
print(x)
else:
print(0)
|
s782819391 | p03495 | u466478199 | 1537590522 | Python | Python (3.4.3) | py | Runtime Error | 132 | 32572 | 175 | from collections import Counter
N,K=map(int,input().split())
A=list(map(int,input().split()))
x=Counter(A)
l=x.most_common(K)
s=0
for i in range(K):
s+=l[i][1]
print(N-s) |
s578178275 | p03495 | u466478199 | 1537585793 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 25276 | 181 | N,K=map(int,input().split())
A=list(map(int,input().split()))
L=[]
B=set(A)
for i in B:
x=A.count(i)
L.append(x)
L.sort(reverse=True)
S=0
for i in range(K):
S+=L[i]
print(N-S) |
s569525859 | p03495 | u466478199 | 1537585541 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 24996 | 252 | N,K=map(int,input().split())
A=list(map(int,input().split()))
L=[]
A.sort()
A.append(200001)
for i in range(N):
if A[i]==A[i+1]:
continue
else:
x=A.count(A[i])
L.append(x)
L.sort(reverse=True)
S=0
for i in range(K):
S+=L[i]
print(N-S) |
s347526223 | p03495 | u466478199 | 1537584876 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 25716 | 262 | N,K=map(int,input().split())
A=list(map(int,input().split()))
L=[]
A.sort()
A.append(200001)
for i in range(N):
if A[i]==A[i+1] or i==N-1:
continue
else:
x=A.count(A[i])
L.append(x)
L.sort(reverse=True)
S=0
for i in range(K):
S+=L[i]
print(N-S) |
s685179350 | p03495 | u513081876 | 1537148681 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 25276 | 189 | N , K = map(int, input().split())
A = list(map(int, input().split()))
syurui = set(A)
ans = 0
if len(syurui) > K:
ans = sum(sorted([A.count(i) for i in syurui])[:n_syurui-K])
print(ans) |
s123387208 | p03495 | u197078193 | 1535583266 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 39348 | 196 | N,K = map(int,input().split())
A = list(map(int,input().split()))
import collections
c = collections.Counter(A)
ans = N
for k in range(K):
n = c.most_common()[k][0]
ans -= c[n]
print(ans)
|
s005871292 | p03495 | u221345507 | 1535180536 | Python | Python (3.4.3) | py | Runtime Error | 162 | 39344 | 214 | import collections
N, K =map(int,input().split())
a=list(map(int,input().split()))
c = collections.Counter(a)
c_=c.most_common()
c__=np.array(c_)
ans=0
for i in range (K,c__.shape[0]):
ans+=c__[i][1]
print(ans) |
s523948664 | p03495 | u366644013 | 1535058722 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 279 | n, k = map(int, input().split())
a = list(map(int, input().split())
ans = 0
dic = {}
for i in a:
if i in dic:
dic[i] += 1
else:
dic[i] = 1
dic = sorted(dic.items(), key=lambda x: x[1])
while len(dic) > k:
ans += dic[0][1]
del dic[0]
print(ans) |
s945000077 | p03495 | u796060588 | 1534477947 | Python | Python (2.7.6) | py | Runtime Error | 157 | 28776 | 197 | # vim: set fileencoding=utf-8 :
from collections import Counter
n, k = map(int, raw_input().split())
a = map(int, raw_input().split())
c = Counter(a).values().sort(reverse=True)
print(sum(c[:k]))
|
s505706256 | p03495 | u690536347 | 1533052054 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 227 | N,K=map(int,raw_input().split())
d={}
l=map(int,raw_input().split())
for i in l:
if not i in d:
d[i]=1
else:
d[i]+=1
c=0
e=list(sorted(d.items(),key=lambda x:x[1]))[:len(d.items())-K]
for i in e:
c+=i[1]
print(c)
|
s314053367 | p03495 | u690536347 | 1533051765 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 227 | N,K=map(int,raw_input().split())
d={}
l=map(int,raw_input().split())
for i in l:
if not i in d:
d[i]=1
else:
d[i]+=1
c=0
e=list(sorted(d.items(),key=lambda x:x[1]))[len(d.items())-K:]
for i in e:
c+=i[1]
print(c)
|
s637428865 | p03495 | u690536347 | 1533051712 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 221 | N,K=map(int,raw_input().split())
d={}
l=map(int,raw_input().split())
for i in l:
if not i in d:
d[i]=1
else:
d[i]+=1
c=0
e=sorted(d.items(),key=lambda x:x[1])[len(d.items())-K:]
for i in e:
c+=i[1]
print(c)
|
s124074697 | p03495 | u690536347 | 1533051147 | Python | Python (3.4.3) | py | Runtime Error | 169 | 41120 | 201 | N,K=map(int,input().split())
d={}
l=map(int,input().split())
for i in l:
if not i in d:
d[i]=1
else:
d[i]+=1
c=0
e=list(sorted(d.items(),key=lambda x:x[1]))[len(d)-K:]
for i in e:
c+=e[1] |
s503692114 | p03495 | u115682115 | 1532212411 | Python | Python (3.4.3) | py | Runtime Error | 95 | 32564 | 148 | from collections import Counter
N,K = map(int,input().split())
ctr = Counter(list(map(int,input().split())))
a = ctr.values()
print(N - sum(a[:K]))
|
s818916611 | p03495 | u115682115 | 1532211185 | Python | Python (3.4.3) | py | Runtime Error | 112 | 45412 | 191 | from collections import Counter
N,K = map(int,input().split())
a = list(map(int,input().split()))
matome = set(a)
counter =0
ctr = Counter(a)
kensyo = ctr.values()
print(N - sum(kensyo[:K]))
|
s709699567 | p03495 | u125505541 | 1530846002 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38640 | 863 | /*
g++ -std=c++11 -o2 -Wall ABC081C.cpp -o ./out/ABC081C.out
./out/ABC081C.out
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
std::fill( (T*)array, (T*)(array+N), val );
}
constexpr ll INF = 10000000000000... |
s808811840 | p03495 | u785220618 | 1528599406 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 46996 | 477 | # -*- coding: utf-8 -*-
n, k = map(int, input().split())
A = list(map(int, input().split()))
dict_A = {i: 0 for i in range(1, n+1)}
for a in A:
dict_A[a] += 1
num_list = [[] for _ in range(n)]
for key in dict_A.keys():
num_list[dict_A[key]].append(key)
ans = 0
count = len(dict_A.keys())
pointer = 1
while co... |
s899061747 | p03495 | u785220618 | 1528599036 | Python | Python (3.4.3) | py | Runtime Error | 2105 | 39632 | 510 | # -*- coding: utf-8 -*-
n, k = map(int, input().split())
A = list(map(int, input().split()))
dict_A = {}
for a in A:
if a not in dict_A:
dict_A[a] = 1
else:
dict_A[a] += 1
num_list = [[] for _ in range(n)]
for key in dict_A.keys():
num_list[dict_A[key]].append(key)
ans = 0
count = len(di... |
s209454119 | p03495 | u624475441 | 1528436893 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 340 | #include <algorithm>
#include <iostream>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; ++i)
using namespace std;
int main() {
int N, K;
cin >> N >> K;
vector<int> c(N);
REP(i,N) {
int a; cin >> a; c[--a]++;
}
sort(c.begin(), c.end(), greater<int>());
int s = N;
REP(i,K) s -= c[i];
cout << s <... |
s165836101 | p03495 | u091855288 | 1525407626 | Python | Python (3.4.3) | py | Runtime Error | 104 | 19476 | 112 | N, K = map(int, input().split())
B = [0]*N
for i in input().split():
B[int(i)] += 1
print(sum(sorted(B)[:-K])) |
s155332348 | p03495 | u811202694 | 1525398682 | Python | Python (3.4.3) | py | Runtime Error | 167 | 42520 | 235 | from collections import Counter
n, k = map(int, input().split())
a = Counter((i for i in input().split()))
sort_count = sorted(a.items(), key=lambda x: x[1])
total = 0
for i in range(k):
total += sort_count[i][1]
print(n-total)
|
s086457782 | p03495 | u503901534 | 1524811315 | Python | Python (3.4.3) | py | Runtime Error | 212 | 32184 | 368 | n, k = map(int,input().split())
al = list(map(int,input().split()))
dics = {}
for i in range(n):
if al[i] in dics:
dics[al[i]] = dics[al[i]] + 1
else:
dics.update({al[i]:1})
counts = len(dics.keys())
kesu = 0
sortv = list(sorted(dics.values()))
if len(sortv) > k:
for i in range(n-... |
s181664120 | p03495 | u503901534 | 1524811154 | Python | Python (3.4.3) | py | Runtime Error | 196 | 32184 | 368 | n, k = map(int,input().split())
al = list(map(int,input().split()))
dics = {}
for i in range(n):
if al[i] in dics:
dics[al[i]] = dics[al[i]] + 1
else:
dics.update({al[i]:1})
counts = len(dics.values())
kesu = 0
sortv = list(sorted(dics.values()))
if len(sortv) > k:
for i in range(... |
s519114454 | p03495 | u503901534 | 1524811119 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 451 | n, k = map(int,input().split())
al = list(map(int,input().split()))
dics = {}
for i in range(n):
if al[i] in dics:
dics[al[i]] = dics[al[i]] + 1
else:
dics.update({al[i]:1})
counts = len(dics.values())
kesu = 0
sortv = list(sorted(dics.values()))
#while len(sortv) > k:
# kesu = ke... |
s762520518 | p03495 | u503901534 | 1524810933 | Python | Python (3.4.3) | py | Runtime Error | 16 | 2940 | 457 | n, k = map(int,input().split())
al = list(map(int,input().split()))
dics = {}
for i in range(n):
if al[i] in dics:
dics[al[i]] = dics[al[i]] + 1
else:
dics.update({al[i]:1})
counts = len(dics.values())
kesu = 0
sortv = list(sorted(list((dics.values()))))
#while len(sortv) > k:
# k... |
s260863969 | p03495 | u503901534 | 1524810855 | Python | Python (3.4.3) | py | Runtime Error | 196 | 32312 | 456 | n, k = map(int,input().split())
al = list(map(int,input().split()))
dics = {}
for i in range(n):
if al[i] in dics:
dics[al[i]] = dics[al[i]] + 1
else:
dics.update({al[i]:1})
counts = len(dics.values())
kesu = 0
sortv = list(sorted(list((dics.values()))))
#while len(sortv) > k:
# ke... |
s401835292 | p03495 | u503901534 | 1524810007 | Python | Python (3.4.3) | py | Runtime Error | 175 | 32184 | 358 | n, k = map(int,input().split())
al = list(map(int,input().split()))
dics = {}
for i in range(n):
if al[i] in dics:
dics[al[i]] = dics[al[i]] + 1
else:
dics.update({al[i]:1})
counts = len(dics.values())
kesu = 0
sortv = dics.values()
while len(sortv) > k:
kesu = kesu + min(sortv)
... |
s191762670 | p03495 | u702582248 | 1520491044 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 199 | n, k = input().split()
a = {}
for i in [int(j) for j in input().split()]:
if i in a:
a[i] += 1
else:
a[i] = 1
if len(a) <= k:
print(0)
else:
print(sum(sorted(a.values())[len(a) - k])) |
s216101195 | p03495 | u820351940 | 1520368685 | Python | Python (3.4.3) | py | Runtime Error | 109 | 24748 | 301 | # 5 2
# 1 1 2 2 5
n, k = map(int, input().split())
a = list(map(int, input().split()))
countup = [0 for x in range(n)]
for i in a:
countup[i] += 1
result = 0
f = list(filter(lambda x: x != 0, countup.sort()))
for i, v in enumerate(f):
if i >= len(f) - k:
print(result)
break
result += v
|
s714486179 | p03495 | u030726788 | 1519702190 | Python | Python (3.4.3) | py | Runtime Error | 204 | 24744 | 277 | n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
kind=[]
count=1
for i in range(len(a)-1):
if(a[i]==a[i+1]):count+=1
else:
kind.append(count)
count=1
kind.append(count)
kind.sort()
change=0
for i in range(k):change+=kind.pop()
print(n-change)
|
s422556092 | p03495 | u143492911 | 1517518599 | Python | Python (3.4.3) | py | Runtime Error | 37 | 18820 | 217 | from collections import Counter
n,k=map(int,input().split())
cnt=list(sorted(Counter(map(int,input().split().values()))))
num=len(cnt)
ans=0
for v in cnt:
if num<=k:
break
ans+=v
num-=1
print(ans)
|
s082590798 | p03495 | u879309973 | 1516370877 | Python | Python (2.7.6) | py | Runtime Error | 2115 | 1970876 | 777 | import numpy as np
def solve(N, K, A):
numbers = {}
for a in A:
numbers[a] = numbers.get(a, 0) + 1
M = len(numbers)
if M <= K:
return 0
dp = np.full((M+1, M+1), N, dtype=int)
dp[0,:] = 0
for i, n in enumerate(numbers.values()):
for j in range(M+1):
if j >... |
s701192395 | p03495 | u879309973 | 1516370799 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 775 | import numpy as np
def solve(N, K, A):
numbers = {}
for a in A:
numbers[a] = numbers.get(a, 0) + 1
M = len(numbers)
if M <= K:
return 0
dp = np.full((M+1, M+1), N, dtype=in
dp[0,:] = 0
for i, n in enumerate(numbers.values()):
for j in range(M+1):
if j > 0... |
s659303085 | p03495 | u879309973 | 1516370427 | Python | Python (2.7.6) | py | Runtime Error | 2114 | 1970876 | 611 | import numpy as np
def solve(N, K, A):
numbers = {}
for a in A:
numbers[a] = numbers.get(a, 0) + 1
M = len(numbers)
if M <= K:
return 0
dp = np.full((M+1, M+1), N)
dp[0,:] = 0
for i, n in enumerate(numbers.values()):
for j in range(M+1):
if j > 0:
... |
s460613466 | p03495 | u879309973 | 1516370238 | Python | Python (2.7.6) | py | Runtime Error | 2134 | 1970828 | 445 | import numpy as np
N, K = map(int, raw_input().split())
A = map(int, raw_input().split())
numbers = {}
for a in A:
numbers[a] = numbers.get(a, 0) + 1
M = len(numbers)
dp = np.full((M+1, M+1), N)
dp[0,:] = 0
for i, n in enumerate(numbers.values()):
for j in range(M+1):
if j > 0:
dp[i+1,j] = m... |
s076444022 | p03495 | u140251125 | 1515632232 | Python | Python (3.4.3) | py | Runtime Error | 174 | 32180 | 505 | import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
#keyはA[i]、valueは登場回数
A_unique = {}
for i in range(0,len(A)):
if A[i] in A_unique:
A_unique[A[i]] += 1
else:
A_unique[A[i]] = 1
v = list(A_unique.values())
v.sort() #登場回数が少ない順に書き換えていく
A_length = len(A_unique.keys... |
s168522875 | p03495 | u569906225 | 1515393385 | Python | Python (2.7.6) | py | Runtime Error | 196 | 28820 | 225 | import collections
N, K = map(int, raw_input().split())
A = map(int, raw_input().split())
A_dict = collections.Counter(A)
A_common = A_dict.most_common(K)
result = N
for i in range(K): result -= A_common[i][1]
print result |
s352191096 | p03495 | u401093859 | 1514667374 | Python | Python (3.4.3) | py | Runtime Error | 124 | 24996 | 599 | #N個のボールを持ち,K個以下の整数にする
#順当に考えるならば,種類が少ないやつから変更していけばいい
#番号の列をリストで表現
#押し付けきれるとは限らない
counter = 0
condition = list(map(int, input().split()))
A_list = list(map(int, input().split()))
zero_line = [0 for _ in range(condition[0])]
for i in A_list:
if zero_line[i] == 0:
counter += 1
zero_line[i] += 1
zero_l... |
s394789504 | p03495 | u323626540 | 1514264243 | Python | Python (3.4.3) | py | Runtime Error | 216 | 39316 | 421 | from collections import defaultdict
parameter = list(map(int, input().split()))
n, k = parameter[0], parameter[1]
balls = list(map(int, input().split()))
numbers = defaultdict(lambda: 0)
for b in balls:
numbers[b] += 1
if len(numbers) == k:
print(0)
else:
sort_number = sorted(numbers.items(), key=lambd... |
s869337036 | p03495 | u323626540 | 1514264101 | Python | Python (3.4.3) | py | Runtime Error | 215 | 39336 | 367 | from collections import defaultdict
parameter = list(map(int, input().split()))
n, k = parameter[0], parameter[1]
balls = list(map(int, input().split()))
numbers = defaultdict(lambda: 0)
for b in balls:
numbers[b] += 1
sort_number = sorted(numbers.items(), key=lambda x:x[1], reverse=True)
answer = n - sum([sort... |
s631443595 | p03495 | u814166125 | 1513800749 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 32564 | 404 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 20 12:35:48 2017
"""
from collections import Counter
NKList = list(map(int,input().split()))
N = NKList[0]
K = NKList[1]
AList = list(map(int,input().split()))
countDict = Counter(AList)
soretedList = sorted(countDict.values())
rewrite = 0
l = len(soretedList)
whil... |
s445350924 | p03495 | u814166125 | 1513800703 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 32572 | 404 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 20 12:35:48 2017
"""
from collections import Counter
NKList = list(map(int,input().split()))
N = NKList[0]
K = NKList[1]
AList = list(map(int,input().split()))
countDict = Counter(AList)
soretedList = sorted(countDict.values())
rewrite = 0
l = len(soretedList)
whil... |
s478918781 | p03495 | u886545507 | 1513782805 | Python | Python (2.7.6) | py | Runtime Error | 262 | 38760 | 283 | #abc081c
import collections
import sys
n,k=map(int,raw_input().split())
a=map(int,raw_input().split())
if n==k:
print 0
sys.exit()
cnt=collections.Counter(a)
l=[]
for k1,v in cnt.items():
l.append(v)
l2=sorted(l,reverse=True)
temp=0
for i in xrange(k):
temp+=l2[i]
print n-temp
|
s538798584 | p03495 | u882831132 | 1512973023 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 27008 | 170 | n, k=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
d=sorted([a.count(i) for i in set(a)])[::-1]
ans=0
for i in range(k):
ans+=d[i]
print(n-ans)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.