Divisible subarrays segmentation error

Hello Team,

Can you please check out my code for divisible subarrays and let me know why it is showing segmentation error?

My code does not differ much from Prateek bhaiya’s s explained in the video

Just reduce the size of both the array to 10^5.
You cannot create an integer array of size with order > 10^5 inside the main. It will give an error.
If you declare the array outside the main as global, the maximum size allowed is upto 10^7

//DEBUG:::::

lets make pre[1000005] to pre[n] and arr[1000005] to arr[n+1]
because there are many test cases and may exceed time limit while initializing the array with zero

your updated code:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.