Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from statistics import mode

n = int(input())
v = list(map(int, input.split()))
a = v[::1]
b = v[1::1]
slash = mode(a)
back_slash = mode(b)
a = [i for i in a if i != slash]
b = [j for j in b if j != back_slash]
print(len(a) + len(b))


Fixed submission:
from collections import Counter

n = int(input())
v = list(map(int, input().split()))
v_odd = v[0::2]
v_even = v[1::2]
ans = 0
c_odd = Counter(v_odd)
c_even = Counter(v_even)
v_o, c_o = zip(*c_odd.most_common())
v_e, c_e = zip(*c_even.most_common())
if len(c_o) == 1:
    odd1 = 0
else:
    odd1 = c_o[1]
if len(c_e) == 1:
    even1 = 0
else:
    even1 = c_e[1]
if not v_o[0] == v_e[0]:
    print(sum(c_o) - c_o[0] + sum(c_e) - c_e[0])
else:
    ans = min(sum(c_o) - c_o[0] + sum(c_e) - even1, sum(c_o) - odd1 + sum(c_e) - c_e[0])
    print(ans)

Buggy python submission (verdict: Runtime Error):
from statistics import mode

n = int(input())
v = list(map(int, input.split()))
a = v[::1]
b = v[1::1]
slash = mode(a)
back_slash = mode(b)
a = [i for i in a if i == slash]
b = [j for j in b if j == back_slash]
print(len(a) + len(b))


Fixed submission:
from collections import Counter

n = int(input())
v = list(map(int, input().split()))
v_odd = v[0::2]
v_even = v[1::2]
ans = 0
c_odd = Counter(v_odd)
c_even = Counter(v_even)
v_o, c_o = zip(*c_odd.most_common())
v_e, c_e = zip(*c_even.most_common())
if len(c_o) == 1:
    odd1 = 0
else:
    odd1 = c_o[1]
if len(c_e) == 1:
    even1 = 0
else:
    even1 = c_e[1]
if not v_o[0] == v_e[0]:
    print(sum(c_o) - c_o[0] + sum(c_e) - c_e[0])
else:
    ans = min(sum(c_o) - c_o[0] + sum(c_e) - even1, sum(c_o) - odd1 + sum(c_e) - c_e[0])
    print(ans)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd


def liner_search(n, l):
    for i in range(len(l)):
        if n < l[i]:
            return i
    return len(l)


N, X = map(int, input().split())
x = sorted(list(map(int, input().split())))
x.insert(liner_search(X, x), X)
sabun = [None] * N
for i in range(1, len(x)):
    sabun[i - 1] = x[i] - x[i - 1]
res = gcd(sabun[0], sabun[1])
for i in range(1, len(sabun)):
    res = gcd(res, sabun[i])
print(res)


Fixed submission:
from fractions import gcd


def liner_search(n, l):
    for i in range(len(l)):
        if n < l[i]:
            return i
    return len(l)


N, X = map(int, input().split())
x = sorted(list(map(int, input().split())))
x.insert(liner_search(X, x), X)
sabun = [None] * N
for i in range(1, len(x)):
    sabun[i - 1] = x[i] - x[i - 1]
res = gcd(0, sabun[0])
for i in range(1, len(sabun)):
    res = gcd(res, sabun[i])
print(res)

Buggy python submission (verdict: Runtime Error):
def liner_search(n, l):
    for i in range(len(l)):
        if n <= l[i]:
            return i


N, X = map(int, input().split())
x = sorted(list(map(int, input().split())))
x.insert(liner_search(X, x), X)
sabun = [None] * N
for i in range(1, len(x)):
    sabun[i - 1] = x[i] - x[i - 1]
print(sorted(sabun)[0])


Fixed submission:
from fractions import gcd


def liner_search(n, l):
    for i in range(len(l)):
        if n < l[i]:
            return i
    return len(l)


N, X = map(int, input().split())
x = sorted(list(map(int, input().split())))
x.insert(liner_search(X, x), X)
sabun = [None] * N
for i in range(1, len(x)):
    sabun[i - 1] = x[i] - x[i - 1]
res = gcd(0, sabun[0])
for i in range(1, len(sabun)):
    res = gcd(res, sabun[i])
print(res)
Buggy python submission (verdict: Runtime Error):
S = list(input())
K = int(input())
if not S[0] == "1":
    print(S[0])
else:
    print(S[1])


Fixed submission:
def searchInf(s, k):
    l = k if len(s) >= k else len(s)
    for i in range(l):
        if s[i] == "1":
            continue
        else:
            print(s[i])
            return 0
    print(1)
    return 0


