ZhenlongDai/ACPR huggingface dataset:
Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n,k=map(int,input().split())
a=list(map(int,input().split()))

cnt=Counter(a)
cnt_len=len(cnt)
cnt=sorted(list(cnt))
ans=0
for i in range(cnt_len-k):
    ans+=cnt[i]
print(ans)

Failing test case input:
10 1
5 2 3 2 4 1 2 2 3 8

Expected output:
6


Actual output:
15


Fixed submission (verdict: Accepted):
from collections import Counter
n,k=map(int,input().split())
a=list(map(int,input().split()))

cnt=Counter(a)
cnt_len=len(cnt)
cnt=sorted(list(cnt.values()))
ans=0
if cnt_len<k:
    print(0)
    exit()
for i in range(cnt_len-k):
    ans+=cnt[i]
print(ans)

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
A = list(map(int, input().split()))

import collections
c = collections.Counter(A)
print(c)
if len(c.keys()) > k:
    num = len(c.keys()) - k
    print(sum(sorted(c.values())[:num]))
else:
    print(0)

Failing test case input:
0 4
-2 2 0 1

Expected output:
0


Actual output:
Counter({-2: 1, 2: 1, 0: 1, 1: 1})
0


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
A = list(map(int, input().split()))

import collections
c = collections.Counter(A)

if len(c.keys()) > k:
    num = len(c.keys()) - k
    print(sum(sorted(c.values())[:num]))
else:
    print(0)

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K=map(int,input().split())
a=input().split()

list.sort(a)
    
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

b.append(count)
size+=1
  
print(b)
list.sort(b,reverse=True)

s=0
if K<size:
  for u in range (K):
    s+=b[u]
else:
  s=N
print(N-s)

Failing test case input:
3 7
-2 1 0 1

Expected output:
0


Actual output:
[1, 1, 1]
0


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
a=input().split()

list.sort(a)
    
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

b.append(count)
size+=1
  
list.sort(b,reverse=True)

s=0
if K<size:
  for u in range (K):
    s+=b[u]
else:
  s=N
print(N-s)

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K=map(int, input().split())
A=list(map(int, input().split()))
sa=set(A)
if len(sa)<=K:
  print(0)
else:
  
  sub=len(sa)-K
  
  A.sort()
  A.append(A[-1])
  a=[0]*len(sa)
  j=0
  for i in range(N):
    a[j]+=1
    if A[i]!=A[i+1]:
      j+=1
  
  a.sort()

Failing test case input:
10 3
5 1 3 4 4 1 2 2 3 4

Expected output:
3


Actual output:

Fixed submission (verdict: Accepted):
N, K=map(int, input().split())
A=list(map(int, input().split()))
sa=set(A)
if len(sa)<=K:
  print(0)
else:
  
  sub=len(sa)-K
  
  A.sort()
  A.append(A[-1])
  a=[0]*len(sa)
  j=0
  for i in range(N):
    a[j]+=1
    if A[i]!=A[i+1]:
      j+=1
  
  a.sort()
  print(sum(a[:sub]))
Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import OrderedDict

temp=input()
n,k=list(map(int,temp.split(" ")))
co=OrderedDict()
ans=[]
temp=input()
nums=list(map(int,temp.split(" ")))
for i in nums:
  if i in co:
	  co[i]+=1
  else:
	  co[i]=1
for i in co:
  ans.append(co[i])
kinds=len(ans)
dif=kinds-k
if dif<=0:
    print(0)
else:
    ans.sort()
    print(sum(ans[:dif-1]))

Failing test case input:
10 3
5 1 3 4 4 1 2 2 3 4

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
from collections import OrderedDict

temp=input()
n,k=list(map(int,temp.split(" ")))
co=OrderedDict()
ans=[]
temp=input()
nums=list(map(int,temp.split(" ")))
for i in nums:
  if i in co:
	  co[i]+=1
  else:
	  co[i]=1
for i in co:
  ans.append(co[i])
kinds=len(ans)
dif=kinds-k
if dif<=0:
    print(0)
else:
    ans.sort()
    print(sum(ans[:dif]))

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n,k = map(int,input().split())
L = list( map(int,input().split()))

L = Counter(L)
if len(L) > k-1:
    L = sorted(list(L.most_common()))[len(L)-k+1:]
else:
    print(0)
    exit()

ans = 0
for i in range(len(L)):
    ans += L[i][1]
print(ans)

Failing test case input:
0 4
-2 3 2 6

Expected output:
0


Actual output:
3


Fixed submission (verdict: Accepted):
from collections import Counter
n,k = map(int,input().split())
L = list( map(int,input().split()))
l = len(L)
L = Counter(L)
L = sorted(list(L.most_common(k)))

ans = 0
for i in range(len(L)):
    ans += L[i][1]
if l >= ans:
    print(l - ans)
else:
    print(0)

Problem: p03497
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import heapq
from collections import Counter
N, K = map(int, input().split())
A = list(map(int, input().split()))
l = Counter(A)
dif = len(l) - K
l = list(l.values())
heapq.heapify(l)

print(sum(l[:dif]))

Failing test case input:
0 5
-4 1 -1 1

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
import heapq
from collections import Counter
N, K = map(int, input().split())
A = list(map(int, input().split()))
l = Counter(A)

dif = len(l) - K
if dif <= 0:
    print(0)
    exit()
l = list(l.values())
heapq.heapify(l)

ans = 0
for i in range(dif):
    ans += heapq.heappop(l)
print(ans)

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
a=list(map(int,input().split()))
import collections
count=0
data=collections.Counter(a)
data=sorted(data.items(),key=lambda x:x[1])
if k<len(data):
    for i in range(len(data)-k):
        count+=data[i][1]
else:
    print(0)
print(count)


Failing test case input:
0 11
-4 1 5 9

