Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
gap = [0]
mt = []
va = []
i = 0
while i+1 <= len(h)-1:
    if h[i+1]-h[i] != 0:
        gap.append(h[i+1]-h[i])
        i += 1
    else:
        h.pop(i+1)
for i in range(h):    
    if gap[i] >= 0: 
        if gap[i+1] < 0:
            mt.append(h[i])
    else:
        if gap[i+1] > 0:
            va.append(h[i])
if gap[-1] > 0 :
    mt.append(h[-1])
if mt == []:
    mt.append(h[0])
ans = 0
for x in mt:
    ans += x
for x in va:
    ans -= x
print(ans)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
gap = [0]
mt = []
va = []
i = 0
while i+1 <= len(h)-1:
    if h[i+1]-h[i] != 0:
        gap.append(h[i+1]-h[i])
        i += 1
    else:
        h.pop(i+1)
for i in range(len(h)-1):    
    if gap[i] >= 0: 
        if gap[i+1] < 0:
            mt.append(h[i])
    else:
        if gap[i+1] > 0:
            va.append(h[i])
if gap[-1] > 0 :
    mt.append(h[-1])
if mt == []:
    mt.append(h[0])
ans = 0
for x in mt:
    ans += x
for x in va:
    ans -= x
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
gap = [0]
mt = []
va = []
i = 0
while i+1 <= len(h)-1:
    if h[i+1]-h[i] != 0:
        gap.append(h[i+1]-h[i])
        i += 1
    else:
        h.pop(i+1)
for i in range(h)    
    if gap[i] >= 0: 
        if gap[i+1] < 0:
            mt.append(h[i])
    else:
        if gap[i+1] > 0:
            va.append(h[i])
if gap[-1] > 0 :
    mt.append(h[-1])
if mt == []:
    mt.append(h[0])
ans = 0
for x in mt:
    ans += x
for x in va:
    ans -= x
print(ans)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
gap = [0]
mt = []
va = []
i = 0
while i+1 <= len(h)-1:
    if h[i+1]-h[i] != 0:
        gap.append(h[i+1]-h[i])
        i += 1
    else:
        h.pop(i+1)
for i in range(len(h)-1):    
    if gap[i] >= 0: 
        if gap[i+1] < 0:
            mt.append(h[i])
    else:
        if gap[i+1] > 0:
            va.append(h[i])
if gap[-1] > 0 :
    mt.append(h[-1])
if mt == []:
    mt.append(h[0])
ans = 0
for x in mt:
    ans += x
for x in va:
    ans -= x
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
from collections import defaultdict
d = defaultdict(list)
l = [[] for i in range(M)]
for i in range(M):
    P,Y = map(str, input().split())
    P = "0" * (6-len(P)) + P
    d[P] += [int(Y)]
    l[i] = [P,int(Y)]
for i in range(M):
    tmp = str((sorted(d[l[i][0]]).index(l[i][1]))+1)
    print(l[i][0] + "0" * (6-len(tmp)) + tmp)

