i have solved the naive chef question n i'm getting correct answer but the code is not being accepted by codechef. Can someone tell me wats wrg with my code??

#include <stdio.h>

int main()
{
int i,j,n,t,a,b;
float p=0.0,q=0.0,r=0.0;
scanf("%d",&t);
for(i=0;i<t;i++)
{scanf("%d%d%d",&n,&a,&b);
int k=(int)malloc(nsizeof(int));
for(j=0;j<n;j++)
{scanf("%d",(k+j));}
if(a==b)
{for(j=0;j<n;j++)
{
if(
(k+j)==a)
q++;

      }p=((q*q)/(n*n));
      
      
        
    }
    else
    {for(j=0;j<n;j++)
      {
          if(*(k+j)==a)
          q++;
          else if(*(k+j)==b)
          r++;
          
      }p=((q*r)/(n*n));
      
      
    }printf("%f",p);
    q=0.0;
    r=0.0;
  }return 0;

}