Problem 786
Count Elements Greater Than X
Problem
Count the elements of the array that are strictly greater than a given value X. Elements equal to X do not count. Loop over the array once with a counter. This kind of filter-and-count loop appears inside many larger algorithms, so it is worth writing cleanly and correctly.
Input
The first line contains N and X. The second line contains the N array elements.
Output
Print how many elements are greater than X.
Constraints
1 <= N <= 100000; -10^9 <= A[i], X <= 10^9
Example input
5 5 4 10 6 2 6
Example output
3
Explanation
In 4 10 6 2 6 with X = 5, the elements 10, 6 and 6 are greater than 5, so the answer is 3. The values equal to 5 would not count.