Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10 ** 9 + 7
N, M = map(int, input().split())
A = tuple(int(input()) for _ in range(M))
table = [0] * (N + 1)
table[0] = 1
for i in range(N + 1):
    now = table[i]
    if i + 1 < N + 1 and i + 1 not in A:
        table[i + 1] = (table[i + 1] + now) % MOD
    if i + 2 < N + 1 and i + 2 not in A:
        table[i + 2] = (table[i + 2] + now) % MOD
print(table[N])

Fixed submission:
MOD = 10 ** 9 + 7
N, M = map(int, input().split())
table = [0] * (N + 1)
table[0] = 1
banned = [0] * (N + 1)
for _ in range(M):
    banned[int(input())] = 1
for i in range(N + 1):
    now = table[i]
    if i + 1 < N + 1 and not banned[i + 1]:
        table[i + 1] = (table[i + 1] + now) % MOD
    if i + 2 < N + 1 and not banned[i + 2]:
        table[i + 2] = (table[i + 2] + now) % MOD
print(table[N])

Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10 ** 9 + 7
N, M = map(int, input().split())
A = tuple(int(input()) for _ in range(M))
table = [0] * (N + 1)
table[0] = 1
for i in range(N + 1):
    now = table[i]
    if i + 1 < N + 1 and i + 1 not in A:
        table[i + 1] = (table[i + 1] + now) % MOD
    if i + 2 < N + 1 and i + 2 not in A:
        table[i + 2] = (table[i + 2] + now) % MOD
print(table[N])

Fixed submission:
MOD = 10 ** 9 + 7
N, M = map(int, input().split())
table = [0] * (N + 1)
table[0] = 1
banned = [0] * (N + 1)
for _ in range(M):
    banned[int(input())] = 1
for i in range(N + 1):
    now = table[i]
    if i + 1 < N + 1 and not banned[i + 1]:
        table[i + 1] = (table[i + 1] + now) % MOD
    if i + 2 < N + 1 and not banned[i + 2]:
        table[i + 2] = (table[i + 2] + now) % MOD
print(table[N])
Buggy python submission (verdict: Runtime Error):
MOD = 10 ** 9 + 7
p3 = [1] * N
for i in range(1, N):
    p3[i] = p3[i - 1] * 3 % MOD
L = input()
N = len(L)
p2 = 1
total = 0
for i in range(N):
    if L[i] == "1":
        total = (total + p2 * p3[N - i - 1]) % MOD
        p2 = p2 * 2 % MOD
print((total + p2 * p3[N - i - 1]) % MOD)

Fixed submission:
MOD = 10 ** 9 + 7
L = input()
N = len(L)
total = 0
one_count = 0
pow2, pow3 = [1], [1]
p2, p3 = 1, 1
for i in range(N):
    p2 = p2 * 2 % MOD
    p3 = p3 * 3 % MOD
    pow2.append(p2)
    pow3.append(p3)
for i in range(N):
    if L[i] == "1":
        total = (total + pow2[one_count] * pow3[N - i - 1]) % MOD
        one_count += 1
print((total + pow2[one_count] * pow3[N - i - 1]) % MOD)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from scipy.sparse.csgraph import connected_components
N, M = map(int, input().split())
matrix = np.array([[0] * N for _ in range(N)], dtype=np.bool)
for _ in range(M):
    i, j, _ = map(int, input().split())
    matrix[i - 1][j - 1] = True

print(connected_components(matrix)[0])


