Problem p03776 (python)

Fixed submission:
#! coding: UTF-8
N,A,B = list(map(int,input().split(" ")))
V = list(map(int,input().split(" ")))
V.sort(reverse=True)
max_avr = sum(V[:A]) / A
a_num = V.count(V[A-1])
a_pos = V[:A].count(V[A-1])

#確率統計nCr
import math
def nCr(n,r):
    f = math.factorial
    return f(n) // f(r) // f(n-r)

if V[0] == V[A-1]:
    cnt = sum(nCr(a_num,i) for i in range(A,min(B,a_num)+1)) 
else:
    cnt = nCr(a_num,a_pos)
print("{0:.10f}".format(max_avr))
print(int(cnt))

Buggy submission (verdict: Runtime Error):
#! coding: UTF-8
data1 = list(map(int,input().split(" ")))
N = data1[0]
A = data1[1]
B = data1[2]
data2 = list(map(int,input().split(" ")))
data2.sort(reverse=True)
max_avr = sum(data2[:A]) / A
a_num = data2.count(data2[A-1])
a_pos = data2[:A].count(data2[A-1])
#確率統計nCr
import math
def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)
cnt = 0
if a_pos == A:
    while a_pos <= B:
        cnt += nCr(a_num,a_pos)
        a_pos += 1
else:
    cnt = nCr(a_num,a_pos)
print("{0:.10f}".format(max_avr))
print(int(cnt))

Buggy submission (verdict: Runtime Error):
#! coding: UTF-8
data1 = list(map(int,input().split(" ")))
N = data1[0]
A = data1[1]
B = data1[2]
data2 = list(map(int,input().split(" ")))
data2.sort(reverse=True)
max_avr = sum(data2[:A]) / A
a_num = data2.count(data2[A-1])
a_pos = data2[:A].count(data2[A-1])
#確率統計nCr
import math
def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)
cnt = 0
if a_pos == A:
    while a_pos <= B:
        cnt += nCr(a_num,a_pos)
        a_pos += 1
else:
    cnt = nCr(a_num,a_pos)
print("{0:.6f}".format(max_avr))
print(int(cnt))

Buggy submission (verdict: Runtime Error):
#! coding: UTF-8
data1 = list(map(int,input().split(" ")))
N = data1[0]
A = data1[1]
B = data1[2]
data2 = list(map(int,input().split(" ")))
data2.sort(reverse=True)
max_avr = sum(data2[:A]) / A
a_num = 0
a_pos = 0
for i in range(N):
	if data2[i] == data2[A-1]:
		a_num += 1
		if i < A:
			a_pos += 1
#確率統計nCr
import math
def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)
cnt = 0
if a_pos == A:
    while a_pos <= B:
        cnt += nCr(a_num,a_pos)
        a_pos += 1
else:
    cnt = nCr(a_num,a_pos)
print("{0:.6f}".format(max_avr))
print(int(cnt))

Buggy submission (verdict: Runtime Error):
#! coding: UTF-8
data1 = list(map(int,input().split(" ")))
N = data1[0]
A = data1[1]
B = data1[2]
data2 = list(map(int,input().split(" ")))
data2.sort(reverse=True)
max_avr = sum(data2[:A])
max_avr /= A
a_num = 0
a_pos = 0
for i in range(N):
	if data2[i] == data2[A-1]:
		a_num += 1
		if i < A:
			a_pos += 1
#確率統計nCr
import math
def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)
cnt = 0
if a_pos == A:
    while a_pos <= B:
        cnt += nCr(a_num,a_pos)
        a_pos += 1
else:
    cnt += nCr(a_num,a_pos)
print("{0:.6f}".format(max_avr))
print(int(cnt))

Buggy submission (verdict: Runtime Error):
#! coding: UTF-8
data1 = list(map(int,input().split(" ")))
N = data1[0]
A = data1[1]
B = data1[2]
data2 = list(map(int,input().split(" ")))
data2.sort(reverse=True)
max_avr = 0
for i in range(A):
	max_avr += data2[i]
max_avr /= A
a_num = 0
a_pos = 0
for i in range(N):
	if data2[i] == data2[A-1]:
		a_num += 1
		if i < A:
			a_pos += 1
#確率統計nCr
import math
def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)
cnt = 0
if a_pos == A:
    while a_pos <= B:
        cnt += nCr(a_num,a_pos)
        a_pos += 1
else:
    cnt += nCr(a_num,a_pos)
print("{0:.6f}".format(max_avr))
print(int(cnt))