import heapq heap = [2, 1, 3, 4, 5] heapq.heapify(heap) n = int(input()) for i in range(n) : x = int(input()) if x == 0 : print(heapq.heappop(heap)) print(heap)
To embed this project on your website, copy the following code and paste it into your website's HTML: