#C10434. Distinct Elements Query

    ID: 39639 Type: Default 1000ms 256MiB

Distinct Elements Query

Distinct Elements Query

You are given an array of n integers and a threshold value k. You are also given m queries. Each query is described by two integers l and r representing a subarray from index l to r (1-indexed). For each query, you need to count the number of distinct elements within the subarray that are strictly greater than k.

The condition for an element a to be counted is given by the inequality:

\( a > k \)

Output the result for each query on a new line.

Note: The input format is provided below. Make sure your solution reads from stdin and writes to stdout.

inputFormat

The first line contains three integers n, m, and k separated by spaces, where n is the number of elements in the array, m is the number of queries, and k is the threshold.

The second line contains n integers representing the elements of the array.

The next m lines each contain two integers l and r, describing a query.

outputFormat

For each query, output a single integer on a new line representing the number of distinct elements in the subarray that are greater than k.

## sample
8 3 5
1 3 5 7 9 2 4 6
1 4
2 6
3 8
1

2 3

</p>