S = list(input())
K = int(input())
searchInf(S, K)
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())
l = list(map(int, input().split()))
index = l.index(1)

ans = 0
if index != 0:
    p = index - K + 1
    ans += 1
    if p < 0:
        index = index + (-1 * p)
    elif p > 0:
        while p > 0:
            p = p - K + 1
            ans += 1
if index < (N - 1):
    ans += 1
    index = index + K - 1
    while index < (N - 1):
        index = index + K - 1
        ans += 1

print(ans)

Fixed submission:
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))

ans = 1
N = N - K
ans += ceil(N/(K-1))
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, x = map(int, input())
if a <= x <= a+b:
    ans = "YES"
else:
    ans = "NO"
print(ans)

Fixed submission:
a, b, x = map(int, input().split())
if a <= x <= a+b:
    ans = "YES"
else:
    ans = "NO"
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
a1 = 7
ai = 0
for i in range(K + 1):
  ai = a1 % K
  a1 = (a1 * 10 + 7)
  if ai == 0:
    break
else:
  i = -2 
print(i + 1)

Fixed submission:
K = int(input())
a1 = 7
ai = 0
for i in range(K + 1):
  if i == 0:
    ai = a1 % K
  else:
    ai = (ai * 10 + 7) % K
  if ai == 0:
    break
else:
    i = -2
print(i + 1)

Buggy python submission (verdict: Runtime Error):
K = int(input())
a1 = 7
ai = 0
for i in range(K + 1):
        ai = a1 % K
        a1 = (a1 * 10 + 7)
    if ai == 0:
        break
 
print(i + 1)

Fixed submission:
K = int(input())
a1 = 7
ai = 0
for i in range(K + 1):
  if i == 0:
    ai = a1 % K
  else:
    ai = (ai * 10 + 7) % K
  if ai == 0:
    break
else:
    i = -2
print(i + 1)
Buggy python submission (verdict: Runtime Error):
from decimal import *
A, B = map(float, input().split())
B = int(B * 100)
A = int(A)
ans = A * B
ans = // 10
ans = // 10
print(ans)

Fixed submission:
from decimal import Decimal
A,B = map(str, input().split())
A = int(A)
B = Decimal(B)
print(int(A * B))
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = []
def prime_factorize(n,a):
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

prime_factorize(N, a)
ans = 0
if len(a) >= 1:
    before = a[0]
    kosuu = 1
    for i in range(1, len(a)):
        tmp = a[i]
        if tmp == before:
            kosuu += 1
        else:
            ini = 1
            while kosuu - ini >= 0:
                kosuu = kosuu - ini
                ini += 1
                ans += 1
            before = tmp
            kosuu = 1
        ini = 1
    while kosuu - ini >= 0:
        kosuu = kosuu - ini
        ini += 1
        ans += 1


print(ans)

Fixed submission:
N = int(input())
a = []
def prime_factorize(n,a):
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

prime_factorize(N, a)
ans = 0
if len(a) > 1:
    before = a[0]
    kosuu = 1
    for i in range(1, len(a)):
        tmp = a[i]
        if tmp == before:
            kosuu += 1
        else:
            ini = 1
            while kosuu - ini >= 0:
                kosuu = kosuu - ini
                ini += 1
                ans += 1
            before = tmp
            kosuu = 1
        ini = 1
    while kosuu - ini >= 0:
        kosuu = kosuu - ini
        ini += 1
        ans += 1
if len(a) == 1:
    ans = 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))
kosuu = 1
tadoru = [1]
pin = 1
tmp = 1
while pin == 1:
    tmp = A[tmp-1]
    if tmp == 1:
        break
    else:
        tadoru.append(tmp)
        kosuu += 1
mod = K % kosuu
print(tadoru[mod])

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
toujou = [0] * N
toujou[0] = 1
kosuu = 1
tadoru = [1]
pin = 1
tmp = 1
while pin == 1:
    tmp = A[tmp-1]
    toujou[tmp-1] += 1
    if toujou[tmp - 1] == 2:
            break
    else:
        tadoru.append(tmp)
        kosuu += 1

loop_start = tadoru.index(tmp)
loop = kosuu - loop_start
if K < kosuu:
    print(tadoru[K])
else:
    K = K - loop_start
    a = K % loop
    print(tadoru[loop_start + a])
Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
i = 0
while True:
  tmp1 = pow(X + pow(i, 5), 1/5)
  if tmp1.is_integer():
    print(int(tmp1), i)
    break
  tmp2 = pow(X - pow(i, 5), 1/5)
  if tmp2 != complex:
    if tmp2.is_integer():
      print(int(tmp2), -i)
      break
  else:
    i += 1

