Triple Pair

AtCoder
IDarc160_b
Time2000ms
Memory256MB
Difficulty
You are given a positive integer $N$. Find the number, modulo $998244353$, of triples of positive integers $(x,y,z)$ that satisfy the following condition. * All of $xy$, $yz$, $zx$ are less than or equal to $N$. You have $T$ test cases to solve. ## Constraints * $1 \le T \le 100$ * $1 \le N \le 10^9$ ## Input The input is given from Standard Input in the following format, where $\mathrm{case}_i$ represents the $i$\-th test case: $T$ $\mathrm{case}_1$ $\mathrm{case}_2$ $\vdots$ $\mathrm{case}_T$ Each test case is in the following format: $N$ [samples]
Samples
Input #1
4
1
2
5
998244353
Output #1
1
4
17
727512986

In the first test case, $N=1$. There is one triple $(x,y,z)$ that satisfies the condition: $(1,1,1)$.
In the second test case, $N=2$. There are four triples $(x,y,z)$ that satisfy the condition: $(1,1,1),(2,1,1),(1,2,1),(1,1,2)$.
API Response (JSON)
{
  "problem": {
    "name": "Triple Pair",
    "description": {
      "content": "You are given a positive integer $N$. Find the number, modulo $998244353$, of triples of positive integers $(x,y,z)$ that satisfy the following condition. *   All of $xy$, $yz$, $zx$ are less than or",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc160_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given a positive integer $N$.\nFind the number, modulo $998244353$, of triples of positive integers $(x,y,z)$ that satisfy the following condition.\n\n*   All of $xy$, $yz$, $zx$ are less than or...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments