#K67252. Inventory Operations

    ID: 32601 Type: Default 1000ms 256MiB

Inventory Operations

Inventory Operations

You are given a series of inventory operations to perform on a collection of items. There are three types of operations:

  • add <item> <quantity>: Increase the stock of the specified item by the given quantity. If the item does not exist, it is added to the inventory.
  • update <item> <quantity>: Set the stock of the specified item to the given quantity.
  • check <item>: Check if the specified item has a stock greater than 0. If so, output yes; otherwise, output no.

For each check operation, output the result on a new line. Use stdin for input and stdout for output.

In mathematical terms, let \( S(item) \) denote the current stock of an item. For each check operation, you must output:

\[ \text{output} = \begin{cases} \text{yes} &\text{if } S(item) > 0, \\ \text{no} &\text{otherwise.} \end{cases} \]

inputFormat

The first line contains an integer n, the number of operations.

The next n lines each contain an operation in one of the following forms:

  • add item quantity
  • update item quantity
  • check item

All tokens are space-separated.

outputFormat

For each check operation performed in the order of input, print a single line with either yes or no based on the current stock of the item.

## sample
6
add apples 10
add bananas 5
check apples
update apples 20
check apples
check oranges
yes

yes no

</p>