For this Question: Given a 2D matrix of size [M, N],  Q number of queries. In each query, you will be given a number X to check whether it is present in the matrix or not.The first line contains three integers M(number of rows), N(Number of columns), and Q(number of queries)
Next M lines contain N integers which are the elements of the matrix.
Next, Q lines will contain a single integer X.

Constraints:-
1<=M,N<=1000
1<=Q<=10000
1<=X, Arr[i]<=1000000000For each query, in a new line print "Yes" if the element is present in matrix or print "No" if the element is absent.Input:-
3 3 2
1 2 3
5 6 7
8 9 10
7
11

Output:-
Yes
No

Input:-
3 4 4
4 8 11 14
15 54 45 47
1 2 3 4
5
15
45
26

Output:-
No
Yes
Yes
No, I have written this Solution Code: 
#include <bits/stdc++.h>
using namespace std;
#define N 1000000
long a[N];
int main()
{
      
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);

    int n,m,q;
    cin>>n>>m>>q;
    n=n*m;

    long long sum=0,sum1=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    while(q--){
            long x;
    cin>>x;

        int l=0;
        int r=n-1;
        while (r >= l) {
        int mid = l + (r - l) / 2;
        if (a[mid] == x) {
             cout<<"Yes"<<endl;goto f;}

        if (a[mid] > x)
            {
                r=mid-1;
            }
            else {l=mid+1;
            }
    }
    cout<<"No"<<endl;
    f:;

    }



}
, In this Programming Language: C++, Now tell me if this Code is compilable or not?