cakeWalk -runtime error

problem link:

solution link:
https://www.codechef.com/viewsolution/27509071

why I am getting Runtime error (NZEC)?

a=[0]*int(math.sqrt(n))

if(a[2]!=0 and a[5]!=0)

If n<25 then len(a) will be less than 5.

in that scenario it must give index out of range.

if(n>2):
    a[n]+=1

Here ā€œnā€ could be a float.