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 T 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 N space separated integers denoting the array arr[]. Third line of test case contains Q 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