Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = 0
    m0 = 10**9+7
    for i in range(0,N-1):
        sumtemp = 0
        for j in range(i+1,N):
            sumtemp = (sumtemp+A[j]) % m0
        ans = (ans + A[i] * sumtemp) % m0
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = 0
    m0 = 10**9+7
    Ar = [0]*N
    sum0 = 0
    for i in reversed(range(N)):
        sum0 = (sum0 + A[i]) % m0
        Ar[i] = sum0

    for i in range(N-1):
        ans = (ans + A[i] * Ar[i+1]) % m0
    print(ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
ans = 0
m0 = 10**9+7
for i in range(0,N-1):
    sumtemp = 0
    for j in range(i+1,N):
        sumtemp = (sumtemp+A[j]) % m0
    ans = (ans + A[i] * sumtemp) % m0
print(ans)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = 0
    m0 = 10**9+7
    Ar = [0]*N
    sum0 = 0
    for i in reversed(range(N)):
        sum0 = (sum0 + A[i]) % m0
        Ar[i] = sum0

    for i in range(N-1):
        ans = (ans + A[i] * Ar[i+1]) % m0
    print(ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
ans = 0
m0 = 10**9+7
for i in range(0,N-1):
    sumtemp = 0
    for j in range(i+1,N):
        sumtemp += A[j]
    ans = (ans + A[i] * sumtemp) % m0
print(ans)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = 0
    m0 = 10**9+7
    Ar = [0]*N
    sum0 = 0
    for i in reversed(range(N)):
        sum0 = (sum0 + A[i]) % m0
        Ar[i] = sum0

    for i in range(N-1):
        ans = (ans + A[i] * Ar[i+1]) % m0
    print(ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
ans = 0
m0 = 10**9+7
for i in range(0,N-1):
    for j in range(i+1,N):
        ans = (ans + A[i]*A[j]) % m0
print(ans)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = 0
    m0 = 10**9+7
    Ar = [0]*N
    sum0 = 0
    for i in reversed(range(N)):
        sum0 = (sum0 + A[i]) % m0
        Ar[i] = sum0

    for i in range(N-1):
        ans = (ans + A[i] * Ar[i+1]) % m0
    print(ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
ans = 0
m0 = 10**9+7
for i in range(0,N-1):
    for j in range(i+1,N):
        ans = (ans + A[i]*A[j]) % m0
print(ans)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = 0
    m0 = 10**9+7
    Ar = [0]*N
    sum0 = 0
    for i in reversed(range(N)):
        sum0 = (sum0 + A[i]) % m0
        Ar[i] = sum0

    for i in range(N-1):
        ans = (ans + A[i] * Ar[i+1]) % m0
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n0 = int(1e5)+1
x = [0]*n0

n = int(input())
a0 = list(map(int,input().split()))
q = int(input())
bcs = []
for i in range(q):
    bcs.append(list(map(int,input().split())))

for a in a0:
    x[a] += 1

for bc in bcs:
    x[bc[1]] += x[bc[0]]
    x[bc[0]] = 0
    sum0 = 0
    for i in range(n0):
        sum0 += i*x[i]
    print(sum0)

Fixed submission:
n0 = int(1e5)+1
x = [0]*n0

n = int(input())
a0 = list(map(int,input().split()))
q = int(input())
bcs = []
for i in range(q):
    bcs.append(list(map(int,input().split())))

for a in a0:
    x[a] += 1
sum0 = sum(a0)

for bc in bcs:
    sum0 = sum0 + bc[1]*x[bc[0]] - bc[0]*x[bc[0]]
    x[bc[1]] += x[bc[0]]
    x[bc[0]] = 0
    print(sum0)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
q = int(input())
bcs = []
for i in range(q):
    bcs.append(list(map(int,input().split())))
for bc in bcs:
    a = [bc[1] if i == bc[0] else i for i in a]
    print(sum(a))

Fixed submission:
n0 = int(1e5)+1
x = [0]*n0

n = int(input())
a0 = list(map(int,input().split()))
q = int(input())
bcs = []
for i in range(q):
    bcs.append(list(map(int,input().split())))

for a in a0:
    x[a] += 1
sum0 = sum(a0)

for bc in bcs:
    sum0 = sum0 + bc[1]*x[bc[0]] - bc[0]*x[bc[0]]
    x[bc[1]] += x[bc[0]]
    x[bc[0]] = 0
    print(sum0)
Buggy python submission (verdict: Runtime Error):
from functools import lru_cache

@lru_cache(maxsize=None)
def fib(n):
    if n < 2:
        return n
    else:
        return fib(n - 2) + fib(n - 1)

n,m = map(int,input().split())
a = [int(input()) for _ in range(m)]

for i in range(len(a)-1):
    if a[i+1] == a[i]+1:
        print(0)
        exit()
x = []
temp=0
for i in range(m):
    x.append(a[i]-temp-1)
    temp = a[i]+1
x.append(n-temp)

temp = 1
div = 1000000007

for i in x:
    temp = (temp*fib(i+1))%div

print(temp)


Fixed submission:
def Fib(n):
    a, b = 1, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b

n,m = map(int,input().split())
a = [int(input()) for _ in range(m)]

for i in range(len(a)-1):
    if a[i+1] == a[i]+1:
        print(0)
        exit()
x = []
temp=0
for i in range(m):
    x.append(a[i]-temp-1)
    temp = a[i]+1
x.append(n-temp)

temp = 1
div = 1000000007

for i in x:
    temp = (temp*Fib(i+1))%div

print(temp)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = [int(input()) for _ in range(m)]
for i in range(len(a)-1):
    if a[i+1] == a[i]+1:
        print(0)
        exit()
x = [0]*(n+1)
x[0]=1
div = 1000000007

if not 1 in a:
    x[1]=1

for i in range(2,n+1):
    if not i in a:
        x[i] = (x[i-2] + x[i-1]) % div
print(x[n])

Fixed submission:
def Fib(n):
    a, b = 1, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b

n,m = map(int,input().split())
a = [int(input()) for _ in range(m)]

for i in range(len(a)-1):
    if a[i+1] == a[i]+1:
        print(0)
        exit()
x = []
temp=0
for i in range(m):
    x.append(a[i]-temp-1)
    temp = a[i]+1
x.append(n-temp)

temp = 1
div = 1000000007

for i in x:
    temp = (temp*Fib(i+1))%div

print(temp)
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
if s[0] != "1":
    print(s[0])
elif s[:k] == "1"*k:
    print("1")
else:
    print(s.replace("1","")[0])

Fixed submission:
s = input()
k = int(input())
if s[0] != "1":
    print(s[0])
elif s[:k].replace("1","")=="":
    print("1")
else:
    print(s.replace("1","")[0])
Buggy python submission (verdict: Runtime Error):
a.sort()
count = 0
temp = a[0]
tempcount = 1
for i in range(1,n):
    if a[i]==temp:
        tempcount += 1
    else:
        if not tempcount%2 == 0:
            count += 1
        tempcount = 1
    temp = a[i]
    #print(i,tempcount)
if tempcount%2 == 1:
    count += 1
print(count)

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]

a.sort()
count = 0
temp = a[0]
tempcount = 1
for i in range(1,n):
    if a[i]==temp:
        tempcount += 1
    else:
        if not tempcount%2 == 0:
            count += 1
        tempcount = 1
    temp = a[i]
    #print(i,tempcount)
if tempcount%2 == 1:
    count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n = int(input())
s = [int(input()) for s in range(n)]
max0 = 0
for i in range(n):
    s2 = list(itertools.permutations(s, i+1))
    for comb in s2:
        tmax =sum(comb)
        if tmax%10 != 0: 
            max0 = max(max0,sum(comb))
print(max0)

Fixed submission:
n = int(input())
s = [int(input()) for s in range(n)]
s1 = []
sum0 = 0
for i in s:
    if i%10 == 0:
        sum0 += i
    else:
        s1.append(i)

if len(s1) == 0:
    print(0)
else:
    sum1 = sum(s1)
    if sum1%10 != 0:
        print(sum0 + sum1)
    else:
        print(sum0 + sum1 - min(s1))
Buggy python submission (verdict: Runtime Error):
print("ACL" * int(input())

Fixed submission:
print("ACL" * int(input()))
Buggy python submission (verdict: Runtime Error):
d,t,s = map(int,input().split())
if d <= s * t:
    print("Yes")
else:
    print("No")

Fixed submission:
s = input()
t = input()
ls = []
for i in range(len(s) - len(t) + 1):
    ls.append(s[i:i+len(t)])
now = 0
minimum = len(t)
for i in range(len(ls)):
    now = 0
    for j in range(len(t)):
        if t[j] == ls[i][j]:
            now += 1
    if len(t) - now < minimum:
        minimum = len(t) - now
print(minimum)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
A = list(map(int,input().split()))
ls = []
now = A[0]
for i in range(1,N):
    ls.append(math.gcd(now,A[i]))
    now = math.gcd(now,A[i])
if ls.count(1) == N-1:
    print("pairwise coprime")
else:
    if ls[N-1] == 1:
        print("setwise coprime")
    else:
        print("not coprime")

Fixed submission:
import math
import sys
n = int(input())
a = list(map(int, input().split()))

ga = a[0]
for i in range(n):
  ga = math.gcd(ga, a[i])

if ga != 1:
  print("not coprime")
  sys.exit()

m = 1000000
b = [0]*(m+1)
#高速素因数分解
for i in range(2, m):
  if b[i] != 0:
    continue
  j = 1
  while True:
    t = i * j
    if t > m:
      break
    if b[t] == 0:
      b[t] = i
    j += 1
d = {}
for i in a:
  p = i
  #pが1になるまで重複素因子があるかを調べる
  while p != 1:
    if p in d:
      print("setwise coprime")
      sys.exit()
    d[p] = 1
    p = int(p/b[p])
#pairwise coprimeではない
print("pairwise coprime")
Buggy python submission (verdict: Runtime Error):
N = input()
ans = 0
for i in range(len(N)):
  ans += N[i]
print("Yes") if ans%9 == 0 else print("No")

Fixed submission:
print("Yes") if int(input())%9 == 0 else print("No")
Buggy python submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
now = b[0]
ans = 0
for i in range(len(a)+len(b)):
    if now >= k:
        break
    else:
        if len(a) == 0:
            ans += 1
            now += b[0]
            b.remove(b[0])
        elif len(b) == 0:
            ans += 1
            now += a[0]
            a.remove(a[0])
        else:
            if a[0] < now:
                ans += 1
                now += a[0]
                a.remove(a[0])
            else:
                now = b[1]
                ans += 1
                now += b[0]
                b.remove(b[0])
print(ans)


Fixed submission:
a = int(input())
print(a+a**2+a**3)

Buggy python submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
now = b[0]
ans = 0
for i in range(len(a)+len(b)):
    if now >= k:
        break
    else:
        if len(a) == 0:
            ans += 1
            now += b[0]
            b.remove(b[0])
        elif len(b) == 0:
            ans += 1
            now += a[0]
            a.remove(a[0])
        else:
            if a[0] < now:
                ans += 1
                now += a[0]
                a.remove(a[0])
            else:
                now = b[1]
                ans += 1
                now += b[0]
                b.remove(b[0])
print(ans)


Fixed submission:
a = int(input())
print(a+a**2+a**3)

Buggy python submission (verdict: Runtime Error):
print(a = int(input()) a+a**2+a**3)

Fixed submission:
a = int(input())
print(a+a**2+a**3)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
ans = 0
for i in range(K):
  ans += p[i]
print(ans)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[0:k]))
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
a = (4x-y)/2
b = (-2x+y)/2
if a%1 == 0 and 0 <= aand b%1 == 0 and 0 <=b:
  print("Yes")
else:
  print("No")

Fixed submission:
x,y = map(int,input().split())
flag = 0
for i in range(0,x+1):
    #鶴だけ固定
    now = y - 2 * i
    #亀の足の数 = y - 2×鶴の足の数
    if now % 4 == 0:
        #足の数が4で割り切れたら
        if now //4 == (x - i):
            #足の数の商が (x - i)と一致したら
            print("Yes")
            flag += 1
            break
if flag == 0:
    print("No")

Buggy python submission (verdict: Runtime Error):
x,y = int(input())
flag = 0
for i in range(x+1):
  if (y - 2*i)%4 == 0 and (y -  2 * i)//4 == x - i:
    flag += 1
    print("Yes")
    break
if flag == 0:
  print("No")

Fixed submission:
x,y = map(int,input().split())
flag = 0
for i in range(0,x+1):
    #鶴だけ固定
    now = y - 2 * i
    #亀の足の数 = y - 2×鶴の足の数
    if now % 4 == 0:
        #足の数が4で割り切れたら
        if now //4 == (x - i):
            #足の数の商が (x - i)と一致したら
            print("Yes")
            flag += 1
            break
if flag == 0:
    print("No")
Buggy python submission (verdict: Runtime Error):
b,w = map(int,input().split())
t = int(input())
if v <= w:
    print("NO")
else:
    dis = abs(b-a)
    sp = abs(v-w)
    if 0 < dis / sp <= t:
        print("YES")
    else:
        print("NO")

Fixed submission:
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
if v <= w:
    print("NO")
else:
    dis = abs(b-a)
    sp = abs(v-w)
    if 0 < dis/sp <= t:
        print("YES")
    else:
        print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
ans = a[0]
for i in range(1,N):
    ans *= a[i]
if ans > 10**18:
    print(-1)
else:
    print(ans)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort()
A.reverse()
if A.count(0) > 0:
    print(0)
else:
    ans = A[0]
    flag = 0
    for i in range(1,N):
        ans *= A[i]
        if ans > 10**18:
            flag += 1
            print(-1)
            break
    if flag == 0:
        print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
ans = a[0]
for i in range(1,N):
    ans *= a[i]
if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort()
A.reverse()
if A.count(0) > 0:
    print(0)
else:
    ans = A[0]
    flag = 0
    for i in range(1,N):
        ans *= A[i]
        if ans > 10**18:
            flag += 1
            print(-1)
            break
    if flag == 0:
        print(ans)
Buggy python submission (verdict: Runtime Error):
from decimal import Decimal
s = map(float,input().split())
S = Decimal(A)*Decimal(B)
print(S//1)


Fixed submission:
from decimal import Decimal
import math

a,b=map(Decimal,input().split())

print(math.floor(a*b))
Buggy python submission (verdict: Runtime Error):
#Solver:Rute
a,b,c,k = map(int,input().split())
if k<=a:
  print(k)
elif a<k<=a+b:
  print(k)
else:
  #-1のカードの枚数超過 (k-(a+b))枚
  print(a-(k-(a+b)))


Fixed submission:
#Solver:Rute
S = input()
T = input()
if T[0:len(S)] == S:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
#Solver:Rute
a,b,c,k = map(int,input().split())
if k<=a:
  print(k)
elif a<k<=a+b:
  print(a)
else:
  #-1のカードの枚数超過 (k-(a+b))枚
  print(a-(k-(a+b)))


Fixed submission:
#Solver:Rute
S = input()
T = input()
if T[0:len(S)] == S:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import math
def equation(a,b,n):
  return math.floor((a*n)/b)-a*math.floor(n/b)
d,e,f = map(int,input().split())
K = min(e-1,f)
print(equation(K))


Fixed submission:
K = int(input())
a,b = map(int,input().split())
flag = 0
for i in range(a,b+1):
    if i%K == 0:
        flag += 1
        print("OK")
        break
if flag == 0:
    print("NG")
Buggy python submission (verdict: Runtime Error):
import math
def equation(a,b,n):
  return math.floor((a*x)/b)-A*math.floor(x/B)
d,e,f = map(int,input().split())
X = equation(d,e,f)
Y = equation(d,e,e-1)
print(max(X,Y))

Fixed submission:
import math
def equation(a,b,n):
  return math.floor((a*n)/b)-a*math.floor(n/b)
d,e,f = map(int,input().split())
K = min(e-1,f)
print(equation(d,e,K))

Buggy python submission (verdict: Runtime Error):
A,B,N = map(int,input().split())
x = math.gcd(N,B)
K = math.floor(N/B)
if K == 0:
    print(math.floor(A*N/B)-A*math.floor(N/B))
else:
    alpha = B*(K+1)-1
    if alpha > N:
        alpha = N
    print(math.floor(alpha/B)-A*math.floor(alpha/B))

Fixed submission:
import math
def equation(a,b,n):
  return math.floor((a*n)/b)-a*math.floor(n/b)
d,e,f = map(int,input().split())
K = min(e-1,f)
print(equation(d,e,K))
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
for i in range(10**2):
  c -= b
  if c <= 0:
    print("Yes")
    break
  a -= d
  if a <= 0:
    print("No")
    break


Fixed submission:
a,b = map(int,input().split())
if b>=a:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Runtime Error):
import math
R = int(input())
print(2*math.pi()*R)

Fixed submission:
import math
N = int(input())
print(2*math.pi*N)

Buggy python submission (verdict: Runtime Error):
import math
print(int(input()*math.pi*2))

Fixed submission:
import math
N = int(input())
print(2*math.pi*N)
Buggy python submission (verdict: Time Limit Exceeded):
import math
K=int(input())
ans=0
 
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans+=math.gcd(math.gcd(i,j),k)
print(ans)

Fixed submission:
ls = [1, 9, 30, 76, 141, 267, 400, 624, 885, 1249, 1590, 2208, 2689, 3411, 4248, 5248, 6081, 7485, 8530, 10248, 11889, 13687, 15228, 17988, 20053, 22569, 25242, 28588, 31053, 35463, 38284, 42540, 46581, 50893, 55362, 61824, 65857, 71247, 76884, 84388, 89349, 97881, 103342, 111528, 120141, 128047, 134580, 146316, 154177, 164817, 174438, 185836, 194157, 207927, 218812, 233268, 245277, 257857, 268182, 288216, 299257, 313635, 330204, 347836, 362973, 383709, 397042, 416448, 434025, 456967, 471948, 499740, 515581, 536073, 559758, 583960, 604833, 633651, 652216, 683712, 709065, 734233, 754734, 793188, 818917, 846603, 874512, 909496, 933081, 977145, 1006126, 1041504, 1073385, 1106467, 1138536, 1187112, 1215145, 1255101, 1295142, 1342852, 1373253, 1422195, 1453816, 1502376, 1553361, 1595437, 1629570, 1691292, 1726717, 1782111, 1827492, 1887772, 1925853, 1986837, 2033674, 2089776, 2145333, 2197483, 2246640, 2332104, 2379085, 2434833, 2490534, 2554600, 2609625, 2693919, 2742052, 2813988, 2875245, 2952085, 3003306, 3096024, 3157249, 3224511, 3306240, 3388576, 3444609, 3533637, 3591322, 3693924, 3767085, 3842623, 3912324, 4027884, 4102093, 4181949, 4270422, 4361548, 4427853, 4548003, 4616104, 4718640, 4812789, 4918561, 5003286, 5131848, 5205481, 5299011, 5392008, 5521384, 5610705, 5739009, 5818390, 5930196, 6052893, 6156139, 6239472, 6402720, 6493681, 6623853, 6741078, 6864016, 6953457, 7094451, 7215016, 7359936, 7475145, 7593865, 7689630, 7886244, 7984165, 8130747, 8253888, 8403448, 8523897, 8684853, 8802826, 8949612, 9105537, 9267595, 9376656, 9574704, 9686065, 9827097, 9997134, 10174780, 10290813, 10493367, 10611772, 10813692]
K = int(input())
print(ls[K-1])
Buggy python submission (verdict: Runtime Error):
K,N = map(int,input().split())
now = -10**9
for i in range(N):
  if i == N-1:
    if K-A[N-1]+A[i]>now:
      now = K-A[N-1]+A[i]
  else:
    if A[i+1]-A[i] > now:
      now = A[i+1]-A[i]
print(K-now)

Fixed submission:
K,N = map(int,input().split())
A = list(map(int,input().split()))
now = K-A[N-1]+A[0]
for i in range(N-1):
  if A[i+1]-A[i] > now:
    now = A[i+1]-A[i]
print(K-now)
Buggy python submission (verdict: Runtime Error):
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
S = P
T = Q
S.sort()
T.sort()
minimum = (S[0]+T[0])
K = 10**9
for i in range(M):
    x,y,c = map(int,input().split())
    S = P[x-1]+Q[y-1]-c
    if S=<K:
        if S <= 0:
            K = 0
        else:
            K = S
if minimum>K:
    print(K)
else:
    print(minimum)

Fixed submission:
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
K = min(a)+min(b)
X = 10**9
for i in range(M):
    x,y,c = map(int,input().split())
    S = a[x-1]+b[y-1]-c
    if S<X:
        X = S
if X<K:
    print(X)
else:
    print(K)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
L = list(map(int,input().split()))
L.sort()
L.reverse()
count = K
ans = 0
for i in range(len(L)):
  if count != 0:
    L[i] = 0
    ans += 1
    count -= 1
    if sum(L) == 0:
      count = 0
      break
  else:
    break
print(count+sum(L))

Fixed submission:
N,K = map(int,input().split())
L = list(map(int,input().split()))
L.sort()
count = K
ans = 0
if len(L)>K:
  for i in range(len(L)-K):
    ans += L[i]
  print(ans)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
H = int(input())

s = 1
count = 0
while H > 0:
	count += n
	H //= 2
	s *= 2

print(count)


Fixed submission:
H = int(input())

s = 1
count = 0
while H > 0:
	count += s
	H //= 2
	s *= 2

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int,input().split()))
k = []
ans = 0
k = []
for i in range(0,N):
  #P_i <= P_jの判定
  #これまでで最小値だったら、+1
  k.append(P[i])
  k.sort()
  if k[0] == P[i]:
    ans += 1