Expected output:
0


Actual output:
0
0


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
a=list(map(int,input().split()))
import collections
count=0
data=collections.Counter(a)
data=sorted(data.items(),key=lambda x:x[1])
if k<len(data):
    for i in range(len(data)-k):
        count+=data[i][1]
else:
    print(0)
    exit()
print(count)
Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K=map(int,input().split())
a=input().split()

list.sort(a)
    
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

list.sort(b,reverse=True)

s=0
if K<size:
  for u in range (K):
    s+=b[u]
else:
  s=N
print(N-s)

Failing test case input:
5 2
2 1 4 2 1

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
a=input().split()

list.sort(a)
    
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

b.append(count)
size+=1
  
list.sort(b,reverse=True)

s=0
if K<size:
  for u in range (K):
    s+=b[u]
else:
  s=N
print(N-s)

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter

N, K = map(int, input().split())

A = list(map(int, input().split()))

C = Counter(A)
v = list(C.values())
v = sorted(v)

div = len(v)
ans = 0
if div <= K:
    ans = 0
else:
    ans += sum(v[0:K-div-1])
print(ans)


Failing test case input:
10 3
5 1 3 4 8 1 2 2 6 4

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
from collections import Counter

N, K = map(int, input().split())

A = list(map(int, input().split()))

C = Counter(A)
v = list(C.values())
v = sorted(v)

div = len(v)
ans = 0
if div <= K:
    ans = 0
else:
    ans += sum(v[0:div-K])
print(ans)

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter

n, k = map(int, input().split())
a = [int(i) for i in input().split()]

a.sort()
cnt = dict(Counter(a))
cnt = sorted(cnt.items(), key = lambda x : x[1])

if len(set(a)) <= k:
  print(0)
  exit()

ans = 0
for i in range(k-1):
  ans += cnt[i][1]

print(ans)

Failing test case input:
10 3
5 1 3 2 4 1 2 2 3 8

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
from collections import Counter

n, k = map(int, input().split())
a = [int(i) for i in input().split()]

a.sort()
cnt = dict(Counter(a))
cnt = sorted(cnt.items(), key = lambda x : x[1])

if len(set(a)) <= k:
  print(0)
  exit()

ans = 0
h = len(set(a)) - k
for i in range(h):
  ans += cnt[i][1]

print(ans)

Problem: p03497
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,k = map(int, input().split( ))
import sys
from collections import Counter
input = sys.stdin.readline
a = list(map(int,input().split( )))

ac = Counter(a)
cnt = []
for k in ac:
    cnt.append(ac[k])
cnt.sort()
if len(cnt)<=2:
    print(0)
else:
    print(sum(cnt[:-2]))

Failing test case input:
4 5
-2 1 2 4

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
n,k = map(int, input().split( ))
import sys
from collections import Counter
input = sys.stdin.readline
a = list(map(int,input().split( )))

ac = Counter(a)
cnt = []
for ke in ac:
    cnt.append(ac[ke])
cnt.sort()
if len(cnt)<=k:
    print(0)
else:
    print(sum(cnt[:-k]))
Problem: p03497
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import Counter 

N, K = map(int, input().split())
A = list(map(int, input().split()))
s = len(set(A))
t = s-K

c = Counter(A)
num = list(c)
num.sort()

print(sum(num[:t])) if t>0 else print(0)

Failing test case input:
10 3
5 2 3 4 8 1 2 2 3 4

Expected output:
3


Actual output:
6


Fixed submission (verdict: Accepted):
from collections import Counter 

N, K = map(int, input().split())
A = list(map(int, input().split()))
s = len(set(A))
t = s-K

c = Counter(A)
num = list(c.values())
num.sort()

print(sum(num[:t])) if t>0 else print(0)

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K=map(int,input().split())
A=list(map(int,input().split()))

B=[0]*(N+1)
for i in range(0,N):
    B[A[i]]=B[A[i]]+1
C=[]
for i in range(0,N+1):
    if B[i]!=0:
        C.append(B[i])
print(C)
C.sort()
print(C)
if K>=len(C):
    print(0)
else:
    s=0
    for i in range(0,len(C)-K):
        s=s+C[i]
    print(s)


Failing test case input:
10 3
5 1 3 4 4 1 2 2 3 4

Expected output:
3


Actual output:
[2, 2, 2, 3, 1]
[1, 2, 2, 2, 3]
3


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
A=list(map(int,input().split()))

B=[0]*(N+1)
for i in range(0,N):
    B[A[i]]=B[A[i]]+1
C=[]
for i in range(0,N+1):
    if B[i]!=0:
        C.append(B[i])
C.sort()
if K>=len(C):
    print(0)
else:
    s=0
    for i in range(0,len(C)-K):
        s=s+C[i]
    print(s)

Problem: p03497
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
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

for i in range(len(cnt)):
    if len(cnt) + i <= K:
        break
    ans += cnt[i][1]

print(ans)


Failing test case input:
10 3
5 1 3 4 8 1 2 2 6 4

Expected output:
4


Actual output:
10


Fixed submission (verdict: Accepted):
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

for i in range(len(cnt)):
    if len(cnt) - i <= K:
        break
    ans += cnt[i][1]

print(ans)

Problem: p03497
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import heapq
from collections import Counter
N, K = map(int, input().split())
A = list(map(int, input().split()))
l = Counter(A)
dif = len(l) - K
if dif <= 0:
    print(0)
    exit()
l = list(l.values())
heapq.heapify(l)

print(sum(l[:dif]))

Failing test case input:
10 1
5 1 3 2 4 1 2 2 3 8

Expected output:
7


Actual output:
8


Fixed submission (verdict: Accepted):
import heapq
from collections import Counter
N, K = map(int, input().split())
A = list(map(int, input().split()))
l = Counter(A)

