Run error appears again and again

coding block ide give scorrect output but while submitting it shows run error.
following is my code:

you need to increase the size of array a and count rest everything is fine

okay, now its correct. Thanks a lot.