Language: C++

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC target ("avx,avx2,tune=native")
#pragma GCC optimization ("unroll-loops")
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
typedef long long ll;
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(v) ((int)v.size())
#define all(v) v.begin(), v.end()
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define orz ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);    
#define inp freopen("input.txt","r",stdin);freopen("out.txt","w",stdout); 
ll mod=1e9+7;
void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);    
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
}
const int N=2e5+5;
int x[200],y[200];
bool cmp(const pi &A,const pi &B) {
	return atan2(A.second , A.first) < atan2(B.second , B.first);
}

int main() {
    io();
    int n;
    cin>>n;
    pair<int,int> a[200];
    for(int i=0;i<n;i++){
    	cin>>x[i].first>>a[i].second

    }
    /*for(int i=0;i<n;i++){
		if(x[i]==0 && y[i]==0)
			continue;
		double tr=atan2(y[i],x[i]);
		th.push_back(tr);
		for(int j=0;j<n;j++){
			if(i == j)
				continue;
			if(x[j] == 0 && y[j] == 0)
				continue;
			double ts=atan2(y[j],x[j]);
			th.push_back((tr+ts)/2);
		}
	}*/
	sort(a,a + n,cmp);
	double ans = 0;
	for(int i = 0;i < n;++i) {
		double X = a[i].first,Y = a[i].second;
		ans = max(ans,X * X + Y * Y);
		for(int j = (i + 1) % n;j != i;j = (j + 1) % n) {
			X += a[j].first,Y += a[j].second;
			ans = max(ans,X * X + Y * Y);
		}
	}
	printf("%.10lf",sqrt(ans));
	return 0;

}
 


 

Compiler output:
a.cc:32:16: error: 'pi' does not name a type; did you mean 'pb'?
   32 | bool cmp(const pi &A,const pi &B) {
      |                ^~
      |                pb
a.cc:32:28: error: 'pi' does not name a type; did you mean 'pb'?
   32 | bool cmp(const pi &A,const pi &B) {
      |                            ^~
      |                            pb
a.cc: In function 'bool cmp(const int&, const int&)':
a.cc:33:24: error: request for member 'second' in 'A', which is of non-class type 'const int'
   33 |         return atan2(A.second , A.first) < atan2(B.second , B.first);
      |                        ^~~~~~
a.cc:33:35: error: request for member 'first' in 'A', which is of non-class type 'const int'
   33 |         return atan2(A.second , A.first) < atan2(B.second , B.first);
      |                                   ^~~~~
a.cc:33:52: error: request for member 'second' in 'B', which is of non-class type 'const int'
   33 |         return atan2(A.second , A.first) < atan2(B.second , B.first);
      |                                                    ^~~~~~
a.cc:33:63: error: request for member 'first' in 'B', which is of non-class type 'const int'
   33 |         return atan2(A.second , A.first) < atan2(B.second , B.first);
      |                                                               ^~~~~
a.cc: In function 'int main()':
a.cc:42:19: error: request for member 'first' in 'x[i]', which is of non-class type 'int'
   42 |         cin>>x[i].first>>a[i].second
      |                   ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:5:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = std::pair<int, int>*; _Iterator2 = std::pair<int, int>*; _Compare = bool (*)(const int&, const int&)]':
/usr/include/c++/14/bits/stl_algo.h:1777:14:   required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const int&, const int&)>]'
 1777 |           if (__comp(__i, __first))
      |               ~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const int&, const int&)>]'
 1817 |           std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const int&, const int&)>]'
 1908 |           std::__final_insertion_sort(__first, __last, __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = pair<int, int>*; _Compare = bool (*)(const int&, const int&)]'
 4805 |       std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:59:6:   required from here
   59 |         sort(a,a + n,cmp);
      |         ~~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:158:30: error: invalid initialization of reference of type 'const int&' from expression of type 'std::pair<int, int>'
  158 |         { return bool(_M_comp(*__it1, *__it2)); }
      |                       ~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Val_comp_iter<_Compare>::operator()(_Value&, _Iterator) [with _Value = std::pair<int, int>; _Iterator = std::pair<int, int>*; _Compare = bool (*)(const int&, const int&)]':
/usr/include/c++/14/bits/stl_algo.h:1757:20:   required from 'void std::__unguarded_linear_insert(_RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<int, int>*; _Compare = __gnu_cxx::__ops::_Val_comp_iter<bool (*)(const int&, const int&)>]'
 1757 |       while (__comp(__val, __next))
      |              ~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1785:36:   required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const int&, const int&)>]'
 1785 |             std::__unguarded_linear_insert(__i,
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
 1786 |                                 __gnu_cxx::__ops::__val_comp_iter(__comp));
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const int&, const int&)>]'
 1817 |           std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const int&, const int&)>]'
 1908 |           std::__final_insertion_sort(__first, __last, __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = pair<int, int>*; _Compare = bool (*)(const int&, const int&)]'
 4805 |       std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:59:6:   required from here
   59 |         sort(a,a + n,cmp);
      |         ~~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:240:30: error: invalid initialization of reference of type 'const int&' from expression of type 'std::pair<int, int>'
  240 |         { return bool(_M_comp(__val, *__it)); }
      |                       ~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = std::pair<int, int>*; _Value = std::pair<int, int>; _Compare = bool (*)(const int&, const int&)]':
/usr/include/c++/14/bits/stl_heap.h:140:48:   required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = pair<int, int>*; _Distance = long int; _Tp = pair<int, int>; _Compare = __gnu_cxx::__ops::_Iter_comp_val<bool (*)(const int&, const int&)>]'
  140 |       while (__holeIndex > __topIndex && __comp(__first + __parent, __value))
      |                                          ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:247:23:   required from 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = pair<int, int>*; _Distance = long int; _Tp = pair<int, int>; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const int&, const int&)>]'
  247 |       std::__push_heap(__first, __holeIndex, __topIndex,
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  248 |                        _GLIBCXX_MOVE(__value), __cmp);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:356:22:   required from 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = pair<int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const int&, const int&)>]'
  356 |           std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value),
      |           ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  357 |                              __comp);
      |                              ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1593:23:   required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const int&, const int&)>]'
 1593 |       std::__make_heap(__first, __middle, __comp);
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25:   required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const int&, const int&)>]'
 1868 |       std::__heap_select(__first, __middle, __last, __comp);
      |       ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = pair<int, int>*; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const int&, const int&)>]'
 1884 |               std::__partial_sort(__first, __last, __last, __comp);
      |               ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1905:25:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(const int&, const int&)>]'
 1905 |           std::__introsort_loop(__first, __last,
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
 190