Language: C++

#include<bits/stdc++.h>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef long double lf;

ll cross(pii a, pii b) {
    return 1LL * a.first * b.second - 1LL * a.second * b.first;
}

int P[6], Q[6];

vector<pii> Sum, Conv;

vector<pii> mrg(vector<pii> &a, vector<pii> &b) {
    vector<pii> ret;
    int pos1 = 0, pos2 = 0;
    while(pos1 < a.size() && pos2 < b.size()) {
        if(cross(a[pos1], b[pos2]) <= 0) ret.push_back(a[pos1]), pos1++;
        else ret.push_back(b[pos2]), pos2++;
    }
    while(pos1 < a.size()) ret.push_back(a[pos1]), pos1++;
    while(pos2 < b.size()) ret.push_back(b[pos2]), pos2++;
    return ret;
}

int main() {
    for(int i = 0; i < 6; i++) {
        scanf("%d", &P[i]);
    }
    for(int i = 0; i < 6; i++) {
        scanf("%d", &Q[i]);
    }

    Sum.push_back(pii(-P[0], Q[0]));
    Sum.push_back(pii(P[0], -Q[0]));

    for(int i = 1; i < 6; i++) {
        vector<pii> tmp;
        tmp.push_back(pii(-P[i], Q[i]));
        tmp.push_back(pii(P[i], -Q[i]));

        Sum = mrg(Sum, tmp);
    }

    pii st = pii(0, 0);
    for(int i = 0; i < 6; i++) {
        st.first += P[i];
    }

    Conv.push_back(st);

    for(int i = 0; i < (int)Sum.size() - 1; i++) {
        pii tmp = Conv.back();
        Conv.push_back(pii(tmp.first + Sum[i].first, tmp.second + Sum[i].second));
    }

    lf ans = 0;

    for(int i = 0; i < Conv.size(); i++) {
        pii a = Conv[i];
        pii b = Conv[(i + 1)%Conv.size()];

        if(a.first == a.second || b.first == b.second || ((a.first < a.second) ^ (b.first < b.second))) {
            lf x1 = a.first;
            lf y1 = a.second;
            lf x2 = b.first;
            lf y2 = b.second;
            if(a.first == b.first) ans = max(ans, x1);
            else ans = max(ans, (y1 - (y2 - y1) / (x2 - x1) * x1) / (1 - (y2 - y1) / (x2 - x1)));
        }
        else if(a.first < a.second) ans = max(ans, max(a.first, b.first));
        else ans = max(ans, max(a.second, b.second));
    }

    cout<<fixed;
    cout.precision(20);
    cout << ans / 100;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:46: error: no matching function for call to 'max(lf&, const int&)'
   73 |         else if(a.first < a.second) ans = max(ans, max(a.first, b.first));
      |                                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:73:46: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'int')
   73 |         else if(a.first < a.second) ans = max(ans, max(a.first, b.first));
      |                                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:73:46: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   73 |         else if(a.first < a.second) ans = max(ans, max(a.first, b.first));
      |                                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:74:23: error: no matching function for call to 'max(lf&, const int&)'
   74 |         else ans = max(ans, max(a.second, b.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:74:23: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'int')
   74 |         else ans = max(ans, max(a.second, b.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:74:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   74 |         else ans = max(ans, max(a.second, b.second));
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~