I do not understand why I need to put
(t1==t2 && i==2*n)
at line 44 inside the if condition in my code. The loop will run till i<=2*n and both the codes should give same answer, but the first one is giving TLE and 2nd is getting accepted.
code with TLE: TLE
code accepted: AC