Why timelimit exceeds

possibily becuase of hash_str and the other array size

refer to thi s

sir your code is also not pssing all the testcases

this code is from the editorial this will help u better
sorry for the previous link