InterviewBit Problems   Diffk II : Solved

Solution is showing memory limit exceeded (1)
Overflow and underflow cases are not test (1)
Using map in c++ is resulting in MLE and unordered map solves it... is it cause o (3)
When I used the following code with map it showed memory limit exceeded error but (2)