Codeforces Round 995 (Div. 3) |
---|
Finished |
You are given a sequence $$$a$$$, consisting of $$$n$$$ integers, where the $$$i$$$-th element of the sequence is equal to $$$a_i$$$. You are also given two integers $$$x$$$ and $$$y$$$ ($$$x \le y$$$).
A pair of integers $$$(i, j)$$$ is considered interesting if the following conditions are met:
Your task is to determine the number of interesting pairs of integers for the given sequence $$$a$$$.
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
Each test case consists of two lines:
Additional constraint on the input: the sum of $$$n$$$ across all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, output one integer — the number of interesting pairs of integers for the given sequence $$$a$$$.
74 8 104 6 3 66 22 274 9 6 3 4 53 8 103 2 13 1 12 3 43 3 63 2 14 4 123 3 2 16 8 81 1 2 2 2 3
4 7 0 0 1 5 6
In the first example, there are $$$4$$$ interesting pairs of integers:
Name |
---|