{"problem":{"name":"Accumulating Many Times","description":{"content":"You are given $N$ length-$M$ sequences, where each element is $0$ or $1$. The $i$\\-th sequence is $A_i = (A_{i, 1}, A_{i, 2}, \\dots, A_{i, M})$. For integers $i, j \\ (1 \\leq i, j \\leq N)$, define $f(i","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc184_e"},"statements":[{"statement_type":"Markdown","content":"You are given $N$ length-$M$ sequences, where each element is $0$ or $1$. The $i$\\-th sequence is $A_i = (A_{i, 1}, A_{i, 2}, \\dots, A_{i, M})$.\nFor integers $i, j \\ (1 \\leq i, j \\leq N)$, define $f(i, j)$ as follows:\n\n*   $f(i, j) :=$ The smallest non-negative integer $x$ such that $A_i$ and $A_j$ become identical after performing the following operation $x$ times, or $0$ if such $x$ does not exist.\n    *   For all integers $k \\ (1 \\leq k \\leq M)$ simultaneously, replace $A_{i, k}$ with $\\displaystyle \\left (\\sum_{l=1}^{k} A_{i, l} \\right ) \\bmod 2$.\n\nFind $\\displaystyle \\sum_{i=1}^{N} \\sum_{j=i}^{N} f(i, j)$, modulo $998244353$.\n\n## Constraints\n\n*   $1 \\leq N \\times M \\leq 10^6$\n*   $A_{i, j} \\in {0, 1}$\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $M$\n$A_{1, 1}$ $A_{1, 2}$ $\\cdots$ $A_{1, M}$\n$A_{2, 1}$ $A_{2, 2}$ $\\cdots$ $A_{2, M}$\n$\\vdots$\n$A_{N, 1}$ $A_{N, 2}$ $\\cdots$ $A_{N, M}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc184_e","tags":[],"sample_group":[["4 3\n1 0 0\n1 1 0\n1 0 1\n0 1 1","8\n\n$f(1, 1) = 0$, $f(1, 2) = 3$, $f(1, 3) = 2$, $f(1, 4) = 0$, $f(2, 2) = 0$, $f(2, 3) = 3$, $f(2, 4) = 0$, $f(3, 3) = 0$, $f(3, 4) = 0$, $f(4, 4) = 0$, so print their sum, $8$."],["7 6\n1 0 0 0 0 0\n1 1 1 0 0 0\n1 0 1 1 0 0\n1 0 0 0 1 1\n1 0 0 0 0 1\n1 0 0 0 0 0\n1 1 1 1 1 1","6"]],"created_at":"2026-03-03 11:01:14"}}