Can anyone paste link to solution?
I don’t have a solution (and wouldn’t post it if I did), but I can give you a link to some hints from the problem setter.
See https://codeforces.com/blog/entry/55599
how I can use 2 d fenwick.It will lead to segmentation fault
I’ve no idea, I’ve not solved it.