{"problem":{"name":"Pair of Sequences","description":{"content":"You are given integers $N$, $M$, $X$, and $Y$. Find the number, modulo $998244353$, of pairs $(A, B)$ of sequences $A=(a_1,\\ldots,a_N)$ and $B=(b_1,\\ldots,b_N)$ that satisfy all of the following condi","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":8000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"agc069_e"},"statements":[{"statement_type":"Markdown","content":"You are given integers $N$, $M$, $X$, and $Y$.\nFind the number, modulo $998244353$, of pairs $(A, B)$ of sequences $A=(a_1,\\ldots,a_N)$ and $B=(b_1,\\ldots,b_N)$ that satisfy all of the following conditions:\n\n*   $A = (a_1, \\ldots, a_N)$ is a sequence of non-negative integers.\n*   $B = (b_1, \\ldots, b_N)$ is a subsequence of $(0, 1, \\ldots, M - 1)$.\n*   $\\sum\\limits_{i=1}^{N} a_i = X$.\n*   $\\sum\\limits_{i=1}^{N} a_i b_i = Y$.\n\n## Constraints\n\n*   $1 \\leq N \\leq M \\leq 2 \\times 10^5$\n*   $1 \\leq X, Y \\leq 2 \\times 10^5$\n*   All input values are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $M$ $X$ $Y$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"agc069_e","tags":[],"sample_group":[["3 4 3 4","5\n\nHere are the five pairs $(A, B)$ satisfying the conditions:\n\n*   $A = (0, 2, 1)$, $B = (0, 1, 2)$\n*   $A = (1, 0, 2)$, $B = (0, 1, 2)$\n*   $A = (1, 1, 1)$, $B = (0, 1, 3)$\n*   $A = (1, 2, 0)$, $B = (0, 2, 3)$\n*   $A = (2, 1, 0)$, $B = (1, 2, 3)$"],["1 1 1 1","0\n\nThere are no pairs $(A, B)$ satisfying the conditions."],["12345 67890 9876 54321","150392014\n\nFind the count modulo $998244353$."]],"created_at":"2026-03-03 11:01:14"}}