Language: C++

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

int main() {
  int N, x, y;
  cin >> N;
  vector<int> a(N);
  
  for(int i=0;i<N;i++) {
    cin >> a.at(i);
  }
  
  sort(a.begin(N),a.end(N));
  reverse(a.begin(N),a.end(N));
  
  for(int i=0;i<N;i++) {
    if(i%2==0) {
      x += a.at(i);
    }
    else {
      y += a.at(i);
    }
  }
  cout << x-y << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: no matching function for call to 'std::vector<int>::begin(int&)'
   13 |   sort(a.begin(N),a.end(N));
      |        ~~~~~~~^~~
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:873:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::begin() [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator]'
  873 |       begin() _GLIBCXX_NOEXCEPT
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:873:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:883:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::begin() const [with _Tp = int; _Alloc = std::allocator<int>; const_iterator = std::vector<int>::const_iterator]'
  883 |       begin() const _GLIBCXX_NOEXCEPT
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:883:7: note:   candidate expects 0 arguments, 1 provided
a.cc:13:24: error: no matching function for call to 'std::vector<int>::end(int&)'
   13 |   sort(a.begin(N),a.end(N));
      |                   ~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:893:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::end() [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator]'
  893 |       end() _GLIBCXX_NOEXCEPT
      |       ^~~
/usr/include/c++/14/bits/stl_vector.h:893:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:903:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::end() const [with _Tp = int; _Alloc = std::allocator<int>; const_iterator = std::vector<int>::const_iterator]'
  903 |       end() const _GLIBCXX_NOEXCEPT
      |       ^~~
/usr/include/c++/14/bits/stl_vector.h:903:7: note:   candidate expects 0 arguments, 1 provided
a.cc:14:18: error: no matching function for call to 'std::vector<int>::begin(int&)'
   14 |   reverse(a.begin(N),a.end(N));
      |           ~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:873:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::begin() [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator]'
  873 |       begin() _GLIBCXX_NOEXCEPT
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:873:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:883:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::begin() const [with _Tp = int; _Alloc = std::allocator<int>; const_iterator = std::vector<int>::const_iterator]'
  883 |       begin() const _GLIBCXX_NOEXCEPT
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:883:7: note:   candidate expects 0 arguments, 1 provided
a.cc:14:27: error: no matching function for call to 'std::vector<int>::end(int&)'
   14 |   reverse(a.begin(N),a.end(N));
      |                      ~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:893:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::end() [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator]'
  893 |       end() _GLIBCXX_NOEXCEPT
      |       ^~~
/usr/include/c++/14/bits/stl_vector.h:893:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:903:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_iterator std::vector<_Tp, _Alloc>::end() const [with _Tp = int; _Alloc = std::allocator<int>; const_iterator = std::vector<int>::const_iterator]'
  903 |       end() const _GLIBCXX_NOEXCEPT
      |       ^~~
/usr/include/c++/14/bits/stl_vector.h:903:7: note:   candidate expects 0 arguments, 1 provided