criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
typedef long long LL;

LL comb(LL n, LL k){
  LL r=1;
  for(LL d=1; d<=k; d++){
    r*=n;
    n--;
    r/=d;
  }
  return r;
}

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  vector<double> v(N);
  rep(i,N) cin >> v[i];
  sort(v.begin(),v.end(),greater<double>());
  double sum=0;
  rep(i,A) sum+=v[i];
  double ans=sum/A;
  LL num=0, n=0;
  rep(i,N) if(v[i]==v[0]) n++;
  if(n>=A) for(LL k=A; k<=min(n,B); k++) num+=comb(n,k);
  else{
    n=0;
    rep(i,N) if(v[i]==v[A-1]) n++;
    LL k=0;
    rep(i,A) if(v[i]==v[A-1]) k++;
    num+=comb(n,k);
  }
  cout << fixed <<  setprecision(15) << ans << endl;
  cout << num << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:30: error: no matching function for call to 'min(LL&, int&)'
   31 |   if(n>=A) for(LL k=A; k<=min(n,B); k++) num+=comb(n,k);
      |                           ~~~^~~~~
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:31:30: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   31 |   if(n>=A) for(LL k=A; k<=min(n,B); k++) num+=comb(n,k);
      |                           ~~~^~~~~
/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 a.cc:4:
/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:31:30: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   31 |   if(n>=A) for(LL k=A; k<=min(n,B); k++) num+=comb(n,k);
      |                           ~~~^~~~~
Language: Java

import java.util.*;
public class Main {
    public static long gcd(long x,long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static long lcm(long x,long y){                                                              
        return x*y/gcd(x,y);                                                                                                                                                                                                                
    }
    public static long fac(long x){
        if(x==0) return 1;
        return x*fac(x-1);
    }
    public static long per(long x,long y){
        return fac(x)/fac(x-y);      
    }
    public static long com(long x,long y){
        return per(x,y)/fac(y);      
    }
    public static long com2(long x,long y){
        if(y==0 || y==x) return 1;
        if(x < y) return 0;
        return com2(x-1,y-1)+com2(x-1,y);
    }
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
		long [] in = new long [a];
        long [] [] pascal = new long [51][51];
        for(int i=0;i<=50;i++){
        for(int j=0;j<=i;j++){if(j==0 || j==i){pascal[i][j]=1;}
                             else{pascal[i][j]=pascal[i-1][j-1]+pascal[i-1][j];}
                             }
        }
        double d = 0;
        for(int i=0;i<a;i++){
                             in[i] = sc.nextLong();
                            }
		Arrays.sort(in);
        long e = 0;
        long f = 0;
        long g = 0;       
        for(int i=0;i<b;i++){d+=in[a-i-1];                                               
                            }
        d/=b;
        for(int i=0;i<a;i++){if(in[i]==in[a-b]){f++;if(i>=a-b){g++;}}
                            }
       
        if(d==in[a-1]){for(int i=b;i<=c;i++){e+=pascal[f][i];}}
        else{e=pascal[f][g];}
		System.out.println(d);
        System.out.println(e);
	}
}


Compiler output:
Main.java:52: error: incompatible types: possible lossy conversion from long to int
        if(d==in[a-1]){for(int i=b;i<=c;i++){e+=pascal[f][i];}}
                                                       ^
Main.java:53: error: incompatible types: possible lossy conversion from long to int
        else{e=pascal[f][g];}
                      ^
Main.java:53: error: incompatible types: possible lossy conversion from long to int
        else{e=pascal[f][g];}
                         ^
3 errors
Language: Java