dif = len(l) - K
if dif <= 0:
    print(0)
    exit()
l = list(l.values())
heapq.heapify(l)

ans = 0
for i in range(dif):
    ans += heapq.heappop(l)
print(ans)
Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n, k = map(int, input().split())
al = sorted(Counter(input().split()).values(), reverse=True)

print(al)
print(sum(al[k:]))


Failing test case input:
0 4
-2 2 0 1

Expected output:
0


Actual output:
[1, 1, 1, 1]
0


Fixed submission (verdict: Accepted):
from collections import Counter
n, k = map(int, input().split())
al = sorted(Counter(input().split()).values(), reverse=True)
print(sum(al[k:]))

Problem: p03497
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import Counter

N, K = map(int, input().split())
A = list(map(int, input().split()))
C = Counter(A).most_common()

if len(C) <= K:
    print(0)
    exit()

ans = 0
for i in range(len(C) - 1, len(C) - K, -1):
    ans += C[i][1]
print(ans)


Failing test case input:
10 1
5 1 3 2 4 1 2 2 3 8

Expected output:
7


Actual output:
0


Fixed submission (verdict: Accepted):
from collections import Counter

N, K = map(int, input().split())
A = list(map(int, input().split()))
C = Counter(A).most_common()

if len(C) <= K:
    print(0)
    exit()
ans = 0
for c in C[len(C) - 1:K - 1:-1]:
    ans += c[1]
print(ans)

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)
    
s = len(d) - k
ans = 0

for i in range(s):
    ans += d[i][1]
    
print(ans)

Failing test case input:
5 2
2 1 2 2 1

Expected output:
0


Actual output:
0
0


Fixed submission (verdict: Accepted):
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])
    
s = len(d) - k
ans = 0

for i in range(s):
    ans += d[i][1]
    
print(ans)

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter

N, K = map(int, input().split())
A = list(map(int, input().split()))
X = Counter()
for a in A:
    X[a] += 1
if len(X) <= K:
    print(0)
    exit()
ans = 0
Y = list(sorted(X.items(), key=lambda x: x[1]))
for i in range(0, K-1):
    ans += Y[i][1]
print(ans)


Failing test case input:
10 3
5 1 3 4 8 1 2 2 3 4

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
from collections import Counter

N, K = map(int, input().split())
A = Counter(map(int, input().split()))
if len(A) <= K:
    print(0)
    exit(0)
ans = 0
Y = list(sorted(A.items(), key=lambda x: x[1]))
for i in range(0, len(A)-K):
    ans += Y[i][1]
print(ans)
Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


n, k = map(int, input().split())
s = map(int, input().split())
d = {}

for i in s:
    d.setdefault(i, 0)
    d[i] = d[i] + 1

if k >= len(d):
    print(0)
else:
    c = len(d) - k
    t = list(d.keys())
    t.sort()
    print(sum(t[0:c]))


Failing test case input:
10 3
5 1 3 4 8 1 2 2 3 4

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):


n, k = map(int, input().split())
s = map(int, input().split())
d = {}

for i in s:
    d.setdefault(i, 0)
    d[i] = d[i] + 1

if k >= len(d):
    print(0)
else:
    c = len(d) - k
    t = list(d.values())
    t.sort()
    print(sum(t[0:c]))

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n , k = map(int, input().split())
a = list(map(int, input().split()))

dict = {}
for i in range(n):
  if a[i] in dict:
    dict[a[i]] += 1
  else:
    dict[a[i]] = 1
ans = sorted(dict.items(), key=lambda x:x[1])

if len(ans) == k:
  print(0)
else:
  tmp = 0
  s = 0
  for i in ans:
    tmp += i[1]
    s+=1
    if s == len(dict) - k:
      break
  print(tmp)
    

Failing test case input:
5 5
1 1 2 3 1

Expected output:
0


Actual output:
5


Fixed submission (verdict: Accepted):
n , k = map(int, input().split())
a = list(map(int, input().split()))

dict = {}
for i in range(n):
  if a[i] in dict:
    dict[a[i]] += 1
  else:
    dict[a[i]] = 1
ans = sorted(dict.items(), key=lambda x:x[1])
if len(ans) <= k:
  print(0)
else:
  tmp = 0
  s = 0
  for i in ans:
    tmp += i[1]
    s+=1
    if s == len(dict) - k:
      break
  print(tmp)

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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()
a=len(d.values())-k
ans=0
for i in m:
  if a<=0:
    break
  a-=1
  ans+=1
print(ans)

Failing test case input:
10 3
5 1 3 4 2 1 2 2 3 4

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
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.values())
m.sort()
a=len(m)-k
ans=0
for i in m:
  if a<=0:
    break
  a-=1
  ans+=i
print(ans)

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections

n, k = map(int, input().split())
A = list(map(int, input().split()))

c = collections.Counter(A)
c = sorted(c.values())

c_list = len(c)
cnt = 0
if len(c) <= k:
    print(0)
else:
    for i in c:
        cnt += i
        if c_list-cnt<=k:
            print(cnt)
            exit()


Failing test case input:
10 1
5 1 3 2 4 1 2 2 3 8

Expected output:
7


Actual output:
5


Fixed submission (verdict: Accepted):
import collections

n, k = map(int, input().split())
A = list(map(int, input().split()))

c = collections.Counter(A)
c = sorted(c.values(),reverse=True)

if len(c) <= k:
    print(0)
    exit()

cnt = 0
for i in range(k):
    cnt += c[i]
print(n-cnt)
Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict


N, K = map(int, input().split())
A = list(map(int, input().split()))

dictNum = defaultdict(int)
for a in A:
    dictNum[a] += 1

listNum = sorted(list(dictNum.values()))
if len(listNum) <= K:
    print(0)
