Language: C++

#include<bits/stdc++.h>

using namespace std;

const int MaxN = 1e5 + 15;
const int INF = 1e9;
const int MOD = 1e9 + 7;

const long double PI = acos(-1);

struct point{
    long double x, y;
    int num;
    point()
    {

    }
    point(long double x, long double y) : x(x), y(y)
    {

    }
    bool operator < (const point & oth) const
    {
        return make_pair(x, y) < make_pair(oth.x, oth.y);
    }
    void print()
    {
        cout << x << ' ' << y << ' ' << num << '\n';
    }
};

struct line{
    long double a, b, c;
    line(point q, point p)
    {
        a = p.y - q.y;
		b = q.x - p.x;
		c = -a * p.x - b * p.y;
		norm();
    }
    void norm() {
		long double z = sqrt (a*a + b*b);
		if (abs(z) > 1e-9)
			a /= z,  b /= z,  c /= z;
	}
};

long double area(point a, point b, point c)
{
    return (c.y - a.y) * (b.x - a.x) - (b.y - a.y) * (c.x - a.x);
}

long double dist(long double x, long double y, long double xx, long double yy)
{
    return sqrt((x - xx) * (x - xx) + (y - yy) * (y - yy));
}

long double dist(point a, point b)
{
    return dist(a.x, a.y, b.x, b.y);
}

vector <point> v;

long double ans[MaxN];

long double det (long double a, long double b, long double c, long double d) {
	return a * d - b * c;
}

point inter(line m, line n)
{
    long double zn = det (m.a, m.b, n.a, n.b);
    point res;
    res.x = -det (m.c, m.b, n.c, n.b) / zn;
	res.y = -det (m.a, m.c, n.a, n.c) / zn;
	res.num = -1;
	return res;
}

