Problem:
 Score : 400 points    Problem Statement You are given N items. The value of the i -th item (1 \leq i \leq N) is v_i . Your have to select at least A and at most B of these items. Under this condition, find the maximum possible arithmetic mean of the values of selected items. Additionally, find the number of ways to select items so that the mean of the values of selected items is maximized.      Constraints  1 \leq N \leq 50  1 \leq A,B \leq N  1 \leq v_i \leq 10^{15}  Each v_i is an integer.         Input The input is given from Standard Input in the following format:  N  A  B  v_1  v_2 ... v_N       Output Print two lines. The first line should contain the maximum possible arithmetic mean of the values of selected items. The output should be considered correct if the absolute or relative error is at most 10^{-6} . The second line should contain the number of ways to select items so that the mean of the values of selected items is maximized.        Sample Input 1 5 2 2
1 2 3 4 5      Sample Output 1 4.500000
1  The mean of the values of selected items will be maximized when selecting the fourth and fifth items. Hence, the first line of the output should contain 4.5 . There is no other way to select items so that the mean of the values will be 4.5 , and thus the second line of the output should contain 1 .       Sample Input 2 4 2 3
10 20 10 10      Sample Output 2 15.000000
3  There can be multiple ways to select items so that the mean of the values will be maximized.       Sample Input 3 5 1 5
1000000000000000 999999999999999 999999999999998 999999999999997 999999999999996      Sample Output 3 1000000000000000.000000
1

Solution (Python):
N,A,B = map(int, input().split())
V = [int(v) for v in input().split()]

V.sort(reverse=True)
s = 0
for i in range(A):
    s += V[i]
    idx = i
    
av = s/A
for i in range(A, B):
    if V[i] < av:
        break
    s += V[i]
    av = s/(i+1)
    idx = i
    
cnt_up = 0
cnt_same = 0
for i in range(N):
    if V[i] > V[idx]:
        cnt_up += 1
    elif V[i] == V[idx]:
        cnt_same += 1
        
print(av)

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


if cnt_up > 0:
    ans = cmb(cnt_same, A-cnt_up)
else:
    ans = 0
    for i in range(A, B+1):
        if cnt_same < i:
            break
        ans += cmb(cnt_same, i)
        
print(ans)

Solution (Python):
def comb(n,r):
    if n < r:
        return 0
    si,bo = 1,1
    for i in range(n):
        si *= i+1
    for i in range(r):
        bo *= i+1
    for i in range(n-r):
        bo *= i+1
    return si//bo

N,A,B = map(int,input().split())
v = list(map(int,input().split()))
v.sort(reverse=True)

print(sum(v[:A])/A)
n = 0
r = 0
for i in range(A):
    if v[i] == v[A-1]:
        r += 1
        n += 1
for i in range(A,N):
    if v[i] == v[A-1]:
        n += 1
ans = 0
if v[0] != v[A-1]:
    print(comb(n,r))
    exit()
for _ in range(A,B+1):
    ans += comb(n,r)
    r += 1
print(ans)

Solution (Python):
import math
def comb(n, k):
    return math.factorial(n) // (math.factorial(n - k) * math.factorial(k))

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

v.sort(reverse=True)
max_avg = sum(v[:a]) / a
min_v = min(v[:a])

ans = 0
for i in range(a, b+1):
    if max_avg != sum(v[:i]) / i: break
    cnt1 = v[:i].count(min_v)
    cnt2 = v.count(min_v)
    ans += comb(cnt2, cnt1)

print(max_avg)
print(int(ans))

Solution (Python):
from math import factorial

def nCr(n, r) :
    return factorial(n)//(factorial(r)*factorial(n-r))


n,a,b = map(int,input().split())
V = sorted(list(map(int,input().split())), reverse=True)

L1, L2 = V[:a], V[a:]

ans1 = sum(L1)/a

minv = min(L1)
x = L1.count(minv)
y = L2.count(minv)

ans2 = 0

if x == a :
    for i in range(x, x+min(y, b-a)+1) :
        ans2 += nCr(x+y, i)
else :
    ans2 = nCr(x+y, x)

print(ans1)
print(ans2)

Solution (Python):

import sys
input = sys.stdin.readline


N,A,B = map(int,input().split())
V = list(map(int,input().split()))

V.sort(reverse=True)

ans1 = sum(V[:A])/A

