Language: C++

#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <algorithm>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    list<pair<pair<long, long>, double> > lzSortedPnt;
    {
        long n = 0;
        vector<pair<long, long> > vzPnt;
        {
            cin >> n;
            vzPnt.resize(n);
            long i = 0;
            for (i = 0; i < n; ++i) {
                cin >> vzPnt[i].first;
                cin >> vzPnt[i].second;
            }
            sort(vzPnt.begin(), vzPnt.end()); // ?????????????????§????§????????±??????? 
            if (n == 0) {
                cout << n << "\n";
                return 0;
            }
            if (n == 1) {
                cout << n << "\n";
                cout << vzPnt[0].first << " " << vzPnt[0].second << "\n";
               return 0;
            }
        }

        vector<pair<pair<double, double>, size_t> > vzValuePnt(n);
        {
            vzValuePnt[0] = pair<pair<double, double>, size_t>(pair<double, double>(0.0, 0.0), 0); // dummy 
            long i = 1;
            for (i = 1; i < n; ++i) {
                double iX = vzPnt[i].first - vzPnt[0].first;
                double iY = vzPnt[i].second - vzPnt[0].second;
                double dLenSq = (iX * iX) + (iY + iY); // ?????????????????????sqrt????????? 
                double dAngle = 0;
                if (iX > 0) {
                    dAngle = iY / iX; // 0???20000 
                } else if (iX == 0) {
                    // iY????????§??§???20000????????§????????????25000??????iX==0?????±????????¨???????????¨??????????????? 
                    dAngle = 25000;
                } else {
                    dAngle = 50000 + iY / iX; // 30000???50000
                }
                vzValuePnt[i] = pair<pair<double, double>, size_t>(pair<double, double>(dAngle, dLenSq), i);
            }
            sort(vzValuePnt.begin(), vzValuePnt.end());
        }

        long i = 0;
        for (i = 0; i < n; ++i) {
            lzSortedPnt.push_back(pair<pair<long, long>, double>(vzPnt[vzValuePnt[i].second], vzValuePnt[i].first.first));
        }

        if (false) { // test?????? 
            auto it = lzSortedPnt.begin();
            for ( ; it != lzSortedPnt.end(); ++it) {
                cout << it->first.first << " " << it->first.second << "\n";
            }
            return 1;
        }
    }

    list<pair<long, long> > lzResultPnt;
    {
        // ?????????2??????????????¶????§£(??\??????1?????\????????´???????????????????????±????????¨????????±??£??????????????§??????2?????\????????????) 
        lzSortedPnt.push_back(lzSortedPnt.front()); // ?????????????????????????????¨???????????¨????????? 
        lzResultPnt.push_back(lzSortedPnt.front().first);
        lzSortedPnt.pop_front();
        lzResultPnt.push_back(lzSortedPnt.front().first);
        lzSortedPnt.pop_front();
    }

    while (!lzSortedPnt.empty()) {
        pair<long, long> azResultLast[2] = { *(--(--(lzResultPnt.end()))), *(--(lzResultPnt.end())) };
        long aiNextPntDir[2] = { lzSortedPnt.front().first.first - azResultLast[1].first, lzSortedPnt.front().first.second - azResultLast[1].second };
        list<pair<pair<long, long>, double> >::iterator it = lzSortedPnt.begin();
        list<pair<pair<long, long>, double> >::iterator itNext = it;
        ++it;
        while (it != lzSortedPnt.end()) {
            if (itNext->second != it->second) {
                break;
            }
            long aiPntDir[2] = { it->first.first - azResultLast[1].first, it->first.second - azResultLast[1].second };
            if (false) { // ?§????????????????????????????????????§1????????°???????????°???????????? 
                itNext = it;
                aiNextPntDir[0] = aiPntDir[0];
                aiNextPntDir[1] = aiPntDir[1];
            }
        }
        long aiLastResultDir[2] = { azResultLast[1].first  - azResultLast[0].first, azResultLast[1].second - azResultLast[0].second };
        while (true) {
            
        }
        lzResultPnt.push_back(itNext->first);
        lzSortedPnt.erase(itNext);
    }

    lzResultPnt.pop_back(); // ?????????????????????????????????????????§?????? 
    long i = 0;
    size_t n = lzResultPnt.size();
    cout << n << "\n";
    auto it = lzResultPnt.begin();
    for ( ; it != lzResultPnt.end(); ++it) {
        cout << it->first << " " << it->second << "\n";
    }

    return 0;
}

Compiler output:
a.cc:9:22: error: '_TCHAR' has not been declared
    9 | int _tmain(int argc, _TCHAR* argv[])
      |                      ^~~~~~