import java.util.*;
public class Main {
    public static long gcd(long x,long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static long lcm(long x,long y){                                                              
        return x*y/gcd(x,y);                                                                                                                                                                                                                
    }
    public static long fac(long x){
        if(x==0) return 1;
        return x*fac(x-1);
    }
    public static long per(long x,long y){
        return fac(x)/fac(x-y);      
    }
    public static long com(long x,long y){
        return per(x,y)/fac(y);      
    }
    public static long com2(long x,long y){
        if(y==0 || y==x) return 1;
        if(x < y) return 0;
        return com2(x-1,y-1)+com2(x-1,y);
    }
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
		long [] in = new long [a];
        double d = 0;
        for(int i=0;i<a;i++){
                             in[i] = sc.nextLong();
                            }
		Arrays.sort(in);
        long e = 0;
        long f = 0;
        long g = 0; 
        long k;
        for(int i=0;i<h;i++){d+=in[a-i-1];                                               
                            }
        d/=b;
        for(int i=0;i<a;i++){if(in[i]==in[a-b]){f++;if(i>=a-b){g++;}}
                            }
       
        if(d==in[a-1]){for(int i=b;i<=c;i++){k=com2(f,i);e+=k;}}
        else{e=com2(f,g);}
		System.out.println(d);
        System.out.println(e);
	}
}