Fixed submission:
A,B = map(int, input().split())
print(A + B//2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()) 
tmp=10**3
ans=0
for i in range(N):
    if abs(A-T+H[i]*0.006)<tmp:
        tmp=abs(A-T+H[i]*0.006)
        ans=i+1
print(ans)

Fixed submission:
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
tmp = 1000
ans = 0
for i in range(N):
    if abs(A-T+H[i]*0.006)<tmp:
        tmp=abs(A-T+H[i]*0.006)
        ans=i+1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = str(input())
for i in range(3):
    if n[i] == "1":
        n[i] = "9"
    else:
        n[i] = "1"
print(n)          

Fixed submission:
n = str(input())
m = ""
for i in range(3):
    if n[i] == "1":
        m += "9"
    else:
        m += "1"
print(m)
Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
v = list(map(int, input().split()))
even = [v[2*i] for i in range(n//2)]
odd = [v[2**i+1] for i in range(n//2)]
dEven = collections.Counter(even).most_common()
dOdd = collections.Counter(odd).most_common()
if dEven[0][0] != dOdd[0][0]:
    ans = n - dEven[0][1]  - dOdd[0][1]
else:
    ans = n - max(dEven[0][1]+dOdd[1][0], dEven[1][0]+dOdd[0][1])
print(ans)

Fixed submission:
import collections
n = int(input())
v = list(map(int, input().split()))
even = [v[2*i] for i in range(n//2)]
odd = [v[2*i+1] for i in range(n//2)]
dEven = collections.Counter(even).most_common()
dOdd = collections.Counter(odd).most_common()
if dEven[0][0] != dOdd[0][0]:
    ans = n - dEven[0][1]  - dOdd[0][1]
else:
    if len(dEven) >=2 and len(dOdd) >= 2:
        ans = n - max(dEven[0][1]+dOdd[1][1], dEven[1][1]+dOdd[0][1])
    elif len(dEven) < len(dOdd):
        ans = n - (dEven[0][1]+dOdd[1][1])
    elif len(dEven) > len(dOdd):
        ans = n - (dEven[1][1]+dOdd[0][1])
    else:
        ans = n//2
print(ans)
Buggy python submission (verdict: Runtime Error):
from decimal import *
i = input().split()
a = int(i[0])
b = Decimal(i[1])i
print(int(a * b))

Fixed submission:
from decimal import *
i = input().split()
a = int(i[0])
b = Decimal(i[1])
print(int(a * b))
Buggy python submission (verdict: Runtime Error):
from math import sqrt
def get_divisor(num):
	arr = [i for i in range(1,int(sqrt(num))) if num % i == 0]
	arr += [num // i for i in reversed(arr)]
	return arr

def get_common(num1, num2):
	list_a = get_divisor(num1)
	list_b = get_divisor(num2)
	return [i for i in list_a if i in list_b]

def prime_ch(num):
	if num == 1:
		return False
	for i in list(range(2,int(sqrt(num))+1)):
		if num % i == 0:
			return False
	return True


A,B = list(map(int,input().split()))[:2]
common = get_common(A,B)
c_prime = [p for p in common if prime_ch(p)]
print((len(c_prime)+1))

Fixed submission:
N = int(input())
odd_count = 0
for i in range(1,N+1):
	if i % 2 == 1:
		odd_count += 1
print(odd_count/N)

Buggy python submission (verdict: Runtime Error):
N = int(input())
odd_count = 0
for i in range(1,N+1):
  if i % 2 = 1:
  	odd_count+=1
print(odd_count/N)

Fixed submission:
N = int(input())
odd_count = 0
for i in range(1,N+1):
	if i % 2 == 1:
		odd_count += 1
print(odd_count/N)
Buggy python submission (verdict: Runtime Error):
N,K = list(map(int,input().split())).[:2]
height = list(map(int,input().split())).[:N]
able2ride = [a in height if a > K]
print(len(able2ride))

Fixed submission:
N,K = list(map(int,input().split()))[:2]
height = list(map(int,input().split()))[:N]
able2ride = [a for a in height if a >= K]
print(len(able2ride))
Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
def get_divisor(num):
	return [i for i in range(1,num+1) if num % i == 0]

def get_common(num1, num2):
	list_a = get_divisor(num1)
	list_b = get_divisor(num2)
	return [i for i in list_a if i in list_b]

def prime_ch(num):
	if num == 1:
		return False
	for i in range(2,int(sqrt(num))+1):
		if num % i == 0:
			return False
	return True


A,B = list(map(int,input().split()))[:2]
common = get_common(A,B)
c_prime = [p for p in common if prime_ch(p)]
print((len(c_prime)+1))

Fixed submission:
from math import sqrt
def get_divisor(num):
	arr = [i for i in range(1,int(sqrt(num))+1) if num % i == 0]
	arr += [num // i for i in reversed(arr) if num // i not in arr]
	return arr

def get_common(num1, num2):
	list_a = get_divisor(num1)
	list_b = get_divisor(num2)
	return [i for i in list_a if i in list_b]

def prime_ch(num):
	if num == 1:
		return False
	for i in list(range(2,int(sqrt(num))+1)):
		if num % i == 0:
			return False
	return True


A,B = list(map(int,input().split()))[:2]
common = get_common(A,B)
c_prime = [p for p in common if prime_ch(p)]
print((len(c_prime)+1))
Buggy python submission (verdict: Runtime Error):
code = input()
previous = 'a'
for c in code:
  if perivioud == c:
    print('bad')
    break

Fixed submission:
code = input()
previous = 'a'
ch = True
for c in code:
    if previous == c:
        print('Bad')
        ch = False
        break
    previous = c
if ch:
    print('Good')
Buggy python submission (verdict: Runtime Error):
N,X = list(map(int,input().split(' ')))
L = list(map(int,input().split(' ')))[:N]

p = 0
count = 1

for i in range(1,N):
    p += L[i]
    if p <= X:
        count += 1
print(count)


Fixed submission:
x,a = list(map(int,input().split(' ')))
if x < a:
  print(0)
else:
  print(10)
Buggy python submission (verdict: Runtime Error):
from math import log2

def prob(num, dice, K):
	times = int(log2(K/num) + 1)
	base  = 1/dice
	if times < 0:
		times = 0
	p = base * pow(0.5,times)
	return p

def sum_prob(dice, K):
	probabilty = 0
	for i in range(1,dice+1):
		probabilty += prob(i, dice, K)
	return probabilty


inputs = list(map(float,input().split(' ')))[:2]
dice = inputs[0]
K = inputs[1]
probabilty = sum_prob(dice, K)
print(probabilty)

Fixed submission:
length_and_index = list(map(int,input().split(' ')))
input_str = list(input()[:length_and_index[0]])
input_str[length_and_index[1]-1] = chr(ord(input_str[length_and_index[1]-1])+32)
out = "".join(str(x) for x in input_str)
print(out)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
il = lambda func=int: list(map(func, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]
def gcd(a, b):
    if a < b: return gcd(b, a)
    if b == 0: return a
    return gcd(b, a%b)
def lcm(a, b):
    return a * b // gcd(a, b)

n, m = il()
s = input()
t = input()
ans = lcm(n, m)
hoge = "0" * ans
for i in range(n):
    nn = ans//n
    if hoge[i*nn] != "0" and hoge[i*nn] != s[i]:
        print(-1)
        exit()
    hoge = hoge[:i*nn] + s[i] + hoge[i*nn+1:]
for i in range(m):
    mm = ans//m
    if hoge[i*mm] != "0" and hoge[i*mm] != t[i]:
        print(-1)
        exit()
    hoge = hoge[:i*mm] + t[i] + hoge[i*mm+1:]
print(ans)

Fixed submission:
from sys import stdin
il = lambda func=int: list(map(func, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]
def gcd(a, b):
    if a < b: return gcd(b, a)
    if b == 0: return a
    return gcd(b, a%b)
def lcm(a, b):
    return a * b // gcd(a, b)

n, m = il()
s = input()
t = input()
aa = gcd(n, m)
bb = lcm(n, m)
cc = aa // bb
for i in range(aa):
    if s[n//aa*i] != t[m//aa*i]:
        print(-1)
        exit()
print(bb)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
il = lambda func=int: list(map(func, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

n = int(input())
v = il()
a = dict()
b = dict()
for i in range(n):
    if i&1:
        if v[i] in a:
            a[v[i]] += 1
        else:
            a[v[i]] = 1
    else:
        if v[i] in b:
            b[v[i]] += 1
        else:
            b[v[i]] = 1
ans = 0
a = sorted(a.items(), key=lambda x:x[1])
b = sorted(b.items(), key=lambda x:x[1])

if a[-1][0] == b[-1][0]:
    ans += min(a[-1][1], b[-1][1])
else:
    if len(a) > 1:
        ans += n//2 - a[-1][1]
    if len(b) > 1:
        ans += n//2 - B[-1][1]

print(ans)

Fixed submission:
from sys import stdin
il = lambda func=int: list(map(func, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

n = int(input())
v = il()
a = dict()
b = dict()
for i in range(n):
    if i&1:
        if v[i] in a:
            a[v[i]] += 1
        else:
            a[v[i]] = 1
    else:
        if v[i] in b:
            b[v[i]] += 1
        else:
            b[v[i]] = 1
a = sorted(a.items(), key=lambda x:x[1])
b = sorted(b.items(), key=lambda x:x[1])

h = a[-1][0]
ans = n//2 - a[-1][1]
if b[-1][0] == h:
    if len(b) == 1:
        ans += n//2
    else:
        ans += n//2 - b[-2][1]
else:
    ans += n//2 - b[-1][1]

hoge = ans 

h = b[-1][0]
ans = n//2 - b[-1][1]
if a[-1][0] == h:
    if len(a) == 1:
        ans += n//2
    else:
        ans += n//2 - a[-2][1]
else:
    ans += n//2 - a[-1][1]

print(min(ans, hoge))
Buggy python submission (verdict: Runtime Error):
import math
na = lambda: list(map(int, input().split()))
n, X = na()
x = na()
x.append(X)
x.sort()
l = []
for i in range(len(x)-1):
    l.append(x[i+1]-x[i])
ans = l[0]
for i in l[1:]:
    ans = math.gcd(ans, i)
print(ans)

Fixed submission:
from functools import reduce
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
def gcd_list(numbers):
    return reduce(gcd, numbers)
na = lambda: list(map(int, input().split()))
n, X = na()
x = na()
x.append(X)
x.sort()
l = []
for i in range(len(x)-1):
    l.append(x[i+1]-x[i])
print(gcd_list(l))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy
ans = 0
n, m = map(int, input().split())
a = numpy.cumsum([0] + [int(i) for i in input().split()])
for i in range(n):
    for j in range(i+1):
        if (a[i+1] - a[j]) % m == 0:
            ans += 1
print(ans)

Fixed submission:
import numpy
na = lambda: list(map(int, input().split()))

n, m = na()
a = list(map(lambda x: x%m, list(numpy.cumsum([0] + na()))))

def count(n):
    return n*(n-1)//2

dic = dict()
ans = 0
for i in a:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

ans = 0
for i in dic.values():
    ans += count(i)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]
a.sort()
print(a[-1] - a[0])

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
print(a[-1] - a[0])

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]
a.sort()
print(a[-1] - a[0])

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
print(a[-1] - a[0])

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]
a.sort()
print(a[-1] - a[0])

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
print(a[-1] - a[0])
Buggy python submission (verdict: Runtime Error):
from collections import counter
n = int(input())
a = [int(i) for i in input().split()]
output = 0
b = [abs(elem - i) for i, elem in enumerate(a, 1)]
c = counter(b)
d = c.most_common()

surume = 0
if len(d) == 1:
    surume = d[0][0]
else:
    if d[0][1] == d[1][1]:
        surume = 0
    else:
        surume = d[0][0]
e = [abs(abs(elem - i) - abs(surume)) for i, elem in enumerate(a, 1)]
print(sum(e))

Fixed submission:
import math

n = int(input())
a = [int(i) for i in input().split()]
b = [elem - i for i, elem in enumerate(a, 1)]
b.sort()
center = b[math.floor(len(b) / 2)]
c = [abs(i - center) for i in b]
print(sum(c))
Buggy python submission (verdict: Runtime Error):
import math
n, k = map(int, input().split())
a = input()
print(math.celi(n-1/k-1))

Fixed submission:
import math
n, k = map(int, input().split())
a = input()
print(math.ceil((n-1)/(k-1)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
cnt_l = []
for i in range(n):
  cnt = 0
  cnt += s[:i].count("W")
  cnt += s[i+1:].count("E")
  cnt_l.append(cnt) 
print(min(cnt_l))

Fixed submission:
import numpy
n = int(input())
s = input()
Ws = [0] + [1 if i == "W" else 0 for i in s]
Ws_sum = list(numpy.cumsum(Ws))
cnt_l = []
for i in range(n):
    cnt_l.append(Ws_sum[i]+n-i-1-Ws_sum[-1]+Ws_sum[i+1])
print(min(cnt_l))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
cnt_l = []
for i in range(n):
  cnt = 0
  cnt += s[:i].count("W")
  cnt += s[i+1:].count("E")
  cnt_l.append(cnt) 
print(min(cnt_l))

Fixed submission:
import numpy
n = int(input())
s = input()
Ws = [0] + [1 if i == "W" else 0 for i in s]
Ws_sum = list(numpy.cumsum(Ws))
cnt_l = []
for i in range(n):
    cnt_l.append(Ws_sum[i]+n-i-1-Ws_sum[-1]+Ws_sum[i+1])
print(min(cnt_l))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
cnt_l = []
for i in range(n):
  cnt = 0
  if i != 0:
    for j in s[:i]:
      if j == "W":
        cnt += 1  
  if i != n - 1:
    for k in s[i+1:]:
      if k == "E":
        cnt += 1
  cnt_l.append(cnt) 
print(min(cnt_l))

Fixed submission:
import numpy
n = int(input())
s = input()
Ws = [0] + [1 if i == "W" else 0 for i in s]
Ws_sum = list(numpy.cumsum(Ws))
cnt_l = []
for i in range(n):
    cnt_l.append(Ws_sum[i]+n-i-1-Ws_sum[-1]+Ws_sum[i+1])
print(min(cnt_l))
Buggy python submission (verdict: Runtime Error):
x = int(input())
a = []
for i in range(2, x+1):
    for j in range(2, x+1):
        b = i ** j
        a.append(b if b <= x else 0)
print(max(a))

Fixed submission:
x = int(input())
a = [1]
for i in range(2, x+1):
    cnt = 2
    while i ** cnt <= x:
        a.append(i ** cnt)
        cnt += 1
print(max(a))
Buggy python submission (verdict: Time Limit Exceeded):
# 部分点解
s = input()
k = int(input())
n = len(s)
subs = []
for i in range(n):
    for j in range(n-i):
        subs.append(s[i:i+j+1])
print(sorted(set(subs))[k-1])

Fixed submission:
s = input()
k = int(input())
n = len(s)
subs = []
for i in range(n):
    for j in range(min(5, n-i)):
        subs.append(s[i:i+j+1])
print(sorted(set(subs))[k-1])
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
if b - a + 1 <= k:
    for i in range(a, b+1):
        print(i):
else:
    for i in range(a, a+k-1):
        print(i)
    for i in range(b-k+1, b):
        print(i)

Fixed submission:
a, b, k = map(int, input().split())
for i in range(a, min(b+1, a+k)):
    print(i)
for i in range(max(b-k+1, a+k), b+1):
    print(i)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
c = list(range(a, b+1))
if len(c) < 2*k:
    for i in c:
        print(i)
else:
    for i in c[:k] + c[-k:]:
        print(i)

Fixed submission:
a, b, k = map(int, input().split())
for i in range(a, min(b+1, a+k)):
    print(i)
for i in range(max(b-k+1, a+k), b+1):
    print(i)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
c = list(range(a, b+1))
if len(c) <= 2*k:
    for i in c:
        print(i)
else:
    for i in c[:k] + c[-k:]:
        print(i)

Fixed submission:
a, b, k = map(int, input().split())
for i in range(a, min(b+1, a+k)):
    print(i)
for i in range(max(b-k+1, a+k), b+1):
    print(i)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
l = list(range(a, b+1))
for i in sorted(list(set(l[:k] + l[-k:]))):
    print(i)

Fixed submission:
a, b, k = map(int, input().split())
for i in range(a, min(b+1, a+k)):
    print(i)
for i in range(max(b-k+1, a+k), b+1):
    print(i)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
l = list(range(a, b+1))
for i in set(l[:k] + l[-k:]):
    print(i)

Fixed submission:
a, b, k = map(int, input().split())
for i in range(a, min(b+1, a+k)):
    print(i)
for i in range(max(b-k+1, a+k), b+1):
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for i in a:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
ans = 0
for i in set(a):
    n = a.count(i)
    if n < i:
        ans += n
    else:
        ans += n-i
print(ans)

Fixed submission:
import collections
n = int(input())
a = [int(i) for i in input().split()]
A = collections.Counter(a)
ans = 0
for key in A.keys():
    if key <= A[key]:
        ans += A[key] - key
    else:
        ans += A[key]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
ans = 0
for i in set(a):
    n = a.count(i)
    if n < i:
        ans += n
    else:
        ans += n-i
print(ans)

Fixed submission:
import collections
n = int(input())
a = [int(i) for i in input().split()]
A = collections.Counter(a)
ans = 0
for key in A.keys():
    if key <= A[key]:
        ans += A[key] - key
    else:
        ans += A[key]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
dic = collections.Counter(a)
#for i in a:
#    if i in dic:
#        dic[i] += 1
#    else:
#        dic[i] = 1
dic = sorted(dic.items(), key=lambda x: x[1])
while len(dic) > k:
    ans += dic[0][1]    
    del dic[0]
print(ans)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
dic = {}
for i in a:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
dic = sorted(dic.items(), key=lambda x: x[1])
#while len(dic) > k:
#    ans += dic[0][1]    
#    del dic[0]
for i in range(len(dic)-k):
    ans += dic[i][1]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
dic = {}
for i in a:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
dic = sorted(dic.items(), key=lambda x: x[1])
while len(dic) > k:
    ans += dic[0][1]    
    del dic[0]
print(ans)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
dic = {}
for i in a:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
dic = sorted(dic.items(), key=lambda x: x[1])
#while len(dic) > k:
#    ans += dic[0][1]    
#    del dic[0]
for i in range(len(dic)-k):
    ans += dic[i][1]
print(ans)

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split())
ans = 0
dic = {}
for i in a:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
dic = sorted(dic.items(), key=lambda x: x[1])
while len(dic) > k:
    ans += dic[0][1]    
    del dic[0]
print(ans)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
dic = {}
for i in a:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
dic = sorted(dic.items(), key=lambda x: x[1])
#while len(dic) > k:
#    ans += dic[0][1]    
#    del dic[0]
for i in range(len(dic)-k):
    ans += dic[i][1]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = [int(i) for i in input().split()]
ans = 0
dic = {}
for i in a:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
dic = sorted(dic.items(), key=lambda x: x[1])
while len(dic) > k:
    ans += dic[0][1]    
    del dic[0]
print(ans)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
dic = {}
for i in a:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
dic = sorted(dic.items(), key=lambda x: x[1])
#while len(dic) > k:
#    ans += dic[0][1]    
#    del dic[0]
for i in range(len(dic)-k):
    ans += dic[i][1]
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if len(set(n)) <= 2:
    print("Yes")
else:
    print("No")

Fixed submission:
n = list(map(int, input()))
n.sort()
if n[0] == n[1] == n[2]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
if aa[0] == b[2] and a[1] == b[1] and [2] == b[0]:
    print("YES")
else:
    print("NO")

Fixed submission:
a = input()
b = input()
if (a[0] == b[2]) and (a[1] == b[1]) and (a[2] == b[0]):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
k = int(input())
i = 1
while i < k:
    i *= 2
    n -= 1
while n != 0:
    i += k
    n -= 1
print(i)

Fixed submission:
n = int(input())
k = int(input())
num = 1
for i in range(n):
    if num + k < num * 2:
        num += k
    else:
        num *= 2
print(num)
Buggy python submission (verdict: Runtime Error):
a = map(int, input())
a.sort()
if a == b:
    print(c)
else:
    print(a)

Fixed submission:
a = input().split()
a.sort()
if a[0] == a[1]:
    print(a[2])
else:
    print(a[0])