qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N = int(input())
A = sorted(list( map( int, input().split() ) ), reverse=True)
Alice = 0
Bob = 0
for i in range(0,N,2):
    Alice += A[i]
    Bob += A[i+1]
print(Alice-Bob)

Fixed code:
N = int(input())
A = sorted(list( map( int, input().split() ) ), reverse=True)
Alice = 0
Bob = 0
for i in range(0,N,2):
    Alice += A[i]
    if i+1 <= N-1:
        Bob += A[i+1]
print(Alice-Bob)
Buggy code:
N = int(input())

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

# print(a)

for i in range(len(a)):
  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()
a.reverse()

Alice = 0
Bob = 0

# print(a)


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

print(Alice -Bob)
Buggy code:
n = input()
num = [i for i in map(int,input().split(" "))]

num.sort(reverse=True)

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


Fixed code:
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)
Buggy code:
input()
li = list(map(int, input().split()))
li.sort(reverse=True)
alice = [i for index,i in enumerate(li) if index % 2 == 0]
ans = alice * 2 - sum(li)
print(alice)

Fixed code:
input()
li = list(map(int, input().split()))
li.sort(reverse=True)
alice = sum([i for index,i in enumerate(li) if index % 2 == 0])
ans = alice * 2 - sum(li)
print(ans)
Buggy code:
N = int(input())
a = list(map(int, input().split()))

a.sort()

alice = sum(a[0::2])
bob = sum(a[1::2])

print(alice - bob)


Fixed code:
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:
def draw_max_card(card_list):
    max_card = max(card_list)
    card_list.remove(max_card)
    return max_card

n = int(input())
card_list = list(map(int, input().split(" ")))
points_alice = 0
points_bob  = 0
for count in range(1, n + 1):
    print(count)
    if count % 2 != 0:
        points_alice += draw_max_card(card_list)
    else:
        points_bob += draw_max_card(card_list)


Fixed code:
def draw_max_card(card_list):
    max_card = max(card_list)
    card_list.remove(max_card)
    return max_card

n = int(input())
card_list = list(map(int, input().split(" ")))
points_alice = 0
points_bob  = 0
for count in range(1, n + 1):
    if count % 2 != 0:
        points_alice += draw_max_card(card_list)
    else:
        points_bob += draw_max_card(card_list)

print(points_alice - points_bob)
Buggy code:
N=int(input())

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

a.sort(reverse=True)
A=[]
B=[]

for i,k in enumerate(a):
    if i%2 == 0:
        A.append(a[i])
               
               
    elif i%2 == 1:
        B.append(a[i])
        
    print(i)    
print(sum(A)-sum(B))  

Fixed code:
N=int(input())

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

a.sort(reverse=True)
A=[]
B=[]

for i,k in enumerate(a):
    if i%2 == 0:
        A.append(a[i])
               
               
    elif i%2 == 1:
        B.append(a[i])
        
    
print(sum(A)-sum(B))
Buggy code:
n = int(input())
a = list(map(int,input().split()))
a.sort()
c = 0
d = 0
for i in range(n):
    if i % 2 == 0:
        c += a[i]
    else:
        d += a[i]
print(c-d)

Fixed code:
n = int(input())
a = list(map(int,input().split()))
a.sort()
a.reverse()
c = 0
d = 0
for i in range(n):
    if i % 2 == 0:
        c += a[i]
    else:
        d += a[i]
print(c-d)
Buggy code:
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))


Fixed code:
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))
Buggy code:
n = int(input())
a_list = [int(x) for x in input().split()]
alice = bob = []
for i, a in enumerate(sorted(a_list, reverse=True)):
    if i % 2 == 0:
        alice.append(a)
    else:
        bob.append(a)
print(sum(alice) - sum(bob))


Fixed code:
n = int(input())
a_list = [int(x) for x in input().split()]
alice = bob = 0
for i, a in enumerate(sorted(a_list, reverse=True)):
    if i % 2 == 0:
        alice += a
    else:
        bob += a
