why do I get SIGSEGV in the problem

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

This is because (max - min) can be very huge(as large as 1e9).
You cannot allocate such a large sized array(forget about accessing elements).
Try to think of a different approach to this problem.

//