Language: C++

//ProblemB

#ifdef _MYPC
#include "mypc.h"
#endif // _MYPC

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <memory>
#include <cstdio>
#include <cstring>

using namespace std;

//ProblemB

#define MAXN 100

class Solve {
private:
	struct Point {
		int no;
		int x, y;
		double a;
	} p[MAXN];
	int n;

	double get_cos(const Point& a, const Point& b) {
		return double(b.x - a.x)
			/ sqrt((double(a.x - b.x) * double(a.x - b.x)
				+ double(a.y - b.y) * double(a.y - b.y)));
	}

	double get_cos(int x1, int y1, int x2, int y2) {
		return (double(x1) * x2 + double(y1) * y2)
			/ sqrt((double(x1) * x1 + double(y1) * y1) * (double(x2) * x2 + double(y2) * y2));
	}

	long long outer_prodect(int x1, int y1, int x2, int y2) {
		return (long long)(x1)* y2 - (long long)(x2)* y1;
	}

	void solve() {
		cin >> n;
		int mi = 0;
		for (int i = 0; i < n; i++) {
			cin >> p[i].x >> p[i].y;
			p[i].no = i;

			if (p[i].y < p[mi].y
				|| p[i].y == p[mi].y && p[i].x < p[mi].x) {
				mi = i;
			}
		}
		swap(p[0], p[mi]);

		if (n == 2) {
			cout << 0.5 << endl;
			cout << 0.5 << endl;
			return;
		}

		for (int i = 1; i < n; i++) {
			p[i].a = get_cos(p[0], p[i]);
		}
		sort(p + 1, p + n, [this](const Point& a, const Point& b) {
			return a.a > b.a;
		});

		stack<Point> st;
		st.push(p[0]);
		st.push(p[1]);

		auto cur_x = p[1].x - p[0].x;
		auto cur_y = p[1].y - p[0].y;
		stack<pair<int, int>> st_xy;

		int ii = 2;
		while (ii < n) {
			auto top = st.top();
			auto outer = outer_prodect(cur_x, cur_y, p[ii].x - top.x, p[ii].y - top.y);

			if (outer > 0) {
				st.push(p[ii]);
				st_xy.push({ cur_x, cur_y });
				cur_x = p[ii].x - top.x;
				cur_y = p[ii].y - top.y;
				ii++;
			}
			else {
				st.pop();
				cur_x = st_xy.top().first;
				cur_y = st_xy.top().second;
				st_xy.pop();
			}
		}

		vector<Point> v;
		while (!st.empty()) {
			v.push_back(st.top());
			st.pop();
		}
		v.push_back(v[0]);
		v.push_back(v[1]);

		for (int i = 0; i < n; i++) {
			p[i].a = 0;
		}
		double pi = acos(0) * 2;
		for (size_t i = 1; i < v.size() - 1; i++) {
			auto cos = get_cos(v[i].x - v[i - 1].x, v[i].y - v[i - 1].y,
				v[i].x - v[i + 1].x, v[i].y - v[i + 1].y);
			p[v[i].no].a = acos(- cos) / pi / 2;
		}

		for (int i = 0; i < n; i++) {
			cout << p[i].a << endl;
		}
	}

public:
	Solve() { solve(); }
};

int main(int argc, char* argv[]) {
	unique_ptr<Solve> solve = make_unique<Solve>();
	return 0;
}


Compiler output:
a.cc: In member function 'double Solve::get_cos(const Point&, const Point&)':
a.cc:38:27: error: 'sqrt' was not declared in this scope
   38 |                         / sqrt((double(a.x - b.x) * double(a.x - b.x)
      |                           ^~~~
a.cc: In member function 'double Solve::get_cos(int, int, int, int)':
a.cc:44:27: error: 'sqrt' was not declared in this scope
   44 |                         / sqrt((double(x1) * x1 + double(y1) * y1) * (double(x2) * x2 + double(y2) * y2));
      |                           ^~~~
a.cc: In member function 'void Solve::solve()':
a.cc:117:29: error: 'acos' was not declared in this scope
  117 |                 double pi = acos(0) * 2;
      |                             ^~~~