Language: C++

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define inf 1e16
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define M 1000010

ll f(pii a){
	ll t=a.fi*a.fi+a.se*a.se;
	return t;;
}
pii g(pii a,pii b){
	pii x;
	x.fi=a.fi+b.fi;
	x.se=a.se+b.se;
	return x;
}
pii h(pii a,pii b,pii c){
	pii x;
	x=g(b,c);
	ll a1=f(a),a2=f(x);
	if(a1<=a2){
		return x;
	}
	else return a;
}
int main(){
	IOS;
	ll n;cin>>n;
	ll a[n+1],b[n+1];
	rep(i,1,n+1)cin>>a[i]>>b[i];
	vector<pii>dp(n+1);
	rep(i,0,n+1)dp[i].fi=-1,dp[i].se=-1;
	dp[1].fi=a[1];dp[1].se=b[1];
	rep(i,2,n+1){
		pii ans;ans.fi=a[i];ans.se=b[i];
		pii d;d=ans;
		rep(j,1,i){
			ans=h(ans,d,dp[j]);
		}
		dp[i].fi=ans.fi;dp[i].se=ans.se;
	}
	ld ans=-1.0000;
	rep(i,1,n+1)ans=max(ans,(ld)sqrt(f(dp[i])));
	ll x1=0,y1=0;
	rep(i,1,n+1)x1+=a[i],y1+b[i];
	ans=max(ans,x1*x1+y1*y1);
	ld r;r=sqrt((ld)ans);
	cout<<fixed<<setprecision(20)<<ans;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:61:16: error: no matching function for call to 'max(long double&, long long int)'
   61 |         ans=max(ans,x1*x1+y1*y1);
      |             ~~~^~~~~~~~~~~~~~~~~
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:61:16: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'long long int')
   61 |         ans=max(ans,x1*x1+y1*y1);
      |             ~~~^~~~~~~~~~~~~~~~~
/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:61:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   61 |         ans=max(ans,x1*x1+y1*y1);
      |             ~~~^~~~~~~~~~~~~~~~~