I have found a solution with time complexity O(n sqrt(n)) for a problem with n<=10^5, test cases<=5, individual array Integers are <=10^5 and time limit is 2 seconds. But i am getting TLE for most of the cases in last sub-task. Language used= python, pypy

I don’t understand why all cases of last subtask not working although 2 cases of last subtask got accepted.