else:
    print(sum(listNum[:K-1]))

Failing test case input:
10 3
5 1 3 4 8 1 2 2 3 4

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
from collections import defaultdict


N, K = map(int, input().split())
A = list(map(int, input().split()))

dictNum = defaultdict(int)
for a in A:
    dictNum[a] += 1

listNum = sorted(list(dictNum.values()))
if len(listNum) <= K:
    print(0)
else:
    print(sum(listNum[:len(listNum)-K]))

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n,k=map(int,input().split())
a=list(map(int,input().split()))

cnt=Counter(a)
cnt_len=len(cnt)
cnt=sorted(list(cnt))
ans=0
if cnt_len<k:
    print(0)
    exit()
for i in range(cnt_len-k):
    ans+=cnt[i]
print(ans)

Failing test case input:
10 3
5 1 3 2 4 1 2 2 3 8

Expected output:
3


Actual output:
6


Fixed submission (verdict: Accepted):
from collections import Counter
n,k=map(int,input().split())
a=list(map(int,input().split()))

cnt=Counter(a)
cnt_len=len(cnt)
cnt=sorted(list(cnt.values()))
ans=0
if cnt_len<k:
    print(0)
    exit()
for i in range(cnt_len-k):
    ans+=cnt[i]
print(ans)

Problem: p03497
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import Counter

N, K = map(int, input().split())
A = list(map(int, input().split()))
C = Counter(A).most_common()

if len(C) <= K:
    print(0)
    exit()

ans = 0
for c in C[len(C) - 1:len(C) - K:-1]:
    ans += c[1]
print(ans)


Failing test case input:
10 3
5 2 3 4 8 1 2 2 3 4

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
from collections import Counter

N, K = map(int, input().split())
A = list(map(int, input().split()))
C = Counter(A).most_common()

if len(C) <= K:
    print(0)
    exit()
ans = 0
for c in C[len(C) - 1:K - 1:-1]:
    ans += c[1]
print(ans)

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
l=list(map(int,input().split()))
l1=[]
l2=[]
c=0
for i in l:
  if i in l1:
    l2[l1.index(i)]+=1
  else:
    l1.append(i)
    l2.append(1)
if m>=len(l2):
  print(0)
else:
  l2=sorted(l2)
  for i in range(m):
    c+=l2[i]
  print(c)
  

Failing test case input:
10 3
5 1 3 2 4 1 2 2 3 4

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
l=list(map(int,input().split()))
d={}

c=0
for i in l:
  if i in d:
    d[i]+=1
  else:
    d[i]=1
l1=d.values()
if m>=len(l1):
  print(0)
else:
  l1=sorted(l1)
  for i in range(len(l1)-m):
    c+=l1[i]
  print(c)
Problem: p03497
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

import sys
from collections import deque, defaultdict
from math import sqrt, factorial





def solve():
    n, k = [int(x) for x in input().split()]
    a = [int(x) for x in input().split()]
    d = defaultdict(int)
    for e in a:
        d[e] += 1
    b = [k for k in d]
    b.sort()
    ans = 0
    i = 0
    m = len(b)
    while m - i > k:
        ans += b[i]
        i += 1
    print(ans)


t = 1

for case in range(1,t+1):
    ans = solve()





Failing test case input:
10 3
5 2 3 4 8 1 2 2 3 4

Expected output:
3


Actual output:
6


Fixed submission (verdict: Accepted):

import sys
from collections import deque, defaultdict
from math import sqrt, factorial





def solve():
    n, k = [int(x) for x in input().split()]
    a = [int(x) for x in input().split()]
    d = defaultdict(int)
    for e in a:
        d[e] += 1
    b = [(d[k], k) for k in d]
    b.sort()
    ans = 0
    i = 0
    m = len(b)
    while m - i > k:
        ans += b[i][0]
        i += 1
    print(ans)


t = 1

for case in range(1,t+1):
    ans = solve()

Problem: p03497
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import Counter 

N, K = map(int, input().split())
A = list(map(int, input().split()))
s = len(set(A))
t = s-K

c = Counter(A)
num = list(c)
num.sort()

print(sum(num[:t]))

Failing test case input:
4 4
1 1 4 2

Expected output:
0


Actual output:
3


Fixed submission (verdict: Accepted):
from collections import Counter 

N, K = map(int, input().split())
A = list(map(int, input().split()))
s = len(set(A))
t = s-K

c = Counter(A)
num = list(c.values())
num.sort()

print(sum(num[:t])) if t>0 else print(0)

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import OrderedDict

temp=input()
n,k=list(map(int,temp.split(" ")))
co=OrderedDict()
ans=[]
temp=input()
nums=list(map(int,temp.split(" ")))
for i in nums:
  if i in co:
	  co[i]+=1
  else:
	  co[i]=1
for i in co:
  ans.append(co[i])
kinds=len(ans)
dif=kinds-k
if dif<=0:
    print(0)
else:
    ans.sort()
    print(sum(ans[:k-1]))

Failing test case input:
10 3
5 2 3 4 8 1 2 2 3 4

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
from collections import OrderedDict

temp=input()
n,k=list(map(int,temp.split(" ")))
co=OrderedDict()
ans=[]
temp=input()
nums=list(map(int,temp.split(" ")))
for i in nums:
  if i in co:
	  co[i]+=1
  else:
	  co[i]=1
for i in co:
  ans.append(co[i])
kinds=len(ans)
dif=kinds-k
if dif<=0:
    print(0)
else:
    ans.sort()
    print(sum(ans[:dif]))
Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n , k = map(int, input().split())
a = list(map(int, input().split()))

dict = {}
for i in range(n):
  if a[i] in dict:
    dict[a[i]] += 1
  else:
    dict[a[i]] = 1
