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

N = int(input())
A = []
B = []
for _ in range(N):
    s = input().split()
    A.append(int(s[0]))
    B.append(int(s[1]))

def list_add(in1, in2):
    wrk = np.array(in1) + np.array(in2)
    return wrk.tolist()

C = list_add(A, B)

ind = 0

a_happy = 0
b_happy = 0

for i in range(N):
    if i%2 == 0:
        ind = C.index(max(C))
        a_happy += A[ind]
        A.pop(ind)
        B.pop(ind)
        C.pop(ind)
    if i%2 == 1:
        ind = C.index(max(C))
        b_happy += B[ind]
        A.pop(ind)
        B.pop(ind)
        C.pop(ind)

print(a_happy - b_happy)


Fixed submission:
import numpy as np

N = int(input())
C = []
for _ in range(N):
    a, b = map(int, input().split())
    C.append([a+b, a, b])

D = sorted(C, reverse=True)

ans = 0

for i in range(N):
    if i % 2 == 0:
        ans += D[i][1]
    elif i % 2 == 1:
        ans -= D[i][2]

print(ans)

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

N = int(input())
A = []
B = []
for _ in range(N):
    s = input().split()
    A.append(int(s[0]))
    B.append(int(s[1]))

def set_list(es):
    return np.unique(es).shape[0] == 1

ind = 0

A = np.array(A)
B = np.array(B)

a_happy = 0
b_happy = 0
A_flag = 0
B_flag = 0

if set_list(A):
    A_flag = 1

if set_list(B):
    B_flag = 1

for i in range(N):
    if i%2 == 0:
        if A_flag == 0:
            ind =np.argmax(A)
            a_happy += A[ind]
            A = np.delete(A, ind)
            B = np.delete(B, ind)
            if set_list(B):
                B_flag = 1
        elif A_flag == 1:
            ind =np.argmax(B)
            a_happy += A[ind]
            A = np.delete(A, ind)
            B = np.delete(B, ind)
    if i%2 == 1:
        if B_flag == 0:
            ind =np.argmax(B)
            b_happy += B[ind]
            A = np.delete(A, ind)
            B = np.delete(B, ind)
            if set_list(A):
                A_flag = 1
        elif B_flag == 1:
            ind =np.argmax(A)
            b_happy += B[ind]
            A = np.delete(A, ind)
            B = np.delete(B, ind)

print(a_happy - b_happy)


Fixed submission:
import numpy as np

N = int(input())
C = []
for _ in range(N):
    a, b = map(int, input().split())
    C.append([a+b, a, b])

D = sorted(C, reverse=True)

ans = 0

for i in range(N):
    if i % 2 == 0:
        ans += D[i][1]
    elif i % 2 == 1:
        ans -= D[i][2]

print(ans)

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

N = int(input())
A = []
B = []
for _ in range(N):
    s = input().split()
    A.append(int(s[0]))
    B.append(int(s[1]))

def set_list(es):
    es = es.tolist()
    return len(list(set(es))) == 1

ind = 0

A = np.array(A)
B = np.array(B)

a_happy = 0
b_happy = 0
A_flag = 0
B_flag = 0

if set_list(A):
    A_flag = 1

if set_list(B):
    B_flag = 1

for i in range(N):
    if i%2 == 0:
        if A_flag == 0:
            ind =np.argmax(A)
            a_happy += A[ind]
            A = np.delete(A, ind)
            B = np.delete(B, ind)
            if set_list(A):
                A_flag = 1
            if set_list(B):
                B_flag = 1
        elif A_flag == 1:
            ind =np.argmax(B)
            a_happy += A[ind]
            A = np.delete(A, ind)
            B = np.delete(B, ind)
    if i%2 == 1:
        if B_flag == 0:
            ind =np.argmax(B)
            b_happy += B[ind]
            A = np.delete(A, ind)
            B = np.delete(B, ind)
            if set_list(A):
                A_flag = 1
            if set_list(B):
                B_flag = 1
        elif B_flag == 1:
            ind =np.argmax(A)
            b_happy += B[ind]
            A = np.delete(A, ind)
            B = np.delete(B, ind)

print(a_happy - b_happy)


Fixed submission:
import numpy as np

N = int(input())
C = []
for _ in range(N):
    a, b = map(int, input().split())
    C.append([a+b, a, b])

D = sorted(C, reverse=True)

ans = 0

for i in range(N):
    if i % 2 == 0:
        ans += D[i][1]
    elif i % 2 == 1:
        ans -= D[i][2]

print(ans)

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

N = int(input())
A = []
B = []
for _ in range(N):
    s = input().split()
    A.append(int(s[0]))
    B.append(int(s[1]))

def set_list(es):
    es = es.tolist()
    return len(list(set(es))) == 1

ind = 0

A = np.array(A)
B = np.array(B)

a_happy = 0
b_happy = 0

for i in range(N):
    if i%2 == 0:
        if set_list(A):
            ind = np.argmax(B)
        else:
            ind = np.argmax(A)
        a_happy += A[ind]
        A = np.delete(A, ind)
        B = np.delete(B, ind)
    if i%2 == 1:
        if set_list(B):
            ind = np.argmax(A)
        else:
            ind = np.argmax(B)
        b_happy += B[ind]
        A = np.delete(A, ind)
        B = np.delete(B, ind)

print(a_happy - b_happy)


Fixed submission:
import numpy as np

N = int(input())
C = []
for _ in range(N):
    a, b = map(int, input().split())
    C.append([a+b, a, b])

D = sorted(C, reverse=True)

ans = 0

for i in range(N):
    if i % 2 == 0:
        ans += D[i][1]
    elif i % 2 == 1:
        ans -= D[i][2]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
B = []
for _ in range(N):
    s = input().split()
    A.append(int(s[0]))
    B.append(int(s[1]))

def set_list(es):
    return len(list(set(es))) == 1

ind = 0

a_happy = 0
b_happy = 0

for i in range(N):
    if i%2 == 0:
        if set_list(A):
            ind = B.index(max(B))
        else:
            ind = A.index(max(A))
        a_happy += A[ind]
        A.pop(ind)
        B.pop(ind)
    if i%2 == 1:
        if set_list(B):
            ind = A.index(max(A))
        else:
            ind = B.index(max(B))
        b_happy += B[ind]
        A.pop(ind)
        B.pop(ind)
    #print(a_happy, b_happy)

print(a_happy - b_happy)


Fixed submission:
import numpy as np

N = int(input())
C = []
for _ in range(N):
    a, b = map(int, input().split())
    C.append([a+b, a, b])

D = sorted(C, reverse=True)

ans = 0

for i in range(N):
    if i % 2 == 0:
        ans += D[i][1]
    elif i % 2 == 1:
        ans -= D[i][2]

print(ans)