Description
![]()
You are writing a program to help organize his daily schedule.
You receive a list of dates in different formats:
-
YYYY-MM-DD -
MM/DD/YYYY -
DD Mon YYYY(e.g.,25 Oct 2025)
Your task is to sort these dates chronologically from earliest to latest.
Constraints
-
All input dates and formats are valid.
-
No two dates represent the same calendar day.
-
You do not need to check for duplicates.
Input
A single line of comma-separated dates.
Output
Print the dates sorted chronologically, one per line.
Original input format is preserved.
Sample Input Download
Sample Output Download
Discuss
Description
He wants you to go buy him some groceries.
As an I2P student, you have to make a shopping list to buy the foods for Varaha.

Write a program to manage a shopping list. Each item in the list has a name and a quantity.
The program should support the following commands:
-
add→ Add an entry with a quantity. If the entry already exists, increase its quantity. -
remove→ Remove a quantity of an entry. If the quantity becomes 0 or negative, remove the entry completely. -
show→ Display the current shopping list -
count→ Print the total sum of all quantities in the list. -
clear→ Remove all entries from the shopping list.
items = {}
# Functions
def add():
pass
def remove():
pass
def show():
pass
def count():
pass
def clear():
pass
# Command mapping using lambdas
actions = {
# todo
}
# Main program
n = int(input())
for _ in range(n):
cmd = input().strip()
# todo
Input
-
The first line contains an integer
n,number of commands. -
The next
nlines contain the commands
For add and remove, the next line contains the entry name and quantity separated by a space.
For show, count, and clear, no additional input is required.
Output
-
show, print the shopping list. -
count, print the total sum of quantities. -
No output is required for
add,remove, orclear.