Special Pair

Limits: 1s, 256 MB

Mr. X is an “array pagla” person. He loves doing different types of things with arrays. Today Mr. X is going to his friend Sohel Hafiz’s birthday party. He took an array A with him as a birthday present. The present contains some arbitrary numbers and queries. It also contains some special pairs in it. Two numbers will be called a special pair if:

This is a companion discussion topic for the original entry at https://toph.co/p/special-pair