Problem p02890 (python)

Fixed submission:
import sys
input = sys.stdin.readline

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

#output
from collections import Counter
import bisect

l = Counter(A).most_common()
l = [b for a, b in l]
M = len(l)
l.sort()
p = sum(l)

maximum_operation = [0] * N

ll = []
for x in reversed(range(1, N+1)):
    a = bisect.bisect_left(l, x)
    if a == 0:
        b = M*x
        c = 0
    elif a >= M:
        b = 0
        c = p
    else:
        b = (M-a)*x
        c = sum(l[0:a]) 
    ll.append((b + c)/x)

for K in range(M):
    maximum_operation[K] = N - bisect.bisect_left(ll, K+1)

for m in maximum_operation:
    print(m)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

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

#output
from collections import Counter
import bisect
import numpy as np

l = Counter(A).most_common()
l = [b for a, b in l]
l = np.array(l)
M = len(l)
np.sort(l)
m = np.cumsum(l)
p = m[-1]

maximum_operation = [0] * N

ll = np.array([])
for x in range(1, N+1):
    a = bisect.bisect_left(l, x)
    if a == 0:
        b = M*x
        c = 0
    elif a >= M:
        b = 0
        c = p
    else:
        b = (M-a)*x
        c = m[a-1] 
    ll.append((b + c)/x)
np.sort(ll)

for K in range(M):
    maximum_operation[K] = N - bisect.bisect_left(ll, K+1)

for m in maximum_operation:
    print(m)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

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

#output
from collections import Counter
import bisect
import numpy as np

l = Counter(A).most_common()
l = [b for a, b in l]
M = len(l)
l.sort()
m = np.cumsum(l)
p = m[-1]

maximum_operation = [0] * N

ll = []
for x in range(1, N+1):
    a = bi.bisect_left(l, x)
    if a == 0:
        b = M*x
        c = 0
    elif a >= M:
        b = 0
        c = p
    else:
        b = (M-a)*x
        c = m[a-1] 
    ll.append((b + c)/x)
ll.sort()

for K in range(M):
    maximum_operation[K] = N - bisect.bisect_left(ll, K+1)

for m in maximum_operation:
    print(m)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

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

#output
from collections import Counter
import bisect

l = Counter(A).most_common()
l = [b for a, b in l]
M = len(l)

number_of_operation = [0] * O
maximum_operation = [0] * N

ll = []
for x in reversed(range(1, N+1)):
    ll.append(sum([min(x, i) for i in l]) / x)

for K in range(M):
    maximum_operation[K] = N-bisect.bisect_left(ll, K+1)

for m in maximum_operation:
    print(m)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

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

#output
from collections import Counter
import bisect as bi

l = Counter(A).most_common()
l = [b for a, b in l]
M = len(l)

number_of_operation = [0] * O
maximum_operation = [0] * N

ll = []
for x in reversed(range(1, N+1)):
    ll.append(sum([min(x, i) for i in l]) / x)

for K in range(M):
    maximum_operation[K] = N-bi.bisect_left(ll, K+1)

for m in maximum_operation:
    print(m)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

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

#output
from collections import Counter
import bisect as bi

l = Counter(A).most_common()
l = [b for a, b in l]
M = len(l)

number_of_operation = [0] * O
maximum_operation = [0] * N

ll = []
for x in reversed(range(1, N+1)):
    ll.append(sum([min(x, i) for i in l]) / x)

for K in range(M):
    maximum_operation[K] = N-bi.bisect_left(ll, K+1)

for m in maximum_operation:
    print(m)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
 
#input
N = int(input())
A = list(map(int, input().split()))

#output
from collections import Counter
import numpy as np

l = Counter(A).most_common()
l = [b for a, b in l]
M = len(l)
O = l[0]

number_of_operation = [0] * O
maximum_operation = [0] * N
operation_matrix = np.zeros((O, M), int)

for m in range(M):
    operation_matrix[0:l[m], m] += 1

for o in range(O):
    number_of_operation[o] = sum(operation_matrix[o])

for K in range(N):
    temp_number_of_operation = list(number_of_operation)
    for o in range(O-1):
        p, q = divmod(temp_number_of_operation[o], K+1)
        if p > 0:
            temp_number_of_operation[o+1] += q
        maximum_operation[K] += p
    maximum_operation[K] += number_of_operation[O-1]//(K+1)

for m in maximum_operation:
    print(m)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
 
#input
N = int(input())
A = list(map(int, input().split()))
 
from collections import Counter
import numpy as np
 
l = Counter(A).most_common()
l = [b for a, b in l]
l = np.array(l)
 
maximum_operation = [0] * N
for K in range(len(l)):
    l = Counter(A).most_common()
    l = [b for a, b in l]
    l = np.array(l)
    while l[K] > 0:
        l[0:K+1] -= 1
        l = np.sort(l, kind = "quicksort")[::-1]
        maximum_operation[K] += 1
 
for m in maximum_operation:
    print(m)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
 
#input
N = int(input())
A = list(map(int, input().split()))
 
#output
from collections import Counter
 
l = Counter(A).most_common()
l = [b for a, b in l]
 
maximum_operation = [0] * N
for K in range(len(l)):
    l = Counter(A).most_common()
	l = [b for a, b in l]
    while l[K] > 0:
        for i in range(K+1):
            l[i] -= 1
        l.sort(reverse = True)
        maximum_operation[K] += 1
 
for m in maximum_operation:
    print(m)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
 
#input
N = int(input())
A = list(map(int, input().split()))
 
#output
from collections import Counter
 
l = Counter(A).most_common()
l = [b for a, b in l]
 
maximum_operation = [0] * N
for K in range(len(l)):
    l = Counter(A).most_common()
	l = [b for a, b in l]
    while l[K] > 0:
        for i in range(K+1):
            l[i] -= 1
        l.sort(reverse = True)
        maximum_operation[K] += 1
 
for m in maximum_operation:
    print(m)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

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

#output
from collections import Counter
 
l = Counter(A).most_common()
l = [b for a, b in l]

maximum_operation = [0] * N
for K in range(len(l)):
    l = Counter(A).most_common()
    l = [b for a, b in l]
    while l[K][1] > 0:
        for i in range(K+1):
            l[i] -= 1
        l.sort(reverse = True)
        maximum_operation[K] += 1

for m in maximum_operation:
    print(m)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

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

#output
from collections import Counter
from operator import itemgetter
import math
import numpy as np

l = Counter(A).most_common()
l = [[a, b] for a, b in l]

maximum_operation = [0] * N
for K in range(len(l)):
    l = Counter(A).most_common()
    l = [[a, b] for a, b in l]
    while l[K][1] > 0:
        for i in range(K+1):
            l[i][1] -= 1
        l.sort(key = itemgetter(1), reverse = True)
        maximum_operation[K] += 1

for m in maximum_operation:
    print(m)