Fixed submission:
X = int(input())
pin = 0
for i in range(-120, 120):
    if pin == 1:
        break
    for j in range(-120, 120):
        if pow(i, 5) - pow(j, 5) == X :
            pin =1
            print(i, j)
            break

Buggy python submission (verdict: Runtime Error):
X = int(input())
i = 0
while True:
  tmp1 = pow(X + pow(i, 5), 1/5)
  if tmp1.is_integer():
    print(int(tmp1), i)
    break
  tmp2 = pow(X - pow(i, 5), 1/5)
  if tmp2.is_integer():
    print(int(tmp2), -i)
    break
  else:
    i += 1
          

Fixed submission:
X = int(input())
pin = 0
for i in range(-120, 120):
    if pin == 1:
        break
    for j in range(-120, 120):
        if pow(i, 5) - pow(j, 5) == X :
            pin =1
            print(i, j)
            break
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = 0
plus_lis = [A[i] + i for i in range(N)]
minus_lis = [k - A[k] for k in range(N)]
plus_lis.sort()
minus_lis.sort()

ans_lis = [0] * 10 ** 6
for x in plus_lis:
    if x < 10 ** 6:
        ans_lis[x-1] += 1
for y in minus_lis:
    if y > 0:
        ans += ans_lis[x-1]
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = 0
plus_lis = [A[i] + i for i in range(N)]
minus_lis = [k - A[k] for k in range(N)]

ans_lis = [0] * 10 ** 6
for x in plus_lis:
    if x < 10 ** 6:
        ans_lis[x-1] += 1
for y in minus_lis:
    if y > 0:
        ans += ans_lis[y-1]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
count = 0
for i in range(N-1):
    for k in range(A[i] + i, N):
        if i + A[i] == k - A[k] :
            count += 1
print(count)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = 0
plus_lis = [A[i] + i for i in range(N)]
minus_lis = [k - A[k] for k in range(N)]

ans_lis = [0] * 10 ** 6
for x in plus_lis:
    if x < 10 ** 6:
        ans_lis[x-1] += 1
for y in minus_lis:
    if y > 0:
        ans += ans_lis[y-1]
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
R, G, B, N = map(int, input().split())
ans = 0
cr = math.ceil(N/R)
cg = math.ceil(N/G)
cb = math.ceil(N/B)
for i in range(cr + 1):
    for j in range(cg + 1):
        tmp =  i * R + j * G
        if N - tmp >= 0 and (N - tmp) % B == 0:
           ans += 1
        elif N - tmp < 0:
          break
print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(N-1):
  ans[A[i] - 1] += 1
for i in range(N):
  print(ans[i])

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(N):
  ans[A[i] - 1] += 1
for i in range(N):
  print(ans[i])

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(N-1):
  ans[A[i] - 1] += 1
for i in range(N):
  print(ans[i])
Buggy python submission (verdict: Runtime Error):
import math
K = int(input())
ans = 0
for a in range(1, K+1):
  for b in range(1, a+1):
    for c in range(1, b+1):
      if a != b and b != c and c != a:
        ans += math.gcd(a,b,c) * 6
      elif a == b and b == c:
        ans += math.gcd(a,b,c)
      else:
        ans += math.gcd(a,b,c) * 3
print(ans)

Fixed submission:
import math
K = int(input())
ans = 0
for a in range(1, K+1):
  for b in range(1, a+1):
    for c in range(1, b+1):
      if a != b and b != c and c != a:
        ans += math.gcd(math.gcd(a,b),c) * 6
      elif a == b and b == c:
        ans += math.gcd(math.gcd(a,b),c)
      else:
        ans += math.gcd(math.gcd(a,b),c) * 3
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
r = []
g = []
b = []
for i in range(N):
  if S[i] == 'R':
    r.append(i)
  elif S[i] == 'G':
    g.append(i)
  else:
    b.append(i)
ans = len(r) * len(g) * len(b)
for a in r:
  for k in g:
    for l in b:
      ze = abs(a-k)
      m = abs(k-l)
      n = abs(l-a)
      if ze == m or m == n or n == ze:
        ans -= 1
print(ans)
  

Fixed submission:
N = int(input())
S = input()
r = []
g = []
b = []
for i in range(N):
  if S[i] == 'R':
    r.append(i)
  elif S[i] == 'G':
    g.append(i)
  else:
    b.append(i)
