L. Starquake!
time limit per test
3 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
19 7
-5 -5 4 2 4 2 4 3 4 -5 -5 -5 11 11 10 9 8 9 10
QUERY 1 19
QUERY 2 11
STARQUAKE 3 11
QUERY 2 11
FISSURE 4 9 7
QUERY 2 11
QUERY 1 19
Output
8
7
3
3
4