document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. void update(int idx ,int val){
  2.     while (idx <= N){
  3.         res[idx] += val;
  4.         idx += (idx & -idx);
  5.     }
  6. }
');