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:SPREAD Problem - CodeChef
ans is below: CodeChef: Practical coding for everyone