Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
V = sorted([int(x) for x in input().split()],reverse=True)
from statistics import mean
from math import comb
maxmean = mean(V[:A])
way = 1
for i in range(1,B+1-A):
    v = V.pop(0)
    if v != maxmean:
        break
if i > 0:
    same = A + i
    for j in range(A,same):
        way += comb(same, j)
print(maxmean)
print(way)

Fixed submission:
N, A, B = map(int, input().split())
V = sorted([int(x) for x in input().split()],reverse=True)
from statistics import mean
from math import comb
maxmean = mean(V[:A])
if V[0] != V[A-1]:
    n = V.count(V[A-1])
    k = V[:A].count(V[A-1])
    way = comb(n, k)
else:
    n = V.count(V[A-1])
    way = sum(comb(n, k) for k in range(A, min(n,B)+1))
print(maxmean)
print(way)

Buggy python submission (verdict: Runtime Error):
import statistics
import math
N, A, B = map(int, input().split())
v = [int(x) for x in input().split()]
v.sort()

base = v[N-A:]
rem = v[:N-A]
mean_max = statistics.mean(base)
cnb = 0
while mean_max == statistics.mean(base):
    if len(rem) == 0: break
    same = base.count(base[0])
    extra = rem.count(base[0])
    cnb += math.factorial(same+extra)/math.factorial(same)/math.factorial(extra)
    base.append(rem[len(rem)-1])
    rem = rem.pop
print(mean_max)
print(math.floor(cnb))

Fixed submission:
N, A, B = map(int, input().split())
V = sorted([int(x) for x in input().split()],reverse=True)
from statistics import mean
from math import comb
maxmean = mean(V[:A])
if V[0] != V[A-1]:
    n = V.count(V[A-1])
    k = V[:A].count(V[A-1])
    way = comb(n, k)
else:
    n = V.count(V[A-1])
    way = sum(comb(n, k) for k in range(A, min(n,B)+1))
print(maxmean)
print(way)

Buggy python submission (verdict: Runtime Error):
import statistics
import math
N, A, B = map(int, input().split())
v = [int(x) for x in input().split()]
v.sort()

base = v[N-A:]
rem = v[:N-A]
mean_max = statistics.mean(base)
cnb = 0
while mean_max == statistics.mean(base) or not len(rem) == 0:
    same = base.count(base[0])
    extra = rem.count(base[0])
    cnb += math.factorial(same+extra)/math.factorial(same)/math.factorial(extra)
    base.append(rem[len(rem)-1])
    rem = rem.pop
print(mean_max)
print(math.floor(cnb))

Fixed submission:
N, A, B = map(int, input().split())
V = sorted([int(x) for x in input().split()],reverse=True)
from statistics import mean
from math import comb
maxmean = mean(V[:A])
if V[0] != V[A-1]:
    n = V.count(V[A-1])
    k = V[:A].count(V[A-1])
    way = comb(n, k)
else:
    n = V.count(V[A-1])
    way = sum(comb(n, k) for k in range(A, min(n,B)+1))
print(maxmean)
print(way)

Buggy python submission (verdict: Runtime Error):
import statistics
import math
N, A, B = map(int, input().split())
v = [int(x) for x in input().split()]
v.sort()

base = v[N-A:]
rem = v[:N-A]
mean_max = statistics.mean(base)
cnb = 0
while mean_max == statistics.mean(base):
    same = base.count(base[0])
    extra = rem.count(base[0])
    cnb += math.factorial(same+extra)/math.factorial(same)/math.factorial(extra)
    base.append(rem[len(rem)-1])
    rem = rem.pop
print(mean_max)
print(math.floor(cnb))

Fixed submission:
N, A, B = map(int, input().split())
V = sorted([int(x) for x in input().split()],reverse=True)
from statistics import mean
from math import comb
maxmean = mean(V[:A])
if V[0] != V[A-1]:
    n = V.count(V[A-1])
    k = V[:A].count(V[A-1])
    way = comb(n, k)
else:
    n = V.count(V[A-1])
    way = sum(comb(n, k) for k in range(A, min(n,B)+1))
print(maxmean)
print(way)