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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s495513770 | p03496 | u330205771 | 1512961416 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3064 | 1145 | import math
N = int(input())
a = list(map(int, input().split()))
op = []
for i in range(N - 1):
if a[i] > a[i + 1]:
delta = a[i] - a[i + 1]
cand_plus = []
for j in range(N):
if a[j] < 0:
cand_plus.append(float("inf"))
else:
cand_plus.... |
s461747757 | p03496 | u354915818 | 1512960928 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3316 | 1934 | # coding: utf-8
# Here your code !
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
s = input().split()
s = [int(i) for i in s]
S = [abs(i) for i in s]
seq = sorted(S , reverse=True )
index = [seq.index(v) for v in S]
sor = sorted(s)
flag = False
for i in range(N) :
if sor[i] != s[i] :
f... |
s713099011 | p03496 | u132434645 | 1512960746 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2824 | 1678 | import math
def a(xs, m):
k = xs.index(m) + 1
ops = []
a = xs[0];
for i in range(1, len(xs)):
b = xs[i]
if a > b:
d = a - b
n = int(math.ceil(d / float(m)))
d2 = m - b
n2 = int(math.ceil(d2 / float(m)))
if n2 > 0 and n2 < n:
... |
s176122248 | p03496 | u132434645 | 1512960655 | Python | Python (2.7.6) | py | Runtime Error | 2105 | 57980 | 1573 | import math
def a(xs, m):
k = xs.index(m) + 1
ops = []
a = xs[0];
for i in range(1, len(xs)):
b = xs[i]
if a > b:
d = a - b
n = int(math.ceil(d / float(m)))
d2 = m - b
n2 = int(math.ceil(d2 / float(m)))
if n2 > 0 and n2 < n:
... |
s755812213 | p03496 | u354915818 | 1512960386 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3188 | 1648 | # coding: utf-8
# Here your code !
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
s = input().split()
s = [int(i) for i in s]
S = [abs(i) for i in s]
seq = sorted(S , reverse=True )
index = [seq.index(v) for v in S]
sor = sorted(s)
flag = False
for i in range(N) :
if sor[i] != s[i] :
f... |
s126804379 | p03497 | u821251381 | 1601265146 | Python | PyPy3 (7.3.0) | py | Runtime Error | 150 | 121656 | 174 | import collections as c
N,K,*A= map(int,open(0).read().split())
ans=0
C=c.Counter(A)
C=sorted(C.values())
for i in range(N):
if len(C)<=K:
break
ans+=C[i]
print(ans) |
s788098676 | p03497 | u459798349 | 1600900634 | Python | PyPy3 (7.3.0) | py | Runtime Error | 89 | 74368 | 170 | n,k=map(int,input().split())
A=[int(i) for i in input().split()]
tab=[0 for i in range(n+1)]
for num in A:
tab[num]+=1
tab.sort(reverse=True)
print(n-10 sum(tab[:k])) |
s266128382 | p03497 | u655048024 | 1598495285 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 32320 | 228 | n,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(set(a))
if(len(b)<=k):
print(0)
else:
s = []
for i in range(len(b)):
s.append(a.count(b[i]))
s.sort()
ans = sum(s[:len(b-k)])
print(ans)
|
s809223824 | p03497 | u369502636 | 1597639146 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 32348 | 495 | n,k = map(int,input().split())
a = list(map(int,input().split()))
kaburi = []
for i in range(n):
if not a[i] in kaburi:
kaburi.append(a[i])
kaisu = 0
while True:
p = n
q = 0
if k >= len(kaburi):
print(kaisu)
break
else:
for j in range(len(kaburi)):
p = ... |
s270541324 | p03497 | u758815106 | 1597305759 | Python | Python (3.8.2) | py | Runtime Error | 123 | 34584 | 459 | N, K = map(int, input().split())
A = list(map(int, input().split()))
dic = {}
for a in A:
if a in dic:
dic[a] += 1
else:
dic[a] = 1
li = [0] * N
for a in dic:
li[dic[a]] += 1
ans = 0
k = len(dic)
for i in range(N):
if li[i] > 0:
if k - li[i] >= K:
ans += i * li[... |
s914170492 | p03497 | u581403769 | 1595978246 | Python | Python (3.8.2) | py | Runtime Error | 104 | 32192 | 283 | n, k = map(int, input().split())
a = list(map(int, input().split()))
a1 = sorted(a)
a2 = []
count = 0
for i in range(n - 1):
if a1[i] == a1[i + 1]:
count += 1
else:
a2.append(count)
break
a2.append(count)
l = sorted(a2)
print(sun(l[:len(l) - k - 1])) |
s246004214 | p03497 | u394244719 | 1595951594 | Python | PyPy3 (7.3.0) | py | Runtime Error | 123 | 99972 | 309 | n, k = map(int, input().split())
A = list(map(int, input().split()))
cnt_l = [0]*10**5
num = []
ans = 0
for i in A:
cnt_l[i] += 1
if i not in num:
num.append(i)
cnt_l.sort()
cnt_l = cnt_l[10**5-len(num):]
if len(cnt_l) <= k:
print(0)
exit()
cnt_l = cnt_l[:k-1]
print(sum(cnt_l)) |
s973920718 | p03497 | u833436666 | 1595272122 | Python | Python (3.8.2) | py | Runtime Error | 195 | 51828 | 473 | import math
import sys
import collections
n,k = map(int, input().split())
A = list(map(int, input().split()))
count=len(A)
Adel=list(set(A))
ans=len(Adel)-k
#print(Adel)
if ans<0:
ans=0
print(ans)
sys.exit()
newA=collections.Counter(A)
ans=len(Adel)
Aans=n
for i in range(k+1):
count=newA.most_common()[i... |
s162370421 | p03497 | u423966555 | 1594998222 | Python | Python (3.8.2) | py | Runtime Error | 127 | 44364 | 250 | from collections import Counter
N, K = map(int, input().split())
A = list(map(int ,input().split()))
d = Counter(A)
d.most_common()
n =len(d)
ans = 0
if n <= K:
print(0)
exit()
else:
for i in range(K,n):
ans += d[i][1]
print(ans) |
s241606373 | p03497 | u423966555 | 1594998181 | Python | Python (3.8.2) | py | Runtime Error | 124 | 44428 | 251 | from collections import Counter
N, K = map(int, input().split())
A = list(map(int ,input().split()))
d = Counter(A)
d.most_common()
n =len(d_)
ans = 0
if n <= K:
print(0)
exit()
else:
for i in range(K,n):
ans += d[i][1]
print(ans) |
s797037768 | p03497 | u640922335 | 1594397825 | Python | Python (3.8.2) | py | Runtime Error | 103 | 35248 | 225 | from collections import Counter
N,K=map(int,input().split())
N=list(map(int,input().split()))
A=Counter(N)
C=list(A.values())
C=C.sort(reverse=True)
if len(C)<=K:
print(0)
else:
ans=sum(C[-(len(C)-K):])
print(ans) |
s022007086 | p03497 | u640922335 | 1594397807 | Python | Python (3.8.2) | py | Runtime Error | 99 | 35252 | 234 | from collections import Counter
N,K=map(int,input().split())
N=list(map(int,input().split()))
A=Counter(N)
C=list(A.values())
C=C.sort(reverse=True)
print(C)
if len(C)<=K:
print(0)
else:
ans=sum(C[-(len(C)-K):])
print(ans) |
s898589349 | p03497 | u247211039 | 1593464935 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8912 | 307 | N K= map(int, input().split())
A =list(map(int, input().split()))
Aset =list(set(A))
B=[0]*len(Aset)
cnt =0
for i in range(len(Aset)):
for j in range(len(A)):
if Aset[i] == A[j]:
cnt += 1
B[i] = cnt
cnt =0
B=sorted(B)[::-1]
ans =0
for i in range(K,len(B)):
ans +=B[i]
print(ans) |
s004196836 | p03497 | u560708725 | 1593464491 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 32372 | 203 | n, k = map(int, input().split())
a = list(map(int,input().split()))
ans = []
for num in list(set(a)):
ans.append(a.count(num))
ans.sort(reverse=True)
for i in range(k):
ans.pop(0)
print(sum(ans)) |
s971572144 | p03497 | u350093546 | 1593263463 | Python | Python (3.8.2) | py | Runtime Error | 85 | 32136 | 90 | n,k=map(int,input().split())
a=list(map(int,input().split()))
print(max(0,len(set(a)-k)))
|
s010578511 | p03497 | u350093546 | 1593263430 | Python | Python (3.8.2) | py | Runtime Error | 71 | 32356 | 90 | n,K=map(int,input().split())
a=list(map(int,input().split()))
print(max(0,k-len(set(a))))
|
s812189293 | p03497 | u940780117 | 1593021495 | Python | Python (3.8.2) | py | Runtime Error | 106 | 41624 | 287 | N,K=map(int,input().split())
A=list(map(int,input().split()))
t=list()
ans=0
vari=0
A_set=set(A)
if len(A_set)<=K:
print(0)
else:
vari=len(A_set)
while vari>K:
ans+=min(A)
tmp=min(A)
A[A.index(min(A))]=200001
vari=len(set(A)-1)
print(ans)
|
s140448096 | p03497 | u923270446 | 1591545488 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 370 | n = int(input())
a = list(map(int, input().split()))
print(n * 2 - 1)
ma, mi = max(a), min(a)
ima, imi = a.index(ma), a.index(mi)
if abs(ma) > abs(mi):
for i in range(1, n + 1):
print(ima + 1, i)
for i in range(1, n):
print(i, i + 1)
else:
for i in range(1, n + 1):
print(imi + 1, i)
... |
s186090927 | p03497 | u593567568 | 1589855270 | Python | Python (3.4.3) | py | Runtime Error | 152 | 39344 | 264 | from collections import Counter
N,K = map(int,input().split())
A = list(map(int,input().split()))
C = Counter(A).most_common()
L = len(C)
if L <= K:
print(0)
exit()
ans = 0
cnt = 0
for v in C.values():
cnt += 1
if K < cnt:
ans += v
print(ans)
|
s270156613 | p03497 | u189023301 | 1589685750 | Python | Python (3.4.3) | py | Runtime Error | 169 | 41504 | 231 | from collections import Counter
n, m = map(int, input().split())
dic = Counter(map(int, input().split()))
lis = sorted(dic.items(), key=lambda x: x[1], reverse=True)
res = 0
for i in range(m):
res += lis[i][1]
print(n - res)
|
s544815203 | p03497 | u222668979 | 1589680241 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2111 | 77264 | 300 | n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt = {}
for i in a:
if i in cnt.keys():
cnt[i] += 1
else:
cnt[i] = 1
ans, k = 0, len(cnt) - k
for i in range(len(cnt) + 1):
if 0 >= k:
print(ans)
break
ans += cnt[i][1]
k -= 1
|
s756675149 | p03497 | u337626942 | 1589251336 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 25644 | 399 | 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_... |
s664498964 | p03497 | u848647227 | 1589164167 | Python | Python (3.4.3) | py | Runtime Error | 119 | 45364 | 252 | import collections
a,b = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
br = set(ar)
cr = collections.Counter(ar)
n = len(br) - b
dr = []
for k in cr.keys():
cr.append(k)
cr.sort()
count = 0
for i in range(n):
count += cr[i] |
s618137410 | p03497 | u186542450 | 1589087863 | Python | PyPy3 (2.4.0) | py | Runtime Error | 318 | 96584 | 211 | N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
AS = set(A)
# 減らす種類の個数
SS = len(AS) - K
re = []
for ass in AS:
re.append(ass)
sorted(re)
print(len(re[::SS]))
|
s346992458 | p03497 | u060793972 | 1587605608 | Python | Python (3.4.3) | py | Runtime Error | 66 | 24748 | 237 | def mycounter(d,i):
if i in d:
d[i]+=1
else:
d[i]=1
return d
n, k = list(map(int, input().rstrip().split()))
print(sum(sorted(mycounter(list(map(int, input().rstrip().split()))).values(), reverse=True)[k:]))
|
s981593212 | p03497 | u060793972 | 1587605540 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 144 | n, k = list(map(int, input().rstrip().split()))
print(sum(sorted(Counter(list(map(int, input().rstrip().split()))).values(), reverse=True)[k:])) |
s994589745 | p03497 | u790710233 | 1584246831 | Python | Python (3.4.3) | py | Runtime Error | 185 | 39344 | 275 | from collections import Counter
n, k = map(int, input().split())
*a, = map(int, input().split())
c = Counter(a)
kv = sorted(c.items(), key=lambda x: x[1], reverse=True)
if n <= k:
print(0)
else:
ans = n
for i in range(k):
ans -= kv[i][1]
print(ans)
|
s698801672 | p03497 | u941407962 | 1582674137 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38256 | 236 | N, = map(int, input().split())
A = map(int, input().split())
from collections import defaultdict
d = defaultdict(int)
for a in A:
d[a] += 1
r = 0
for a in d:
if a > d[a]:
r += d[a]
else:
r += d[a]-a
print(r)
|
s799981178 | p03497 | u252828980 | 1582379766 | Python | Python (3.4.3) | py | Runtime Error | 218 | 34156 | 196 | import numpy as np
n,k = map(int,input().split())
L = list( map(int,input().split()))
L = np.array(L)
set1,cnt = np.unique(L,return_counts = True)
cnt1 = sorted(cnt)
print(sum(cnt1[:len(cnt1)-k])) |
s965862703 | p03497 | u441599836 | 1582347713 | Python | Python (3.4.3) | py | Runtime Error | 138 | 32564 | 233 | import collections
n, k = map(int, input().split())
a = list(map(int, input().split()))
t = 0
ans = n
l = collections.Counter(a)
x = l.most_common(k)
for i in range(k):
t += x[i][1]
ans -= t
if ans < 0:
ans = 0
print(ans)
|
s812686360 | p03497 | u166340293 | 1582313753 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 19040 | 452 | N,K=map(int,input().split())
a=input().split()
for i in range (N):
for j in range (N-1):
if a[j]>a[j+1]:
g=a[j]
a[j]=a[j+1]
a[j+1]=g
count=1
size=0
b=[]
for p in range (N-1):
if a[p]==a[p+1]:
count+=1
else:
b.append(count)
count=1
size+=1
for q in range (size):
for r... |
s457860014 | p03497 | u303039933 | 1580235612 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2109 | 105164 | 2094 | # -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
class Scanner():
def int():
return int(sys.stdin.readline().rstrip())
... |
s402488520 | p03497 | u487594898 | 1579786097 | Python | PyPy3 (2.4.0) | py | Runtime Error | 261 | 96976 | 234 | import collections
import sys
N,K = map(int,input().split())
A = list(map(int,input().split()))
c = collections.Counter(A)
if len(c)<= K:
print(0)
sys.exit()
for i in range(K):
cnt += c.most_common()[i][1]
print(N-cnt) |
s356869625 | p03497 | u487594898 | 1579785698 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 246 | import collections
import sys
N,K = map(int,input().split())
A = list(map(int,input().split()))
c = collections.Counter(A)
if len(c)<= K:
print(0)
sys.exit()
for i in range(K):
cnt += c.most_common()[i][1]
if cnt >= K:
print(N-cnt)
|
s626144202 | p03497 | u487594898 | 1579785346 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 39320 | 184 | import collections
N,K = map(int,input().split())
A = list(map(int,input().split()))
c = collections.Counter(A)
cnt = 0
for i in range(K):
cnt += c.most_common()[i][1]
print(N-cnt) |
s263482270 | p03497 | u089142196 | 1577635947 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 407 | N=int(input())
A=list(map(int,input().split()))
cnt=0
bflag=False
sflag=False
for i in range(1,N):
if A[i]>A[i-1]:
if sflag==True:
cnt+=1
bflag=False
sflag=False
else:
bflag=True
sflag=False
elif A[i]<A[i-1]:
if bflag==True:
cnt+=1
bflag=False
sflag=Fals... |
s484832272 | p03497 | u089142196 | 1577635923 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 407 | N=int(input())
A=list(map(int,input().split()))
cnt=0
bflag=False
sflag=False
for i in range(1,N):
if A[i]>A[i-1]:
if sflag==True:
cnt+=1
bflag=False
sflag=False
else:
bflag=True
sflag=False
elif A[i]<A[i-1]:
if bflag==True:
cnt+=1
bflag=False
sflag=Fals... |
s271628930 | p03497 | u417014669 | 1577583640 | Python | Python (3.4.3) | py | Runtime Error | 98 | 32440 | 350 | n=map(int,input().split())
t= list(map(int,input().split()))
import sys
import collections
c = collections.Counter(t)
c=sorted(list(c.values()))
ans=0
delete_count=len(c)-k
if delete_count<=0:
print(0)
sys.exit()
else:
for i in range(delete_count):
if len(c)>k:
ans+=c[i]
pr... |
s399203350 | p03497 | u417014669 | 1577583495 | Python | Python (3.4.3) | py | Runtime Error | 96 | 32544 | 335 | n=map(int,input().split())
t= list(map(int,input().split()))
import sys
import collections
c = collections.Counter(t)
c=sorted(list(c.values()))
ans=0
delete_count=len(c)-k
if delete_count<=0:
print(0)
else:
for i in range(delete_count):
if len(c)>k:
ans+=c[i]
print(ans)
sys.ex... |
s802570087 | p03497 | u332253305 | 1577221312 | Python | Python (3.4.3) | py | Runtime Error | 141 | 26812 | 242 | n,k=map(int,input().split())
a=list(map(int,input().split()))
s=[0 for i in range(n)]
z=set(a)
y=len(z)
for x in a:
s[x]+=1
b=sorted(s)
f=0
ans=0
for x in b:
if x!=0:
f+=1
ans+=x
if f>=y-k:
break
print(ans)
|
s220570600 | p03497 | u332253305 | 1577219352 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 125 | n,k=int(input()),int(input())
a=list(map(int,input().split()))
s=set(a)
if len(s)<=k:
print(0)
else:
print(len(s)-k)
|
s081217241 | p03497 | u346395915 | 1574401913 | Python | Python (3.4.3) | py | Runtime Error | 229 | 39352 | 326 | from collections import defaultdict
n,k = map(int,input().split())
a_li = list(map(int,input().split()))
d = defaultdict(int)
for key in a_li:
d[key] += 1
d = sorted(d.items(), key=lambda x:x[1])
if k >= len(d):
print(0)
eixt()
s = len(d) - k
ans = 0
for i in range(s):
ans += d[i][1]
prin... |
s125194838 | p03497 | u076306174 | 1572748491 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3316 | 590 | import math
import heapq
from collections import Counter
#N,K=map(int, input[].split()) #複数数値入力 「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[].split())) #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
N,K=map(int, input[0].split()) #複数数値入力 「A B」みたいなスペース空いた入力のとき
A=list(map(int, input[1].split())) #リスト入力 「a1 a2 a3 ...」みたいな配列の... |
s344102766 | p03497 | u291873788 | 1571374128 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 627 | #include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;
int main()
{
int n,k;
cin>>n>>k;
vector<int> a(n);
REP(i,n) cin>>a[i];
sort(ALL(a));
vect... |
s031306405 | p03497 | u978494963 | 1564623309 | Python | Python (3.4.3) | py | Runtime Error | 115 | 35996 | 305 | from collections import defaultdict
n,k = map(int,input().split())
nums = input().split()
count_per_num = defaultdict(int)
for n in nums:
count_per_num[n] += 1
count_per_nums = sorted(count_per_nums, key=lambda x:x[1])
ans = 0
for i in range(len(count_per_nums)-k):
ans += count_per_nums[i]
print(ans) |
s705850875 | p03497 | u114648678 | 1564184454 | Python | Python (3.4.3) | py | Runtime Error | 161 | 39348 | 176 | import collections
n,k=map(int,input().split())
a=list(map(int,input().split()))
c=collections.Counter(a)
d=c.most_common()
ans=0
for i in range(k):
ans+=d[i][1]
print(n-ans) |
s243569772 | p03497 | u114648678 | 1564183692 | Python | Python (3.4.3) | py | Runtime Error | 156 | 39320 | 197 | import collections
n,k=map(int,input().split())
a=list(map(int,input().split()))
cnt=collections.Counter(a)
cnt.most_common()
ans=0
for i in range(k):
print(ans[i][1])
ans+=cnt[i][1]
peint(ans) |
s497447241 | p03497 | u933214067 | 1558625311 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 27176 | 1460 | import math
import fractions
import copy
#以下てんぷら
def j(q):
if q==1: print("YES")
elif q == 0:print("NO")
exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
if (x>y):print("+")
elif (x<y): print("-")
else: print("?")
"""
def ip():
return int(input())
def printrow(a):
for i in range(len(a)):
... |
s079831445 | p03497 | u614734359 | 1558584637 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 32508 | 245 | from collections import Counter
N,K = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
d = [a for a in Counter(A).values()]
tmp = 0
for i in range(min(K,len(d)+1)):
tmp += max(d)
d.remove(max(d))
print(len(A)-tmp)
|
s844395477 | p03497 | u614734359 | 1558584506 | Python | Python (3.4.3) | py | Runtime Error | 121 | 32512 | 250 | from collections import Counter
N,K = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
d = [a for a in Counter(A).values()]
tmp = 0
for i in range(min(K,len(set(d))+1)):
tmp += max(d)
d.remove(max(d))
print(len(A)-tmp)
|
s061732128 | p03497 | u298297089 | 1558220468 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 202 | from collections import Counter
N, K = map(int, input().split())
A = list(map(int, input().split()))
dA = Counter(A)
if len(dA) - K <= 0:
print(0)
exit()
print(sum(sorted(dA.values())[:len(dA)-K]))) |
s736366745 | p03497 | u969190727 | 1556247334 | Python | Python (3.4.3) | py | Runtime Error | 2105 | 39344 | 172 | import collections
n,k=map(int,input().split())
A=list(map(int,input().split()))
c=collections.Counter(A)
tot=0
for i in range(k):
tot+=c.most_common()[i][1]
print(n-tot) |
s653241972 | p03497 | u859897687 | 1555935346 | Python | Python (3.4.3) | py | Runtime Error | 124 | 41120 | 214 | n,k=map(int,input().split())
d=dict()
for i in map(int,input().split()):
if i not in d:
d[i]=1
else:
d[i]+=1
m=list(d.keys())
m.sort()
n-=k
for i in m:
if n<=0:
break
n-=d[i]
ans+=1
print(ans) |
s282604768 | p03497 | u859897687 | 1555935271 | Python | Python (3.4.3) | py | Runtime Error | 118 | 41120 | 208 | n,k=map(int,input().split())
d=dict()
for i in map(int,input().split()):
if i not in d:
d[i]=1
else:
d[i]+=1
m=d.keys()
m.sort()
n-=k
for i in m:
if n<=0:
break
n-=d[i]
ans+=1
print(ans) |
s166465883 | p03497 | u807772568 | 1521916581 | Python | Python (3.4.3) | py | Runtime Error | 142 | 32564 | 216 | import collections
data = list(map(int,input().split()))
da = list(map(int,input().split()))
ta = collections.Counter(da)
dt = ta.most_common(data[1])
for i in range(data[1]):
data[0] -= dt[i][1]
print(data[0]) |
s279835744 | p03497 | u807772568 | 1521916357 | Python | Python (3.4.3) | py | Runtime Error | 136 | 32564 | 212 | import collections
data = list(map(int,input().split()))
da = list(map(int,input().split()))
ta = collections.Counter(da)
dt = ta.most_common(data[1])
for k, v in dt.items():
data[0] -= int(v)
print(data[0]) |
s724906640 | p03497 | u005388620 | 1520395928 | Python | Python (3.4.3) | py | Runtime Error | 141 | 32284 | 392 | lis = list(map(int, input().split()))
lis2 = list(map(int, input().split()))
n = lis[0]
k = lis[1]
d = {}
for i in range(n):
if lis2[i] not in d.keys():
d[lis2[i]] = 1
else:
d[lis2[i]] += 1
if len(b) <= k:
print(0)
else:
a = list(d.values())
a.sort()
a.reverse()
swa... |
s574618267 | p03497 | u005388620 | 1520395620 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 348 | lis2 = list(map(int, input().split()))
n = lis[0]
k = lis[1]
d = {}
for i in range(n):
if lis2[i] not in d.keys():
d[lis2[i]] = 1
else:
d[lis2[i]] += 1
if len(b) <= k:
print(0)
else:
a = d.values()
a.sort()
a.reverse()
swap = 0
for i in range(k,len(a)):
... |
s597392050 | p03497 | u005388620 | 1520392882 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 25476 | 462 | lis = list(map(int, input().split()))
lis2 = list(map(int, input().split()))
n = lis[0]
k = lis[1]
a = []
b = []
for i in range(n):
if lis2[i] not in a:
a.append(lis2[i])
count = 0
for j in range(i+1,n):
if lis2[j] == lis2[i]:
count += 1
b.append(count)
i... |
s450689429 | p03497 | u005388620 | 1520392733 | Python | Python (3.4.3) | py | Runtime Error | 67 | 25124 | 460 | lis = list(map(int, input().split()))
lis2 = list(map(int, input().split()))
n = lis[0]
k = lis[1]
a = []
b = []
for i in range(n):
if lis2[i] not in a:
a.append(lis2[i])
count = 0
for j in range(i+1,n):
if lis[j] == lis[i]:
count += 1
b.append(count)
if ... |
s360147163 | p03497 | u005388620 | 1520392346 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 455 | lis = list(map(int, input().split()))
lis2 = list(map(int, input().split()))
n = lis[0]
k = lis[1]
a = []
b = []
for i in range(n):
if lis2[i] not in a
a.append(lis2[i])
count = 0
for j in range(i+1,n)
if lis[j] == lis[i]
count += 1
b.append(count)
if len... |
s498729289 | p03497 | u005388620 | 1520391697 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 342 | lis = list(map(int, input().split()))
n = lis[0]
k = lis[1]
a = []
b = []
for i in range(n):
if lis[i] not in a
a.append(lis[i])
count = 0
for j in range(i+1,n)
if lis[j] == lis[i]
count += 1
b.append(count)
if len(b) <= k
print(0)
else:
b.sort()
b.reserve()
swap = 0
for i in range(k,len(b))
swap... |
s024599300 | p03497 | u559823804 | 1517612126 | Python | Python (2.7.6) | py | Runtime Error | 112 | 22008 | 282 | n,k=map(int,raw_input().split())
a=map(int,raw_input().split())
aa=len(set(a))
div=max(0,int(aa)-k)
res = [(a.count(e),e) for e in aa if a.count(e) > 0]
resl=sorted(res,key=lambda x:x[0],reverse=True)
ans=0
while div>0:
ans+=resl[-1][0]
resl.pop()
div=div-1
print ans
|
s928625769 | p03497 | u870262604 | 1516162301 | Python | Python (3.4.3) | py | Runtime Error | 211 | 34124 | 273 | import numpy as np
N, K = map(int, input().split())
a = list(map(int, input().split()))
a = np.array(a)
def solve():
u, c = np.unique(a, return_counts=True)
k = len(u) - K
if len(u) > K:
print(np.sum(np.sort(c)[:k]))
else:
print(0)
solve() |
s187353040 | p03497 | u132159708 | 1515874264 | Python | Python (2.7.6) | py | Runtime Error | 93 | 13020 | 1185 | # coding:utf-8
# テストケースをgmailに送信します
import sys
import smtplib
from email.mime.text import MIMEText
from email.utils import formatdate
FROM_ADDRESS = 'hoge.atcoder@gmail.com'
MY_PASSWORD = 'hogeatcoder'
TO_ADDRESS = 'hoge.atcoder@gmail.com'
BCC = ''
SUBJECT = 'テストケース'
BODY = 'pythonでメール送信'
def create_message(from_ad... |
s507786077 | p03497 | u651663683 | 1513911331 | Python | Python (3.4.3) | py | Runtime Error | 178 | 27172 | 309 | def ncnt(i,j):
n=i.index(j)
nn=list(reversed(i)).index(j)
return len(i)-n-nn
n,k=list(map(int,input().split()))
inl=list(map(int,input().split()))
inl.sort()
ins=set(inl)
d=k-len(ins)
ddat=[n for i in range(d)]
for i in ins:
l=ncnt(inl,i)
if ddat[0][1]>l:
ddat.pop(0)
ddat.append(l)
print(sum(ddat))
|
s948961335 | p03497 | u785421275 | 1513141560 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 871 | n = int(input())
a = list(map(int, input().split()))
seq = []
last = n
for i in range(n - 1, -1, -1):
if a[i] < 0:
if last != n:
seq.append((last, i))
seq.append((last, i))
a[i] += a[last] * 2
last = i
last = -1
for i in range(n - 1):
if a[i] >= 0:
i... |
s647106487 | p03497 | u612721349 | 1513129243 | Python | Python (3.4.3) | py | Runtime Error | 149 | 32540 | 494 | from collections import defaultdict
n, k = map(int, input().split())
al = [int(i) for i in input().split()]
# dictionary で種類と数値をとっておく
d = defaultdict(int)
for a in al:
d[a] += 1
# 種類が少ないものから色を変えていくと最小の変えなければいけないボールの数がわかる
ans = 0
if d.keys() > k:
# 色を塗り替えないといけないので数えなければ…
v = d.values()
v.sort()
ans = sum(v[... |
s060238664 | p03497 | u612721349 | 1513129210 | Python | Python (3.4.3) | py | Runtime Error | 113 | 29808 | 487 | from collections import defaultdict
n, k = map(int, input().split())
al = [int(i) for i in range(n)]
# dictionary で種類と数値をとっておく
d = defaultdict(int)
for a in al:
d[a] += 1
# 種類が少ないものから色を変えていくと最小の変えなければいけないボールの数がわかる
ans = 0
if d.keys() > k:
# 色を塗り替えないといけないので数えなければ…
v = d.values()
v.sort()
ans = sum(v[:d.keys... |
s944631683 | p03497 | u890657861 | 1513043431 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 25276 | 236 | row1 = input().split()
N = int(row1[0])
K = int(row1[1])
a = list(map(int,input().split()))
s = sorted(set(a),key=a.count,reverse=True)
for i in range(K):
s.pop(0)
counts = 0
for i in s:
counts += a.count(i)
print(counts) |
s893018495 | p03497 | u772244321 | 1512963155 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 684 |
import sys
# get inputs
num_ball = int(sys.argv[1])
lim_num_kind_of_ball = int(sys.argv[2])
arr_balls = {}
for i in range(3, len(sys.argv)):
ball = int(sys.argv[i])
if ball not in arr_balls.keys():
arr_balls[ball] = 1
else:
arr_balls[ball] += 1
num_kind_of_ball = len(arr_balls.keys())
wr... |
s785439256 | p03497 | u772244321 | 1512959319 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 832 |
import sys
def main():
# get inputs
num_ball = int(sys.argv[1])
lim_num_kind_of_ball = int(sys.argv[2])
arr_balls = {}
for i in range(3, len(sys.argv)):
ball = int(sys.argv[i])
if ball not in arr_balls.keys():
arr_balls[ball] = 1
else:
arr_balls[bal... |
s972046990 | p03497 | u280269055 | 1512958968 | Python | Python (3.4.3) | py | Runtime Error | 88 | 35996 | 212 | from collections import Counter
n,k = map(int, input().split())
a = input().split()
c = Counter(a)
t = len(c) - k
r = 0
if t > 0:
serial = c.most_common[-t:]
for s in serial:
r += s[1]
print(r) |
s761936821 | p03497 | u280269055 | 1512958838 | Python | Python (3.4.3) | py | Runtime Error | 76 | 35996 | 229 | from collections import Counter
n,k = map(int, input().split())
a = input().split()
c = Counter(a)
t = len(c) - k
r = 0
if t > 0:
serial = list(map(list, c.most_common[-t:]))
for s in serial:
r += s[1]
print(r) |
s482052811 | p03497 | u280269055 | 1512958739 | Python | Python (3.4.3) | py | Runtime Error | 24 | 6004 | 241 | from collections import Counter
n,k = map(int, input().split())
a = [input() for _ in range(n)]
c = Counter(a)
t = len(c) - k
r = 0
if t > 0:
serial = list(map(list, c.most_common[-t:]))
for s in serial:
r += s[1]
print(r) |
s058327315 | p03497 | u988832865 | 1512957992 | Python | PyPy3 (2.4.0) | py | Runtime Error | 380 | 107344 | 268 | N, K = map(int, input().split())
A = map(int, input().split())
cnt = {}
for a in A:
if a not in cnt:
cnt[a] = 0
cnt[a] += 1
cnt = sorted(cnt.items(), key=lambda x: x[1])
ans = 0
i = 0
while len(cnt) > K:
ans += cnt[i][1]
i += 1
print(ans)
|
s429148486 | p03498 | u203197031 | 1600926234 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8996 | 797 | def main():
import sys
import numpy as np
ikimasu = sys.stdin.buffer.readline
ini = lambda: int(ins())
ina = lambda: list(map(int, ikimasu().split()))
ins = lambda: ikimasu().strip()
n = ini()
tmp = ina()
num,index = 0,0
for i in range(n):
if(abs(tmp[i])>num):
... |
s736895716 | p03498 | u806976856 | 1600396424 | Python | PyPy3 (7.3.0) | py | Runtime Error | 87 | 75104 | 969 | n=int(input())
a=list(map(int,input().split()))
m=0
ans=[]
b=[a[i] for i in range(n)]
for i in range(2*n):
for j in range(n-1):
if b[j]>b[j+1]:
ans.append([b.index(max(b)) + 1, j + 2])
b[j+1]+=max(b)
m+=1
break
f=0
for i in range(n-1):
if b[i]>b[i+1]:
... |
s776592284 | p03498 | u367701763 | 1599464438 | Python | PyPy3 (7.3.0) | py | Runtime Error | 167 | 89028 | 581 | import sys
from bisect import *
input = sys.stdin.readline
N = int(input())
A = [0] + list(map(int, input().split()))
P = [[] for _ in range(N+1)]
for i in range(1,N+1):
for j in range(N+1):
for k in range(N+1):
P[i].append((A[i]+A[j]+A[k],j,k))
B = [-float("inf")]
res = []
for i in range(1,N+1)... |
s202462139 | p03498 | u367701763 | 1599464080 | Python | PyPy3 (7.3.0) | py | Runtime Error | 162 | 88548 | 524 | import sys
from bisect import *
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
P = [[] for _ in range(N)]
Q = [[] for _ in range(N)]
for i in range(N):
for j in range(N):
for k in range(N):
P[i].append((A[i]+A[j]+A[k],j+1,k+1))
B = [-float("inf")]
print(2*N)
for ... |
s459829640 | p03498 | u113971909 | 1598532789 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9280 | 1034 | #!/usr/bin python3
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
def check(l):
ret = True
for i in range(n-1):
if a[i]>a[i+1]:
ret = False
break
return ret
def solv(ret):
print(len(ret))
for i in ret:
print("{} {}".format(*i))... |
s723866377 | p03498 | u984276646 | 1595662656 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9360 | 1531 | N = int(input())
A = list(map(int, input().split()))
pos = []
neg = []
pc, nc = 0, 0
for i in range(N):
if A[i] >= 0:
pos.append(i)
pc += 1
elif A[i] < 0:
neg.append(i)
nc += 1
seq = []
cnt = 0
for i in range(pc-1):
if A[pos[i]] > A[pos[i+1]]:
A[pos[i+1]] += A[pos[i]]
seq.append([pos[i]+1,... |
s711837676 | p03498 | u936985471 | 1591490822 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3064 | 1329 | import sys
readline = sys.stdin.readline
N = int(readline())
A = list(map(int,readline().split()))
# 最も絶対値の大きい数を、それが正の数なら右から、負の数なら左から、
# 昇順になっていない場所に足していく
# print(A)
ans = []
while True:
plusmax = 0
minusmax = 0
plusmax_i = -1
minusmax_i = -1
target = -1
maxdiff = 0
for i in range(len(A)):
if A... |
s231448608 | p03498 | u936985471 | 1591490246 | Python | Python (3.4.3) | py | Runtime Error | 33 | 3064 | 1338 | import sys
readline = sys.stdin.readline
N = int(readline())
A = list(map(int,readline().split()))
# 最も絶対値の大きい数を、それが正の数なら右から、負の数なら左から、
# 昇順になっていない場所に足していく
ans = []
while True:
plusmax = 0
minusmax = 0
plusmax_i = -1
minusmax_i = -1
left_target = -1
right_target = -1
targetdiff = 0
for i in range(len(... |
s089705711 | p03498 | u462329577 | 1591180938 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 732 | n = int(input())
a = list(map(int, input().split()))
b, idx = zip(*sorted(zip(a, range(1, n))))
if b[-1] < 0:
print(n - 1)
# 全て負の数なので後ろから累積和をとる
for i in range(n - 1):
print(n - i, n - i - 1)
elif b[0] >= 0:
print(n - 1)
for i in range(n - 1):
print(i + 1, i + 2)
else:
# max or mi... |
s710132323 | p03498 | u462329577 | 1591180662 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 728 | n = int(input())
a = list(map(int, input().split()))
b, idx = zip(*sorted(zip(a, range(1, n))))
if b[-1] < 0:
print(n - 1)
# 全て負の数なので後ろから累積和をとる
for i in range(n - 1):
print(n - i, n - i - 1)
elif b[0] >= 0:
print(n - 1)
for i in range(n - 1):
print(i + 1, i + 2)
else:
# max or mi... |
s716685845 | p03498 | u392319141 | 1591158196 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3188 | 798 | N = int(input())
A = list(map(int, input().split()))
ans = []
mx = max(A)
mi = min(A)
if mx * mi < 0:
if abs(mi) > abs(mx):
x = A.index(mi)
for y in range(N):
if y == x:
continue
A[y] += mi
ans.append((x, y))
else:
x = A.index(mx)
... |
s773202229 | p03498 | u392319141 | 1591158105 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3188 | 867 | N = int(input())
A = list(map(int, input().split()))
ans = []
mx = max(A)
mi = min(A)
if mx * mi < 0:
if abs(mi) > abs(mx):
x = A.index(mi)
for y in range(N):
if y == x:
continue
A[y] += mi
ans.append((x, y))
else:
x = A.index(mx)
... |
s932644147 | p03498 | u392319141 | 1591157964 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 797 | N = int(input())
A = list(map(int, input().split()))
ans = []
mx = max(A)
mi = min(A)
if mx * mi < 0:
if abs(mi) > abs(mx):
x = A.index(mi)
for y in range(N):
if y == x:
continue
A[y] += mi
ans.append((x, y))
else:
x = A.index(mx)
... |
s454285333 | p03498 | u392319141 | 1591157845 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 831 | N = int(input())
A = list(map(int, input().split()))
ans = []
mx = max(A)
mi = min(A)
if mx * mi < 0:
if abs(mi) > abs(mx):
x = A.index(mi)
for y in range(N):
if y == x:
continue
A[y] += mi
ans.append((x, y))
else:
x = A.index(mx)
... |
s855652836 | p03498 | u619144316 | 1591157458 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 761 | N = int(input())
A = list(map(int,input().split()))
MIN,MAX = 10**7,-10**7
ans = []
for i in range(N):
if MIN > A[i]:
MIN =A[i]
min_i = i
if MAX < A[i]:
MAX = A[i]
max_i = i
if abs(MIN) <= abs(MAX):
for i in range(N):
if A[i] < 0:
A[i] += MAX
... |
s620655365 | p03498 | u392319141 | 1591157412 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 722 | N = int(input())
A = list(map(int, input().split()))
ans = []
mx = max(A)
mi = min(A)
if abs(mi) > abs(mx):
x = A.index(mi)
for y in range(N):
if y == x:
continue
A[y] += mi
ans.append((x, y))
else:
x = A.index(mx)
for y in range(N):
if x == y:
c... |
s302976491 | p03498 | u392319141 | 1591157363 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 736 | N = int(input())
A = list(map(int, input().split()))
ans = []
mx = max(A)
mi = min(A)
if abs(mi) > abs(mx):
x = A.index(mi)
for y in range(N):
if y == x:
continue
A[y] += mi
ans.append((x, y))
else:
x = A.index(mx)
for y in range(N):
if x == y:
c... |
s709999530 | p03498 | u392319141 | 1591157258 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 717 | N = int(input())
A = list(map(int, input().split()))
ans = []
mx = max(A)
mi = min(A)
if abs(mi) > abs(mx):
x = A.index(mi)
for y in range(N):
if y == x:
continue
A[y] += mi
ans.append((x, y))
if abs(mx) >= abs(mi):
x = A.index(mx)
for y in range(N):
if x ==... |
s086104672 | p03498 | u392319141 | 1591157153 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 716 | N = int(input())
A = list(map(int, input().split()))
ans = []
mx = max(A)
mi = min(A)
if abs(mi) > abs(mx):
x = A.index(mi)
for y in range(N):
if y == x:
continue
A[y] += mi
ans.append((x, y))
if abs(mx) > abs(mi):
x = A.index(mx)
for y in range(N):
if x == ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.