Interesting Queries
Medium Accuracy: 13.77% Submissions: 3083 Points: 4

Given an array arr[] of N elements and Q queries . Each query consists of two integers L and R . You task is to find the number of elements of arr[] in range [L,R] which occur atleast K times.

Input:

First line of input consist of a single integer denoting the total number of test case. First line of test case contains three space separated integers N,Q and K. Second line of test case contains space separated integers denoting the array arr[]. Third line of test case contains pairs of integers Li and Ri denoting  Q queries.


Output:

For each test case output a single line consisting of Q integers , representing  the answer to each query


Constraints:

T=10

1<=N,Q,K<=10000

1<=a[i]<=1000


Example:

Input:

1

5 2 1

1 1 2 1 3

1 5 2 4

Output:

3 2

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.