Can anyone please explain me why first code https://www.codechef.com/viewsolution/21531950 gets TLE while the second one https://www.codechef.com/viewsolution/21531975 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