Language: C++

// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

db p[6] , q[6];

int main(){
  rep(i,0,6) cin >> p[i] , p[i] /= 100;
  rep(i,0,6) cin >> q[i] , q[i] /= 100;
  function<db(db)> get = [&](db x) -> db {
    db res = 0;
    rep(i,0,6) res += max(x * p[i] , (1 - x) * q[i]);
    return res;
  };
  db l = 0 , r = 1;
  rep(i,0,200) {
    db m1 = (2 * l + r) / 3;
    db m2 = (l + r * 2) / 3;
    if(get(m1) < get(m2))
      r = m2;
    else
      l = m1;
  }
  printf("%.12f\n",get((l + r) / 2));
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:3: error: 'function' was not declared in this scope
   42 |   function<db(db)> get = [&](db x) -> db {
      |   ^~~~~~~~
a.cc:19:1: note: 'std::function' is defined in header '<functional>'; this is probably fixable by adding '#include <functional>'
   18 | #include <algorithm>
  +++ |+#include <functional>
   19 | using namespace std;
a.cc:42:14: error: expected primary-expression before '(' token
   42 |   function<db(db)> get = [&](db x) -> db {
      |              ^
a.cc:42:17: error: expected primary-expression before ')' token
   42 |   function<db(db)> get = [&](db x) -> db {
      |                 ^
a.cc:51:11: error: no matching function for call to 'get(db&)'
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 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:2:
/usr/include/c++/14/bits/stl_pair.h:1250:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(pair<_Tp1, _Tp2>&)'
 1250 |     get(pair<_Tp1, _Tp2>& __in) noexcept
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:1250:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'std::pair<_Tp1, _Tp2>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/bits/stl_pair.h:1255:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(pair<_Tp1, _Tp2>&&)'
 1255 |     get(pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:1255:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'std::pair<_Tp1, _Tp2>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/bits/stl_pair.h:1260:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const pair<_Tp1, _Tp2>&)'
 1260 |     get(const pair<_Tp1, _Tp2>& __in) noexcept
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:1260:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'const std::pair<_Tp1, _Tp2>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/bits/stl_pair.h:1265:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(const pair<_Tp1, _Tp2>&&)'
 1265 |     get(const pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:1265:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'const std::pair<_Tp1, _Tp2>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2445:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(tuple<_Elements ...>&)'
 2445 |     get(tuple<_Elements...>& __t) noexcept
      |     ^~~
/usr/include/c++/14/tuple:2445:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'std::tuple<_Elements ...>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/tuple:2451:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const tuple<_Elements ...>&)'
 2451 |     get(const tuple<_Elements...>& __t) noexcept
      |     ^~~
/usr/include/c++/14/tuple:2451:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'const std::tuple<_Elements ...>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/tuple:2457:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(tuple<_Elements ...>&&)'
 2457 |     get(tuple<_Elements...>&& __t) noexcept
      |     ^~~
/usr/include/c++/14/tuple:2457:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'std::tuple<_Elements ...>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/tuple:2466:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(const tuple<_Elements ...>&&)'
 2466 |     get(const tuple<_Elements...>&& __t) noexcept
      |     ^~~
/usr/include/c++/14/tuple:2466:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'const std::tuple<_Elements ...>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/bits/stl_pair.h:138:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(array<_Tp, _Nm>&)'
  138 |     get(array<_Tp, _Nm>&) noexcept;
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:138:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'std::array<_Tp, _Nm>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/bits/stl_pair.h:142:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(array<_Tp, _Nm>&&)'
  142 |     get(array<_Tp, _Nm>&&) noexcept;
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:142:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'std::array<_Tp, _Nm>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/bits/stl_pair.h:146:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const array<_Tp, _Nm>&)'
  146 |     get(const array<_Tp, _Nm>&) noexcept;
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:146:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'const std::array<_Tp, _Nm>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/bits/stl_pair.h:150:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp&& std::get(const array<_Tp, _Nm>&&)'
  150 |     get(const array<_Tp, _Nm>&&) noexcept;
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:150:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'const std::array<_Tp, _Nm>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/bits/stl_pair.h:1272:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_T1, _T2>&)'
 1272 |     get(pair<_Tp, _Up>& __p) noexcept
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:1272:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'std::pair<_T1, _T2>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/bits/stl_pair.h:1277:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const pair<_T1, _T2>&)'
 1277 |     get(const pair<_Tp, _Up>& __p) noexcept
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:1277:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'const std::pair<_T1, _T2>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/bits/stl_pair.h:1282:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(pair<_T1, _T2>&&)'
 1282 |     get(pair<_Tp, _Up>&& __p) noexcept
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:1282:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'std::pair<_T1, _T2>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/bits/stl_pair.h:1287:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const pair<_T1, _T2>&&)'
 1287 |     get(const pair<_Tp, _Up>&& __p) noexcept
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:1287:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'const std::pair<_T1, _T2>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/bits/stl_pair.h:1292:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_Up, _Tp>&)'
 1292 |     get(pair<_Up, _Tp>& __p) noexcept
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:1292:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'std::pair<_Up, _Tp>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~
/usr/include/c++/14/bits/stl_pair.h:1297:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const pair<_Up, _Tp>&)'
 1297 |     get(const pair<_Up, _Tp>& __p) noexcept
      |     ^~~
/usr/include/c++/14/bits/stl_pair.h:1297:5: note:   template argument deduction/substitution failed:
a.cc:51:11: note:   mismatched types 'const std::pair<_Up, _Tp>' and 'db' {aka 'double'}
   51 |     if(get(m1) < get(m2))
      |        ~~~^~~~