Run error in test casses

im getting run error for all the test cases except the first one in this question . Here’s the code

#include
#include
using namespace std;
int main() {
int arr[10],n,m;
cin>>n;
for(int i=0;i<n;i++ )
{
cin>> m;
for(int i = 0;i<m;i++)
{
cin>>arr[i];
}
next_permutation(arr,arr+m);
for(int i =0 ; i<m ; i++)
{
cout<<arr[i]<<" ";
}
cout<<endl;

} 
return 0;

}

code is correct
just change the size of array according to constraints
1 <= N <= 1000

so make size of array atleast 1000
Modified 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.