Language: C++

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>

#define EPS (0.0000001)

using namespace std;

int mod(int n, int k) { return n % k >= 0 ? n % k : n % k + k; }

double det(pair<double, double> p, pair<double, double> q) {
  return p.first * q.second - p.second * q.first;
}

pair<double, double> sub(pair<double, double> p, pair<double, double> q) {
  return make_pair(p.first - q.first, p.second - q.second);
}

double dot(pair<double, double> p, pair<double, double> q) {
  return p.first * q.first + p.second * q.second;
}

double norm(pair<double, double> p) {
  return sqrt(p.first * p.first + p.second * p.second);
}

double angle(pair<double, double> p, pair<double, double> q) {
  return acos(dot(p, q) / (norm(p) * norm(q)));
}

vector<pair<double, double>> get_convex_hull(
    const vector<pair<double, double>> &p0s) {
  const int N = p0s.size();
  vector<pair<double, double>> ps(p0s);
  sort(ps.begin(), ps.end());
  vector<pair<double, double>> res;
  for (int i = 0; i < N; i++) {
    while (res.size() > 1) {
      pair<double, double> v_cur =
                               sub(res[res.size() - 1], res[res.size() - 2]),
                           v_new = sub(ps[i], res[res.size() - 2]);
      if (det(v_cur, v_new) > 0) {
        break;
      }
      res.pop_back();
    }
    res.push_back(ps[i]);
  }

  const int t = res.size();
  for (int i = N - 2; i >= 0; i--) {
    while (res.size() > t) {
      pair<double, double> v_cur =
                               sub(res[res.size() - 1], res[res.size() - 2]),
                           v_new = sub(ps[i], res[res.size() - 2]);
      if (det(v_cur, v_new) > 0) {
        break;
      }
      res.pop_back();
    }
    res.push_back(ps[i]);
  }
  res.pop_back();
  return res;
}

int main(int argc, char *argv[]) {
  // read inputs
  int N;
  vector<pair<double, double>> ps;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    double x, y;
    scanf("%lf %lf", &x, &y);
    ps.push_back(make_pair(x, y));
  }

  if (N == 2) {
    printf("0.5\n0.5\n");
    return;
  }

  // get convex hull
  vector<pair<double, double>> qs = get_convex_hull(ps);
  // for (pair<double, double> &q : qs) {
  //   printf("(%lf, %lf)\n", q.first, q.second);
  // }

  // calculate answer
  vector<double> probs(N, 0);
  for (int i = 0; i < qs.size(); i++) {
    // get points
    pair<double, double> p_cur = qs[i], p_prev = qs[mod(i - 1, qs.size())],
                         p_next = qs[mod(i + 1, qs.size())];
    // calculate angles
    pair<double, double> v_prev = sub(p_cur, p_prev),
                         v_next = sub(p_next, p_cur);
    const double theta = angle(v_prev, v_next);
    // printf("(%lf, %lf) -> (%lf, %lf): %lf\n", v_prev.first, v_prev.second,
    //        v_next.first, v_next.second, theta);
    // find index
    for (int j = 0; j < N; j++) {
      if (norm(sub(p_cur, ps[j])) < EPS) {
        probs[j] = theta / (2.0 * M_PI);
        break;
      }
    }
  }

  // print answer
  for (int i = 0; i < N; i++) {
    printf("%.10lf\n", probs[i]);
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:84:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
   84 |     return;
      |     ^~~~~~