#C14092. Filter and Sort Students

    ID: 43703 Type: Default 1000ms 256MiB

Filter and Sort Students

Filter and Sort Students

Your challenge is to process a list of student records. Each record consists of an integer id, a student's name (a single word), and an integer score. You need to filter out the students whose score is below a given threshold and then sort the remaining students in descending order based on their scores. If two students have the same score, they should be sorted in alphabetical order by name.

In mathematical terms, if a student's score is denoted by \(s\) and their name by \(n\), then the sorting is performed by ordering the pair \((-s, n)\) in lexicographic order.

For example, consider two students with scores equal to 92 and names 'Charlie' and 'Eve'. Since 'Charlie' comes before 'Eve' alphabetically, Charlie will appear before Eve in the sorted order.

inputFormat

The input is read from standard input (stdin). The first line contains an integer \(n\) (1 \(\leq\) n \(\leq\) 105), which represents the number of student records. The following \(n\) lines each contain a student record with three fields separated by spaces:

  • An integer id
  • A string name (without spaces)
  • An integer score

The next line contains an integer \(t\), the minimum score threshold.

outputFormat

Output the filtered and sorted student records to standard output (stdout). Each record should be printed on a new line in the format:

id name score

If no records meet the criteria, do not output anything.

## sample
5
1 Alice 88
2 Bob 75
3 Charlie 92
4 David 85
5 Eve 92
80
3 Charlie 92

5 Eve 92 1 Alice 88 4 David 85

</p>