codeforces#P1520D. Same Differences
Same Differences
Description
You are given an array of integers. Count the number of pairs of indices such that and .
The first line contains one integer (). Then test cases follow.
The first line of each test case contains one integer ().
The second line of each test case contains integers () — array .
It is guaranteed that the sum of over all test cases does not exceed .
For each test case output the number of pairs of indices such that and .
Input
The first line contains one integer (). Then test cases follow.
The first line of each test case contains one integer ().
The second line of each test case contains integers () — array .
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case output the number of pairs of indices such that and .