Need Help in ARRCENT

What is the problem with my solution? my array is not storing more than 50 or
60 numbers.
I am getting correct answer for small N but not for large
I feel the logics are correct and there shouldn’t be a case of overflow

https://www.codechef.com/viewsolution/33107966