Language: C++

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

int nCm(int n,int m){
	m=min(m,n-m);
	if(	m==0)return 0;
	else return nCm(n-1,m-1)+nCm(n-1,m);
}

signed main(){
	int n,a,b;cin>>n>>a>>b;
	vector<int> v(n);
	for(auto&& w:v)cin>>w;

	int sm=accumulate(v.begin(),v,begin()+a,0);
	double avg=(double)sm/a;

	
	sort(v.begin(),v.end(),greater<int>());
	int a0=v[a-1];
		

	int x=count(v.begin(),v.end(),a0);
	int y=count(v.begin(),v.begin()+a,a0);
	int cnt;
	if(y<a){cnt=nCm(x,y);}
	else {int b0=min(b,y);
		 for(int i=0;i+a<b0;i++){
		cnt+=nCm(y,(x+i));}
	}  
	cout<<cnt<<endl;
	cout.setprecision(10);
	cout<<avg<<endl;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:44: error: no matching function for call to 'begin()'
   16 |         int sm=accumulate(v.begin(),v,begin()+a,0);
      |                                       ~~~~~^~
In file included from /usr/include/c++/14/bits/algorithmfwd.h:39,
                 from /usr/include/c++/14/bits/stl_algo.h:59,
                 from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/initializer_list:88:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::begin(initializer_list<_Tp>)'
   88 |     begin(initializer_list<_Tp> __ils) noexcept
      |     ^~~~~
/usr/include/c++/14/initializer_list:88:5: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/range_access.h:52:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&)'
   52 |     begin(_Container& __cont) -> decltype(__cont.begin())
      |     ^~~~~
/usr/include/c++/14/bits/range_access.h:52:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:63:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&)'
   63 |     begin(const _Container& __cont) -> decltype(__cont.begin())
      |     ^~~~~
/usr/include/c++/14/bits/range_access.h:63:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:95:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])'
   95 |     begin(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~~~
/usr/include/c++/14/bits/range_access.h:95:5: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1227:5: note: candidate: 'template<class _Tp> _Tp* std::begin(valarray<_Tp>&)'
 1227 |     begin(valarray<_Tp>& __va) noexcept
      |     ^~~~~
/usr/include/c++/14/valarray:1227:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/valarray:1238:5: note: candidate: 'template<class _Tp> const _Tp* std::begin(const valarray<_Tp>&)'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
/usr/include/c++/14/valarray:1238:5: note:   candidate expects 1 argument, 0 provided
a.cc:33:14: error: 'std::ostream' {aka 'class std::basic_ostream<char>'} has no member named 'setprecision'; did you mean 'std::streamsize std::ios_base::_M_precision'? (not accessible from this context)
   33 |         cout.setprecision(10);
      |              ^~~~~~~~~~~~
In file included from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/ios_base.h:578:25: note: declared protected here
  578 |     streamsize          _M_precision;
      |                         ^~~~~~~~~~~~