Interesting Queries
Submissions: 2080   Accuracy:

10.34%

  Difficulty: Medium   Marks: 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

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Pranay Pandey
Author: pra1nay7_313


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.