ans = sorted(dict.items(), key=lambda x:x[1])
if len(ans) < k:
  print(0)
else:
  tmp = 0
  s = 0
  for i in ans:
    tmp += i[1]
    s+=1
    if s == len(dict) - k:
      break
  print(tmp)
    

Failing test case input:
4 4
-1 1 2 3

Expected output:
0


Actual output:
4


Fixed submission (verdict: Accepted):
n , k = map(int, input().split())
a = list(map(int, input().split()))

dict = {}
for i in range(n):
  if a[i] in dict:
    dict[a[i]] += 1
  else:
    dict[a[i]] = 1
ans = sorted(dict.items(), key=lambda x:x[1])
if len(ans) <= k:
  print(0)
else:
  tmp = 0
  s = 0
  for i in ans:
    tmp += i[1]
    s+=1
    if s == len(dict) - k:
      break
  print(tmp)

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
from collections import Counter
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N, K = map(int, readline().split())
    A = list(map(int, readline().split()))
    count = Counter(A)
    L = len(count)
    print(L)
    if L<=K:
        print(0)
    else:
        B = list(count.values())
        B.sort()
        print(sum(B[:L-K]))



if __name__ == '__main__':
    main()

Failing test case input:
4 4
-1 0 2 4

Expected output:
0


Actual output:
4
0


Fixed submission (verdict: Accepted):
import sys
from collections import Counter
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N, K = map(int, readline().split())
    A = list(map(int, readline().split()))
    count = Counter(A)
    L = len(count)
    if L<=K:
        print(0)
    else:
        B = list(count.values())
        B.sort()
        print(sum(B[:L-K]))



if __name__ == '__main__':
    main()

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

if len(b) <= k:
    print(0)
else:
    b.sort()
    b.reverse()
    swap = 0
    for i in range(k,len(b)):
        swap += b[i]
    print(swap)

Failing test case input:
10 1
5 2 3 2 4 1 2 2 3 8

Expected output:
6


Actual output:
1


Fixed submission (verdict: Accepted):
lis = list(map(int, input().split()))
lis2 = 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(list(d.values())) <= k:
    print(0)
else:
    a = list(d.values())
    a.sort()
    a.reverse()
    swap = 0
    for i in range(k,len(a)):
        swap += a[i]
    print(swap)
Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections

n, k = map(int, input().split())
A = list(map(int, input().split()))

c = collections.Counter(A)
c = sorted(c.values())

cnt = 0
if len(c) <= k:
    print(0)
else:
    for i in c:
        cnt += i
        if len(c)-cnt<=k:
            print(cnt)
            exit()


Failing test case input:
10 1
5 1 3 2 4 1 2 2 3 8

Expected output:
7


Actual output:
5


Fixed submission (verdict: Accepted):
import collections

n, k = map(int, input().split())
A = list(map(int, input().split()))

c = collections.Counter(A)
c = sorted(c.values(),reverse=True)

if len(c) <= k:
    print(0)
    exit()

cnt = 0
for i in range(k):
    cnt += c[i]
print(n-cnt)

Problem: p03497
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k = map(int, input().split())
num = [0] * 200000
an = list(map(int, input().split()))
for i in range(len(an)):
    num[an[i]] += 1
Ans = 0
num2 = [s for s in num if s != 0]
num2.sort()
length = len(num2)
for i in range(length):
    Ans += num2[i]
    length = length - 1
    if length == k:
        break
print(Ans)

Failing test case input:
4 4
1 1 2 2

Expected output:
0

Actual output:
4


Fixed submission (verdict: Accepted):
n,k = map(int, input().split())
num = [0] * 200000
an = list(map(int, input().split()))
for i in range(len(an)):
    num[an[i]] += 1
Ans = 0
num2 = [s for s in num if s != 0]
num2.sort()
length = len(num2)
if k < length:
    for i in range(length):
        Ans += num2[i]
        length = length - 1
        if length == k:
            break
print(Ans)

Problem: p03497
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import defaultdict
N, K = map(int,input().split())
A = list(map(int,input().split()))
D = defaultdict(int)
for a in A:
  D[a]+=1
D = sorted(D.values())
ans = 0
if len(D)<=K:
  print(ans)
else:
    print(sum(D[:K]))

Failing test case input:
10 3
5 1 3 4 2 1 2 2 3 4

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
from collections import defaultdict
N, K = map(int,input().split())
A = list(map(int,input().split()))
D = defaultdict(int)
for a in A:
  D[a]+=1
D = sorted(D.values())
ans = 0
if len(D)<=K:
  print(ans)
else:
    print(sum(D[:len(D)-K]))

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
import sys

n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
c = Counter(a)

if k>=len(c):
    print(0)
    sys.exit()
d = c.values()
print(sorted(d))
print(sum(sorted(d)[:len(c)-k]))


Failing test case input:
10 3
5 2 3 4 8 1 2 2 3 4

Expected output:
3


Actual output:
[1, 1, 1, 2, 2, 3]
3


Fixed submission (verdict: Accepted):
from collections import Counter
import sys

n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
c = Counter(a)

if k>=len(c):
    print(0)
    sys.exit()
d = c.values()
print(sum(sorted(d)[:len(c)-k]))
Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections

N,K = map(int,input().split())
A = [int(x) for x in input().split()]

B = list(collections.Counter(A).values())

print(sum(B[K::]))

Failing test case input:
10 3
5 1 3 2 4 1 2 2 3 4

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
import collections

N,K = map(int,input().split())
A = [int(x) for x in input().split()]

B = sorted(list(collections.Counter(A).values()),reverse=True)

print(sum(B[K::]))

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
a = [ int(x) for x in input().split() ]

d = {}
for i in a:
    d[i] = d.get(i, 0) + 1

d = sorted(d.items(), key=lambda x: -x[0])

