**Problem link** : contest practice

**Difficulty** : CakeWalk

**Pre-requisites** : Basic programming language constructions knowledge

**Problem** : find the number of pairs for which **|a _{i}+a_{j}-K|** is minimal possible (and this minimal possible value), having the array

**a[]**and the integer

**K**given.

**Explanation** :

There were two subtasks.

In the first one **N** equals to 2. That means that the minimal difference will always be **|a _{1}+a_{2}-K|** because totally there will be only one pair.

In the second one, **N** is still fairly small, so we can check all possible pairs of {**a _{i}**,

**a**} via a brute force. I.e. we can make two nested cycles, the first one for

_{j}**i**and the second one for

**j**and there check that

**|a**has the minimal possible value.

_{i}+a_{j}-K|Actually, the problem can be solved for **N** <= 10^{6} within the same time bounds, but it was decided not to add this subtask in order to enable more people to get the full points. See tester’s solution for the details on this solution.