ZhenlongDai/ACPR huggingface dataset:
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = list(map(int, input().split()))
a = 0
b = 0

l.sort()
for i in range(n):
    if i%2 == 0:
        a += l[i]
    else:
        b += l[i]
print(a-b)

Failing test case input:
2
-1 123

Expected output:
124


Actual output:
-124


Fixed submission (verdict: Accepted):
n = int(input())
l = list(map(int, input().split()))
a = 0
b = 0

l = sorted(l, reverse=True)
for i in range(n):
    if i%2 == 0:
        a += l[i]
    else:
        b += l[i]
print(a-b)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
a.sort()
x = y = 0
for i, j in enumerate(a):
    if i%2 == 0:
        x += j
    else:
        y += j
print(x - y)

Failing test case input:
2
1 58

Expected output:
57


Actual output:
-57


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
x = y = 0
for i, j in enumerate(a):
    if i%2 == 0:
        x += j
    else:
        y += j
print(x - y)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = input()
a = input().split()

a.sort()
a.reverse()

alice = 0
bob = 0

a_num = len(a)

for i in range(a_num):
  if i % 2 == 0:
    alice += int(a[i])
  else:
    bob += int(a[i])

print(alice - bob)

Failing test case input:
2
-2 -31

Expected output:
29


Actual output:
-29


Fixed submission (verdict: Accepted):
N = input()
a = input().split()
a = list(map(int, a))

a.sort()
a.reverse()

alice = 0
bob = 0

a_num = len(a)

for i in range(a_num):
  if i % 2 == 0:
    alice += int(a[i])
  else:
    bob += int(a[i])

print(alice - bob)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input()
a=list(map(int,input().split()))
print(sum(a[::2])-sum(a[1::2]))

Failing test case input:
2
1 70

Expected output:
69


Actual output:
-69


Fixed submission (verdict: Accepted):
input()
a=sorted(list(map(int,input().split())))[::-1]
print(sum(a[::2])-sum(a[1::2]))

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input();a = sorted(list(map(int, input().split())));print(sum(a[:: 2]) - sum(a[1:: 2]))

Failing test case input:
2
0 64

Expected output:
64


Actual output:
-64


Fixed submission (verdict: Accepted):
input();a = sorted(list(map(int, input().split())));print(sum(a[-1::-2]) - sum(a[-2::-2]))

Problem: p03434
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
A=[int(x) for x in input().split()]
B=sorted(A)
print(B[-1])
Alice=[]
Bob=[]
while len(B)!=0 and len(B)!=1:
  Alice.append(B[-1])
  B.pop()
  Bob.append(B[-1])
  B.pop()
  print(B)
  print(len(B))
if len(B)==1:
  Alice.append(B[0])
  B.pop()
print(sum(Alice)-sum(Bob))


Failing test case input:
2
-109 215

Expected output:
324


Actual output:
215
[]
0
324


Fixed submission (verdict: Accepted):
n=int(input())
A=[int(x) for x in input().split()]
B=sorted(A)
Alice=[]
Bob=[]
while len(B)!=0 and len(B)!=1:
  Alice.append(B[-1])
  B.pop()
  Bob.append(B[-1])
  B.pop()
if len(B)==1:
  Alice.append(B[0])
  B.pop()
print(sum(Alice)-sum(Bob))
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(n):
    if i % 2 == 0:
        ans += a[i]
    else:
        ans -= a[i]
abs(ans)

Failing test case input:
2
1 -76

Expected output:
77


Actual output:

Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
ans = 0
for i in range(n):
    if i % 2 == 0:
        ans += a[i]
    else:
        ans -= a[i]
print(ans)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
a, b = 0, 0
print(l)
for i in range(len(l)):
  if i % 2 == 0:
    a += l[i]
  else:
    b += l[i]

print(abs(a-b))


Failing test case input:
2
13 -7

Expected output:
20


Actual output:
[13, -7]
20


Fixed submission (verdict: Accepted):
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
a, b = 0, 0
for i in range(len(l)):
  if i % 2 == 0:
    a += l[i]
  else:
    b += l[i]

print(abs(a-b))

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = sorted(map(int, input().split()))[::-1]
print(sum(a[::2])-sum(a[1::2]))

Failing test case input:
2
-228 336

Expected output:
564


Actual output:
2


Fixed submission (verdict: Accepted):
input()
a = sorted(map(int, input().split()))[::-1]
print(sum(a[::2])-sum(a[1::2]))

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = list(map(int, input().split()))
sorted_a = list(reversed(sorted(a)))
print(sorted_a)
alice = 0
bob = 0
for i in range(N):
    if i % 2 == 0:
        alice += sorted_a[i]
    else:
        bob += sorted_a[i]
print(alice - bob)

Failing test case input:
2
-1 -55

Expected output:
54


Actual output:
[-1, -55]
54


Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int, input().split()))
sorted_a = list(reversed(sorted(a)))
alice = 0
bob = 0
for i in range(N):
    if i % 2 == 0:
        alice += sorted_a[i]
    else:
        bob += sorted_a[i]
