qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n = int(input())
a = int(input())
if n % 500 == a % 500:
  print('Yes')
else:
  print('No')

Fixed code:
n = int(input())
a = int(input())
if (n % 500 <= a):
  print('Yes')
else:
  print('No')
Buggy code:
n = input()
a = input()
n %= 500
if n <= a:
    print('Yes')
else:
    print('No')

Fixed code:
n = int(input())
a = int(input())

if n%500 <= a:
    print('Yes')
else:
    print('No')
Buggy code:

def main():
    N = int(input())
    a = int(input())

    r = N%500

    if r == 0:
        print ('yes')
    elif a >= r:
        print ('yes')
    else:
        print ('No')


if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()


Fixed code:

def main():
    N = int(input())
    a = int(input())

    r = N%500

    if r == 0:
        print ('Yes')
    elif a >= r:
        print ('Yes')
    else:
        print ('No')


if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()
Buggy code:
int("A")
int("N")
if N%500<=A:
  print ("Yes")
else:
  print("No")

Fixed code:
N=int(input())
A=int(input())
if(N%500 <= A):
    print("Yes")
else:
    print("No")
Buggy code:
n = int(input())
a = int(input())
if((a%500)<=n):
  print("Yes")
else:
  print("No")

Fixed code:
n = int(input())
a = int(input())

t = n % 500
if t <= a:
    print('Yes')
else:
    print('No')
Buggy code:
n = int(input())
a = int(input())
if((a%500)<=b):
  print("Yes")
else:
  print("No")


Fixed code:
a = int(input())
n = int(input())
if((a%500)<=n):
  print("Yes")
else:
  print("No")
Buggy code:
n = input()
a = input()
if (n % 500) <= a:
  print('Yes')
else:
  print('No')

Fixed code:
n = int(input())
a = int(input())
if n%500 <= a: 
    print('Yes')
else:
    print('No')
Buggy code:
a=int(input())
b=int(input())
c=a%500
if b>=c:
    print(Yes)
else:
    print(No)



Fixed code:
a=int(input())
b=int(input())
c=a%500
if b>=c:
    print("Yes")
else:
    print("No")
Buggy code:
n = int(input())
a = int(input())
zan = n - a
if zan <= 0:
  print('Yes')
else:
  if zan % 500 == 0:
    print('Yes')
  else:
    print('No')

Fixed code:
n = int(input())
a = int(input())
ans = n % 500
if ans - a <=0:
    print('Yes')
else:
    print('No')
Buggy code:
a,b=int(input()),int(input())
print("Yes" if b%500<=a else "No")


Fixed code:
a,b=int(input()),int(input())
print("Yes" if a%500<=b else "No")
Buggy code:
N = int(input())
A = int(input())

amari =　N % 500

if ( A >= amari):
    print("Yes")
else:
    print("No")

Fixed code:
N = int(input())
A = int(input())

if (N >= 500):
    amari = N % 500
    if ( A >= amari):
        print("Yes")
    else:
        print("No")

else:
    if ( A >= N):
        print("Yes")
    else:
        print("No")
Buggy code:
n = int(input())
a = int(input())
print('Yes') if n%500 <= a print('No')

Fixed code:
n = int(input())
a= int(input())

print("Yes" if n % 500 <= a else "No")
Buggy code:
n=int(input())
a=int(input())
n = n % 500
if a <= n :
 print('Yes')
else :
 print('No')

Fixed code:
n = int(input())
a = int(input())
if (n % 500) <= a:
    print("Yes")
else:
    print("No")
Buggy code:
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1

def main():
    n=int(input())
    a=int(input())
    if a<=n%500:
        print("Yes")
    else:
        print("No")

main()

Fixed code:
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1

def main():
    n=int(input())
    a=int(input())
    if a>=n%500:
        print("Yes")
    else:
        print("No")

main()
Buggy code:
n = input()
a = input()

if (n % 500)<= a:
    print("Yes")
else:
    print("No")

Fixed code:
n= int(input())
a = int(input())
 
if (n%500 <= a):
	print('Yes')
else:
	print('No')
Buggy code:
n = input()
a = input()
n = int(n)
a = int(a)

n = n % 500

