생성일: 2022년 1월 29일 오후 6:11
# 최소힙 import sys import heapq sys.stdin = open("input.txt", "rt") heap = [] while True: num = int(input()) if num == -1: break elif num == 0: print(heapq.heappop(heap)) else: heapq.heappush(heap, num)