print(alice - bob)
Buggy code:
N = int(input())
a = [int(x) for x in input().split()]
a.sort()
a.reverse()
alice = 0
bob = 0
i = 0

while 2 * i + 1 <= len(a) - 1:
    alice = alice + a[2 * i]
    bob = bob + a[2 * i + 1]
    i += 1

print(alice - bob)

Fixed code:
N = int(input())
a = [int(x) for x in input().split()]
a.sort()
a.reverse()
bob = 0
i = 0
while 2*i + 1 < len(a):
    a[2*i + 1] = -a[2*i + 1]
    i += 1

print(sum(a))
Buggy code:
n = int(input())
a = str(input()).split()
for i in range(0,n):
    a[i] = int(a[i])
a.sort(reverse=True)

sumn = 0
summ = 0
for i in range(0,n,2):
    sumn += a[i]     
for i in range(1,n,2):
    summ += a[i]
sumn-summ

Fixed code:
n = int(input())
a = str(input()).split()
for i in range(0,n):
    a[i] = int(a[i])
a.sort(reverse=True)

sumn = 0
summ = 0
for i in range(0,n,2):
    sumn += a[i]     
for i in range(1,n,2):
    summ += a[i]
print(sumn-summ)
Buggy code:
n = int(input())
l = [int(x) for x in input().split()]
a = 0
b = 0
for i in range(n):
  if i % 2 == 0:
    a += max(l)
    l = l.remove(max(l))
  elif i % 2 == 1:
    b += max(l)
    l = l.remove(max(l))
print(a-b)

Fixed code:
n = int(input())
l = [int(x) for x in input().split()]
a = 0
b = 0
for i in range(n):
  if i % 2 == 0:
    a += max(l)
    l.remove(max(l))
  elif i % 2 == 1:
    b += max(l)
    l.remove(max(l))
print(a-b)
Buggy code:
n = input()
a = list(map(int, input().split()))
A = 0
B = 0

a.sort(reverse=True)

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()))
A = 0
B = 0

a.sort(reverse=True)

for i in range(n):
  if i % 2 == 0:
    A += a[i]
  else:
    B += a[i]
    
print(A-B)
Buggy code:
N = int(input())
A = sorted(map(int, input().split()), reverse = True)

print(sum(A[: : 2]) - sum(A[: : -2]))

Fixed code:
N = int(input())
A = sorted(map(int, input().split()), reverse = True)
 
print(sum(A[0: : 2]) - sum(A[1: : 2]))
Buggy code:
times = int(input())
ans = 0
type = 1
num = map(int,input().split(" "))
num.sort(reverse=Ture)
for i in num:
    if type % 2:
        ans += i
    else:
        ans -= i
    type += 1
    
print(ans)

Fixed code:
times = int(input())
ans = 0
type = 1
num = list(map(int,input().split(" ")))
num.sort(reverse=True)
for i in num:
    if type % 2:
        ans += i
    else:
        ans -= i
    type += 1
    
print(ans)
Buggy code:
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)

Fixed code:
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)
Buggy code:
n = int(input())
a = [int(i) for i in input().split()]
alice = 0
bob = 0

a.sort()
for i in range(0, n, 2):
  alice += a[n-i]
  bob += a[n-i-1]

    
print(alice-bob)

Fixed code:
n = int(input())
a = [int(i) for i in input().split()]
alice = 0
bob = 0
 
a.sort()
for i in range(1, n+1, 2):
  alice += a[n-i]
  if n-i-1 >= 0:
    bob += a[n-i-1]

    
print(alice-bob)
Buggy code:
n = int(input())
a = [int(i) for i in input().split()]
alice = 0
bob = 0

while a != []:
  alice += max(a)
  a.remove(max(a))
  bob += max(a)
  try:
    a.remove(max(a))
  except:
    break
    
print(alice-bob)

Fixed code:
n = int(input())
a = [int(i) for i in input().split()]
alice = 0
bob = 0

while a != []:
  alice += max(a)
  a.remove(max(a))
  try:
  	bob += max(a)
  except:
    break
  try:
    a.remove(max(a))
  except:
    break
    
print(alice-bob)
Buggy code:
n = int(input())
lis = [int(x) for x in input().split(" ")]
lis.sort(reverse=True)
lis_Alice = []
lis_Bob = []

for a in range(0, n, 2):
  lis_Alice.append(lis[a])

for b in range(1, n+1, 2):
  lis_Bob.append(lis[b])

print(sum(lis_Alice) - sum(lis_Bob))

Fixed code:
n = int(input())
lis = [int(x) for x in input().split(" ")]
lis.sort(reverse=True)
lis_Alice = []
lis_Bob = []

if n % 2 == 0:
  for a in range(0, n, 2):
    lis_Alice.append(lis[a])
  for b in range(1, n+1, 2):
    lis_Bob.append(lis[b])
else:
  for a in range(0, n+1, 2):
    lis_Alice.append(lis[a])
  for b in range(1, n, 2):
    lis_Bob.append(lis[b]) 

print(sum(lis_Alice) - sum(lis_Bob))
Buggy code:
n = int(input())
a_list = list(map(int,input().split()))
s_a_list = sorted(a_list)
alice = 0
bob = 0
while len(s_a_list)>0:
  alice += s_a_list.pop(-1)
  bob += s_a_list.pop(-1)
print(alice-bob)

Fixed code:
n = int(input())
a_list = list(map(int,input().split()))
s_a_list = sorted(a_list)
alice = 0
bob = 0
while len(s_a_list)>1:
  alice += s_a_list.pop(-1)
  bob += s_a_list.pop(-1)
if len(s_a_list) != 0:
  alice += s_a_list.pop(-1)
print(alice-bob)
Buggy code:

n = int(input())

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

Alice = 0
for i in range(0,n//2+1,2):
    Alice += a[i]

Bob = sum(a)-Alice

print(Alice-Bob)


Fixed code:

n = int(input())

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

Alice = 0
for i in range(0,n,2):
    Alice += a[i]

Bob = sum(a)-Alice

print(Alice-Bob)
Buggy code:
n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reversed = True)
Alice_hand = a[::2]
Bob_hand = a[1::2]
ans = sum(Alice_hand) - sum(Bob_hand)
print(ans)


Fixed code:
n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse = True)
Alice_hand = a[::2]
Bob_hand = a[1::2]
ans = sum(Alice_hand) - sum(Bob_hand)
print(ans)
Buggy code:
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
if n%2 == 1:
  a.append(0)
