Language: C++

#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

#define sz(x) (int)((x).size())
#define endl '\n'
#define x first
#define y second
#define int long long
#define all(a) (a).begin(), (a).end()
#ifdef LOCAL
	#define dbg(x) cout << #x << " = " << x << endl;
#else 
	#define dbg(x)
#endif 

using namespace std;

void solve(); signed main() {
#ifdef LOCAL
    freopen("file1.txt", "r", stdin);                                       
    freopen("file2.txt", "w", stderr);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(15);
    solve();
}

const int INF = 1e18, MAXN = 1e5 + 10;

int dist(int x, int y) {
    return x * x + y * y;
}	

bool cmp(pair<int, int> p1, pair<int, int> p2) {
 	int tmp = p1.x * p2.y - p1.y * p2.x;
 	return tmp > 0 || (tmp == 0 && dist(p1.x, p1.y) < dist(p2.x, p2.y));
}                 	

void solve() {                         
	int n;
	cin >> n;
	vector<pair<int, int>> up, dp;
	for (int i = 0; i < n; ++i) {
		int x, y;
		cin >> x >> y;
		if ((y >= 0)) {
		 	up.push_back({x, y});
		}
		else {
		 	dp.push_back({x, y});
		}
	}

	sort(up.begin(), up.end(), cmp);
	sort(dp.begin(), dp.end(), cmp);
	vector<pair<int, int>> pt;
	for (auto it : up) {
	 	pt.push_back(it);
	}
	for (auto it : dp) {
	 	pt.push_back(it);
	}	
	vector<pair<int, int>> tmp = pt;
	for (int i = 0; i < sz(tmp); ++i) {
	    pt.push_back(tmp[i]);
	}	

	double ans = 0;
	for (int len = 1; len <= n; ++len) {
	    for (int i = 0; i < sz(pt) - len + 1; ++i) {
	     	int l = i, r = i + len - 1;
	     	int cx = 0, cy = 0;
	     	for (int j = l; j <= r; ++j) {
	     		cx += pt[j].x, cy += pt[j].y;
	     	}	
	     	ans = max(ans, cx * cx + cy * cy); 
	    }
	}	

	cout << sqrt(ans) << endl;
}	


Compiler output:
a.cc: In function 'void solve()':
a.cc:78:26: error: no matching function for call to 'max(double&, long long int)'
   78 |                 ans = max(ans, cx * cx + cy * cy);
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:78:26: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'long long int')
   78 |                 ans = max(ans, cx * cx + cy * cy);
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:78:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   78 |                 ans = max(ans, cx * cx + cy * cy);
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~