Buggy python submission (verdict: Runtime Error):
from scipy.special import comb
N,A,B = map(int,input().split())
v = list(map(int,input().split()))
v.sort(reverse=True)

ans = 0
if v[A-1] == v[0]:
    mean = v[0]
    count = 0
    for i in range(N):
        if v[i] == v[0]:
            count += 1
    for i in range(A,min(B,count)+1):
        ans += comb(count,i,exact=True)
else:
    mean = sum(v[:A])/A
    count = 0
    j = N
    for i in range(N):
        if v[i] == v[A-1]:
            j = min(i,j)
            count += 1
    ans = comb(count,A-j,exact=True)
print(mean)
print(ans)

Fixed submission:
def fact(n):
    if n == 0:
        return 1
    else:
        return n*fact(n-1)
def conb(n,r):
    return fact(n)//(fact(r)*fact(n-r))

N,A,B = map(int,input().split())
v = list(map(int,input().split()))
v.sort()
v.reverse()
d_all = {}
for i in range(N):
    if v[i] not in d_all:
        d_all[v[i]] = 0
    d_all[v[i]] += 1
import numpy as np
avg = np.cumsum(np.array(v))
avg = [0]*N
avg[0]=v[0]
for i in range(N-1):
    avg[i+1]=avg[i]+v[i+1]
for i in range(N):
    avg[i]=avg[i]/(i+1)
    
avg = avg[A-1:B]
ans = max(avg)
print(ans)
avg=np.array(avg)
indices = np.where(avg==ans)[0]
ans = 0
for index in indices:
    d_use = {}
    use = A + index
    v_use = v[:use]
    choose=1
    for item in v_use:
        if item not in d_use:
            d_use[item] = 0
        d_use[item] += 1
    for item in d_use:
        choose *= conb(d_all[item],d_use[item])
    ans += choose

print(ans)

Buggy python submission (verdict: Runtime Error):
def fact(n):
    if n == 0:
        return 1
    else:
        return n*fact(n-1)
def conb(n,r):
    return fact(n)//(fact(r)*fact(n-r))

N,A,B = map(int,input().split())
v = list(map(int,input().split()))
v.sort()
v.reverse()
d_all = {}
for i in range(N):
    if v[i] not in d_all:
        d_all[v[i]] = 0
    d_all[v[i]] += 1
import numpy as np
avg = np.cumsum(np.array(v))
for i in range(N):
    avg[i]=int(avg[i])/(i+1)
avg = avg[A-1:B]
ans = max(avg)
print(ans)
indices = np.where(avg==ans)[0]
ans = 0
for index in indices:
    d_use = {}
    use = A + index
    v_use = v[:use]
    choose=1
    for item in v_use:
        if item not in d_use:
            d_use[item] = 0
        d_use[item] += 1
    for item in d_use:
        choose *= conv(d_all[item],d_use[item])
    ans += choose

print(ans)

Fixed submission:
def fact(n):
    if n == 0:
        return 1
    else:
        return n*fact(n-1)
def conb(n,r):
    return fact(n)//(fact(r)*fact(n-r))

N,A,B = map(int,input().split())
v = list(map(int,input().split()))
v.sort()
v.reverse()
d_all = {}
for i in range(N):
    if v[i] not in d_all:
        d_all[v[i]] = 0
    d_all[v[i]] += 1
import numpy as np
avg = np.cumsum(np.array(v))
avg = [0]*N
avg[0]=v[0]
for i in range(N-1):
    avg[i+1]=avg[i]+v[i+1]
for i in range(N):
    avg[i]=avg[i]/(i+1)
    
avg = avg[A-1:B]
ans = max(avg)
print(ans)
avg=np.array(avg)
indices = np.where(avg==ans)[0]
ans = 0
for index in indices:
    d_use = {}
    use = A + index
    v_use = v[:use]
    choose=1
    for item in v_use:
        if item not in d_use:
            d_use[item] = 0
        d_use[item] += 1
    for item in d_use:
        choose *= conb(d_all[item],d_use[item])
    ans += choose

print(ans)