Language: C++

using namespace std;

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
    ll n; cin >> n;
    vector<pair<ll, ll> > X(n);
    for(int i = 0; i < n; i++){
        ll x; cin >> x;
        X[i] = make_pair(x, i);
    }
    sort(all(X));
    ll l = X[n / 2 - 1].first;
    ll li = X[n / 2 - 1].second;
    ll r = X[n / 2].first;
    ll ri = X[n / 2].second;
    for(int i = 0; i < n; i++){
        if(i < li && i < ri){
            cout << r << endl;
        }else if(i == li){
            cout << r << endl;
        }else{
            cout << l << endl;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: 'cin' was not declared in this scope
    8 |     ll n; cin >> n;
      |           ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:9:5: error: 'vector' was not declared in this scope
    9 |     vector<pair<ll, ll> > X(n);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:9:12: error: 'pair' was not declared in this scope
    9 |     vector<pair<ll, ll> > X(n);
      |            ^~~~
a.cc:1:1: note: 'std::pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>'
  +++ |+#include <utility>
    1 | using namespace std;
a.cc:9:19: error: expected primary-expression before ',' token
    9 |     vector<pair<ll, ll> > X(n);
      |                   ^
a.cc:9:23: error: expected primary-expression before '>' token
    9 |     vector<pair<ll, ll> > X(n);
      |                       ^
a.cc:9:25: error: expected primary-expression before '>' token
    9 |     vector<pair<ll, ll> > X(n);
      |                         ^
a.cc:9:27: error: 'X' was not declared in this scope
    9 |     vector<pair<ll, ll> > X(n);
      |                           ^
a.cc:12:16: error: 'make_pair' was not declared in this scope
   12 |         X[i] = make_pair(x, i);
      |                ^~~~~~~~~
a.cc:12:16: note: 'std::make_pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>'
a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |     sort(all(X));
      |     ^~~~
      |     short
a.cc:21:13: error: 'cout' was not declared in this scope
   21 |             cout << r << endl;
      |             ^~~~
a.cc:21:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:26: error: 'endl' was not declared in this scope
   21 |             cout << r << endl;
      |                          ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:23:13: error: 'cout' was not declared in this scope
   23 |             cout << r << endl;
      |             ^~~~
a.cc:23:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:26: error: 'endl' was not declared in this scope
   23 |             cout << r << endl;
      |                          ^~~~
a.cc:23:26: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:25:13: error: 'cout' was not declared in this scope
   25 |             cout << l << endl;
      |             ^~~~
a.cc:25:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:26: error: 'endl' was not declared in this scope
   25 |             cout << l << endl;
      |                          ^~~~
a.cc:25:26: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'