Chef has an array
consisting of positive integers. This array is sorted in non-decreasing order from left to right.
You are given queries. Each query consists of three integers . The answer to this query can be found as follows. Consider the subarray . The answer to the query is the count of numbers in this subarray that are greater than or equal to .
Input Format
- The first line of each test case contains two space-separated integers .
- The second line contains space separated integers denoting the array .
- Each of the next lines contains three space-separated integers denoting the query.
Output Format
Output lines one for each query containing the answer for the corresponding query.
Constraints
Subtasks
- For of the score:
- For of the score:
- Remaining : No extra constraints.
Sample Input 1
5 6
1 2 3 6 9
1 5 1
1 5 3
1 5 10
1 4 4
2 5 4
2 5 1
Sample Output 1
5
3
0
1
2
4
Explanation
- For the first query, all the elements of the array are . Thus, the answer is .
- For the second query, the answer will be , as the elements are >3.
ConversionConversion EmoticonEmoticon