Help me in solving SHARE problem

My issue

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	long long int n,m,c,i,j,a[10000],b[10000],count=0;
	cin>>n>>m>>c;
	for(i=0;i<n;i++){
	    cin>>a[i];
	}
	for(j=0;j<m;j++){
	    cin>>b[j];
	}
	for(i=0;i<n;i++){
	    for(j=0;j<m;j++){
	        if(a[i]+b[j]==c){
	            cout<<"YES"<<endl;
	            break;
	        }
	        else{
	            count++;
	            continue;
	        }
	    }
	    if(count==n*m){
	        cout<<"NO"<<endl;
	    }
	}
	return 0;
}

Problem Link: CodeChef: Practical coding for everyone