Mike and hashtrick challenge

https://ide.codingblocks.com/s/323587 whats wrong in this code

your approach is not wrong
but it is giving TLE in one testcase due to high time complexity
try to do it using some different approach

you can try unordered map instead of map
if it work then okay
otherwise think different approach

you can take help from Reference Code