아직 안돌아가는 나의 풀이
import sys
import heapq
from queue import PriorityQueue
gas_station = []
pq = PriorityQueue()
N = int(input())
for _ in range(N):
distance, fuel = [int(x) for x in sys.stdin.readline().split()]
gas_station.append((distance, fuel))
gas_station.sort(key=lambda item: item[0])
End, oil = [int(x) for x in sys.stdin.readline().split()]
ans, here = 0, 0
for i in range(len(gas_station)):
print(i)
while pq and (here + oil) < gas_station[i][0]:
oil += pq.get()[1]
ans += 1
oil = oil - (gas_station[i][0]-here)
if oil < 0:
break
while pq and here + oil < End:
oil += pq.get()[1]
ans += 1
print(ans) if here + oil >= End else print(-1)