if n > a:
	print("Yes")
else:
	print("No")


Fixed code:
n = int(input())
a = int(input())
if n%500>a:
    print('No')
else:
    print('Yes')
Buggy code:
# coding: utf-8
N = int(input())
A = int(input())

c = N%A

if c > A:
    print("No")
else:
    print("Yes")

Fixed code:
# coding: utf-8
N = int(input())
A = int(input())

c = N%500

if c > A:
    print("No")
else:
    print("Yes")
Buggy code:
N=int(input())
A=int(input())
check=N-N%500
print("Yes" if check<=A else "No")

Fixed code:
N=int(input())
A=int(input())
check=N%500
print("Yes" if check<=A else "No")
Buggy code:
N=int(input())
A=int(input())
n500=N//500
check=N-n500
print("Yes" if check<=A else "No")

Fixed code:
N=int(input())
A=int(input())
n500=N//500
check=N-n500*500
print("Yes" if check<=A else "No")
Buggy code:
n = int(input())
a = int(input())
if (n%500)-a =<0:
  print("Yes")
else:
  print("No")

Fixed code:
n = int(input())
a = int(input())
if (n%500)-a <=0:
  print("Yes")
else:
  print("No")
Buggy code:
n = int(input())
a = int(input())

print(n-500*(n//500))
if n-500*(n//500) <= a:
    print('Yes')
else:
    print('No')

Fixed code:
n = int(input())
a = int(input())

if n-500*(n//500) <= a:
    print('Yes')
else:
    print('No')
Buggy code:
n=int(input())
a=int(input())

if n%500 >=a:
  print("Yes")
else:
  print("No")

Fixed code:
n = int(input())
a = int(input())
if a >= n%500:
    ans = 'Yes'
else:
    ans = 'No'
print(ans)
Buggy code:
def main():
    N = int(input() )
    A = int(input() )
    
    surplus = N % 500
    print(surplus)
    if(surplus <= A):
        print("Yes")
    else:
        print("No")
    
if __name__=="__main__":
    main()

Fixed code:
def main():
    N = int(input() )
    A = int(input() )
    
    surplus = N % 500
#    print(surplus)
    if(surplus <= A):
        print("Yes")
    else:
        print("No")
    
if __name__=="__main__":
    main()
Buggy code:
# 2019/06/02
# AtCoder Beginner Contest 088 - A 

# Input
n = int(input())
a = int(input())

w_coin = n % 500

if w_coin <= n:
    ans = "Yes"
else:
    ans = "No"
    
print(ans)

Fixed code:
# 2019/06/02
# AtCoder Beginner Contest 088 - A 

# Input
n = int(input())
a = int(input())

w_coin = n % 500

if w_coin <= a:
    ans = "Yes"
else:
    ans = "No"
    
print(ans)
Buggy code:
print('N= ')
N = input()
N = int(N)
print('A= ')
A = input()
A = int(A)
print(N)
print(A)

N %= 500

if A > N:
    print('Yes')
else:
    print('No')


Fixed code:
N = int(input())
A = int(input())
if A >= N % 500:
  print('Yes')
else:
  print('No')
Buggy code:
N = int(input())
A = int(input())
if A => N%500:
  print("Yes")
else:
  print("No")

Fixed code:
N = int(input())
A = int(input())
if A >= N%500:
  print("Yes")
else:
  print("No")
Buggy code:
N, A = int(input()), int(input())
for i in range(len(A) + 1):
  if (N - i) % 500 == 0:
    print('Yes')
    exit()
print('No')

Fixed code:
N, A = int(input()), int(input())
for i in range(A + 1):
  if (N - i) % 500 == 0:
    print('Yes')
    exit()
print('No')
Buggy code:
n=int(input())
a=int(input())
if n%500 <= A:print("Yes")
else:print("No")

Fixed code:
n=int(input())
a=int(input())
if n%500 <= a:print("Yes")
else:print("No")
Buggy code:
N = int(input())
a = []
for i in range(1):
    a.append(int(input()))

calc = N - a[0]

if a[0]>N:
    print('Yes')
else:
    print('Yes' if calc % 500 == 0 else 'No')


Fixed code:
N = int(input())
a = []
for i in range(1):
    a.append(int(input()))

if N % 500 ==0:
    print('Yes')
else:
    calc = N % 500
    if a[0] >= calc:
        print('Yes')
    else:
        print('No')
Buggy code:
N = int(input())
A = int(input())
N_500 = N%500
if A >= N_500 :
  print('Yes')
else :
  pritn('No')

Fixed code:
N = int(input())
A = int(input())
N_500 = N%500
if A >= N_500 :
  print('Yes')
else :
  print('No')
Buggy code:
N = int(input())
A = int(input())
if N >= 500:
  while N<500:
    N = N-500
  if N<=A:
    print('Yes')
  else:
    print('No')
else:
  if N<=A:
    print('Yes')
  else:
    print('No')

Fixed code:
N = int(input())
A = int(input())

while N >= 500:
    N = N -500

if N <= A:
    print("Yes")
else:
    print("No")
Buggy code:
n = int(input())
a = int(input())

while a >= 500:
    a -= 500

print("Yes" if a <= n else "No")

Fixed code:
n = int(input())
a = int(input())

while n >= 500:
    n -= 500

print("Yes" if n <= a else "No")
Buggy code:
n = int(input())
a = int(input())
k = N%500<=a
print('Yes' if k else 'No')


Fixed code:
n = int(input())
a = int(input())
k = n%500<=a
print('Yes' if k else 'No')
Buggy code:
N = int(input())
A = int(input())
if(A%500 <= N):
    ans = "Yes"
else:
    ans = "No"
print(ans)

Fixed code:
N = int(input())
A = int(input())
if(N%500 <= A):
    ans = "Yes"
else:
    ans = "No"
print(ans)
Buggy code:
a = int(input())
cost = int(input())
if cost % 500 <= a:
  print("Yes")
else:
  print("No")

Fixed code:
cost = int(input())
a = int(input())
if cost % 500 <= a:
  print("Yes")
else:
  print("No")
Buggy code:
N = int(print())
A = int(print())

if (N%500) > A:
	 print("No")
else:
	print("Yes")


Fixed code:
N = int(input())
A = int(input())

if (N%500) > A:
	 print("No")
else:
	print("Yes")
Buggy code:
n = int(input())
a = int(input())
print(n)
mod = n % 500
if mod < a:
    print("Yes")
else:
    print("No")

Fixed code:
n=int(input())
a=int(input())
if n%500<=a:
   print('Yes')
else:
   print('No')
Buggy code:
N = int(input())
A = int(input())

B = N - N//500
if B <= A:
  print("Yes")
else:
  print("No")

Fixed code:
N = int(input())
A = int(input())

B = N//500
C = N - 500*B

if C <= A:
  print("Yes")
else:
  print("No")
Buggy code:
N = int(input()) % 500
if A >= N:
  print('Yes')
else:
  print('No')

Fixed code:
N = int(input())
A = int(input())
R = N % 500
if A >= R:
    print ('Yes')
else:
    print ('No')
Buggy code:
n = int(input())
a = int(input())

tmp = n % 500

if tmp <= n:
    print("Yes")
else:
    print("No")



Fixed code:
n=int(input())
a=int(input())

if n%500 <= a:
	print("Yes")
else:
	print("No")
Buggy code:
input = [int(input()) for i in range(2)]
print(input)
if input[0] % 500 < input[1]:
   print("Yes")
else:
    print("No")

Fixed code:
input = [int(input()) for i in range(2)]
if input[0] % 500 <= input[1]:
   print("Yes")
else:
    print("No")
Buggy code:
a = int(input())
b = int(input())

print('Yes') if b%500 <= a else print('No')

Fixed code:
a = int(input())
b = int(input())

print('Yes') if a%500 <= b else print('No')
Buggy code:
n = int(input())
a = int(input())

t = n % 500 - a

if a <= 0:
  print("Yes")
else:
  print("No")

Fixed code:
n = int(input())
a = int(input())

t = n % 500 - a

if t <= 0:
  print("Yes")
else:
  print("No")
Buggy code:
N = int(input())
A = int(input())
if N%500 =< A:
  print("Yes")
else:
  print("No")

Fixed code:
N=int(input())
A=int(input())

if N % 500 <= A:
    print("Yes")
else:
    print("No")
Buggy code:
# 088 B
N = int(input())
a = list(map(int, input().split()))
A = 0
B = 0
aa = sorted(a)
for i in range(0, N, 2):
    A += aa[-i-1]
    B += aa[-i-2]
print(A-B)


Fixed code:
# 088 B
N = int(input())
a = list(map(int, input().split()))
A = 0
B = 0
aa = sorted(a)
for i in range(0, N, 2):
    A += aa[-i-1]
    if (i+2)<=N:
        B += aa[-i-2]
print(A-B)
Buggy code:
n = int(input())
cards = sorted(list(map(int, input().split())), reverse=True)
alice = []
bob = []
for i in range(0, n, 2):
    alice.append(max(cards[i]))
    try:
        bob.append(max(cards[i+1]))
    except:
        break
print(sum(alice) - sum(bob))

Fixed code:
n = int(input())
cards = sorted(list(map(int, input().split())), reverse=True)
alice = []
bob = []
for i in range(0, n, 2):
    alice.append(cards[i])
    try:
        bob.append(cards[i+1])
    except:
        break
print(sum(alice) - sum(bob))
Buggy code:
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
Alice = sum(a[::2])
Bob = sum(a[1::2])
print(Alice - )

Fixed code:
n = int(input())
a = list(map(int,input().split()))

a.sort(reverse = True)

print(sum(a[::2]) - sum(a[1::2]))
Buggy code:
N = int(input())
a = list(map(int, input().split()))

a.sort()

Alice = 0
Bob  = 0

for i in range(len(a)):
    if i % 2 == 0:
        Bob = Bob + a[i]
    else:
        Alice = Alice + a[i]

print(Alice - Bob)

Fixed code:
N = int(input())
a = list(map(int, input().split()))

a.sort()
a.reverse()

Alice = 0
Bob  = 0

for i in range(len(a)):
    if i % 2 == 0:
        Alice = Alice + a[i]
    else:
        Bob = Bob + a[i]

print(Alice - Bob)
Buggy code:
N=int(input())
a=list(map(int, input().split()))
a.sort()
Alice=0
Bob=0
for i in range(N):
  if i%2==0:
    Alice += a[i]
  else:
    Bob += a[i]
print(Alice-Bob)

Fixed code:
N=int(input())
a=list(map(int, input().split()))
a.sort(reverse=True)
Alice=0
Bob=0
for i in range(N):
  if i%2==0:
    Alice += a[i]
  else:
    Bob += a[i]
print(Alice-Bob)
Buggy code:
n=int(input())
a=[map(int,input().split())]
a.sort(reverse=True)
print(sum(a[::2]-a[1::2])

Fixed code:
n = int(input())
a = sorted(map(int, input().split()), reverse=True)
print(sum(a[::2])-sum(a[1::2]))
Buggy code:
N = int(input())

a = sorted(map(int,input().split()))

a.reverse()

A = []
B = []

for x in range(0,N+1,2):
    A.append(a[x])

for y in range(1,N,2):
    B.append(a[y])
    

print(sum(A)-sum(B))

Fixed code:
N = int(input())

a = sorted(map(int,input().split()))

a.reverse()

A = []
B = []

for x in range(0,N,2):
    A.append(a[x])
    
        
for y in range(1,N,2):
    B.append(a[y])
    
print(sum(A)-sum(B))
Buggy code:
N = int(input())
a = sorted(list(map(int,input().split())),reverse=True)
print(sum(a)-sum(a[::2]))

Fixed code:
N = int(input())
a = sorted(list(map(int,input().split())),reverse=True)
print(sum(a[0:N:2])-sum(a[1:N:2]))
Buggy code:
n = list(map(int , input().split()))
a = list(map(int , input().split()))

a = sorted(a)
al = 0
bo = 0
for i, aa in enumerate(a):
    if i %2 == 0:
        al += aa
    else:
        bo += aa
print(al -bo)

Fixed code:
n = list(map(int , input().split()))
a = list(map(int , input().split()))

a = sorted(a, reverse=True)
al = 0
bo = 0
for i, aa in enumerate(a):
    if i %2 == 0:
        al += aa
    else:
        bo += aa
print(al -bo)
Buggy code:
N = int(input())
A = list(map(int, input().split()))
A.sort(key=lambda x: -x)
print(sum(A[0::2]))

Fixed code:
N = int(input())
A = list(map(int, input().split()))
A.sort(key=lambda x: -x)
print(sum(A[0::2])-sum(A[1::2]))
Buggy code:
n=int(input())
li=map(int,input().split())
li=sorted(li)
A=0
B=0
for k in range(n//2):
  A += li[2*k]
  B += li[2*k+1]
if n % 2 ==1:
  A += li[n-1]
print(B-A)


Fixed code:
n=int(input())
li=map(int,input().split())
li=sorted(li)[::-1]
A=0
B=0
for k in range(n//2):
  A += li[2*k]
  B += li[2*k+1]
if n % 2 ==1:
  A += li[n-1]
print(A-B)
Buggy code:
n=int(input())
a=list(map(int, input().split()))
t=0
for i in range(len(a)):
  if i%2==0:
    t+=a[n-i-1]
  else:
    t-=a[n-i-1]
print(t)

Fixed code:
n=int(input())
a=list(map(int, input().split()))
t=0
a.sort()
for i in range(len(a)):
  if i%2==0:
    t+=a[n-i-1]
  else:
    t-=a[n-i-1]
print(t)
Buggy code:
N = int(input())
a = list(map(int,input().split()))
a.sort(reverse==True)
ans = 0
for i in range(N):
  if(a%2==0):
    ans += a[i]
  else:
    ans-=a[i]
    

Fixed code:
N = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
ans = 0
for i in range(N):
  if(i%2==0):
    ans += a[i]
  else:
    ans-=a[i]
print(ans)
Buggy code:

def main():
    n = int(input())
    cards = list(map(int, input().split()))
    alice_point = 0
    bob_point = 0

    cards.sort()
    for i in range(0, n):
        if i%2 == 0:
            alice_point += cards[i]
        else:
            bob_point += cards[i]

    print(alice_point - bob_point)

if __name__ == '__main__':
    main()

Fixed code:
import math
def main():
    n = int(input())
    cards = list(map(int, input().split()))
    alice_point = 0
    bob_point = 0

    cards.sort()
    for i in range(0, n):
        if i%2 == 0:
            alice_point += cards[i]
        else:
            bob_point += cards[i]

    print(abs(alice_point - bob_point))

if __name__ == '__main__':
    main()
Buggy code:
num=int(input())
n=list(map(int,input().split()))
n.sort(reverse=True)
print(n)
a=sum(n[::2])
b=sum(n[1::2])
print(a-b)

Fixed code:
num=int(input())
n=list(map(int,input().split()))
n.sort(reverse=True)
#print(n)
a=sum(n[::2])
b=sum(n[1::2])
print(a-b)
Buggy code:
N=int(input())
a=sorted([int(i) for i in input().split()],reverse=True)
print(sum(a[0::2]-sum(a[1::2]))

Fixed code:
N=int(input())
a=sorted([int(i) for i in input().split()],reverse=True)
print(sum(a[0::2])-sum(a[1::2]))
Buggy code:
a=int(input())

b=list(map(int, input().split()))
b.sort(reverse=True)
alice=0
bob=0
c=iter(b)
for i in c:
    alice+=i
    bob+=next(c)
print(alice-bob)

Fixed code:
a=int(input())

b=list(map(int, input().split()))
b.sort(reverse=True)
alice=0
bob=0
c=iter(b)
for i in c:
    alice+=i
    try:
    	bob+=next(c)
    except:
      break
print(alice-bob)
Buggy code:
n = int(input())
cards = sorted(map(int, input().split()), reverse=True)
score_alice, score_bob = 0, 0

for i in range(n):
  if i % 2 == 1:
    score_alice += cards[i]
  else:
    score_bob += cards[i]

print(score_alice - score_bob)

Fixed code:
n = int(input())
cards = sorted(map(int, input().split()), reverse=True)
score_alice, score_bob = 0, 0

for i in range(n):
  if i % 2 == 0:
    score_alice += cards[i]
  else:
    score_bob += cards[i]

print(score_alice - score_bob)
Buggy code:
n = int(input())
a_list = list(map(int, input().split()))
alice = 0
bob = 0


for i in range(len(a_list)):
    if i % 2:
        bob += sorted(a_list)[i]
    else:
        alice += sorted(a_list)[i]

print(str(alice - bob)) 

Fixed code:
n = int(input())
a_list = list(map(int, input().split()))
alice = 0
bob = 0


for i in range(len(a_list)):
    if i % 2:
        bob += sorted(a_list, reverse=True)[i]
    else:
        alice += sorted(a_list, reverse=True)[i]

print(str(alice - bob))
Buggy code:
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)

print(sum(l[0::2])-sum(l[1::2]))

Fixed code:
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)

print(sum(A[0::2])-sum(A[1::2]))
Buggy code:
N=int(input())
A=[int(input()) for i in range(N)]
list.sort(A,reverse=True)
a=0
b=0
for i in range(N):
    if(i%2==0):
        a+=A[i]
    else:
        b+=A[i]
print(a-b)

Fixed code:
N=int(input())
A= list(map(int,input().split()))
list.sort(A,reverse=True)
a=0
b=0
for i in range(N):
    if(i%2==0):
        a+=A[i]
    else:
        b+=A[i]
print(a-b)
Buggy code:
from functools import reduce 
from operator import add

n = int(input())
arr = map(int, input().split())

pt_a = 0
pt_b = 0

arr = arr.sort(reverse=True)

for ind, num in enumerate(arr):
  if ind % 2 == 0:
    pt_a += num
  else:
    pt_b += num

print(pt_a - pt_b)

Fixed code:
from functools import reduce 
from operator import add
 
n = int(input())
arr = list(map(int, input().split()))
 
pt_a = 0
pt_b = 0
 
arr.sort(reverse=True)
 
for ind, num in enumerate(arr):
  if ind % 2 == 0:
    pt_a += num
  else:
    pt_b += num
 
print(pt_a - pt_b)
Buggy code:
n = int(input())
A = list(sorted(list(map(int,input().split())))[::-1])
print(sum(A[::2])-sum(A[1:2]))


Fixed code:
n = int(input())
A = list(sorted(list(map(int,input().split())))[::-1])
print(sum(A[::2])-sum(A[1::2]))
Buggy code:
input()
lis = list(map(int, input().split()))
print(sum(sorted(lis)[0::2]) - sum(sorted(lis)[1::2]))

Fixed code:
input()
lis = sorted(list(map(int, input().split())), reverse=True)
print(sum(lis[0::2]) - sum(lis[1::2]))
Buggy code:
n = int(input())
a = list(map(int, input().split()))
print(a)
count = 0
alice = 0
bob = 0
a.sort()
f = 0
while(len(a) != 0):
    if f == 0:
        alice = alice + a.pop(-1)
        f = 1
    else:
        bob = bob + a.pop(-1)
        f = 0
print('alice %d' % alice)
print('bob %d' % bob)
print(alice - bob)


Fixed code:
n = int(input())
a = list(map(int, input().split()))
count = 0
alice = 0
bob = 0
a.sort()
f = 0
while(len(a) != 0):
    if f == 0:
        alice = alice + a.pop(-1)
        f = 1
    else:
        bob = bob + a.pop(-1)
        f = 0
print(alice - bob)
Buggy code:
n = int(input())
a = input().strip().split()
a = [ int(a[i]) for i in range(len(a)) ]

a.sort(reverse=True)

alice = 0
bob = 0
for i in range(n-1):
    if i % 2 is 0:
        alice = alice + int(a[i])
    else:
        bob = bob + int(a[i])
        
print(alice - bob)

Fixed code:
n = int(input())
a = input().strip().split()
a = [ int(a[i]) for i in range(len(a)) ]

a.sort(reverse=True)

alice = 0
bob = 0
for i in range(n):
    if i % 2 is 0:
        alice = alice + int(a[i])
    else:
        bob = bob + int(a[i])
        
print(alice - bob)
Buggy code:
N = int(input())
a = list(map(int,input().split()))
l = sorted(a)
count = 0
for i in range(3):
    if i % 2 == 0:
        count += l[i]
    else:
        count -= l[i]
print(count)

Fixed code:
N = int(input())
a = list(map(int,input().split()))
l = sorted(a, reverse = True)
count = 0
for i in range(N):
    if i % 2 == 0:
        count += l[i]
    else:
        count -= l[i]
print(count)
Buggy code:
n = int(input())
a = list(map(int,input().split()))
sum_ = sum(a)
sorted(a)
alice = 0
for i in range(len(a)):
    if i % 2 == 0:
        alice += a[-i-1]
print(2*alice - sum_)
#print(alice)

Fixed code:
n = int(input())
a = list(map(int,input().split()))
sum_ = sum(a)
a.sort()
#print(a)
alice = 0
for i in range(len(a)):
    if i % 2 == 0:
        #print(a[-i-1],alice)
        alice += a[-i-1]
print(2*alice - sum_)
#print(alice)
Buggy code:
input()
A = list(map(int,input().split()))
A = A.sort(reverse=True)
Alice = sum(A[1::2])
Bob = sum(A[::2])
print(Alice-Bob)

Fixed code:
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse = True)
Alice = sum(A[::2])
Bob = sum(A[1::2])
print(Alice-Bob)
Buggy code:
# coding: utf-8
N = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
print(a)
alice = sum(a[0::2])
bob = sum(a[1::2])
print(alice-bob)

Fixed code:
# coding: utf-8
N = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
alice = sum(a[0::2])
bob = sum(a[1::2])
print(alice-bob)
Buggy code:
n=input()
aa=map(int,input().split())
aa.sort(reverse=True)

ab=[0]*2

i=0
for a in aa:
  ab[i%2]+=a
  i+=1

print(ab[0]-ab[1])



Fixed code:
n=input()
aa=list(map(int,input().split()))
aa.sort(reverse=True)

ab=[0]*2

i=0
for a in aa:
  ab[i%2]+=a
  i+=1

print(ab[0]-ab[1])
Buggy code:
# -*- coding: utf-8 -*-

import numpy
import scipy

N = int(input())
A = list(map(int, input().split()))
print(A)

A_sort = sorted(A, reverse=True)
print(A_sort)

alice = bob = 0
for i, a in enumerate(A_sort):
    if i%2 == 0:
        alice += a
    else:
        bob += a
print(alice - bob)

Fixed code:
# -*- coding: utf-8 -*-

import numpy
import scipy

N = int(input())
A = list(map(int, input().split()))
#print(A)

A_sort = sorted(A, reverse=True)
#print(A_sort)

alice = bob = 0
for i, a in enumerate(A_sort):
    if i%2 == 0:
        alice += a
    else:
        bob += a

print(alice - bob)
Buggy code:
n = int(input())
L = list(map(int, input().split()))

L.sort(reverse=Ture)
print(sum(L[0::2]) - sum(L[1::2]))

Fixed code:
n = int(input())
L = list(map(int, input().split()))

L.sort(reverse=True)
print(sum(L[0::2]) - sum(L[1::2]))
Buggy code:
N = int(input())
list = map(int,input().split(" "))
cards = sorted(list,reverse=True)

if len(cards) % 2 == 0:
    alice = 0
    for i in range(int(N/2)):
        alice = alice + cards[2 * i]
        
    bob = 0
    for j in range(int(N/2)):
        bob = bob + cards[2 * j + 1]
    else:
        alice = 0
    for i in range(int(N/2) + 1):
        alice = alice + cards[2 * i]
        
    bob = 0
    for j in range(int(N/2)):
        bob = bob + cards[2 * j + 1]
    
print(alice - bob)

Fixed code:
N = int(input())
list = map(int,input().split(" "))
cards = sorted(list,reverse=True)

if len(cards) % 2 == 0:
    alice = 0
    for i in range(int(N/2)):
        alice = alice + cards[2 * i]
    bob = 0
    for j in range(int(N/2)):
        bob = bob + cards[2 * j + 1]
else:
    alice = 0
    for i in range(int(N/2) + 1):
        alice = alice + cards[2 * i]
    bob = 0
    for j in range(int(N/2)):
        bob = bob + cards[2 * j + 1]
        
print(alice - bob)