public static long Calc(int n) { long ans = 0; var fw = new LongFenwickTree(n); for (int i = 0; i < n; i++) { fw.Add(i, i + 1234); } for (int i = 0; i <= n; i++) { ans ^= fw[..i];
public void Solve(ConsoleReader cr, ConsoleWriter cw) { int N = cr; int Q = cr; int[] a = cr.Repeat(N); var fw = new LongFenwickTree(N); for (int i = 0; i < a.Length; i++) { fw.Add(i, a[i]); } for (int i = 0; i < Q; i++) { int t = cr; int l = cr; int r = cr; if (t == 0) { fw.Add(l, r); } else { cw.WriteLine(fw[l..r]);