For this Question: Monk is standing at the door of his classroom. There are currently N students in the class, i'th student got Ai candies.
There are still M more students to come. At every instant, a student enters the class and wishes to be seated with a student who has exactly the same number of candies. For each student, Monk shouts YES if such a student is found, NO otherwise.First line contains two space- separated integers N and M.
Second line contains N + M space- separated integers, the candies of the students.output M new line, Monk's answer to the M students.
Print "YES" (without the quotes) or "NO" (without the quotes) pertaining to the Monk's answer.

Constraints:
1 ≤ N, M ≤ 100000
0 ≤ Ai ≤ 1000000000Sample Input 1:
2 3
3 2 9 11 2

Sample Output 1:
NO
NO
YES

Explanations:
Initially students with 3 and 2 candies are in the class.
A student with 9 candies enters, No student with 9 candies in class. Hence, "NO"
A student with 11 candies enters, No student with 11 candies in class. Hence, "NO"
A student with 2 candies enters, Student with 2 candies found in class. Hence, "YES", I have written this Solution Code: #include<bits/stdc++.h>
using namespace std;
struct node
{
long long int data;
struct node* left;
struct node* right;
};
struct node* newnode(long long int req)
{
struct node* temp = (struct node*)malloc(sizeof(struct node));
temp->data=req;
temp->left=NULL;
temp->right=NULL;
return temp;
}
struct node* insert(struct node* item,long long int val)
{
if(item==NULL)
return newnode(val);
if(val < item->data)
item->left=insert(item->left,val);
else if(val > item->data)
item->right=insert(item->right,val);
return item;
}
bool check(struct node* res,long long int p)
{
while(res!=NULL)
{
if(p < res->data)
res= res->left;
else if(p > res->data)
res= res->right;
else
{
return true;
}
}
return false;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t=1;
//cin>>t;
while(t--)
{
struct node *root=NULL;
long long int n,m,a;
cin>>n>>m;
unordered_map<long long int,int> hash;
for(int i=0;i<n;i++)
{
cin>>a;
root=insert(root,a);
}
for(int i=0;i<m;i++)
{
cin>>a;
if(check(root,a))
{
cout<<"YES\n";
}
else
{
    if(hash[a]==0)
    {
        hash[a]=1;
        cout<<"NO\n";
    }
    else
    cout<<"YES\n";
}
}
}
}
, In this Programming Language: C++, Now tell me if this Code is compilable or not?