Problem p03495 (python)

Fixed submission:
import collections
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
b = collections.Counter(a_list)
d = b.most_common()[k:]
sum = 0
for i in d:
    sum += i[1]
print(sum)

Buggy submission (verdict: Runtime Error):
import collections
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
b = collections.Counter(a_list)
d = b.most_common()[:k]
sum = 0
for i in d:
    sum += i
print(n-sum)

Buggy submission (verdict: Runtime Error):
import collections
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
b = collections.Counter(a_list)
d = b.most_common()[:k]
sum = 0
for i in d:
    sum += i
print(n-i)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
b = Counter(a_list)
d = b.most_common()[:k]
sum = 0
for i in d:
    sum += i
print(n-i)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
b = Counter(a_list)
key, values = zip(*b.most_common())
sum=0
for i in values.range(k):
    d = sum + i
print(n-i)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
b = Counter(a_list)
b_list = sorted(b.items(), key=lambda x:x[1])[:k]
d = sum(b_list.values())
print(n-d)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
b = Counter(a_list)
b_list = sorted(b.items(), key=lambda x:x[1])[:k]
for i in b_list.values():
    d = sum(i)
print(n-d)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
b = Counter(a_list)
b_list = sorted(b.items(), key=lambda x:x[1])
for i in b_list.values[:k]:
    d = sum(i)
print(n-d)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
b = Counter(a_list)
b_list = sorted(b.items(), key=lambda x:x[1])
for i in b_list.values[:k]:
    d = sum(i)
print(n-i)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = []
for i in range(1,n+1):
    if i == a_list[i]:
        b_list[i] += 1
    else:
        b_list[i] = 1
b_list.sort(reverse = True)
f = sum(b_list[:k:])
print(n-f)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = []
for i in range(n+1):
    if i == a_list[i]:
        b_list[i] += 1
    else:
        b_list[i] = 1
b_list.sort(reverse = True)
f = sum(b_list[:k:])
print(n-f)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
b_list = sorted([list(map(int, input().split())).count(i) for i in range(n+1)],reverse = True)[:k]
print(n-sum(b_list))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = sorted(a_list.count(i) for i in range(n+1),reverse = True)
print(n-sum(b_list[:k:]))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(sorted(a_list.count(i) for i in range(n+1),reverse = True))
print(n-sum(b_list[:k:]))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a_list = list(map(int, input().split()))
ans = 0
while True:
    if len(set(a_list)) > k:
        if len(set(a_list)) == k+1:
            a_list.pop()
            ans += 1
        else:
            a_list = set(a_list).pop()
            ans += 1
            
print(ans)