How to test my answer perfectly ?

I am getting correct answer for my code. But it still gives WA on submitting. Can you suggest the test case for which my code may fail.

problem:ChefTown
code:
#include<stdio.h>
int a[400002];
int max(int,int);
int main()
{
int n,w,maxp,p,q,count=0,i;
long long int sum=0;
scanf("%d",&n);
scanf("%d",&w);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<w;i++)
sum+=a[i];
maxp=max(0,w);
p=a[0];
for(i=0;i<=n-w;i++)
{
if(sum==(w*(w+1))/2+(w*(maxp-w)))
count++;
if(i!=(n-w))
{
sum=sum+a[i+w]-p;
if(a[i+w]>maxp)
maxp=a[i+w];
else if(p==maxp)
maxp=max(i+1,w+i+1);
p=a[i+1];

    }
}
printf("%d",count);
return 0;

}
max(j,w){
int max=0,i;
for(i=j;i<w+j;i++)
{
if(a[i]>max)
max=a[i];
}
return max;
}