print(alice - bob)

Problem: p03434
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)

Failing test case input:
2
-4 30

Expected output:
34


Actual output:
-34


Fixed submission (verdict: Accepted):
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)
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())
y = [int(i) for i in input().split()]
y.sort(reverse=True)
a = 0
b = 0
for i in range(1, x+1):
    if(i%2) != 0:
        a += y[i-1]
        print(y[i-1])
    else:
        b += y[i-1]
print(a-b)

Failing test case input:
4
20 1 4 12

Expected output:
11


Actual output:
20
4
11


Fixed submission (verdict: Accepted):
x = int(input())
y = [int(i) for i in input().split()]
y.sort(reverse=True)
a = 0
b = 0
for i in range(1, x+1):
    if (i % 2) != 0:
        a += y[i-1]
    else:
        b += y[i-1]
print(a-b)

Problem: p03434
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = input().split()

a = list(map(int, a))

alice_n = a[::2]
bob_n = a[1::2]

print(sum(alice_n) - sum(bob_n))

Failing test case input:
2
-2 38

Expected output:
40


Actual output:
-40


Fixed submission (verdict: Accepted):
n = int(input())
a = input().split()

a = list(map(int, a))
a.sort(reverse=True)
alice_n = a[::2]
bob_n = a[1::2]

print(sum(alice_n) - sum(bob_n))

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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==1:
    alice+=a[i]
  else:
    bob+=a[i]
print(alice-bob)

Failing test case input:
2
17 -4

Expected output:
21


Actual output:
-21


Fixed submission (verdict: Accepted):
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)

Problem: p03434
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
a = list(map(int, input().split()))

alice = 0
bob = 0

for n in a:
    card = max(a)
    alice += card
    a.remove(card)
    card = max(a)
    bob += card
    a.remove(card)

print(alice - bob)

Failing test case input:
3
2 7 4

Expected output:
5

Actual output:
3


Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int, input().split()))

alice = 0
bob = 0

for n in range(N):
    if len(a) == 0:
        break
    card = max(a)
    alice += card
    a.remove(card)
    if len(a) == 0:
        break
    card = max(a)
    bob += card
    a.remove(card)

print(alice - bob)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(i) for i in range(N)]
A.sort()

if N == 1:
	print(A[0])
else:
	Alice = sum(A[0::2])
	Bob = sum(A[1::2])
	print(Alice-Bob)

Failing test case input:
4
139 0 2 4

Expected output:
137


Actual output:
-2


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(i) for i in input().split()]
A.sort(reverse=True)

if N == 1:
	print(A[0])
else:
	Alice = sum(A[0::2])
	Bob = sum(A[1::2])
	print(Alice-Bob)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
_, *a = map(int, open(0).read().split())
a.sort()
print(sum(a[-1::2]) - sum(a[-2::2]))


Failing test case input:
4
139 1 2 5

Expected output:
135


Actual output:
134


Fixed submission (verdict: Accepted):
_, *a = map(int, open(0).read().split())
a.sort()
print(sum(a[-1::-2]) - sum(a[-2::-2]))
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = input()

a = a.split()


for i in range(n):
	a[i] = int(a[i])
	
a.reverse()


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

Failing test case input:
4
18 4 1 3

Expected output:
16


Actual output:
-12


Fixed submission (verdict: Accepted):
n = int(input())
a = input()

a = a.split()


for i in range(n):
	a[i] = int(a[i])

a	= sorted(a)
a.reverse()

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

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = list(map(int, input().split()))
print(a)
a.sort(reverse=True)
sum1 = 0
sum2 = 0
for j in range(N):
    if j%2 == 0:
        print(a[j])
        sum1 = sum1 + a[j]
    elif j%2 ==1:
        print(a[j])
        sum2 = sum2 + a[j]
print(sum1 - sum2)


Failing test case input:
2
-1 -87

Expected output:
86


Actual output:
[-1, -87]
-1
-87
86


Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
sum1 = 0
sum2 = 0
for j in range(N):
    if j%2 == 0:
        sum1 = sum1 + a[j]
    elif j%2 ==1:
        sum2 = sum2 + a[j]
print(sum1 - sum2)

Problem: p03434
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from sys import stdin
n = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0

a.sort()

for x in range(n):
   if x % 2 == 0:
      ans -= a[x]
   else:
      ans += a[x]

print(ans)

Failing test case input:
3
3 9 4

Expected output:
8


Actual output:
-8


Fixed submission (verdict: Accepted):
from sys import stdin
n = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0

a.sort(reverse = True)

for x in range(n):
   if x % 2 == 0:
      ans += a[x]
   else:
      ans -= a[x]

print(ans)

Problem: p03434
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = [int(x) for x in input().split()]
res = 0
for i in range(n):
  if i % 2 == 0:
    res += a[i]
  else:
    res -= a[i]
print(res)

Failing test case input:
2
-4 30

Expected output:
34