ans2 = 1
cnt = V.count(V[0])
if cnt > A:
    ans2 = 0
    for i in range(A,min(B,cnt)+1):
        tmp = 1
        for j in range(i):
            tmp *= cnt-j
            tmp //= j+1
        ans2 += tmp
else:
    cnt1 = V.count(V[A-1])
    cnt2 = V[:A].count(V[A-1])
    if cnt1 > 1:
        for i in range(cnt2):
            ans2 *= cnt1-i
            ans2 //= i+1

print(ans1)
print(ans2)

Solution (Python):
import math
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
x.reverse()

j=a+1
moto=0
h=0
d=x[a-1]
asd=0
l=x.count(d)
for i in range(a):
  moto+=x[i]
  if x[i]==x[a-1]:
    h+=1
print(moto/a)
if moto/a==x[a-1]:
  for i in range(a,b+1):
    if l-i>=0:
      asd+=math.factorial(l)//(math.factorial(l-i)*math.factorial(i))
  print(asd)
else:
  print(math.factorial(l)//(math.factorial(l-h)*math.factorial(h)))

Solution (Python):
from operator import mul
from functools import reduce
def comb2(n,r):
    r = min(n - r, r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

def examD():
    N, A, B = LI()
    v = LI(); v.sort(reverse = True)
    ans = sum(v[:A])/A
    d = defaultdict(int)
    for s in v:
        d[s] +=1

    cur = A
    for i in v:
        if cur<=d[i]:
            break
        else:
            cur -=d[i]
    if i!=max(v):
        ansC = comb2(d[i],cur)
    else:
        ansC = 0
        for j in range(A,min(B,d[i])+1):
            ansC += comb2(d[i],j)
    print(ans)
    print(ansC)


import sys
import copy
import bisect
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD()

Solution (Python):
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n,a,b=map(int,input().split())
v=list(map(int,input().split()))
v.sort(reverse=True)
ans=0
for i in range(a):
    ans+=v[i]
ans/=a
print(ans)
if v[0]==v[a-1]:
    count=0
    for i in range(n):
        if v[i]==v[0]:
            count+=1
    cnt=0
    for i in range(a,min(b,count)+1):
        cnt+=cmb(count,i)
    print(cnt)
else:
    count=0
    for i in range(n):
        if v[i]==v[a-1]:
            count+=1
    for i in range(n):
        if v[i]==v[a-1]:
            l=i
            break
    cnt=cmb(count,a-l)
    print(cnt)

Solution (Python):
from math import factorial as fact
def comb(n, r):
  denom = fact(r)*fact(n-r)
  return fact(n)//denom

n = list(map(int, input().split()))
l = list(map(int, input().split()))

l = sorted(l)

summ = 0

for i in range(n[1]):
  summ+=l[len(l)-1-i]

avg = float(summ)/n[1]
last =  l[len(l)-n[1]]
lasts = l.count(last)
more = sum(1 for i in l if i>last)
print(avg)
if more!=0:
  answer = comb(lasts, n[1]-more)
  print(answer)
else:
  b= min(lasts, n[2])
  answer = 0
  for i in range(n[1], b+1):
    answer += comb(lasts, i)
  print(answer)

Solution (Python):
import math
from collections import Counter

def comb(n,r):
    f=math.factorial
    return f(n)//(f(r)*f(n-r))

N,A,B=list(map(int,input().split()))
v=sorted(list(map(int,input().split())),reverse=True) 

m=sum(v[:A])/A 

c=Counter(v[:A]) 

a=v[A-1]

n=v.count(a) 
r=c[a] 


ans=comb(n,r)



if v[0]==v[A]:
    for i in range(r+1,min(r+(B-A)+1,n+1)):
        ans+=comb(n,i)

print(m)
print(ans)

Solution (Python):
nCr = {}
def cmb(n, r):
    if n < r:
        return 0
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
  
n, a, b = [int(_) for _ in input().split()]
values = [int(v) for v in input().split()]
values.sort(reverse=True)
maximum_mean = sum(values[:a]) / a
print(maximum_mean)

min_value = values[:a][-1]
accepted = values[:a].count(min_value)
full = values.count(min_value)

if min_value == maximum_mean:
    ans = 0
    for r in range(a, b+1):
        ans += cmb(full, r)
else:
    ans = cmb(full, accepted)

print(ans)

Solution (Python):
from statistics import mean

nCr = {}
def cmb(n, r):
    if n < r:
        return 0
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
  
n, a, b = [int(_) for _ in input().split()]
values = [int(v) for v in input().split()]
values.sort(reverse=True)
maximum_mean = mean(values[:a])
print(maximum_mean)

min_value = values[:a][-1]
accepted = values[:a].count(min_value)
full = values.count(min_value)

if min_value == maximum_mean:
    ans = 0
    for r in range(a, b+1):
        ans += cmb(full, r)
else:
    ans = cmb(full, accepted)

print(ans)

Solution (Python):
from statistics import mean
n, a, b = [int(_) for _ in input().split()]
values = [int(v) for v in input().split()]
values.sort(reverse=True)
maximum_mean = mean(values[:a])
print(maximum_mean)

min_value = values[:a][-1]
accepted = values[:a].count(min_value)
full = values.count(min_value)























nCr = {}
def cmb(n, r):
    if n < r:
        return 0
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]



if min_value == maximum_mean:
    ans = 0
    for r in range(a, b+1):
        ans += cmb(full, r)
else:
    ans = cmb(full, accepted)

print(ans)

Solution (Python):
import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N, A, B = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse = True)
d = dd(int)
sd = dd(int)
res = 1
nCr = {}
def cmb(n, r):
  global nCr
  if r == 0 or r == n: return 1
  if r == 1: return n
  if (n,r) in nCr: return nCr[(n,r)]
  nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
  return nCr[(n,r)]

