Sir why this code on other compiler is giving rigth output

#include
#include
using namespace std;
int bitonic(long int a[],long int n)
{
long int inc[10000],dec[10000];
inc[0]=1;
dec[n-1]=1;
for(int i=1;i<n-1;i++)
{
if(a[i]>=a[i-1])
{
inc[i]=inc[i-1]+1;
}
else
{
inc[i]=1;
}
}
for(int i=n-2;i>=0;i–)
{
if(a[i]>=a[i+1])
{
dec[i]=dec[i+1]+1;
}
else
{
dec[i]=1;
}
}
int curr=0;
int max_sum=(inc[0]+dec[0])-1;
for(int i=1;i<n;i++)
{

   curr=(inc[i]+dec[i])-1;
   max_sum=max(curr,max_sum);

 }
 return max_sum;

}
int main()
{
int t;
cin>>t;
while(t>0)
{
long int n,arr[100000];
cin>>n;
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
cout<<bitonic(arr,n)<<endl;
t–;

}    

}

@Harshit-Kumar-2577121455897279
hello harshit
image

in constraint it is mentioned that n can be upto 1000000 so ur inc and dec array size should be greater than that

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.