Language: C++

#include <ext/random>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
using namespace std;
using int64 = long long;
using uint64 = unsigned long long;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

const double pi = 3.141592653589793;
vector<double> x(101), y(101);
int n; 

inline double naiseki(const double& x1, const double& y1, const double& x2, const double& y2) {
  return x1 * x2 + y1 * y2;
}

// 角度 theta の方向を最終的に向くとして計算
// theta は radian
double calc(const double& theta) {
  double res = 0.0;
  double dx = cos(theta), dy = sin(theta);
  for (int i = 0; i < n; ++i) {
    res += max(0.0, naiseki(dx, dy, x[i], y[i]));
  }
  return res;
}

class Timer{
 public:
  Timer(std::chrono::system_clock::time_point start = std::chrono::system_clock::now(), std::chrono::system_clock::time_point stop = std::chrono::system_clock::now()) : start_(start), stop_(stop) {}
  void Start();
  void Stop();
  double GetElapsedTime();

 private:
  std::chrono::system_clock::time_point start_;
  std::chrono::system_clock::time_point stop_;
};

inline void Timer::Start() {
  start_ = std::chrono::system_clock::now();
}

inline void Timer::Stop() {
  stop_ = std::chrono::system_clock::now();
}

inline double Timer::GetElapsedTime() {
 return std::chrono::duration_cast<std::chrono::milliseconds>(stop_ - start_).count();
}

class Xorshift128plus {
 public:
  using result_type = uint64_t;
  static constexpr uint64_t min() { return numeric_limits<result_type>::min(); }
  static constexpr uint64_t max() { return numeric_limits<result_type>::max(); }
  uint64_t operator () () { return GetNext(); }
  void Initialize();

 private:
  static uint64_t result_;
  static uint64_t seed0_;
  static uint64_t seed1_;
  void Next();
  uint64_t GetNext();
};

uint64_t Xorshift128plus::result_;
uint64_t Xorshift128plus::seed0_ = static_cast<uint64_t>(std::chrono::steady_clock::now().time_since_epoch().count() - 172817281728);
uint64_t Xorshift128plus::seed1_ = static_cast<uint64_t>(std::chrono::steady_clock::now().time_since_epoch().count() + 172817281728);

inline void Xorshift128plus::Initialize() {
  for (int i = 0; i < 10; ++i) {
    Next();
  }
}

inline void Xorshift128plus::Next() {
  uint64_t s1 = seed0_;
  uint64_t s0 = seed1_;
  result_ = s0 + s1;
  seed0_ = s0;
  s1 ^= s1 << 23;
  seed1_ = s1 ^ s0 ^ (s1 >> 18) ^ (s0 >> 5);
}

inline uint64_t Xorshift128plus::GetNext() {
  Next();
  return result_;
}

int main(){
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  Timer time;
  time.Start();
  cin >> n;
  rep(i, n) cin >> x[i] >> y[i];

  double ans = 0.0;
  Xorshift128plus xor128;
  xor128.Initialize();
  int loop = 0;
  uniform_real_distribution<double> dist(0.0, 1.0);
  do {
    double theta = 2.0 * pi * dist(xor128);
    chmax(ans, calc(theta));
    ++loop;
    if (loop % 1000 == 0){
      time.Stop();
    }
  } while (time.GetElapsedTime() <= 1950);

  cout << setprecision(15) << ans << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:115:5: error: 'chmax' was not declared in this scope
  115 |     chmax(ans, calc(theta));
      |     ^~~~~