All except one test case is passing. where is the logic flawed?
Tried with unsigned long long. Still the same test case is failing.
you need to change also these lines:
if(len%2 == 0) result += (len/2)*(len+1); else result += len*((len+1)/2);