please help with time complexity

Can anyone please explain me why first code CodeChef: Practical coding for everyone gets TLE while the second one CodeChef: Practical coding for everyone doesn’t. The only difference between them is in loop condition. In first its (i*i)<=d while in second its i<=(d/i).

Overflow?
Try long long.

3 Likes