SIGSEGV Error in VOTERS problem

Can anyone please tell me how can i treat the SIGSEGV error in the following code Problem Code:VOTERS

#include<stdio.h>
#include<stdbool.h>
int arr[50000];
bool a[150000];
int main()
{
	int list1=0,list2=0,list3=0,i=0,index=0,no=0,temp=0,j=0;

	scanf("%d %d %d",&list1,&list2,&list3);
	for(i=0;i<list1;i++)
	{
	scanf("%d",&no);
	a[no]=1;
	}
	for(i=0;i<list2;i++)
	{
		scanf("%d",&no);
		if(a[no]==1)
		{
			arr[index]=no;
			a[no]=0;
			index++;
		}
		else
		{
			a[no]=1;
		}
	}
	for(i=0;i<list3;i++)
	{
		scanf("%d",&no);
		if(a[no]==1)
		{
		arr[index]=no;
		index++;
		}
	}

	 for(i=1;i<index;i++){
      temp=arr[i];
      j=i-1;
      while((temp<arr[j])&&(j>=0)){
      arr[j+1]=arr[j];
          j=j-1;
      }
      arr[j+1]=temp;
  }

	printf("%d\n",index);

	for(i=0;i<index;i++)
	{
		printf("%d\n",arr[i]);
	}
	return 0;
}

ur bool array size is small…increase it by say arnd 10 times…u will get an AC…hope this helps…:slight_smile:

//