if k >= len(d):
    ans = 0
else:
    ans = sum([ v for k, v in d[:len(d)-k]])

print(ans)

Failing test case input:
10 1
5 2 3 2 4 1 2 2 3 8

Expected output:
6


Actual output:
9


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
a = [ int(x) for x in input().split() ]

d = {}
for i in a:
    d[i] = d.get(i, 0) + 1

d = sorted(d.items(), key=lambda x: x[1])

if k >= len(d):
    ans = 0
else:
    ans = sum([ v for k, v in d[:len(d)-k]])

print(ans)

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter

n, k = map(int, input().split())
A = sorted(Counter(list(map(int, input().split()))).most_common(), key=lambda x:x[1])
cnt = 0
print(A)
if len(A) > k:
    for i in range(len(A)-k):
        cnt += A[i][1]
print(cnt)

Failing test case input:
3 10
-2 1 2 2

Expected output:
0


Actual output:
[(-2, 1), (1, 1), (2, 2)]
0


Fixed submission (verdict: Accepted):
from collections import Counter

n, k = map(int, input().split())
A = sorted(Counter(list(map(int, input().split()))).most_common(), key=lambda x:x[1])
cnt = 0
if len(A) > k:
    for i in range(len(A)-k):
        cnt += A[i][1]
print(cnt)

Problem: p03497
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import collections
n,k = map(int, input().split())
a = list(map(int, input().split()))

c = collections.Counter(a).most_common()[::-1]
p = len(c) - k
if p <= 0:
  print(0)
else:
  print(sum(list(map(lambda x:x[1], c[:k-1]))))
  


Failing test case input:
10 3
5 1 3 2 4 1 2 2 3 8

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
import collections
n,k = map(int, input().split())
a = list(map(int, input().split()))

c = collections.Counter(a).most_common()[::-1]
p = len(c) - k
if p <= 0:
  print(0)
else:
  print(sum(list(map(lambda x:x[1], c[:p]))))
Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K= map(int, input().split())
A = map(int, input().split())
d = {}
for a in A:
    if a in d:
        d[a] = d[a] + 1
    else:
        d[a] = 1
o = []
for dd in d:
    o.append(dd)
o = sorted(o, reverse=True)

if K >= len(o):
    print(0)
else:
    s = 0
    print(sum(o[K:]))


Failing test case input:
10 3
5 1 3 4 8 1 2 2 6 4

Expected output:
4


Actual output:
10


Fixed submission (verdict: Accepted):
N, K= map(int, input().split())
A = map(int, input().split())
d = {}
for a in A:
    if a in d:
        d[a] = d[a] + 1
    else:
        d[a] = 1
o = []
for k, v in d.items():
    o.append(v)
o = sorted(o, reverse=True)

if K >= len(o):
    print(0)
else:
    print(sum(o[K:]))

Problem: p03497
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter

N, K = map(int, input().split())
A = list(map(int, input().split()))

li = Counter(A)
li = list(li.values())
li.sort()

sum(li[:max(len(li) - K, 0)])

Failing test case input:
0 5
-2 2 -1 1

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
from collections import Counter

N, K = map(int, input().split())
A = list(map(int, input().split()))

li = Counter(A)
li = list(li.values())
li.sort()

print(sum(li[:max(len(li) - K, 0)]))
Problem: p00025
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    try:
        a=[int(i) for i in input().split()]
        b=[int(i) for i in input().split()]
    except:
        break
    hit,blow=0,0
    for i,j in zip(a,b):
        if j in a:
            blow+=1
        if i==j:
            hit+=1
    print(hit,blow)

Failing test case input:
2 1 3 2
6 0 5 9
4 1 8 2
4 9 1 0

Expected output:
0 0
1 1


Actual output:
0 0
1 2


Fixed submission (verdict: Accepted):
while True:
    try:
        a=[int(i) for i in input().split()]
        b=[int(i) for i in input().split()]
    except:
        break
    hit,blow=0,0
    for i,j in zip(a,b):
        if i==j:
            hit+=1
        elif j in a:
            blow+=1
    print(hit,blow)

Problem: p00025
Buggy submission (Python3, verdict: Wrong Answer):
import sys
a = list(map(int, input().split()))
for b in sys.stdin:
    b = list(map(int, b.split()))
    hit = 0
    blow = 0
    for i in range(4):
        try:
            if i == a.index(b[i]):
                hit += 1
            else:
                blow += 1
        except:
            pass
    print("{} {}".format(hit, blow))


Failing test case input:
9 1 8 2
6 1 5 3
8 6 0 0
2 7 3 1

Expected output:
1 0
0 0


Actual output:
1 0
0 1
0 2


Fixed submission (verdict: Accepted):
while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
    except:
        break
    hit = 0
    blow = 0
    for i in range(4):
        try:
            if i == a.index(b[i]):
                hit += 1
            else:
                blow += 1
        except:
            pass
    print("{} {}".format(hit, blow))

Problem: p00025
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    try:
        a=[int(i) for i in input().split()]
        b=[int(i) for i in input().split()]
    except:
        break
    hit,blow=0,0
    for i,j in zip(a,b):
        if j in a:
            blow+=1
        if i==j:
            hit+=1

Failing test case input:
9 1 6 4
4 2 5 9
8 1 8 3
6 9 3 0

Expected output:
0 2
0 1


Actual output:

Fixed submission (verdict: Accepted):
while True:
    try:
        a=[int(i) for i in input().split()]
        b=[int(i) for i in input().split()]
    except:
        break
    hit,blow=0,0
    for i,j in zip(a,b):
        if i==j:
            hit+=1
        elif j in a:
            blow+=1
    print(hit,blow)
Problem: p00025
Buggy submission (Python3, verdict: Wrong Answer):
import sys