Fixed submission:
import numpy as np
from scipy.sparse import csr_matrix, csgraph
N, M = map(int, input().split())
row, column, _ = np.array([tuple(map(lambda n: int(n) - 1, input().split())) for _ in range(M)], dtype=np.int32).T
matrix = csr_matrix(([1] * M, (row, column)), shape=(N, N), dtype=np.int32)
print(csgraph.connected_components(matrix)[0])
Buggy python submission (verdict: Runtime Error):
input()
A = list(set(map(int, input().split()))
N = len(A)

def gcd(x, y):
  while y != 0:
    x, y = y, x%y
  return x


if N <= 2:
  print(max(A))
else:
  max = 0
  for i in range(N):
    temp = A.pop(0)
    ans = gcd(A[0], A[1])
    for j in A[1:]:
      ans = gcd(ans, j)
    if max < ans:
      max = ans
    A.append(temp)
  print(max)

Fixed submission:
l = list(map(int, input().split()))
print((l[2] // l[0]) * l[1], "")

Buggy python submission (verdict: Runtime Error):
input()
A = list(map(int, input().split()))
N = len(A)

def gcd(x, y):
  while y != 0:
    x, y = y, x%y
  return x


if N <= 2:
  print(max(A))
else:
  max = 0
  for i in range(N):
    temp = A.pop(0)
    ans = gcd(A[0], A[1])
    for j in A[1:]:
      ans = gcd(ans, j)
    if max < ans:
      max = ans
    A.append(temp)
  print(max)

Fixed submission:
l = list(map(int, input().split()))
print((l[2] // l[0]) * l[1], "")
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()

parity = []
runlength = []

prev = S[0]
run = 0
for c in S:
    if c != prev:
        parity.append(bool(int(prev)))
        runlength.append(run)
        run = 0
    prev = c
    run += 1
parity.append(bool(int(prev)))
runlength.append(run)

if parity.count(False) <= K:
    print(N)
    quit()

argmax = 0
maximum = 0

L = len(parity)
for i in range(L):
    total = sum(runlength[max(0, i - 1): min(L, i + 2)])
    if not parity[i] and total > maximum:
        argmax = i
        maximum = total

while True:
    parity[argmax] = True
    runlength[argmax] = maximum
    del parity[argmax + 1]
    del parity[argmax - 1]
    del runlength[argmax + 1]
    del runlength[argmax - 1]

    K -= 1
    if not K:
        print(maximum)
        break

    L = len(parity)
    maximum = 0
    for i in [argmax - 2, argmax]:
        total = sum(runlength[max(0, i - 1): min(L, i + 2)])
        if total > maximum:
            argmax = i
            maximum = total

Fixed submission:
_, K = map(int, input().split())
S = input()

offset = int(S[0]) == (K & 1)
runs = []

prev = S[0]
run = 0
for c in S:
    if c != prev:
        runs.append(run)
        run = 0
    prev = c
    run += 1
runs.append(run)

L = len(runs)
candidates = []

prev = sum(runs[max(0, offset - K): min(L, offset + K + 1)])
candidates.append(prev)

for i in range(offset + 2, L, 2):
    now = prev
    old_left = i - 2 - K
    new_right = i + K
    if old_left >= 0:
        now -= runs[old_left]
    if old_left + 1 >= 0:
        now -= runs[old_left + 1]
    if new_right - 1 < L:
        now += runs[new_right - 1]
    if new_right < L:
        now += runs[new_right]
    prev = now
    candidates.append(prev)

print(max(candidates))
Buggy python submission (verdict: Runtime Error):
dishes = [int(input()) for _ in range(5)]
print(sum(map(lambda num: num + 10 * (num % 10 != 0) - (num % 10), dishes)) + min(n for n in map(lambda num: num % 10, dishes) if n) - 10)


Fixed submission:
dishes = [int(input()) for _ in range(5)]
tuple_ = tuple(n for n in map(lambda num: num % 10, dishes) if n)
print(sum(map(lambda num: num + 10 * (num % 10 != 0) - (num % 10), dishes)) + min(tuple_ if tuple_ else (10,)) - 10)
Buggy python submission (verdict: Runtime Error):
M, N = map(int, input().split())
COST, STOCK = range(2)
energy_drinks = sorted((tuple(map(int, input().split())) for _ in range(N)), key=lambda tuple_: tuple_[COST])

cost = 0
for energy_drink in energy_drinks:
    buy = min(energy_drink[STOCK], N)
    N -= buy
    cost += buy * energy_drink[COST]
print(cost)


Fixed submission:
M, N = map(int, input().split())
COST, STOCK = range(2)
energy_drinks = sorted((tuple(map(int, input().split())) for _ in range(M)), key=lambda tuple_: tuple_[COST])

cost = 0
for energy_drink in energy_drinks:
    buy = min(energy_drink[STOCK], N)
    N -= buy
    cost += buy * energy_drink[COST]
print(cost)
Buggy python submission (verdict: Runtime Error):
from functools import reduce
from operator import mul
def prime_factorize_dict(n, N):
    d = {1: 50}
    while not n & 1:
        d[2] = d.get(2, 0) + 1
        n >>= 1
    f = 3
    while f * f <= n:
        if not n % f:
            d[f] = d.get(f, 0) + 1
            n //= f
        else:
            f += 2
    if n != 1:
        d[n] = d.get(n, 0) + 1
    return d

N, P = map(int, input().split())
factors, powers = zip(*((factor, power) for factor, power in prime_factorize_dict(P, N).items() if power >= N))
print(reduce(mul, (factor ** (min(powers) // N) for factor in factors)))

Fixed submission:
from functools import reduce
from operator import mul
def prime_factorize_dict(n, N):
    d = {1: 1}
    while not n & 1:
        d[2] = d.get(2, 0) + 1
        n >>= 1
    f = 3
    while f * f <= n:
        if not n % f:
            d[f] = d.get(f, 0) + 1
            n //= f
        else:
            f += 2
    if n != 1:
        d[n] = d.get(n, 0) + 1
    return d

N, P = map(int, input().split())
print(reduce(mul, (factor ** (power // N) for factor, power in prime_factorize_dict(P, N).items())))

Buggy python submission (verdict: Runtime Error):
from functools import reduce
from operator import mul
def prime_factorize_dict(n):
    if n == 1:
        return {1: 1}
    d = dict()
    while not n & 1:
        d[2] = d.get(2, 0) + 1
        n >>= 1
    f = 3
    while f * f <= n:
        if not n % f:
            d[f] = d.get(f, 0) + 1
            n //= f
        else:
            f += 2
    if n != 1:
        d[n] = d.get(n, 0) + 1
    return d

N, P = map(int, input().split())
factors, powers = zip(*((factor, power) for factor, power in prime_factorize_dict(P).items() if power >= N))
print(reduce(mul, (factor ** (min(powers) // N) for factor in factors)))

Fixed submission:
from functools import reduce
from operator import mul
def prime_factorize_dict(n, N):
    d = {1: 1}
    while not n & 1:
        d[2] = d.get(2, 0) + 1
        n >>= 1
    f = 3
    while f * f <= n:
        if not n % f:
            d[f] = d.get(f, 0) + 1
            n //= f
        else:
            f += 2
    if n != 1:
        d[n] = d.get(n, 0) + 1
    return d

N, P = map(int, input().split())
print(reduce(mul, (factor ** (power // N) for factor, power in prime_factorize_dict(P, N).items())))
Buggy python submission (verdict: Runtime Error):
from numpy import ndarray, argmin

input()
temp_on_sea, oracle = map(int, input().rstrip("\n").split())
heights = ndarray(list(map(lambda x: abs(int(x) - oracle) , input().rstrip("\n").split())))

print(heights.argmin() + 1)

Fixed submission:
from numpy import array, argmin

input()
temp_on_sea, oracle = map(int, input().rstrip("\n").split())
heights = list(map(int , input().rstrip("\n").split()))
temp_diff = [abs(temp_on_sea - height * 0.006 - oracle) for height in heights]

print(array(temp_diff).argmin() + 1)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
divisors = sorted(sum(([*{n, M // n}] for n in range(1, int(M ** 0.5) + 1) if not M % n), []), reverse=True)

for d in divisors:
    if M // d >= N:
        print(d)
        break


Fixed submission:
N, M = map(int, input().split())
divisors = sorted(sum((list({n, M // n}) for n in range(1, int(M ** 0.5) + 1) if not M % n), []), reverse=True)

for d in divisors:
    if M // d >= N:
        print(d)
        break
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, M, Q = map(int, input().split())
table = np.zeros((N, N), np.int64)
for _ in range(M):
    L, R = map(lambda n: int(n) - 1, input().split())
    table[L][R] += 1
table = np.rot90(np.rot90(table, k=-1).cumsum(axis=0).cumsum(axis=1), k=1)
for _ in range(Q):
    p, q = map(lambda n: int(n) - 1, input().split())
    print(table[p][q])

Fixed submission:
import numpy as np
N, M, Q = map(int, input().split())
table = np.zeros((N, N), np.int64)
for _ in range(M):
    L, R = map(lambda n: int(n) - 1, input().split())
    table[L][R] += 1
table = np.rot90(np.rot90(table, k=-1).cumsum(axis=0).cumsum(axis=1), k=1)
for _ in range(Q):
    p, q = map(lambda n: int(n) - 1, input().split())
    print(table[p][q])
Buggy python submission (verdict: Runtime Error):
s1 = input()
print("Yes" if input() in tuple(s1[i:] + s1[:i] for i in range(len(s1))) else "No")


Fixed submission:
import numpy as np
A = np.array(sorted(map(int, input().split())))
print((A[1:] - A[:-1]).sum())
Buggy python submission (verdict: Runtime Error):
print("Yes" if input() in tuple(s1[i:] + s1[:i] for i in range(len(s1))) else "No")


Fixed submission:
s1 = input()
print("Yes" if input() in tuple(s1[i:] + s1[:i] for i in range(len(s1))) else "No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
print(eval(input().replace(" ", "+")) - N)

Fixed submission:
N = int(input())
print(sum(map(int, input().split())) - N)
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(min([sum(map(int, str(i) + str(n - i))) for i in range(1, n // 2)]))


Fixed submission:
n = int(input())
print(min([sum(map(int, str(i) + str(n - i))) for i in range(1, n // 2 + 1)]))

Buggy python submission (verdict: Runtime Error):
n = int(input())
print(min([sum(map(int, str(i) + str(n - i))) for i in range(1, n // 2)]))


Fixed submission:
n = int(input())
print(min([sum(map(int, str(i) + str(n - i))) for i in range(1, n // 2 + 1)]))
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
for n in sorted({*range(A, A + K), *range(B - K + 1, B + 1)}):
    print(n)


Fixed submission:
A, B, K = map(int, input().split())
for n in sorted(filter(lambda n: A <= n <= B , set(range(A, A + K)) | set(range(B - K + 1, B + 1)))):
    print(n)
Buggy python submission (verdict: Runtime Error):
dict_ = dict()
[exec("dict_['{0}'] = dict_.get('{0}', 0) + 1".format(input())) for _ in range(int(input()))]
[exec("dict_['{0}'] = dict_.get('{0}', 0) - 1".format(input())) for _ in range(int(input()))]
print(max(*dict_.values(), 0))


Fixed submission:
nblues = int(input())
profits = dict()
for _ in range(nblues):
    word = input().rstrip("\n")
    profits[word] = profits.get(word, 0) + 1

nreds = int(input())
for _ in range(nreds):
    word = input().rstrip("\n")
    profits[word] = profits.get(word, 0) - 1

print(max(0, max(profits.items(), key=lambda t: t[1])[1]))
Buggy python submission (verdict: Time Limit Exceeded):
from functools import lru_cache as cache

H, W, D = map(int, input().split())
A = tuple(tuple(map(int, input().split())) for _ in range(H))

pos = [0] * (H * W + 1)

for i in range(H):
    for j in range(W):
        pos[A[i][j]] = (i, j)

def L1(p1, p2):
    return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])

costs = [-1] * (H * W + 1)

@cache(maxsize=None)
def solve(l, r):
    total = 0
    for i in range(l, r, D):
        if costs[i] == -1:
            costs[i] = L1(pos[i], pos[i + D])
        total += costs[i]
    return total

Q = int(input())
for _ in range(Q):
    print(solve(*map(int, input().split())))


Fixed submission:
H, W, D = map(int, input().split())
A = tuple(tuple(map(int, input().split())) for _ in range(H))

pos = [0] * (H * W + 1)

for i in range(H):
    for j in range(W):
        pos[A[i][j]] = (i, j)

def L1(p1, p2):
    return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])

costs = []

for i in range(H * W + 1):
    costs.append(0 if i <= D else costs[i - D] + L1(pos[i - D], pos[i]))

Q = int(input())
for _ in range(Q):
    L, R = map(int, input().split())
    print(costs[R] - costs[L])

Buggy python submission (verdict: Time Limit Exceeded):
H, W, D = map(int, input().split())
A = tuple(tuple(map(int, input().split())) for _ in range(H))

pos = [0] * (H * W + 1)

for i in range(H):
    for j in range(W):
        pos[A[i][j]] = (i, j)

def L1(p1, p2):
    return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])

costs = [-1] * (H * W + 1)

def solve(l, r):
    total = 0
    for i in range(l, r, D):
        if costs[i] == -1:
            costs[i] = L1(pos[i], pos[i + D])
        total += costs[i]
    return total

Q = int(input())
for _ in range(Q):
    print(solve(*map(int, input().split())))


Fixed submission:
H, W, D = map(int, input().split())
A = tuple(tuple(map(int, input().split())) for _ in range(H))

pos = [0] * (H * W + 1)

for i in range(H):
    for j in range(W):
        pos[A[i][j]] = (i, j)

def L1(p1, p2):
    return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])

costs = []

for i in range(H * W + 1):
    costs.append(0 if i <= D else costs[i - D] + L1(pos[i - D], pos[i]))

Q = int(input())
for _ in range(Q):
    L, R = map(int, input().split())
    print(costs[R] - costs[L])
Buggy python submission (verdict: Runtime Error):
manhattan = lambda x,y: abs(x[0] - y[0]) + abs(x[1] - y[1])

def solve():
    n = int(input())
    table = [[0, 0, 0]] + list(map(int, input().rstrip("\n").split()) for i in range(n))

    for i in range(1, len(table)):
        t = (table[i][0] - table[i - 1][0] - manhattan(table[i - 1][1:], table[i][1:]))
        if t < 0 or t % 2 != 0:
            return "No"
    return "Yes"

print(solve())


Fixed submission:
a, b = map(int, input().split())
print("Odd" if (a * b) % 2 else "Even")
Buggy python submission (verdict: Runtime Error):
manhattan = lambda x,y: abs(x[0] - y[0]) + abs(x[1] - y[1])

def solve():
    n = int(input())
    table = [[0, 0, 0]] + list(map(int, input().rstrip("\n").split()) for i in range(n))

    for i in range(1, len(table)):
        t = (table[i][0] - table[i - 1][0] - manhattan(table[i - 1][1:], table[i][1:]))
        if t < 0 or t % 2 != 0:
            return "No"
    return "Yes"

print(solve())


Fixed submission:
manhattan = lambda x,y: abs(x[0] - y[0]) + abs(x[1] - y[1])

def solve():
    n = int(input())
    table = [[0, 0, 0]] + [list(map(int, input().rstrip("\n").split())) for i in range(n)]

    for i in range(1, len(table)):
        t = (table[i][0] - table[i - 1][0] - manhattan(table[i - 1][1:], table[i][1:]))
        if t < 0 or t % 2 != 0:
            return "No"
    return "Yes"

print(solve())

Buggy python submission (verdict: Runtime Error):
manhattan = lambda x,y: abs(x[0] - y[0]) + abs(x[1] - y[1])

def solve():
    n = int(input())
    table = [[0, 0, 0]] + list(map(int, input().rstrip("\n").split()) for i in range(n))

    for i in range(1, len(table)):
        t = (table[i][0] - table[i - 1][0] - manhattan(table[i - 1][1:], table[i][1:]))
        if t < 0 or t % 2 != 0:
            return "No"
    return "Yes"

print(solve())


Fixed submission:
manhattan = lambda x,y: abs(x[0] - y[0]) + abs(x[1] - y[1])

def solve():
    n = int(input())
    table = [[0, 0, 0]] + [list(map(int, input().rstrip("\n").split())) for i in range(n)]

    for i in range(1, len(table)):
        t = (table[i][0] - table[i - 1][0] - manhattan(table[i - 1][1:], table[i][1:]))
        if t < 0 or t % 2 != 0:
            return "No"
    return "Yes"

print(solve())
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, H = map(int, input().split())
A, B = np.array(tuple(tuple(map(int, input().split())) for _ in range(N))).T

m = A.max()
C = B > m
Q, R = np.divmod(H - B[C].sum(), m)

print(C.sum() + Q + bool(R))


Fixed submission:
import numpy as np
N, H = map(int, input().split())
A, B = np.array(tuple(tuple(map(int, input().split())) for _ in range(N))).T

m = A.max()
B.sort()
C = iter(B[B > m][::-1])

count = 0

try:
    while H > 0:
        H -= next(C)
        count += 1
except StopIteration:
    Q, R = divmod(H, m)
    print(count + Q + bool(R))
else:
    print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
def sieve_of_eratosthenes_2017(N):
    numbers = [n & 1 for n in range(N + 1)]
    numbers[1] = 0
    numbers[2] = 1
    like2017 = []
    p = 1
    while True:
        while not numbers[p]:
            p += 2
        if numbers[(p + 1) >> 1]:
            like2017.append(p)
        if p * p > N:
            for i in range(p, N + 1, 2):
                if (i + 1) >> 1:
                    like2017.append(i)
            return like2017
        for i in range(p * 2, N + 1, p):
            numbers[i] = 0
        p += 2

like2017 = np.array(sieve_of_eratosthenes_2017(10 ** 5), dtype=np.int32)
Q = int(input())
for _ in range(Q):
    l, r = map(int, input().split())
    lindex = np.searchsorted(like2017, l)
    rindex = np.searchsorted(like2017, r, side="right")
    print(rindex - lindex)

Fixed submission:
from itertools import accumulate
def sieve_of_eratosthenes_2017(N):
    numbers = [n & 1 for n in range(N + 1)]
    numbers[1] = 0
    numbers[2] = 1
    like2017 = [0] * (N + 1)
    p = 1
    while True:
        while not numbers[p]:
            p += 2
        if p * p > N:
            for i in range(p, N + 1, 2):
                if numbers[i] & numbers[(i + 1) >> 1]:
                    like2017[i] = 1
            return like2017
        if numbers[(p + 1) >> 1]:
            like2017[p] = 1
        for i in range(p * 2, N + 1, p):
            numbers[i] = 0
        p += 2

like2017 = sieve_of_eratosthenes_2017(10 ** 5)
like2017_sum = list(accumulate(like2017))
Q = int(input())
for _ in range(Q):
    l, r = map(int, input().split())
    print(like2017_sum[r] - like2017_sum[l] + like2017[l])
Buggy python submission (verdict: Runtime Error):
line = input()
A, B, C, D = map(int, input().split())
left, right = A + B, C + D
print((
    "Left" if left > right else
    "Balanced" if left == right else
    "Right"
    ))


Fixed submission:
A, B, C, D = map(int, input().split())
left, right = A + B, C + D
print((
    "Left" if left > right else
    "Balanced" if left == right else
    "Right"
    ))

Buggy python submission (verdict: Runtime Error):
line = input()
left, right = eval(line[:3].replace(" ", "+")), eval(line[-4:].replace(" ", "+"))
print((
    "Left" if left > right else
    "Balanced" if left == right else
    "Right"
    ))


Fixed submission:
A, B, C, D = map(int, input().split())
left, right = A + B, C + D
print((
    "Left" if left > right else
    "Balanced" if left == right else
    "Right"
    ))
Buggy python submission (verdict: Runtime Error):

k, s = map(int, input().rstrip("\n").split())
count = 0

for x in range(k + 1):
    for y in range(k + 1):
        for z in range(k + 1):
            count += (x + y + z == s)

print(count)


Fixed submission:
n, lo, hi = map(int, input().rstrip("\n").split())
print(sum([i if lo <= sum(map(int, str(i))) <= hi else 0 for i in range(n + 1)]))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
dict_ = dict()
[exec("dict_[{0}] = dict_.get({0}, 0) + 1".format(num)) for num in map(int, input().split())]
print(sum(sorted(dict_.values(), reverse=True)[k:]))


Fixed submission:
n, k = map(int, input().rstrip("\n").split())
numbers_dict = dict()
for number in map(int, input().rstrip("\n").split()):
    numbers_dict[number] = numbers_dict.get(number, 0) + 1

print(sum(sorted(numbers_dict.values(), reverse=True)[k:]))
Buggy python submission (verdict: Runtime Error):
import numpy as np
h, w = map(int, input().rstrip("\n").split())

array = np.array([[" "] * (w + 2)] + [list(" " + input().rstrip("\n") + " ") for _ in range(h)] + [[" "] * (w + 2)])

list_ = []

for i in range(1, h + 1):
    for j in range(1, w + 1):
        if array[i][j] == "#":
            list_.append("#")
        else:
            list_.append(str(sum(sum(array[i - 1:i + 2, j - 1:j + 2] == "#"))))
    list_.append("\n")
list_.pop()

print("".join(list_))


Fixed submission:

import numpy as np
h, w = map(int, input().rstrip("\n").split())

array = np.array([[" "] * (w + 2)] + [list(" " + input().rstrip("\n") + " ") for _ in range(h)] + [[" "] * (w + 2)])

list_ = []

for i in range(1, h + 1):
    for j in range(1, w + 1):
        if array[i][j] == "#":
            list_.append("#")
        else:
            list_.append(str(sum(sum(array[i - 1:i + 2, j - 1:j + 2] == "#"))))
    list_.append("\n")
list_.pop()

print("".join(list_))
Buggy python submission (verdict: Runtime Error):
from scipy.sparse import coo_matrix, csgraph
N, M = map(int, input().split())
points = tuple(tuple(map(lambda n: int(n) - 1, input().split())) for _ in range(M))
matrix = coo_matrix(([1] * M, zip(*points)), shape=(N, N)).toarray()
total = 0
for point in points:
    matrix[point] = 0
    total += csgraph.connected_components(matrix, directed=False, return_labels=False) != 1
    matrix[point] = 1
print(total)

Fixed submission:
from scipy.sparse import coo_matrix, csgraph
N, M = map(int, input().split())
points = tuple(tuple(map(lambda n: int(n) - 1, input().split())) for _ in range(M))
matrix = coo_matrix(([1] * M, tuple(zip(*points))), shape=(N, N)).toarray()
total = 0
for point in points:
    matrix[point] = 0
    total += csgraph.connected_components(matrix, directed=False, return_labels=False) != 1
    matrix[point] = 1
print(total)