A Simple If-Else and Loop Problem. Or is it? 😕

Limits: 3s, 1.0 GB

The requirement for this problem is as simple as it can be.

You will be given a sequence of N integers: P1, P2, … , Pn. You have to find the number of possible pairs (Pi, Pj) such that: i ≠ j and A ≤ Pi + Pj ≤ B where A and B are two integers.

This is a companion discussion topic for the original entry at https://toph.co/p/a-simple-if-else-loop-problem-or-is-it