Buggy python submission (verdict: Runtime Error):
from sys import exit
input = sys.stdin.readline

n = int(input())
task = []
time_total = [-1 for i in range(n)]
for i in range(n):
    task.append([int(i) for i in input().split()])
task_sorted = sorted(task, key = lambda x:x[1])
time_total[0] = task_sorted[0][0]
for i in range(n - 1):
    time_total[i + 1] = time_total[i] + task_sorted[i + 1][0]
for i in range(n):
    if time_total[i] > task_sorted[i][1]:
        print("No")
        exit()
print("Yes")

Fixed submission:
import sys
input = sys.stdin.readline

n = int(input())
task = []
time_total = [-1 for i in range(n)]
for i in range(n):
    task.append([int(i) for i in input().split()])
task_sorted = sorted(task, key = lambda x:x[1])
time_total[0] = task_sorted[0][0]
for i in range(n - 1):
    time_total[i + 1] = time_total[i] + task_sorted[i + 1][0]
for i in range(n):
    if time_total[i] > task_sorted[i][1]:
        print("No")
        sys.exit()
print("Yes")

Buggy python submission (verdict: Runtime Error):
from sys import
input = sys.stdin.readline

n = int(input())
task = []
time_total = [-1 for i in range(n)]
for i in range(n):
    task.append([int(i) for i in input().split()])
task_sorted = sorted(task, key = lambda x:x[1])
time_total[0] = task_sorted[0][0]
for i in range(n - 1):
    time_total[i + 1] = time_total[i] + task_sorted[i + 1][0]
for i in range(n):
    if time_total[i] > task_sorted[i][1]:
        print("No")
        exit()
print("Yes")

Fixed submission:
import sys
input = sys.stdin.readline

n = int(input())
task = []
time_total = [-1 for i in range(n)]
for i in range(n):
    task.append([int(i) for i in input().split()])
task_sorted = sorted(task, key = lambda x:x[1])
time_total[0] = task_sorted[0][0]
for i in range(n - 1):
    time_total[i + 1] = time_total[i] + task_sorted[i + 1][0]
for i in range(n):
    if time_total[i] > task_sorted[i][1]:
        print("No")
        sys.exit()
print("Yes")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def my_sort(L, p, q):
    C = [[i, -1] for i in range(q - p + 1)]
    if p < q:
        mid = (p + q) // 2
        A = my_sort(L, p, mid)
        B = my_sort(L, mid + 1, q)
        i = 0
        j = 0
        k = 0
        while k < q - p + 1:
            if i >= mid - p + 1:
                C[k] = B[j]
                j += 1
            elif j >= q - mid:
                C[k] = A[i]
                i += 1
            else:
                if A[i][1] <= B[j][1]:
                    C[k] = A[i]
                    i += 1
                else:
                    C[k] = B[j]
                    j += 1
            k += 1
        return C
    else:
        return [L[p]]

n = int(input())
task = []
time_total = [0 for i in range(n)]
for i in range(n):
    task.append([int(i) for i in input().split()])
task = my_sort(task, 0, n - 1)
time_total[0] = task[0][0]
for i in range(n - 1):
    time_total[i + 1] = time_total[i] + task[i + 1][0]
while i < n:
    if time_total[i] > task[i][1]:
        print("No")
        sys.exit()
    i += 1
print("Yes")

Fixed submission:
import sys
input = sys.stdin.readline

n = int(input())
task = []
time_total = [-1 for i in range(n)]
for i in range(n):
    task.append([int(i) for i in input().split()])
task_sorted = sorted(task, key = lambda x:x[1])
time_total[0] = task_sorted[0][0]
for i in range(n - 1):
    time_total[i + 1] = time_total[i] + task_sorted[i + 1][0]
for i in range(n):
    if time_total[i] > task_sorted[i][1]:
        print("No")
        sys.exit()
print("Yes")

Buggy python submission (verdict: Time Limit Exceeded):
from sys import exit

def my_sort(L, p, q):
    C = [[i, -1] for i in range(q - p + 1)]
    if p < q:
        mid = (p + q) // 2
        A = my_sort(L, p, mid)
        B = my_sort(L, mid + 1, q)
        i = 0
        j = 0
        k = 0
        while k < q - p + 1:
            if i >= mid - p + 1:
                C[k] = B[j]
                j += 1
            elif j >= q - mid:
                C[k] = A[i]
                i += 1
            else:
                if A[i][1] <= B[j][1]:
                    C[k] = A[i]
                    i += 1
                else:
                    C[k] = B[j]
                    j += 1
            k += 1
        return C
    else:
        return [L[p]]


n = int(input())
task = []
time_total = [0 for i in range(n)]
for i in range(n):
    task.append([int(i) for i in input().split()])
task = my_sort(task, 0, n - 1)
time_total[0] = task[0][0]
for i in range(n - 1):
    time_total[i + 1] = time_total[i] + task[i + 1][0]
while i < n:
    if time_total[i] > task[i][1]:
        print("No")
        exit()
    i += 1
print("Yes")

Fixed submission:
import sys
input = sys.stdin.readline

n = int(input())
task = []
time_total = [-1 for i in range(n)]
for i in range(n):
    task.append([int(i) for i in input().split()])
task_sorted = sorted(task, key = lambda x:x[1])
time_total[0] = task_sorted[0][0]
for i in range(n - 1):
    time_total[i + 1] = time_total[i] + task_sorted[i + 1][0]
for i in range(n):
    if time_total[i] > task_sorted[i][1]:
        print("No")
        sys.exit()
print("Yes")