For this Question: Given an integer array A of size N. Another array B is defined as:
B[i] = A[j] such that j > i and A[j] < A[i]. If there does not exist any index j satisfying the above conditions then B[i] = -1. 
Find the array B.The first line contains an integer N.
The next line contains N space-separated integers denoting elements of the array.

<b>Constraints:</b>
1 &le; N &le; 10<sup>5</sup>
1 &le; Ai &le; 10<sup>5</sup>Print N space separated integers denoting the elements of array B.Sample Input 1:
4
10 2 5 3

Output 
2 -1 3 -1

Explanation:
Next element smaller than 10 is 2.
There are no elements after 2 that are less than 2.
Next element smaller than 5 is 3.
There are no elements after 3.

Sample Input 2:
2
1 2

Output 
-1 -1

Explanation:
There are no elements after 1 which is less than 1 and there are no elements after 2. , I have written this Solution Code: #include <bits/stdc++.h>

using namespace std;

void printNSE(vector<int> &arr, int n) {
    int next, i, j;
    vector<int> b;
    for (i = 0; i < n; i++) {
        next = -1;
        for (j = i + 1; j < n; j++) {
            if (arr[i] > arr[j]) {
                next = arr[j];
                break;
            }
        }
        b.push_back(next);
    }
    for (int i = 0; i < n; i++) {
        cout << b[i] << " ";
    }
}

int main() {
    int n;
    cin >> n;
    vector<int> arr(n);
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    printNSE(arr, n);
    return 0;
}

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