#C14453. Filter Recent Users

    ID: 44104 Type: Default 1000ms 256MiB

Filter Recent Users

Filter Recent Users

You are given the current date, a day threshold K, and a list of user records. Each user record consists of an integer id and a registration_date in the format YYYY-MM-DD.

Your task is to filter the users who registered within the last K days (inclusive). In other words, if the registration date is on or after the cutoff date computed by subtracting K days from the current date, then that user qualifies.

The input is read from standard input and the output should be printed to standard output. Each qualifying user's id should be printed on its own line, preserving the input order. If no users qualify, do not print anything.

Note: All dates are given in the YYYY-MM-DD format and you can assume that this format is strictly followed.

Formula: \( \text{cutoff_date} = \text{current_date} - K \; \text{days} \)

inputFormat

The input consists of the following lines:

  1. A line containing the current date in YYYY-MM-DD format.
  2. A line containing an integer K, the number of days for the threshold.
  3. A line containing an integer N, the number of user records.
  4. N subsequent lines, each containing a user record with two values separated by space: an integer id and a registration_date in YYYY-MM-DD format.

outputFormat

Output the id of each user whose registration_date is on or after the cutoff date (i.e., current_date - K days). Each id should be printed on a new line. If no user qualifies, output nothing.

## sample
2023-10-15
30
2
1 2023-10-05
2 2023-09-01
1

</p>