Language: C++

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

long long comb(long long n, long long r) {
    long long ret = 1;
    for (long long i = n; i > n-r; i--) ret *= i;
    for (long long i = 2; i <= r; i++) ret /= i;
    return ret;
}

long long Pow(long long x, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 1) return (x * Pow(x, n - 1));
    long long t = Pow(x, n / 2);
    return (t * t);
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    map<long long, long long> mp;
    vector<pair<long long, long long>> data;
    for (int i = 0; i < n; i++) {
        long long e; cin >> e; mp[e]++;
    }
    for (const auto& e : mp) data.emplace_back(e);
    sort(data.begin(), data.end(), greater<pair<long long, long long>>());
    
    long long cnt = 0;
    long long sum = 0, ans = 0;
    double ave;
    for (int i = 0; i < (int)data.size(); i++) {
        long long v, c; tie(v, c) = data[i];
        if (a <= c && i == 0) {
            ave = v;
            ans = Pow(2LL, min(b, c)) - 1;
            break;
        }
        if (cnt + c < a) {
            cnt += c; sum += (c * v);
        } else {
            int add = a - cnt;
            sum += (v * add);
            ave = (double)sum / a;
            ans = comb(c, add);
            break;
        }
    }
    
    assert(0.00 <= ave && 0 <= ans);
    cout << fixed << setprecision(10) << ave << '\n';
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:31: error: no matching function for call to 'min(int&, long long int&)'
   36 |             ans = Pow(2LL, min(b, c)) - 1;
      |                            ~~~^~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:36:31: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   36 |             ans = Pow(2LL, min(b, c)) - 1;
      |                            ~~~^~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:36:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   36 |             ans = Pow(2LL, min(b, c)) - 1;
      |                            ~~~^~~~~~