Help me in solving WAV2 problem

My issue

It just says Runtime Error, without giving any indication whatsoever what the Runtime error happens to be.

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int N;
	int Q;
	bool isNegative;
	bool isZero;
	int a[ 20000 ];
	int x;
	
	cin >> N >> Q;
	
	for( int i = 0; i < N; i++ )
	{
	    cin >> a[ i ];
	}
	
	for( int i = 0; i < Q; i++ )
	{
	    cin >> x;
	    
        isNegative = isZero = false;

	    for( int j = 0; j < N; j++ )
	    {
	        if( x == a[ j ] )
	        {
	            cout << 0 << endl;
	            isZero = true;
	            break;
	        }
	        
	        if( x < a[ j ] )
	        {
	            isNegative = !isNegative;
	        }
	    }
	    
	    if( !isZero )
	    {
	        cout << ( isNegative? "NEGATIVE": "POSITIVE" ) << endl;
	    }
	}
	
	return 0;
}

Learning course: Binary Search
Problem Link: CodeChef: Practical coding for everyone

@dandeluca
your logic is not right .
plzz refer my c++ code for better understanding

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int n,q;
	cin>>n>>q;
	int a[n];
	for(int i=0;i<n;i++)
	{
	    cin>>a[i];
	}
	sort(a,a+n);
	while(q--)
	{
	    int t;
	    cin>>t;
	    int l=lower_bound(a,a+n,t)-a;
	    if(l==n)
	    cout<<"POSITIVE";
	    else if(a[l]==t)
	    cout<<"0";
	    else 
	    {
	        int d=n-l;
	        if(d%2)
	        cout<<"NEGATIVE";
	        else
	        cout<<"POSITIVE";
	    }
	    cout<<endl;
	}
	return 0;
}