for i in range(N):
  d[v[i]] += 1
r = sum(v[: A])
s = v[: A]
sdsum = 0
for t in s:
  sd[t] += 1
  sdsum += 1
kss = sorted(sd.keys())

f = 0
j = -1
for k in range(A, B + 1):
  j += 1
  t = 1
  for i in range(len(kss)):
    a = kss[i]
    if d[a] < sd[a] + j:
      f = 1
      break
    t *= cmb(d[a], sd[a] + j)
    
  if f:
    break
  res += t
print(r / A)
print(res - 1)

Solution (Python):
from math import factorial


def comb(n, r):
    if n < r:
        return 0
    return factorial(n) // (factorial(r) * factorial(n - r))


N, A, B = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
cnt = 0
cnt2 = 0
for i in range(N):
    if v[i] > v[A]:
        cnt += 1
    if v[i] == v[A]:
        cnt2 += 1
avg_max = sum(v[:A]) / A
print(avg_max)
ans = 0
if v[0] != v[A]:
    print(comb(cnt2, A-cnt))
else:
    for i in range(A, min(B+1, cnt2 + 1)):
        ans += comb(cnt2, i)
    print(ans)

Solution (Python):
from math import factorial
N,A,B = map(int,input().split())
V = sorted(list(map(int,input().split())),reverse=True)
C = {}
for i in range(N):
    if V[i] not in C:
        C[V[i]] = 0
    C[V[i]] += 1
v = V[A-1]
avg = sum(V[:A])/A
print(avg)
cnt = V[:A].count(v)
if cnt<A:
    tot = factorial(C[v])//factorial(cnt)//factorial(C[v]-cnt)
else:
    tot = 0
    for j in range(A,min(B,C[v])+1):
        tot += factorial(C[v])//factorial(j)//factorial(C[v]-j)
print(tot)

Solution (Python):
n,a,b=map(int,input().split())

import math
import functools
 
