https://www.codechef.com/problems/VOTERS

https://www.codechef.com/problems/VOTERS.
someone please help me where am i going wrong.
my code is:
#include<stdio.h>
int presentinb(int w,int *v,int x)
{
int i;
for(i=0;i<x;i++)
{
if(w==*v)
return 1;
v++;
}
return 0;
}
int presentinc(int u,int *y,int z)
{
int i;
for(i=0;i<z;i++)
{
if(u==*y)
return 1;
y++;
}
return 0;
}
int main()
{
int n1,n2,n3;
scanf("%d %d %d",&n1,&n2,&n3);
int a[n1],b[n2],c[n3];
int i,j,k;
int d[n1+n2+n3];
for(i=0;i<n1;i++)
{
scanf("%d",&a[n1]);
}
for(i=0;i<n2;i++)
{
scanf("%d",&b[n2]);
}
for(i=0;i<n3;i++)
{
scanf("%d",&c[n3]);
}
j=0;
for(i=0;i<n1;i++)
{
if((presentinb(a[i],b,n2)==1)||(presentinc(a[i],c,n3)==1))
{
d[j]=a[i];
j++;
}
}
int e=0;
for(i=0;i<n2;i++)
{
if(presentinc(b[i],c,n3)==1)
{
for(k=0;k<j;k++)
{
if(b[i]!=d[k])
{
e++;
}
}
if(e==j)
{
d[j]=b[i];
j++;
}
e=0;
}
}

int t=0;
for(i=0;i<j-1;i++)
{
	for(k=0;k<j-i-1;k++)
	{
		if(d[k+1]<d[k])
		{
			t=d[k+1];
			d[k+1]=d[k];
			d[k]=t;
		}
	}
}
printf("%d\n",j);
for(i=0;i<j;i++)
{
	printf("%d\n",d[i]);
}

}
please.

Please don’t copy paste your unformatted code into the description. Provide a link to the code. Since you have not submited this on codechef yet, you do not have a submission link but that’s fine, you can use ideone.com instead. I indented and submitted your code on ideone. https://ideone.com/vy4uX4

The most obvious errors are at lines 33, 37 and 41. Instead of n1, n2, n3 it should be i, j, k. Even after fixing this though, your solution would not pass on larger test cases ( assuming the rest of it is correct ).
The time complexity of the loop starting at line 44 is n_1*(n_2+n_3). That means that some lines ( like line 7 ) will be executed a large number of times ( n_1\cdot n_2 for line 7 ). Since codechef servers cannot execute that number of instructions in the give time limit ( 1.15243 secs ) your solution would not pass.

I would suggest you look at this and try to come up with a different solution to the problem.