s = 0
for i in range(n//2):
  s += a[2*i]-a[2*i+1]
print(s)
  

Fixed code:
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
if n%2 == 1:
  a.append(0)
  n += 1
s = 0
for i in range(n//2):
  s += a[2*i]-a[2*i+1]
print(s)
Buggy code:
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    a.sort()
    sw = 0
    alice = 0
    bob = 0
    for i in a:
        if sw == 0:
            alice += i
            sw = 1
        else:
            bob += i
            sw = 0
    print(alice-bob)

if __name__ == '__main__':
    main()


Fixed code:
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    a.sort(reverse=True)
    sw = 0
    alice = 0
    bob = 0
    for i in a:
        if sw == 0:
            alice += i
            sw = 1
        else:
            bob += i
            sw = 0
    print(alice-bob)

if __name__ == '__main__':
    main()
Buggy code:
N = int(input())
a = [int(n) for n in input().split()].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)


Fixed code:
N = int(input())
a = [int(n) for n in 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())
aList = list(map(int, input().split()))
aList.sort(reverse = True)
point = [0, 0]
for i in range(N):
    point[i%2] = aList[i]
print(point[0] - point[1])

Fixed code:
N = int(input())
aList = list(map(int, input().split()))
aList.sort(reverse = True)
point = [0, 0]
for i in range(N):
    point[i%2] += aList[i]
print(point[0] - point[1])
Buggy code:
n = int(raw_input())
x = sorted([int(i) for i in raw_input().split(" ")],reverse=True)
print(sum(x[::2]) - sum(x[1::2]))

Fixed code:
n = int(input())
x = sorted([int(i) for i in input().split(" ")],reverse=True)
print(sum(x[::2]) - sum(x[1::2]))
Buggy code:
N = int(input())
A = sorted(list(map(int, input().split())), reversed=True)
if N == 1:
  print(A[0])
  exit()
print(sum(A[0::2]) - sum(A[1::2]))

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

Fixed code:
input()
a=sorted(map(int,input().split()))[::-1]
print(sum(a[::2])-sum(a[1::2]))
Buggy code:
N = int(input())
list_a = list(map(int,input().split()))
list_a.sort(reverse=True)
alice = 0; bob = 0
for i in range(0,100):
    if i % 2 == 0:
        alice += list_a[i]
    else:
        bob += list_a[i]
print(alice-bob)
    


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


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:
n = int(input())
l = sorted(map(int, input().split()), reverse = True)

alice = 0
bob = 0
ab = False
for i in l:
  if ab = False:
	alice += i
  else:
    bob += i
    
print(alice - bob)
  

Fixed code:
n = int(input())
l = sorted(map(int, input().split()), reverse = True)

alice = 0
bob = 0
ab = False
for i in l:
  if ab == False:
    alice += i
    ab = True
  else:
    bob += i
    ab = False
    
print(alice - bob)
Buggy code:
N = int(input())
nums = sorted(list(map(int, input().split())) reverse = True)
print(sum(A[::2]) - sum(B[1::2]))


Fixed code:
N = int(input())
nums = sorted(list(map(int, input().split())), reverse = True)
print(sum(nums[::2]) - sum(nums[1::2]))
Buggy code:
N = int(input())
A = sorted(map(int, input().split()))
print(sum(A[::2])-sum(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:
i = int(input())
a = list(map(int, input().split()))
a.sort
a.reverse
alice = a[0::2]
bob = a[1::2]
print(alice - bob)

Fixed code:
i = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
alice = a[0::2]
bob = a[1::2]
print(sum(alice) - sum(bob))
Buggy code:
n = int(input())
a = list(map(int, input().split()))

a.sort(reversed=True)
score = [0, 0]
for i in range(n):
    score[i%2] += a[i]

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


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

a.sort(reverse=True)
score = [0, 0]
for i in range(n):
    score[i%2] += a[i]

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

Fixed code:

n = input()
a = sorted(map(int, input().split()))
print(abs(sum(a[1::2]) - sum(a[::2])))
Buggy code:
n = input()
a = [int(i) for i in input().split()]
a = sorted(a)
alice = 0
bob = 0
for i in reversed(range(len(a))):
    if i % 2 == 0:
        alice += a[i]
    else:
        bob += a[i]
print(alice-bob)

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

alice = 0
bob = 0

A_rev = sorted(A, reverse=True)

while True:
    alice += A_rev.pop(0)
    bob += A_rev.pop(0)

    if len(A_rev) == 0:
        break

print(alice - bob)

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

alice = 0
bob = 0

A_rev = sorted(A, reverse=True)

while True:
    if len(A_rev) != 0:
        alice += A_rev.pop(0)
    
    if len(A_rev) != 0:
        bob += A_rev.pop(0)
    
    if len(A_rev) == 0:
       break
 
print(alice - bob)
Buggy code:
def main():
    N = int(input())
    a = sorted(map(int, input().split()))[::-1]
    diff = sum([::2]) - sum([1:2])
    print(diff)


if __name__ == "__main__":
    main()

Fixed code:
def main():
    N = int(input())
    a = sorted(map(int, input().split()))[::-1]
    diff = sum(a[::2]) - sum(a[1::2])
    print(diff)


if __name__ == "__main__":
    main()
Buggy code:
input()
A = list(map(int, input().split())).sort(reverse=True)
print(sum([A[i] * ((-1) ** (i % 2)) for i in range(len(A))]))

Fixed code:
input()
A = list(map(int, input().split()))
A.sort(reverse=True)
print(sum([A[i] * ((-1) ** (i % 2)) for i in range(len(A))]))
Buggy code:
n = int(input())
nums = list(map(int,input().split()))
alice = 0
bob = 0

nums.sort()
while nums:
    alice+=nums.pop()
    bob+=nums.pop()

print(alice-bob)

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

nums.sort()
while nums:
    alice+=nums.pop()
    if nums:
        bob+=nums.pop()

print(alice-bob)
Buggy code:
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)

Fixed code:
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)
Buggy code:
N = int(input())
cards = list(map(int, input().split()))
cards.reverse() 
print(sum(cards[0::2])-sum(cards[1::2]))

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

print(ans)

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:
n=int(input())
a=list(map(int,input().split()))
b=sorted(a)
alice=sum(a[::2])
Bob=sum(a[1::2])
print(alice-Bob)

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

print(ans)


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

Fixed code:
N = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(sum(a[::2]) - sum(a[1::2]))
Buggy code:
a,b,c=map(int,input().split())
d,e,f=map(int,input().split())
g,h,i=map(int,input().split())
if a+e==b+d:
  if b+f==c+e:
    if d+h==e+g:
      if e+i==f+h:
        print('Yes')
print('No')

Fixed code:
a,b,c=map(int,input().split())
d,e,f=map(int,input().split())
g,h,i=map(int,input().split())
if a+e==b+d:
  if b+f==c+e:
    if d+h==e+g:
      if e+i==f+h:
        print('Yes')
        exit()
print('No')
Buggy code:
nums =  [list(map(int,input().split())) for i in range(3)]
a1 = 0
b1,b2,b3 = map(int,nums[0])
a2 = nums[1][0] -b2
a3 = nums[2][0] -b3
print(a2,a3)
print(nums)
if nums[1][1] == a2+b2 and nums[1][2] == a2+b3 and nums[2][1] == a3+b2 and nums[2][2] == a3+b3:
    print("Yes")
else:print("No")


Fixed code:
nums =  [list(map(int,input().split())) for i in range(3)]
a1 = 0
b1,b2,b3 = map(int,nums[0])
a2 = nums[1][0] -b1
a3 = nums[2][0] -b1
if nums[1][1] == a2+b2 and nums[1][2] == a2+b3 and nums[2][1] == a3+b2 and nums[2][2] == a3+b3:
    print("Yes")
else:print("No")
Buggy code:
a = [list(map(int,input().split())) for i in range(3)]

if a[0][0]+a[1][1]+a[2][2] == a[0][2]+a[1][1]+a[2][0] == a[0][1]+a[1][0]+a[2][2] == a[0][1]+a[1][2]+a[0][2]:
    print('Yes')
else:
    print('No')

Fixed code:
a = [list(map(int,input().split())) for i in range(3)]

if a[0][0]+a[1][1]+a[2][2] == a[0][2]+a[1][1]+a[2][0] == a[0][1]+a[1][0]+a[2][2] == a[0][1]+a[1][2]+a[2][0]==a[0][2]+a[1][0]+a[2][1] == a[0][0]+a[1][2]+a[2][1]:
    print('Yes')
else:
    print('No')
Buggy code:
c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))
s = [c1,c2,c3]
print(s)
s1 = s[0][0] - s[0][1] - s[1][0] + s[1][1]
s2 = s[1][1] - s[1][2] - s[2][1] + s[2][2]
if  s1== 0 and s2==0:
    if s[0][0] + s[2][2] == s[0][2] + s[2][2]:
        print('Yes')
    else:
        print('No')
