Please help me in CSUB

https://www.codechef.com/viewsolution/17435589
This is my solution for the problem CSUB,its showing wrong answer after trying many times.Then i saw the editorial and compared every test case by using Editorials logic and mine simultaneously,and there’s no difference in Answers.But Anyway its showing Wrong Answer for my Submission.

Can yoou please tell me why its happening so ?

Thats because of overflow, N^2=10^10 which doesnt fit in int ,use long.

Ur ac solution:
https://www.codechef.com/viewsolution/17435883