Language: C++

#include<bits/stdc++.h>
#include<math.h>
using namespace std;

int main(){
  int n;
  int *k;
  int s=0;
  cin >> n;
  vector<int>v(2*n);
  for(int i;i<2*n;i++){
    cin >> v[i];
  }
  for(int i;i<n;i++){
    s+=v.min_element(0,v.size());
    k=&(v.min_element(0,v.size()));
    v.erase(k);
     k=&(v.min_element(0,v.size()));
     v.erase(k);
  }
  cout << s;
  return 0;
}
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'class std::vector<int>' has no member named 'min_element'
   15 |     s+=v.min_element(0,v.size());
      |          ^~~~~~~~~~~
a.cc:16:11: error: 'class std::vector<int>' has no member named 'min_element'
   16 |     k=&(v.min_element(0,v.size()));
      |           ^~~~~~~~~~~
a.cc:17:12: error: no matching function for call to 'std::vector<int>::erase(int*&)'
   17 |     v.erase(k);
      |     ~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note:   no known conversion for argument 1 from 'int*' to 'std::vector<int>::const_iterator'
 1536 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note:   candidate expects 2 arguments, 1 provided
a.cc:18:12: error: 'class std::vector<int>' has no member named 'min_element'
   18 |      k=&(v.min_element(0,v.size()));
      |            ^~~~~~~~~~~
a.cc:19:13: error: no matching function for call to 'std::vector<int>::erase(int*&)'
   19 |      v.erase(k);
      |      ~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note:   no known conversion for argument 1 from 'int*' to 'std::vector<int>::const_iterator'
 1536 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note:   candidate expects 2 arguments, 1 provided