What's wrong with this code?

#include

using namespace std;

int main()
{
int T;
cin>>T;
for(int I=0;I<T;I++)
{
int n;
cin>>n;
int a;
a = new int[n];
int i;
for(i=0;i<2
((int)(n/2));i++)
{
if(i%2==0)
{
a[i]=i+2;
}
else
{
a[i]=i;
}
}
if(n%2!=0)
{
a[i]=a[i-1];
a[i-1]=n;
}
for(int j=0;j<n;j++)
cout<<a[j];
cout<<"\n";
}
return 0;
}

You can’t share code related to ongoing contest!!

@vnr5508 delete your question, otherwise, there’s a possibility you might get disqualified from the contest!!