def cmb(n,r):
    f = math.factorial
    return int(f(n) // f(r) // f(n-r))
 
v=list(map(int,input().split()))
v.sort(reverse=True)
print(sum(v[:a])/a)
x,y=v.count(v[a-1]), v[:a].count(v[a-1])
if v[0]==v[a-1]:
    ans=sum( cmb(x,i)    for i in range(a,min(b,x)+1))

else:
    ans=cmb(x,y)
print(ans)

Solution (Python):
from collections import defaultdict, Counter

def comb(n: int, k: int) -> int:
    ans = 1
    for i in range(1, k+1):
        ans *= n - i + 1
        ans //= i
    return ans

n, a, b = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
c = Counter(v)

cand = defaultdict(int)
for m in range(a, b+1):
    s = sum(v[:m])
    k = len(list(filter(lambda x: x == v[m-1], v[:m])))
    l = c[v[m-1]]

    cand[s / m] += comb(l, k)


ans1 = max(cand.keys())
print(ans1)
print(cand[ans1])

Solution (Python):
import math, collections
n, a, b = map(int, input().split())
list_v = [int(v) for v in input().split()]
list_v.sort(reverse=True)
list_ave = []
list_num = []
for i in range(a, b+1):
  temp_ave = sum(list_v[:i]) / len(list_v[:i])
  list_ave.append(temp_ave)
  list_num.append(i)
max_ave = max(list_ave)
print(max_ave)

list_target = [list_num[i] for i, v in enumerate(list_ave) if v == max_ave]
count = collections.Counter(list_v)
sort_count = sorted(count.items(), reverse=True)
res = 0
for one_num in list_target:
  r = one_num
  for o in sort_count:
    temp = r - o[1]
    if temp <= 0:
      res += math.factorial(o[1]) // (math.factorial(o[1]-r) * math.factorial(r))
      break
    else:
      r -= o[1]
print(res)

Solution (Python):
def combinations(N):
    comb = [[0] * (N + 1) for _ in range(N + 1)]
    comb[0][0] = 1
    for i in range(1, N + 1):
        for j in range(i + 1):
            comb[i][j] += comb[i - 1][j]
            if j > 0:
                comb[i][j] += comb[i - 1][j - 1]
    return comb


nCk = combinations(60)

N, A, B, *V = map(int, open(0).read().split())

V.sort(reverse=True)

num = V.count(V[A - 1])

ans = 0
if V[0] == V[A - 1]:
    ans = sum(nCk[num][A:B + 1])
else:
    a = V[:A].count(V[A - 1])
    ans = nCk[num][a]

ave = sum(V[:A]) / A

print("{:.9f}".format(ave))
print(ans)

Solution (Python):
def combinations(N):
    comb = [[0] * (N + 1) for _ in range(N + 1)]
    comb[0][0] = 1
    for i in range(1, N + 1):
        for j in range(i + 1):
            comb[i][j] += comb[i - 1][j]
            if j > 0:
                comb[i][j] += comb[i - 1][j - 1]
    return comb


nCk = combinations(60)

N, A, B, *V = map(int, open(0).read().split())

V.sort(reverse=True)

num = V.count(V[A - 1])

ans = 0
if V[0] == V[A - 1]:
    for i in range(A, B + 1):
        ans += nCk[num][i]
else:
    a = V[:A].count(V[A - 1])
    ans = nCk[num][a]

ave = sum(V[:A]) / A

print("{:.9f}".format(ave))
print(ans)

Solution (Python):
import sys
stdin = sys.stdin

def na(): return map(int,stdin.readline().split())

def ns(): return stdin.readline().strip()

n,a,b=na()
v=list(na())
v.sort()
tot=0
last=0
for i in range(a):
    tot+=v[-(i+1)]
    last=v[-(i+1)]

com=[]
q=100
for i in range(q):
    com.append([0]*q)

for i in range(q):
    com[i][0]=1
    for j in range(1,q):
        com[i][j]=com[i-1][j-1]+com[i-1][j]

print("{:.9f}".format(tot/a))
lct=0
large=0
for w in v:
    if w>last:large+=1
    if w==last:lct+=1
ret=0
if large==0:
    for i  in range(a,b+1):
        if 0 <= i-large <= lct:
            ret+=com[lct][i-large]
else :
    ret=com[lct][a-large]
print(ret)

Solution (Python):
n,a,b=map(int,input().split())
u=sorted(list(map(int,input().split())))[::-1]
v=sum(u[:a])/a
print(v)
f=[1]
for i in range(50):f+=[f[-1]*(i+1)]
x=u.count(u[a-1])
if u[0]==u[a-1]:print(sum(f[x]//(f[x-i]*f[i])for i in range(a,b+1)))
else:y=u[:a].count(u[a-1]);print(f[x]//(f[x-y]*f[y]))

Solution (Python):
import math

def nCr(n,r):
    return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))

N,A,B = map(int,input().split())

v = list(map(int,input().split()))

minlis = []
maxlis = []

v.sort()

for i in range(N):

    if i < N-A:
        minlis.append(v[i])

    else:
        maxlis.append(v[i])


ave = sum(maxlis) / A
print (ave)


x = min(maxlis)

xinmax = 0
xinmin = 0

for i in minlis:
    if i == x:
        xinmin += 1

for i in maxlis:
    if i == x:
        xinmax += 1

if ave == x and xinmin != 0:

    ans = 0

    for i in range(xinmax + xinmin - A + 1):

        i += A
        if i > B:
            break

        ans += nCr(xinmin+xinmax,i)

    print (ans)

else:

    print (nCr(xinmin+xinmax,xinmax))

Solution (Python):
from math import factorial


def comb(n, r):
    if n < r:
        return 0
    return factorial(n) // (factorial(r) * factorial(n - r))


N, A, B = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
cnt = 0
cnt2 = 0
for i in range(N):
    if v[i] > v[A]:
        cnt += 1
    if v[i] == v[A]:
        cnt2 += 1
avg_max = sum(v[:A]) / A
print(avg_max)
ans = 0
if v[0] != v[A]:
    print(comb(cnt2, A-cnt))
else:
    for i in range(A, min(B+1, cnt2 + 1)):
        ans += comb(cnt2, i)
    print(ans)

Solution (Python):
n, a, b = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)


print(sum(l[:a]) / a)
l_w = l[:a]
ans = 0
nCr = {}


def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n, r) in nCr: return nCr[(n, r)]
    nCr[(n, r)] = cmb(n - 1, r) + cmb(n - 1, r - 1)
    return nCr[(n, r)]


