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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s085615125 | p03487 | u135116520 | 1588629897 | Python | Python (3.4.3) | py | Runtime Error | 60 | 18664 | 216 | import collections
N=int(input())
s=0
a=list(map(int,input().split()))
c=collections.Counter(a)
for i in c.keys():
if c.values(i)>i:
s+=c.values(i)-i
elif c.values(i)<i:
s+=c.values(i)
print(s)
|
s138601166 | p03487 | u272525952 | 1588535301 | Python | PyPy3 (2.4.0) | py | Runtime Error | 219 | 63984 | 200 | n=int(input())
l=list(map(int,input().split()))
lcount=[0]*10**9
count=0
for i in l:
lcount[i]+=1
if lcount[i]>i:
count+=1
for j in l:
if lcount[j]<j:
count+=1
print(count) |
s446055030 | p03487 | u707124227 | 1587219180 | Python | Python (3.4.3) | py | Runtime Error | 61 | 14212 | 229 | n=int(input())
a=list(map(int,input().split()))
c=[0]*(max(a)+1)
for i in range(len(a)):
c[a[i]]+=1
seta=set(a)
ans=0
for ai in seta:
if c[ai]==ai:
pass
elif c[ai]<ai:
ans+=c[ai]
else:
ans+=c[ai]-ai
print(ans) |
s121161211 | p03487 | u863370423 | 1586617641 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 17016 | 387 | import math
import random
line1 = int(input())
line2 = str(input()).split(" ")
keepTrack = dict()
keys = []
keys = list(set(line2))
for element in keys:
keepTrack[element] = line2.count(element)
sum = 0
for key in keys:
##sum += abs()
if (key < keepTrack[key]):
sum += -key + keepTrack[key]
eli... |
s068813894 | p03487 | u353919145 | 1586613588 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14268 | 278 | N = int(input())
seq = list(map(int, input().split()))
elems = set([])
rem = 0
for i in range(0,N+1):
a = seq[i]
if a not in elems:
elems.add(a)
c = seq.count(a)
if (c < a):
rem += c
else:
rem += c-a
print(rem)
|
s491099443 | p03487 | u757030836 | 1584791256 | Python | Python (3.4.3) | py | Runtime Error | 50 | 20852 | 304 | from collections import Counter
n = int(input())
a = Counter(input().split())
ans += 0
for i in range(len(a)):
if a.keys()[i][1] < int(a.keys()[i][0]):
ans += a.keys()[i][0]
elif a.keys()[i][1] >int(a.keys()[i][0]):
ans +=(int(a.keys()[i][0])-a.keys()[i][1])
print(ans)
|
s717690175 | p03487 | u547167033 | 1584727499 | Python | Python (3.4.3) | py | Runtime Error | 60 | 18676 | 186 | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
cnt=0
c=Counter(a)
for u in c.keys():
if int(u)>c[u]:
cnt+=v
else:
cnt+=c[u]-int(u)
print(cnt) |
s158118491 | p03487 | u547167033 | 1584727330 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 158 | import Counter
n=int(input())
a=list(map(int,input().split()))
cnt=0
c=Counter(a)
for u,v in c:
if int(u)>v:
cnt+=v
else:
cnt+=v-int(u)
print(cnt) |
s420680614 | p03487 | u075595666 | 1584249723 | Python | Python (3.4.3) | py | Runtime Error | 65 | 18168 | 198 | n = int(input())
a = [int(i) for i in input().split()]
import collections
c = collections.Counter(a)
for i in range(10**9):
if c[i] < i:
ans += c[i]
if c[i] > i:
ans += c[i]-i
print(ans) |
s305645048 | p03487 | u863442865 | 1582517335 | Python | Python (3.4.3) | py | Runtime Error | 43 | 14692 | 185 | n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
ans = 0
for num, cnt in c.items():
if cnt>=num:
ans += cnt - num
else:
ans += cnt
print(ans)
|
s862525056 | p03487 | u175590965 | 1581823162 | Python | Python (3.4.3) | py | Runtime Error | 74 | 14692 | 278 | n = int(input())
a = list(map(int,input().split()))
n = len(a)
a.sort()
a.append()
ans = 0
i = 0
while i < n:
cnt = 1
while a[i] == a[i+1]:
cnt += 1
i += 1
if cnt >= a[i]:
ans += cnt - a[i]
else:
ans += cnt
i += 1
print(ans) |
s523751576 | p03487 | u391667116 | 1581570065 | Python | Python (3.4.3) | py | Runtime Error | 74 | 14236 | 231 | n = int(input())
a = list(map(int, input().split()))
max = max(a) + 1
num = [0] * max
for i in a:
num[i] += 1
ans = 0
for i in range(max):
if i > num[i]:
ans += num[i]
else:
ans += num[i] - i
print(ans)
|
s764266115 | p03487 | u358254559 | 1581294333 | Python | Python (3.4.3) | py | Runtime Error | 124 | 14268 | 275 | n = int(input())
a = list(map(int, input().split()))
a.sort()
ans=0
lastnum=a[0]
cnt=1
for num in a[1:]:
if num==lastnum:
cnt+=1
else:
ans+=min(cnt,abs(cnt-lastnum))
cnt=1
tmp=lastnum
lastnum=num
ans+=min(cnt,abs(cnt-tmp))
print(ans) |
s697981036 | p03487 | u703214333 | 1580597399 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 15260 | 137 | n=int(input())
a=sorted(list(map(int,input().split())))
i=0
ans=0
while i<n:
h=a.count(a[i])
i+=h
ans+=abs(h-a[i])
print(ans) |
s842812656 | p03487 | u703214333 | 1580596962 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14212 | 129 | n=int(input())
a=sorted(list(map(int,input().split())))
i=0
ans=0
while i<n:
h=a.count(a[i])
i+=h
ans=ans+h-a[i]
print(ans) |
s527241214 | p03487 | u089230684 | 1578844532 | Python | Python (3.4.3) | py | Runtime Error | 23 | 5292 | 271 | n = int(input())
arr = []
out = {}
for i in range(n):
arr.append(int(input()))
if out.get(arr[-1], False):
out[arr[-1]] += 1
else:
out[arr[-1]] = 1
count = 0
for key in out:
if key > out[key]:
count += out[key]
else:
count += out[key] - key
print(count) |
s420265559 | p03487 | u252729807 | 1578169554 | Python | Python (3.4.3) | py | Runtime Error | 44 | 15260 | 172 | N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
ans = 0
for i, m in c.items():
if m < i:
ans += m
else:
ans += m - i
print(ans) |
s433867547 | p03487 | u905582793 | 1576200181 | Python | Python (3.4.3) | py | Runtime Error | 60 | 18676 | 213 | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=Counter(a)
c=list(c)
ans=0
for k in range(len(c)):
i=c[k][0]
x=c[k][1]
if i>x:
ans+=x
elif i<x:
ans+=x-i
print(ans) |
s086451714 | p03487 | u905582793 | 1576200152 | Python | Python (3.4.3) | py | Runtime Error | 61 | 18672 | 209 | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=list(Counter(a))
ans=0
for k in range(len(c)):
i=c[k][0]
x=c[k][1]
if i>x:
ans+=x
elif i<x:
ans+=x-i
print(ans) |
s259017048 | p03487 | u905582793 | 1576200085 | Python | Python (3.4.3) | py | Runtime Error | 59 | 18676 | 177 | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=list(Counter(a))
ans=0
for (i,x) in c:
if i>x:
ans+=x
elif i<x:
ans+=x-i
print(ans) |
s084708669 | p03487 | u934788990 | 1574258381 | Python | Python (3.4.3) | py | Runtime Error | 90 | 14268 | 213 | n = int(input())
a = list(map(int,input().split()))
ans = [0]*max(a)
count = 0
for i in a:
ans[i-1]+=1
for i in a:
if ans[i-1] == i:
pass
else:
count+=1
ans[i-1]-=1
print(count) |
s646373057 | p03487 | u693953100 | 1573931194 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 481 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
int main(){
map<int,int> m;
int n;
cin >> n;
rep(i,n){
int x;
cin >> x;
m[x]++;
}
int res = 0;
for(auto i:m){
if(... |
s186561932 | p03487 | u600195339 | 1572028206 | Python | PyPy3 (2.4.0) | py | Runtime Error | 167 | 38384 | 639 | n = int(input())
a = sorted(list(map(int, input().split())))
ans = 0
cnt = 1
prev = a[0]
#print(a)
for i in range(1, n):
# print('\n# i: ' + str(i))
# print('# a[i]: ' + str(a[i]))
if a[i] == prev:
# print('same!')
cnt += 1
else:
if cnt == prev:
# print('good, skip!')
... |
s255569716 | p03487 | u924785929 | 1571272701 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 777 | #include <iostream>
#include <vector>
using namespace std;
long long int CheckDelete(int a, int i){
if(a == 0 || a==i){
return 0;
}
else{
if(a < labs(a-i)){
return a;
}
else{
return labs(a-i);
... |
s626824088 | p03487 | u921168761 | 1570461101 | Python | Python (3.4.3) | py | Runtime Error | 85 | 15260 | 240 | N = int(input())
A = list(map(int, input().split()))
B = [0] * 100000
ans = 0
for i in range(N):
if A[i] <= 100000:
B[A[i]] += 1
else:
ans += 1
for i in range(100001):
if B[i] < i:
ans += B[i]
else:
ans += B[i] - i
print(ans)
|
s828275711 | p03487 | u921168761 | 1570461000 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 248 | N = int(input())
A = list(map(int, input().split()))
B = [0] * 200000
ans = 0
for i in range(N):
if A[i] < 200000:
B[A[i]] += 1
else:
ans += 1
for i in range(200000):
if B[i] >= i:
ans += B[i] - i
else:
ans += B[i]
print(ans)
|
s355038285 | p03487 | u921168761 | 1570460825 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 221 | N = int(input())
A = list(map(int, input().split()))
B = [0] * 200000
ans = 0
for i in range(N):
if A[i] < 200000:
B[A[i]] += 1
else:
ans += 1
for i in range(200000):
ans += min(B[i], abs(i – B[i]))
print(ans)
|
s060632784 | p03487 | u948524308 | 1569201922 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 202 | import collections
N=int(input())
a_dict=collections.Counter(a)
a=list(a_dict.items())
L=len(a)
ans=0
for i,n in a_dict.items():
if i>n:
ans+=n
elif i<n:
ans+=n-i
print(ans) |
s167457600 | p03487 | u094191970 | 1568308150 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38256 | 191 | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
a_s=list(set(a))
c_l=Counter(a)
cnt=0
for i in a_s:
cnt+=c_l[i] if c_l[i]<i else cnt+=c_l[i]-i
print(cnt) |
s648771683 | p03487 | u602252807 | 1566571098 | Python | PyPy3 (2.4.0) | py | Runtime Error | 180 | 38356 | 591 | from astropy.units import count
n = int(input())
a = list(map(int,input().split()))
a.sort()
v = a[0]
count = 1
result = 0
for i in range(1,n):
if v == a[i]:
count += 1
else:
if v == count:
v = a[i]
count = 1
else:
if count > v:
result ... |
s191411653 | p03487 | u296150111 | 1566311358 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 239 | k=[0]*(10**9+1)
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
k[a[i]-1]+=1
if k[a[i]-1]>a[i]:
ans+=1
b=set()
for i in range(n):
if k[a[i]-1]<a[i]-1 and a[i] not in b:
ans+=k[a[i]-1]
b.add(a[i])
print(ans) |
s757058366 | p03487 | u296150111 | 1566310893 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 139 | k=[0]*(10**9+1)
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
k[a[i]]+=1
if k[a[i]]>a[i]:
ans+=1
print(ans)
|
s841252431 | p03487 | u493491792 | 1566195964 | Python | Python (3.4.3) | py | Runtime Error | 44 | 15260 | 216 | n=int(input())
c=list(map(int,input().split()))
c = collections.Counter(c)
count=0
for x in c:
if x==c[x]:
continue
elif x>c[x]:
count+=c[x]
else:
count=count+(c[x]-x)
print(count) |
s926299258 | p03487 | u437638594 | 1566097649 | Python | Python (3.4.3) | py | Runtime Error | 77 | 14212 | 190 | N = int(input())
a = list(map(int, input().split()))
ans = 0
count = [0] * (10 ** 5)
for i in range(N):
count[a[i]] += 1
ans += 1
if count[a[i]] == a[i]:
ans -= a[i]
print(ans)
|
s724971024 | p03487 | u405256066 | 1566075018 | Python | Python (3.4.3) | py | Runtime Error | 123 | 14616 | 536 | from sys import stdin
N = int(stdin.readline().rstrip())
data = [int(x) for x in stdin.readline().rstrip().split()]
data = sorted(data) + [0]
if N == 1 and data[0] == 1:
print(0)
elif N == 1 and data[0] != 1:
print(1)
else:
ans = 0
num = data[0]
cnt = 0
for i in range(N+1):
if data[i]... |
s048873360 | p03487 | u405256066 | 1566074516 | Python | Python (3.4.3) | py | Runtime Error | 140 | 14020 | 461 | from sys import stdin
N = int(stdin.readline().rstrip())
data = [int(x) for x in stdin.readline().rstrip().split()]
data = sorted(data) + [0]
if N == 1 and data[0] == 1:
print(0)
elif N == 1 and data[0] != 1:
print(1)
else:
ans = 0
num = data[0]
cnt = 0
for i in range(N+1):
if data[i]... |
s591780094 | p03487 | u626337957 | 1564355408 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 318 | N = int(input())
dict = {}
nums = list(map(int, input().split()))
for num in nums:
if num in dict.keys():
dict[num] += 1
else:
dict[num] = 1
ans = 0
for key, value in dict.items():
if int(key) == value
continue
elif int(key) > value:
ans += value
else:
ans += value - int(key)
print(ans) |
s745440678 | p03487 | u050708958 | 1563578844 | Python | Python (3.4.3) | py | Runtime Error | 61 | 23664 | 140 | from collections import Counter
n = input()
c = Counter(map(int, input().split()))
print(sum([v if c < v else v - c for k,v in c.items()]))
|
s856992990 | p03487 | u050708958 | 1563578825 | Python | Python (3.4.3) | py | Runtime Error | 66 | 23668 | 138 | from collections import Counter
n = input()
c = Counter(map(int, input().split()))
print(sum(v if c < v else v - c for k,v in c.items()))
|
s197173217 | p03487 | u714533789 | 1559767410 | Python | Python (3.4.3) | py | Runtime Error | 58 | 14692 | 186 | n = int(input())
a = list(map(int, input().split()))
ans = 0
dp = [0]*max(a)
for i in set(a):
cnt = a.count(i)
if i < cnt: dp[i-1] = cnt - i
elif i > cnt: dp[i-1] = cnt
print(sum(dp)) |
s016905674 | p03487 | u714533789 | 1559767227 | Python | Python (3.4.3) | py | Runtime Error | 56 | 14584 | 177 | n = int(input())
a = list(map(int, input().split()))
ans = 0
dp = [0]*n
for i in set(a):
cnt = a.count(i)
if i < cnt: dp[i] = cnt - i
elif i > cnt: dp[i] = cnt
print(sum(dp)) |
s050447488 | p03487 | u714533789 | 1559767133 | Python | Python (3.4.3) | py | Runtime Error | 51 | 14692 | 173 | n = int(input())
a = list(map(int, input().split()))
ans = 0
dp = [0]*n
for i in set(a):
cnt = a.count(i)
if i < cnt: dp += cnt - i
elif i > cnt: dp += cnt
print(sum(dp)) |
s042705869 | p03487 | u714533789 | 1559767053 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14584 | 171 | n = int(input())
a = list(map(int, input().split()))
ans = 0
dp = [0]*n
for i in set(a):
cnt = a.count(i)
if i < cnt: dp = cnt - i
elif i > cnt: dp = cnt
print(sum(dp)) |
s343379837 | p03487 | u623687794 | 1559424996 | Python | Python (3.4.3) | py | Runtime Error | 96 | 21232 | 178 | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=Counter(a)
c=b.most_common()
ans=0
for i in range(len(c)):
ans+=abs(int(c[0])-c[1])
print(ans) |
s391454192 | p03487 | u463655976 | 1559404334 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 154 | N = input()
d = dict()
for x in map(int, input().split())
if d.get(x) is None:
d[x] = 0
d[x] += 1
print(sum((min(d[x], abs(d[x]-x) for x in d))))
|
s495185068 | p03487 | u698176039 | 1558737677 | Python | Python (3.4.3) | py | Runtime Error | 784 | 14692 | 444 | N = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(N):
if a[i] > 10**5:
ans += 1
del a[i]
import sys
if len(a) == 0:
print(ans)
sys.exit()
counts = [0] * (10 ** 5 + 1)
for i in a:
counts[i] += 1
for i in range(len(counts)):
if counts[i] == 0:co... |
s816637099 | p03487 | u698176039 | 1558737610 | Python | Python (3.4.3) | py | Runtime Error | 790 | 14692 | 444 | N = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(N):
if a[i] > 10**5:
ans += 1
del a[i]
import sys
if len(a) == 0:
print(ans)
sys.exit()
counts = [0] * (10 ** 5 + 1)
for i in a:
counts[a] += 1
for i in range(len(counts)):
if counts[i] == 0:co... |
s251055100 | p03487 | u698176039 | 1558737319 | Python | Python (3.4.3) | py | Runtime Error | 788 | 14692 | 405 | N = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(N):
if a[i] > 10**5+1:
del a[i]
ans += 1
counts = [0] * (10 ** 5 + 1)
for i in range(len(a)):
counts[a[i]] += 1
for i in range(1,len(counts)):
if counts[i] == 0:continue
if counts[i] < i:
an... |
s269828448 | p03487 | u856169020 | 1557841727 | Python | Python (3.4.3) | py | Runtime Error | 27 | 11136 | 253 | N = int(input())
A = map(int, input().split())
dic = {}
for i in range(N):
if dic.get(A[i]) is None:
dic[A[i]] = 1
else:
dic[A[i]] += 1
ans = 0
for k in dic:
if dic[k] >= k:
ans += abs(dic[k] - k)
else:
ans += dic[k]
print(ans) |
s958821760 | p03487 | u856169020 | 1557841619 | Python | Python (3.4.3) | py | Runtime Error | 24 | 5288 | 237 | N = int(input())
dic = {}
for i in range(N):
num = int(input())
if dic.get(num) is None:
dic[n] = 1
else:
dic[n] += 1
ans = 0
for k in dic:
if dic[k] >= k:
ans += abs(dic[k] - k)
else:
ans += dic[k]
print(ans) |
s466896937 | p03487 | u221345507 | 1557620647 | Python | Python (3.4.3) | py | Runtime Error | 58 | 14268 | 271 | N = int(input())
a = list(map(int,input().split()))
while len(a) != 0and max(a) > len(a):
a = [i for i in list if i < len(a)]
set = set(a)
cnt = 0
for i in set:
c = a.count(i)
if c >i:
cnt += c-i
elif c <i:
cnt += c
print(N - len(a)+cnt) |
s061349963 | p03487 | u221345507 | 1557620388 | Python | Python (3.4.3) | py | Runtime Error | 185 | 23516 | 222 | import numpy as np
N = int(input())
a = np.array(list(map(int,input().split())))
set = set(list)
for i in set:
c = list.count(i)
if c >i:
cnt += c-i
elif c <i:
cnt += c
print(N - len(list)+cnt) |
s706466163 | p03487 | u814781830 | 1556487299 | Python | Python (3.4.3) | py | Runtime Error | 50 | 11448 | 216 | N = int(input())
cnt = 0
strdit = {1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0}
for i in input().split():
strdit[int(i)] += 1
for i in strdit.keys():
if strdit[i] != 0:
cnt += abs(i-strdit[i])
print(cnt)
|
s599450510 | p03487 | u798129018 | 1556150700 | Python | PyPy3 (2.4.0) | py | Runtime Error | 226 | 63856 | 167 | N = int(input())
a = list(map(int,input().split()))
c = Counter(a)
ans = 0
for i,j in c.items():
if j>=i:
ans += j-i
else:
ans += j
print(ans)
|
s303682468 | p03487 | u367130284 | 1555687983 | Python | Python (3.4.3) | py | Runtime Error | 31 | 11456 | 115 | from collections import*;print(sum(min(abs(v-k),v)for k,v in Counter(map(int,open(0).read().split())[1:]).items())) |
s499744656 | p03487 | u903959844 | 1555445082 | Python | Python (3.4.3) | py | Runtime Error | 90 | 14732 | 323 | N = int(input())
a = input().split()
a_n = [int(s) for s in a]
max = max(a_n)
a_n_num = [0]*(max+1)
for i in range(len(a_n)):
a_n_num[a_n[i]] += 1
counter = 0
for i in range(len(a_n_num)):
if a_n_num[i] > i:
counter += a_n_num[i] - i
elif a_n_num[i] < i:
counter += a_n_num[i]
print(counte... |
s863383749 | p03487 | u343523393 | 1554941028 | Python | Python (3.4.3) | py | Runtime Error | 121 | 14648 | 437 | import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
N=ni()
A=na()
A.sort()
n=0
ans=0
for i in range(N-1):
n+=1
if(A[i]==A[i+1]):
continue
else:
if(n==A[i]):
n=0
continue
elif(n... |
s628845261 | p03487 | u052499405 | 1554581592 | Python | Python (3.4.3) | py | Runtime Error | 47 | 14492 | 206 | n = int(input())
a = [int(item) for item in input().split()]
count = Counter(a)
ans = 0
for i in count.keys():
if count[i] < i:
ans += count[i]
else:
ans += count[i] - i
print(ans) |
s093414963 | p03487 | u384657160 | 1554534977 | Python | PyPy3 (2.4.0) | py | Runtime Error | 177 | 38512 | 401 | import numpy as np
n = int(input())
s = list(map(int,input().split()))
s1 = np.array(s)
t,r = np.array([]),np.array([])
o = 0
for i in range(n):
if s[i] not in t:
t = np.append(t,s[i])
r = np.append(r,1)
else:
p = np.where(t == s[i])
r[p] += 1
for i in range(len(t)):
q = r[i... |
s038633522 | p03487 | u013408661 | 1554144471 | Python | Python (3.4.3) | py | Runtime Error | 63 | 16028 | 160 | n=int(input())
stack=[0]*(n+1)
a=list(map(int,input().split()))
for i in a:
stack[i]+=1
ans=0
for i in range(1,n+1):
if stack[i]>=i:
ans+=i
print(n-ans) |
s040795022 | p03487 | u623819879 | 1553122923 | Python | PyPy3 (2.4.0) | py | Runtime Error | 231 | 65960 | 229 | n=input()
dc=dict()
for j in input().split():
i=int(j)
if i in dc:
dc[i]+=1
else:
dc[i]=1
ans=0
for i in dc:
if dc[i]>i:
ans+=dc[i]-i,0
elif dc[i]<i:
ans+=dc[i]
print(ans)
|
s420249792 | p03487 | u518556834 | 1550549670 | Python | Python (3.4.3) | py | Runtime Error | 191 | 14692 | 226 | n = int(input())
a = list(map(int,input().split()))
a.sort()
c = 0
d = 0
for i in a:
if a[i] != c:
if a.count(a[i]) >= a[i]:
d += a.count(a[i]) - a[i]
else:
d += a.count(a[i])
c = a[i]
print(d)
|
s927878822 | p03487 | u551351897 | 1549571283 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 1150 | #include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#d... |
s762362931 | p03487 | u864197622 | 1549118779 | Python | Python (3.4.3) | py | Runtime Error | 26 | 3444 | 45 | from collections import counter as C
print(9) |
s622117047 | p03487 | u189575640 | 1547304238 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 427 | 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... |
s016875304 | p03487 | u887207211 | 1546582985 | Python | Python (3.4.3) | py | Runtime Error | 43 | 14492 | 301 | N = int(input())
a = list(map(int,input().split()))
cnt = 0
ind = 1
while A != []:
A = list(map(lambda x: x - 1, A))
if(0 in A):
zero = A.count(0)
if(zero > ind):
cnt += abs(zero - ind)
elif(zero < ind):
cnt += zero
A = filter(lambda n: n != 0, A)
ind += 1
print(cnt) |
s744033588 | p03487 | u037098269 | 1545442871 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 307 | n = int(input())
a_list = list(map(int, input().split()))
dic = {}
i_list = []
for a in a_list:
dic[a] = 0
for a in a_list:
dic[a] += 1
if dic[a] = 1:
i_list.append(a)
ans = 0
for i in i_list:
p = dic[i] - i
if p >= 0:
ans += p
else:
ans += dic[i]
print(ans) |
s918972302 | p03487 | u575431498 | 1544676558 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 290 | N = int(input())
a = [int(x) for x in input().split()]
summary = {}
for x in a:
if x not in summary.keys():
summary[x] = 1
else:
summary[x] += 1
res = 0
for k, v in summary.items():
if k > v:
res += v
else:
res += min(v - k, v)
print(res) |
s239346940 | p03487 | u726439578 | 1544676128 | Python | Python (3.4.3) | py | Runtime Error | 44 | 14268 | 201 | n=int(input())
a=list(map(int,input().split()))
count = {}
ans = 0
for i in a:
count[i] += 1
for i,c in count.items():
if i > c:
ans += c
elif i < c:
ans += c - i
print(ans) |
s956362631 | p03487 | u677440371 | 1544475134 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 327 | n = int(input())
a = [int(i) for i in input().split()]
count = {}
ans = 0
for i in a:
if i not in count:
count[i] = 1
else:
count[i] += 1
for i,c in count.items():
if i > c:
ans += c
elif i < c:
ans += c - i
pri... |
s893532686 | p03487 | u198062737 | 1543558869 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 229 | import collections
N = int(input())
a = [int(i) for i in input().split(" ")]
c = collections.Counter(a)
ans = 0
for key,val in c.items():
del = max(val-key,val)
if key == val:
del = 0
ans += del
print(ans)
|
s850371243 | p03487 | u247366051 | 1542572513 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1545 | require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b); a > b ? a : b end
def min(a,b); a < b ? a : b end
def swap(a,b); a, b = b, a ... |
s825348344 | p03487 | u853900545 | 1539542641 | Python | Python (3.4.3) | py | Runtime Error | 60 | 18676 | 196 | from collections import Counter
n = int(input())
a = list(map(int,input().split()))
cnt = Counter(a)
c = 0
for k,v in c.items():
if v >= k:
c += v-k
else:
c += v
print(c)
|
s766580251 | p03487 | u073775598 | 1539519835 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 83 | #ABC083
import math
X, Y=map(int,input().split())
print(int(math.log(Y/X, 2)//1+1)) |
s930700942 | p03487 | u073775598 | 1539519708 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 81 | #ABC083
import math
X, Y=map(int,input().split())
print(int(math.log(Y//X, 2)+1)) |
s183676953 | p03487 | u073775598 | 1539519634 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 81 | #ABC083
import math
X, Y=map(int,input().split())
print(int(math.log(Y//X, 2)+1)) |
s840122841 | p03487 | u558782626 | 1537139283 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 190 | N = int(input())
a = [int(i) for i in input().split()]
set_a = set(a)
ans = 0
for ai in set_a:
ai_count = a.count(ai)
ans += ai_count - ai if ai_count >= ai else ai_count
print(ans) |
s648292339 | p03487 | u102902647 | 1533879908 | Python | Python (3.4.3) | py | Runtime Error | 276 | 23952 | 1195 | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 10 01:03:03 2018
@author: Yuki
"""
import numpy as np
N = int(input())
A = sorted([int(i) for i in input().split()])
#N = 8
#A = sorted([2, 7, 1, 8, 2, 8, 1, 8])
A_uni = np.array(sorted(list(set(A))))
A = np.array(A)
tmp = 0
res_cnt = 0
i = 0
for i in range(len(A_uni))... |
s617765980 | p03487 | u476418095 | 1532395942 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14692 | 221 | n = int(input())
h = list(map(int, input().split()))
a = list(set(h))
s = 0
l = len(a)
while h.count(a[l-1]) != a[l-1]:
h.remove(a[l-1])
s += 1
if h.count(a[l-1]) == 0:
a.pop()
l = len(a)
print(s)
|
s300123216 | p03487 | u115682115 | 1532169871 | Python | Python (3.4.3) | py | Runtime Error | 46 | 15140 | 170 | from collections import Counter
N = int(input())
s = list(map(int,input().split()))
c = Counter(src)
ans = 0
for i,j in c.items():
ans += j if j<i else j-i
print(ans) |
s026827080 | p03487 | u136395536 | 1529849169 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 91 | N = int(input())
a = [int(i) for i in input().split()]
a.sort()
for i in range(N):
if |
s829934856 | p03487 | u004025573 | 1529677646 | Python | Python (3.4.3) | py | Runtime Error | 124 | 15260 | 532 | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 22 10:08:31 2018
@author: Yuya
"""
N=int(input())
a = list(map(int, input().split()))
a.sort()
count_sum=0
count = 1
for i in range(N-1):
flag=-1
if a[i+1]!=a[i]:
if count>a[i]:
count_sum += count-a[i]
elif count<a[i]:
c... |
s567705749 | p03487 | u411858517 | 1528853990 | Python | Python (3.4.3) | py | Runtime Error | 126 | 14268 | 387 | N = int(input())
a = list(map(int, input().split()))
res = 0
a.sort()
k = 0
for i in range(N-1):
if a[i] != a[i+1]:
count = i + 1 - k
k = count
if count < a[i]:
res += count
else:
res += count - a[i]
for i in range(a[-1]):
if a[-1] != a[... |
s718545037 | p03487 | u411858517 | 1528847768 | Python | Python (3.4.3) | py | Runtime Error | 75 | 14692 | 270 | N = int(input())
a = list(map(int, input().split()))
res = 0
a.sort()
for i in range(N-1):
if a[i] != a[i+1]:
count = i + 1 - count
if count < a[i]:
res += count
else:
res += count - a[i]
print(res) |
s707813615 | p03487 | u411858517 | 1528847606 | Python | Python (3.4.3) | py | Runtime Error | 75 | 14268 | 270 | N = int(input())
a = list(map(int, input().split()))
res = 0
a.sort()
for i in range(N-1):
if a[i] != a[i+1]:
count = i + 1 - count
if count < a[i]:
res += count
else:
res += count - a[i]
print(res) |
s290176469 | p03487 | u455696302 | 1528384522 | Python | Python (3.4.3) | py | Runtime Error | 46 | 14268 | 282 | N = int(input())
A = [int(i) for i in input().split()]
d = Counter(A).most_common()
d = d[::-1]
reCounter = 0
for i in range(len(d)):
if d[i][0] < d[i][1]:
reCounter += d[i][1] - d[i][0]
if d[i][0] > d[i][1]:
reCounter += d[i][1]
print(reCounter) |
s897480157 | p03487 | u107039373 | 1527108475 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 15260 | 144 | input()
l = list(map(int,input().split()))
m = set(l)
a = 0
for i in(m):
while l.count(i) != i:
l.remove(i)
a += 1
print(a) |
s328265814 | p03487 | u803647747 | 1525473449 | Python | Python (3.4.3) | py | Runtime Error | 43 | 14244 | 325 | N = int(input())
a_list = list(map(int, input().split()))
sort_dict = collections.Counter(a_list)
remove_counter = 0
for key, value in sort_dict.items():
if value < key:
remove_counter += value
elif value == key:
pass
else:
remove_counter += (value - key)
print(remove_cou... |
s647410063 | p03487 | u591295155 | 1525210496 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 88548 | 255 | N = int(input())
a = list(map(int, input().split()))
b = [0 for i in range (10000000)]
for i in range (N):
b[a[i]] += 1
tot = 0
for i in range (1, 10000000):
if 0 < b[i] < i:
tot += b[i]
elif b[i] > i:
tot += b[i]-i
print(tot) |
s150380072 | p03487 | u503901534 | 1524447118 | Python | Python (3.4.3) | py | Runtime Error | 100 | 20080 | 435 | n = int(input())
an = list(map(int,input().split()))
anset = list(set(an))
andict = {}
for i in range(len(an)):
if an[i] in andict:
andict[an[i]] = andict[an[i]] + 1
else:
andict.update({an[i]:1})
counter = 0
for i ,j in andict.keys(), andict.values():
if i == j :
None
elif ... |
s955270400 | p03487 | u299801457 | 1522511172 | Python | Python (3.4.3) | py | Runtime Error | 59 | 20596 | 229 | n=int(input())
a=input().split()
dict={}
for i in a:
if i not in dict:
dict[i]=1
else:
dict[i]+=1
ans=0
for i in dict.keys():
count=dict[i]
if count>i:
ans+=count-i
elif count<i:
ans+=count
print(ans)
|
s934000637 | p03487 | u299801457 | 1522510283 | Python | Python (3.4.3) | py | Runtime Error | 27 | 11132 | 161 | n=int(input())
a=map(int,input().split())
ans=0
for i in range(n):
if a.count(i)>i:
ans+=a.count(i)-i
elif a.count(i)<i:
ans+=a.count(i)
print(ans) |
s214705152 | p03487 | u929618357 | 1521671436 | Python | Python (3.4.3) | py | Runtime Error | 81 | 14492 | 212 | N = int(input())
a = [int(i) for i in input().split()]
b = [0] * N
for i in range(N):
b[a[i]] += 1
ans = 0
for i in range(N):
if b[i] < i:
ans += b[i]
else:
ans+= b[i] - i
print(ans) |
s624565722 | p03487 | u319612498 | 1521603848 | Python | Python (3.4.3) | py | Runtime Error | 58 | 14268 | 216 | n=int(input())
a=list(map(int,input().split()))
s=list(set(a))
ans=0
num=[0]*(10**5)
for i in range(n):
num[a[i]]+=1
for i in range(len(s)):
c=num[s[i]]
if s[i]>c: ans+=c
else: ans+=c-s[i]
print(ans)
|
s710936406 | p03487 | u729707098 | 1521329285 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 15000 | 279 | import copy
n = int(input())
x = [int(i) for i in input().split()]
y = copy.deepcopy(x)
z = []
for j in x:
if j not in z and x.count(j)<j:
while y.count(j) != 0: y.remove(j)
elif j not in z and x.count(j)>j:
while y.count != j: y.remove(j)
z.append(j)
print(len(x)-len(y)) |
s079142131 | p03487 | u058240079 | 1520953717 | Python | Python (2.7.6) | py | Runtime Error | 86 | 16292 | 183 | from collections import Counter
n = int(raw_input())
c = Counter(map(int, raw_input().split()))
s = 0
for k,v in c:
if v < k:
s += v
else:
s += v - k
print s
|
s279210527 | p03487 | u820351940 | 1520371252 | Python | Python (3.4.3) | py | Runtime Error | 72 | 18164 | 231 | # 4
# 3 3 3 3
n = int(input())
a = list(map(int, input().split()))
m = {}
for i in a:
m[i] = m.get(i, 0) + 1
result = 0
for i in range(n):
v = a.get(i, 0)
if v >= i:
result += v - i
else:
result += v
print(result) |
s408239768 | p03487 | u863370423 | 1517814508 | Python | Python (3.4.3) | py | Runtime Error | 49 | 14780 | 305 | from collections import Counter
a = int(input())
l = []
i = 1
for i in range(a):
b = [int(i) for i in input(i).split(" ")]
l.append(b)
c=Counter(l)
d = dict(c)
kv = []
for k,v in d.items():
if k>v:
kv.append(v)
elif k<v:
t = v-k
kv.append(t)
s = sum(kv)
print(s)
|
s960830141 | p03487 | u018679195 | 1517813922 | Python | Python (3.4.3) | py | Runtime Error | 48 | 15268 | 305 | from collections import Counter
a = int(input())
l = []
i = 1
for i in range(a):
b = [int(i) for i in input(i).split(" ")]
l.append(b)
c=Counter(l)
d = dict(c)
kv = []
for k,v in d.items():
if k>v:
kv.append(v)
elif k<v:
t = v-k
kv.append(t)
s = sum(kv)
print(s)
|
s311908011 | p03487 | u089230684 | 1517791279 | Python | Python (3.4.3) | py | Runtime Error | 26 | 5548 | 276 | from collections import Counter
a = int(input())
l = []
for i in range(0,a):
b = int(input())
l.append(b)
c=Counter(l)
d = dict(c)
kv = []
for k,v in d.items():
if k>v:
kv.append(v)
elif k<v:
t = v-k
kv.append(t)
s = sum(kv)
print(s)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.