Getting TLE for O(1) time per test case in DIVPAIR

i have solved divpair (practice-medium) in O(1) per testcase time but still getting TLE
http://www.codechef.com/viewsolution/5466658

Can someone please help me got struck with this !!

Your code is invoking undefined behavior. Please check the access specifier for “unsigned long long”.

Its because you are specifying wrong format for unsigned long long. Its %llu not %lld.

Here is the updated version your solution that doesn’t give TLE. Changed %lld to %llu and cout to printf

http://www.codechef.com/viewsolution/5469322

It is giving WA now though