How to find total numbers having frequency=kin a particular range(l,r) in a given array. There are total 10^5 queries of formatl,rand each query is built on the basis of previous query's answer. In particular, after each query we incrementlby the result of the query, swappinglandrifl>r. Note that0<=a[i]<=10^9. Total elements in array isn=10^5.
Sample Input:
5 2 3 #n,k,q7 6 6 5 5 #array (a)0 4 #query13 0 #query24 1 #query3
Sample Output:
2 #ans to query11 #ans to query21 #ans to query3