Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include <cmath>
#include <limits>
#include <iomanip>
using namespace std;

long double zahyou(long long x,long long y){
	return x*x+y*y;
}

int main(){
	long long n;
	cin>>n;
	vector<long long>x(n);
	vector<long long>y(n);
	vector<pair<long long,long long> >z(n);
	for(int i=0;i<n;i++){
		cin>>x[i]>>y[i];
		z[i]=make_pair(x[i],y[i]);
	}
	
	vector<pair<long long,long long> >d1;
	vector<pair<long long,long long> >d2;
	vector<pair<long long,long long> >d3;
	vector<pair<long long,long long> >d4;
	
	for(int i=0;i<n;i++){
		//1
		if(z[i].first>=0&&z[i].second>=0){
			d1.push_back(z[i]);
			if(z[i].first!=0)d2.push_back(z[i]);
			if(z[i].second!=0)d4.push_back(z[i]);
		}
		//2
		if(z[i].first<=0&&z[i].second>=0){
			if(z[i].first!=0)d1.push_back(z[i]);
			d2.push_back(z[i]);
			if(z[i].second!=0)d3.push_back(z[i]);
		}
		//3
		if(z[i].first<=0&&z[i].second<=0){
			if(z[i].second!=0)d2.push_back(z[i]);
			d3.push_back(z[i]);
			if(z[i].first!=0)d4.push_back(z[i]);
		}
		//4
		if(z[i].first>=0&&z[i].second<=0){
			if(z[i].second!=0)d1.push_back(z[i]);
			if(z[i].first!=0)d3.push_back(z[i]);
			d4.push_back(z[i]);
		}
	}
	long long ans=0;
	//cout<<zahyou(1,1);
	//1
	pair<long long, long long>z1=make_pair(0,0);
	for(int i=0;i<d1.size();i++){
		/*cout<<d1[i].first<<d1[i].second<<" "<<zahyou(z1.first,z1.second)<<endl;*/
		if( zahyou(z1.first,z1.second) <zahyou(z1.first+d1[i].first, z1.second+d1[i].second)){
		z1.first+=d1[i].first;
		z1.second+=d1[i].second;
		}
	}
	
	ans=max(ans,zahyou(z1.first,z1.second));
	//cout<<"d1"<<ans<<endl;
	
	pair<long long,long long>z2=make_pair(0,0);
	for(int i=0;i<d2.size();i++){
		
		//cout<<d2[i].first<<d2[i].second<<endl;
		if(zahyou(z2.first,z2.second)<zahyou(z2.first+d2[i].first, z2.second+d2[i].second)){
		z2.first+=d2[i].first;
		z2.second+=d2[i].second;
		}
	}
	ans=max(ans,zahyou(z2.first,z2.second));
	
	//cout<<"d1"<<ans<<endl;
	
	pair<long long,long long>z3=make_pair(0,0);
	for(int i=0;i<d3.size();i++){
		if(zahyou(z3.first,z3.second)<zahyou(z3.first+d3[i].first, z3.second+d3[i].second)){
		z3.first+=d3[i].first;
		z3.second+=d3[i].second;
			}
	}
	ans=max(ans,zahyou(z3.first,z3.second));
	
	pair<long long,long long>z4=make_pair(0,0);
	for(int i=0;i<d4.size();i++){
		if(zahyou(z4.first,z4.second)<zahyou(z4.first+d4[i].first, z4.second+d4[i].second)){
		z4.first+=d4[i].first;
		z4.second+=d4[i].second;
			}
	}
	ans=max(ans,zahyou(z4.first,z4.second));
	
	cout<< setprecision(20) <<sqrt(ans)<<endl;
	
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:67:16: error: no matching function for call to 'max(long long int&, long double)'
   67 |         ans=max(ans,zahyou(z1.first,z1.second));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:67:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long double')
   67 |         ans=max(ans,zahyou(z1.first,z1.second));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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,
                 from a.cc:2:
/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:67:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   67 |         ans=max(ans,zahyou(z1.first,z1.second));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:79:16: error: no matching function for call to 'max(long long int&, long double)'
   79 |         ans=max(ans,zahyou(z2.first,z2.second));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:79:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long double')
   79 |         ans=max(ans,zahyou(z2.first,z2.second));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:79:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   79 |         ans=max(ans,zahyou(z2.first,z2.second));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:90:16: error: no matching function for call to 'max(long long int&, long double)'
   90 |         ans=max(ans,zahyou(z3.first,z3.second));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:90:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long double')
   90 |         ans=max(ans,zahyou(z3.first,z3.second));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:90:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   90 |         ans=max(ans,zahyou(z3.first,z3.second));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:99:16: error: no matching function for call to 'max(long long int&, long double)'
   99 |         ans=max(ans,zahyou(z4.first,z4.second));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:99:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long double')
   99 |         ans=max(ans,zahyou(z4.first,z4.second));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:99:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   99 |         ans=max(ans,zahyou(z4.first,z4.second));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~