Bitonic Array Maximum Length

This is my code , My 2nd test case fails

‘’’’

#include
#define max 1000000
using namespace std;
//Bitonic Algorithm
long long max_arr_len(long long arr[], long long n)
{
long long inc[n];
long long dec[n];
long long i, max_val;

inc[0] = 1;

dec[n-1] = 1;

for (i = 1; i < n; i++)
inc[i] = (arr[i] >= arr[i-1])? inc[i-1] + 1: 1;

for (i = n-2; i >= 0; i--)
dec[i] = (arr[i] >= arr[i+1])? dec[i+1] + 1: 1;


max_val = inc[0] + dec[0] - 1;
for (i = 1; i < n; i++)
    if (inc[i] + dec[i] - 1 > max_val)
        max_val = inc[i] + dec[i] - 1;

return max_val;

}

//BruteForce
/*
long long max_arr_len(long long a[],long long n){
long long cnt,flag=0,max_val=-100;
for(long long i = 0;i<n;i++){
cnt=0;
for(long long j = i;j<n;j++){
if(flag==0){
if(j!=n-1){
if(a[j]<=a[j+1]){
cnt++;
}
else{
flag=1;
cnt++;
}
}
else{
cnt++;
}
}
else{
if(j!=n-1){
if(a[j]>=a[j+1]){
cnt++;
}
else{
flag=0;
cnt++;
if(j+1!=n-1)
break;
}
}
else{
cnt++;
}
}
if(cnt>max_val){
max_val=cnt;
}
}
}
return max_val;
}
*/
int main() {
long long N,n,arr[max];
cin>>N;
while(N–){
cin>>n;
for(long long i = 0;i<n;i++){
cin>>arr[i];
}
cout<<max_arr_len(arr,n)<<endl;
}
return 0;
}

‘’’’’’’’

Please help me