Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <deque>
using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

// pascal's triangle // C[n][k] -> nCk //　O(n^2)
const int MAX_N = 10000;
ll C[MAX_N][MAX_N];
void comb_table(int n){
  REP(i,n+1){
    REP(j,i+1){
      if(j==0 || j==i){
        C[i][j]=1LL;
      }else{
        C[i][j]=(C[i-1][j-1]+C[i-1][j]);
      }
    }
  }
}


int main(){
  ll n, a, b;
  cin >> n >>a >> b;
  ll v[n];
  REP(i,n)cin >> v[i];

  sort(v, v+n);

  double ave = 0;

  REP(i,a){
    ave += v[n-1-i];
  }
  ave /= double(a);

  ll x = v[n-a];

  comb_table(51);

  if(ave == x){
    int xnum = upper_bound(v, v+n, x) - lower_bound(v, v+n, x);
    ll ans = 0;
    for(int i = a; i <= min(b,xnum); i++){
      ans += C[xnum][i];
    }
    cout.precision(20);
    cout << fixed <<  ave << endl;
    cout << ans << endl;

    cout << "hey" << endl;

  }else{
    int xnum = upper_bound(v, v+n, x) - lower_bound(v, v+n, x);
    int xina = (upper_bound(v, v+n, x) - v) - (n - a);
    cout.precision(20);
    cout << fixed <<  ave << endl;
    cout << C[xnum][xina] << endl;
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:69:28: error: no matching function for call to 'min(ll&, int&)'
   69 |     for(int i = a; i <= min(b,xnum); i++){
      |                         ~~~^~~~~~~~
In file included 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: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:69:28: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   69 |     for(int i = a; i <= min(b,xnum); i++){
      |                         ~~~^~~~~~~~
/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,
                 from a.cc:4:
/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:69:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   69 |     for(int i = a; i <= min(b,xnum); i++){
      |                         ~~~^~~~~~~~