Language: C++

#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define rep(i,n) for(int i=1;i<=(n);i++)
#define rep0(i,n) for(int i=0;i<(n);i++)

const ll INF=1e9+7;
ll n,a,b,ans,k,l;
int te[51];
ll s[51],g;
double h;
ll C[51][51];
void init()
{
	memset(C,0,sizeof(C));
	C[0][0]=1;
	for(int i=1;i<=50;i++)
	{
		C[i][0]=1;
		for(int j=1;j<=i;j++)
			C[i][j]=C[i-1][j-1]+C[i-1][j];
	}
}
int main()
{
	/*freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
	init();
	cin>>n>>a>>b;
	rep(i,n){
		cin>>s[i];
	}
	sort(s+1,s+n+1);
	s[n+1]=s[n];
	for(int i=n;i>=1;i--){
		if(s[i]!=s[i+1]){
			te[++l]=k;
			k=0;
		}
		k++;
	}
	k=0;
	l=0;
	for(int i=n;i>=n-a+1;i--){
		g+=s[i];
		if(s[i]!=s[i+1]){
			k=0;
		}
		k++;
	}
//	cout<<k<<' '<<upper_bound(s+1,s+n,s[n-b+1])-s<<' '<<lower_bound(s+1,s+n,s[n-b+1])-s<<endl;
	int v=min(b,upper_bound(s+1,s+n+1,s[n-b+1])-lower_bound(s+1,s+n+1,s[n-b+1]));
	for(int i=k;i<=v;i++){
		ans+=C[upper_bound(s+1,s+n+1,s[n-b+1])-lower_bound(s+1,s+n+1,s[n-b+1])][i];
	}
	double t=g;
	h=t/a;
	printf("%.7f",h);
	cout<<endl<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:18: error: no matching function for call to 'min(long long int&, long int)'
   54 |         int v=min(b,upper_bound(s+1,s+n+1,s[n-b+1])-lower_bound(s+1,s+n+1,s[n-b+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:54:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int')
   54 |         int v=min(b,upper_bound(s+1,s+n+1,s[n-b+1])-lower_bound(s+1,s+n+1,s[n-b+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:54:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   54 |         int v=min(b,upper_bound(s+1,s+n+1,s[n-b+1])-lower_bound(s+1,s+n+1,s[n-b+1]));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~