Language: C++

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

#define int long long
#define double long double
#define fi first
#define se second
#define pb push_back
#define ins insert
#define er erase

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;

const int oo = 1e18 + 7, mod = 998244353;
const int N = 1e2 + 5;
const double PI = 3.14159265359;

int n;

struct point{
    int x, y;
};

point arr1[N];
point dunno;

int direc(point a, point b, point c){
    //(y3 - y2)(x2 - x1) - (x3 - x2)(y2 - y1)
    int temp = (c.y - b.y) * (b.x - a.x) - (c.x - b.x) * (b.y - a.y);
    //if(b.x < a.x) temp = -temp;
    if(!temp) return 0;
    else if(temp > 0) return 1;// counter-clockwise
    else return 2;
}

double dist(point a, point b){
    return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}

double angle(point a, point root){
    if(a.y < root.y) return 180.0 - angle(root, a);
    double xx = (180.0 / PI) * asin((double)(a.y - root.y) / dist(a, root));
    if(a.x < root.x) xx = 180 - xx;
    return xx;
}

bool cmp1(point a, point b){
    if(a.y != b.y) return a.y < b.y;
    return a.x < b.x;
}

struct cmp11{
    bool operator()(const point& a, const point& b){
        if(a.y != b.y) return a.y < b.y;
        return a.x < b.x;
    };
};

map<point, double, cmp11> mp;

bool cmp2(point a, point b){
    int temp1 = angle(a, dunno), temp2 = angle(b, dunno);
    if(temp1 != temp2) return temp1 > temp2;
    return dist(a, dunno) < dist(b, dunno);
}

vector<point> convex(point x[], int n){
    point y[N];
    for(int i = 1; i <= n; i++) y[i] = x[i];
    sort(y + 1, y + n + 1, cmp1);
    dunno = x[1];
    sort(y + 2, y + n + 1, cmp2);
    vector<point> arr, ans;
    arr.clear();
    ans.clear();
    arr.pb(y[1]);
    int itr;
    for(int i = 2; i <= n; i++){
        while(i != n && abs(angle(y[i], y[1]) - angle(y[i + 1], y[1])) < 1e-12) ++i;
        //cout << angle(x[i], x[1]) << "\n";
        arr.pb(y[i]);
    }
    if(arr.size() < 3) return ans;
    //for(int i = 0; i < arr.size(); i++) cout << arr[i].x << " " << arr[i].y << "\n";
    ans.pb(arr[0]);
    ans.pb(arr[1]);
    ans.pb(arr[2]);
    itr = 2;
    for(int i = 3; i < arr.size(); i++){
        while(itr >= 2 && direc(ans[itr - 1], ans[itr], arr[i]) == 1){
            vector<point>::iterator it = ans.end();
            --it;
            ans.erase(it);
            --itr;
            //cout << itr << "\n";
        }
        //cout << arr[i].x << " " << arr[i].y << "\n";
        ans.pb(arr[i]);
        ++itr;
        //cout << itr << "\n";
    }
    //dunno = ans[0];
    sort(ans.begin() + 1, ans.end(), cmp2);
    //for(int i = 1; i < ans.size(); i++) cout << ans[i].x << " " << ans[i].y << " " << angle(ans[i], dunno) << "\n";
    return ans;
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> arr1[i].x >> arr1[i].y;
	vector<point> temp;
	temp = convex(arr1, n);
	if(!temp.size()){
	    int mn = oo, mx = -oo;
	    for(int i = 1; i <= n; i++){
	        mn = min(mn, arr1[i].x);
	        mx = max(mx, arr1[i].x);
	    }
	    for(int i = 1; i <= n; i++){
	        if(arr1[i].x == mn || arr1[i].x == mx) cout << 0.5;
	        else cout << 0.0;
	        cout << "\n";
	    }
	    return 0;
	}
	for(int i = 0; i < temp.size(); i++){
	    point a = temp[(i - 1 + temp.size()) % temp.size()], b = temp[i], c = temp[(i + 1) % temp.size()];
	    //cout << a.x << " " << a.y << " " << b.x << " " << b.y << " " << c.x << " " << c.y << "\n";
	    if(a.y > c.y) swap(a, c);
	    if(b.y >= a.y && b.y <= c.y){
	        mp[b] = 180.0 - (360.0 - angle(a, b) - angle(c, b));
	        if(b.x <= c.x) mp[b] = -mp[b];
	        //cout << angle(a, b) << " " << angle(c, b) << " " << b.x << " " << b.y << " "  << mp[b] << "\n";
	    }
	    else{
	        mp[b] = 180.0 - abs(angle(a, b) - angle(c, b));
	    }
	    //else{
	    //    mp[b] = 180.0 - abs(angle(b, a) - angle(c, b));
	    //}
	}
	for(int i = 1; i <= n; i++){
	    //cout << arr1[i].x << " " << arr1[i].y << " " << mp[arr1[i]] << " ";
	    if(mp.find(arr1[i]) == mp.end()) cout << "0.00000000000";
	    else cout << fixed << setprecision(10) << mp[arr1[i]] / 360.0;
	    cout << "\n";
	}
	//for(int i = 0; i < temp.size(); i++) cout << temp[i].x << " " << temp[i].y << "\n";
}



