TLE in two test cases

Code File:

Why is the time complexity not O(n)?
According to me the program must run in O(n) time complexity. But, code gets TLE for two test cases.

hello @prat98
use unordered map in place of ordered map

Thanks for the information…