even = True
for s in sys.stdin:
    if even:
        even = not even
        a = list(map(int, s.split()))
    else:
        b = list(map(int, s.split()))
        hit = sum(a[i] == b[i] for i in range(4))
        blow = sum(b[i] in a for i in range(4)) - hit
        print(hit, blow)

Failing test case input:
9 1 8 2
6 2 4 9
4 6 8 2
5 9 3 1

Expected output:
0 2
0 0


Actual output:
0 2
2 0
0 2


Fixed submission (verdict: Accepted):
import sys

Even = True
for s in sys.stdin:
    if Even:
        Even = False
        a = list(map(int, s.split()))
    else:
        Even = True
        b = list(map(int, s.split()))
        hit = sum(a[i] == b[i] for i in range(4))
        blow = sum(b[i] in a for i in range(4)) - hit
        print(hit, blow)

Problem: p00025
Buggy submission (Python3, verdict: Wrong Answer):


while True:
    try:
        A, B = input().split(), input().split()
        hit = sum([ 1 for i in range(len(A)) if A[i]==B[i] ])
        blow = sum([ 1 for i in range(len(A)) if B[i] in A ])
        print(str(hit) + ' ' +str(blow))
    except:
        break


Failing test case input:
9 1 8 2
6 1 5 9
8 6 13 2
2 6 4 1

Expected output:
1 1
1 1


Actual output:
1 2
1 2


Fixed submission (verdict: Accepted):


while True:
    try:
        A, B = input().split(), input().split()
        hit = sum([ 1 for i in range(len(A)) if A[i]==B[i] ])
        blow = sum([ 1 for i in range(len(A)) if B[i] in A ]) - hit
        print(str(hit) + ' ' +str(blow))
    except:
        break

Problem: p00025
Buggy submission (Python3, verdict: Wrong Answer):
hit = blow = 0
a = list(map(int,input().split()))
b = list(map(int,input().split()))
for i in range(4):
	if a[i] == b[i]:
		hit += 1
	elif a[i] in b:
		blow += 1
print(hit, blow)


Failing test case input:
9 1 0 -1
3 1 5 9
4 6 0 2
8 6 3 1

Expected output:
1 1
1 0


Actual output:
1 1


Fixed submission (verdict: Accepted):
while 1:
	hit = blow = 0
	try: a = list(map(int,input().split()))
	except: break
	b = list(map(int,input().split()))
	for i in range(4):
		if a[i] == b[i]:
			hit += 1
		elif a[i] in b:
			blow += 1
	print(hit, blow)

Problem: p00025
Buggy submission (Python3, verdict: Wrong Answer):
while True:

    try:
        ansa=hoge1.split()
        ansb=hoge2.split()
    except:
        break

    hit = sum((1 for a, b in zip(ansa, ansb) if a == b))
    blow = sum((1 for a in ansa if a in ansb))

    print(hit, blow - hit)

Failing test case input:
2 1 3 2
6 0 5 9
7 1 8 2
4 9 0 0

Expected output:
0 0
0 0


Actual output:

Fixed submission (verdict: Accepted):
while True:
    try:
        ansa=input().split()
        ansb=input().split()
    except:
        break

    hit = sum((1 for a, b in zip(ansa, ansb) if a == b))
    blow = sum((1 for a in ansa if a in ansb))

    print(hit, blow - hit)
Problem: p00025
Buggy submission (Python3, verdict: Wrong Answer):
import sys

for line in sys.stdin:
    a = list(map(int, line.split()))
    b = list(map(int, line.split()))
    hit = 0
    blow = 0
    for i in range(4):
        if b[i] == a[i]:
            hit += 1
        elif b[i] in a:
            blow += 1
    print(hit,blow)

Failing test case input:
9 1 8 2
6 1 5 3
8 6 0 0
2 7 3 1

Expected output:
1 0
0 0


Actual output:
4 0
4 0
4 0
4 0


Fixed submission (verdict: Accepted):
import sys
inputs = []
for line in sys.stdin:
    inputs.append(line)