Actual output:
-34


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse = True)
res = 0
for i in range(n):
  if i % 2 == 0:
    res += a[i]
  else:
    res -= a[i]
print(res)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
dat =list(input().split())

for i in dat:
	i = int(i)

dat.sort(reverse=True)

asum = 0
bsum = 0
sum=0

for i in range(len(dat)):
     asum =  dat[i]
		
print(asum)

Failing test case input:
3
3 7 4

Expected output:
6


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
dat = list(input().split())

dat = list(map(int,dat))

dat.sort(reverse=True)

asum = 0
bsum = 0

for i in range(n):
	if i % 2 == 0:
		asum = asum + dat[i]
	else:
		bsum = bsum + dat[i]
		
print(asum-bsum)
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))
Alice = 0
A.sort()
for i in range(1,N,2):
  Alice += A[i]
print(2*Alice - sum(A))

Failing test case input:
3
2 7 4

Expected output:
5

Actual output:
-5


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))
Alice = 0
A.sort(reverse=True)
for i in range(0,N,2):
  Alice += A[i]
print(2*Alice - sum(A))

Problem: p03434
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
a = sorted(map(int, input().split()[::-1]))
print(sum(a[::2]) - sum(a[1::2]))

Failing test case input:
2
0 89

Expected output:
89


Actual output:
-89


Fixed submission (verdict: Accepted):
N = int(input())
a = sorted(map(int, input().split()))[::-1]
print(sum(a[::2]) - sum(a[1::2]))

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a_list = list(map(int, input().split()))
a_list.sort(reverse=True)

Alice = 0
Bob = 0

print(a_list)

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

print(Alice-Bob)


Failing test case input:
2
1 37

Expected output:
36


Actual output:
[37, 1]
36


Fixed submission (verdict: Accepted):
N = int(input())
a_list = list(map(int, input().split()))
a_list.sort(reverse=True)

Alice = 0
Bob = 0

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

print(Alice-Bob)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
c = sorted(list(map(int, input().split())))
print(sum(c[0::2]) - sum(c[1::2]))

Failing test case input:
2
-1 -55

Expected output:
54


Actual output:
-54


Fixed submission (verdict: Accepted):
n = int(input())
c = sorted(list(map(int, input().split())), reverse = True)
print(sum(c[0::2]) - sum(c[1::2]))

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = input()

nums = list(map(int, a.split()))

alice = []
bob = []
for na in range(int(n / 2)):
    maxn = max(nums)
    alice.append(maxn)
    nums.remove(maxn)

    maxn = max(nums)
    bob.append(maxn)
    nums.remove(maxn)

print(sum(alice) - sum(bob))


Failing test case input:
3
3 7 4

Expected output:
6


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
a = input()

nums = list(map(int, a.split()))

alice = []
bob = []
for na in range(int(n)):
    if na == 0 or na % 2 == 0:
        maxn = max(nums)
        alice.append(maxn)
        nums.remove(maxn)
    else:
        maxn = max(nums)
        bob.append(maxn)
        nums.remove(maxn)

print(sum(alice) - sum(bob))
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)

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

print("{}".format(Alice - Bob))

Failing test case input:
4
47 4 2 5

Expected output:
44


Actual output:
2


Fixed submission (verdict: Accepted):
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("{}".format(Alice - Bob))

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
ans=0
for i in range(0,n,2):
  ans+=i
for i in range(1,n,2):
  ans-=i
print(ans)

Failing test case input:
2
1 -27

Expected output:
28


Actual output:
-1


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
ans=0
for i in range(0,n,2):
  ans+=a[i]
for i in range(1,n,2):
  ans-=a[i]
print(ans)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
card = list(map(int,input().split()))

card.reverse()

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

print(alice - bob)

Failing test case input:
2
1 -27

Expected output:
28


Actual output:
-28


Fixed submission (verdict: Accepted):
N = int(input())
card = list(map(int,input().split()))

card.sort(reverse=True)

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

print(alice - bob)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)
alice=a[::2]
bob=list(filter(lambda x:x not in alice,a))
print(sum(alice)-sum(bob))

Failing test case input:
4
20 18 2 18

Expected output:
18

Actual output:
36


Fixed submission (verdict: Accepted):
n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)
alice=a[::2]
bob=a[1::2]
print(sum(alice)-sum(bob))
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
cards_number = input()
numbers = list(map(int, cards_number.split()))
ordered_numbers = sorted(numbers, reverse=True)

even_indexes = list(num for num in range(0, N) if num % 2 == 0)
odd_indexes = list(num for num in range(0, N) if num % 2 == 1)
alice_cards = list(ordered_numbers[even_index] for even_index in even_indexes)
bob_cards = list(ordered_numbers[odd_index] for odd_index in odd_indexes)

alice_point = sum(alice_cards)
bob_point = sum(bob_cards)

Failing test case input:
2
-15 81

Expected output:
96


Actual output:

Fixed submission (verdict: Accepted):
N = int(input())
cards_number = input()
numbers = list(map(int, cards_number.split()))
ordered_numbers = sorted(numbers, reverse=True)

