Candidate Walk-LTIMEJAN15 Problem

What is wrong with my code for the case (n==1) ?

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

integer overflow.

The formula is (d*(d+1)(2d+1))/6.

You also need to take care of integer overflow.

declare variable d to be long long int

you have to put d=d-1 in that formula. And see this solution

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

Got it. Such a silly mistake thnx :wink:
Happy Coding