want help to figure out problem with the code????

enter code here whats the problem with this code it gave me a WA for PRGIFT@http://www.codechef.com/AUG14/problems/PRGIFT

#include<stdio.h>
int main(void){
	int t;
	scanf("%d",&t);
	int n,k,m,i,g,h,o,p;
	while(t>0){
		scanf("%d%d",&n,&k);
		int a[n];
		p=0;
		for(i=0;i<n;i++){
			scanf("%d",&a[i]);	
		}
		for(g=0;g<n;g++){
			o=0;
			if(p==1){
				break;}
			for(m=n-1;m>=0;m--){	
				for(h=g;h<=m;h++){
					if(a[h]%2==0)
					o++;
				}
					if(o==k){
						p=1;
						printf("yes");
						break;
					}
					o=0;
			}
		}
		if(p!=1){
			printf("no");
		}
	t--;
	}
return 0;
}

in

1
4 0
2 4 6 8

out

NO
1 Like