Language: C++

#include <cstdio>
#include <vector>
using namespace std;

class Point {
public:
    int x, y;
    Point(int a = 0, int b = 0)
    {
        int x = a;
        int y = b;
    };
    bool operator <(const Point& p) const {
        return y < p.y || (y == p.y && x < p.x);
    }
};

inline bool direct(Point& base, Point& a, Point& b) {
    return (a.x - base.x)*(b.y - base.y) - (a.y - base.y)*(b.x - base.x) < 0;
}

int main() {
    int n, i;
    int k = 2;
    vector<Point> P[100000], H[200000];
    scanf("%d", &n);
    for (i = 1; i <= n; ++i) {
        scanf("%d%d",&P[i - 1].x, &P[i - 1].y);
        Point point = P[i - 1];
        register int j = i;
        while (j >= 2 && point < P[j - 2]) {
            P[j - 1] = P[j - 2];
            j--;
        }
        P[j - 1] = point;
    }
    H[0] = P[0];
    H[1] = P[1];
    for (i = 0; i < n - 2; ++i) {
        while (k >= 2 && direct(H[k - 2],H[k - 1],P[i + 2])) k--;
        H[k++] = P[i + 2];
    }
    H[k++] = P[n - 2];
    for (i = n; i > 2; i--) {
        while (k >= 2 && direct(H[k - 2],H[k - 1],P[i - 3])) k--;
        H[k++] = P[i - 3];
    }
    printf("%d\n", k - 1);
    for (i = 0; i < k - 1; ++i) {
        printf("%d %d\n", H[i].x, H[i].y);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:32: error: 'class std::vector<Point>' has no member named 'x'
   28 |         scanf("%d%d",&P[i - 1].x, &P[i - 1].y);
      |                                ^
a.cc:28:45: error: 'class std::vector<Point>' has no member named 'y'
   28 |         scanf("%d%d",&P[i - 1].x, &P[i - 1].y);
      |                                             ^
a.cc:29:30: error: conversion from 'std::vector<Point>' to non-scalar type 'Point' requested
   29 |         Point point = P[i - 1];
      |                       ~~~~~~~^
a.cc:30:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   30 |         register int j = i;
      |                      ^
a.cc:31:32: error: no match for 'operator<' (operand types are 'Point' and 'std::vector<Point>')
   31 |         while (j >= 2 && point < P[j - 2]) {
      |                          ~~~~~ ^ ~~~~~~~~
      |                          |              |
      |                          Point          std::vector<Point>
a.cc:13:10: note: candidate: 'bool Point::operator<(const Point&) const'
   13 |     bool operator <(const Point& p) const {
      |          ^~~~~~~~
a.cc:13:34: note:   no known conversion for argument 1 from 'std::vector<Point>' to 'const Point&'
   13 |     bool operator <(const Point& p) const {
      |                     ~~~~~~~~~~~~~^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/vector:62,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
 1045 |     operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note:   template argument deduction/substitution failed:
a.cc:31:41: note:   'Point' is not derived from 'const std::pair<_T1, _T2>'
   31 |         while (j >= 2 && point < P[j - 2]) {
      |                                         ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
  448 |     operator<(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note:   template argument deduction/substitution failed:
a.cc:31:41: note:   'Point' is not derived from 'const std::reverse_iterator<_Iterator>'
   31 |         while (j >= 2 && point < P[j - 2]) {
      |                                         ^
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  493 |     operator<(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note:   template argument deduction/substitution failed:
a.cc:31:41: note:   'Point' is not derived from 'const std::reverse_iterator<_Iterator>'
   31 |         while (j >= 2 && point < P[j - 2]) {
      |                                         ^
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1694 |     operator<(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note:   template argument deduction/substitution failed:
a.cc:31:41: note:   'Point' is not derived from 'const std::move_iterator<_IteratorL>'
   31 |         while (j >= 2 && point < P[j - 2]) {
      |                                         ^
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
 1760 |     operator<(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note:   template argument deduction/substitution failed:
a.cc:31:41: note:   'Point' is not derived from 'const std::move_iterator<_IteratorL>'
   31 |         while (j >= 2 && point < P[j - 2]) {
      |                                         ^
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:2089:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
 2089 |     operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2089:5: note:   template argument deduction/substitution failed:
a.cc:31:41: note:   'Point' is not derived from 'const std::vector<_Tp, _Alloc>'
   31 |         while (j >= 2 && point < P[j - 2]) {
      |                                         ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/vector:87:
/usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
 2600 |     operator<(const tuple<_TElements...>& __t,
      |     ^~~~~~~~
/usr/include/c++/14/tuple:2600:5: note:   template argument deduction/substitution failed:
a.cc:31:41: note:   'Point' is not derived from 'const std::tuple<_UTypes ...>'
   31 |         while (j >= 2 && point < P[j - 2]) {
      |                                         ^
a.cc:35:20: error: no match for 'operator=' (operand types are 'std::vector<Point>' and 'Point')
   35 |         P[j - 1] = point;
      |                    ^~~~~
In file included from /usr/include/c++/14/vector:72:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = Point; _Alloc = std::allocator<Point>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'Point' to 'const std::vector<Point>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = Point; _Alloc = std::allocator<Point>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'Point' to 'std::vector<Point>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = Point; _Alloc = std::allocator<Point>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'Point' to 'std::initializer_list<Point>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:40:40: error: invalid initialization of reference of type 'Point&' from expression of type 'std::vector<Point>'
   40 |         while (k >= 2 && direct(H[k - 2],H[k - 1],P[i + 2])) k--;
      |                                 ~~~~~~~^
a.cc:18:27: note: in passing argument 1 of 'bool direct(Point&, Point&, Point&)'
   18 | inline bool direct(Point& base, Point& a, Point& b) {
      |                    ~~~~~~~^~~~
a.cc:45:40: error: invalid initialization of reference of type 'Point&' from expression of type 'std::vector<Point>'
   45 |         while (k >= 2 && direct(H[k - 2],H[k - 1],P[i - 3])) k--;
      |                                 ~~~~~~~^
a.cc:18:27: note: in passing argument 1 of 'bool direct(Point&, Point&, Point&)'
   18 | inline bool direct(Point& base, Point& a, Point& b) {
      |                    ~~~~~~~^~~~
a.cc:50:32: error: 'class std::vector<Point>' has no member named 'x'
   50 |         printf("%d %d\n", H[i].x, H[i].y);
      |                                ^
a.cc:50:40: error: 'class std::vector<Point>' has no member named 'y'
   50 |         printf("%d %d\n", H[i].x, H[i].y);
      |                                        ^