Language: C++

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <random>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using ld = long double;
constexpr ld pi = M_PI;

int main() {
    const auto start = chrono::system_clock::now();

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N;
    ld L;
    cin >> N >> L;
    ld T[N];
    for (size_t i = 0; i < N; i++) {
        cin >> T[i];
    }

    ld angle[N];
    for (size_t i = 0; i < N; i++) {
        angle[i] = 2.0L * pi * T[i] / L;
    }

    ld Sin[N];
    for (size_t i = 0; i < N; i++) {
        Sin[i] = sinl(angle[i]);
    }

    ld Cos[N];
    for (size_t i = 0; i < N; i++) {
        Cos[i] = cosl(angle[i]);
    }

    ld table[N][N];
    for (size_t i = 0; i < N; i++) {
        for (size_t j = 0; j < N; j++) {
            table[i][j] = sqrtl(1.0L - cosl(angle[i] - angle[j]));
        }
    }

    ld x = 0.0L;
    ld y = 0.0L;
    ld cnt = 0;

    random_device rnd;
    mt19937 rng(rnd());

    while (true) {
        const auto end = chrono::system_clock::now();
        if (chrono::duration_cast<chrono::milliseconds>(end - start).count() > 3990) {
            break;
        }
        int i, j, k;
        i = rng() % N;
        j = rng() % N;
        while (i == j) j = rng() % N;
        k = rng() % N;
        while (i == k || j == k) k = rng() % N;
        const ld inv = table[i][j] + table[j][k] + table[k][i];
        x += (table[i][j] * Cos[k] + table[k][i] * Cos[j] + table[j][k] * Cos[i]) / inv;
        y += (table[i][j] * Sin[k] + table[k][i] * Sin[j] + table[j][k] * Sin[i]) / inv;
        cnt += 1.0L;
    }

    cout << fixed << setprecision(20) << x / cnt << ' ' << y / cnt << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:24: error: 'chrono' has not been declared
   29 |     const auto start = chrono::system_clock::now();
      |                        ^~~~~~
a.cc:72:26: error: 'chrono' has not been declared
   72 |         const auto end = chrono::system_clock::now();
      |                          ^~~~~~
a.cc:73:13: error: 'chrono' has not been declared
   73 |         if (chrono::duration_cast<chrono::milliseconds>(end - start).count() > 3990) {
      |             ^~~~~~
a.cc:73:35: error: 'chrono' has not been declared
   73 |         if (chrono::duration_cast<chrono::milliseconds>(end - start).count() > 3990) {
      |                                   ^~~~~~
a.cc:88:22: error: 'setprecision' was not declared in this scope
   88 |     cout << fixed << setprecision(20) << x / cnt << ' ' << y / cnt << endl;
      |                      ^~~~~~~~~~~~
a.cc:22:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
   21 | #include <random>
  +++ |+#include <iomanip>
   22 | #pragma GCC optimize("Ofast")