Compiler output:
Main.java:41: error: cannot find symbol
        for(int i=0;i<h;i++){d+=in[a-i-1];                                               
                      ^
  symbol:   variable h
  location: class Main
1 error
Language: Java

import java.util.*;
public class Main {
    public static long gcd(long x,long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static long lcm(long x,long y){                                                              
        return x*y/gcd(x,y);                                                                                                                                                                                                                
    }
    public static long fac(long x){
        if(x==0) return 1;
        return x*fac(x-1);
    }
    public static long per(long x,long y){
        return fac(x)/fac(x-y);      
    }
    public static long com(long x,long y){
        return per(x,y)/fac(y);      
    }
    public static long com2(long x,long y){
        if(y==0 || y==x) return 1;
        if(x < y) return 0;
        return com2(x-1,y-1)+com2(x-1,y);
    }
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
		long [] in = new long [a];
        double d = 0;
        for(int i=0;i<a;i++){
                             in[i] = sc.nextLong();
                            }
		Arrays.sort(in);
        long e = 0;
        long f = 0;
        long g = 0; 
        long k;
        for(int i=0;i<h;i++){d+=in[a-i-1];                                               
                            }
        d/=b;
        for(int i=0;i<a;i++){if(in[i]==in[a-b]){f++;if(i>=a-b){g++;}}
                            }
       
        if(d==in[a-1]){for(int i=h;i<=c;i++){k=com2(f,i);e+=k;}}
        else{e=com2(f,g);}
		System.out.println(d);
        System.out.println(e);
	}
}


Compiler output:
Main.java:41: error: cannot find symbol
        for(int i=0;i<h;i++){d+=in[a-i-1];                                               
                      ^
  symbol:   variable h
  location: class Main
Main.java:47: error: cannot find symbol
        if(d==in[a-1]){for(int i=h;i<=c;i++){k=com2(f,i);e+=k;}}
                                 ^
  symbol:   variable h
  location: class Main
2 errors
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

ll comb[52][52];

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n, a, b;
	cin >> n >> a >> b;
	vector<ll> v(n);
	rep(i, n) cin >> v[i];
	sort(all(v)); reverse(all(v));
	ll sum = 0;
	rep(i, a) sum += v[i];
	cout << (double)sum / a << '\n';
	int cnt = 0;
	rep(i, b) if (v[i] == v[a - 1]) cnt++;
	int use = 0;
	rep(i, a) if (v[i] > v[a - 1]) use++;
	comb[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		rep(j, i + 1) {
			comb[i][j] += comb[i - 1][j];
			if (j != 0) comb[i][j] += comb[i - 1][j - 1];
		}
	}
	ll ans = comb[cnt][i];
	if (sum == v[a - 1] * a) for (int i = a - use + 1; i <= cnt; i++) ans += comb[cnt][i];
	cout << ans << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:28: error: 'i' was not declared in this scope
   65 |         ll ans = comb[cnt][i];
      |                            ^
Language: Java

import java.util.*;
public class Main {
    public static long gcd(long x,long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static long lcm(long x,long y){                                                              
        return x*y/gcd(x,y);                                                                                                                                                                                                                
    }
    public static long fac(long x){
        if(x==0) return 1;
        return x*fac(x-1);
    }
    public static long per(long x,long y){
        return fac(x)/fac(x-y);      
    }
    public static long com(long x,long y){
        return per(x,y)/fac(y);      
    }
    public static long com2(long x,long y){
        if(y==0) return 1;
        if(y==x) return 1;
        return com2(x-1,y-1)+com2(x-1,y);
    }
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
		long [] in = new long [a];
        double d = 0;
        for(int i=0;i<a;i++){
                             in[i] = sc.nextLong();
                            }
		Arrays.sort(in);
        long e = 0;
        long f = 0;
        long g = 0;
        for(int i=0;i<b;i++){d+=in[a-i-1];                                               
                            }
        d/=b;
        for(int i=0;i<a;i++){if(in[i]==in[a-b]){f++;if(i>=a-b){g++;}}
                            }
        
        if(d=in[a-1]){for(long i=g;i<=f;i++){e+=com(f,i);}}
        else{e=com(f,g);}
		System.out.println(d);
        System.out.println(e);
	}
}


Compiler output:
Main.java:46: error: incompatible types: double cannot be converted to boolean
        if(d=in[a-1]){for(long i=g;i<=f;i++){e+=com(f,i);}}
            ^
1 error
Language: Java

import java.util.*;
public class Main {
    public static Long gcd(Long x,Long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static Long lcm(Long x,Long y){                                                              
        return x*(y/gcd(x,y));                                                                                                                                                                                                                
    }
    public static Long fac(Long x){
        if(x==0) return x+1;
        return x*fac(x-1);
    }
    public static Long per(Long x,Long y){
        return fac(x)/fac(x-y);      
    }
    public static Long com(Long x,Long y){
        return per(x,y)/fac(y);      
    }
    public static Long com2(Long x,Long y){
        if(y==0) return y+1;
        if(y==x) return com2(x,0);
        return com2(x-1,y-1)+com2(x-1,y);
    }
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
		Long [] in = new Long [a];
        double d = 0;
        for(int i=0;i<a;i++){
                             in[i] = sc.nextLong();
                            }
		Arrays.sort(in);
        Long e = in[0]-in[0];
        Long f = e;
        Long g = e;
        for(int i=0;i<b;i++){d+=in[a-i-1];                                               
                            }
        d/=b;
        for(int i=0;i<a;i++){if(i>=a-c && in[i]==in[a-b]){f++;if(i>=a-b){g++;}}
                            }
        if(g==b){for(Long i=g;i<=f;i++){e+=com2(f,i);}}
        else{e+=com2(f,g);}
		System.out.println(d);
        System.out.println(e);
	}
}


Compiler output:
Main.java:23: error: incompatible types: int cannot be converted to Long
        if(y==x) return com2(x,0);
                               ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
using namepsace std;
int factor(int n) {
  int ret=1;
  for(int i = n; i > 1; i++)
    ret *= i;
  return ret;
}
int main() {
  
  int N,A,B;
  cin >> N >> A >> B;
  vector<int> vec = new vector<int>(N);
  for(int i = 0; i < N; i++) {
    cin >> vec[i]; 
  }
  sort(vec.begin(), vec.end());
  int current_dupl = 1;
  int count = 0;
  int choice = 1;
  int sum;
  for(int i = vec.size()-1; i >= 0; i++){
     if(count < A || (current_dupl > 1 && count < B)) {
        sum += vec[i]; 
       if((i < (vec.size()-1)) && (vec[i] == vec[i-1])){
          current_dupl++;
       }
       else {
         choice += factor(current_dupl);
         current_dupl = 1;
       }
     }
     count++;
  }
  return 0; 
}

Compiler output:
a.cc:4:7: error: expected nested-name-specifier before 'namepsace'
    4 | using namepsace std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:14:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   14 |   cin >> N >> A >> B;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:15:3: error: 'vector' was not declared in this scope
   15 |   vector<int> vec = new vector<int>(N);
      |   ^~~~~~
a.cc:15:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:15:10: error: expected primary-expression before 'int'
   15 |   vector<int> vec = new vector<int>(N);
      |          ^~~
a.cc:17:12: error: 'vec' was not declared in this scope
   17 |     cin >> vec[i];
      |            ^~~
a.cc:19:8: error: 'vec' was not declared in this scope
   19 |   sort(vec.begin(), vec.end());
      |        ^~~
a.cc:19:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   19 |   sort(vec.begin(), vec.end());
      |   ^~~~
      |   std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
Language: Java

import java.util.*;
public class Main {
    public static Long gcd(Long x,Long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static Long lcm(Long x,Long y){                                                              
        return x*y/gcd(x,y);                                                                                                                                                                                                                
    }
    public static Long fac(Long x){
        if(x==0) return x+1;
        return x*fac(x-1);
    }
    public static Long per(Long x,Long y){
        return fac(x)/fac(x-y);      
    }
    public static Long com(Long x,Long y){
        return per(x,y)/fac(y);      
    }
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
		Long [] in = new Long [a];
        double d = 0;
        Long e = d-d;
        Long f = e;
        Long g = e;
        f++;
        for(int i=0;i<a;i++){
                             in[i] = sc.nextLong();
                            }
		Arrays.sort(in);  
        for(int i=0;i<b;i++){d+=in[a-i-1];                                               
                            }
        d/=b;
        for(int i=0;i<a;i++){if(i>=a-c && in[i]==in[a-b]){f++;if(i>=a-b){g++;}}
                            }
        for(Long i=g;i<=f;i++){e+=com(f,i);}
		System.out.println(d);
        System.out.println(e);
	}
}


Compiler output:
Main.java:28: error: incompatible types: double cannot be converted to Long
        Long e = d-d;
                  ^
1 error
Language: Java

import java.util.*;
public class Main {
    public static Long gcd(Long x,Long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static Long lcm(Long x,Long y){                                                              
        return x*y/gcd(x,y);                                                                                                                                                                                                                
    }
    public static Long fac(Long x){
        if(x==0) return x+1;
        return x*fac(x-1);
    }
    public static Long per(Long x,Long y){
        return fac(x)/fac(x-y);      
    }
    public static Long com(Long x,Long y){
        return per(x,y)/fac(y);      
    }
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
        Long c = sc.nextInt();
		Long [] in = new int [a];
        double d = 0;
        Long e = c-c;
        Long f = e;
        Long g = e;
        f++;
        for(int i=0;i<a;i++){
                             in[i] = sc.nextLong();
                            }
		Arrays.sort(in);  
        for(int i=0;i<b;i++){d+=in[a-i-1];                                               
                            }
        d/=b;
        for(int i=0;i<a;i++){if(i>=a-c && in[i]==in[a-b]){f++;if(i>=a-b){g++;}}
                            }
        for(Long i=g;i<=f;i++){e+=com(f,i);}
		System.out.println(d);
        System.out.println(e);
	}
}


Compiler output:
Main.java:25: error: incompatible types: int cannot be converted to Long
        Long c = sc.nextInt();
                           ^
Main.java:26: error: incompatible types: int[] cannot be converted to Long[]
		Long [] in = new int [a];
		             ^
2 errors
Language: Java

import java.util.*;
public class Main {
    public static Long gcd(Long x,Long y){
        if(x < y) return gcd(y, x);
        if(y == 0) return x;
        return gcd(y, x % y);
    }
    public static Long lcm(Long x,Long y){                                                              
        return x*y/gcd(x,y);                                                                                                                                                                                                                
    }
    public static Long fac(Long x){
        if(x==0) return x+1;
        return x*fac(x-1);
    }
    public static Long per(Long x,Long y){
        return fac(x)/fac(x-y);      
    }
    public static Long com(Long x,Long y){
        return per(x,y)/fac(y);      
    }
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        Long b = sc.nextLong();
        Long c = sc.nextLong();
		Long [] in = new int [a];
        double d = 0;
        Long e = a-a;
        Long f = e;
        Long g = e;
        f++;
        for(int i=0;i<a;i++){
                             in[i] = sc.nextLong();
                            }
		Arrays.sort(in);  
        for(int i=0;i<b;i++){d+=in[a-i-1];                                               
                            }
        d/=b;
        for(int i=0;i<a;i++){if(i>=a-c && in[i]==in[a-b]){f++;if(i>=a-b){g++;}}
                            }
        for(Long i=g;i<=f;i++){e+=com(f,i);}
		System.out.println(d);
        System.out.println(e);
	}
}

Compiler output:
Main.java:26: error: incompatible types: int[] cannot be converted to Long[]
		Long [] in = new int [a];
		             ^
Main.java:28: error: incompatible types: int cannot be converted to Long
        Long e = a-a;
                  ^
Main.java:39: error: incompatible types: possible lossy conversion from long to int
        for(int i=0;i<a;i++){if(i>=a-c && in[i]==in[a-b]){f++;if(i>=a-b){g++;}}
                                                     ^
3 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
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;
}

signed main(){
  COMinit();
  int N,A,B; cin>>N>>A>>B;
  vi C(N);
  rep(i,0,N) cin>>C[i];
  sort(ALL(C),vi,greater<int>());
  int sum=0;
  rep(i,0,A) sum+=C[i];
  double ans=sum*1.0/A;
  printf("%.10lf\n",ans);
  int Ans=1;
  int E=0,D=0;
  rep(i,0,A){
    if(C[i]==C[A-1]) D++;
  }
  rep(i,A,N){
    if(C[i]==C[A-1]) E++;
  }
  Ans*=COM(D+E,D);
  if(C[0]==C[A-1]){
    REP(i,A+1,min(B,D+E)){
      Ans*=COM(D+E,i);
      Ans%=MOD;
    }
  }
  cout<<Ans<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:47:17: error: expected primary-expression before ',' token
   47 |   sort(ALL(C),vi,greater<int>());
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a,b,n;
long long c[51];double d[51];
ll f[51][51];
bool cmp(long long a,long long b)
{
	return a>b;
	
}
void fi()
{
	memset(f,0,sizeof(f));
	f[0][0]=1;
	for(int i=1;i<=50;i++)
	{
	f[i][0]=1;
	for(int j=1;j<=i;j++)
	f[i][j]=f[i-1][j-1]+f[i-1][j];	
	}
	
	
}
int main()
{
	scanf("%d%d%d",&n,&a,&b);
	for(int i=0;i<n;i++)
	scanf("%lld",&c[i]);
	sort(c,c+n,cmp);
	for(int i=1;i<=n;i++)
	d[i]=d[i-1]+c[i-1];
	int p=upper_bound(c,c+n,c[a-1],greater<int>())-c;
	int q=lower_bound(c,c+n,c[a-1],greater<int>())-c;
	fi();
	if(a==1&&p==1)
	{
	printf("%.10lf\n",d[1]/1);
	printf("1\n");
}
	else if((a>=2&&c[a-1]==c[0])||(a==1&&c[1]==c[0]))
	{
    printf("%.10lf\n",d[1]/1);
	ll sum=0;
	for(int i=a;i<=b;i++)
	sum+=f[p][i];
	printf("%lld\n",sum);
	}
    else 
    {
    printf("%.10lf\n",(double)d[a]/a);
    printf("%lld\n",f[p-q][a-q]);
}
   return 0;
	
	

Compiler output:
a.cc: In function 'int main()':
a.cc:54:13: error: expected '}' at end of input
   54 |    return 0;
      |             ^
a.cc:26:1: note: to match this '{'
   26 | {
      | ^
Language: Java

import java.util.*;

public class ABC057D {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int min = in.nextInt();
        int max = in.nextInt();
        long[] nums = new long[n];
        for( int i = 0; i < n; i++ ) nums[i] = in.nextLong();
        Arrays.sort(nums);
        boolean same = true;
        long ave = 0;
        int totalPostSame = 0;
        int postSame = 0;
        for( int i = n-1; i >= 0; i-- ) {
            // flag if not everything is the same
            if( i >= 1 ) if( nums[i] != nums[i-1] ) same = false;
            // get average
            if( i >= n-min ) ave += nums[i];
            // count nums that are the same as the one at A
            if( nums[i] == nums[n-min] ) {
                totalPostSame++;
                if( i >= n-min ) postSame++; // everything before A (sorted)
            }
        }
        System.out.println((double)ave/min);

        // pascals triangle
        long[][] pascal = new long[n+1][n+1];
        pascal[0][0] = 1;
        for( int i = 1; i <= n; i++ ) {
            for( int j = 0; j <= i; j++ ) {
                if( i == j ) pascal[i][j] = 1;
                else if( j == 0 ) pascal[i][j] = 1;
                else pascal[i][j] = pascal[i-1][j-1] + pascal[i-1][j];
            }
        }
        System.out.println(Arrays.deepToString(pascal));
        if( same ) {
            long total = 0;
            for( int i = min; i <= max; i++ ) {
                total += pascal[i][min];
            }
            System.out.println(total);
        } else {
            System.out.println(pascal[totalPostSame][postSame]);
        }
    }
}

Compiler output:
Main.java:3: error: class ABC057D is public, should be declared in a file named ABC057D.java
public class ABC057D {
       ^
1 error
Language: C++

from collections import defaultdict
import operator as op
from functools import reduce

def ncr(n, r):
	r = min(r, n-r)
	numer = reduce(op.mul, range(n, n-r, -1), 1)
	denom = reduce(op.mul, range(1, r+1), 1)
	
	if n == 0 or n < r:
		return 0
	return numer // denom

n, a, b = map(int, input().split())
v = sorted(list(map(int, input().split())))

mydict = defaultdict(lambda: 0)
mynewdict = defaultdict(lambda: 0)

for num in v:
	mydict[num]+=1

new_v = v[n-a:]

for num in new_v:
	mynewdict[num]+=1

x = 1
for key in mynewdict:
	x *= ncr(mydict[key], mynewdict[key])
	
ave = sum(new_v)/a
print("{0:.16f}".format(ave))

if ave in v[:n-a]:
	for i in range(1,b-a+1):
		x += ncr(mydict[ave],i+a)

print(x)

Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from collections import defaultdict
      | ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
using namespace std;

long long com[51][51];

void combination(int n){
  //combination
    com[0][0] = 1;
    for (int i = 1; i <=n; ++i) {
        for (int j = 0; j <= i; ++j) {
            com[i][j] += com[i-1][j];
            if (j > 0) com[i][j] += com[i-1][j-1];        
        }
    }
}

int main(void){
    int N, a, b; 
    cin >> N >> a >> b;
  
  combination(N);
  
    vector<long long> v(N);
  
    for (int i = 0; i < N; ++i) 
      cin >> v[i];
  
    sort(v.begin(), v.end(), greater<long long>());

    
    long long sum = 0;
  
    for (int i = 0; i < a; ++i){
      sum += v[i];
    }
  
    double ave = (double)(sum) / a;

    
    long long res = 0;
  
    int num = 0;
    for (int i = 0; i < N; ++i) if (v[i] == v[a-1]) ++num;
  
    if (v[0] == v[a-1]) {
        for (int j = a; j <= b; ++j) {
            res += c[num][j];
        }
    }
  
    else {
        int ans = 0;
        for (int i = 0; i < a; ++i) if (v[i] == v[a-1]) ans++;
        res = c[num][ans];
    }
  
    cout << fixed << setprecision(20) << ave << endl;
    cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:20: error: 'c' was not declared in this scope
   50 |             res += c[num][j];
      |                    ^
a.cc:57:15: error: 'c' was not declared in this scope
   57 |         res = c[num][ans];
      |               ^
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 lli = long long int;
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: In function 'int main()':
a.cc:38:12: error: 'fabsl' was not declared in this scope
   38 |         if(fabsl(average - val) <= EPS){
      |            ^~~~~
Language: Java

import java.io.PrintWriter;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		PriorityQueue<Long> v = new PriorityQueue<>(Comparator.reverseOrder());
		for(int i=0;i<N;i++) {
			v.add(Long.parseLong(sc.next()));
		}
		double dp[] = new double[N+1];
		dp[0] = 0;
		int counter = 1;
		long f=0,ins=0;
		for(int i=1;i<A+1;i++) {
			f = v.poll();
			dp[i] = (dp[i-1]+f) / i;
		}
		for(int i=A+1;i<N+1;i++) {
			ins = v.poll();
			if(f == ins) {
				counter ++;
			}
			dp[i] = ((dp[i-1]*(i-1))+ins)/i;
		}
		int result = 0;
		//counter expresses the number of the replacible elements.
		for(int i=A;i<=B;i++) {
			if(dp[A] == dp[i]) {
				result += combination(counter,i);
			}
		}

		out.println(dp[A]);
		out.println(result);

		out.flush();
	}

	public static long combination(int n,int k) {
		if(n < k) {
			return 0;
		}
		else {
			long numerator = 1,denominator = 1;
			for(int i=n;i>n-k;i--) {
				numerator = numerator * i;
			}
			for(int i=k;i>0;i--) {
				denominator = denominator * i;
			}
			return numerator / denominator;
		}

Compiler output:
Main.java:60: error: reached end of file while parsing
		}
		 ^
1 error
Language: Java

import java.util.*;

public class ABC057{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=Integer.parseInt(sc.next());
        int a=Integer.parseInt(sc.next());
        int b=Integer.parseInt(sc.next());
        ArrayList<Long> v=new ArrayList<Long>();
        for(int i=0;i<n;i++){
            v.add(Long.parseLong(sc.next()));
        }
        sc.close();
        Collections.sort(v,(v1, v2)->{
            if(v1<v2) return 1;
            else if(v1>v2) return -1;
            else return 0;
        });
        long min=v.get(a-1);
        int minCount=0;
        int befA=1;
        double avg=0;
        for(int i=0;i<n;i++){
            if(i<a) avg+=v.get(i);
            if(v.get(i)==min) minCount++;
            if(i==a-1) befA=minCount;
        }
        avg=avg/((double) a);
        long pattern=0;
        long minCj;
        int minCount2;
        int j_max=befA;
        if(min==v.get(0)) j_max+=b-a;
        for(int j=befA;j<=j_max;j++){
            minCount2=minCount;
            minCj=1;
            for(int d=1;d<=j;d++){
                minCj*=minCount2;
                minCount2--;
                minCj/=d;
            }
            pattern+=minCj;
        }
        System.out.println(String.format("%.6f", avg));
        System.out.println(pattern);
    }
}

Compiler output:
Main.java:3: error: class ABC057 is public, should be declared in a file named ABC057.java
public class ABC057{
       ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long maxn=1e15;
long long n,m,d,ans1,ans2=0,cnt1,cnt2;
int a[maxn],C[100][100];
bool cmp(long long x,long long y)
{
	return x>y;
}
void init()
{
    C[0][0]=1;
    C[1][0]=1;
    C[1][1]=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]+C[i-1][j-1];
    }
}
int main()
{
	init();
	cin>>n>>m>>d;
	for(long long i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+n+1,cmp);
	for(long long i=1;i<=m;i++)
	{
		ans1+=a[i];
	}
	for(long long i=1;i<=n;i++) 
	{
		if(a[i]==a[m]) 
		{
			cnt1++;
		}
	}    
	for(long long i=1;i<=m;i++)  
	{
		if(a[i]==a[m]) 
		{
			cnt2++;	
		}
	}
    if(a[1]==a[m]) 
	{
		for(long long i=m;i<=min(cnt2,d);i++) 
		{
			ans2+=C[cnt2][i-1];
		}	
	}
    else ans2=C[cnt1][cnt2];
    printf("%lf\n%lld",(double)ans1/m,ans2);
	return 0;
}

Compiler output:
/tmp/cccNL6ua.o: in function `init()':
a.cc:(.text+0x1f): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cccNL6ua.o
a.cc:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cccNL6ua.o
a.cc:(.text+0x33): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cccNL6ua.o
a.cc:(.text+0x6c): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cccNL6ua.o
a.cc:(.text+0xb9): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cccNL6ua.o
a.cc:(.text+0xf9): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cccNL6ua.o
a.cc:(.text+0x135): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cccNL6ua.o
/tmp/cccNL6ua.o: in function `main':
a.cc:(.text+0x39b): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cccNL6ua.o
a.cc:(.text+0x419): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/cccNL6ua.o
collect2: error: ld returned 1 exit status
Language: C++


#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PP pair<P,P>


int c[1100][1100];

void comb_table(void){
  for(int i=0;i<=1000;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]);
      }
    }
  }
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int n,a,b;
  cin>>n>>a>>b;
  map<int,int> mp;
  vi v(n);
  rep(i,n){
    cin>>v[i];
    mp[v[i]]++;
  }

  sort(all(v));
  reverse(all(v));

  int s=0,t=0;
  rep(i,n){
    if(v[i]==v[a-1]){
      s++;
      if(i<a) t++;
    }
  }

  double ave=0;
  rep(i,a){
    ave+=v[i];
  }

  ave/=a;
  comb_table();
  cout<<ave<<endl;
  int ans=0;
  if(a==t){
    FOR(i,a,b+1){
      ans+=c[s][i];
    }
  }else{
    ans=c[mp[v[p]]][a-p];
  }

  cout<<ans<<endl;



}

