criyle/codenet-compile-errors huggingface dataset:
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;

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: In function 'int main()':
a.cc:60:14: error: expected ';' before 'for'
   60 |     COMinit()
      |              ^
      |              ;
a.cc:61:9: error: 'i' was not declared in this scope
   61 |     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:61:9: error: 'i_len' was not declared in this scope
   61 |     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:64:13: error: 'res' was not declared in this scope; did you mean 'rep'?
   64 |             res += COM(num, j);
      |             ^~~
      |             rep
a.cc:73:13: error: 'res' was not declared in this scope; did you mean 'rep'?
   73 |     cout << res << endl;
      |             ^~~
      |             rep
Language: C++

#include <bits/stdc++.h>
using namespace std;
double m[55];
bool cmp(double x,double y)
{
    return x>y;
}
ll A(ll n,ll m)
{
    ll cnt = 1;
    if(n < m)
        return 0;
    while(m--)
    {
        cnt*=n;
        n--;
    }
    return cnt;
}

ll C(ll n,ll m)
{
    if(n < m)
        return 0;
    return A(n,m)/A(m,m);
}
int main()
{
    int n,a;
    double b;
    cin>>n>>a>>b;
    for(int i=1;i<=n;i++)
    {
        cin>>m[i];
    }
    sort(m+1,m+1+n,cmp);
    double sum = 0;
    for(int i=1;i<=a;i++)
    {
        sum += m[i];
    }
    double ave = sum/a;
    double k = m[a];
    int cnt1 = 0,cnt2 = 0 ;
    for(int i=1;i<=n;i++)
    {
        if(m[i] == k){
            cnt1++;
        }
    }
    for(int i=1;i<=a;i++)
    {
        if(m[i] == k){
            cnt2++;
        }
    }
    int res = 0;
    if(cnt2 == a){
        for(int i=a;i<=b;i++)
        {
            res += C(cnt1,i);
        }
    }else{
        res = C(cnt1,cnt2);
    }
    printf("%.8lf",ave);
    printf("%d\n",res);
    return 0;
}


Compiler output:
a.cc:8:1: error: 'll' does not name a type
    8 | ll A(ll n,ll m)
      | ^~
a.cc:21:1: error: 'll' does not name a type
   21 | ll C(ll n,ll m)
      | ^~
a.cc: In function 'int main()':
a.cc:61:20: error: 'C' was not declared in this scope
   61 |             res += C(cnt1,i);
      |                    ^
a.cc:64:15: error: 'C' was not declared in this scope
   64 |         res = C(cnt1,cnt2);
      |               ^
Language: C++

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <time.h>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <string.h>

