Language: C++

#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INTINF = 1<<30;
const int MOD = 1000000007;

void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, A, B; cin >> N >> A >> B;
    vector<long long> v(N);
    for (int i = 0; i < N; ++i) cin >> v[i];
    sort(v.begin(), v.end(), greater<ll>());

    ll sum = 0;
    for (int i = 0; i < A; ++i) sum += v[i];
    double ave = (double)(sum) / A;

    ll ans = 0;
    int num = 0;
    COMinit()
    rep(i,N) if(v[i] == v[A-1]) ++num;
    if(v[0] == v[A-1]){
        for (int j = A; j <= B; ++j) {
            res += COM(num, j);
        }
    }
    else{
      int a = 0;
      for (int i = 0; i < A; ++i) if (v[i] == v[A-1]) ++a;
      ans = COM(num, a);
    }
    cout << fixed << setprecision(10) << ave << endl;
    cout << res << endl;
}

Compiler output:
a.cc:24:11: error: redefinition of 'const int MOD'
   24 | const int MOD = 1000000007;
      |           ^~~
a.cc:13:11: note: 'const int MOD' previously defined here
   13 | const int MOD = 1000000007;
      |           ^~~
a.cc: In function 'int main()':
a.cc:61:14: error: expected ';' before 'for'
   61 |     COMinit()
      |              ^
      |              ;
a.cc:62:9: error: 'i' was not declared in this scope
   62 |     rep(i,N) if(v[i] == v[A-1]) ++num;
      |         ^
a.cc:5:43: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
      |                                           ^
a.cc:62:9: error: 'i_len' was not declared in this scope
   62 |     rep(i,N) if(v[i] == v[A-1]) ++num;
      |         ^
a.cc:5:45: note: in definition of macro 'rep'
    5 | #define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
      |                                             ^
a.cc:65:13: error: 'res' was not declared in this scope; did you mean 'rep'?
   65 |             res += COM(num, j);
      |             ^~~
      |             rep
a.cc:74:13: error: 'res' was not declared in this scope; did you mean 'rep'?
   74 |     cout << res << endl;
      |             ^~~
      |             rep