even_indexes = list(num for num in range(0, N) if num % 2 == 0)
odd_indexes = list(num for num in range(0, N) if num % 2 == 1)
alice_cards = list(ordered_numbers[even_index] for even_index in even_indexes)
bob_cards = list(ordered_numbers[odd_index] for odd_index in odd_indexes)

alice_point = sum(alice_cards)
bob_point = sum(bob_cards)

print(alice_point-bob_point)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
list_an = input().split()
list_an_int = [int(s) for s in list_an]

list_an_int.sort()
list_an_int.reverse()

print(list_an_int)
Alice_counter = 0
Bob_counter = 0

counter = 0
for i in range(N):
    if counter % 2 == 0:
        Alice_counter += list_an_int[i]
    else:
        Bob_counter += list_an_int[i]
    counter += 1
print(Alice_counter - Bob_counter)


Failing test case input:
2
-1 152

Expected output:
153


Actual output:
[152, -1]
153


Fixed submission (verdict: Accepted):
N = int(input())
list_an = input().split()
list_an_int = [int(s) for s in list_an]

list_an_int.sort()
list_an_int.reverse()

Alice_counter = 0
Bob_counter = 0

counter = 0
for i in range(N):
    if counter % 2 == 0:
        Alice_counter += list_an_int[i]
    else:
        Bob_counter += list_an_int[i]
    counter += 1
print(Alice_counter - Bob_counter)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
X = list(map(int, input().split(' ')))

X.sort()

x = sum(X)
b = sum(X[0::2])
a = x - b

print(a-b)

Failing test case input:
3
2 7 4

Expected output:
5

Actual output:
-5


Fixed submission (verdict: Accepted):
n = int(input())
X = list(map(int, input().split(' ')))

X.sort(reverse = True)

x = sum(X)
a = sum(X[0::2])

b = x - a

print(a-b)

Problem: p03434
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
a = list(map(int, input().split()))
a.sort()
al=0
bo=0
for i in range(n):
  if i%2==0:
    al+=a[i]
  else:
    bo+=a[i]
print(al-bo)

Failing test case input:
2
-2 -87

Expected output:
85


Actual output:
-85


Fixed submission (verdict: Accepted):
n=int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
al=0
bo=0
for i in range(n):
  if i%2==0:
    al+=a[i]
  else:
    bo+=a[i]
print(al-bo)
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
  n = int(input())
  l = list(map(int, input().split()))
  l.sort(reverse=True)
  ans = 0
  for i in range(len(l)):
    if i%2 == 0:
      ans += i
    else:
      ans -= i
  print(ans)

if __name__ == "__main__":
  main()
  

Failing test case input:
2
-43 123

Expected output:
166


Actual output:
-1


Fixed submission (verdict: Accepted):
def main():
  ans = 0
  n = int(input())
  l = list(map(int, input().split()))
  l.sort(reverse=True)
  for i in range(len(l)):
    if i % 2 == 0:
      ans += l[i]
    else:
      ans -= l[i]
  print(ans)

if __name__ == '__main__':
  main()

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
alice = sum(A[::2])
bob = sum(A[:1:2])
print(alice - bob)


Failing test case input:
4
33 4 1 3

Expected output:
31


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
alice = sum(A[::2])
bob = sum(A[1::2])
print(alice - bob)

Problem: p03434
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
a = list(map(int, input().split()))

al=0
bo=0
for i in range(n):
  if i%2==0:
    al+=a[i]
  else:
    bo+=a[i]
print(al-bo)

Failing test case input:
4
23 4 0 12

Expected output:
15


Actual output:
7


Fixed submission (verdict: Accepted):
n=int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
al=0
bo=0
for i in range(n):
  if i%2==0:
    al+=a[i]
  else:
    bo+=a[i]
print(al-bo)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

B=0
A=0
N = int(input())
l = map(int, input().split())

l = list(sorted(l))

for i in range(1, N):
    B+=l[N-i]
    A+=l[N-i-1]

    
print(B-A)

Failing test case input:
4
93 4 2 5

Expected output:
90


Actual output:
91


Fixed submission (verdict: Accepted):
S=0
N = int(input())
l = map(int, input().split())

l = list(sorted(l))

for i in range(1, N+1):
    if i%2 == 1:
        S+=l[N-i]
        
    else:
        S-=l[N-i]
        
            


print(S)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = list(map(int, input().split(' ')))

l.sort()
l.reverse()

result = 0

for e in enumerate(l):
    result += e[1] if e[0] % 2 else -e[1]

print(result)

Failing test case input:
2
-23 81

Expected output:
104


Actual output:
-104


Fixed submission (verdict: Accepted):
n = int(input())
l = list(map(int, input().split(' ')))

l.sort()
l.reverse()

result = 0

for e in enumerate(l):
    result += e[1] if e[0] % 2 == 0 else -e[1]

print(result)
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
alice = sum([i for i in a if i%2 == 0])
bob = sum([i for i in a if i%2 == 1])
print(alice-bob)


Failing test case input:
4
139 0 2 4

Expected output:
137


Actual output:
-133


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
alice = sum([a[i] for i in range(0,n,2)])
bob = sum([a[i] for i in range(1,n,2)])
print(alice-bob)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def card_game():
    n = int(input())
    a_li = [int(i) for i in input().split()]
    ans = 0
    turn_switch = True

    a_li.sort()

    for i in a_li:
        if turn_switch:
            ans += i
            turn_switch = False
        else:
            ans -= i
            turn_switch = True

    return ans


if __name__ == '__main__':
    print(card_game())

Failing test case input:
2
1 -58

Expected output:
59


Actual output:
-59


Fixed submission (verdict: Accepted):
def card_game():
    n = int(input())
    a_li = [int(i) for i in input().split()]
    ans = 0
    turn_switch = True

    li = sorted(a_li, reverse=True)

    for i in li:
        if turn_switch:
            ans += i
            turn_switch = False
        else:
            ans -= i
            turn_switch = True

    return ans


if __name__ == '__main__':
    print(card_game())

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
Alice = 0
for i in range(0, n, 2):
    print(i)
    Alice += l[i]
Bob = sum(l) - Alice
print(abs(Bob - Alice))


Failing test case input:
2
-2 54

Expected output:
56


Actual output:
0
56


Fixed submission (verdict: Accepted):
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
Alice = 0
for i in range(0, n, 2):
    Alice += l[i]
Bob = sum(l) - Alice
print(abs(Bob - Alice))

Problem: p03434
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
s=0
a.reverse()
s=sum(a[::2])-sum(a[1::2])
print(s)


Failing test case input:
2
17 -4

Expected output:
21


Actual output:
-21


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
s=0
a.sort()
s=sum(a[:n:2])-sum(a[1:n:2])
if s>0:
    print(s)
else:
    print(-s)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n = int(input())
cards = sorted(list(map(int, input().split())), reverse=True)

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

Failing test case input:
2
0 89

Expected output:
89


Actual output:
[89, 0]
89


Fixed submission (verdict: Accepted):

n = int(input())
cards = sorted(list(map(int, input().split())), reverse=True)

alice = 0
bob = 0
for i in range(n):
    a = cards[i]
    if i % 2:
        bob += a
    else:
        alice += a
print(alice-bob)
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A =[i for i in input().split()]
A = sorted(A,reverse=True)
Alice = 0
Bob = 0
while len(A) != 0:
    Alice += int(A.pop(0))
    if len(A) == 0:
        break
    else:
        Bob += int(A.pop(0))
print(Alice - Bob)

Failing test case input:
4
139 1 2 5

Expected output:
135


Actual output:
141


Fixed submission (verdict: Accepted):
N = int(input())
A =[i for i in map(int,input().split())]
A = sorted(A,reverse=True)
Alice = 0
Bob = 0
while len(A) != 0:
    Alice += int(A.pop(0))
    if len(A) == 0:
        break
    else:
        Bob += int(A.pop(0))

print(Alice - Bob)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))

A.sort(reverse=True)
print(A)
print((sum(A[::2])) - sum(A[1::2]))

Failing test case input:
2
-65 215

Expected output:
280


Actual output:
[215, -65]
280


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))

A.sort(reverse=True)
print((sum(A[::2])) - sum(A[1::2]))

Problem: p03434
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
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_)


Failing test case input:
2
4 -1

Expected output:
5


Actual output:
-5


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
sum_ = sum(a)
a.sort()

alice = 0
for i in range(len(a)):
    if i % 2 == 0:
        
        alice += a[-i-1]
print(2*alice - sum_)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
for i in range(n):
    if i % 2 == 1:
        ans1 += a[i]
    else:
        ans2 += a[i]
print(max(ans1,ans2))

Failing test case input:
2
0 -24

Expected output:
24


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
a = sorted(list(map(int,input().split())),reverse = True)
ans1 = 0
ans2 = 0
for i in range(n):
    if i % 2 == 0:
        ans1 += a[i]
    else:
        ans2 += a[i]
print(ans1-ans2)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(i) for i in input().split()]

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

Alice_point = 0; Bob_point = 0

for i in range(N):
    
    if i % 2 == 0:
        print("Alice=",i)
        Alice_point += A_sorted[i]
    else:
        print("Bob=",i)
        Bob_point += A_sorted[i]
    
ans = Alice_point - Bob_point

print(ans)

Failing test case input:
2
-316 336

Expected output:
652


Actual output:
[336, -316]
Alice= 0
Bob= 1
652


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(i) for i in input().split()]

A_sorted = sorted(A, reverse=True)

Alice_point = 0; Bob_point = 0

for i in range(N):
    
    if i % 2 == 0:
        Alice_point += A_sorted[i]
    else:
        Bob_point += A_sorted[i]
    
ans = Alice_point - Bob_point

print(ans)
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=sorted(map(int,input().split()))

A=0
B=0

for i in range(n):
 if i%2 ==1:
  A += a[i]
 else:
  B += a[i]

