Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007
using namespace std;
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define yes cout<<"yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define no cout<<"no"<<endl;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
 
/*---------------------------------------------------*/
 
ull C[55][55];
void comb_table(int n){
  rep(i,n+1){
    rep(j,n+1){
      if(j==0||j==i)C[i][j]=(ull)1;
      else C[i][j]=C[i-1][j-1]+C[i-1][j];
    }
  }
}
 
int main(){
  int n,a,b;
  vll v;
  map<ull,int>imp,mp;
  cin>>n>>a>>b;
  comb_table(n);
  rep(i,n){
    ll in;
    cin>>in;
    v.pb(in);
    imp[in]++;
  }
  sort(all(v),greater<ll>());
  ll ave=0;
  rep(i,a){
    ave+=v[i];
  }
  int pos=0,max_pos=0;
  rep(i,n){
    if(v[i]==v[a-1]){
      pos++;
      if(i<a)max_pos++;
    }
  }
  ull cnt=0;
  if(v[0]==v[a-1]){
    REP(i,a,pos+1)cnt+=C[pos][i];
  }else{
    cnt+=C[pos][max_pos];
  }
  printf("%.10f\n",ave/(double)a);
  cout<<cnt<<endl;
  return 0;
}
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007
using namespace std;

#define rep(i,n) for(int i=0;i vi;
typedef vector vll;
typedef pair pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;

/*---------------------------------------------------*/

ull C[55][55];
void comb_table(int n){
  rep(i,n+1){
    rep(j,n+1){
      if(j==0||j==i)C[i][j]=(ull)1;
      else C[i][j]=C[i-1][j-1]+C[i-1][j];
    }
  }
}

