Language: C++

#include<bits/stdc++.h>
using namespace std;
#define next Next
#define last Last
#define int long long
#define double long double
const int N=1e6+5;
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
#define gc getchar
inline int read()
{
	int ret=0,f=0;char c=gc();
	while(!isdigit(c)){if(c=='-')f=1;c=gc();}
	while(isdigit(c)){ret=ret*10+c-48;c=gc();}
	if(f)return -ret;return ret;
}
int n;
double ans;
struct node{
	double x,y;
	double ang;
};
node p[N],sum[N];
bool operator < (node a,node b)
{
	return a.ang<b.ang;
}
node operator + (node a,node b)
{
	return (node){a.x+b.x,a.y+b.y};
}
node operator - (node a,node b)
{
	return (node){a.x-b.x,a.y-b.y};
}
int CJ(node a,node b)
{
	return a.x*b.y-b.x*a.y;
}
int suan(node x)
{
	return x.x*x.x+x.y*x.y;
}
signed main()
{
	n=read();
	for(int i=1;i<=n;i++)
	{
		p[i].x=read();p[i].y=read();
		p[i].ang=atan2(p[i].y,p[i].x);
	}
	sort(p+1,p+n+1);
	for(int i=1;i<=n;i++)p[n+i]=p[i];
	for(int i=1;i<=n*2;i++)sum[i]=sum[i-1]+p[i];
	int l=1,r=1;
	ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
	while(r+1<=l+n-1&&CJ(p[l],p[r+1])>=0)
	{
		r++;
		ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
	}
	while(l+1<=n)
	{
		l++;
		ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
		while(r+1<=l+n-1&&CJ(p[l],p[r+1])>=0)
		{
			r++;
			ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
		}
	}
	printf("%.15lf\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:16: error: no matching function for call to 'max(long double&, __gnu_cxx::__enable_if<true, double>::__type)'
   57 |         ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:1:
/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:57:16: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'})
   57 |         ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:57:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   57 |         ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:61:24: error: no matching function for call to 'max(long double&, __gnu_cxx::__enable_if<true, double>::__type)'
   61 |                 ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:61:24: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'})
   61 |                 ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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
/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:61:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   61 |                 ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:66:24: error: no matching function for call to 'max(long double&, __gnu_cxx::__enable_if<true, double>::__type)'
   66 |                 ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:66:24: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'})
   66 |                 ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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
/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:66:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   66 |                 ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:70:32: error: no matching function for call to 'max(long double&, __gnu_cxx::__enable_if<true, double>::__type)'
   70 |                         ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
      |                             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:70:32: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'})
   70 |                         ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
      |                             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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
/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:70:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   70 |                         ans=max(ans,sqrt(suan(sum[r]-sum[l-1])));
      |                             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~