Language: C++

#include <stdio.h>
#include <vector>
#include <tuple>

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

constexpr long double EPS = 1e-10;
using info = std::pair<lli, lli>;
// DP[i][j] = (v, c) := 品物 1, ..., i から j 個選んだ時の価値の総和v, その方法数 c 
std::vector<std::vector<info>> DP;

int main(void){
    int n, a, b; scanf("%d%d%d", &n, &a, &b);
    DP.resize(n+1, std::vector<info>(n+1, info(0, 0)));
    DP[0][0] = {0, 1};
    REP(i, n){
        lli v; scanf("%lld", &v);
        for(int j = 0; j <= i; ++j){
            // not chosen
            if(DP[i+1][j].first < DP[i][j].first) 
                    DP[i+1][j] = DP[i][j];
            else if(DP[i+1][j].first == DP[i][j].first)
                    DP[i+1][j].second += DP[i][j].second;

            // chosen
            if(DP[i+1][j+1].first < DP[i][j].first + v)
                    DP[i+1][j+1] = {DP[i][j].first + v, DP[i][j].second};
            else if(DP[i+1][j+1].first == DP[i][j].first + v)
                    DP[i+1][j+1].second += DP[i][j].second;
        }
    }

    long double average = 0; lli cnt = 0;
    for(int x = a; x <= b; ++x){
        double val = DP[n][x].first; val /= x;
        if(fabsl(average - val) <= EPS){
            cnt += DP[n][x].second;
        }
        else if(average < val){
            average = val;
            cnt = DP[n][x].second;
        }
    }
    printf("%.16Lf\n%lld\n", average, cnt);
    
    return 0;
}

Compiler output:
a.cc:9:24: error: 'lli' was not declared in this scope
    9 | using info = std::pair<lli, lli>;
      |                        ^~~
a.cc:9:29: error: 'lli' was not declared in this scope
    9 | using info = std::pair<lli, lli>;
      |                             ^~~
a.cc:9:32: error: template argument 1 is invalid
    9 | using info = std::pair<lli, lli>;
      |                                ^
a.cc:9:32: error: template argument 2 is invalid
a.cc:11:25: error: 'info' was not declared in this scope
   11 | std::vector<std::vector<info>> DP;
      |                         ^~~~
a.cc:11:25: error: template argument 1 is invalid
a.cc:11:25: error: template argument 2 is invalid
a.cc:11:29: error: template argument 1 is invalid
   11 | std::vector<std::vector<info>> DP;
      |                             ^~
a.cc:11:29: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:15:8: error: request for member 'resize' in 'DP', which is of non-class type 'int'
   15 |     DP.resize(n+1, std::vector<info>(n+1, info(0, 0)));
      |        ^~~~~~
a.cc:15:32: error: 'info' was not declared in this scope
   15 |     DP.resize(n+1, std::vector<info>(n+1, info(0, 0)));
      |                                ^~~~
a.cc:15:36: error: template argument 1 is invalid
   15 |     DP.resize(n+1, std::vector<info>(n+1, info(0, 0)));
      |                                    ^
a.cc:15:36: error: template argument 2 is invalid
a.cc:16:7: error: invalid types 'int[int]' for array subscript
   16 |     DP[0][0] = {0, 1};
      |       ^
a.cc:18:9: error: 'lli' was not declared in this scope
   18 |         lli v; scanf("%lld", &v);
      |         ^~~
a.cc:18:31: error: 'v' was not declared in this scope
   18 |         lli v; scanf("%lld", &v);
      |                               ^
a.cc:21:18: error: invalid types 'int[int]' for array subscript
   21 |             if(DP[i+1][j].first < DP[i][j].first)
      |                  ^
a.cc:21:37: error: invalid types 'int[int]' for array subscript
   21 |             if(DP[i+1][j].first < DP[i][j].first)
      |                                     ^
a.cc:22:23: error: invalid types 'int[int]' for array subscript
   22 |                     DP[i+1][j] = DP[i][j];
      |                       ^
a.cc:22:36: error: invalid types 'int[int]' for array subscript
   22 |                     DP[i+1][j] = DP[i][j];
      |                                    ^
a.cc:23:23: error: invalid types 'int[int]' for array subscript
   23 |             else if(DP[i+1][j].first == DP[i][j].first)
      |                       ^
a.cc:23:43: error: invalid types 'int[int]' for array subscript
   23 |             else if(DP[i+1][j].first == DP[i][j].first)
      |                                           ^
a.cc:24:23: error: invalid types 'int[int]' for array subscript
   24 |                     DP[i+1][j].second += DP[i][j].second;
      |                       ^
a.cc:24:44: error: invalid types 'int[int]' for array subscript
   24 |                     DP[i+1][j].second += DP[i][j].second;
      |                                            ^
a.cc:27:18: error: invalid types 'int[int]' for array subscript
   27 |             if(DP[i+1][j+1].first < DP[i][j].first + v)
      |                  ^
a.cc:27:39: error: invalid types 'int[int]' for array subscript
   27 |             if(DP[i+1][j+1].first < DP[i][j].first + v)
      |                                       ^
a.cc:28:23: error: invalid types 'int[int]' for array subscript
   28 |                     DP[i+1][j+1] = {DP[i][j].first + v, DP[i][j].second};
      |                       ^
a.cc:28:39: error: invalid types 'int[int]' for array subscript
   28 |                     DP[i+1][j+1] = {DP[i][j].first + v, DP[i][j].second};
      |                                       ^
a.cc:28:59: error: invalid types 'int[int]' for array subscript
   28 |                     DP[i+1][j+1] = {DP[i][j].first + v, DP[i][j].second};
      |                                                           ^
a.cc:29:23: error: invalid types 'int[int]' for array subscript
   29 |             else if(DP[i+1][j+1].first == DP[i][j].first + v)
      |                       ^
a.cc:29:45: error: invalid types 'int[int]' for array subscript
   29 |             else if(DP[i+1][j+1].first == DP[i][j].first + v)
      |                                             ^
a.cc:30:23: error: invalid types 'int[int]' for array subscript
   30 |                     DP[i+1][j+1].second += DP[i][j].second;
      |                       ^
a.cc:30:46: error: invalid types 'int[int]' for array subscript
   30 |                     DP[i+1][j+1].second += DP[i][j].second;
      |                                              ^
a.cc:34:30: error: 'lli' was not declared in this scope
   34 |     long double average = 0; lli cnt = 0;
      |                              ^~~
a.cc:36:24: error: invalid types 'int[int]' for array subscript
   36 |         double val = DP[n][x].first; val /= x;
      |                        ^
a.cc:37:12: error: 'fabsl' was not declared in this scope
   37 |         if(fabsl(average - val) <= EPS){
      |            ^~~~~
a.cc:38:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   38 |             cnt += DP[n][x].second;
      |             ^~~
      |             int
a.cc:38:22: error: invalid types 'int[int]' for array subscript
   38 |             cnt += DP[n][x].second;
      |                      ^
a.cc:42:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   42 |             cnt = DP[n][x].second;
      |             ^~~
      |             int
a.cc:42:21: error: invalid types 'int[int]' for array subscript
   42 |             cnt = DP[n][x].second;
      |                     ^
a.cc:45:39: error: 'cnt' was not declared in this scope; did you mean 'int'?
   45 |     printf("%.16Lf\n%lld\n", average, cnt);
      |                                       ^~~
      |                                       int