print(ans)

Fixed submission:
N = int(input())
minimum = 10**8
ans = 0
P = list(map(int,input().split()))
for i in range(N):
  if P[i] < minimum:
    minimum = P[i]
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
flag = 0
for i in range(1,54001):
    if math.floor(i*1.08) == N:
        print(i)
        flag += 1
        break
if flag == 0:
    print(":(")

Fixed submission:
N = int(input())
ans = 0
k = 0
for i in range(N+1):
    if N<=i*1.08<N+1:
        print(int(i))
        ans += 1
        break
if ans == 0:
    print(":(")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = A
S = sum(A)
B.reverse()
cum1 = [0]*(N)
cum2 = [0]*(N)
now1 = 0
for i in range(N):
  now1 += A[i]
  cum1[i] = now1
  cum2[i] = S-now1
minimum = 10**9
for i in range(N):
  if abs(cum1[i]-cum2[i]) < minimum:
    minimum = abs(cum1[i]-cum2[i])
print(minimum)


Fixed submission:
x,y = map(int,input().split())
ans = 0
if x<= 3:
    ans += 400000-100000*x
if y <= 3:
    ans += 400000-100000*y
if x== 1 and y == 1:
    ans += 400000
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
#距離の箱を作成
kyori = []
kyori2 = []
kyori3 = []
sumation = 0
for i in range(N):
    #N回繰り返す
    kyori.append(list(map(int,input().split())))
