Getting TLE,MLE,WA don't know why

PLZ HELP

Hey @Akshay123
Your approach seems fine
Slight changes needed
Please cross verify your approach with this https://ide.codingblocks.com/s/235860

https://ide.codingblocks.com/s/236181, still getting TLE on test case 5, PLZ HELP

@Akshay123
Just use unordered_map instead of map
Rest is fine

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.