Please review my SNACKDOWN 2018 TEAMMATE problem's slution

/*
I have used four cases

  1. start and end at even place
  2. start and end at odd place
  3. start at odd and end at even place
  4. else
    used the grouping concept
    /
    #include<bits/stdc++.h>
    using namespace std;
    #define c 1000000007
    unsigned long long int fct(unsigned long long int x)
    {
    unsigned long long f = 1;
    for (int j=1;j<=x;j++)
    f = (f
    j)%c;
    return f;
    }
    int main()
    {
    unsigned long long int T=0,N=0,i=0,j=0,mn=0,mx=0,k=0,s=1,srt=0,end=0;
    cin>>T;
    for(i=0;i<T;i++)
    {
    cin>>N;
    unsigned long long int arr=new unsigned long long int[N];
    unsigned long long int cnt=new unsigned long long int[N];
    for(j=0;j<N;j++)
    cnt[j]=1;
    for(j=0;j<N;j++)
    cin>>arr[j];
    sort(arr,arr+N);
    mx=arr[N-1];
    mn=arr[0];
    k=0;
    for(j=1;j<N;j++)
    {
    if(mn==arr[j])
    {
    cnt[k]+=1;;
    }
    else
    {
    mn=arr[j];
    k++;
    }
    }
    /

    for(j=0;j<N;j++)
    cout<<cnt[j]<<" ";
    /
    s=1;
    k=0;
    j=0;
    while(j<N)
    {
    srt=j;
    end=j+cnt[k]-1;
    j=end+1;
    if(cnt[k]==2)
    {
    if(srt%2==1 && end%2==0)
    s=((s%c)2)%c;
    }
    if(cnt[k]>2)
    {
    if(srt%2==0 && end%2==0)
    {
    s=(((s%c)
    (cnt[k]%c))%c
    (fct(cnt[k]-1)%c))%c;
    s=s/pow(2,cnt[k]/2);
    s=s/fct(cnt[k]/2);
    }
    else if(srt%2==1 && end%2==1)
    {
    s=(((s%c)
    (cnt[k]%c))%c*(fct(cnt[k]-1)%c))%c;
    s=s/pow(2,cnt[k]/2);
    s=s/fct(cnt[k]/2);
    }
    else if(srt%2==1 && end%2==0)
    {
    s=((((s%c)((cnt[k]/2)%c))%c)((cnt[k]-1)%c))%c;
    s=((s%c)(fct(cnt[k]-2)%c))%c;
    s=s/pow(2,(cnt[k]-2)/2);
    s=s/fct((cnt[k]-2)/2);
    }
    else//(srt%2==0 && end%2==1)
    {
    s=((s%c)
    (fct(cnt[k])%c))%c;
    s=s/pow(2,cnt[k]/2);
    s=s/fct(cnt[k]/2);
    }
    }
    k=k+1;
    }
    cout<<s<<endl;
    }
    return(0);
    }
//