SOLVE

LATER

This is Code Apocalypse !!!

Problem

Editorial

Analytics

This is CODE APOCALYPSE!! People are fighting against each other ,not for food ,money or life but for points. There are **n** people and each of them is fighting for some number of points.

Now you will be given q queries containing **l** and **r**. You have to tell the maximum number of people who are fighting for same number of point from **l** to **r**.

INPUT

First line contains a integer **t** denoting the number of test cases.

Every first line of each test case contains **n** and **q** where **n** are the number of people and **q** is the number of queries.

Every second line of test case contains **n** space separated integer **a**_{i} denoting the point in non decreasing order.

Next **q** lines contains two integer **l** and **r**.

OUTPUT

For every **q** queries you have to print the maximum number of people fighting for same number of points in a new line.

CONSTRAINT

1<=**n**,**q**<=10^{5}

1<=**a**_{i}<=10^{6}

1<=**l**<=**r**<=**n**

Time Limit:
1.0 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
C,
C++,
C++14,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Julia,
Kotlin,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift,
Visual Basic

Initializing Code Editor...

{"00b89a7": "/pagelets/problem-author-tester/algorithm/this-is-code-apocalypse-1/", "20a1a56": "/pagelets/show-submission/algorithm/this-is-code-apocalypse-1/", "87497d6": "/pagelets/problems-hint/algorithm/this-is-code-apocalypse-1/", "dcafde3": "/pagelets/suggested-problems/algorithm/this-is-code-apocalypse-1/", "70713e6": "/pagelets/recommended-problems/algorithm/this-is-code-apocalypse-1/"}

realtime.hackerearth.com

80

ade9d8e0b169e3b457025dc7f00a6ea744d70360

58a29e5cae2309f04b28

/realtime/pusher/auth/