P5387 [Cnoi2019] Humanoid Danmaku.

Background

Since the problem setters have all retired, the background has been put off indefinitely.

Description

There is a game between Cirno and Marisa: First, a **sequence** $V$ is given, and all numbers are in $[1, m]$. On each turn, a player may choose $x \in V$, $y \in [1, x]$, and require that $x \oplus y \in [0, x)$, then change $x$ into $x \oplus y$. $\oplus$ denotes bitwise XOR. If a player cannot make a move, then that player is considered to lose. Assume that both Cirno and Marisa use optimal strategies. Now Cirno wants to know, when she moves first, what is the number of winning initial sequences modulo $998244353$.

Input Format

One line with two integers $|V|$ and $m$.

Output Format

One line, the answer.

Explanation/Hint

For $100\%$ of the testdata, $|V| \le 10^{18}$ and $m \le 10^6$. This problem uses bundled tests. Translated by ChatGPT 5