ans = len(r) * len(g) * len(b)
sub = 0
for i in range(1,N//2+1):
  if 2 * i == N:
    break
  for k in range(N):
    if S[sub] != S[sub + i] and S[sub + i] != S[sub + 2 * i] and S[sub + 2 * i] != S[sub]:
      ans -= 1
    if sub + 2 * i + 1< N:
      sub += 1
    else:
      sub = 0
      break
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
K = int(input())
lis = [1,2,3,4,5,6,7,8,9]
lis = np.array(lis)
  
if K < 10:
  print(K)
    
else:
  count = 9
  sub_count = 0
  while count < K:
    tmp = lis[sub_count]
    if tmp % 10 == 9:
      count += 2
      lis.append(tmp * 10  + 8)
      lis.append(tmp + 9)
      sub_count += 1
    elif  tmp % 10== 0:
      count += 2
      lis.append(tmp * 10 + 0)
      lis.append(tmp * 10 + 1)
      sub_count += 1
    else:
      count += 3
      for i in range(-1,2):
        lis.append(tmp * 10 + tmp % 10 + i)
      sub_count += 1
  print(lis[count-1])


Fixed submission:
x, y, z = map(int, input().split())
print(z),
print(x),
print(y),
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
mi = 10**6
for i in range(M):
  x, y, c = map(int, input().split())
  tmp = A[x-1] + B[y-1] - c
  if mi > tmp:
    mi = tmp
A.sort()
B.sort()
tmp = A[0] + B[0]
if mi > tmp:
  mi = tmp
print(mi)

Fixed submission:
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
mi = 10**6
for i in range(M):
  x, y, c = map(int, input().split())
  tmp = a[x-1] + b[y-1] - c
  if mi > tmp:
    mi = tmp
a.sort()
b.sort()
tmp = a[0] + b[0]
if mi > tmp:
  mi = tmp
print(mi)
Buggy python submission (verdict: Runtime Error):
import sys
S = input()
Q = int(input())
pin = 0
for i in range(Q):
  t = list(sys.stdin.readline().split())
  if int(t[0]) == 1:
    if pin == 1:
      pin = 0
    else:
      pin = 1
  else:
    if int(t[1]) % 2 == pin :
      S = S + t[2]
    else:
      S = t[2] + S
if pin == 1:
  S = S[::-1]
print(S)


Fixed submission:
S = input()
if S[0] == S[1] and S[1] == S[2] :
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
S = input()
Q = int(input())
pin = 0
for i in range(Q):
  t = list(sys.stdin.readline().split())
  if int(t[0]) == 1:
    pin += 1
  else:
    if int(t[1]) % 2 == pin % 2 :
      S = S + t[2]
    else:
      S = t[2] + S
if pin % 2 == 1:
  S = S[::-1]
print(S)


Fixed submission:
import sys
S = input()
Q = int(input())
pin = 0
left = ''
right = ''
for i in range(Q):
  t = list(sys.stdin.readline().split())
  if int(t[0]) == 1:
    pin += 1
  else:
    if int(t[1]) % 2 == pin % 2 :
      right = right + t[2]
    else:
      left = t[2] + left
S = left + S + right
if pin % 2 == 1:
  S = S[::-1]
print(S)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
S = input()
Q = int(input())
pin = 0
for i in range(Q):
  t = list(sys.stdin.readline().split())
  if int(t[0]) == 1:
    if pin == 1:
      pin = 0
    else:
      pin = 1
  else:
    if int(t[1]) % 2 == pin :
      S = S + t[2]
    else:
      S = t[2] + S
if pin == 1:
  S = S[::-1]
print(S)


Fixed submission:
import sys
S = input()
Q = int(input())
pin = 0
left = ''
right = ''
for i in range(Q):
  t = list(sys.stdin.readline().split())
  if int(t[0]) == 1:
    pin += 1
  else:
    if int(t[1]) % 2 == pin % 2 :
      right = right + t[2]
    else:
      left = t[2] + left
S = left + S + right
if pin % 2 == 1:
  S = S[::-1]
print(S)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
pin = 0
for i in range(Q):
  t = list(input().split())
  if int(t[0]) == 1:
    if pin == 1:
      pin = 0
    else:
      pin = 1
  else:
    if int(t[1]) % 2 == pin :
      S = S + t[2]
    else:
      S = t[2] + S
if pin == 1:
  S = S[::-1]
print(S)

Fixed submission:
import sys
S = input()
Q = int(input())
pin = 0
left = ''
right = ''
for i in range(Q):
  t = list(sys.stdin.readline().split())
  if int(t[0]) == 1:
    pin += 1
  else:
    if int(t[1]) % 2 == pin % 2 :
      right = right + t[2]
    else:
      left = t[2] + left
S = left + S + right
if pin % 2 == 1:
  S = S[::-1]
print(S)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]
S.sort()
maxi = 0
ans = []
total_count = 0
while total_count != N:
  tmp = S.count(S[total_count])
  total_count += tmp
  if maxi < tmp:
    maxi = tmp
    ans.clear()
    ans.append(S[total_count])
  elif maxi == tmp:
    ans.append(S[total_count])
for i in range(len(ans)):
  print(ans[i])
    
  

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
S.sort()
maxi = 0
tmp = 1
ans = []
for i in range(N-1):
  if S[i] == S[i+1]:
    tmp += 1
  else:
    if tmp > maxi:
      maxi = tmp
      ans.clear()
      ans.append(S[i])
    elif tmp == maxi:
      ans.append(S[i])
    tmp = 1
  if i == N-2:
      if S[i] == S[i+1]:
        if tmp > maxi:
          maxi = tmp
          ans.clear()
          ans.append(S[i])
        elif tmp == maxi:
          ans.append(S[i])
      else:
        if maxi == 1:
          ans.append(S[N-1])
for i in range(len(ans)):
  print(ans[i])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 'YES'
for i in range(N-1):
  if a[i] == a[i+1]:
    ans = 'NO'
    break
print(ans)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = "YES"
for i in range(1,N):
    if A[i-1] == A[i]:
        ans = "NO"
        break
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 'YES'
for i in range(n-1):
  if a[i] == a[i+1]:
    ans = 'NO'
    break
print(ans)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = "YES"
for i in range(1,N):
    if A[i-1] == A[i]:
        ans = "NO"
        break
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
def yabaton(A):
  for i in range(0,n-1):
    for j in range(i+1,n):
      if A[i] == A[j]:
        return 'NO'
  return 'YES'
yabaton(A)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = "YES"
for i in range(1,N):
    if A[i-1] == A[i]:
        ans = "NO"
        break
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
for i in range(0,n-1):
  for j in range(i+1,n):
    if A[i] == A[j]:
      return 'NO'
return 'YES'


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = "YES"
for i in range(1,N):
    if A[i-1] == A[i]:
        ans = "NO"
        break
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
for i in range(0,n-1):
  for j in range(i+1,n):
    if A[i] != A[j]:
      return 'NO'
return 'YES'

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = "YES"
for i in range(1,N):
    if A[i-1] == A[i]:
        ans = "NO"
        break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
p = list(map(int,input().split()))
total = 0
if N != K:
  for i in range(N-K+1):
    tmp = sum(p[i:i+K])
    if tmp > total:
      total = tmp
else:
  total = sum(p)
total = K + total
print(total/2)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
total = sum(p[0:K])
tmp = total
if N != K:
  for i in range(N-K):
    tmp = tmp - p[i] + p[i+K]
    if tmp > total:
      total = tmp
else:
  total = sum(p)
total = K + total
print(total/2)
Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())
H = list(map(int,input().split()))
if K >= N:
  print(0)
else:
  H.sort
  print(sum(H[0:N-K])

Fixed submission:
N, K = map(int,input().split())
H = list(map(int,input().split()))
if K >= N:
  print(0)
else:
  H.sort()
  print(sum(H[0:N-K]))
Buggy python submission (verdict: Runtime Error):
H = int(input())
total = 1
while H > 1:
  H = H // 2
  if H != 0:
    total += 1
number = 0
for i in range(tatal):
  number += 2 ** i
print(number)


Fixed submission:
H = int(input())
def re(a):
  if a == 1:
    return 1
  return 2 * re(a//2) + 1
print(re(H))

Buggy python submission (verdict: Runtime Error):
H = int(input())
total = 1
while H != 1:
  H = H // 2
  total += 1
for i in range(tatal):
  number += 2 ** i
print(number)

Fixed submission:
H = int(input())
def re(a):
  if a == 1:
    return 1
  return 2 * re(a//2) + 1
print(re(H))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
count = 1
for i in range(1, N):
  if P[i] <= min(P[0:i]):
    count += 1
print(count)


Fixed submission:
N = int(input())
P = list(map(int, input().split()))
count = 1
tmp_min = P[0]
for i in range(1, N):
  if P[i] <= tmp_min:
    count += 1
    tmp_min = P[i]
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
P = list(map(int, input().split()))
count = 1
for i in range(1, N):
  if P[i] <= min(P[0,i]):
    count += 1
print(count)


Fixed submission:
N = int(input())
P = list(map(int, input().split()))
count = 1
tmp_min = P[0]
for i in range(1, N):
  if P[i] <= tmp_min:
    count += 1
    tmp_min = P[i]
print(count)