Problem p03428 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(), (x).end()
#define puts(x) cout << x << endl
#define rep(i, m, n) for (ll i = m; i < n; ++i)
#define pb push_back
#define fore(i, a) for (auto &i : a)
#define rrep(i, m, n) for (ll i = m; i >= n; --i)

const long double pi = acos(-1.0);
const int s = 500000;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int N;
  cin >> N;
  vector<pair<long double, long double>> p(N);
  for (int i = 0; i < N; i++)
    cin >> p[i].first >> p[i].second;

  vector<int> ans(N);
  for (int i = 0; i < s; i++) {
    long double co = cos(2 * pi * ((long double)i / (long double)s));
    long double si = sin(2 * pi * ((long double)i / (long double)s));
    vector<pair<long double, int>> temp;
    for (int j = 0; j < N; j++) {
      temp.pb({p[j].first * co + p[j].second * si, j});
    }
    sort(all(temp));
    ans[temp.back().second]++;
  }

  for (int i = 0; i < N; i++) {
    cout << setprecision(20) << (long double)ans[i] / s << endl;
    ;
  }

  return 0;
}

Fixed submission:
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(), (x).end()
#define puts(x) cout << x << endl
#define rep(i, m, n) for (ll i = m; i < n; ++i)
#define pb push_back
#define fore(i, a) for (auto &i : a)
#define rrep(i, m, n) for (ll i = m; i >= n; --i)

const long double pi = acos(-1.0);
const int s = 250000;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int N;
  cin >> N;
  vector<pair<long double, long double>> p(N);
  for (int i = 0; i < N; i++)
    cin >> p[i].first >> p[i].second;

  vector<int> ans(N);
  for (int i = 0; i < s; i++) {
    long double co = cos(2 * pi * ((long double)i / (long double)s));
    long double si = sin(2 * pi * ((long double)i / (long double)s));
    vector<pair<long double, int>> temp;
    for (int j = 0; j < N; j++) {
      temp.pb({p[j].first * co + p[j].second * si, j});
    }
    sort(all(temp));
    ans[temp.back().second]++;
  }

  for (int i = 0; i < N; i++) {
    cout << setprecision(20) << (long double)ans[i] / s << endl;
    ;
  }

  return 0;
}