Help Me Pls! SQRDSUB

I don’t know why still get partially correct. Can somebody explain the issue?

This is my code:
https://www.codechef.com/viewsolution/37818945