Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int n;
int array[100000];

int partition(int a[], int p, int r);

int main(){
    cin>>n;
    for (int i=0; i<n; i++) {
        cin>>array[i];
    }
    int pivot = partition(array, 0, n-1);
    if (pivot == n-1) {
        for (int i=0; i<n-1; i++) {
            cout<<array[i]<<" ";
        }
        cout<<"["<<array[i]<<"] "<<endl;
    }
    else{
        for (int i=0; i<n-1; i++) {
            if (i==pivot) {
                cout<<"["<<array[i]<<"] ";
            }else{
                cout<<array[i]<<" ";
            }
        }
        cout<<array[n-1]<<endl;
    }
    return 0;
}

int partition(int a[], int p, int r){
    int x = a[r];
    int i=p-1;
    for (int j=p; j<r; j++) {
        if (a[j]<=x) {
            i++;
            swap(a[i],a[j]);
        }
    }
    swap(a[i+1],a[r]);
    return i+1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: reference to 'array' is ambiguous
   14 |         cin>>array[i];
      |              ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:7:5: note:                 'int array [100000]'
    7 | int array[100000];
      |     ^~~~~
a.cc:16:27: error: reference to 'array' is ambiguous
   16 |     int pivot = partition(array, 0, n-1);
      |                           ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:7:5: note:                 'int array [100000]'
    7 | int array[100000];
      |     ^~~~~
a.cc:19:19: error: reference to 'array' is ambiguous
   19 |             cout<<array[i]<<" ";
      |                   ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:7:5: note:                 'int array [100000]'
    7 | int array[100000];
      |     ^~~~~
a.cc:21:20: error: reference to 'array' is ambiguous
   21 |         cout<<"["<<array[i]<<"] "<<endl;
      |                    ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:7:5: note:                 'int array [100000]'
    7 | int array[100000];
      |     ^~~~~
a.cc:21:26: error: 'i' was not declared in this scope
   21 |         cout<<"["<<array[i]<<"] "<<endl;
      |                          ^
a.cc:26:28: error: reference to 'array' is ambiguous
   26 |                 cout<<"["<<array[i]<<"] ";
      |                            ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:7:5: note:                 'int array [100000]'
    7 | int array[100000];
      |     ^~~~~
a.cc:28:23: error: reference to 'array' is ambiguous
   28 |                 cout<<array[i]<<" ";
      |                       ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:7:5: note:                 'int array [100000]'
    7 | int array[100000];
      |     ^~~~~
a.cc:31:15: error: reference to 'array' is ambiguous
   31 |         cout<<array[n-1]<<endl;
      |               ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:7:5: note:                 'int array [100000]'
    7 | int array[100000];
      |     ^~~~~