Language: C++

#include<iostream>
#include<bits/stdc++.h>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#define EPS 1e-6
#define INF 2147483647
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define llINF 9223372036854775807

using namespace std;
int main(){
  int n,a,b;
  cin>>n>>a>>b;
  vector<ll>vl;
  for(int i=0;i<n;i++){
    ll aaaaaa;cin>>aaaaaa;
    vl.pb(aaaaaa);
  }
  sort(vl.begin(),vl.end(),greater<ll>());
  double ma=0;
  for(int i=0;i<a;i++)
    ma+=vl[i];
  printf("%.7f\n",ma/(double)a);
  ll acnt=0;
  ll apointer=0;
  for(int i=0;i<n;i++){
    if(vl[i]==vl[a-1]&&acnt==0){
      apointer=i;acnt++;
    }else if(vl[i]==vl[a-1])acnt++;
  }
  ll cnt=0;
  if(acnt==1)cnt=1;
  else if(acnt==n){
    for(int i=a-1;i<b;i++){
      cnt+=(ll)1<<i;
    }
  }else if(apointer==0&&acnt!=n){
    ll aaacnt=1;
    for(int i=a;i<=acnt&&i<=b;i++){
      aaacnt=1;
      int abc=min(i-pointer,min(acnt,b)-(i-pointer));
      for(int j=0;j<abc;j++){
	aaacnt*=(ll)(acnt-j);
      }
      for(int j=1;j<=abc;j++)
	aaacnt=(ll)aaacnt/j;
      cnt+=aaacnt;
    }
  }else{
    cnt=1;
    int abc=min(a-apointer,acnt-(a-apointer));
    for(int i=0;i<abc;i++){
      cnt*=(ll)(acnt-i);
    }
    for(int i=1;i<=abc;i++){
      cnt=(ll)cnt/i;
    }
  }
  cout<<cnt<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:21: error: 'pointer' was not declared in this scope; did you mean 'apointer'?
   50 |       int abc=min(i-pointer,min(acnt,b)-(i-pointer));
      |                     ^~~~~~~
      |                     apointer
a.cc:50:32: error: no matching function for call to 'min(long long int&, int&)'
   50 |       int abc=min(i-pointer,min(acnt,b)-(i-pointer));
      |                             ~~~^~~~~~~~
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:50:32: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   50 |       int abc=min(i-pointer,min(acnt,b)-(i-pointer));
      |                             ~~~^~~~~~~~
/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 /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/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:50:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   50 |       int abc=min(i-pointer,min(acnt,b)-(i-pointer));
      |                             ~~~^~~~~~~~