if l[0] == l[-1]:
    for i in range(a, b + 1):
        ans += cmb(b, i)
elif l_w[0] == l_w[-1]:
    for i in range(a, min(b + 1,l.count(l_w[-1])+1)):
        ans += cmb(l.count(l_w[-1]), i)
else:
    ans = cmb(l.count(l_w[-1]), l_w.count(l_w[-1]))
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    N, A, B = map(int, input().split())
    v = sorted(list(map(int, input().split())), reverse=True)

    kai = [1] * (N+1)

    for i in range(1, N+1):
        kai[i] = i * kai[i-1]

    ans1 = sum(v[:A]) / A

    dic = {}
    for t in v:
        if t in dic:
            dic[t] += 1
        else:
            dic[t] = 1
    
    dic = sorted(dic.items(), reverse=True)
    
    tmp = 0
    for i in range(N):
        tmp += dic[i][1]
        if tmp >= A:
            ind = i
            must = A - (tmp - dic[i][1])
            max_ = min(B, tmp) - (tmp - dic[i][1])
            break
    n = dic[ind][1]
    if ind == 0:
        ans2 = 0
        
        for i in range(A, max_+1):
            ans2 += (kai[n] // kai[n - i]) // kai[i]
    else:
        
        ans2 = (kai[n] // kai[n - must]) // kai[must]
    
    print(ans1)
    print(ans2)

if __name__ == "__main__":
    main()

Solution (Python):
from math import factorial

def getlist():
	return list(map(int, input().split()))

N, A, B = getlist()
v = sorted(getlist())

ans1 = 0
for i in range(A):
	ans1 += v[-1 - i]
ans1 = ans1 / A
print(ans1)

if v[-1] != v[- A]:
	i = 0
	while True:
		if v[- A + i] == v[- A]:
			i += 1
		else:
			 break
	ans2 = factorial(v.count(v[- A])) // factorial(i) // factorial(v.count(v[- A]) - i)

else:
	ans2 = 0
	n = v.count(v[-1])
	for i in range(A, B + 1):
		if v[- i] == v[- A]:
			ans2 += factorial(n) // factorial(n - i) // factorial(i)

		else:
			 break

print(int(ans2))

Solution (Python):
from math import factorial


def resolve():
    n, a, b = map(int, input().split())
    v = list(map(int, input().split()))
    v.sort(reverse=True)
    max_ave = sum(v[:a]) / a
    ath = v[a - 1]
    num_ath = v.count(ath)
    large = len([vi for vi in v if vi > ath])
    if v[0] == ath:
        ans = 0
        for i in range(a - large, min(b - large, num_ath) + 1):
            ans += combi(num_ath, i)
    else:
        ans = combi(num_ath, a - large)
    print(max_ave)
    print(ans)


def combi(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))


if __name__ == "__main__":
    resolve()

Solution (Python):
def comb(n,m):
    ans = 1
    if n==0 or m == 0:
        return 0
    else:
        for i in range(m):
            j = n-i
            ans *= j
        for i in range(1,m+1):
            ans //= i
        return ans
    
def main():
    import sys
    input = sys.stdin.readline
    N,A,B = map(int,input().split())
    V = list(map(int,input().split()))
    
    
    V = sorted(V)[::-1]
    maxAv = sum(V[:A])/A
    maxB = A
    for i in range(A+1,B+1):
        tmp = sum(V[:i])/i
        if maxAv == tmp:
            maxB = i
    count = 0
    
    C = []
    now = V[0]
    c = 0
    for i in V:
        if now == i:
            c += 1
        else:
            C.append([now,c])
            now = i
            c = 1
    if c != 0:
      C.append([now,c])
    C = sorted(C,key=lambda a: a[0])[::-1]
    for i in range(A,maxB+1):
        pretmp = 0
        tmp = 0
        now = 0
        for j in C:
            if tmp >= i:
                break
            now = j[1]
            pretmp = tmp
            tmp += now
        count += comb(now, i-pretmp)
    
    print(maxAv)    
    print(count)
            
    
main()

Solution (Python):

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

V.sort(reverse=True)

print(sum(V[:a]) / a)

D = {}
Da = {}

for i in range(n):
    try:
        D[V[i]] += 1
    except:
        D[V[i]] = 1

for i in range(a):
    try:
        Da[V[i]] += 1
    except:
        Da[V[i]] = 1



def C(x, y):
    ans = 1
    for i in range(x, x-y, -1):
        ans *= i
    for i in range(1, y+1):
        ans //= i
    return ans



if len(set(V[:a])) > 1:
    ans = 1
    for i in set(V[:a]):
        ans *= C(D[i], Da[i])

else:
    ans = 0
    for i in range(a, b+1):
        
        ans += C(D[V[0]], i)

print(ans)

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


def comb(n, r):
    fact = 1
    for i in range(n - r + 1, n + 1):
        fact = fact * i
    divisor = 1
    for j in range(1, r + 1):
        divisor = divisor * j


    return fact // divisor



n, a, b = LI()
value = sorted(LI(), reverse=True)
m = value[a-1]
ans = 0
print(sum(value[:a]) / a)
left_cnt = value[:a].count(m)
total_cnt = value.count(m)
if left_cnt != a:
    print(comb(total_cnt, left_cnt))
else:
    for k in range(a, min(total_cnt, b) + 1):
        ans += comb(total_cnt, k)
    print(ans)

Solution (Python):
from scipy.misc import comb
N,A,B,*V=map(int,open(0).read().split());d={}
for v in V:d[v]=d.get(v,0)+1
l=sorted(d.items(),key=lambda x:x[0])[::-1]
if l[0][1]>A:
 print(l[0][0])
 print(int(sum(comb(l[0][1],i,exact=1)for i in range(A,B+1))))
else:
 s=0;c=A
 for k,v in l:
  if v<c:s+=k*v;c-=v
  else:print((s+k*c)/A);print(int(comb(v,c,exact=1)));break

Solution (Python):
N, A, B = map(int, input().split())
vs = list(map(int, input().split()))
vs.sort(reverse=True)

r = sum(vs[:A])/A
print(r)
vA = vs[A-1]
I = vs.index(vA)
C = vs.count(vA)

if I != 0:
  
  r = 1
  for i in range(1, A-I+1):
    r = r*(C-i+1)//i
  print(r)
else:
  rs = []
  for n in range(A, B+1):
    
    if n-I < 0 or n-I > C:
      continue
    r = 1
    for i in range(1, n-I+1):
      r = r*(C-i+1)//i
    
    rs.append(r)
  
  r = sum(rs)
  print(r)

Solution (Python):
from collections import Counter
N,A,B = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)

