Help in question SPREAD

,

Can anybody please explain me where I went wrong .My output is showing 0 on online compiler, but is working well on codeblocks.

link to the question is:https://www.codechef.com/problems/SPREAD
ans is below: https://www.codechef.com/viewsolution/15527368

//