#K69887. Count Buses Exceeding Distance Threshold
Count Buses Exceeding Distance Threshold
Count Buses Exceeding Distance Threshold
You are given a list of buses with their traveled distances. Your task is to count the number of buses that have traveled more than a given threshold distance k kilometers. The first line of the input contains two integers: n (the number of buses) and k (the threshold distance). This is followed by n lines, each containing two integers: bus_id and distance.
In mathematical terms, you need to compute the value of:
[ \text{count} = \sum_{i=1}^{n} [d_i > k], ]
where \(d_i\) is the distance traveled by the \(i\)-th bus, and the indicator function \([d_i > k]\) equals 1 if \(d_i > k\) and 0 otherwise.
Output the computed count.
inputFormat
The input is read from stdin and has the following format:
- The first line contains two integers n and k, separated by a space.
- The next n lines each contain two integers: bus_id and distance.
outputFormat
The output is written to stdout and should be a single integer representing the number of buses whose traveled distance is strictly greater than k.
## sample3 100
1 150
2 200
3 250
3