P16261 [Lanqiao Cup 2026 NOI Qualifier Python/Java Group B] Interference Fringes
Description
In the National Precision Optics Laboratory, researchers are using two sets of high-power coherent lasers to carry out a “quantum interference fringes” locking experiment.
Let the output power of Laser 1 be $a$ ($0 \leq a \leq 20269876543210$), and the output power of Laser 2 be $b$ ($0 \leq b \leq 20260123456789$), where $a$ and $b$ are both non-negative integers.
Physical laws show that the interference fringes can be successfully locked only when the total system power $S = a + b$ is exactly a perfect square.
How many different power allocation plans $(a, b)$ can make the experiment successfully lock? Since the number of plans may be very large, you only need to output the result modulo $998244353$.
Note: Two plans $(a_1, b_1)$ and $(a_2, b_2)$ are considered different if and only if $a_1 \neq a_2$ or $b_1 \neq b_2$.
Input Format
N/A
Output Format
This is an output-only fill-in-the-blank problem. You only need to compute the result and submit it. The answer is a single integer. When submitting, fill in only this integer; any extra content will result in no score.
Explanation/Hint
Translated by ChatGPT 5