#P10288. Frequency Query
Frequency Query
Frequency Query
You are given a positive integer sequence of length .
There are queries. In the -th query (), you are given three integers , , and . You need to determine the number of times appears in the subarray .
inputFormat
The first line contains two integers and .
The second line contains positive integers representing the sequence .
Each of the following lines contains three integers , , describing a query.
outputFormat
For each query, output one integer — the number of occurrences of in the subarray .
sample
5 3
1 2 1 3 1
1 5 1
2 4 2
3 5 3
3
1
1
</p>