else:
    print('No')


Fixed code:
c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))
s = [c1,c2,c3]

s1 = s[0][0] - s[0][1] - s[1][0] + s[1][1]
s2 = s[1][1] - s[1][2] - s[2][1] + s[2][2]
if  s1== 0 and s2==0:
    if s[0][0] + s[2][2] == s[0][2] + s[2][0]:
        print('Yes')
    else:
        print('No')
else:
    print('No')
Buggy code:
a, b, c = map(int, input().split())
d, e, f = map(int, input().split())
g, h, i = map(int, input().split())

if a-d==b-e==c-f and a-g==b-h==c-i and a-b--d-e==g-h and a-c==d-f==g-i:
    print("Yes")
else:
    print("No")

Fixed code:
a, b, c = map(int, input().split())
d, e, f = map(int, input().split())
g, h, i = map(int, input().split())

if a-d==b-e==c-f and a-g==b-h==c-i and a-b==d-e==g-h and a-c==d-f==g-i:
    print("Yes")
else:
    print("No")
Buggy code:
c = []
for i in range(3):
  r = map(int, input().split())
  c.append(r)
  
d1 = set([])
d2 = set([])
d3 = set([])
d4 = set([])
for i in range(3):
  d1.append(c[i][1] - c[i][0])
  d2.append(c[i][2] - c[i][1])
  d3.append(c[1][i] - c[0][i])
  d4.append(c[2][i] - c[1][i])
