#C1660. File Classification by Size

    ID: 44890 Type: Default 1000ms 256MiB

File Classification by Size

File Classification by Size

You are given a list of files, each with a name and its size (in bytes). Your task is to classify the files into three categories based on their sizes:

  • Small Files: files with size ≤ 1000 bytes.
  • Medium Files: files with size between 1001 and 100000 bytes (inclusive).
  • Large Files: files with size > 100000 bytes.

For each non-empty category, first output the category header. Then, output the file names in that category sorted in ascending order by their file size. If there are no files in a category, do not output the header for that category.

Note: The input is provided via standard input and the output must be printed to standard output.

inputFormat

The first line of input contains an integer N representing the number of files. The following N lines each contain a file name (a string without spaces) and an integer representing the file size in bytes, separated by space.

outputFormat

For every file category that contains at least one file, first print the category header on its own line (Small Files, Medium Files, or Large Files). Then, print the names of the files in that category, each on a new line, in ascending order based on their sizes.

## sample
5
small1.txt 500
small2.txt 1000
medium1.txt 1500
medium2.txt 50000
large1.txt 150001
Small Files

small1.txt small2.txt Medium Files medium1.txt medium2.txt Large Files large1.txt

</p>