For this Question: Given an array <b>arr[]</b> of <b>N</b> elements. The task is to <b>count maximum number of distinct smaller elements on right side of any array element</b>. For example, in {10, 6, 9, 7, 20, 19, 21, 18, 17, 16}, the result is 4. 

<b>Note</b> that 20 has a maximum of 4 smaller elements on the right side. Other elements have less count, for example 10 has 3 smaller elements on the right side.First line of input contains number of testcases T. For each testcase, first line of input contains number of elements in the array and next line contains array elements.

<b>Constraints:</b>
1 <= T <= 100
1 <= N <= 10^4
1 <= arr[i] <= 10^6

<b>Sum of N over all testcases does not exceed 10^5</b>For each testcase, print the maximum count of smaller elements on right side. Input:
4
10
10 6 9 7 20 19 21 18 17 16
5
5 4 3 2 1
5
1 2 3 4 5
5
1 2 3 2 1

Output:
4
4
0
2

Explanation:
Testcase 1: Number of smaller elements on the right side of every element (from left to right) in the array are 3 0 1 0 4 3 3 2 1 and 0 respectively. The maximum of all these counts is 4.
Testcase 2: Number of smaller elements on the right side of every element (from left to right) in the array are 4 3 2 1 and 0 respectively. The maximum of all these counts is 4., I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;
void countSmallerRight(int A[], int len)
{
    set<int> s;
    int countSmaller[len];
    for (int i = len - 1; i >= 0; i--) {
        s.insert(A[i]);
        auto it = s.lower_bound(A[i]);
        countSmaller[i] = distance(s.begin(), it);
    }
  int x=0;
    for (int i = 0; i < len; i++) {
        x=max(x, countSmaller[i]); }
        cout<<x<<endl;
}

// Driver code
int main()
{
 int t;
 cin>>t;
 while(t--){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){cin>>a[i];}

    countSmallerRight(a, n);}

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