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: import java.io.*; // for handling input/output
import java.util.*; // contains Collections framework

// don't change the name of this class
// you can add inner classes if needed
class Main {
	public static void main (String[] args) {
                      // Your code here
		Scanner sc = new Scanner(System.in);
		int m = sc.nextInt();
		int n = sc.nextInt();
		int q = sc.nextInt();
		int mat[] = new int[m*n];
		int matSize = m*n;

		for(int i = 0; i < m*n; i++)
		{
			
				int ele = sc.nextInt();
				mat[i] = ele;
			
		}

		Arrays.sort(mat);

		for(int i = 1; i <= q; i++)
		{
			
			int qs = sc.nextInt();
			System.out.println(isPresent(mat, matSize, qs));
			
		}


	}

	static String isPresent(int mat[], int size, int ele)
	{
		    int l = 0, h = size-1;
			while(l <= h)
			{
				int mid = l + (h-l)/2;
				if(mat[mid] == ele)
				   return "Yes";
				else if(mat[mid] > ele)
				    h = mid - 1;
				else l = mid+1;
				   
			}

			return "No";
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?