int main()
{
//    freopen("input.txt", "r", stdin);

    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;

    v.resize(n);

    for(int i = 0; i < n; ++i)
    {
        cin >> v[i].x >> v[i].y;
        v[i].num = i + 1;
    }

    sort(v.begin(), v.end());

    vector <point> v1, v2;

    v1.push_back(v[0]);
    v2.push_back(v[0]);

    for(int i = 1; i + 1 < v.size(); ++i)
    {
        if(area(v[0], v[i], v.back()) < 0)
            v1.push_back(v[i]);
        else
        if(area(v[0], v[i], v.back()) > 0)
            v2.push_back(v[i]);
    }

    v1.push_back(v.back());
    v2.push_back(v.back());

    vector <point> res;

    res.push_back(v1[0]);

    for(int i = 1; i < v1.size(); ++i)
    {
        while(res.size() > 1 && area(res[res.size() - 2], res[res.size() - 1], v1[i]) >= 0)
            res.pop_back();
        res.push_back(v1[i]);
    }

    for(int i = v2.size() - 2; i > 0; --i)
    {
        while(res.size() > 1 && area(res[res.size() - 2], res[res.size() - 1], v2[i]) >= 0)
            res.pop_back();
        res.push_back(v2[i]);
    }

    res.push_back(res[0]);
    res.push_back(res[1]);

    if(res.size() == 4)
    {
        ans[res[0].num] = ans[res[1].num] = 0.5;
    }else
    {
        for(int i = 1; i + 1 < res.size(); ++i)
        {
            point x1;

            x1.x = res[i - 1].x - res[i].x;
            x1.y = res[i - 1].y - res[i].y;

            swap(x1.x, x1.y);
            x1.x = -x1.x;

            point c1;

            c1.x = (res[i].x + res[i - 1].x) / 2.;
            c1.y = (res[i].y + res[i - 1].y) / 2.;

            line a = line(c1, point(c1.x + x1.x, c1.y + x1.y));

            point x2;

            x2.x = res[i + 1].x - res[i].x;
            x2.y = res[i + 1].y - res[i].y;

            swap(x2.x, x2.y);
            if(res[i] == v.back())
                x2.y = -x2.y;
            else
                x2.x = -x2.x;

            point c2;

            c2.x = (res[i].x + res[i + 1].x) / 2.;
            c2.y = (res[i].y + res[i + 1].y) / 2.;

            line b = line(c2, point(c2.x + x2.x, c2.y + x2.y));

            point k = inter(a, b);

            c1 = point(k.x + x1.x, k.y + x1.y);
            c2 = point(k.x + x2.x, k.y + x2.y);

            long double C = dist(c1, c2);
            long double A = dist(c1, k);
            long double B = dist(c2, k);

            long double p = acos((C * C - A * A - B * B) / (-2 * A * B));

            ans[res[i].num] = p / PI / 2.;
        }
    }

    for(int i = 1; i <= n; ++i)
    {
        cout.precision(10);
        cout << fixed << ans[i] << '\n';
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:167:23: error: no match for 'operator==' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'} and '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'})
  167 |             if(res[i] == v.back())
In file included from /usr/include/c++/14/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
                 from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
 1103 |     operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note:   template argument deduction/substitution failed:
a.cc:167:33: note:   '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
  167 |             if(res[i] == v.back())
      |                                 ^
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
 1199 |     operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note:   template argument deduction/substitution failed:
a.cc:167:33: note:   '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
  167 |             if(res[i] == v.back())
      |                                 ^
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
 1274 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note:   template argument deduction/substitution failed:
a.cc:167:33: note:   '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
  167 |             if(res[i] == v.back())
      |                                 ^
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
 1366 |     operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note:   template argument deduction/substitution failed:
a.cc:167:33: note:   '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
  167 |             if(res[i] == v.back())
      |                                 ^
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
 1441 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note:   template argument deduction/substitution failed:
a.cc:167:33: note:   '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
  167 |             if(res[i] == v.back())
      |                                 ^
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
 1534 |     operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note:   template argument deduction/substitution failed:
a.cc:167:33: note:   '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
  167 |             if(res[i] == v.back())
      |                                 ^
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
 1613 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note:   template argument deduction/substitution failed:
a.cc:167:33: note:   '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
  167 |             if(res[i] == v.back())
      |                                 ^
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
 2186 |     operator==(const match_results<_Bi_iter, _Alloc>& __m1,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note:   template argument deduction/substitution failed:
a.cc:167:33: note:   '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
  167 |             if(res[i] == v.back())
      |                                 ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
 1033 |     operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note:   template argument deduction/substitution failed:
a.cc:167:33: note:   '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'} is not derived from 'const std::pair<_T1, _T2>'
  167 |             if(res[i] == v.back())
      |                                 ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
  441 |     operator==(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note:   template argument deduction/substitution failed:
a.cc:167:33: note:   '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'} is not derived from 'const std::reverse_iterator<_Iterator>'
  167 |             if(res[i] == v.back())
      |                                 ^
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  486 |     operator==(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note:   template argument deduction/substitution failed:
a.cc:167:33: note:   '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'} is not derived from 'const std::reverse_iterator<_Iterator>'
  167 |             if(res[i] == v.back())
      |                                 ^
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1667 |     operator==(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note:   template argument deduction/substitution failed:
a.cc:167:33: note:   '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'} is not derived from 'const std::move_iterator<_IteratorL>'
  167 |             if(res[i] == v.back())
      |                                 ^
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
 1737 |     operator==(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note:   template argument deduction/substitution failed:
a.cc:167:33: note:   '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'} is not derived from 'const std::move_iterator<_IteratorL>'
  167 |             if(res[i] == v.back())
      |                                 ^
In file included from /usr/include/c++/14/bits/char_traits.h:42,
                 from /usr/include/c++/14/string:42,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
  192 |     operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note:   template argument deduction/substitution failed:
a.cc:167:33: note:   '__gnu_cxx::__alloc_traits<std::allocator<point>, point>::value_type' {aka 'point'} is not derived from 'const std::fpos<_StateT>'
  167 |             if(res[i] == v.back())
      |                                 ^
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
  235 |     operator==(const allocator<_T1>&, const allocator<