"WATCHFB" solution not accepted

https://www.codechef.com/viewsolution/26832156
Question ID:- WATCHFB
Contest:- Lunchtime September
Error :- RE(SIGSEGV)

Plzz help me with this problem…

error because of array declaration with a[10]
try to intialize with given n or max limit given in constraints
moreover logic is wrong