Compiler output:
In file included from /usr/include/c++/14/map:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_tree.h: In instantiation of 'static const _Key& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_S_key(_Const_Link_type) [with _Key = point; _Val = std::pair<const point, long double>; _KeyOfValue = std::_Select1st<std::pair<const point, long double> >; _Compare = cmp11; _Alloc = std::allocator<std::pair<const point, long double> >; _Const_Link_type = const std::_Rb_tree_node<std::pair<const point, long double> >*]':
/usr/include/c++/14/bits/stl_tree.h:1648:17:   required from 'const _Key& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Auto_node::_M_key() const [with _Key = point; _Val = std::pair<const point, long double>; _KeyOfValue = std::_Select1st<std::pair<const point, long double> >; _Compare = cmp11; _Alloc = std::allocator<std::pair<const point, long double> >]'
 1648 |         { return _S_key(_M_node); }
      |                  ~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:2461:62:   required from 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_hint_unique(const_iterator, _Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<const point&>, std::tuple<>}; _Key = point; _Val = std::pair<const point, long double>; _KeyOfValue = std::_Select1st<std::pair<const point, long double> >; _Compare = cmp11; _Alloc = std::allocator<std::pair<const point, long double> >; iterator = std::_Rb_tree<point, std::pair<const point, long double>, std::_Select1st<std::pair<const point, long double> >, cmp11, std::allocator<std::pair<const point, long double> > >::iterator; const_iterator = std::_Rb_tree<point, std::pair<const point, long double>, std::_Select1st<std::pair<const point, long double> >, cmp11, std::allocator<std::pair<const point, long double> > >::const_iterator]'
 2461 |         auto __res = _M_get_insert_hint_unique_pos(__pos, __z._M_key());
      |                                                           ~~~~~~~~~~^~
/usr/include/c++/14/bits/stl_map.h:513:37:   required from 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = point; _Tp = long double; _Compare = cmp11; _Alloc = std::allocator<std::pair<const point, long double> >; mapped_type = long double; key_type = point]'
  513 |           __i = _M_t._M_emplace_hint_unique(__i, std::piecewise_construct,
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  514 |                                             std::tuple<const key_type&>(__k),
      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  515 |                                             std::tuple<>());
      |                                             ~~~~~~~~~~~~~~~
a.cc:134:14:   required from here
  134 |                 mp[b] = 180.0 - (360.0 - angle(a, b) - angle(c, b));
      |                     ^
/usr/include/c++/14/bits/stl_tree.h:768:15: error: static assertion failed: comparison object must be invocable as const
  768 |               is_invocable_v<const _Compare&, const _Key&, const _Key&>,
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:768:15: note: 'std::is_invocable_v<const cmp11&, const point&, const point&>' evaluates to false