Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

N, M = [int(x) for x in input().split()]
A = list([int(x) * - 1 for x in input().split()])

while M > 0:
    heapq.heapify(A)
    count = (heapq.heappop(A) * -1 // 2) * -1

    heapq.heappush(A, count)
    M -= 1

print(sum(A) * -1)


Fixed submission:
import heapq

N, M = [int(x) for x in input().split()]
A = list([int(x) * - 1 for x in input().split()])
heapq.heapify(A)

for _ in range(M):
    target = heapq.heappop(A) * -1
    heapq.heappush(A, (target // 2) * -1)

print(sum(A) * -1)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

N, M = [int(x) for x in input().split()]
A = list([int(x) for x in input().split()])

stack = deque()
stack.appendleft((0, M, 0))

min_money = 10**9*10**5

while stack:
    i_t = stack.popleft()
    item_number = i_t[0]
    tickets = i_t[1]
    need_money = i_t[2]

    for use_tickets in range(tickets+1):
        if item_number + 1 <= N:
            money = A[item_number] // 2**use_tickets
            stack.appendleft((item_number+1, tickets-use_tickets,
                              need_money + money))

        else:
            min_money = min(need_money, min_money)

        if money == 0:
            break

print(min_money)


Fixed submission:
import heapq

N, M = [int(x) for x in input().split()]
A = list([int(x) * - 1 for x in input().split()])
heapq.heapify(A)

for _ in range(M):
    target = heapq.heappop(A) * -1
    heapq.heappush(A, (target // 2) * -1)

print(sum(A) * -1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list([int(x) for x in input().split()])

for i in range(0, A[0] * 2 + 1, 2):
    result = [0] * N
    result[0] = i
    for x in range(N-1, -1, -1):
        if x == N-1:
            r = (A[x] - result[0] // 2) * 2
        else:
            r = (A[x] - result[x+1] // 2) * 2

        if r % 2 != 0 or r < 0:
            break

        if x == 0:
            if r == i:
                print(' '.join([str(x) for x in result]))
                exit()

        result[x] = r


Fixed submission:
N = int(input())
A = list([int(x) for x in input().split()])

result = [0] * N
x = 0
for key, i in enumerate(A):
    if key % 2 == 0:
        x += i
    else:
        x -= i

result[0] = x

for i in range(1, N):
    result[i] = 2 * A[i-1] - result[i-1]

print(' '.join([str(x) for x in result]))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A = list([int(x) for x in input().split()])

left = []
right = []

for key, v in enumerate(A):
    s = [0] * N
    s[key] = 1

    if key+1 == N:
        s[0] = 1
    else:
        s[key+1] = 1
    left.append(s)

    right.append([v])

a = np.matrix(left)
b = np.matrix(right)

result = np.linalg.solve(a, b).flatten().tolist()[0]
print(' '.join([str(int(x) * 2) for x in result]))


Fixed submission:
N = int(input())
A = list([int(x) for x in input().split()])

result = [0] * N
x = 0
for key, i in enumerate(A):
    if key % 2 == 0:
        x += i
    else:
        x -= i

result[0] = x

for i in range(1, N):
    result[i] = 2 * A[i-1] - result[i-1]

print(' '.join([str(x) for x in result]))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

N = int(input())
answer_list = set(['M', 'A', 'R', 'C', 'H'])
name_count = []

for i in range(N):
    name = input()

    if name[0] in answer_list:
        name_count.append(name[0])

result = list([1 for x in combinations(
    name_count, 3) if len(set(x)) == len(x)])
print(sum(result))


Fixed submission:
from itertools import combinations

N = int(input())
name_count = {'M': 0,
              'A': 0,
              'R': 0,
              'C': 0,
              'H': 0, }
for i in range(N):
    name = input()

    if name[0] in name_count:
        name_count[name[0]] += 1


def comb(n, r):
    up = 1
    down = 1
    for i in range(r):
        up *= n - i
        down *= i + 1
    return up // down


all_sum = sum(name_count.values())
total = comb(all_sum, 3)

for i in name_count.values():
    if i >= 2:
        total -= comb(i, 2) * (all_sum - i)

    if i >= 3:
        total -= comb(i, 3)

print(total)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(x) for x in input().split()]

result = []
for _ in range(N):
    a, b = [int(x) for x in input().split()]
    result.extend([a] * b)

result.sort()
print(result[K-1])


Fixed submission:
N, K = [int(x) for x in input().split()]

result = {}
for _ in range(N):
    a, b = [int(x) for x in input().split()]
    if a in result:
        result[a] += b
    else:
        result[a] = b

result = sorted(result.items())

now = 0
for key, value in result:
    now += value

    if now >= K:
        print(key)
        exit()
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

X = int(input())

queue = deque()
queue.appendleft((0, 0))

while queue:
    now = queue.pop()
    pos = now[0]
    time = now[1]

    if pos == X:
        print(time)
        exit()

    queue.appendleft((pos + time+1, time+1))
    queue.appendleft((pos, time+1))
    queue.appendleft((pos - (time+1), time+1))


Fixed submission:
X = int(input())

time = 0
pos = 0
while pos < X:
    time += 1
    pos += time

print(time)
Buggy python submission (verdict: Time Limit Exceeded):
X = input()

while X != ''.join(X.split('ST')):
    X = ''.join(X.split('ST'))

print(len(X))


Fixed submission:
from collections import deque

X = input()
stack = deque([X[0]])
for i in range(1, len(X)):
    if X[i] == 'S':
        stack.appendleft(X[i])

    if X[i] == 'T':
        if stack:
            check = stack.popleft()
            if check == 'T':
                stack.appendleft(check)
                stack.appendleft(X[i])
        else:
            stack.appendleft(X[i])

print(len(stack))

Buggy python submission (verdict: Time Limit Exceeded):
X = input()

while X != ''.join(X.split('ST')):
    X = ''.join(X.split('ST'))

print(len(X))


Fixed submission:
from collections import deque

X = input()
stack = deque([X[0]])
for i in range(1, len(X)):
    if X[i] == 'S':
        stack.appendleft(X[i])

    if X[i] == 'T':
        if stack:
            check = stack.popleft()
            if check == 'T':
                stack.appendleft(check)
                stack.appendleft(X[i])
        else:
            stack.appendleft(X[i])

print(len(stack))
Buggy python submission (verdict: Runtime Error):

n,k=map(int,input().split())
a=list(map(int,input().split()))
if k==0:
    print(max(a))
    exit()
a.sort()
left,right=0,a[n-1]
mid=right
while abs(right-left)>2:
    mid=(left+right)//2
    temp=0
    for i in range(n-1,-1,-1):
        if a[i]<=mid: break
        temp+=a[i]//mid
    if temp>k: left=mid
    else: right=mid
mid-=1
while True:
    temp=0
    flag=0
    for i in range(n-1,-1,-1):
        if a[i]<=mid: break
        temp+=a[i]//mid
    if temp>k: mid+=1
    else:
        flag=1
        break
    if flag: break
print(mid)

Fixed submission:

n,k=map(int,input().split())
a=list(map(int,input().split()))
if k==0:
    print(max(a))
    exit()
a.sort()
left,right=0,a[n-1]
mid=right
while abs(right-left)>2:
    mid=(left+right)//2
    temp=0
    for i in range(n-1,-1,-1):
        if a[i]<=mid: break
        temp+=a[i]//mid
    if temp>k: left=mid
    else: right=mid
mid-=1
if mid<=0: mid=1
while True:
    temp=0
    flag=0
    for i in range(n-1,-1,-1):
        if a[i]<=mid: break
        temp+=a[i]//mid
    if temp>k: mid+=1
    else:
        flag=1
        break
    if flag: break
print(mid)

Buggy python submission (verdict: Runtime Error):
from math import ceil
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k==0:
    print(max(a))
    exit()
a.sort()
left,right=0,a[n-1]
mid=right
while abs(right-left)>2:
    mid=(left+right)/2
    temp=0
    for i in range(n-1,-1,-1):
        if a[i]<=mid: break
        temp+=a[i]//mid
    if temp>k: left=mid
    else: right=mid
mid=int(mid)-1
while True:
    temp=0
    flag=0
    for i in range(n-1,-1,-1):
        if a[i]<=mid: break
        temp+=a[i]//mid
    if temp>k: mid+=1
    else:
        flag=1
        break
    if flag: break
print(mid)

Fixed submission:

n,k=map(int,input().split())
a=list(map(int,input().split()))
if k==0:
    print(max(a))
    exit()
a.sort()
left,right=0,a[n-1]
mid=right
while abs(right-left)>2:
    mid=(left+right)//2
    temp=0
    for i in range(n-1,-1,-1):
        if a[i]<=mid: break
        temp+=a[i]//mid
    if temp>k: left=mid
    else: right=mid
mid-=1
if mid<=0: mid=1
while True:
    temp=0
    flag=0
    for i in range(n-1,-1,-1):
        if a[i]<=mid: break
        temp+=a[i]//mid
    if temp>k: mid+=1
    else:
        flag=1
        break
    if flag: break
print(mid)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
temp=1
for i in range(k): temp*=a[i]
for i in range(k,n,1):
    temp2=temp
    temp//=a[i-k]
    temp*=a[i]
    if temp2>=temp: print("No")
    else: print("Yes")

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
temp=1
for i in range(k,n,1):
    if a[i-k]>=a[i]: print("No")
    else: print("Yes")
Buggy python submission (verdict: Runtime Error):
A="abcdefghijklmnopqrstuvwxyz"
n=int(input())-1
name=[]
while n>0:
    temp=n%26
    name.append(temp)
    n//=26
length=len(name)
for i in range(length-1):
    print(A[name[length-i-1]-1],end="")
print(A[name[0]])

Fixed submission:
A="abcdefghijklmnopqrstuvwxyz"
n=int(input())
i=1
while n-26**i>0:
    n-=26**i
    i+=1
name=[]
n-=1
for j in range(i):
    temp=n%26
    name.append(A[temp])
    n//=26
for k in name[::-1]: print(k,end="")
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
d=dict(Counter(a))
ans=sum(a)
q=int(input())
for _ in range(q):
    b,c=map(int,input().split())
    ans+=c*d[b]-b*d[b]
    print(ans)
    if c in d.keys(): d[c]+=d[b]
    else: d[c]=d[b]
    d[b]=0

Fixed submission:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
d=dict(Counter(a))
ans=sum(a)
q=int(input())
for _ in range(q):
    b,c=map(int,input().split())
    if b not in d.keys():
        print(ans)
        continue
    ans+=(c*d[b]-b*d[b])
    print(ans)
    if c in d.keys(): d[c]+=d[b]
    else: d[c]=d[b]
    d[b]=0
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a,b):
    if b==0: return a
    return gcd(b,a%b)

k=int(input())
ans=0
for a in range(1,k+1):
    for b in range(1,k+1):
        temp=gcd(a,b)
        for c in range(1,k+1):
            ans+=gcd(temp,c)
print(ans)

Fixed submission:
from math import gcd

k=int(input())
ans=0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=gcd(a,gcd(b,c))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd

k=int(input())
ans=0
for a in range(k):
    for b in range(k):
        for c in range(k):
            ans+=gcd(a+1,gcd(b+1,c+1))
print(ans)

Fixed submission:
from math import gcd

k=int(input())
ans=0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=gcd(a,gcd(b,c))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a,b):
    if b==0: return a
    return gcd(b,a%b)

k=int(input())
ans=0
for a in range(k):
    for b in range(k):
        for c in range(k):
            ans+=gcd(a+1,gcd(b+1,c+1))
print(ans)

Fixed submission:
from math import gcd

k=int(input())
ans=0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=gcd(a,gcd(b,c))
print(ans)
Buggy python submission (verdict: Runtime Error):
_,m=map(int,input().split())
a=list(map(int,input().split()))
cnt=0
temp=sum(a)
for v in a:
    if v>=a/(4*m): cnt+=1
if cnt>=m: print("Yes")
else: print("No")

Fixed submission:
_,m=map(int,input().split())
a=list(map(int,input().split()))
cnt=0
temp=sum(a)
for v in a:
    if v>=temp/(4*m): cnt+=1
if cnt>=m: print("Yes")
else: print("No")
Buggy python submission (verdict: Runtime Error):
x=int(input())
(a,b)=divmod(x/500)
print(a*1000+b//5*5)

Fixed submission:
x=int(input())
(a,b)=divmod(x,500)
print(a*1000+b//5*5)
Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)
s1=s[0:n//2]
s2=s[n//2+1:n]
if s=s[::-1]and s1=s1[::-1] and s2=s2[::-1]: print("Yes")
else: print("No")

Fixed submission:
s=input()
n=len(s)
s1=s[0:n//2]
s2=s[n//2+1:n]
if s==s[::-1]and s1==s1[::-1] and s2==s2[::-1]: print("Yes")
else: print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
i=1
while True:
    if n<k**i:
        print(i)
        break

Fixed submission:
n,k=map(int,input().split())
i=1
while True:
    if n<k**i:
        print(i)
        break
    i+=1
Buggy python submission (verdict: Runtime Error):
MOD=10**9+7

def powmod(a,n,m): #a^n mod m
    ans=1
    while n!=0:
        if n&1: ans=ans*a%m
        a=a*a%m
        n>>=1
    return ans%m

def fact(n):
    ans=1
    for i in range(n): ans=ans*(i+1)%MOD
    return ans

def fact(a,b):
    ans=1
    for i in range(a,b+1): ans*=ans*i%MOD
    return ans

n,a,b=map(int,input().split())

ans=powmod(2,n,MOD)-1
ta1=fact(n-a+1,n)
tb1=fact(n-b+1,n)
ta2=pow(fact(a),MOD-2,MOD)
tb2=pow(fact(b),MOD-2,MOD)
a=ta1*ta2%MOD
b=tb1*tb2%MOD
print((ans-a-b)%MOD)

Fixed submission:
MOD=10**9+7

def powmod(a,n,m): #a^n mod m
    ans=1
    while n!=0:
        if n&1: ans=ans*a%m
        a=a*a%m
        n>>=1
    return ans%m

def fact(a,b):
    ans=1
    for i in range(a,b+1): ans=ans*i%MOD
    return ans

n,a,b=map(int,input().split())

ans=powmod(2,n,MOD)-1
ta1=fact(n-a+1,n)
tb1=fact(n-b+1,n)
ta2=pow(fact(1,a),MOD-2,MOD)
tb2=pow(fact(1,b),MOD-2,MOD)
a=ta1*ta2%MOD
b=tb1*tb2%MOD
print((ans-a-b)%MOD)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
	if i==2:
		print("Yes")
        exit()
print("No")


Fixed submission:
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
    if i==2:
        print("Yes")
        exit()
print("No")

Buggy python submission (verdict: Runtime Error):
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
	if i==2:
		print("Yes")
    	exit()
print("No")


Fixed submission:
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
    if i==2:
        print("Yes")
        exit()
print("No")

Buggy python submission (verdict: Runtime Error):
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
	if i==2:
      print("Yes")
	  exit()
print("No")


Fixed submission:
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
    if i==2:
        print("Yes")
        exit()
print("No")

Buggy python submission (verdict: Runtime Error):
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
	if i==2:
	    print("Yes")
        exit()
print("No")


Fixed submission:
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
    if i==2:
        print("Yes")
        exit()
print("No")

Buggy python submission (verdict: Runtime Error):
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
	if i==2:
	    print("Yes")
        exit()
print("No")


Fixed submission:
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
    if i==2:
        print("Yes")
        exit()
print("No")

Buggy python submission (verdict: Runtime Error):
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values()
	if i==2:
	    print("Yes")
      	exit()
print("No")

Fixed submission:
from collections import Counter
a=list(map(int,input().split()))
dic=Counter(a)
for i in dic.values():
    if i==2:
        print("Yes")
        exit()
print("No")
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
dic=defaultdict(int)
n=int(input())
for _ in range(n): dic[input()]+=1
lis=sorted(dic.items(),key=lambda x:x[1],reverse=True)
M=lis[0][1]
ans=[]
for i in range(n):
    if lis[i][1]==M: ans.append(lis[i][0])
    else: break
ans.sort()
for i in ans: print(i)

Fixed submission:
from collections import defaultdict
dic=defaultdict(int)
n=int(input())
for _ in range(n): dic[input()]+=1
lis=sorted(dic.items(),key=lambda x:x[1],reverse=True)
M=lis[0][1]
ans=[]
for i in range(len(lis)):
    if lis[i][1]==M: ans.append(lis[i][0])
    else: break
ans.sort()
for i in ans: print(i)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split())
dic=Counter(a)
for val in dic.values():
    if val>=2:
        print("NO")
        exit()
print("YES")

Fixed submission:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
dic=Counter(a)
for val in dic.values():
    if val>=2:
        print("NO")
        exit()
print("YES")
Buggy python submission (verdict: Runtime Error):
a,b=input()
A=int(a*b)
B=int(b*a)
print(min(A,B))

Fixed submission:
a,b=input().split()
A=a*int(b)
B=b*int(a)
print(min(A,B))
Buggy python submission (verdict: Runtime Error):
n=input()
p=list(map(int,input().split()))
ans,m=0,p[0]
for i in range(n):
    m=min(m,p[i])
    if m==p[i]: ans+=1
print(ans)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
ans,m=0,p[0]
for i in range(n):
    m=min(m,p[i])
    if m==p[i]: ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

def func(i,j,k):
    num = str(k)
    if int(num[0])==i and int(num[-1])==j:
        return True
    return False

n = int(input())
table = np.zeros((9,9))
for i in range(9):
    for j in range(9):
        for k in range(n):
            if func(i+1,j+1,k+1):
                table[i][j]+=1

ans = 0
for i in range(9):
    for j in range(9):
        ans += table[i][j]*table[j][i]
print(int(ans))

Fixed submission:
import numpy as np

n = int(input())
table,ans = np.zeros((9,9)),0

for k in range(n):
    num = str(k+1)
    if int(num[0])!=0 and int(num[-1])!=0:
        table[int(num[0])-1][int(num[-1])-1]+=1

for i in range(9):
    for j in range(9):
        ans += table[i][j]*table[j][i]
print(int(ans))
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
if a>=k: print(a-k,b)
elif a+b>=k: print(0,a+b-k)
else: print(0,0)


Fixed submission:
s,t=input().split()
print(t+s)
Buggy python submission (verdict: Runtime Error):
n=int(input())
flag=0
for i in range(9):
    for j in range(9):
        if i*j=n:
            flag=1
            break
if flag: print("Yes")
else: print("No")

Fixed submission:
n=int(input())
flag=0
for i in range(1,10):
    for j in range(1,10):
        if i*j==n:
            flag=1
            break
if flag: print("Yes")
else: print("No")
Buggy python submission (verdict: Runtime Error):
s=input()
k=int(input())
cnt=1
temp=[]
for i in range(len(s)-1):
    if s[i]==s[i+1]: cnt+=1
    else:
        temp.append([s[i],cnt])
        cnt=1
if cnt>=1: temp.append([s[-1],cnt])
if len(temp)==1:
    print(k*len(s)//2)
    exit()
ans=0
if temp[0][0]!=temp[-1][0]:
    for pair in temp:
        if pair[1]!=1: ans+=pair[1]//2
    print(ans*k)
else:
    for pair in temp[1:-1]:
        if pair[1]!=1: ans+=pair[1]//2
    ans*=k
    ans+=(k-1)*((temp[0][0]+temp[-1][0])//2)
    ans+=temp[0][0]//2+temp[-1][0]//2
    print(ans)

Fixed submission:
s=input()
k=int(input())
cnt=1
temp=[]
for i in range(len(s)-1):
    if s[i]==s[i+1]: cnt+=1
    else:
        temp.append([s[i],cnt])
        cnt=1
if cnt>=1: temp.append([s[-1],cnt])
if len(temp)==1:
    print(k*len(s)//2)
    exit()
ans=0
if temp[0][0]!=temp[-1][0]:
    for pair in temp:
        if pair[1]!=1: ans+=pair[1]//2
    print(ans*k)
else:
    for pair in temp[1:-1]:
        if pair[1]!=1: ans+=pair[1]//2
    ans*=k
    ans+=(k-1)*((temp[0][1]+temp[-1][1])//2)
    ans+=temp[0][1]//2+temp[-1][1]//2
    print(ans)
Buggy python submission (verdict: Runtime Error):
def gcd(a,b): #最大公約数
    if a%b==0: return b
    return gcd(b,a%b)

def ela(g):
    s={}
    i=2
    while i*i<=g:
        while g%i==0:
            g//=i
            s.add(i)
        i+=1
    return s

a,b=map(int,input().split())
G=gcd(max(a,b),min(a,b))
print(len(ela(G))+1)

Fixed submission:
def gcd(a,b):
    if b==0: return a
    return gcd(b,a%b)

def ela(g):
    s={1}
    i=2
    while i*i<=g:
        while g%i==0:
            g//=i
            s.add(i)
        i+=1
    if g!=1: s.add(g)
    return s

a,b=map(int,input().split())
G=gcd(max(a,b),min(a,b))
print(len(ela(G)))
Buggy python submission (verdict: Runtime Error):
import heapq

n,m = map(int,input().split())
a = list(map(int,input().split()))
a = map(lambda x:-x, a)
heapq.heapify(a)
print(a)
for _ in range(m):
    temp = -heapq.heappop(a)
    temp//=2

    heapq.heappush(a,-temp)
ans = 0
for _ in range(n):
    ans -= heapq.heappop(a)
print(ans)

Fixed submission:
import heapq

n,m = map(int,input().split())
a = list(map(lambda x: -int(x),input().split()))
heapq.heapify(a)
for _ in range(m):
    temp = -heapq.heappop(a)
    temp//=2
    heapq.heappush(a,-temp)
ans = 0
for _ in range(n):
    ans -= heapq.heappop(a)
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(max(c-(a-b)),0)

Fixed submission:
a,b,c=map(int,input().split())
print(max(c-(a-b),0))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in range(n-1,-1,-1):
    temp=0
    for j in range(2*i,n,i): temp+=ans[j]
    if a[i]!=temp%2: ans[i]=1
print(sum(ans))                                 
for i in range(n):
    if ans[i]==1: print(i+1,end=" ")

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*(n+1)
for i in range(n,0,-1):
    temp=0
    for j in range(i,n+1,i): temp+=ans[j]
    if a[i-1]!=temp%2: ans[i]=1
print(sum(ans))           
for i in range(n+1):
    if ans[i]==1: print(i,end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for i in range(n-1,-1,-1):
    temp=0
    for j in range(i,n): temp+=ans[j]
    if a[i]!=temp%2: ans[i]=1
print(sum(ans))                                 
for i in range(n):
    if ans[i]==1: print(i+1,end=" ")

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*(n+1)
for i in range(n,0,-1):
    temp=0
    for j in range(i,n+1,i): temp+=ans[j]
    if a[i-1]!=temp%2: ans[i]=1
print(sum(ans))           
for i in range(n+1):
    if ans[i]==1: print(i,end=" ")
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

n=int(input())
c=[]
for _ in range(n): c.append(list(map(int,input().split())))
dic=defaultdict(int)
for i in range(0,n-1):
    for j in range(i+1,n):
        temp=(abs(c[i][0]-c[j][0]),abs(c[i][1]-c[j][1]))
        dic[temp]+=1
print(n-max(dic.values()))

Fixed submission:
from collections import defaultdict
n=int(input())
c=[]
for _ in range(n): c.append(list(map(int,input().split())))
dic=defaultdict(int)
for i in range(n):
    for j in range(n):
        if i==j: continue
        dic[(c[i][0]-c[j][0],c[i][1]-c[j][1])]+=1
if dict(dic): print(n-max(dic.values()))
else: print(1)