For this Question: Given an input stream of n integers, find the kth largest element for each element in the stream.The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. 
Each test case contains two lines. The first line of each test case contains two space-separated integers n and k. Then in the next line are n space-separated values of the array.

Constraints:
1 <= T <= 100
1 <= n <= 10^3
1 <= K <= n
1 <= stream[i] <= 10^5For each test case, in a new line, print the space separated values denoting the kth largest element at each insertion, if the kth largest element at a particular insertion in the stream doesn't exist print -1.Sample Input:
2
6 4
1 2 3 4 5 6
2 1
3 4

Sample Output:
-1 -1 -1 1 2 3
3 4 

Explanation:
Testcase1:
k = 4
For 1, the 4th largest element doesn't exist so we print -1.
For 2, the 4th largest element doesn't exist so we print -1.
For 3, the 4th largest element doesn't exist so we print -1.
For 4, the 4th largest element is 1 {1, 2, 3, 4}
For 5, the 4th largest element is 2 {2, 3, 4 ,5}
for 6, the 4th largest element is 3 {3, 4, 5}, I have written this Solution Code: 
// author-Shivam gupta

#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795

#define MOD 1000000007

#define read(type) readInt<type>()
#define max1 1000008
#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
typedef long int li;

typedef unsigned long int uli;

typedef long long int ll;

typedef unsigned long long int  ull;


void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
void solve(){
  priority_queue<int> pq;
        int n,k;
        cin>>n>>k;
        int x;
        int cnt=1;
        FOR(i,n){
        cin>>x;
        x=-x;

        if(cnt<k){out1(-1);pq.push(x);cnt++;continue;}

        else{
                if(cnt==k){pq.push(x);out1(-pq.top());cnt++;continue;}
            if(x<pq.top()){
                pq.pop();
                pq.push(x);
            }
            out1(-pq.top());

        }

        }


}
int main() {
    fast();
int t;
cin>>t;
    while(t--){

       solve();
        cout<<endl;
    }
}





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