Language: C++

#include <stdio.h>
#include <utility>
#include <math.h>
#include <algorithm>
#include <stack>
using namespace std;
typedef pair< pair<int, int>, int> piii;

bool comp(const piii *a, const piii *b) {
  if((*a).first.first * (*b).first.second > (*a).first.second * (*b).first.first) return true;
  else return false;
}

int main(void) {
  int i, j, k, v, r;
  double ans = 0.0;
  scanf("%d%d", &v, &r);
  bool flag[v];
  piii p[v];
  int tx = 0, ty = 0;
  for(i = 0; i < v; ++i) {
    flag[i] = true;
    scanf("%d%d", &p[i].first.fisrt, &p[i].first.second);
    p[i].second = i;
    if(i < 3)tx += p[i].first.first, ty += p[i].first.second;
  }
  tx /= 3, ty /= 3;
  for(i = 0; i < v; ++i) p[i].first.first -= tx, p[i].first.second -= ty;
  sort(p, p + v, comp);
  stack<piii> sta;
  sta.push(p[0]), sta.push(p[1]);
  for(i = 2; i < v; ++i) {
    while( 1 ) {
      piii s1 = sta.top();
      sta.pop();
      piii s2 = sta.top();
      if((s1.first.first -
    }
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:23:31: error: 'struct std::pair<int, int>' has no member named 'fisrt'; did you mean 'first'?
   23 |     scanf("%d%d", &p[i].first.fisrt, &p[i].first.second);
      |                               ^~~~~
      |                               first
a.cc:38:5: error: expected primary-expression before '}' token
   38 |     }
      |     ^
a.cc:37:27: error: expected ')' before '}' token
   37 |       if((s1.first.first -
      |          ~                ^
      |                           )
   38 |     }
      |     ~                      
a.cc:37:27: error: expected ')' before '}' token
   37 |       if((s1.first.first -
      |         ~                 ^
      |                           )
   38 |     }
      |     ~                      
a.cc:38:5: error: expected primary-expression before '}' token
   38 |     }
      |     ^
a.cc:39:4: error: expected '}' at end of input
   39 |   }
      |    ^
a.cc:14:16: note: to match this '{'
   14 | int main(void) {
      |                ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
                 from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 from /usr/include/c++/14/math.h:36,
                 from a.cc:3:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = std::pair<std::pair<int, int>, int>*; _Iterator2 = std::pair<std::pair<int, int>, int>*; _Compare = bool (*)(const std::pair<std::pair<int, int>, int>*, const std::pair<std::pair<int, int>, int>*)]':
/usr/include/c++/14/bits/stl_algo.h:1777:14:   required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<pair<int, int>, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const pair<pair<int, int>, int>*, const pair<pair<int, int>, int>*)>]'
 1777 |           if (__comp(__i, __first))
      |               ~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<pair<int, int>, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const pair<pair<int, int>, int>*, const pair<pair<int, int>, int>*)>]'
 1817 |           std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<pair<int, int>, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const pair<pair<int, int>, int>*, const pair<pair<int, int>, int>*)>]'
 1908 |           std::__final_insertion_sort(__first, __last, __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = pair<pair<int, int>, int>*; _Compare = bool (*)(const pair<pair<int, int>, int>*, const pair<pair<int, int>, int>*)]'
 4805 |       std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:29:7:   required from here
   29 |   sort(p, p + v, comp);
      |   ~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:158:30: error: cannot convert 'std::pair<std::pair<int, int>, int>' to 'const std::pair<std::pair<int, int>, int>*' in argument passing
  158 |         { return bool(_M_comp(*__it1, *__it2)); }
      |                       ~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Val_comp_iter<_Compare>::operator()(_Value&, _Iterator) [with _Value = std::pair<std::pair<int, int>, int>; _Iterator = std::pair<std::pair<int, int>, int>*; _Compare = bool (*)(const std::pair<std::pair<int, int>, int>*, const std::pair<std::pair<int, int>, int>*)]':
/usr/include/c++/14/bits/stl_algo.h:1757:20:   required from 'void std::__unguarded_linear_insert(_RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<pair<int, int>, int>*; _Compare = __gnu_cxx::__ops::_Val_comp_iter<bool (*)(const pair<pair<int, int>, int>*, const pair<pair<int, int>, int>*)>]'
 1757 |       while (__comp(__val, __next))
      |              ~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1785:36:   required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<pair<int, int>, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const pair<pair<int, int>, int>*, const pair<pair<int, int>, int>*)>]'
 1785 |             std::__unguarded_linear_insert(__i,
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
 1786 |                                 __gnu_cxx::__ops::__val_comp_iter(__comp));
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<pair<int, int>, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const pair<pair<int, int>, int>*, const pair<pair<int, int>, int>*)>]'
 1817 |           std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<pair<int, int>, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const pair<pair<int, int>, int>*, const pair<pair<int, int>, int>*)>]'
 1908 |           std::__final_insertion_sort(__first, __last, __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = pair<pair<int, int>, int>*; _Compare = bool (*)(const pair<pair<int, int>, int>*, const pair<pair<int, int>, int>*)]'
 4805 |       std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:29:7:   required from here
   29 |   sort(p, p + v, comp);
      |   ~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:240:30: error: cannot convert 'std::pair<std::pair<int, int>, int>' to 'const std::pair<std::pair<int, int>, int>*' in argument passing
  240 |         { return bool(_M_comp(__val, *__it)); }
      |                       ~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = std::pair<std::pair<int, int>, int>*; _Value = std::pair<std::pair<int, int>, int>; _Compare = bool (*)(const std::pair<std::pair<int, int>, int>*, const std::pair<std::pair<int, int>, int>*)]':
/usr/include/c++/14/bits/stl_heap.h:140:48:   required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = pair<pair<int, int>, int>*; _Distance = long int; _Tp = pair<pair<int, int>, int>; _Compare = __gnu_cxx::__ops::_Iter_comp_val<bool (*)(const pair<pair<int, int>, int>*, const pair<pair<int, int>, int>*)>]'
  140 |       while (__holeIndex > __topIndex && __comp(__first + __parent, __value))
      |                                          ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:247:23:   required from 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = pair<pair<int, int>, int>*; _Distance = long int; _Tp = pair<pair<int, int>, int>; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const pair<pair<int, int>, int>*, const pair<pair<int, int>, int>*)>]'
  247 |       std::__push_heap(__first, __holeIndex, __topIndex,
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  248 |                        _GLIBCXX_MOVE(__value), __cmp);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:356:22:   required from 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = pair<pair<int, int>, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const pair<pair<int, int>, int>*, const pair<pair<int, int>, int>*)>]'
  356 |           std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value),
      |           ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  357 |                              __comp);
      |                              ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1593:23:   required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<pair<int, int>, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const pair<pair<int, int>, int>*, const pair<pair<int, int>, int>*)>]'
 1593 |       std::__make_heap(__first, __middle, __comp);
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25:   required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<pair<int, int>, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const pair<pair<int, int>, int>*, const pair<pair<int, int>, int>*)>]'
 1868 |       std::__heap_select(__first, __middle, __last, __comp);
      |       ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAc