REAYZCODETST - Coding Test

no tags 

Great programmer “Tourist” is attending a coding test. In this test he is asked to solve an easy problem. The problem description is:

There is an array a consists of n integers and another nonnegative integer x. He need to find the number of pair (i, j) where i != j and ai – aj = x.

As it is very easy for him, he gave you this problem and start trying another hard problem. Can you solve this for him?

Input

Input starts with an integer t (1 ≤ t ≤ 10), number of test case.

Each case contains two integer n (1 ≤ n ≤ 105), and x (0 ≤ x ≤ 109).

Next line contains n separated integers ai (1 ≤ ai ≤ 109).

Output

For each case, print the case number and the number of pairs which meet the above condition.

Example

Input:
2
5 3
5 1 4 2 3
10 2
12 17 19 13 17 11 17 12 15 14

Output:
Case 1: 2
Case 2: 10

hide comments
julkas: 2018-09-29 18:19:08

@nadstratosfer Try x=0.

nadstratosfer: 2018-09-29 16:45:37

I don't understand why I'm getting WA in this simple problem. What case does my solution fail on?

Julkas, of course I have handled x=0. Thanks Zukow!

Last edit: 2018-09-30 04:29:59

Added by:Nabil
Date:2018-09-18
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All