Chef and Dolls showing SIGSEV error

Hi,
My code is getting SIGSEV error even though my answer is coming correctly for the sample inputs. I’m unable to resolve this error. Could someone please help me out in rectifying this error as I’m not able to understand where I’m going wrong.

My code is as follows:
#include

using namespace std;

int main()
{
int T,N,ti;
cin>>T;
for(int i = 0; i < T; i++)
{
cin>>N;
int arr[N] = {0}; //initialized all array elements to 0
for(int i = 0; i < N; i++){
cin>>ti;
arr[ti]++; //Using index as doll type and increasing the value of the element at the index as we encounter that particular type of doll
}
for(int j = 0; j < N; j++){
if(arr[j]%2!=0)
cout<<j<<endl;
}
}
return 0;
}