#C3775. Counting Occurrences Up to a Given Number
Counting Occurrences Up to a Given Number
Counting Occurrences Up to a Given Number
You are given a list of integers and a target integer \(T\). Your task is to count the occurrence of each integer in the list that is less than or equal to \(T\). Then, output the result in ascending order of the integers. For each integer that qualifies, print the integer and its count separated by a space on a new line.
If no integer in the list is less than or equal to \(T\), output nothing.
Example:
Input: 8 1 2 2 3 4 4 4 5 4</p>Output: 1 1 2 2 3 1 4 3
inputFormat
The input is read from standard input (stdin) in the following format:
- The first line contains an integer \(n\), the number of elements in the list.
- The second line contains \(n\) space-separated integers.
- The third line contains an integer \(T\) (the target number).
outputFormat
For each unique integer from the list that is \(\le T\), output a line containing the integer and its count (frequency), separated by a space. The output should be in ascending order by the integer. If no number qualifies, output nothing.
## sample8
1 2 2 3 4 4 4 5
4
1 1
2 2
3 1
4 3
</p>