I am getting RTL for 10164

But I am finding no reason for getting Runtime error

I am getting mad

Can anyone help me, Please!!!

I am here sending my code

Code: Select all

```
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define sz 3000
long num[sz];
bool finished;
void subset(long a[],long k,long n,long N);
void con_candidate(long a[],long k,long c[],long n,long *ncan);
void main()
{
long tot,i,a[sz],N;
while(scanf("%ld",&N)==1 && N)
{
tot = 2*N - 1;
memset(num,0,sizeof(num));
memset(a,0,sizeof(a));
for(i=1;i<=tot;i++)scanf("%ld",&num[i]);
for(i=0;i<sz-1;i++)a[i]=1;
finished = false;
subset(a,0,tot,N);
if(finished == false)printf("No\n");
}
}
void subset(long a[],long k,long n,long N)
{
long i,j,ncan,c[sz];
long sum;
if(k==n)return;
if(k>N) return;
if(k==N)
{
sum = 0;
for(i=1;i<=k;i++)
{
sum+=num[a[i]];
}
if(sum%N==0)
{
printf("Yes\n");
for(i=1;i<k;i++)printf("%ld ",num[a[i]]);
printf("%ld\n",num[a[k]]);
finished = true;
return;
}
}
else
{
k++;
con_candidate(a,k,c,n,&ncan);
for(j=0;j<ncan;j++)
{
a[k] = c[j];
subset(a,k,n,N);
if(finished == true)return;
}
}
}
void con_candidate(long a[],long k,long c[],long n,long *ncan)
{
long i;
*ncan = 0;
if(k==1)
{
for(i=1;i<=n;i++)
c[(*ncan)++]=i;
}
else
{
for(i = a[k-1]+1;i<=n;i++)c[(*ncan)++]=i;
}
}
```