Candidate Walk-LTIMEJAN15 Problem

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

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

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