Chika gives you an integer sequence $a_1, a_2, \ldots, a_n$ and $m$ tasks. For each task, you need to answer the number of "friendly pairs" in a given interval.
friendly pair: for two integers $a_i$ and $a_j$, if $i<j$ and the absolute value of $a_i-a_j$ is no more than a given constant integer $K$, then $(i, j)$ is called a "friendly pair".A friendly pair $(i, j)$ in a interval $[L,R]$ should satisfy $L \leq i < j \leq R$.