For this Question: N people are standing in line numbered 1 to N from left to right. Each person wants to know the height of the person to left of him having height less than him. If there are multiple such people he wants to know the height of the person closest to him. 
If there is no such person report -1.The first line of input contains N, the size of the array.
The second line of input contains N space-separated integers.

Constraints
2 ≤  N ≤ 100000
0 ≤  Arr[i] ≤ 1000000000 (Height can be zero wierd people :p )The output should contain N space separated integers, the ith integer should be the height reported to ith person (-1 if no person to the left is found whose height is less).Sample Input 1
5
1 2 3 4 5

Sample Output 1
-1 1 2 3 4

Sample Input 2
2
1 1

Sample Output 2
-1 -1, I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;

int main(){
int n;
cin>>n;
stack <long long > s;
long long a;
for(int i=0;i<n;i++){
        cin>>a;
    while(!(s.empty())){
            if(s.top()<a){break;}
        s.pop();
    }
    if(s.empty()){cout<<-1<<" ";}
    else{cout<<s.top()<<" ";}
    s.push(a);
}
}
, In this Programming Language: C++, Now tell me if this Code is compilable or not?