Harryxun/stf_run huggingface dataset:
from collections import Counter

def solve(n, A):
    c = Counter(A)
    cands = sorted(filter(lambda kv: kv[1] >= 2, c.items()),  key=lambda kv: -kv[0])
    ret = 0
    if cands[0][1] >= 4:
        ret = cands[0][0] * cands[0][0]
    elif len(cands) >= 2:
        ret = cands[0][0] * cands[1][0]
    return ret

_n = int(input())
_A = map(int, input().split())
print(solve(_n, _A))


### FIXED CODE ###

from collections import Counter

def solve(n, A):
    c = Counter(A)
    cands = sorted(filter(lambda kv: kv[1] >= 2, c.items()),  key=lambda kv: -kv[0])
    ret = 0
    if len(cands) >= 1 and cands[0][1] >= 4:
        ret = cands[0][0] * cands[0][0]
    elif len(cands) >= 2:
        ret = cands[0][0] * cands[1][0]
    return ret

_n = int(input())
_A = map(int, input().split())
print(solve(_n, _A))
# -*- coding: utf-8 -*-
 
X = input()
A = input()
 
if X < A:
 print(0)
else:
 print(10)

### FIXED CODE ###

X, A = map(int, input().split())
 
if X < A:
 print(0)
else:
 print(10)
a = int(input())
b = int(input())

if( a*b%2 == 0 ):
    print("EVEN")
else:
    print("ODD")

### FIXED CODE ###

a,b = map(int, input().split())
if( a*b%2 == 0 ):
    print("Even")
else:
    print("Odd")
S=input()
K=int(input())
L=len(S)
cnt=0
ren=1

if L==1:
  ans= K//2
elif L==2:
  if S[0]==S[1]:
    ans = K
  else:
    ans = 0
