1class Solution:2def maxTwoEvents(self, events: List[List[int]]) -> int:34events.sort()5heap = []6res2, res1 = 0, 07for s, e, p in events:8while heap and heap[0][0] < s:9res1 = max(res1, heapq.heappop(heap)[1])1011res2 = max(res2, res1 + p)12heapq.heappush(heap, (e, p))1314return res2