pls find out the error(www.codechef.com/problems/COOLING)

#include<stdio.h>
#include<conio.h>
int main()
{
int a[30],i,n,p,b[30],t,j,l;
scanf("%d",&l);
for(j=0;j<l;j++)
{
scanf("%d",&n);
for(i=0;i<l;i++)
{
scanf("%d",&a[i]);
}
scanf("%d",&b[0]);
for(i=1;i<n;i++)
{
scanf("%d",&b[i]);
if(b[i]>=b[i-1])
{
t=b[i];
}
}
for(i=0;i<n;i++)
{
if(a[i]<=t)
p++;
}
printf("%d\n",p);
p=0;
}
getch();
return 0;
}

One of the problem that seem to me is that in for loop in which u take the input of a[i]'s u take the input of only a[0] and after in a for loop where there is an if condition if(a[i]<=t) value of i varies form 0 to n. And basically u just have values of a[0]. One more problem is that u have intialised the value of p after using it aboveā€¦ I mean first u r making it p++ , even u r making it print and then u are assigning it value 0.