def heapreplace(heap, item):
 returnitem = heap[0]
 heap[0] = item
 _siftup(heap, 0)
 return returnitem

def heapreplace ( heap , item ) : returnitem = heap [ 0 ] heap [ 0 ] = item _siftup ( heap , 0 ) return returnitem
pop and return the current smallest value .