P10704 Redemption
Background
>$$Lord,$$
>
>$$is this person also someone we must save\dots$$
>
>$$May my barrage of bullets put out your suffering\dots$$
>
>$$If you see an angel who gives off an ominous aura,$$
>
>$$please tell her for me:$$
>
>$$I have never forgotten her\dots$$
Description
Given $n$, $m$, and $n$ integers $a_i$ ($1 \le i \le n$).
Compute:
$$ \sum\limits_{i=1}^{n} \sum\limits_{j=1}^{n}\left \lfloor \frac{m}{a_i a_j} \right \rfloor$$
Output the result modulo $998244353$.
Input Format
The first line contains two integers $n$ and $m$.
The second line contains $n$ integers $a_1, a_2 \dots a_n$.
Output Format
Output one integer, the result modulo $998244353$.
Explanation/Hint
#### Sample Explanation
The contributions in Sample 1 are as follows:
$(a_1, a_1): \left \lfloor \frac{30}{2\times 2} \right \rfloor = 7$.
$(a_1, a_2), (a_2, a_1): \left \lfloor \frac{30}{2\times 2} \right \rfloor \times 2 = 14$.
$(a_1, a_3), (a_3, a_1): \left \lfloor \frac{30}{2\times 8} \right \rfloor \times 2 = 2$.
$(a_1, a_4), (a_4, a_1): \left \lfloor \frac{30}{2\times 4} \right \rfloor \times 2 = 6$.
$(a_1, a_5), (a_5, a_1): \left \lfloor \frac{30}{2\times 2} \right \rfloor \times 2 = 14$.
$(a_2, a_2): \left \lfloor \frac{30}{2\times 2} \right \rfloor = 7$.
$(a_2, a_3), (a_3, a_2): \left \lfloor \frac{30}{2\times 8} \right \rfloor \times 2 = 2$.
$(a_2, a_4), (a_4, a_2): \left \lfloor \frac{30}{2\times 4} \right \rfloor \times 2 = 6$.
$(a_2, a_5), (a_5, a_2): \left \lfloor \frac{30}{2\times 2} \right \rfloor \times 2 = 14$.
$(a_3, a_5), (a_5, a_3): \left \lfloor \frac{30}{2\times 8} \right \rfloor \times 2 = 2$.
$(a_4, a_4): \left \lfloor \frac{30}{4\times 4} \right \rfloor = 1$.
$(a_4, a_5), (a_5, a_4): \left \lfloor \frac{30}{2\times 4} \right \rfloor \times 2 = 6$.
$(a_5, a_5): \left \lfloor \frac{30}{2\times 2} \right \rfloor = 7$.
$7 + 14 + 2 + 6 + 14 + 7 + 2 + 6 + 14 + 2 + 1 + 6 + 7 = 88$.
#### Constraints
| Subtask ID | $n$ | $m$ | $a_i$ | Score | Special Property |
| :----------: | :----------: | :----------: | :----------: | :----------: | :----------: |
| $0$ | $\le 10^2$ | $\le 10^{6}$ | $\le 10^5$ | $10$ | $-$ |
| $1$ | $\le 10^4$ | $\le 10^{10}$ | $\le 10^9$ | $10$ | $-$ |
| $2$ | $\le 10^6$ | $\le 10^{10}$ | $\le 10^4$ | $10$ | $-$ |
| $3$ | $\le 10^6$ | $\le 10^8$ | $\le 10^9$ | $20$ | $-$ |
| $4$ | $\le 10^6$ | $\le 10^{10}$ | $\le 10^9$ | $20$ | $A$ |
| $5$ | $\le 10^6$ | $\le 10^{10}$ | $\le 10^9$ | $30$ | $-$ |
Special property $A$: $\sum\limits_{i=1}^{n} a_i \le 10^7$.
For $100\%$ of the testdata: $1 \le n \le 10^6$, $1 \le a_i \le 10^9$, $\sum\limits_{i=1}^{n} a_i \le 10^9$, and $1 \le m \le 10^{10}$.
**Special note: This problem uses bundled subtask testing. You can only get the score for a subtask after passing all test points in that subtask.**
Translated by ChatGPT 5