Polo the Penguin and the Numbers giving runtime error

plz help me with this question. its giving runtime error(sigsegv).


and here is my solution:
http://www.codechef.com/viewsolution/2943287
plz also tell me how to deal with large input test cases like around 10^9 as this code works fine with small inputs but not with the large ones…thanks

some one plz answer this!!!

The range of a and b lies in the range [1 , 10^9] and you are declaring your array as numbers[b-a+1]. In the worst possible case when a=1 and b=10^9, you will be declaring an array of size 10^9 which is far more than what can be allotted.

You should come up with a better and less memory intensive algorithm for this problem.

//