Buggy python submission (verdict: Runtime Error):
from sys import stdin
import operator as op
import numpy
import math

def combination_table(N):
	C = []
	for i in range(N+1):
		C.append([0] * (N+1))
	for i in range(N+1):
		for j in range(i+1):
			if (j==0 or j==i):
				C[i][j] = 1
			else:
				C[i][j] = C[i-1][j-1]+C[i-1][j]
	return C

if __name__ == "__main__":
	N, A, B = stdin.readline().split(" ")
	N = int(N)
	A = int(A)
	B = int(B)
	V = []
	line = stdin.readline().split(" ")
	unique_elements = dict()
	for e in line:
		V.append(int(e)) 
		if not int(e) in unique_elements:
			unique_elements[int(e)] = 1
		else:
			unique_elements[int(e)] += 1
	V.sort(reverse=True)

	C = combination_table(3)

	# find optimal selections between A and B
	optimal = [A]
	highest_avg = -1
	for i in range(A, B+1):
		avg = float(sum(V[:i])) / float(i)
		if (avg > highest_avg):
			highest_avg = avg
			optimal = [i] # reset the list
		elif (avg == highest_avg):
			if not i in optimal:
				optimal.append(i)

	total = 1
	for e in optimal:
		# unique elements and count in for optimal value
		op_elemements = dict()
		for i in range(e):
			if V[i] in op_elemements:
				op_elemements[V[i]] += 1
			else:
				op_elemements[V[i]] = 1

		# find the sum
		for key, value in op_elemements.items():
			# print (unique_elements[key], value, C[unique_elements[key]][value])
			total = total * C[unique_elements[key]][value]

	print ("{:6f}".format(highest_avg))
	print (int(total))


Fixed submission:
from sys import stdin

def combination_table(N):
	C = []
	for i in range(N+1):
		C.append([0] * (N+1))
	for i in range(N+1):
		for j in range(i+1):
			if (j==0 or j==i):
				C[i][j] = 1
			else:
				C[i][j] = C[i-1][j-1]+C[i-1][j]
	return C

if __name__ == "__main__":
	N, A, B = stdin.readline().split(" ")
	N = int(N)
	A = int(A)
	B = int(B)
	V = []
	line = stdin.readline().split(" ")
	unique_elements = dict()
	for e in line:
		V.append(int(e)) 
		if not int(e) in unique_elements:
			unique_elements[int(e)] = 1
		else:
			unique_elements[int(e)] += 1
	V.sort(reverse=True)

	C = combination_table(N)

	# find optimal selections between A and B
	a_th_val_pos = 0
	a_th_val_num = 0
	highest_avg = float(sum(V[:A])) / float(A)
	for i in range(N):
		if V[i] == V[A-1]:
			a_th_val_num += 1
			if i < A:
				a_th_val_pos += 1


	cnt = 0
	if a_th_val_pos == A:
		for i in range(A, B+1):
			cnt += C[a_th_val_num][i]
	else:
		cnt += C[a_th_val_num][a_th_val_pos]

	print ("{:6f}".format(highest_avg))
	print (cnt)

Buggy python submission (verdict: Runtime Error):
from sys import stdin
import operator as op
from functools import reduce

def nCr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom

if __name__ == "__main__":
	N, A, B = stdin.readline().split(" ")
	N = int(N)
	A = int(A)
	B = int(B)
	V = []
	line = stdin.readline().split(" ")
	unique_elements = dict()
	for e in line:
		V.append(int(e)) 
		if not int(e) in unique_elements:
			unique_elements[int(e)] = 1
		else:
			unique_elements[int(e)] += 1
	V.sort(reverse=True)


	# find optimal selections between A and B
	optimal = [A]
	highest_avg = -1
	for i in range(A, B+1):
		avg = float(sum(V[:i])) / float(i)
		if (avg > highest_avg):
			highest_avg = avg
			optimal = [i] # reset the list
		elif (avg == highest_avg):
			if not i in optimal:
				optimal.append(i)

	total = 1
	for e in optimal:
		# unique elements and count in for optimal value
		op_elemements = dict()
		for i in range(e):
			if V[i] in op_elemements:
				op_elemements[V[i]] += 1
			else:
				op_elemements[V[i]] = 1

		# find the sum
		for key, value in op_elemements.items():
			total = total * nCr(unique_elements[key], value)

	print ("{:6f}".format(highest_avg))
	print (int(total))


Fixed submission:
from sys import stdin

def combination_table(N):
	C = []
	for i in range(N+1):
		C.append([0] * (N+1))
	for i in range(N+1):
		for j in range(i+1):
			if (j==0 or j==i):
				C[i][j] = 1
			else:
				C[i][j] = C[i-1][j-1]+C[i-1][j]
	return C

if __name__ == "__main__":
	N, A, B = stdin.readline().split(" ")
	N = int(N)
	A = int(A)
	B = int(B)
	V = []
	line = stdin.readline().split(" ")
	unique_elements = dict()
	for e in line:
		V.append(int(e)) 
		if not int(e) in unique_elements:
			unique_elements[int(e)] = 1
		else:
			unique_elements[int(e)] += 1
	V.sort(reverse=True)

	C = combination_table(N)

	# find optimal selections between A and B
	a_th_val_pos = 0
	a_th_val_num = 0
	highest_avg = float(sum(V[:A])) / float(A)
	for i in range(N):
		if V[i] == V[A-1]:
			a_th_val_num += 1
			if i < A:
				a_th_val_pos += 1


	cnt = 0
	if a_th_val_pos == A:
		for i in range(A, B+1):
			cnt += C[a_th_val_num][i]
	else:
		cnt += C[a_th_val_num][a_th_val_pos]

	print ("{:6f}".format(highest_avg))
	print (cnt)