Buggy python submission (verdict: Runtime Error):
import numpy as np
import itertools

N, A, B = list(map(int, input().split()))
V = np.array(list(map(int, input().split())))
V.sort()
V[:] = V[::-1]

def nCr(n, r):
    return(len(list(itertools.combinations(np.arange(n), p))))

d = V[A-1]
# unless all equal, we only need A
if d == V.max():
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    res = nCr(d_eq_cnt, A)
    res_sum = res
    for k in range(1, min(B, d_eq_cnt) + 1 - A):
        res = res * (d_eq_cnt - (A+k-1)) // (A+k)
        res_sum += res
    print(V[:A].mean())
    print(res_sum)
    
    
else:
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    d_lq_cnt = np.count_nonzero(V > d)
    print(V[:A].mean())
    print(nCr(d_eq_cnt, A - d_lq_cnt))



Fixed submission:
import numpy as np

N, A, B = list(map(int, input().split()))
V = np.array(list(map(int, input().split())))
V.sort()
V[:] = V[::-1]

def fac(n):
    return 1 if n<=1 else n*fac(n-1)
        
def nCr(n, r):
    return fac(n) // fac(n-r) // fac(r)

d = V[A-1]
# unless all equal, we only need A
if d == V.max():
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    res = nCr(d_eq_cnt, A)
    res_sum = res
    for k in range(1, min(B, d_eq_cnt) + 1 - A):
        res = res * (d_eq_cnt - (A+k-1)) // (A+k)
        res_sum += res
    print(V[:A].mean())
    print(res_sum)
    
    
else:
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    d_lq_cnt = np.count_nonzero(V > d)
    print(V[:A].mean())
    print(nCr(d_eq_cnt, A - d_lq_cnt))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import itertools

N, A, B = list(map(int, input().split()))
V = np.array(list(map(int, input().split())))
V.sort()
V[:] = V[::-1]

def nCp(n, p):
    return(len(list(itertools.combinations(np.arange(n), p))))

d = V[A-1]
# unless all equal, we only need A
if d == V.max():
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    print(V[:A].mean())
    res = nCp(d_eq_cnt, A)
    res_sum = nCp(d_eq_cnt, A)
    for k in range(1, min(B, d_eq_cnt) + 1 - A):
        res = res * (d_eq_cnt - (A+k-1)) // (A+k)
        res_sum += res
    print(res_sum)
    
    
else:
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    d_lq_cnt = np.count_nonzero(V > d)
    print(V[:A].mean())
    print(nCp(d_eq_cnt, A - d_lq_cnt))



Fixed submission:
import numpy as np

N, A, B = list(map(int, input().split()))
V = np.array(list(map(int, input().split())))
V.sort()
V[:] = V[::-1]

def fac(n):
    return 1 if n<=1 else n*fac(n-1)
        
def nCr(n, r):
    return fac(n) // fac(n-r) // fac(r)

d = V[A-1]
# unless all equal, we only need A
if d == V.max():
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    res = nCr(d_eq_cnt, A)
    res_sum = res
    for k in range(1, min(B, d_eq_cnt) + 1 - A):
        res = res * (d_eq_cnt - (A+k-1)) // (A+k)
        res_sum += res
    print(V[:A].mean())
    print(res_sum)
    
    
else:
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    d_lq_cnt = np.count_nonzero(V > d)
    print(V[:A].mean())
    print(nCr(d_eq_cnt, A - d_lq_cnt))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import itertools

N, A, B = list(map(int, input().split()))
V = np.array(list(map(int, input().split())))
V.sort()
V[:] = V[::-1]

def nCp(n, p):
    return(len(list(itertools.combinations(np.arange(n), p))))

d = V[A-1]
# unless all equal, we only need A
if d == V.max():
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    print(V[:A].mean())
    print(sum([nCp(d_eq_cnt, k) for k in range(A, min(B,d_eq_cnt)+1)]))
else:
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    d_lq_cnt = np.count_nonzero(V > d)
    print(V[:A].mean())
    print(nCp(d_eq_cnt, A - d_lq_cnt))



Fixed submission:
import numpy as np

N, A, B = list(map(int, input().split()))
V = np.array(list(map(int, input().split())))
V.sort()
V[:] = V[::-1]

def fac(n):
    return 1 if n<=1 else n*fac(n-1)
        
def nCr(n, r):
    return fac(n) // fac(n-r) // fac(r)

d = V[A-1]
# unless all equal, we only need A
if d == V.max():
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    res = nCr(d_eq_cnt, A)
    res_sum = res
    for k in range(1, min(B, d_eq_cnt) + 1 - A):
        res = res * (d_eq_cnt - (A+k-1)) // (A+k)
        res_sum += res
    print(V[:A].mean())
    print(res_sum)
    
    
else:
    # count how many d
    d_eq_cnt = np.count_nonzero(V == d)
    d_lq_cnt = np.count_nonzero(V > d)
    print(V[:A].mean())
    print(nCr(d_eq_cnt, A - d_lq_cnt))