Limits: 277h46m40s, 128 MB
You will be given an array A of n integers. All elements of the array are between 1 and 50 (inclusive). Also, you will be given three integers L, R and k. Consider a subarray AL, AL+1,.....,AR . Now you have to tell how many unique values have at least k occurrences in that subarray.
This is a companion discussion topic for the original entry at https://toph.co/p/horrible-queries