Language: C++

#include <iostream>
#include <vector>

int main()
{
  int N=0;
  std::cin >> N;
  std::vector<int> A(N);
  std::vector<std::pair<int, int>> max_list();
  
  max_list.push_back(std::make_pair(-1, 0));
  
  for(int i=0; i<N; i++){
    std::cin >> A[i];
    if(A[i] > max_list.front().second){
      max_list.push_front(std::make_pair(i, A[i]));
    } else if(A[i] > max_list[1].second){
      max_list.insert(max_list.begin() + 1, std::make_pair(i, A[i]));
  }
  
  for(int i=0; i<N; i++){
    if(A[0].first == i){
      std::cout << A[1].second;
    } else {
      std::cout << A[0].second;
    }
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:44: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
    9 |   std::vector<std::pair<int, int>> max_list();
      |                                            ^~
a.cc:11:12: error: request for member 'push_back' in 'max_list', which is of non-class type 'std::vector<std::pair<int, int> >()'
   11 |   max_list.push_back(std::make_pair(-1, 0));
      |            ^~~~~~~~~
a.cc:15:24: error: request for member 'front' in 'max_list', which is of non-class type 'std::vector<std::pair<int, int> >()'
   15 |     if(A[i] > max_list.front().second){
      |                        ^~~~~
a.cc:16:16: error: request for member 'push_front' in 'max_list', which is of non-class type 'std::vector<std::pair<int, int> >()'
   16 |       max_list.push_front(std::make_pair(i, A[i]));
      |                ^~~~~~~~~~
a.cc:17:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   17 |     } else if(A[i] > max_list[1].second){
      |                                ^
a.cc:17:34: error: request for member 'second' in '*(max_list + 1)', which is of non-class type 'std::vector<std::pair<int, int> >()'
   17 |     } else if(A[i] > max_list[1].second){
      |                                  ^~~~~~
a.cc:18:16: error: request for member 'insert' in 'max_list', which is of non-class type 'std::vector<std::pair<int, int> >()'
   18 |       max_list.insert(max_list.begin() + 1, std::make_pair(i, A[i]));
      |                ^~~~~~
a.cc:18:32: error: request for member 'begin' in 'max_list', which is of non-class type 'std::vector<std::pair<int, int> >()'
   18 |       max_list.insert(max_list.begin() + 1, std::make_pair(i, A[i]));
      |                                ^~~~~
a.cc:22:13: error: request for member 'first' in 'A.std::vector<int>::operator[](0)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   22 |     if(A[0].first == i){
      |             ^~~~~
a.cc:23:25: error: request for member 'second' in 'A.std::vector<int>::operator[](1)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   23 |       std::cout << A[1].second;
      |                         ^~~~~~
a.cc:25:25: error: request for member 'second' in 'A.std::vector<int>::operator[](0)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 |       std::cout << A[0].second;
      |                         ^~~~~~
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^