For this Question: Given an array Arr of size N and an integer K. Todo wants you to find lexicographically minimum subsequence of the array of size K.
A subsequence is a sequence that can be derived from array by deleting some or no elements without changing the order of the remaining elements.
A sequence X is lexicographically smaller than Y if in the first position where X and Y differ, subsequence X has a number less than the corresponding number in Y.First line of input contains two integers N and K.
Second line of input contains N integers denoting array Arr.

Constraints: 
1 <= K <= N <= 100000
1 <= Arr[i] <= 1000000000Print K integers denoting the lexicographically minimum subsequence of the array of size K.Sample Input 1
5 2
12 2 1 3 4

Sample Output 1
1 3

Sample Input 2
5 4
12 2 1 3 4

Sample Output 2
2 1 3 4, I have written this Solution Code: #pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountll
#define m_p make_pair
#define infi 1e18+1
#define eps 0.000000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
//////////////

typedef unsigned long long ull;
auto clk=clock();
#define all(x) x.begin(),x.end()
#define S second
#define F first
#define sz(x) ((long long)x.size())
#define int long long  
#define f80 __float128
#define pii pair<int,int>
/////////////
 
signed main(){
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int n;
	cin>>n;
	int k;
	cin>>k;
	int arr[n];
	for(int i=0;i<n;++i){
		cin>>arr[i];
	}
	stack<int >s;
	int counter = n - k;
	for (int i = 0; i < n; i++) {
		while (!s.empty() && arr[i] < s.top() && counter != 0) {
			s.pop();
			counter--;
		}
		s.push(arr[i]);
	}
	while (!s.empty() && counter != 0) {
		s.pop();
		counter--;
	}
	vector<int >ans;
	while (!s.empty()) {
		ans.pb(s.top());
		s.pop();
	}
	reverse(ans.begin(), ans.end());
	for(auto r: ans)
		cout<<r<<" ";
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?