Buggy python submission (verdict: Time Limit Exceeded):
def combi(n, r):
  if r == 0 or n == r:
    return 1
  return combi(n-1, r-1) + combi(n-1, r)

n, a, b = map(int, input().split())
items = sorted(map(int, input().split()), reverse=True)
max_ave_list = items[:a]
print(sum(max_ave_list)/len(max_ave_list))

m = max_ave_list.count(max_ave_list[-1])
l = items.count(max_ave_list[-1])
if l == m:
  print(1)
elif max_ave_list[0] != max_ave_list[-1]:
  print(combi(l, m))
else:
  print(sum(combi(l, k) for k in range(m, min(b, l) + 1)))

Fixed submission:
import sys

sys.setrecursionlimit(10000)


def memoize(f):
    cache = {}

    def func(*args):
        if args not in cache:
            cache[args] = f(*args)
        return cache[args]

    return func


@memoize



def combi(n, r):
  if r == 0 or n == r:
    return 1
  return combi(n-1, r-1) + combi(n-1, r)

n, a, b = map(int, input().split())
items = sorted(map(int, input().split()), reverse=True)
max_ave_list = items[:a]
print(sum(max_ave_list)/len(max_ave_list))

m = max_ave_list.count(max_ave_list[-1])
l = items.count(max_ave_list[-1])
if l == m:
  print(1)
elif max_ave_list[0] != max_ave_list[-1]:
  print(combi(l, m))
else:
  print(sum(combi(l, k) for k in range(m, min(b, l) + 1)))

Buggy python submission (verdict: Runtime Error):
def combi(n, r):
  if r == 0 or n == r:
    return 1
  return combi(n-1, r-1) + combi(n-1, r)

n, a, b = map(int, input().split())
items = sorted(map(int, input().split()), reverse=True)
max_ave_list = imtes[:a]
print(sum(max_ave_list)/len(max_ave_list))

m = max_ave_list.count(max_ave_list[-1])
l = items.count(max_ave_list[-1])
if l == m:
  print(1)
elif max_ave_list[0] != max_ave_list[-1]:
  print(combi(l, m))
else:
  print(sum(combi(l, k) for k in range(m, min(b, l) + 1)))

Fixed submission:
import sys

sys.setrecursionlimit(10000)


def memoize(f):
    cache = {}

    def func(*args):
        if args not in cache:
            cache[args] = f(*args)
        return cache[args]

    return func


@memoize



def combi(n, r):
  if r == 0 or n == r:
    return 1
  return combi(n-1, r-1) + combi(n-1, r)

n, a, b = map(int, input().split())
items = sorted(map(int, input().split()), reverse=True)
max_ave_list = items[:a]
print(sum(max_ave_list)/len(max_ave_list))

m = max_ave_list.count(max_ave_list[-1])
l = items.count(max_ave_list[-1])
if l == m:
  print(1)
elif max_ave_list[0] != max_ave_list[-1]:
  print(combi(l, m))
else:
  print(sum(combi(l, k) for k in range(m, min(b, l) + 1)))

Buggy python submission (verdict: Runtime Error):

def f1(i):
  if(i == 1):
    return 1
  return i*f1(i-1)

def f2(a, b):
  print(a, b)
  return f1(a)/(f1(b)*f1(a-b))
a = [int(i) for i in input().split()]
v = [int(i) for i in input().split()]

sorted_v = sorted(v)

b = []
c = {}

sum = 0
count = 0
for i in range(a[1]):
  b.append(sorted_v[a[0] - i -1])
  if(not sorted_v[a[0] - i -1] in c):
    c[sorted_v[a[0] - i -1]] = 1
  else:
    c[sorted_v[a[0] - i -1]] += 1
  sum += sorted_v[a[0] - i -1]
  count += 1

pattern = 1
memory = count

max = max(b)

if(max == sorted_v[a[0] - memory -1] and count == c[sorted_v[a[0] - memory -1]] ):
   tmp = c[max]
   while(max == sorted_v[a[0] - memory -1]):
     c[max] += 1
     memory += 1
     if(a[0] - memory -1 == -1):
        break
   if(c[max] > a[2]):
      pattern = 0
      pattern = f2(c[max], a[2])
   else:
      pattern = 1
   for i in range(a[1], min(c[max], a[2])):
     pattern += f2(c[max], i)


else:
    if(sorted_v[a[0] - memory -1] == b[-1]):
      e = c[sorted_v[a[0] - memory -1]]
      while(sorted_v[a[0] - memory -1] == b[-1]):
        c[sorted_v[a[0] - memory -1]] += 1
        memory += 1
        if(a[0] - memory -1 == -1):
          memory -= 1
          break
      pattern = f2(c[sorted_v[a[0] - memory -1]], e)
    else:
      pattern = 1


print("{0:.7f}".format(sum/count))
print(pattern)

Fixed submission:
import sys

sys.setrecursionlimit(10000)


def memoize(f):
    cache = {}

    def func(*args):
        if args not in cache:
            cache[args] = f(*args)
        return cache[args]

    return func


@memoize



def combi(n, r):
  if r == 0 or n == r:
    return 1
  return combi(n-1, r-1) + combi(n-1, r)

n, a, b = map(int, input().split())
items = sorted(map(int, input().split()), reverse=True)
max_ave_list = items[:a]
print(sum(max_ave_list)/len(max_ave_list))

m = max_ave_list.count(max_ave_list[-1])
l = items.count(max_ave_list[-1])
if l == m:
  print(1)
elif max_ave_list[0] != max_ave_list[-1]:
  print(combi(l, m))
else:
  print(sum(combi(l, k) for k in range(m, min(b, l) + 1)))