import heapq
h = []
heapq.heappush(h, 20) # logn
heapq.heappush(h, 10)
print(heapq.heappop(h)) # min : logn
print(heapq.heappop(h)) # min : logn
set() # unordered
a = [-1, 1, 2, 3, 4, 5]
def add(x):
a.append(x)
i = len(a) - 1
while i > 1 and a[i // 2] > a[i]:
a[i], a[i // 2] = a[i // 2], a[i]
i //= 2