print(A-B)

Failing test case input:
3
2 7 4

Expected output:
5

Actual output:
-5


Fixed submission (verdict: Accepted):
n=int(input())
a=sorted(map(int,input().split()),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)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
if __name__ == '__main__':
    n = int(input())
    k = [int(i) for i in input().split()]
    a = 0
    b = 0
    k.sort(reverse=True)
    print(k)
    flag = True
    for i in k:
        if flag == True:
            a+=i
            flag=False
        else:
            b+=i
            flag=True
    print(a-b)


Failing test case input:
2
-1 36

Expected output:
37


Actual output:
[36, -1]
37


Fixed submission (verdict: Accepted):
if __name__ == '__main__':
    n = int(input())
    k = [int(i) for i in input().split()]
    a = 0
    b = 0
    k.sort(reverse=True)
    flag = True
    for i in k:
        if flag == True:
            a+=i
            flag=False
        else:
            b+=i
            flag=True
    print(a-b)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
b,c=0,0
for i in range(n):
    print(i)
    if i%2==1:
        b+=a[-i-1]
    else:
        c+=a[-i-1]
print(c-b)

Failing test case input:
2
0 -74

Expected output:
74


Actual output:
0
1
74


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
b,c=0,0
for i in range(n):
    if i%2==1:
        b+=a[-i-1]
    else:
        c+=a[-i-1]
print(c-b)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split(" ")))

A = sorted(A,reverse=True)
print(A)
a_sum = 0
b_sum = 0
for i in range(len(A)):
    if i%2==0:
        a_sum+= A[i]
    else:
        b_sum += A[i]

print(a_sum-b_sum)

Failing test case input:
2
-43 215

Expected output:
258


Actual output:
[215, -43]
258


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split(" ")))
A = sorted(A,reverse=True)
a_sum = 0
b_sum = 0
for i in range(len(A)):
    if i%2==0:
        a_sum+= A[i]
    else:
        b_sum += A[i]

print(a_sum-b_sum)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = int(input())
b = list(map(int,input().split()))
b.sort()
c = sum(b[::2])
d = sum(b[1::2])
print(d-c)

Failing test case input:
3
3 9 4

Expected output:
8


Actual output:
-8


Fixed submission (verdict: Accepted):
a = int(input())
b = list(map(int,input().split()))
b.sort(reverse=True)
c = sum(b[::2])
d = sum(b[1::2])
print(c-d)
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=int(input())
b=[int(i) for i in input().split()]
c=sorted(b)

d=sum(c[0::2])
e=sum(c[1::2])
print(e-d)


Failing test case input:
3
3 9 4

Expected output:
8


Actual output:
-8


Fixed submission (verdict: Accepted):
a=int(input())
b=[int(i) for i in input().split()]
c=sorted(b)

d=sum(c[0::2])
e=sum(c[1::2])
print(abs(e-d))

Problem: p03434
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a_list = list(map(int, input().split()))
print(a_list)

a_list.sort(reverse = True)
alice_sum = 0
bob_sum = 0
for i in range(len(a_list)):
    if i % 2 == 0:
        alice_sum += a_list[i]
    else:
        bob_sum += a_list[i]

print(alice_sum - bob_sum)

Failing test case input:
2
-1 45

Expected output:
46


Actual output:
[-1, 45]
46


Fixed submission (verdict: Accepted):
n = int(input())
a_list = list(map(int, input().split()))

a_list.sort(reverse = True)
alice_sum = 0
bob_sum = 0
for i in range(len(a_list)):
    if i % 2 == 0:
        alice_sum += a_list[i]
    else:
        bob_sum += a_list[i]

print(alice_sum - bob_sum)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
Aseq=input().split()
A=[]
for i in range(n):
    A.append(int(Aseq[i]))
A.sort()
AA=A[0::2]
AB=A[1::2]
print(sum(AA)-sum(AB))

Failing test case input:
2
0 171

Expected output:
171


Actual output:
-171


Fixed submission (verdict: Accepted):
n=int(input())
Aseq=input().split()
A=[]
for i in range(n):
    A.append(int(Aseq[i]))
A.sort(reverse=True)
AA=A[0::2]
AB=A[1::2]
print(sum(AA)-sum(AB))

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
alice = 0
bob = 0
cards = [int(val) for val in input().split()]

cards = sorted(cards, reverse=True)

print(cards)

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

Failing test case input:
2
2 32

Expected output:
30


Actual output:
[32, 2]
30


Fixed submission (verdict: Accepted):
n = int(input())
alice = 0
bob = 0
cards = [int(val) for val in input().split()]

cards = sorted(cards, reverse=True)

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

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
card = list(map(int,input().split()))
card = sorted(card,reverse=True)
alice = 0
bob = 0

print(card)
for i,who in enumerate(card):
    if i % 2 ==0:
        alice += who
    else:
        bob += who

print(alice-bob)


Failing test case input:
4
139 1 2 5

Expected output:
135


Actual output:
[139, 5, 2, 1]
135


