Why do some problems have constraints as t (1≤ t ≤10^4) and (1≤ n ≤2⋅10^5) gives TLE for O(N^2) solution , also when time limit is 2sec. By the way I am talking about this problem.

I think bruh you are assuming that if for 10^9 operations it took 1 sec then for 10^18 it will take 2 sec. Please analyze your doubt without posting it randomly.