Compiler output:
a.cc: In function 'int main()':
a.cc:84:16: error: 'p' was not declared in this scope
   84 |     ans=c[mp[v[p]]][a-p];
      |                ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cfloat>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong C[55][55];
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]);
            }
        }
    }
}

llong n, a, b;
llong v[55];
llong sum[55];

int main() {
    comb_table(50);
    
    cin >> n >> a >> b;
    for (llong i = 1; i <= n; i++) {
        cin >> v[i];
    }
    sort(v + 1, v + n + 1, greater<>());

    for (llong i = 1; i <= n; i++) {
        sum[i] = sum[i - 1] + v[i];
    }

    __float128 maxv = 0;
    for (llong i = a; i <= b; i++) {
        __float128 avg = (sum[i]) / ((__float128)i);
        maxv = max(avg, maxv);
    }
    
    llong ans = 0 , last = -1;
  
    for (llong i = a; i <= b; i++) {
        __float128 avg = (__float128)sum[i] / (__float128)i;

        if (maxv == avg) {
            llong t = v[i];
            llong N = 0;
            llong K = 0;
          
          assert(last == -1 || last == a[i]);
            
            for (llong j = 1; j <= n; j++) {
                if (v[j] == t) N++;
            }
            for (llong j = i; j > 0; j--) {
                if (v[j] == t) K++;
            }

            ans += C[N][K];
        }
    }

    printf("%.*lf\n", DBL_DIG, (double)maxv);
    printf("%lld\n", ans);

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:67:41: error: invalid types 'llong {aka long long int}[llong {aka long long int}]' for array subscript
   67 |           assert(last == -1 || last == a[i]);
      |                                         ^
a.cc:67:11: error: 'assert' was not declared in this scope
   67 |           assert(last == -1 || last == a[i]);
      |           ^~~~~~
a.cc:14:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
   13 | #include <cfloat>
  +++ |+#include <cassert>
   14 | using namespace std;
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) {
            ans += 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 << ans << 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) {
      |         ^
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) {
      |         ^
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)
      |                                             ^
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) {
            ans += 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) {
      |         ^
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) {
      |         ^
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:75:13: error: 'res' was not declared in this scope; did you mean 'rep'?
   75 |     cout << res << endl;
      |             ^~~
      |             rep