c = Counter(v)
ans_num = sum(v[:A]) / A
ans_cnt = 0

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

num = v[A-1]
num_all = c[num]
cc = Counter(v[:A])
tmp = cc[num]

for i in range(A-1, B):
    last = v[i]
    if i != A-1:
        if last != v[0]:
            break
    ans_cnt += cmb(num_all, (i+1)-(A-tmp))


print(ans_num)
print(ans_cnt)

Solution (Python):
from collections import defaultdict,Counter

def nck(n, k):
    ret = 1
    for i in range(min(n - k, k)):
        ret *= (n - i)
        ret /= (i + 1)
    return ret


def main():
    n, a, b = map(int, input().split())
    v = list(map(int, input().split()))

    v = sorted(v, reverse=True)
    d = Counter(v)
    value = 0
    t = 0
    for i in range(a):
        value += v[i]
        if i == a - 1:
            t = v[i]
    print(value / a)

    c = 0
    for i in range(n):
        if v[i] == t:
            break
        c += d[v[i]]

    ans = 0
    if d[v[0]] > a:
        for i in range(a, min(b,d[v[0]])+1):
            ans += nck(d[v[0]], i)
        print(int(ans))
    else:
        print(int(nck(d[t], a - c)))


if __name__ == '__main__':
    main()