import java.io.*; import java.util.*; class Main { static final long calc(int[] a){ int n=a.length; int[]b=a.clone(); { // coord comp int[]c=b.clone(); Arrays.sort(c); int pos=0; Maphm=new HashMap(); for(int i=0;i 0) { x = (x - 1) / 2; this.seg[x] = this.seg[2 * x + 1] + this.seg[2 * x + 2]; } } long query(int l, int r) { l += SIZE - 1; r += SIZE - 1; long y = 0; while (l < r) { if ((l & 1) == 0) { y = y + this.seg[l]; } if ((r & 1) == 0) { y = y + this.seg[r - 1]; } l /= 2; r = (r - 1) / 2; } return y; } }