else:  #|S|>=3が保証
  if S[0]!=S[-1]:
    for i in range(1,L):  
      if S[i]==S[i-1]:
        ren +=1
        if i==L-1:
          cnt += ren//2  
      else:
        cnt += ren//2
        ren=1
    ans=cnt*K
  else:
    head=0
    tail=0
    i=0
    j=0
    while S[i]==S[0]:
      head += 1
      i +=1
    while S[-1-j]==S[-1]:
      tail += 1
      j += 1
    #print(head,tail)
    if L-head-tail<0:
      ans=K*L//2
    elif L-head-tail==0:
      ans= K*( (head//2)+(tail//2) )
    else:  
      for k in range(head,L-tail):  
        #print("k=",k,"S[k]=",S[k])
        if S[k]==S[k-1]:
          ren +=1
          if k==L-tail-1:
            cnt += ren//2  
        else:
          cnt += ren//2
          ren=1
      #print("cnt",cnt)   
      
    ans=K*cnt + (K-1)*(head+tail)//2 + head//2 + tail//2
    
print(ans)


### FIXED CODE ###

S=input()
K=int(input())
N=len(S)

if S.count(S[0])==N:
  ans= K*N//2
else:
  h=0
  for i in range(N):
    if S[i]==S[0]:
      h +=1
    else:
      break
  t=0
  for i in range(N-1,-1,-1):
    if S[i]==S[-1]:
      t +=1
    else:
      break
  ren=1
  cnt=0
  for i in range(h,N-t):
    if S[i]==S[i-1]:
      ren +=1
      if i==N-t-1:
        cnt += ren//2
    else:
      cnt += ren//2
      ren=1    
      
  if S[0]==S[-1]:
    #print(h//2, (K-1)*((h+t)//2), t//2 ,K*cnt)
    ans= h//2 + (K-1)*((h+t)//2) + t//2 + K*cnt
  else:
    #print(h//2,cnt,t//2)
    ans= (h//2 + cnt + t//2)*K
print(ans)
N,K = list(map(int, input().split()))
p = list(map(int, input().split()))
max_l = 0
Max_l = p[0:K]

for i in range(N-K+1):
    m = sum(p[i:i+K])
    if m > max_l:
        max_l = m
        Max_l = p[i:i+K]


print((sum(L)+K)//2)

### FIXED CODE ###

N,K = list(map(int, input().split()))
p = list(map(int, input().split()))
max_l = 0
Max_l = p[0:K]
S = [0]
s=0
for j in range(N):
    s += p[j]
    S.append(s)

for i in range(N-K+1):
    m = S[K+i]-S[i]
    if m > max_l:
        max_l = m



print((max_l+K)/2)
N,M=map(int,input().split())
PY=[list(map(int,input().split()))+[i] for i in range(M)] #定義終了

PY.sort(key= lambda x:x[1])
num=[0]*N
w=[""]*M

for p,y,i in PY:
	num[p-1]+=1
	w[i]=str(p).zfill(6)+str(num[p-1]).zfill(6)

for a in range(M):
	print(w)

### FIXED CODE ###

N,M=map(int,input().split())
PY=[list(map(int,input().split()))+[i] for i in range(M)] #定義終了

PY.sort(key= lambda x:x[1])
num=[0]*N
w=[""]*M

for p,y,i in PY:
	num[p-1]+=1
	w[i]=str(p).zfill(6)+str(num[p-1]).zfill(6)

for i in range(M):
  	print(w[i])
N = input

if N[-1:] == "2"or"4"or"5"or"7"or"9":
    print("hon")
elif N[-1:] == "0"or"1"or"6"or"8":
    print("pon")
elif N[-1:] == "3":
    print("bon")

### FIXED CODE ###

N = input()
n = N[-1:]

if n == "2" or n == "4" or n == "5" or n == "7" or n == "9":
    print("hon")
elif n == "0" or n == "1" or n == "6" or n == "8":
    print("pon")
elif n == "3":
    print("bon")
#!usr/bin/env python3

'''
time score 7.88 for list
time score 03.17 for deque
time score 03.22 for defaultdict(dict)

''' 

from collections import defaultdict
from collections import deque
#import time

def main():
    # Read stdin
    start = time.clock()
    fl = input().split(" ")
    V = int(fl[0])
    E = int(fl[1])
    R = int(fl[2])
    # Adjacency list
    G = defaultdict(list)
    for i in range(E):
        s, t, w = [int(x) for x in input().split(" ")]
        G[s].append((t, w))
    # initialized
    d = {}
    INF = float('inf')
    # INF = 10001
    nodes_list = range(V)
    for i in nodes_list:
        d[i] = INF
    d[R] = 0
    # deque is better than list aka double link list O(1) for pop head and append
    q = deque([R])
    while q:
        # u = heappop(q)
        u = q.popleft()
        for v in G[u]:
            if d[v[0]] > d[u] + v[1]:
                d[v[0]] = d[u] + v[1]
                # heappush(q, v[0])
                q.append(v[0])
    for k in nodes_list:
        if d[k] == float('inf'):
            print("INF")
        else:
            print(d[k])
    #end = time.clock() - start
    #print('Computation time : {}'.format(end))


if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import defaultdict
from collections import deque
from sys import stdin
#time 2.49
def sp(G,R,V):
    d = {}
    INF = float('inf')
    for i in range(V):
        d[i] = INF
    d[R] = 0
    q = deque([(0, R)])
    while q:
        (cost, v) = q.popleft()
        for (u, c) in G[v].items():
            if d[u] > d[v] + c:
                d[u] = d[v] + c
                q.append((d[u], u))
    return d

V, E, R = [int(x) for x in stdin.readline().split()]
G = defaultdict(dict)
for case in range(E):
    s, t, w = [int(x) for x in stdin.readline().split()]
    G[s][t] = w
d = sp(G, R, V)
for k in range(V):
        if d[k] == float('inf'):
            print("INF")
        else:
            print(d[k])
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 13 14:52:12 2020

@author: USER
"""
import math
l=list(map(int,input().split()))
N=l[0]
K=l[1]
A=list(map(int,input().split()))
X=0
A=sorted(A)
for i in range(len(A)-K+1):
    for j in range(i+K-1,len(A)):
        X=X+(A[j]-A[i])*math.factorial(j-i-1)/(math.factorial(K-2)*math.factorial(j-i-1-K+2))
        X=X%(10**9+7)
        
print(int(X))
    

### FIXED CODE ###

def power(a,n):
    x=1
    L=list(format(n,'b'))
    l=len(L)
    for i in range(l):
        if int(L[l-i-1])==1:        
            x=(x*a)%(10**9+7)
        a=(a*a)%(10**9+7)
    return x
N,K=map(int,input().split())
A=list(map(int,input().split()))
b=sorted(A)
c=sorted(A,reverse=True)
D=[]
M=0
x=1
y=1
for l in range(K-1):
    x=(x*(N-l-1))%(10**9+7)
    y=(y*(l+1))%(10**9+7)
y=power(y,10**9+5)
M+=(x*y*(c[0]-b[0]))%(10**9+7)
for i in range(1,N-K+1):
    y1=power(N-i,10**9+5)
    x=(x*y1)%(10**9+7)
    x=(x*(N-K-i+1))%(10**9+7)  
    m=(x*y*(c[i]-b[i]))
    if m>0:
        m=m%(10**9+7)
    M+=m
    M%(10**9+7)

print(M%(10**9+7))
if 6<=a<=13:

    print(int(b/2))

elif 0<=a<=5:
    print(0)

elif 13<=a<=100:
    print(b)




### FIXED CODE ###

a,b=(int(x) for x in input().split())


if b%2==0 and 2<=b<=1000:
  
  if 0<=a<=5:
    
    print(0)
  
  elif 6<=a<=12:
    
    print(int(b/2))
    
  elif 13<=a<=100:
    
    print(b)
N = int(input())

arr = []

for i in range(N):
    arr.append(input())

print(len(arr.set()))

### FIXED CODE ###

N = int(input())

arr = []

for i in range(N):
    arr.append(input())

print(len(set(arr)))
N, K = map(int, input().split())
num = [0 for _ in range(N)]
for i in range(1, N + 1):
    num[i % K] += 1
ans = 0
for a in range(N):
    b = (K - a) % K
    c = (K - a) % K
    if (b + c) % K == 0:
        ans += num[a] * num[b] * num[c]
print(ans)




### FIXED CODE ###

N, K = map(int, input().split())
num = [0 for _ in range(K)]
for i in range(1, N + 1):
    num[i % K] += 1
ans = 0
for a in range(K):
    b = (K - a) % K
    c = (K - a) % K
    if (b + c) % K == 0:
        ans += num[a] * num[b] * num[c]
print(ans)
#encoding utf-8

import math
from functools import reduce


#複数の最大コゥ約数
def gcd(numbers):
    return reduce(math.gcd, numbers)

n,X = map(int, input().split())

x = [int(i) for i in input().split()]

x.append(X)

x.sort()

minus=[]
for i in range(len(x)-1):
    minus.append(x[i+1]-x[i])

D = gcd(minus)

print(D)


### FIXED CODE ###

#encoding utf-8

import math
from functools import reduce

#複数の最大コゥ約数
def gcd(a,b):
    l = max(a,b)
    m = min(a,b)
    while m != 0:
        extra = l%m
        l = m
        m = extra
    return l

def gcd_multi(numbers):
    return reduce(gcd,numbers)

n,X = map(int, input().split())

x = [int(i) for i in input().split()]

x.append(X)

x.sort()

minus=[]

for i in range(len(x)-1):
    minus.append(x[i+1]-x[i])


D = gcd_multi(minus)

print(int(D))
a, b = map(int, input().split())
if max(a,b) <= 9:
    print(int(a * b))

else:
    print(-1)


### FIXED CODE ###

num = int(input())
print(int(num * num))
import math
X=int(input())

for i in range(X+1):
  print(pow(X-pow(i,5),1/5),i)
  if pow(X-pow(i,5),1/5)%1==0:
    break
print(int(pow(X-pow(i,5),1/5)),-i)

### FIXED CODE ###

import math
X=int(input())
c=0
for i in range(200):   
  for j in range(-200,200):
    if i**5-j**5==X:
      c=1
      break
      
  if c==1:
    break
      
print(i,j)
import sys

#fin = open("test.txt", "r")
fin = sys.stdin

n, m = map(int, fin.readline().split())

A = [[] for i in range(n)]
for i in range(n):
	A[i] = list(map(int, fin.readline().split()))

b = [0 for i in range(m)]

for i in range(m):
	b[i] = int(fin.readline())

c = [0 for i in range(m)]

for i in range(n):
	for j in range(m):
		c[i] += A[i][j] * b[j]

for i in range(n):
	print(c[i])

### FIXED CODE ###

import sys

#fin = open("test.txt", "r")
fin = sys.stdin

n, m = map(int, fin.readline().split())

A = [[] for i in range(n)]
for i in range(n):
	A[i] = list(map(int, fin.readline().split()))

b = [0 for i in range(m)]

for i in range(m):
	b[i] = int(fin.readline())

c = [0 for i in range(n)]

for i in range(n):
	for j in range(m):
		c[i] += A[i][j] * b[j]

for i in range(n):
	print(c[i])
from functools import lru_cache

S = input().strip()

MOD = 10 ** 9 + 7

lens = len(S)

sys.setrecursionlimit(10 ** 8)

@lru_cache(maxsize=None)
def solve(amari, keta):
    if keta == lens - 1:
        if S[keta] == "?":
            cnt = 0
            for i in range(9, -1, -1):
                if (amari + i) % 13 == 5:
                    cnt += 1
            return cnt
        else:
            if (amari + int(S[keta])) % 13 == 5:
                return 1 % MOD
            else:
                return 0
    else:
        if S[keta] == "?":
            x = 0
            for i in range(9, -1, -1):
                x += solve((amari + (i * 10 ** (lens - 1 - keta)) % 13) % 13, keta + 1)
            return x % MOD
        else:
            return solve((amari + (int(S[keta]) * 10 ** (lens - 1 - keta)) % 13) % 13, keta + 1) % MOD


print(solve(0, 0) % MOD)


### FIXED CODE ###


S = input()

MOD = 10 ** 9 + 7
count = 0
S_len = len(S)

dp = [[0 for i in range(13)] for j in range(100006)]
c = -1
if S[0] != '?':
    c = int(S[0])
for j in range(10):
    if c == -1:
        dp[1][j] = 1
    else:
        dp[1][c] = 1

for i in range(2, S_len + 1):
    c = -1
    if S[i - 1] != '?':
        c = ord(S[i - 1]) - ord('0')

    for j in range(10):
        if c != -1 and c != j:
            continue
        for k in range(13):
            dp[i][(k * 10 + j) % 13] += dp[i - 1][k] % MOD


print(dp[S_len][5] % MOD)
n = int(input())
info = [tuple(map(int, input().split()))]
nonzeroinfo = []
for x, y, h in info:
    if h > 0:
        nonzeroinfo.append((x, y, h))
zeroinfo = []
for x, y, h in info:
    if h == 0:
        zeroinfo.append((x, y, h))
def checknonzero(x, y, h):
    for a, b, c in nonzeroinfo:
        if h != abs(x-a) + abs(y-b) + c:
            return False
    return True
def checkzero(x, y, h):
    for a, b, _ in zeroinfo:
        if abs(x-a) + abs(y-b) < h:
            return False
    return True
for x in range(101):
    for y in range(101):
        x1, y1, h1 = nonzeroinfo[0]
        h = abs(x-x1) + abs(y-y1) + h1
        ret1 = checknonzero(x, y, h)
        ret2 = checkzero(x, y, h)
        if ret1 and ret2:
            print(x, y, h)
            exit()

### FIXED CODE ###

n = int(input())
x = [0] * n
y = [0] * n
h = [0] * n
for i in range(n):
    x[i], y[i], h[i] = map(int, input().split())
for a in range(101):
    for b in range(101):
        hset = set()
        for i in range(n):
            if h[i] != 0:
                hset.add(h[i] + abs(x[i]-a) + abs(y[i]-b))
        if len(hset) == 1:
            height = hset.pop()
            check = True
            for i in range(n):
                if h[i] == 0:
                    if height - abs(x[i]-a) - abs(y[i]-b) > 0:
                        check = False
                        break
            if check:
                print(a,b,height)
                exit()
print('ERROR EXIT')
from collections import defaultdict,deque
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
N,M=map(int,input().split())
if M==0:
  print(-1)
  exit()
G=defaultdict(set)
for i in range(M):
  a,b,c=map(int,input().split())
  G[a+(c<<30)].add(b+(c<<30))
  G[b+(c<<30)].add(a+(c<<30))
  G[a].add(a+(c<<30))
  G[b].add(b+(c<<30))
  G[a+(c<<30)].add(a)
  G[b+(c<<30)].add(b)
def BFS(x):
  d={}
  for k in G.keys():
    d[k]=float("inf")
  stack=deque([(x,0)])
  while stack:
    s,m=stack.popleft()
    if s==N:
      return m
    if d[s]>m:
      d[s]=m
      if s>=(1<<30):
        for i in G[s]:
          if d[i]>10**30:
            stack.appendleft((i,m))
      else: 
        for i in G[s]:
          if d[i]>10**30:
            stack.append((i,m+1))
  return -1

print(BFS(1))



      
    

### FIXED CODE ###

from collections import defaultdict,deque
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
N,M=map(int,input().split())
if M==0:
  print(-1)
  exit()
G=defaultdict(set)
for i in range(M):
  a,b,c=map(int,input().split())
  G[a+(c<<30)].add(b+(c<<30))
  G[b+(c<<30)].add(a+(c<<30))
  G[a].add(a+(c<<30))
  G[b].add(b+(c<<30))
  G[a+(c<<30)].add(a)
  G[b+(c<<30)].add(b)
def BFS(x):
  d={}
  for k in G.keys():
    d[k]=float("inf")
  stack=deque([(x,0)])
  if x not in d:
    return -1
  while stack:
    s,m=stack.popleft()
    if s==N:
      return m
    if d[s]>m:
      d[s]=m
      if s>=(1<<30):
        for i in G[s]:
          if d[i]>10**30:
            stack.appendleft((i,m))
      else: 
        for i in G[s]:
          if d[i]>10**30:
            stack.append((i,m+1))
  return -1

print(BFS(1))
N = int(input())
print(sum(list(range(N))))

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
  n = int(N / 2)
  print(n * (N - 1))
else:
  n = int((N-1)/2)
  print(N*n)
from operator import itemgetter

N, M = map(int, input().split())
in_hand = list(map(int, input().split()))
in_hand.sort()

change_list = []

for line in range(M):
    change_count, change_number = map(int, input().split())

    change_list.append([change_count, change_number])


change_list.sort(key=itemgetter(1), reverse=True)

index = 0
for change in change_list:
    for i in range(change[0]):
        if in_hand[i+index] < change[1]:
            in_hand[i+index] = change[1]
        else:
            break
    else:
        index += change[0]
        continue
    break

print(sum(in_hand))


### FIXED CODE ###

from operator import itemgetter

N, M = map(int, input().split())
in_hand = list(map(int, input().split()))
in_hand.sort()

change_list = []

for line in range(M):
    change_count, change_number = map(int, input().split())

    change_list.append([change_count, change_number])


change_list.sort(key=itemgetter(1), reverse=True)

index = 0
try:
    for change in change_list:
        for i in range(change[0]):
            if in_hand[i+index] < change[1]:
                in_hand[i+index] = change[1]
            else:
                break
        else:
            index += change[0]
            continue
        break
except:
    pass

print(sum(in_hand))
n,m = map(int,input().split())
ct = 0

while n > 0:
  ct+=1
  n//=k
  
print(ct)

### FIXED CODE ###

n,m = map(int,input().split())
ct = 0

while n > 0:
  ct+=1
  n//=m
  
print(ct)
n=input()
A=[]
A.append(n)
for i in range(2,10**6):
  if n%2==0:
    n/=2
  else:
    n=3*n+1
  if n in A:
    print(i)
    exit()
  else:
    A.append(n)

### FIXED CODE ###

n=int(input())
A=[]
A.append(n)
for i in range(2,10**6):
  if n%2==0:
    n/=2
  else:
    n=3*n+1
  if n in A:
    print(i)
    exit()
  else:
    A.append(n)
print(int(eval(input().replace(" ","*")))

### FIXED CODE ###

l = input()
l = l.replace('.', " ")
# print(l)
l = [int(i) for i in l.split()]
a, b, c = l
# print(l)
b = b * 100 + c
a *= b
a //= 100
print(a)
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
if X<Z<=Y and max(x)<Z and min(y)>=Z :
    print('No War')
else:
    print('War')

### FIXED CODE ###

N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
Z=min(y)
if X<Z<=Y and max(x)<Z and min(y)>=Z :
    print('No War')
else:
    print('War')
N=int(input())
S=input()
if S[0:N/2]==S[N/2:N] and N/2==0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N=int(input())
S=input()
if S[0:int(N/2)]==S[int(N/2):int(N)] and N%2==0:
  print("Yes")
else:
  print("No")
N,K=map(int,input().split())
if K==0:
  ans=N
elif N%K==0 and K%N==0:
  ans=0
else:
  if N%2==0:
    ans=min(N,abs(N-K))
  else:
    ans=1
print(ans)

### FIXED CODE ###

N,K=map(int,input().split())
ans=min(N,N%K,abs(N%K-K))
print(ans)
import sys
import numpy as np

N = int(sys.stdin.readline())
L = np.array(list(map(int, sys.stdin.readline().split())))
L = np.sort(L)

count = 0

for i in range(N - 2):
    a = L[i]
    for j in range(i + 1, N - 1):
        b = L[j]
        c_cand = L[j + 1:]
        c_num = np.count_nonzero(c_cand < a + b)
        count += c_num
        
print(count)

### FIXED CODE ###

import sys
import bisect

N = int(sys.stdin.readline())
L = list(map(int, sys.stdin.readline().split()))
L.sort()

count = 0

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        c = bisect.bisect_left(L, L[i]+L[j])
        if c > j:
            count += c - j - 1
        else:
            pass
        
print(count)
x**3


### FIXED CODE ###

n =int( input())
print(n**3)
N, Q = map(int, input().split())
S = str(input())
count = [0]*(N+1)
lists = []
for i in range(N):
    if S[i] == "A" and S[i + 1] == "C":
        count[i + 1] = count[i] + 1
    else:
        count[i + 1] = count[i]
for i in range(Q):
    l, r = map(int, input().split())
    ans = count[r-1] - count[l-1]
    lists.append(ans)
for i in range(len(lists)):
    print(lists[i])


### FIXED CODE ###

N, Q = map(int, input().split())
ruisekiwa = [0]
lists = []
cnt = 0
S = str(input())
for t in range(1, N):
    if S[t - 1] == "A" and S[t] == "C":
        cnt += 1
    ruisekiwa.append(cnt)
ruisekiwa.append(cnt)
for i in range(Q):
    l, r = map(int, input().split())
    ans = ruisekiwa[r - 1] - ruisekiwa[l - 1]
    lists.append(ans)
for m in range(len(lists)):
    print(lists[m])
N = int(input())
S = list(map(int,input().split(""))) 
result_list = [] 
for i in range(N): 
    X = S[:i] 
    Y = S[i:] 
    counter = 0 
    old_list = [] 
    for j in X: 
        if j in Y and not(j in old_list): 
            counter += 1 
            old_list.append(j) 
            result_list.append(counter) 
print (max(result_list))

### FIXED CODE ###

N = int(input())
S = list(input()) 
result_list = [] 
for i in range(N): 
    X = S[:i] 
    Y = S[i:] 
    counter = 0 
    old_list = [] 
    for j in X: 
        if j in Y and not(j in old_list): 
            counter += 1 
            old_list.append(j) 
            result_list.append(counter) 
if result_list == []:
    print(0)
else:
    print (max(result_list))
memo = [[0] * 60 for i in range(60)]

def comb(n,k):
    if memo[n][k] > 0:
        return memo[n][k]
    elif k == 0 or k == n:
        memo[n][k] = 1
        return memo[n][k]
    else:
        memo[n][k] = comb(n-1,k) + comb(n-1,k-1)
        return memo[n][k]

n,a,b = map(int,input().split(' '))
v = list(map(int,input().split(' ')))

v.sort()
v.reverse()
if len(set(v)) == 1:
    print(v[0])
    ans = 0
    for i in range(a,b+1):
        ans += comb(n,i) 
    print(ans)
else:
    total = 0
    for i in range(a):
        total += v[i]
    print("%.10f" % total/a)
    if a < n and v[a] == v[a-1]:
        l = r = 0
        for i in range(n):
            if v[i] == v[a]:
                if i < a:
                    l += 1
                else:
                    r += 1
        print(comb(l+r,l))
    else:
        print(1)

### FIXED CODE ###

memo = [[0] * 60 for i in range(60)]

def comb(n,k):
    if memo[n][k] > 0:
        return memo[n][k]
    elif k == 0 or k == n:
        memo[n][k] = 1
        return memo[n][k]
    else:
        memo[n][k] = comb(n-1,k) + comb(n-1,k-1)
        return memo[n][k]

n,a,b = map(int,input().split(' '))
v = list(map(int,input().split(' ')))

v.sort()
v.reverse()
if len(set(v[:a])) == 1:
    print(v[0])
    cnt = 0
    for i in range(n):
        if v[i] == v[0]:
            cnt += 1
    ans = 0
    for i in range(a,min(b,cnt)+1):
        ans += comb(cnt,i) 
    print(ans)
else:
    total = 0
    for i in range(a):
        total += v[i]
    print("%.10f" % (total/a))
    if a < n and v[a] == v[a-1]:
        l = r = 0
        for i in range(n):
            if v[i] == v[a]:
                if i < a:
                    l += 1
                else:
                    r += 1
        print(comb(l+r,l))
    else:
        print(1)
a = int(input())
b = int(input())
c = int(input())
print(min(a*b, c))

### FIXED CODE ###

a, b, c  =map(int,input().split())
print(min(a*b, c))
a=int(input())
b=int(input())
c=int(input())
x=int(input())

ans=0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i+100*j+50*k==x
      ans+=1
      
print(ans)

### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
x=int(input())

ans=0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i+100*j+50*k==x:
        ans+=1
      
print(ans)
N = int(input())
import numpy as np

A = list(map(int, input().split()))
dp = np.zeros((N,9))
for i in range(N):
  tmp = [0]*(A[i]-1)+[1]+[0]*(9-A[i])
  tmp = np.array(tmp)
  dp[i] = tmp+dp[i-1]

dp = np.array(dp)
ans = []
for i in range(N):
  if i > 0 and i < N-1:
    tmp = dp[N-1] - dp[i] + dp[i-1]
    tmp = tmp*(tmp-1)/2
    tmp = [t for t in tmp.tolist() if t > 0]
    tmp = np.array(tmp)
    ans.append(tmp.sum())
  if i == 0:
    tmp = dp[N-1] - dp[i]
    tmp = tmp*(tmp-1)/2
    tmp = np.array([t for t in tmp.tolist() if t>0])
    ans.append(tmp.sum())
  if i == N-1:
    tmp = dp[N-2]
    tmp = tmp*(tmp-1)/2
    tmp = np.array([t for t in tmp.tolist() if t>0])
    ans.append(tmp.sum())
for i in ans:
  print(int(i))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))

from collections import defaultdict
c = defaultdict(int)
cm = set()
c2 = list()
num = 0
for i in range(N):
  c[A[i]] += 1
  cm.add(A[i])
for i in list(cm):
  num += c[i]*(c[i]-1)//2
for i in range(N):
  ans = num - c[A[i]] + 1
  c2.append(ans)

for cs in c2:
  print(cs)
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

a, b, c, d = na()

def gcd(a, b):
    return a if b == 0 else gcd(b, b%a)

def cou(b, c, d):
    g = gcd(c, d)
    return b - b//c - b//d + b//(c//g*d)

print(cou(b, c, d) - cou(a-1, c, d))

### FIXED CODE ###

import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

a, b, c, d = na()

def gcd(a, b):
    while b > 0:
        c = a % b
        a = b
        b = c
    return a

def cou(b, c, d):
    g = gcd(c, d)
    return b - b//c - b//d + b//(c//g*d)

print(cou(b, c, d) - cou(a-1, c, d))