Run time error

I am consistently getting run time error please help me with my problem.
Here’s the link:

It may happen because you are wasting a lot of memory by declaring an array of size 50 but you got limited memory with which you must get the output.

try declaring the array as a[N] after taking the input of N, as it would make


This is because you are initializing the array (arr) of size 50.
you should do it like this.
scanf("%d", &N);
int arr[N];


Thank you guys.