the problem

my solution

the code runs fine with the given input but throws an error when i run it
please help

Your code declares an array of size 100 only whereas the size of array input could be upto 100000 so when your code tries to access an element beyond 100 it returns a segmentation fault or SIGSEGV error.