data-structure from heapq import _heappify_max, _heappop_max, _heappushpop_max, _siftdown_max def _heappush_max(heap, item): """Maxheap version of a heappush.""" heap.append(item) _siftdown_max(heap, 0, len(heap) - 1)