Fixed submission (verdict: Accepted):
n = int(input())
card = list(map(int,input().split()))
card = sorted(card,reverse=True)
alice = 0
bob = 0


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

print(alice-bob)
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
num = input().split(" ")

num.sort(reverse=True)

A = 0
B = 0
t=0
for i in num:
    if t%2==0:
        A+=int(i)
        print(i)
        print(t)
    else:
        B+=int(i)
    t+=1
print(A-B)

Failing test case input:
4
139 1 2 5

Expected output:
135


Actual output:
4
0
4


Fixed submission (verdict: Accepted):
n = input()
num = [i for i in map(int,input().split(" "))]

num.sort(reverse=True)

A = 0
B = 0
t=0
for i in num:
    if t%2==0:
        A+=int(i)
    else:
        B+=int(i)
    t+=1
print(A-B)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))
Alice = 0
A.sort()
for i in range(0,N,2):
  Alice += A[i]
print(2*Alice - sum(A))

Failing test case input:
2
0 -84

Expected output:
84


Actual output:
-84


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))
Alice = 0
A.sort(reverse=True)
for i in range(0,N,2):
  Alice += A[i]
print(2*Alice - sum(A))

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
card = list(map(int,input().split()))

card.sort()

asum = 0
bsum = 0
for i in range(n):
  if n%2==0:
    asum += card[i]
  else:
    bsum += card[i]

print(asum-bsum)

Failing test case input:
2
0 -100

Expected output:
100


Actual output:
-100


Fixed submission (verdict: Accepted):
n = int(input())
card = list(map(int,input().split()))

card.sort(reverse=True)

asum = 0
bsum = 0
for i in range(n):
  if i%2==0:
    asum += card[i]
  else:
    bsum += card[i]

print(asum-bsum)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
cards = [int(i) for i in input().split()]
cards.sort(reverse=True)

diff = 0

for idx, i in enumerate(cards):
	if idx % 2 == 0:
		diff += i
	else:
		diff -= i

print(diff)

Failing test case input:
2
0 64

Expected output:
64


Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
cards = [int(i) for i in input().split()]
cards.sort(reverse=True)

diff = 0

for idx, i in enumerate(cards):
	if idx % 2 == 0:
		diff += i
	else:
		diff -= i

print(diff)

Problem: p03434
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
s=0
a.reverse()
s=sum(a[:n:2])-sum(a[1:n:2])
print(s)

Failing test case input:
4
139 0 2 4

Expected output:
137


Actual output:
-137


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
s=0
a.sort()
s=sum(a[:n:2])-sum(a[1:n:2])
if s>0:
    print(s)
else:
    print(-s)
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
A = list(map(int,input().split()))
Alice_card = []
Bob_card = []
for i in range(n):
        if i%2 == 0:
                Alice_card.append(A[i])
        else:
                Bob_card.append(A[i])
Alice_total = sum(Alice_card)
Bob_total = sum(Bob_card)
print(abs(Alice_total - Bob_total))

Failing test case input:
3
2 7 4

Expected output:
5

Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
A = list(map(int,input().split()))
A = sorted(A)
Alice_card = []
Bob_card = []
for i in range(n):
        if i%2 == 0:
                Alice_card.append(A[i])
        else:
                Bob_card.append(A[i])
Alice_total = sum(Alice_card)
Bob_total = sum(Bob_card)
print(abs(Alice_total - Bob_total))

Problem: p03434
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
l = sorted(map(int, input().split()))
a = 0
b = 0
for i in range(n):
  if i % 2 == 0:
  	a += l.pop()
  else:
    b += l.pop()
print(a)

Failing test case input:
2
-1 36

Expected output:
37


Actual output:
36


Fixed submission (verdict: Accepted):
n = int(input())
l = sorted(map(int, input().split()))
a = 0
b = 0
for i in range(n):
  if i % 2 == 0:
  	a += l.pop()
  else:
    b += l.pop()
print(a - b)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a_sort = sorted(a, reverse=True)
    alice = 0
    bob = 0
    for i in range(n):
        print(i)
        if i % 2 == 0:
            alice += a_sort[i]
        else:
            bob += a_sort[i]
    res = alice - bob
    print(res)
if __name__ == '__main__':
    main()

Failing test case input:
2
0 -100

Expected output:
100


Actual output:
0
1
100


Fixed submission (verdict: Accepted):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a_sort = sorted(a, reverse=True)
    alice = 0
    bob = 0
    for i in range(n):
        if i % 2 == 0:
            alice += a_sort[i]
        else:
            bob += a_sort[i]
    res = alice - bob
    print(res)
if __name__ == '__main__':
    main()

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
2
0 -18

Expected output:
18


Actual output:
-18


Fixed submission (verdict: Accepted):
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)
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
l = list(map(int,input().split()))
l_r = sorted(l,reverse=True)
Alice = l_r[::2]
Bob = l_r[1::2]

m =0
n = 0
for i in Alice:
    m += i
for j in Bob:
    n += j
print({m-n})


Failing test case input:
2
-4 30

Expected output:
34


Actual output:
{34}


Fixed submission (verdict: Accepted):















































N = int(input())
l = list(map(int,input().split()))
l_r = sorted(l,reverse=True)
Alice = l_r[::2]
Bob = l_r[1::2]

m =0
n = 0
for i in Alice:
    m += i
for j in Bob:
    n += j
print(m-n)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
S=0
for i in range(N):
  if i%2==1:
    S+=a[i]
  else:
    S-=a[i]
print(S)

Failing test case input:
4
47 4 1 5

Expected output:
45


Actual output:
-45


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

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
SA = sorted(A,reverse=True)
ALI =0
BOB=0
for i in range(1,N,2):
    ALI += SA[i]
for n in range(2,N,2):
    BOB += SA[n]
ans = ALI - BOB
print(ans)

Failing test case input:
2
-1 36

Expected output:
37


Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
SA = sorted(A,reverse=True)
ALI =0
BOB=0
for i in range(0,N,2):
    ALI += int(SA[i])
for n in range(1,N,2):
    BOB += int(SA[n])
ans = ALI - BOB
print(ans)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(a) for a in input().split()]
A.sort()
d = 0
for a in A[::2]:
  d += a
for a in A[1::2]:
  d -= a
print(d)


Failing test case input:
2
-316 336

Expected output:
652


Actual output:
-652


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(a) for a in input().split()]
A.sort()
A.reverse()
d = 0
for a in A[::2]:
  d += a
for a in A[1::2]:
  d -= a
print(d)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

a = list(map(int, input().split()))
Alice = 0
Bob = 0



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

print(Alice -Bob)




Failing test case input:
2
-23 123

Expected output:
146


Actual output:
-146


Fixed submission (verdict: Accepted):
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+=a[i]
  else:
    Bob+=a[i]

print(Alice -Bob)
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)


Failing test case input:
2
2 32

Expected output:
30


Actual output:
[2, 32]
alice 32
bob 2
30


Fixed submission (verdict: Accepted):
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)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
alist = input().split()
alist = sorted(alist, reverse=True)
count = 1
alice = 0
bob = 0

for a in alist:
    if count % 2:
        alice += int(a)
    else:
        bob += int(a)
    count = count + 1
print(alice - bob)

Failing test case input:
4
47 4 2 5

Expected output:
44


Actual output:
-40


Fixed submission (verdict: Accepted):
N = int(input())
alist = input().split()
aint = list(map(int, alist))
aint = sorted(aint, reverse=True)
count = 1
alice = 0
bob = 0

for a in aint:
    if count % 2:
        alice += a
    else:
        bob += a
    count = count + 1
print(alice - bob)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
cards = sorted(list(map(int, input().split())))

alice = 0
bob = 0
for i in range(N):
  if i % 2 == 0:
    alice += cards[i]
  else:
    bob += cards[i]

print(alice-bob)

Failing test case input:
2
-2 123

Expected output:
125


Actual output:
-125


Fixed submission (verdict: Accepted):
N = int(input())
cards = sorted(list(map(int, input().split())), reverse=True)

alice = 0
bob = 0
for i in range(N):
  if i % 2 == 0:
    alice += cards[i]
  else:
    bob += cards[i]

print(alice-bob)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
numbers = list(map(int, input().split()))
Alice_point = 0
Bob_point = 0

numbers.sort()
print(numbers)

while True:
    try:
        Alice_point += numbers[0]
        Bob_point += numbers[1]
        numbers.remove(numbers[0])
        numbers.remove(numbers[0])
    except IndexError:
        break

print(Alice_point - Bob_point)

Failing test case input:
2
-4 30

Expected output:
34


Actual output:
[-4, 30]
-34


Fixed submission (verdict: Accepted):
N = int(input())
numbers = list(map(int, input().split()))
Alice_point = 0
Bob_point = 0

numbers.sort(reverse=True)

while True:
    try:
        Alice_point += numbers[0]
        Bob_point += numbers[1]
        numbers.remove(numbers[0])
        numbers.remove(numbers[0])
    except IndexError:
        break

print(Alice_point - Bob_point)
Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
cards = list(map(int, input().split()))

alice = 0
bob = 0
for i in range(N):
  if i % 2 == 0:
    alice += cards[i]
  else:
    bob += cards[i]

print(alice-bob)

Failing test case input:
3
3 7 4

Expected output:
6


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
cards = sorted(list(map(int, input().split())), reverse=True)

alice = 0
bob = 0
for i in range(N):
  if i % 2 == 0:
    alice += cards[i]
  else:
    bob += cards[i]

print(alice-bob)

Problem: p03434
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=sorted(map(int,input().split()))

A=0
B=0

for i in range(n):
 if i%2 ==0:
  A += a[i]
 else:
  B += a[i]

print(A-B)

Failing test case input:
2
-1 -28

Expected output:
27


Actual output:
-27


Fixed submission (verdict: Accepted):
n=int(input())
a=sorted(map(int,input().split()),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)