#define sf scanf
#define pf printf
#define lf double
#define ll long long
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
using namespace std;
ll c[100];
bool cmp(ll a,ll b){
    return a > b;
}
ll C(ll a,ll b){
    if(b == 0 || a == b)return 1ll;
    if(b == 1)return a;
    return (C(a-1,b-1)+C(a-1,b));
}
int main() {
    //pld(C)
    ll n;
    sld(n)
    ll a,b;
    sld(a) sdl(b)
    for(ll i = 0; i < n; i ++){
        sld(c[i])
    }
    ll sum = 0;
    sort(c,c+n,cmp);
    ll x = c[a-1];
    ll count0 = 0;
    for(ll i = a-1; i >= 0; i --){
        if(c[i] == x){
            count0 ++;
        }
        sum += c[i];
    }
    ll count1 = 0;
    for(ll i = a; i < n; i ++){
        if(c[i] == x){
            count1 ++;
        }
    }
    pf("%.6lf",(lf)sum/(lf)a); pn
    pld(C(count0+count1,count0)); pn
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:12: error: 'sdl' was not declared in this scope; did you mean 'sld'?
   52 |     sld(a) sdl(b)
      |            ^~~
      |            sld
a.cc:53:19: error: 'i' was not declared in this scope
   53 |     for(ll i = 0; i < n; i ++){
      |                   ^
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include <cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

ll C[51][51];

void comb_table(int N){
    for(int i = 0;i <= N; ++i){
        for(int j = 0;j <= i; ++j){
            if(j == 0 || j == i){
                 C[i][j] = 1LL;
            }else{
                C[i][j] = C[i-1][j-1] + C[i-1][j];
            }
        }
    }
}


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int N, A, B; cin >> N >> A >> B;
    comb_table(N);
    ld v[55]; rep(i, N) cin >> v[i];
    sort(v, v + N, greater<ll>());
    ld mini = v[A - 1]; 
    int cnt = 0, cnt1 = 0;
    rep(i, N) {
        if(v[i] == mini) cnt ++;
    }
    ld ans = 0;
    rep(i, A) {
        ans += v[i];
        if(v[i] == mini) cnt1 ++;
    }
    ans /= A;
    cout << fixed << setprecison(8) << ans << endl;
    if(v[0] != mini) {
        cout << C[cnt][cnt1] << endl;
    } else {
        ll ans1 = 0;
        Rep(i, A, B + 1) {
            if(cnt < i) break;
            ans1 += C[cnt][i];
        }
        cout << ans1 << endl;
    }
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:87:22: error: 'setprecison' was not declared in this scope
   87 |     cout << fixed << setprecison(8) << ans << endl;
      |                      ^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using ll = long long;
using namespace std;

std::vector<std::vector<long long>> comb(ll n, ll r) {
  std::vector<std::vector<long long>> v(n + 1,std::vector<long long>(n + 1, 0));
  for (ll i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (ll j = 1; j < v.size(); j++) {
    for (ll k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

int main(){
  ll N,A,B;
  cin>>N>>A>>B;
  vector <ll> v(N);
  for (ll i(0);i<N;i++) cin>>v[i];
  sort(v.begin(),v.end(),greater<ll>());
  ll sum(0);
  ll cnti(0);
  for (ll i(A-1);i>=0;i--){
    if(v[A-1]==v[i])cnti++;
    sum+=v[i];
  }
	double ans=(double)sum / A;
  cout <<setprecision(20)<<ans<<endl; 
  ll cnt(0);
  for (ll i(0);i<N;i++){
    if (v[i]==v[A-1]) cnt++;
  }
  ll ans(0);
	if (cnt==N){
    for (ll i(A);i<=B;i++){
      if (cnt>=i) ans+=comb(cnt,i)[cnt][i];
    }
		cout << ans <<endl;
		return 0;
  }
	ans=comb(cnt,cnti)[cnt][cnti];  
  cout << ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:6: error: conflicting declaration 'll ans'
   37 |   ll ans(0);
      |      ^~~
a.cc:31:16: note: previous declaration as 'double ans'
   31 |         double ans=(double)sum / A;
      |                ^~~
Language: C++

#include <bits/stdc++.h>
using ll = long long;
using namespace std;

std::vector<std::vector<long long>> comb(ll n, ll r) {
  std::vector<std::vector<long long>> v(n + 1,std::vector<long long>(n + 1, 0));
  for (ll i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (ll j = 1; j < v.size(); j++) {
    for (ll k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

ll main(){
  ll N,A,B;
  cin>>N>>A>>B;
  vector <ll> v(N);
  for (ll i(0);i<N;i++) cin>>v[i];
  sort(v.begin(),v.end(),greater<ll>());
  ll sum(0);
  ll cnti(0);
  for (ll i(A-1);i>=0;i--){
    if(v[A-1]==v[i])cnti++;
    sum+=v[i];
  }
  cout <<setprecision(8)<< (double)sum / A<<endl;
  ll cnt(0);
  for (ll i(0);i<N;i++){
    if (v[i]==v[A-1]) cnt++;
  }
  ll ans(0);
	if (cnt==N){
    for (ll i(A);i<=B;i++){
      if (cnt>=i) ans+=comb(cnt,i)[cnt][i];
    }
		cout << ans <<endl;
		return 0;
  }
	ans=comb(cnt,cnti)[cnt][cnti];  
  cout << ans<<endl;
  return 0;
}


Compiler output:
a.cc:19:1: error: '::main' must return 'int'
   19 | ll main(){
      | ^~
Language: C++

#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>
 
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>
 
#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;
 
template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

const double eps = 1e-12;

typedef ll Int;


const int N = 128;
ll dp[N][N];

ll rec(int n, int r) {
  if (n < 0 || r < 0) return 0;
  if (dp[n][r] != -1) return dp[n][r];
  if (n == 0 || n == r) return dp[n][r] = 1;
  return dp[n][r] = rec(n-1, r) + rec(n-1, r-1);
}

class C_cls {
  static const int N = 1000000;
  vector<Int> facts;
public:
  C_cls() : facts(vector<Int>(N, 1)){
    FOR(i,1,N) facts[i] = facts[i-1] * Int(i);
  }
  Int choose(int n, int r) { return rec(n, r); }
};

C_cls C;

double error(double a, double b) {
  double abs_error = fabs(a - b);
  if (a > eps) { return min(abs_error, abs_error / a); }
  return abs_error;
}


int main() {
  REP(i,N) REP(j,N) dp[i][j] = -1;
  
  int n, a, b;
  while (cin >> n >> a >> b) {
    vll v(n);
    REP(i,n) cin >> v[i];
    sort(RALL(v));

    double average = 0;
    auto ave = [&](int c) { return accumulate(v.begin(), v.begin() + c, 0.0) / c; };
    FOR(c,a,b+1) {
      gs(average, ave(c));
    }

    ll cnt = 0;
    FOR(c,a,b+1) if (error(average - ave(c)) < eps) {
      // cout << "# c = " << c << endl;
      map<ll,int> mn, mr;
      ll t = 1;
      REP(i,n) mn[v[i]]++;
      REP(i,c) mr[v[i]]++;
      for (const auto& e: mr) {
        // cout << "+= " << mn[e.first] << " C " << e.second << " = " <<
        //   C.choose(mn[e.first], e.second) << endl;
        t *= C.choose(mn[e.first], e.second);
      }
      cnt += t;
    }

    printf("%.9lf\n%lld\n", average, cnt);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:90:27: error: too few arguments to function 'double error(double, double)'
   90 |     FOR(c,a,b+1) if (error(average - ave(c)) < eps) {
      |                      ~~~~~^~~~~~~~~~~~~~~~~~
a.cc:67:8: note: declared here
   67 | double error(double a, double b) {
      |        ^~~~~
Language: C++

#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int64_t GetCombination(int64_t n, int64_t r) {
  cerr << "\033[93m" << n << " " << r << "\033[m" << endl;
  if (n / 2 < r) {
    r = n - r;
  }
  assert(r >= 0);
  assert(n >= 0);

  if (r == 0) return 1;
  return n * GetCombination(n - 1, r - 1) / r;
}

void OutputError(std::string s) {
  cerr << "\033[93m" << s << "\033[m" << endl;
  return;
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  int64_t n, a, b;
  cin >> n >> a >> b;
  std::vector<int64_t> v(n);
  int64_t sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }

  std::sort(v.begin(), v.end(), std::greater<int64_t>());

  bool all_same = true;
  for (int i = 0; i < a; i++) {
    sum += v[i];
    if (i >= 1 && v[i - 1] != v[i]) {
      all_same = false;
    }
  }

  int64_t pattern = 0;
  if (all_same) {
    cerr << "allsame" << endl;
    int64_t number_canchoose = 0;
    for (int i = 0; i < n; i++) {
      cerr << "\033[93m"
           << "roop 1"
           << "\033[m" << endl;
      if (v[i] == v[0]) {
        number_canchoose++;
      } else
        break;
    }
    for (int i = a; i <= b && i <= number_canchoose; i++) {
      pattern += GetCombination(number_canchoose, i);
    }
  } else {
    cerr << "not allsame" << endl;
    int64_t number_canchoose = 0;
    for (int i = 0; i < n; i++) {
      if (v[i] == v[a - 1]) {
        number_canchoose++;
      }
    }
    int64_t number_shouldchoose = 0;
    for (int i = 0; i < a; i++) {
      if (v[i] == v[a - 1]) {
        number_shouldchoose++;
      }
    }
    pattern = GetCombination(number_canchoose, number_shouldchoose);
  }

  cout << (double)sum / a << endl;
  cout << pattern << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int64_t GetCombination(int64_t, int64_t)':
a.cc:20:3: error: 'assert' was not declared in this scope
   20 |   assert(r >= 0);
      |   ^~~~~~
a.cc:9:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    8 | #include <utility>
  +++ |+#include <cassert>
    9 | #include <vector>
Language: C++

#include <iostream>
using namespace std;
typedef long long ll;

ll c[51][51];

ll com(ll n, ll k){
    if(k == 0) return 1;
    if(k == n) return 1;
    if(k > n) return 0;
    if(c[n][k]) return c[n][k];
    return c[n][k] = com(n - 1, k) + com(n - 1, k - 1);
}

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    ll v[51];
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    sort(v, v + n, greater<ll>());
    for(int i = 0; i <= 50; i++){
        for(int j = 0; j <= 50; j++){
            c[i][j] = 0;
        }
    }
    ll lim = v[a - 1];
    ll sum = 0;
    for(int i = 0; i < a; i++){
        sum += v[i];
    }
    printf("%.15f\n", sum * 1.0 / a);
    int lsum = 0;
    int lbf = 0;
    for(int i = 0; i < n; i++){
        if(v[i] == lim){
            lsum++;
            if(i < a) lbf++;
        }
    }
    if(v[0] != lim) cout << com(lsum, lbf) << endl;
    else{
        ll ans = 0;
        for(int i = a; i <= b; i++){
            ans += com(lsum, i);
        }
        cout << ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   23 |     sort(v, v + n, greater<ll>());
      |     ^~~~
      |     short
Language: Java

import java.math.BigInteger;
import java.util.stream.*;
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();

        long[] v = IntStream.range(0, n).mapToLong(i -> scanner.nextLong()).sorted().toArray();

        double ave = Arrays.stream(v).skip(n - a).average().getAsDouble();
        int count = 0;
        int max = 0, min;
        for (int i = 0; i < n; i++) {
            if (v[i] == v[n - a]) {
                count++;
                max = i;
            }
        }

        min = a - n + max + 1;
        max = max + 1 == n ? Math.min(b - n + max + 1, count) : min;

        BigInteger[] fac = new BigInteger[count + 1];
        fac[0] = BigInteger.ONE;
        for (int i = 1; i <= count; i++) {
            fac[i] = fac[i - 1].multiply(BigInteger.valueOf(i));
        }

        long ans = 0;
        for (int i = min; i <= max; i++) {
            ans += fac[count].divide(fac[count - i].multiply(fac[i])).longValue();
        }
        System.out.println(ave);
        System.out.println(ans);

        Util.println(count, min, max);
        System.out.println(Arrays.toString(v));
    }
}

Compiler output:
Main.java:41: error: cannot find symbol
        Util.println(count, min, max);
        ^
  symbol:   variable Util
  location: class Main
1 error
Language: C++

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

int N,A,B;
vector<long long> v(60);
long long dp[60][60];
long long dq[60][60];

int main(){
  cin >> N >> A >> B;
  for(int i=0;i<=N;i++){
    for(int j=0;j<=N;j++){dq[i][j]=1;}
  }
  dq[0][0]=1;
  for(int i=0;i<N;i++)cin >> v[i];
  for(int i=0;i<N;i++){
    for(int j=0;j<i;j++){
      if(dp[i][j+1]==dp[i][j]+v[i]){dq[i+1][j+1]+=dq[i][j+1];}
      dp[i+1][j+1]=max(dp[i][j]+v[i],dp[i][j+1]);
    }
  }
  double rec=0; long long ans=0;
  for(int i=A;i<=B;i++){
    if(rec<dp[N][i]*1.0/i){rec=dp[N][i]*1.0/i; ans=dq[N][i];}
    if(rec==dp[N][i]*1.0/i){ans+=dq[N][i];}
  }
  cout << rec << endl;
  cout << ans << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:28:23: error: expected '}' at end of input
   28 |   cout << ans << endl;
      |                       ^
a.cc:9:11: note: to match this '{'
    9 | int main(){
      |           ^
Language: C++

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807


int n,a,b,v,ans,tmpa,memo[51][51],sum;
map<int,int> m;
long double anssum;

signed main() {
    cin >> n >> a >> b;tmpa = a;
    rep(i,n+1) for(int j=0;j<=i;j++) {
        if (j==0 || j==i) memo[i][j] = 1;
        else memo[i][j] = memo[i-1][j-1]+memo[i-1][j];
    }
    rep(i,n) cin >> v,m[v]++;
    auto itr = m.rbegin();
    if (a <= itr->se) {
        anssum = itr->fi;
        int hogepiyo = min(b,itr->se);
        for(int i=a;i<=hogepiyo;i++) ans += memo[hogepiyo][i];
    }
    else {
        do {
            a -= itr->se;
            b -= itr->se;
            sum += itr->fi*itr->se;
            ++itr;
        }while(a > itr->se);
        sum += itr->fi*a;
        anssum = sum/tmpa(long double);
        ans += memo[itr->se][a];
    }
    cout << fixed << anssum << endl;
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:27: error: expected primary-expression before 'long'
   46 |         anssum = sum/tmpa(long double);
      |                           ^~~~
a.cc:46:38: error: 'tmpa' cannot be used as a function
   46 |         anssum = sum/tmpa(long double);
      |                                      ^
Language: C++

#include<bits/stdc++.h>

#define ll long long
#define met(a, x) memset(a,x,sizeof(a))
#define inf 0x3f3f3f3f
#define ull unsigned long long
#define mp make_pair

using namespace std;
const int mod = 998244353;
const int N = 3e5 + 10;
const int M = 1e6 + 10;
ll a[N];

bool cmp(int x, int y) {
    return x > y;
}

ll C[300][300];

void init() {
    met(C, 0);
    C[0][0] = 1;
    for (int i = 1; i <= 50; i++) {
        C[i][0] = 1;
        for (int j = 1; j <= i; j++)
            C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    init();
    int n, l, r;
    while (cin >> n >> l >> r) {
        for (int i = 0; i <n; i++)
            cin >> a[i];
        sort(a, a + n , cmp);
        double ans=0;
        for(int i=;i<l;i++){
            ans+=a[i];
        }
        ans/=l;
        int num=0,cnt=0;
        for(int i=0;i<n;i++){
            if(a[i]==a[l-1]){
                num++;
                if(i<l){
                    cnt++;
                }
            }
        }
        ll sum=0;
        if(cnt==l){
            for(int i=l;i<=r;i++){
                sum+=C[num][i];
            }
        }else{
            sum+=C[num][cnt];
        }
        cout<<fixed<<setprecision(10)<<ans<<endl<<sum<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:19: error: expected primary-expression before ';' token
   42 |         for(int i=;i<l;i++){
      |                   ^
Language: C++

using ll=long long;
using R=double;
// Combination Table
ll C[51][51]; // C[n][k] -> nCk

void comb_table(int N){
    for(int i=0;i<n+1;++i){
        for(int j=0;j<=i;++j){
            if(j==0||j==i){
                C[i][j]=1;
            }
            else{
                C[i][j]=C[i-1][j-1]+C[i-1][j];
            }
        }
    }
}

int main(void){
    int N,A,B;
cin>> N>>A>>B;
  const int NMAX=50;
    ll v[NMAX];
    for(int i=0;i<N;++i){
        cin >> v[i];
}
    comb_table(N);
    sort(v,v+N);
    reverse(v,v+N);
    R max_average=0.0;
    for(int i=0;i<A;++i){
        max_average+=v[i];
    }
    max_average/=A;
    int a_th_val_num=0,a_th_val_pos=0;
    for(int i=0;i<N;++i){
        if(v[i]==v[A-1]){
            a_th_val_num++;
            if(i<A){
                a_th_val_pos++;
} }
}
    ll cnt=0LL;
    if(a_th_val_pos==A){
        for(a_th_val_pos=A;a_th_val_pos<=B;++a_th_val_pos){
            cnt+=C[a_th_val_num][a_th_val_pos];
} }else{
        cnt+=C[a_th_val_num][a_th_val_pos];
    }
    cout.precision(20);
    cout << fixed << max_average << endl;
    cout << cnt << endl;
return 0; }

Compiler output:
a.cc: In function 'void comb_table(int)':
a.cc:7:19: error: 'n' was not declared in this scope
    7 |     for(int i=0;i<n+1;++i){
      |                   ^
a.cc: In function 'int main()':
a.cc:21:1: error: 'cin' was not declared in this scope
   21 | cin>> N>>A>>B;
      | ^~~
a.cc:28:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   28 |     sort(v,v+N);
      |     ^~~~
      |     short
a.cc:29:5: error: 'reverse' was not declared in this scope
   29 |     reverse(v,v+N);
      |     ^~~~~~~
a.cc:50:5: error: 'cout' was not declared in this scope
   50 |     cout.precision(20);
      |     ^~~~
a.cc:51:13: error: 'fixed' was not declared in this scope
   51 |     cout << fixed << max_average << endl;
      |             ^~~~~
a.cc:51:37: error: 'endl' was not declared in this scope
   51 |     cout << fixed << max_average << endl;
      |                                     ^~~~
Language: C++


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<string>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;i++)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;

//combination table
ll C[51][51];

void comb_table(int N) {
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= i; j++) {
			if (j == 0 or j == i) {
				C[i][j] = 1LL;
			}
			else {
				C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
			}
		}
	}
}

int main(){
	int N, A, B;
	cin >> N >> A >> B;

	vector<ll> data;
	rep(i, 0, N) {
		ll x;
		cin >> x;
		data.push_back(x);
	}

	sort(data.begin(), data.end());
	reverse(data.begin(), data.end());

	
	R max_ave = 0.0;
	//まず平均を出力
	rep(i, 0, A) {
		max_ave += data[i];
	}
	max_ave /= A;



	//組み合わせの計算
	comb_table(N);


	int a_th_cnt=0;
	int a_th_in_cnt = 0;
	rep(i, 0, N) {
		if (data[i] == data[A - 1]) {
			a_th_cnt++;
			if (i <= A - 1) {
				a_th_in_cnt++;
			}
		}
	}


	ll ans = 0LL;
	if (data[0] == data[A-1]) {
		for(a_th_in_cnt = A; a_th_in_cnt <= B;a_th_in_cnt++) {
			ans += C[a_th_cnt][a_th_in_cnt];
		}
	}
	else {
		ans = C[a_th_cnt][a_th_in_cnt];
	}



	cout.precision(20);
	cout << fixed << max_ave << endl;
	cout << ans << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:92:29: error: expected '}' at end of input
   92 |         cout << ans << endl;
      |                             ^
a.cc:38:11: note: to match this '{'
   38 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<string>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;i++)
using namespace std;
using ll = long long;
const ll inf = 1LL << 50;


ll comb(ll n, ll r) {
	ll ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}


int main(){
	ll N, A, B;
	cin >> N >> A >> B;

	vector<ll> sum;
	vector<ll> data;
 	map<ll, ll> m;
	rep(i, 0, N) {
		ll x;
		cin >> x;
		data.push_back(x);
		sum.push_back(x);
		m[x]++;
	}
	sort(data.begin(), data.end());
	reverse(data.begin(), data.end());
	sort(sum.begin(), sum.end());
	reverse(sum.begin(), sum.end());
	rep(i, 1, N) {
		sum[i] += sum[i - 1];
	}

	ll temp[2] = { 0,0 };
	ll cnt=1;

	rep(i, A - 1, B) {
		map<ll, ll> s;
		rep(j, 0, i + 1) {
			s[data[j]]++;
		}
		if (i == A - 1) {
			temp[0] = sum[i];
			temp[1] = i + 1;
			for (auto a: s) {
				cnt *= comb(m[a.first],a.second);
			}
		}
		else if (temp[1] * sum[i] > temp[0] * (i + 1)) {
			temp[0] = sum[i];
			temp[1] = i + 1;
			cnt = 1;
			for (auto a:s) {
				cnt *= comb(m[a.first], a.second);
			}
		}
		else if (temp[1] * sum[i] == temp[0] * (i + 1)) {
			ll tempnum = 1;
			for (auto a : s) {
				tempnum *= comb(m[a.first], a.second);
			}
			cnt += tempnum;
		}


	}

	long double ans = long double(temp[0]) / long double(temp[1]);
	printf("%f\n", ans);
	cout << cnt << endl;


	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:89:27: error: expected primary-expression before 'long'
   89 |         long double ans = long double(temp[0]) / long double(temp[1]);
      |                           ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setprecision(20)
#define EPS 1e-9


typedef long long ll;
typedef pair<ll, ll> P;


ll comb[51][51];
void makeComb()
{
  comb[0][0] = 1;
  for (ll i = 0; i <= 50; i++) {
    for (ll j = 0; j <= i; j++) {
      if (i == 0 || j == 0 || j == i)
        comb[i][j] = 1;
      else
        comb[i][j] = comb[i-1][j] + comb[i-1][j-1];
    }
  }
}

ll main()
{
  makeComb();
  /*for (ll i = 0; i < 10; i++) {
    for (ll j = 0; j < 10; j++) {
      cout << setw(3) << comb[i][j] << ' ';
    }
    cout << endl;
  }*/

  ll N, A, B;
  cin >> N >> A >> B;
  vector<ll> v(N);
  REP(i, N) cin >> v[i];
  sort(ALL(v), greater<ll>());
  /*for (ll i = 0; i < N; i++) cout << v[i] << ' ';
  cout << endl;*/

  long double sum = 0;
  for (ll i = 0; i < A; i++) { sum += v[i]; }
  cout << Decimal << (sum / A) << endl;


  if (v[0] == v[A - 1]) {
    ll bef = A - 1, aft = A;
    while (bef >= 0 && v[bef] == v[A-1]) bef--;
    while (aft < B && v[aft] == v[A-1]) aft++;
    bef = A - 1 - bef;
    aft = aft - A;

    ll ans = 0;
    for (ll i = 0; i <= aft; i++) {
      ans += comb[bef + aft][bef + i];
    }
    cout << ans << endl;
  } else {
    ll bef = A - 1, aft = A;
    while (bef >= 0 && v[bef] == v[A-1]) bef--;
    while (aft < N && v[aft] == v[A-1]) aft++;
    bef = A - 1 - bef;
    aft = aft - A;
    cout << comb[bef + aft][bef] << endl;
  }

	return 0;
}



Compiler output:
a.cc:43:1: error: '::main' must return 'int'
   43 | ll main()
      | ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,a,b;cin>>n>>a>>b;
  ll v[n];for(ll i=0;i<n;i++)cin>>v[i];
  pair<ll,ll>dp[n+1][n+1];
  for(ll i=0;i<=n;i++)for(ll j=0;j<=n;j++)dp[i][j]=make_pair(-1,0);
  for(ll i=0;i<=n;i++)dp[i][0]=make_pair(0,0);
  for(ll i=0;i<n;i++){
    for(ll j=0;j<n;j++){
      ll f=dp[i][j].first;
      ll s=dp[i][j].second;
      if(f>=0){
        if(dp[i+1][j].first<f)dp[i+1][j]=dp[i][j];
        else if(dp[i+1][j].first==f)dp[i+1][j].second+=s;
        if(dp[i+1][j+1].first<f+v[i])dp[i+1][j+1]=make_pair(f+v[i],max((ll)1,s));
        else if(dp[i+1][j+1].first==f+v[i]){
          dp[i+1][j+1].second+=s;
          if(j==0)dp[i+1][j+1].second=1;
      }
    }
  }
  double ma=0.0;
  double num[n+1];
  for(ll i=a;i<=b;i++){
    num[i]=(dp[n][i].first)/(i*1.0);
    ma=max(ma,num[i]);
  }
  ll ans=0;
  for(ll i=a;i<=b;i++){
    if(num[i]==ma)ans+=dp[n][i].second;
  }
  cout<<ma<<endl;
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:2: error: expected '}' at end of input
   36 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,a,b;cin>>n>>a>>b;
  ll v[n];for(ll i=0;i<n;i++)cin>>v[i];
  pair<ll,ll>dp[n+1][n+1];
  for(ll i=0;i<=n;i++)for(ll j=0;j<=n;j++)dp[i][j]=make_pair(-1,0);
  for(ll i=0;i<=n;i++)dp[i][0]=make_pair(0,0);
  for(ll i=0;i<n;i++){
    for(ll j=0;j<n;j++){
      ll f=dp[i][j].first;
      ll s=dp[i][j].second;
      if(f>=0){
        if(dp[i+1][j].first<f)dp[i+1][j]=dp[i][j];
        else if(dp[i+1][j].first==f)dp[i+1][j].second+=s;
        if(dp[i+1][j+1].first<f+v[i])dp[i+1][j+1]=make_pair(f+v[i],s);
        else if(dp[i+1][j+1].first==f+v[i])dp[i+1][j+1].second+=s;
      }
    }
  }
  double ma=0.0;
  double num[n+1];
  for(ll i=a;i<=b;i++){
    num[i]=(dp[n][i].first)/(i*1.0);
    ma=max(ma,num);
  }
  ll ans=0;
  for(ll i=a;i<=b;i++){
    if(num[i]==ma)ans+=dp[n][i].second;
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:11: error: no matching function for call to 'max(double&, double [(n + 1)])'
   26 |     ma=max(ma,num);
      |        ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:26:11: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'double [(n + 1)]')
   26 |     ma=max(ma,num);
      |        ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:26:11: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   26 |     ma=max(ma,num);
      |        ~~~^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,a,b;cin>>n>>a>>b;
  ll v[n];for(ll i=0;i<n;i++)cin>>v[i];
  pair<ll,ll>dp[n+1][n+1];
  for(ll i=0;i<=n;i++)for(ll j=0;j<=n;j++)dp[i][j]=make_pair(-1,0);
  for(ll i=0;i<=n;i++)dp[i][0]=make_pair(0,0);
  for(ll i=0;i<n;i++){
    for(ll j=0;j<n;j++){
      ll f=dp[i][j].first;
      ll s=dp[i][j].second;
      if(f>=0){
        if(dp[i+1][j].first<f)dp[i+1][j]=dp[i][j];
        else if(dp[i+1][j].first==f)dp[i+1][j].second+=s;
        if(dp[i+1][j+1].first<f+v[i])dp[i+1][j+1]=make_pair(f+a[i],s);
        else if(dp[i+1][j+1].first==f+v[i])dp[i+1][j+1].second+=s;
      }
    }
  }
  double ma=0.0;
  double num[n+1];
  for(ll i=a;i<=b;i++){
    num[i]=(dp[n][i].first)/(i*1.0);
    ma=max(ma,num);
  }
  ll ans=0;
  for(ll i=a;i<=b;i++){
    if(num[i]==ma)ans+=dp[n][i].second;
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:64: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   17 |         if(dp[i+1][j+1].first<f+v[i])dp[i+1][j+1]=make_pair(f+a[i],s);
      |                                                                ^
a.cc:26:11: error: no matching function for call to 'max(double&, double [(n + 1)])'
   26 |     ma=max(ma,num);
      |        ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:26:11: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'double [(n + 1)]')
   26 |     ma=max(ma,num);
      |        ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:26:11: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   26 |     ma=max(ma,num);
      |        ~~~^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long;
int calc(ll x){
  int count = 0;
  while(x>0){
    x/=10;
    count++;
  }
  return count;
}
int F(ll A,ll B){
  return max(calc(A),calc(B));
}
int main(){
  ll N;
  cin>>N;
  int min=1<<29;
  for(ll i=1;i*i<=N;i++) {
    if(N%i==0){
      min=min(min,F(i, N/i));
    }
  }
  cout<<min<<endl;
  return 0;
}


Compiler output:
a.cc:3:21: error: expected ')' before ';' token
    3 | #define ll long long;
      |                     ^
a.cc:4:10: note: in expansion of macro 'll'
    4 | int calc(ll x){
      |          ^~
a.cc:4:9: note: to match this '('
    4 | int calc(ll x){
      |         ^
a.cc:4:13: error: 'x' does not name a type
    4 | int calc(ll x){
      |             ^
a.cc:3:21: error: expected ')' before ';' token
    3 | #define ll long long;
      |                     ^
a.cc:12:7: note: in expansion of macro 'll'
   12 | int F(ll A,ll B){
      |       ^~
a.cc:12:6: note: to match this '('
   12 | int F(ll A,ll B){
      |      ^
a.cc:12:10: error: 'A' does not name a type
   12 | int F(ll A,ll B){
      |          ^
a.cc:12:15: error: 'B' does not name a type
   12 | int F(ll A,ll B){
      |               ^
a.cc: In function 'int main()':
a.cc:3:17: error: declaration does not declare anything [-fpermissive]
    3 | #define ll long long;
      |                 ^~~~
a.cc:16:3: note: in expansion of macro 'll'
   16 |   ll N;
      |   ^~
a.cc:16:6: error: 'N' was not declared in this scope
   16 |   ll N;
      |      ^
a.cc:3:17: error: declaration does not declare anything [-fpermissive]
    3 | #define ll long long;
      |                 ^~~~
a.cc:19:7: note: in expansion of macro 'll'
   19 |   for(ll i=1;i*i<=N;i++) {
      |       ^~
a.cc:19:10: error: 'i' was not declared in this scope
   19 |   for(ll i=1;i*i<=N;i++) {
      |          ^
a.cc:19:20: error: expected ')' before ';' token
   19 |   for(ll i=1;i*i<=N;i++) {
      |      ~             ^
      |                    )
a.cc:19:21: error: 'i' was not declared in this scope
   19 |   for(ll i=1;i*i<=N;i++) {
      |                     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n,a,b,t=0;
  cin>>n>>a>>b;
  vector<ll> c(n);
  for(int i=0;i<n;i++){
    cin>>c[i];
  }
  sort(c.begin(),c.end());
  reverse(c.begin(),c.end());
  for(int i=0;i<a;i++){
    t+=c[i];
  }
  cout<<fixed;
  cout<<seprecision(8)<<(double)t/(double)a<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'seprecision' was not declared in this scope
   17 |   cout<<seprecision(8)<<(double)t/(double)a<<endl;
      |         ^~~~~~~~~~~
Language: C++

def inpl(): return [int(i) for i in input().split()]

N, A, B = inpl()
V = inpl()
V = list(reversed(sorted(V)))
x1 = N-1
x2 = 0
for i in range(N):
    if V[i] == V[A]:
        x1 = min(x1,i)
        x2 = max(x2,i)

print(sum(V[0:A])/A)
from scipy.special import comb
ans = 0
if x1 == 0:
    for l in range(min(B-1,x2)-A+2):
        ans += comb(x2-x1+1,l-x1+1, exact=True)
    print(ans)
else:
    print(comb(x2-x1+1,A-x1+1, exact=True))

Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def inpl(): return [int(i) for i in input().split()]
      | ^~~
Language: C++

#include "stdafx.h"
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))

using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}


const int MOD = 1000000007;


ll v[60];
int main() {
	int N, A, B; cin >> N >> A >> B;
	REP(i, N) {
		cin >> v[i];
	}
	SORT(v, N); REVERSE(v, N);
	double ave = 0;
	REP(i, A) {
		ave += v[i] / double(A);
	}
	cout <<setprecision(20)<< ave << endl;
	bool equal = true;
	int c = 0;
	REP(i, A) {
		if (v[i] != v[0]) {
			equal = false;
			c = i;
			break;
		}
	}
	int c2 = 0;
	bool equal2=true;
	if (equal) {
		FOR(i, A, B) {
			if (v[i] != v[0]) {
				equal2 = false;
				c2 = i;
				break;
			}
		}
		ll ans = 0;
		if (equal2) {
			FOR(i, A, B + 1) {
				ans += nCr(B, i);
			}
			cout << ans << endl;
			return 0;
		}
		else {
			FOR(i, A, c2+1) {
				ans += nCr(c2, i);
			}
			cout << ans << endl;
			return 0;
		}
	}
	else {
		int cnt = 0;
		int c3 = 0;
		REP(i, N) {
			if (v[i] == v[A - 1]) {
				c3 = i;
				break;
			}
		}
		REP(i, N) {
			if (v[i] == v[A - 1]) {
				cnt++;
			}
		}
		ll ans = 0;
		ans = nCr(cnt, c3);
		cout << ans << endl;
	}
}




Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <stdio.h>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
double eps=0.000001;

unsigned long long combi(int a,int b){
  unsigned long long up=1,dn=1;
  for(int i=0;i<b;i++){
    up*=a-i;
    dn*=b-i;
  }
  return up/dn;
}

int main(void){
  int n,a,b,c,d;
  scanf("%d%d%d",&n,&a,&b);
  vector<unsigned long long> v(n);
  for(int i=0;i<n;i++) scanf("%llu",&v[i]);
  sort(v.begin(),v.end());
  double ans1=1.0*accumulate(v.end()-a+1,v.end(),0)/a;
  for(c=n-1;c>=0;c--) if(v[c]==v[n-a])break;
  c=n-1-c;
  unsigned long long ans2=0;
  d=count(v.begin(),v.end(),v[n-a]);
  for(int i=a;i<=b;i++){
    if(fabs(ans1-1.0*accumulate(v.end()-i+1,v.end(),0)/i)<eps){
      ans2+=combi(d,i-c);
    }
  }
  printf("%f\n%llu\n",ans1,ans2);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:8: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   29 |     if(fabs(ans1-1.0*accumulate(v.end()-i+1,v.end(),0)/i)<eps){
      |        ^~~~
      |        labs
Language: C++

#include <stdio.h>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
double eps=0.000001;

unsigned long long combi(int a,int b){
  unsigned long long up=1,dn=1;
  for(int i=0;i<b;i++){
    up*=a-i;
    dn*=b-i;
  }
  return up/dn;
}

int main(void){
  int n,a,b,c,d;
  scanf("%d%d%d",&n,&a,&b);
  vector<unsigned long long> v[n];
  for(int i=0;i<n;i++) scanf("%llu",&v[i]);
  sort(v.begin(),v.end());
  double ans1=1.0*accumulate(v.end()-a+1,v.end(),0)/a;
  for(c=n-1;c>=0;c--) if(v[c]==v[n-a])break;
  c=n-1-c;
  unsigned long long ans2=0;
  d=count(v.begin(),v.end(),v[n-a]);
  for(int i=a;i<=b;i++){
    if(abs(ans1-1.0*accumulate(v.end()-i+1,v.end(),0)/i)<eps){
      ans2+=combi(d,i-c);
    }
  }
  printf("%f\n%llu\n",ans1,ans2);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:10: error: request for member 'begin' in 'v', which is of non-class type 'std::vector<long long unsigned int> [n]'
   22 |   sort(v.begin(),v.end());
      |          ^~~~~
a.cc:22:20: error: request for member 'end' in 'v', which is of non-class type 'std::vector<long long unsigned int> [n]'
   22 |   sort(v.begin(),v.end());
      |                    ^~~
a.cc:23:32: error: request for member 'end' in 'v', which is of non-class type 'std::vector<long long unsigned int> [n]'
   23 |   double ans1=1.0*accumulate(v.end()-a+1,v.end(),0)/a;
      |                                ^~~
a.cc:23:44: error: request for member 'end' in 'v', which is of non-class type 'std::vector<long long unsigned int> [n]'
   23 |   double ans1=1.0*accumulate(v.end()-a+1,v.end(),0)/a;
      |                                            ^~~
a.cc:27:13: error: request for member 'begin' in 'v', which is of non-class type 'std::vector<long long unsigned int> [n]'
   27 |   d=count(v.begin(),v.end(),v[n-a]);
      |             ^~~~~
a.cc:27:23: error: request for member 'end' in 'v', which is of non-class type 'std::vector<long long unsigned int> [n]'
   27 |   d=count(v.begin(),v.end(),v[n-a]);
      |                       ^~~
a.cc:29:34: error: request for member 'end' in 'v', which is of non-class type 'std::vector<long long unsigned int> [n]'
   29 |     if(abs(ans1-1.0*accumulate(v.end()-i+1,v.end(),0)/i)<eps){
      |                                  ^~~
a.cc:29:46: error: request for member 'end' in 'v', which is of non-class type 'std::vector<long long unsigned int> [n]'
   29 |     if(abs(ans1-1.0*accumulate(v.end()-i+1,v.end(),0)/i)<eps){
      |                                              ^~~