P8834 [ChuanZhi Cup #3 Final] Sequence
Background
disangan333 likes disangan233, so he also wants you to help him count.
Description
ChuanZhi Academy has $n$ students, and each student has a number $a_n$. There is also a constant $k$.
If there are two students, the $i$-th student and the $j$-th student, satisfying $i < j$ and $a_i \times a_j \leq k$, then these two students are called a "harmonious pair". How many "harmonious pairs" are there among these students?
For all testdata, $n \leq 10^3$, $a_i \leq 10^5$, $k \leq 10^9$.
Input Format
The input has $2$ lines.
The first line contains two positive integers $n, k$.
The second line contains $n$ positive integers $a_1 \ldots a_n$.
Output Format
Output $1$ line with $1$ integer, which is the answer.
Explanation/Hint
# Sample Explanation
In the sample, the $4$ pairs $(1, 2)$, $(1, 3)$, $(1, 4)$, $(1, 5)$ are all "harmonious pairs".
Translated by ChatGPT 5