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


def main():
    N = int(input())
    A = np.array([])
    B = np.array([])
    for i in range(0, N):
        a, b = map(int, input().split())
        A = np.append(A, [a])
        B = np.append(B, [b])
    
    takahashi = 0
    aoki = 0
    # 足し算して一番大きいところからとる
    sum_AB = A + B
    l = sum_AB.argsort()[::-1]
    takahashi = sum([A[i] for i in [j for idx, j in enumerate(l) if idx % 2 == 0]])
    aoki = sum([B[i] for i in [j for idx, j in enumerate(l) if idx % 2 != 0]])

    print(int(takahashi - aoki))


main()


Fixed submission:
import numpy as np


def main():
    N = int(input())
    A = []
    B = []
    for i in range(0, N):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)
    
    takahashi = 0
    aoki = 0
    # 足し算して一番大きいところからとる
    A = np.array(A)
    B = np.array(B)
    sum_AB = A + B
    l = sum_AB.argsort()[::-1]
    takahashi = sum([A[i] for i in [j for idx, j in enumerate(l) if idx % 2 == 0]])
    aoki = sum([B[i] for i in [j for idx, j in enumerate(l) if idx % 2 != 0]])

    print(int(takahashi - aoki))


main()

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


def main():
    N = int(input())
    A = np.array([])
    B = np.array([])
    for i in range(0, N):
        a, b = map(int, input().split())
        A = np.append(A, [a])
        B = np.append(B, [b])
    
    takahashi = 0
    aoki = 0
    # 足し算して一番大きいところからとる
    sum_AB = A + B
    l = sum_AB.argsort()[::-1]
    for idx, i in enumerate(l):
        if idx % 2 == 0:
            takahashi += A[i]
        else:
            aoki += B[i]

    print(int(takahashi - aoki))


main()


Fixed submission:
import numpy as np


def main():
    N = int(input())
    A = []
    B = []
    for i in range(0, N):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)
    
    takahashi = 0
    aoki = 0
    # 足し算して一番大きいところからとる
    A = np.array(A)
    B = np.array(B)
    sum_AB = A + B
    l = sum_AB.argsort()[::-1]
    takahashi = sum([A[i] for i in [j for idx, j in enumerate(l) if idx % 2 == 0]])
    aoki = sum([B[i] for i in [j for idx, j in enumerate(l) if idx % 2 != 0]])

    print(int(takahashi - aoki))


main()

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


def main():
    N = int(input())
    A = np.array([])
    B = np.array([])
    for i in range(0, N):
        a, b = map(int, input().split())
        A = np.append(A, [a])
        B = np.append(B, [b])
    
    # 自分に一番良い手と相手にとって一番良い手を考える
    # 自分にとって一番良い手が複数ある場合、その中で相手が一番良い手を選ぶ
    # 自分にとって一番良い手が１つの場合、相手にとって一番良い手との比較をして、差が大きい方を選ぶ
    # 自分にとって良いてと相手にとっていい手が同じ場合(相手にとっていい手が複数ある場合も)、それを選ぶ
    takahashi = 0
    aoki = 0
    # 足し算して一番大きいところからとる
    sum_AB = A + B
    #  print(A, B)
    for i in range(1, N + 1):
        max_idx = np.argmax(sum_AB)
        #  print(sum_AB, max_idx)
        if i % 2 == 1:
            takahashi += A[max_idx]
        else:
            aoki += B[max_idx]
        sum_AB[max_idx] = -1

    print(int(takahashi - aoki))


def sub(N, A, B):
    takahashi = 0
    aoki = 0
    # 足し算して一番大きいところからとる
    sum_AB = A + B
    #  print(A, B)
    for i in range(1, N + 1):
        max_idx = np.argmax(sum_AB)
        #  print(sum_AB, max_idx)
        if i % 2 == 1:
            takahashi += A[max_idx]
        else:
            aoki += B[max_idx]
        sum_AB[max_idx] = -1

    print(int(takahashi - aoki))



main()


Fixed submission:
import numpy as np


def main():
    N = int(input())
    A = []
    B = []
    for i in range(0, N):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)
    
    takahashi = 0
    aoki = 0
    # 足し算して一番大きいところからとる
    A = np.array(A)
    B = np.array(B)
    sum_AB = A + B
    l = sum_AB.argsort()[::-1]
    takahashi = sum([A[i] for i in [j for idx, j in enumerate(l) if idx % 2 == 0]])
    aoki = sum([B[i] for i in [j for idx, j in enumerate(l) if idx % 2 != 0]])

    print(int(takahashi - aoki))


main()

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


def main():
    N = int(input())
    A = np.array([])
    B = np.array([])
    for i in range(0, N):
        a, b = map(int, input().split())
        A = np.append(A, [a])
        B = np.append(B, [b])
    
    # 自分に一番良い手と相手にとって一番良い手を考える
    # 自分にとって一番良い手が複数ある場合、その中で相手が一番良い手を選ぶ
    # 自分にとって一番良い手が１つの場合、相手にとって一番良い手との比較をして、差が大きい方を選ぶ
    # 自分にとって良いてと相手にとっていい手が同じ場合(相手にとっていい手が複数ある場合も)、それを選ぶ
    sub(N, A, B)


def sub(N, A, B):
    takahashi = 0
    aoki = 0
    # 足し算して一番大きいところからとる
    sum_AB = A + B
    #  print(A, B)
    for i in range(1, N + 1):
        max_idx = np.argmax(sum_AB)
        #  print(sum_AB, max_idx)
        if i % 2 == 1:
            takahashi += A[max_idx]
        else:
            aoki += B[max_idx]
        sum_AB[max_idx] = -1

    print(int(takahashi - aoki))



main()


Fixed submission:
import numpy as np


def main():
    N = int(input())
    A = []
    B = []
    for i in range(0, N):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)
    
    takahashi = 0
    aoki = 0
    # 足し算して一番大きいところからとる
    A = np.array(A)
    B = np.array(B)
    sum_AB = A + B
    l = sum_AB.argsort()[::-1]
    takahashi = sum([A[i] for i in [j for idx, j in enumerate(l) if idx % 2 == 0]])
    aoki = sum([B[i] for i in [j for idx, j in enumerate(l) if idx % 2 != 0]])

    print(int(takahashi - aoki))


main()