#x間の距離、y間の距離を算出
#ここで、2→1と1→2などは同じ距離なので計算しない
x_distance = 0
y_distance = 0
for i in range(0,N):
    for j in range(i+1,N):
        x_distance = (kyori[i][0]-kyori[j][0])**2
        y_distance = (kyori[i][1]-kyori[j][1])**2
        #xとyの距離を計算(sqrt導出)
        Kyorixy = math.sqrt(x_distance + y_distance)
        kyori2.append(Kyorixy)
if len(kyori2) == 1:
    print(kyori2[0])
else:
   goukei = sum(kyori2)*2/N

Fixed submission:
n = int(input())
print(int(n**2))
Buggy python submission (verdict: Runtime Error):
N = int(input())
ls = []
ls2 = []
for i in range(N):
  ls.append(map(int,input().split()))
X = 0
Y = 0
for i in range(N):
  for j in range(i+1,N):
    X = (ls[i][0]-ls[j][0])**2
    Y = (ls[i][1]-ls[j][1])**2
    XY = (X+Y)**(0.5)
    ls2.apppend(XY)
if len(ls2) == 1:
  print(ls2[0])
else:
  ans = sum(ls2)*2/N
  print(ans)

Fixed submission:
import math
N = int(input())
#距離の箱を作成
kyori = []
kyori2 = []
kyori3 = []
sumation = 0
for i in range(N):
    #N回繰り返す
    kyori.append(list(map(int,input().split())))
#x間の距離、y間の距離を算出
#ここで、2→1と1→2などは同じ距離なので計算しない
x_distance = 0
y_distance = 0
for i in range(0,N):
    for j in range(i+1,N):
        x_distance = (kyori[i][0]-kyori[j][0])**2
        y_distance = (kyori[i][1]-kyori[j][1])**2
        #xとyの距離を計算(sqrt導出)
        Kyorixy = math.sqrt(x_distance + y_distance)
        kyori2.append(Kyorixy)
if len(kyori2) == 1:
    print(kyori2[0])
else:
  goukei = sum(kyori2)*2/N
  print(goukei)