Run Error in a Code

I tried to implement the approach given in the editorial for the problem regarding Bitonic Subarry, but I it gives “Run Error”. AI tried again by reducing the size of the arrays to 1000 and 2 test cases passed, while Run error was given in anther 2. The code works on other IDEs so I am not sure what the problem is. Please check.

using namespace std;

int main() {
int t;
int arr[1000000], inc[1000000], dec[1000000];
//cout<<"Enter t ";
cin>>t;

for(int test = 0; test < t; test++)
{
	long long int n;
	int m = 0;
	cin>>n;
	for(int i = 0; i<n; i++)
	{
		cin>>arr[i];
	}
	inc[0] = 1;
	for(int i = 1; i<n; i++)
	{
		if(arr[i-1] <= arr[i])
		{
			inc[i] = inc[i-1] + 1;
		}
		else
		{
			inc[i] = 1;
		}

	}
	dec[n-1] = 1;
	for(int i = n - 2; i >= 0; i--)
	{
		if(arr[i] >= arr[i+1])
			dec[i] = dec[i + 1] + 1;
		else
		{
			dec[i] = 1;
		}
	}
	for(int i = 0; i < n; i++)
	{
		if((inc[i] + dec[i] - 1) > m)
			m = inc[i] + dec[i] - 1;
	}
	cout<<m<<endl;
}
return 0;

}

Save your code on ide.codingblocks.com and then share its link.

This is the code with size of array taken as 1000

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.