For this Question: Given two integer array A and B of size N and an integer K. You need to perform N operations, where in the i<sup>th</sup> operation you append the integer B[i] to array A. Find the kth largest element after each operation.
Note: The k<sup>th</sup> largest element is the k<sup>th</sup> element in the sorted order, not the k<sup>th</sup> distinct element.First line contains two integers N and K.
Next line contains N space separated integers denoting elements of array A.
Next line contains N space separated integers denoting elements of array B.

Constraints
1 <= N <= 10^5
1 <= Ai<= 10^5
1 <= K <= NPrint N space separated integers denoting the kth largest element after each operation.Sample Input 1:
4 3
4 5 8 2
3 5 10 9

Output 
4 5 5 8

Explanation:
Initially, Array = {4, 5, 8, 2}
Insert 3. Array = {4, 5, 8, 2, 3}   3rd largest element = 4
Insert 5. Array = {4, 5, 8, 2, 3, 5}   3rd largest element = 5
Insert 10. Array = {4, 5, 8, 2, 3, 5, 10}    3rd largest element = 5
Insert 9. Array = {4, 5, 8, 2, 3, 5, 10, 9}   3rd largest element = 8

Sample Input 2:
3 2
4 5 6
1 2 3

Output
5 5 5

Explanation
Initially, Array = {4, 5, 6}
Insert 1. Array = {4, 5, 6, 1}   2nd largest element = 5
Insert 2. Array = {4, 5, 6, 1, 2}   2nd largest element = 5
Insert 3. Array = {4, 5, 6, 1, 2, 3}    2nd largest element = 5, I have written this Solution Code: /*package whatever //do not write package name here */

import java.io.*;
import java.util.*;

class Main{
	public static void main (String[] args)throws IOException {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	    int n,k;
    	    String line = br.readLine();
    	    String[] strs = line.trim().split("\\s+");
    	    n=Integer.parseInt(strs[0]);
    	    k=Integer.parseInt(strs[1]);
    	    int a[] = new int[n];
            line = br.readLine();
            strs = line.trim().split("\\s+");
            for (int i = 0; i < n; i++) {
                 a[i] = Integer.parseInt(strs[i]);
            }
            int b[] = new int[n];
            line = br.readLine();
            strs = line.trim().split("\\s+");
            for (int i = 0; i < n; i++) {
                 b[i] = Integer.parseInt(strs[i]);
            }
            PriorityQueue<Integer> p = new PriorityQueue<Integer>();
    	    for (int i = 0; i < n; i++)  {
        		p.add(a[i]);
        		if (p.size() > k) {
        			p.poll();
        		}
        	}
            for (int i = 0; i < n; i++)  {
        		p.add(b[i]);
        		if (p.size() > k) {
        			p.poll();
        		}
        		System.out.print(p.peek() + " ");
        	}
	  
        	
    
	}	
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?