Filter by Threshold and Return Name with Max Score
Complete the function below. The function receives the full standard input as a single string and must return the exact standard output lines for the described problem.
Problem
Given records records = [(name, score), ...] and an integer threshold:
Filter out all records with score > threshold (keep score <= threshold).
Among the remaining records, find the record with the maximum score and output its name.
Constraints:
At least one record satisfies score <= threshold.
name is a no-space string, score is an integer.
Input:
Line 1: integer n
Line 2: integer threshold
Next n lines: name score
Output:
One line: the name with the maximum score among those <= threshold.
Example: Input:
4
80
alice 50
bob 90
cindy 80
dave 70
Output:
cindy
Example
Input
4
80
alice 50
bob 90
cindy 80
dave 70
Output
cindy
Complete solveFilterThresholdMaxScore. It has one parameter, String input, containing the full stdin payload. Return the stdout payload as an array of lines, without trailing newline characters.
1Example 1
The returned string array must match the expected standard output lines for the sample input.
Constraints
Limits and guarantees your solution can rely on.
Use the limits and requirements stated in the prompt.