410576: GYM104053 J Math Exam
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
J. Math Examtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output
There are many integer sequences in the world, and your mission is to find how many sequences are good.
An integer sequence $$$a_i$$$ of length $$$n$$$ is good if and only if all of these conditions holds:
- $$$\forall i \in [1,n], 4S_i = {a_i}^2 + 2a_i + 1$$$.
- $$$\forall i \in [1,n], |a_i| \le m$$$.
Where $$$S_i = \sum_{j=1}^i a_j$$$.
You will be given $$$n$$$ and $$$m$$$, and it is guaranteed that $$$m$$$ is odd.
Since the answer may be very large, you should calculate it modulo $$$998\, 244\, 353$$$.
InputThe only line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^7$$$, $$$1 \le m \leq 2n$$$, $$$m$$$ is odd).
OutputOutput a single integer — the number of good sequences meeting the constraints, modulo $$$998\, 244\, 353$$$.
ExamplesInput9 13Output
124Input
500 999Output
195157058