#C2414. Taco Command Processor

    ID: 45728 Type: Default 1000ms 256MiB

Taco Command Processor

Taco Command Processor

You are given a series of commands to manipulate a set of integers. The commands are of two types:

  • INSERT X: Insert the integer X into the set.
  • REMOVE_MIN: Remove the smallest integer from the set if it exists.

After processing all the commands, output the smallest integer remaining in the set. If the set is empty, output -1.

Formally, let \( K \) be the number of commands. For each command, update the set accordingly. After all commands, let the answer be \( \min(S) \) if \( S \) is non-empty, otherwise, the answer is -1.

inputFormat

The first line contains an integer \( K \), the number of commands. The following \( K \) lines each contain a command. Each command is either in the format INSERT X where X is an integer, or REMOVE_MIN.

outputFormat

Output a single integer: the smallest number in the set after processing all the commands, or -1 if the set is empty.

## sample
6
INSERT 5
INSERT 3
REMOVE_MIN
INSERT 10
REMOVE_MIN
REMOVE_MIN
-1

</p>