if len(d1) == 1 and len(d2) == 1 and len(d3) == 1 and len(d4) == 1:
  print('Yes')
else:
  print('No')
  

Fixed code:
c = []
for i in range(3):
  r = list(map(int, input().split()))
  c.append(r)
  
d1 = set([])
d2 = set([])
d3 = set([])
d4 = set([])
for i in range(3):
  d1.add(c[i][1] - c[i][0])
  d2.add(c[i][2] - c[i][1])
  d3.add(c[1][i] - c[0][i])
  d4.add(c[2][i] - c[1][i])
if len(d1) == 1 and len(d2) == 1 and len(d3) == 1 and len(d4) == 1:
  print('Yes')
else:
  print('No')
Buggy code:
# -*- coding: utf-8 -*-

import numpy as np
import scipy

C = [[0 for i in range(3)] for j in range(3)]
for i in range(3):
    C[i] = list(map(int, input().split()))
#print(C)

for i in range(2):
    for j in range(2):
        if C[0][j] - C[0][j+1] != C[i][j] - C[i][j+1]:
            print("No")
            exit()
        if C[i][0] - C[i+1][0] != C[i][j] - C[i+1][j]:
            print("No")
            exit()
print("Yes")


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

import numpy as np
import scipy

C = [[0 for i in range(3)] for j in range(3)]
for i in range(3):
    C[i] = list(map(int, input().split()))
#print(C)

for i in range(3):
    for j in range(3):
        if C[0][0] - C[0][j] != C[i][0] - C[i][j]:
            print("No")
            exit()
        if C[0][0] - C[i][0] != C[0][j] - C[i][j]:
            print("No")
            exit()
print("Yes")
Buggy code:
C = [list(map(int, input().split())) for _ in range(3)]

ans = "Yes"

for i in range(1, -1, -1):
    C0i = C[0][2] - C[0][i]
    C1i = C[1][2] - C[1][i]
    C2i = C[2][2] - C[2][i]
    
    if C0i != C1i and C0i != C2i:
        ans = "No"
        
print(ans)

Fixed code:
C = [list(map(int, input().split())) for _ in range(3)]

ans = "Yes"

for i in range(1, -1, -1):
    C0i = C[0][2] - C[0][i]
    C1i = C[1][2] - C[1][i]
    C2i = C[2][2] - C[2][i]
    
    if C0i != C1i or C0i != C2i:
        ans = "No"
        
print(ans)