int main(){
  int n,a,b;
  vll v;
  mapimp,mp;
  cin>>n>>a>>b;
  comb_table(n);
  rep(i,n){
    ll in;
    cin>>in;
    v.pb(in);
    imp[in]++;
  }
  sort(all(v),greater());
  ll ave=0;
  rep(i,a){
    ave+=v[i];
  }
  int pos=0,max_pos=0;
  rep(i,n){
    if(v[i]==v[a-1]){
      pos++;
      if(i#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define yes cout<<"yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define no cout<<"no"<<endl;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;

/*---------------------------------------------------*/

ull C[55][55];
void comb_table(int n){
  rep(i,n+1){
    rep(j,n+1){
      if(j==0||j==i)C[i][j]=(ull)1;
      else C[i][j]=C[i-1][j-1]+C[i-1][j];
    }
  }
}

int main(){
  int n,a,b;
  vll v;
  map<ull,int>imp,mp;
  cin>>n>>a>>b;
  comb_table(n);
  rep(i,n){
    ll in;
    cin>>in;
    v.pb(in);
    imp[in]++;
  }
  sort(all(v),greater<ll>());
  ll ave=0;
  rep(i,a){
    ave+=v[i];
  }
  int pos=0,max_pos=0;
  rep(i,n){
    if(v[i]==v[a-1]){
      pos++;
      if(i<a)max_pos++;
    }
  }
  ull cnt=0;
  if(v[0]==v[a-1]){
    REP(i,a,min(pos+1,b))cnt+=C[pos][i];
  }else{
    cnt+=C[pos][max_pos];
  }
  printf("%.10f\n",ave/(double)a);
  cout<<cnt<<endl;
  return 0;
}


Compiler output:
a.cc:93:10: error: #include expects "FILENAME" or <FILENAME>
   93 | #include
      |          ^
a.cc:94:10: error: #include expects "FILENAME" or <FILENAME>
   94 | #include
      |          ^
a.cc:95:10: error: #include expects "FILENAME" or <FILENAME>
   95 | #include
      |          ^
a.cc:96:10: error: #include expects "FILENAME" or <FILENAME>
   96 | #include
      |          ^
a.cc:97:10: error: #include expects "FILENAME" or <FILENAME>
   97 | #include
      |          ^
a.cc:98:10: error: #include expects "FILENAME" or <FILENAME>
   98 | #include
      |          ^
a.cc:99:10: error: #include expects "FILENAME" or <FILENAME>
   99 | #include
      |          ^
a.cc:100:10: error: #include expects "FILENAME" or <FILENAME>
  100 | #include
      |          ^
a.cc:101:10: error: #include expects "FILENAME" or <FILENAME>
  101 | #include
      |          ^
a.cc:102:10: error: #include expects "FILENAME" or <FILENAME>
  102 | #include
      |          ^
a.cc:103:10: error: #include expects "FILENAME" or <FILENAME>
  103 | #include
      |          ^
a.cc:104:10: error: #include expects "FILENAME" or <FILENAME>
  104 | #include
      |          ^
a.cc:105:10: error: #include expects "FILENAME" or <FILENAME>
  105 | #include
      |          ^
a.cc:106:10: error: #include expects "FILENAME" or <FILENAME>
  106 | #include
      |          ^
a.cc:107:10: error: #include expects "FILENAME" or <FILENAME>
  107 | #include
      |          ^
a.cc:108:10: error: #include expects "FILENAME" or <FILENAME>
  108 | #include
      |          ^
a.cc:109:10: error: #include expects "FILENAME" or <FILENAME>
  109 | #include
      |          ^
a.cc:110:10: error: #include expects "FILENAME" or <FILENAME>
  110 | #include
      |          ^
a.cc:116:9: warning: "rep" redefined
  116 | #define rep(i,n) for(int i=0;i vi;
      |         ^~~
a.cc:24:9: note: this is the location of the previous definition
   24 | #define rep(i,n) for(int i=0;i<int(n);i++)
      |         ^~~
a.cc:157:11: error: stray '#' in program
  157 |       if(i#include <iostream>
      |           ^
a.cc:180:9: warning: "rep" redefined
  180 | #define rep(i,n) for(int i=0;i<int(n);i++)
      |         ^~~
a.cc:116:9: note: this is the location of the previous definition
  116 | #define rep(i,n) for(int i=0;i vi;
      |         ^~~
a.cc:117:9: error: typedef declared 'auto'
  117 | typedef vector vll;
      |         ^~~~~~
a.cc:118:9: error: typedef declared 'auto'
  118 | typedef pair pi;
      |         ^~~~
a.cc:120:5: error: redefinition of 'int dx [4]'
  120 | int dx[4]={1,0,-1,0};
      |     ^~
a.cc:43:5: note: 'int dx [4]' previously defined here
   43 | int dx[4]={1,0,-1,0};
      |     ^~
a.cc:121:5: error: redefinition of 'int dy [4]'
  121 | int dy[4]={0,1,0,-1};
      |     ^~
a.cc:44:5: note: 'int dy [4]' previously defined here
   44 | int dy[4]={0,1,0,-1};
      |     ^~
a.cc:122:6: error: redefinition of 'bool debug'
  122 | bool debug=false;
      |      ^~~~~
a.cc:45:6: note: 'bool debug' previously defined here
   45 | bool debug=false;
      |      ^~~~~
a.cc:126:5: error: redefinition of 'ull C [55][55]'
  126 | ull C[55][55];
      |     ^
a.cc:49:5: note: 'ull C [55][55]' previously declared here
   49 | ull C[55][55];
      |     ^
a.cc:127:6: error: redefinition of 'void comb_table(int)'
  127 | void comb_table(int n){
      |      ^~~~~~~~~~
a.cc:50:6: note: 'void comb_table(int)' previously defined here
   50 | void comb_table(int n){
      |      ^~~~~~~~~~
a.cc: In function 'void comb_table(int)':
a.cc:116:32: error: expected ';' before 'vi'
  116 | #define rep(i,n) for(int i=0;i vi;
      |                                ^~
a.cc:128:3: note: in expansion of macro 'rep'
  128 |   rep(i,n+1){
      |   ^~~
a.cc:116:34: error: expected primary-expression before ';' token
  116 | #define rep(i,n) for(int i=0;i vi;
      |                                  ^
a.cc:128:3: note: in expansion of macro 'rep'
  128 |   rep(i,n+1){
      |   ^~~
a.cc:116:34: error: expected ')' before ';' token
  116 | #define rep(i,n) for(int i=0;i vi;
      |                     ~            ^
a.cc:128:3: note: in expansion of macro 'rep'
  128 |   rep(i,n+1){
      |   ^~~
a.cc:116:32: error: expected ';' before 'vi'
  116 | #define rep(i,n) for(int i=0;i vi;
      |                                ^~
a.cc:129:5: note: in expansion of macro 'rep'
  129 |     rep(j,n+1){
      |     ^~~
a.cc:116:34: error: expected primary-expression before ';' token
  116 | #define rep(i,n) for(int i=0;i vi;
      |                                  ^
a.cc:129:5: note: in expansion of macro 'rep'
  129 |     rep(j,n+1){
      |     ^~~
a.cc:116:34: error: expected ')' before ';' token
  116 | #define rep(i,n) for(int i=0;i vi;
      |                     ~            ^
a.cc:129:5: note: in expansion of macro 'rep'
  129 |     rep(j,n+1){
      |     ^~~
a.cc:130:10: error: 'j' was not declared in this scope
  130 |       if(j==0||j==i)C[i][j]=(ull)1;
      |          ^
a.cc:130:19: error: 'i' was not declared in this scope
  130 |       if(j==0||j==i)C[i][j]=(ull)1;
      |                   ^
a.cc: At global scope:
a.cc:136:5: error: redefinition of 'int main()'
  136 | int main(){
      |     ^~~~
a.cc:59:5: note: 'int main()' previously defined here
   59 | int main(){
      |     ^~~~
a.cc: In function 'int main()':
a.cc:139:3: error: 'mapimp' was not declared in this scope
  139 |   mapimp,mp;
      |   ^~~~~~
a.cc:116:32: error: expected ';' before 'vi'
  116 | #define rep(i,n) for(int i=0;i vi;
      |                                ^~
a.cc:142:3: note: in expansion of macro 'rep'
  142 |   rep(i,n){
      |   ^~~
a.cc:116:34: error: expected primary-expression before ';' token
  116 | #define rep(i,n) for(int i=0;i vi;
      |                                  ^
a.cc:142:3: note: in expansion of macro 'rep'
  142 |   rep(i,n){
      |   ^~~
a.cc:116:34: error: expected ')' before ';' token
  116 | #define rep(i,n) for(int i=0;i vi;
      |                     ~            ^
a.cc:142:3: note: in expansion of macro 'rep'
  142 |   rep(i,n){
      |   ^~~
a.cc:146:5: error: 'imp' was not declared in this scope; did you mean 'mp'?
  146 |     imp[in]++;
      |     ^~~
      |     mp
a.cc:116:32: error: expected ';' before 'vi'
  116 | #define rep(i,n) for(int i=0;i vi;
      |                                ^~
a.cc:150:3: note: in expansion of macro 'rep'
  150 |   rep(i,a){
      |   ^~~
a.cc:116:34: error: expected primary-expression before ';' token
  116 | #define rep(i,n) for(int i=0;i vi;
      |                                  ^
a.cc:150:3: note: in expansion of macro 'rep'
  150 |   rep(i,a){
      |   ^~~
a.cc:116:34: error: expected ')' before ';' token
  116 | #define rep(i,n) for(int i=0;i vi;
      |                     ~            ^
a.cc:150:3: note: in expansion of macro 'rep'
  150 |   rep(i,a){
      |   ^~~
a.cc:151:12: error: 'i' was not declared in this scope
  151 |     ave+=v[i];
      |            ^
a.cc:116:32: error: expected ';' before 'vi'
  116 | #define rep(i,n) for(int i=0;i vi;
      |                                ^~
a.cc:154:3: note: in expansion of macro 'rep'
  154 |   rep(i,n){
      |   ^~~
a.cc:116:34: error: expected primary-expression before ';' token
  116 | #define rep(i,n) for(int i=0;i vi;
      |                                  ^
a.cc:154:3: note: in expansion of macro 'rep'
  154 |   rep(i,n){
      |   ^~~
a.cc:116:34: error: expected ')' before ';' token
  116 | #define rep(i,n) for(int i=0;i vi;
      |                     ~            ^
a.cc:154:3: note: in expansion of macro 'rep'
  154 |   rep(i,n){
      |   ^~~
a.cc:155:10: error: 'i' was not declared in this scope
  155 |     if(v[i]==v[a-1]){
      |          ^
a.cc:157:11: error: expected ';' before 'include'
  157 |       if(i#include <iostream>
      |           ^~~~~~~~
      |           ;
a.cc:193:1: error: 'typedef' invalid in condition
  193 | typedef long long ll;
      | ^~~~~~~
a.cc:193:19: error: typedef 'll' is initialized (use 'decltype' instead)
  193 | typedef long long ll;
      |                   ^~
a.cc:193:21: error: expected initializer before ';' token
  193 | typedef long long ll;
      |                     ^
a.cc:193:21: error: expected ')' before ';' token
  193 | typedef long long ll;
      |                     ^
      |                     )
a.cc:157:9: note: to match this '('
  157 |       if(i#include <iostream>
      |         ^
a.cc:206:23: error: a function-definition is not allowed here before '{' token
  206 | void comb_table(int n){
      |                       ^
a.cc:215:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  215 | int main(){
      |         ^~
a.cc:215:9: note: remove parentheses to default-initialize a variable
  215 | int main(){
      |         ^~
      |         --
a.cc:215:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:215:11: error: a function-definition is not allowed here before '{' token
  215 | int main(){
      |           ^
a.cc:248:2: error: expected '}' at end of input
  248 | }
      |  ^
a.cc:155:21: note: to match this '{'
  155 |     if(v[i]==v[a-1]){
      |                     ^
a.cc:248:2: error: expected '}' at end of input
  248 | }
      |  ^
a.cc:154:11: note: to match this '{'
  154 |   rep(i,n){
      |           ^
a.cc:248:2: error: expected '}' at end of input
  248 | }
      |  ^
a.cc:136:11: note: to match this '{'
  136 | int main(){
      |           ^