#P11799. Triple Nested XOR Sum
Triple Nested XOR Sum
Triple Nested XOR Sum
Problem Statement:
You are given an integer sequence \(a_1, a_2, \ldots, a_n\) of length \(n\) and an integer \(m\). Your task is to compute the following sum:
\[ S = \sum_{i=1}^{n} \sum_{j=1}^{n} \sum_{k=0}^{m} \min(a_i \oplus k,\; a_j \oplus k)\]
Here, \(\oplus\) denotes the bitwise XOR operation. Since the answer may be very large, output the result modulo \(998244353\).
inputFormat
The first line of input contains two integers \(n\) and \(m\) separated by a space.
The second line contains \(n\) space-separated integers \(a_1, a_2, \ldots, a_n\).
outputFormat
Output a single integer representing \(S \bmod 998244353\).
sample
2 1
1 2
8