Same code different behaviour

Solution link (TLE) : Submission #99250735 - Codeforces

Solution link (Accepted): Submission #99250995 - Codeforces

Question Link :

Why is there TLE , both are having the same procedure and approach ?

Most probably , expression dis=xx+yy
will be overflow as x and y are of type integer , variable dis will become negative(dis<0) and hence it never comes out of while loop

2 Likes

Okay . Thanks @nihar_99