https://practice.geeksforgeeks.org/problems/longest-consecutive-subsequence/0/?track=sp-hashing&batchId=152

why does my code give tle although it is 0(n) time complexity??please tell what is wrong in this code only i dont need the correct answer i already have accesss to correct answer