n = len(inputs)
for _ in range(n 
    a = list(map(int, inputs[_ * 2].split()))
    b = list(map(int, inputs[_ * 2 + 1].split()))
    hit = 0
    blow = 0
    for i in range(4):
        if b[i] == a[i]:
            hit += 1
        elif b[i] in a:
            blow += 1
    print(hit, blow)

Problem: p00025
Buggy submission (Python3, verdict: Wrong Answer):



def hit_and_blow(answer: list, expect: list) -> tuple:
    hit, blow = 0, 0
    for (i, j) in zip(answer, expect):
        if i == j:
            hit += 1
    answer_set = set(answer)
    expect_set = set(expect)
    blow_set = answer_set & expect_set
    print(blow_set)
    blow = len(blow_set) - hit
    return hit, blow


if __name__ == '__main__':
    while True:
        try:
            answer_number = list(map(int, input().split()))
            expected_number = list(map(int, input().split()))
        except EOFError:
            break
        h, b = hit_and_blow(answer_number, expected_number)
        print(h, b)

Failing test case input:
9 1 8 2
6 1 5 9
4 6 8 4
2 6 3 0

Expected output:
1 1
1 0


Actual output:
{1, 9}
1 1
{6}
1 0


Fixed submission (verdict: Accepted):



def hit_and_blow(answer: list, expect: list) -> tuple:
    hit, blow = 0, 0
    for (i, j) in zip(answer, expect):
        if i == j:
            hit += 1
    answer_set = set(answer)
    expect_set = set(expect)
    blow_set = answer_set & expect_set
    blow = len(blow_set) - hit
    return hit, blow


if __name__ == '__main__':
    while True:
        try:
            answer_number = list(map(int, input().split()))
            expected_number = list(map(int, input().split()))
        except EOFError:
            break
        h, b = hit_and_blow(answer_number, expected_number)
        print(h, b)

Problem: p00025
Buggy submission (Python3, verdict: Wrong Answer):



def main(a, b):
    hit = 0
    blow = 0

    for a_e, b_e in zip(a, b):
        if a_e == b_e:
            hit += 1
        elif a_e in b:
            blow += 1

    print(hit, blow, sep=' ')


a = [int(e) for e in input().split()]
b = [int(e) for e in input().split()]

main(a, b)

Failing test case input:
9 1 8 2
6 0 1 9
4 6 5 2
4 6 3 0

Expected output:
0 2
2 0


Actual output:
0 2


Fixed submission (verdict: Accepted):



def main(a, b):
    hit = 0
    blow = 0

    for a_e, b_e in zip(a, b):
        if a_e == b_e:
            hit += 1
        elif a_e in b:
            blow += 1

    print(hit, blow, sep=' ')

while True:
    try:
        a = [int(e) for e in input().split()]
        b = [int(e) for e in input().split()]
    except:
        break

    main(a, b)
Problem: p00025
Buggy submission (Python3, verdict: Wrong Answer):
ansa=input().split()
ansb=input().split()

hit = sum((1 for a, b in zip(ansa, ansb) if a == b))
blow = sum((1 for a in ansa if a in ansb))

print(hit, blow)

Failing test case input:
9 1 8 2
6 2 5 9
4 6 8 2
4 9 3 0

Expected output:
0 2
1 0


Actual output:
0 2


Fixed submission (verdict: Accepted):
while True:
    try:
        ansa=input().split()
        ansb=input().split()
    except:
        break

    hit = sum((1 for a, b in zip(ansa, ansb) if a == b))
    blow = sum((1 for a in ansa if a in ansb))

    print(hit, blow - hit)

Problem: p00025
Buggy submission (Python3, verdict: Wrong Answer):
hit = blow = 0
a = [*map(int,input().split(' '))]
b = [*map(int,input().split(' '))]
for i in range(4):
	if a[i] == b[i]:
		hit += 1
	if a[i] == b[i-1]:
		blow += 1
print(hit, blow)


Failing test case input:
9 1 8 2
6 1 5 9
4 6 8 2
2 6 0 1

Expected output:
1 1
1 1


Actual output:
1 1


Fixed submission (verdict: Accepted):
while 1:
	hit = blow = 0
	try: a = list(map(int,input().split()))
	except: break
	b = list(map(int,input().split()))
	for i in range(4):
		if a[i] == b[i]:
			hit += 1
		elif a[i] in b:
			blow += 1
	print(hit, blow)

Problem: p00025
Buggy submission (Python3, verdict: Wrong Answer):
import sys

def hitBlow(a, b):
    hit = 0
    blow = 0
    for i in range(len(a)):
        if a[i] == b[i]:
            hit += 1
        for j in range(i+1, len(b)):
            if a[i] == b[j]:
                blow += 1

    return [hit, blow]

for s in sys.stdin:
    a = list(map(int, s.split()))
    b = list(map(int, input().split()))

    hit, blow = hitBlow(a, b)

    print(hit, blow)

Failing test case input:
9 1 8 2
6 1 5 9
0 9 8 6
2 6 3 0

Expected output:
1 1
0 2


Actual output:
1 1
0 1


Fixed submission (verdict: Accepted):
import sys

def hitBlow(a, b):
    hit = 0
    blow = 0
    for i in range(len(a)):
        if a[i] == b[i]:
            hit += 1
        else:
            for j in range(len(b)):
                if a[i] == b[j]:
                    blow += 1

    return [hit, blow]

for s in sys.stdin:
    a = list(map(int, s.split()))
    b = list(map(int, input().split()))

    hit, blow = hitBlow(a, b)

    print(hit, blow)
Problem: p00025
Buggy submission (Python3, verdict: Wrong Answer):


def main():
    while True:
        try:
            A=input().split()
            B=input().split()

            Hit=0
            Blow=0

            for b in B:
                if b in A:
                    index=B.index(b)
                    print(index)
                    if b==A[index]:
                        Hit+=1

                    else:
                        Blow+=1
            print(Hit,Blow)

        except:
            break
            
    
        
if __name__ == '__main__':
    main()

Failing test case input:
9 1 8 -1
3 1 5 9
4 6 0 2
8 6 3 1

Expected output:
1 1
1 0


Actual output:
1
3
1 1
1
1 0


Fixed submission (verdict: Accepted):


def main():
    while True:
        try:
            A=input().split()
            B=input().split()

            Hit=0
            Blow=0

            for b in B:
                if b in A:
                    index=B.index(b)
                    if b==A[index]:
                        Hit+=1

                    else:
                        Blow+=1
            print(Hit,Blow)

        except:
            break
            
    
        
if __name__ == '__main__':
    main()

Problem: p00025
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    hit=0
    bro=0
    try:
        a = [int(i) for i in input().split()]
        b= [int(j) for j in input().split()]
        for l in range(4):
            if a[l]==b[l]:
                hit+=1
        for g in range(4):
            for p in range(4):
                if a[g]==a[p]:
                    bro+=1
        bro=bro-hit
        bro-=1
        print(hit,bro)
    except:break



Failing test case input:
9 0 8 2
6 1 5 9
7 22 13 2
2 6 7 1

Expected output:
0 1
0 2


Actual output:
0 3
0 3


Fixed submission (verdict: Accepted):
while True:
    hit=0
    bro=0
    try:
        a = [int(i) for i in input().split()]
        b= [int(j) for j in input().split()]
        for g in range(4):
            for p in range(4):
                if a[g]==b[p]:
                    bro+=1
        for l in range(4):
            if a[l]==b[l]:
                hit+=1
                bro-=1
        print(hit,bro)
    except:break