Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

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

a = A - 1
top = V[0]
ans = 0

if top == V[a]:
  d = 1
  for i in range(a,N):
    if V[i] != top:
      b = i
      break
  if A == B:
    n = reduce(mul,[t for t in range(A,b + 1)])
    d = reduce(mul,[k for k in range(1,A + 1)])
    ans = n / d
  else:
    for i in range(1,b + 1):
      n = 1
      d *= i
      if i < A:
        continue
      for j in range(b,b - i,-1):
        n *= j
        print(n,d)
      n /= d
      ans += n
  print(float(top))
  print(int(ans))
else:
  sect = V[:A]
  ave = sum(sect) / A
  print(ave)
  con = V.count(V[a])
  ind = V.index(V[a])
  i = a - ind + 1
  if a == ind:
    print(con)
  else:
    n = reduce(mul,[t for t in range(con - i + 1,con + 1)]) 
    d = reduce(mul,[k for k in range(1,i + 1)])
    print(int(n/d))



Fixed submission:
import collections
from operator import mul
from functools import reduce

N,A,B = map(int, input().split())
V = list(map(int, input().split()))
VV = sorted(V,reverse = True)
ave = 0
ml = []

for i in range(A,B + 1):
  avet = sum(VV[:i]) / i
  if avet >= ave:
    ml.append(i)
    ave = max(ave,avet)
  else:
    break

dic = collections.Counter(V)
#print(dic,ml)

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

res = 0

for j in ml:
  r = dic[VV[j - 1]]
  rr = VV.index(VV[j - 1])
  res += cmb(r,j - rr)

print(ave)
print(res)

Buggy python submission (verdict: Runtime Error):
import itertools
import collections
from operator import mul
from functools import reduce

N,A,B = map(int,input().split())
V = sorted(list(map(int,input().split())),reverse = True)
a = A - 1
top = V[0]
ans = 0

if top == V[a]:
  d = 1
  for i in range(1,B + 1):
    if V[i] != top:
      B = i
      break
  for i in range(1,B + 1):
    n = 1
    d *= i
    
    if i < A:
      continue
    for j in range(B,B - i,-1):
      n *= j
    n /= d
    ans += n
  print(float(top))
  print(int(ans))
else:
  sect = V[:A]
  ave = sum(sect) / A
  print(ave)
  con = V.count(V[a])
  ind = V.index(V[a])
  i = a - ind + 1
  if a == ind:
    print(con)
  else:
    n = reduce(mul,[t for t in range(con - i + 1,con + 1)]) 
    d = reduce(mul,[k for k in range(1,i + 1)])
    print(int(n/d))



Fixed submission:
import collections
from operator import mul
from functools import reduce

N,A,B = map(int, input().split())
V = list(map(int, input().split()))
VV = sorted(V,reverse = True)
ave = 0
ml = []

for i in range(A,B + 1):
  avet = sum(VV[:i]) / i
  if avet >= ave:
    ml.append(i)
    ave = max(ave,avet)
  else:
    break

dic = collections.Counter(V)
#print(dic,ml)

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

res = 0

for j in ml:
  r = dic[VV[j - 1]]
  rr = VV.index(VV[j - 1])
  res += cmb(r,j - rr)

print(ave)
print(res)

Buggy python submission (verdict: Runtime Error):
import itertools
import collections
from operator import mul
from functools import reduce

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

ans = 0

if len(set(V)) == 1:
  d = reduce(mul,[i for i in range(1,A)])
  for i in range(A,B + 1):
    n = 1
    d *= i
    for j in range(B,B - i,-1):
      n *= j
    n /= d
    ans += n
  print(float(V[0]))
  print(int(ans))
else:
  a = A - 1
  sect = V[:A]
  ave = sum(sect) / A
  print(ave)
  con = V.count(V[a])
  ind = V.index(V[a])
  i = a - ind + 1
  if a == ind:
    print(con)
  else:
    n = reduce(mul,[t for t in range(con - i + 1,con + 1)]) 
    d = reduce(mul,[k for k in range(1,i + 1)])
    print(int(n/d))

Fixed submission:
import collections
from operator import mul
from functools import reduce

N,A,B = map(int, input().split())
V = list(map(int, input().split()))
VV = sorted(V,reverse = True)
ave = 0
ml = []

for i in range(A,B + 1):
  avet = sum(VV[:i]) / i
  if avet >= ave:
    ml.append(i)
    ave = max(ave,avet)
  else:
    break

dic = collections.Counter(V)
#print(dic,ml)

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

res = 0

for j in ml:
  r = dic[VV[j - 1]]
  rr = VV.index(VV[j - 1])
  res += cmb(r,j - rr)

print(ave)
print(res)

Buggy python submission (verdict: Runtime Error):
import itertools
import collections
from operator import mul
from functools import reduce

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

total = 0
pattern = 0

if len(set(V)) == 1:
  for i in range(1,B):
    c = 1
    for j in range(B,B - i,-1):
      c *= j
    d = [t for t in range(1,i + 1)]
    d = reduce(mul,d)
    c /= d
    pattern += c
  a = A - 1
  print(float(V[0]))
  print(int(pattern) + 1)
else:
  a = A - 1
  sect = V[:A]
  total += sum(sect) / A
  print(total)
  con = V.count(V[a])
  ind = V.index(V[a])
  C = con - ind
  if con == ind:
    print(1)
  else:
    numer = reduce(mul,[k for k in range(C,con + 1)]) 
    denom = reduce(mul,[k for k in range(1,C + 1)])
    print(int(numer/denom))

Fixed submission:
import collections
from operator import mul
from functools import reduce

N,A,B = map(int, input().split())
V = list(map(int, input().split()))
VV = sorted(V,reverse = True)
ave = 0
ml = []

for i in range(A,B + 1):
  avet = sum(VV[:i]) / i
  if avet >= ave:
    ml.append(i)
    ave = max(ave,avet)
  else:
    break

dic = collections.Counter(V)
#print(dic,ml)

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

res = 0

for j in ml:
  r = dic[VV[j - 1]]
  rr = VV.index(VV[j - 1])
  res += cmb(r,j - rr)

print(ave)
print(res)