Spoj CTRICK
How to solve the problem CTRICK on spoj. Can someone also suggest a good material for reading about fenwick trees.