package no259; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.util.NoSuchElementException; //0 | 0 1 2 2 1 0 //1 | 1 2 2 1 0 0 //2 | 2 2 1 0 0 1 public class Main { public static void main(String[] args) { IO io = new IO(); int n = io.nextInt(); int q = io.nextInt(); int n2 = n * 2; BIT bit = new BIT(n2); for(int qq=0;qq0) { s+=bit[i]; i-=i&-i; } return s; } public long get(int index) { return sum(index,index+1); } public void set(int index,long num) { accumulate(index,num-get(index)); } public String toString() { long[] value = new long[n]; for(int i=0;i Integer.MAX_VALUE) { throw new NumberFormatException(); } return (int) nl; } public char nextChar() { if (!hasNext()) { throw new NoSuchElementException(); } return (char) readByte(); } public double nextDouble() { return Double.parseDouble(next());} public int[] nextIntArray(int n) { int[] a = new int[n]; for(int i=0;i