For this Question: Given an array A, find the nearest smaller element S[i] for every element A[i] in the array such that the element has an index smaller than i.

More formally,
    S[i] for an element A[i] = an element A[j] such that 
    j is maximum possible AND 
    j < i AND
    A[j] <= A[i]
Elements for which no smaller element exist, consider next smaller element as -1.The first line contains the size of array, n
The next line n elements of the integer array, A[i]

<b>Constraints:</b>
1 <= n <= 10^5
1 <= A[i] <= 10^6Print the integer array S such that S[i] contains nearest smaller number than A[i] such than index of S[i] is less than 'i'. If no such element occurs S[i] should be -1.Input:
5
4 5 2 10 8

Output:
-1 4 -1 2 2

Explanation 1:
    index 1: No element less than 4 in left of 4, G[1] = -1
    index 2: A[1] is only element less than A[2], G[2] = A[1]
    index 3: No element less than 2 in left of 2, G[3] = -1
    index 4: A[3] is nearest element which is less than A[4], G[4] = A[3]
    index 4: A[3] is nearest element which is less than A[5], G[5] = A[3]

Input:
5
1 2 3 4 5

Output:
-1 1 2 3 4, I have written this Solution Code: #include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

int a[N];

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