I am getting segmentation fault in coingblocks ide but not on codechef. Why is that?

And please tell improvement to remove the fault.

It is due to the large amount of memory allocation in the array

So how to solve this?

u can use a vector for large memory allocation.