number of factors shows SIGSEGV run time error

why does it show runtime error ?

#include <stdio.h>
#include <math.h>
int prm[500];
int prime(long long int n)
{
    int status[n],i,j;;

    for(i=0;i<n;i++)
        status[i] = 0;

    for(i=3;i<=sqrt(n);i+=2)
    {
        if(status[i] == 0)
        {
            for(j=i*i;j<=n;j+=i+i)
                status[j] = 1;
        }
    }
    int p = 1;
    prm[0] = 2;
    for(i=3;i<=n;i+=2)
    {
        if(status[i] == 0)
        {
              prm[p] = i;
              p++;
        }
    }
    return p;
}
int main()
{
    long long int a,b,c,i,x,result,counts,y;
    long long int sum;
    scanf("%lld", &a);
    while(a--)
    {
        sum=1;
        scanf("%lld", &b);
        while(b--)
        {
            scanf("%lld", &c);
            sum*=c;
        }
        y=prime(sqrt(sum));
        x = sum;
        result = 1;
        for(i=0;i<y;i++)
        {
            counts=0;
            if(x % prm[i] == 0)
            {
                while(x % prm[i] == 0)
                {
                    x/=prm[i];
                    counts++;
                }
                result*=(counts+1);
            }
        }
        if(x>1)
            result*=2;

        printf("%lld\n",result);
    }
    return 0;
}