#C14161. Inventory Tracking System

    ID: 43780 Type: Default 1000ms 256MiB

Inventory Tracking System

Inventory Tracking System

You are given the current stock levels of items in an inventory and a list of sales transactions. Your task is to update the inventory by subtracting the sold quantities from the stock. If an item in the sales record is not present in the inventory, ignore it. The stock level should never drop below zero.

After processing all sales, print the updated inventory in the same order as they were provided in the input. Each inventory item should be printed with its name (with the first letter capitalized) followed by a colon and the updated quantity.

The update operation follows the formula: \( \text{new_stock} = \max(0, \text{old_stock} - \text{sales_quantity}) \).

inputFormat

The input is provided via stdin and has the following format:

N
item1 quantity1
item2 quantity2
... (N lines)
M
itemA quantityA
itemB quantityB
... (M lines)

Here, N is the number of inventory items and M is the number of sales records. Each item name and quantity are separated by a space.

outputFormat

Print the updated inventory to stdout. For each of the N inventory items (in the order they were input), output a line in the following format:

Item: quantity

where 'Item' is the item name with its first letter capitalized and 'quantity' is the updated stock level.

## sample
3
apples 50
bananas 30
oranges 20
3
apples 10
bananas 5
oranges 8
Apples: 40

Bananas: 25 Oranges: 12

</p>