problem link:- http://mirror.codeforces.com/problemset/problem/221/D i have used mo's algorithm and my complexity fits in given time limit.. but still i am getting TLE on test 5.. please help.. my submission:- http://mirror.codeforces.com/contest/221/submission/18995087
Try using scanf/printf and possibly unordered_map. I use these in my solution and it passed.
Change cin\cout to printf\scanf and compress values instead of using map. Code