Harryxun/stf_run huggingface dataset:
import sys
import itertools
import numpy as np

MOD = 998244353
MAX = 10 ** 5 * 2 + 5

fac = [0 for i in range(MAX)]
finv = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]

def comInit(mod):
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod

def com(n, r, mod):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod

comInit(MOD)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
n, m, k = map(int, readline().split())

ans = 0
now = m * (m - 1) ** (n - k - 2) % MOD
for x in range(k, -1, -1):
    now *= (m - 1) % MOD
    ans += now * com(n - 1, x, MOD) % MOD
    # ans += tmp
print(ans % MOD)

### FIXED CODE ###

import sys
import itertools
import numpy as np

MOD = 998244353
MAX = 10 ** 5 * 2 + 5

fac = [0 for i in range(MAX)]
finv = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]

def comInit(mod):
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod

def com(n, r, mod):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod

comInit(MOD)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
n, m, k = map(int, readline().split())

ans = 0
col = m
for x in range(n - 1, -1, -1):
    now = col
    now *= com(n - 1, x, MOD) % MOD
    if x <= k:
        ans += now
    col = (col * (m - 1)) % MOD

print(ans % MOD)
n,k=map(int,input().split())
s=input()

num_cnt=[]
if s[0]=='1':
  num_cnt.append(0)

cnt=1
for i in range(1,n):
  if s[i]==s[i-1]:
    cnt+=1
  else:
    num_cnt.append(cnt)
    cnt=1
num_cnt.append(cnt)

if k<=n/2:
  ans=sum(num_cnt[:2*k])

  tmp=len(num_cnt)
  if tmp%2==0:
    limit=tmp//2-k
  else:
    num_cnt.append(0)
    limit=tmp//2-k+1
  
  #print(ans)
  #print(num_cnt)
  tmp=num_cnt[2*k]+num_cnt[2*k+1]-num_cnt[0]
  if tmp>0:
    ans+=tmp
  
  for i in range(1,limit):
    tmp=num_cnt[2*(i+k)]+num_cnt[2*(i+k)+1]-num_cnt[2*i]-num_cnt[2*i+1]
    #print(tmp)
    if tmp>0:
      ans+=tmp
else:
  ans=n
print(ans)
  

### FIXED CODE ###

n,k=map(int,input().split())
s=input()

num_cnt=[]
if s[0]=='1':
  num_cnt.append(0)

cnt=1
for i in range(1,n):
  if s[i]==s[i-1]:
    cnt+=1
  else:
    num_cnt.append(cnt)
    cnt=1
num_cnt.append(cnt)

leng=len(num_cnt)
if leng/2>k:
  ans=sum(num_cnt[:2*k])
  tot=ans
  
  if leng%2==0:
    limit=leng//2-k
  else:
    num_cnt.append(0)
    limit=leng//2-k+1
  
  #print(ans)
  #print(num_cnt)
  tmp2=num_cnt[2*k]+num_cnt[2*k+1]-num_cnt[0]
  tot+=tmp2
  if tot>ans:
    ans=tot
  
  for i in range(1,limit):
    #print(2*(i+k)+1)
    tmp=num_cnt[2*(i+k)]+num_cnt[2*(i+k)+1]-num_cnt[2*i]-num_cnt[2*i-1]
    #print(tot)
    tot+=tmp
    if tot>ans:
      ans=tot
else:
  ans=n
print(ans)
lis = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
 
k = int(input())
 
print(lis[k])

### FIXED CODE ###

lis1 = [0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())

print(lis1[k])
import functools
import sys

sys.setrecursionlimit(1000000000)
n = input()
memo = {}

@functools.lru_cache(None)
def dp(index, carry):
    if index >= len(n):
        return 99999999999999999999 if carry else 0
    v = int(n[index])
    if carry:
        # ぴったり払う
        temp = 10 - v + dp(index+1, 0)
        # お釣りありで払う
        temp = min(temp, 9 - v + dp(index+1, 1))
    else:
        # ぴったり払う
        temp = v + dp(index+1, 0)
        # お釣りありで払う
        temp = min(temp, 1 + v + dp(index+1, 1))
    return temp

print(min(dp(0, 0), 1 + dp(0, 1)))

### FIXED CODE ###

n = input()
lenn = len(n)

dp = [0, 10000]
for d in reversed(n):
    d = int(d)
    dp = [min(d + dp[0], d + 1 + dp[1]), min(10 - d + dp[0], 9 - d + dp[1])]

print(min(dp[0], 1 + dp[1]))
A = int(input())
B = int(input())
kuchi = 1
taps = 0 
while kuchi < B:
    taps +=1
    kuchi +=A-1
print(taps)
    
    


### FIXED CODE ###

A,B = map(int, input().split(' '))
kuchi = 1
taps = 0 
while kuchi < B:
    taps +=1
    kuchi +=A-1
print(taps)
C = input()
print(chr(ord(C)+1)

### FIXED CODE ###

C = input()
print(chr(ord(C)+1))
#!/usr/bin/env python3
    import sys
    import math
     
    def solve(A: int, B: int, N: int):
     
        x = min(B-1, N)
        print(math.floor(A*x/B) - A*math.floor(x/B))
     
        return
     
     
    def main():
        def iterate_tokens():
            for line in sys.stdin:
                for word in line.split():
                    yield word
        tokens = iterate_tokens()
        A = int(next(tokens))  # type: int
        B = int(next(tokens))  # type: int
        N = int(next(tokens))  # type: int
        solve(A, B, N)
     
    if __name__ == '__main__':
        main()

### FIXED CODE ###

#!/usr/bin/env python3
import sys
import math

def solve(A: int, B: int, N: int):
    x = min(B-1, N)
    print(math.floor(A*x/B) - A*math.floor(x/B))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)

if __name__ == '__main__':
    main()
n, *XYH = map(int, open(0).read().split())
for cx, cy in product(range(101), repeat=2):
    B, C = set(), set()
    for x, y, h in zip(XYH[::3], XYH[1::3], XYH[2::3]):
        s = h + abs(x-cx) + abs(y-cy)
        if h:
            C.add(s)
        else:
            B.add(s)
    if len(C) == 1:
        h = C.pop()
        if all(h <= b for b in B):
            print(cx, cy, h)
            exit()

### FIXED CODE ###

from itertools import product
n, *XYH = map(int, open(0).read().split())
X, Y, H = XYH[::3], XYH[1::3], XYH[2::3]
A = []
for cx, cy in product(range(101), repeat=2):
    B = set()
    C = set()
    for x, y, h in zip(X, Y, H):
        s = h + abs(x-cx) + abs(y-cy)
        if h == 0:
            B.add(s)
        else:
            C.add(s)
    if len(C) == 1:
        h = C.pop()
        if all(h <= b for b in B):
            A.append((cx, cy, h))
print(*A.pop())
a,b=list(map(int,input().split()))
if b//a==0:
  print(b//a)
elif -(-b//a):
  print(-(-b//a))


### FIXED CODE ###

s=list(input())
t=list(input())
ans=0
for i in range(len(s)):
  if s[i]==t[i]:
    ans+=1
    continue
print(ans)
def main():
    with open("input.txt", "r") as f:
        t = f.readlines()
        N = int(t[0].split()[0])
        K = int(t[0].split()[1])
        h = t[1].split()
        h = [int(i) for i in h]
#    N, K  = map(int, input().split())
#    h = list(map(int, input().split()))
    dp = [10**9] * N
    dp[0] = 0

    for i in range(N):
        if i == 0:
            pass
        elif i == 1:
            dp[i] = h[1]
        else:
            dp[i] = min([dp[i-j] + abs(h[i]-h[i-j]) for j in range(1, min(K,i)+1)])
    print(dp[N-1])

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    N, K  = map(int, input().split())
    h = list(map(int, input().split()))
    dp = [10**9] * N
    dp[0] = 0

    for i in range(N):
        dp[i] = min([dp[i-j] + abs(h[i]-h[i-j]) for j in range(min(K,i)+1)])
    print(dp[N-1])

if __name__ == "__main__":
    main()
import itertools
n = int(input())
a = tuple(map(int, input().split()))
b = tuple(map(int, input().split()))

l = list(itertools.permutations(range(1,n+1)))

print(abs(l.index(a) - l.index(b)))





### FIXED CODE ###

import math
import itertools

n = int(input())
x, y = [0]*n, [0]*n
for i in range(n):
    a, b = map(int, input().split())
    x[i], y[i] = a, b
l = list(itertools.permutations(range(n)))

tmp = 0
for p in l:
    for j in range(n-1):
        a = p[j]
        b = p[j+1]
        tmp += math.sqrt((x[a]-x[b])**2 + (y[a]-y[b])**2)

print(round(tmp/len(l), 10))
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
sum1 = 0
sum2 = 0
ans_list = []
for i in range(n):
    sum2 += a2[i]
for i in range(n-1):
    sum1 += a1[i]
    sum2 -= a2[i]
    ans1 = sum1 + sum2 + a1[i+1]
    ans2 = sum1 + sum2 + a2[i]
    ans_list.append(ans1)
    ans_list.append(ans2)       
print(max(ans_list))    

### FIXED CODE ###

n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
sum1 = 0
sum2 = 0
ans_list = []
for i in range(n):
    sum2 += a2[i]
if n != 1:    
    for i in range(n-1):
        sum1 += a1[i]
        sum2 -= a2[i]
        ans1 = sum1 + sum2 + a1[i+1]
        ans2 = sum1 + sum2 + a2[i]
        ans_list.append(ans1)
        ans_list.append(ans2)   
else:
    ans_list.append(a1[0]+a2[0])
print(max(ans_list))
s = input()
k = int(input())

i=0
while(s[i]=="1"):
    i +=1
    
if k<i:
    print(1)
else:
    print(s[i])

### FIXED CODE ###

s = input()
k = int(input())

i=0
while(s[i]=="1"):
    if i==(len(s)-1):
        break
    i +=1
    
if k<(i+1):
    print(1)
else:
    print(s[i])
import math

N = int(input())
Xi = list(map(int, input().split(" ")))

Xi_min = min(Xi)
Xi_max = max(Xi)

ans = math.inf
print("-----")
for i in range(Xi_min, Xi_max+1):
    tmp = 0
    for j in range(N):
        tmp += pow(Xi[j] - i, 2)
    if tmp < ans:
        ans = tmp

print(ans)

### FIXED CODE ###

import math

N = int(input())
Xi = list(map(int, input().split(" ")))

Xi_min = min(Xi)
Xi_max = max(Xi)

ans = 999999999
for i in range(Xi_min, Xi_max+1):
    tmp = 0
    for j in range(N):
        tmp += pow(Xi[j] - i, 2)
    if tmp < ans:
        ans = tmp

print(ans)
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = 0

i = 0
while d <= x:
  d += l[i]
  i += 1
print(i)

### FIXED CODE ###

n, x = map(int, input().split())
l = list(map(int, input().split()))
d = 0

i = 0
while d <= x and i <= n:
  if i < n:
    d += l[i]
  i += 1
print(i)
jN = int(input())

M = []
for _ in range(N):
  t, x, y = map(int, input().split())
  M.append([t, x, y])

current = [0, 0, 0]
can = True
for m in M:
  dt = m[0] - current[0]
  dist = abs(m[1] - current[1]) + abs(m[2] - current[2])
  if (dist > dt):
    can = False
    break
  else:
    if (dist % 2 != dt % 2):
      can = False
      break
  current = m

result = "Yes" if (can == True) else "No"
print(result)

### FIXED CODE ###

N = int(input())

M = []
for _ in range(N):
  t, x, y = map(int, input().split())
  M.append([t, x, y])

current = [0, 0, 0]
can = True
for m in M:
  dt = m[0] - current[0]
  dist = abs(m[1] - current[1]) + abs(m[2] - current[2])
  if (dist > dt):
    can = False
    break
  else:
    if (dist % 2 != dt % 2):
      can = False
      break
  current = m

result = "Yes" if (can == True) else "No"
print(result)
N , M = map(int, input().split())
As =[input() for _ in range(N)]
Bs =[input() for _ in range(M)]
m = N-M
for i in range(m):
    for j in range(m):
        flag = True
        for k in range(M):
            for l in range(M):
                if As[k+i][l+j] != Bs[k][l]:
                    flag = False
                    break
            if not flag:
                break
        if flag:
            break
    if flag:
        break
if flag:
    print('Yes')
else:
    print('No')
            

### FIXED CODE ###

N , M = map(int, input().split())
As =[input() for _ in range(N)]
Bs =[input() for _ in range(M)]
m = N-M
for i in range(m+1):
    for j in range(m+1):
        flag = True
        for k in range(M):
            for l in range(M):
                if As[k+i][l+j] != Bs[k][l]:
                    flag = False
                    break
            if not flag:
                break
        if flag:
            break
    if flag:
        break
if flag:
    print('Yes')
else:
    print('No')
N = int(input())
S = [input() for _ in range(N)]

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in dic.keys():
  if dic[keys] == maxim:
    ans.append(keys)
    
ans.sort()

for i in len(ans):
  print(ans[i])


### FIXED CODE ###

N = int(input())
S = [input() for _ in range(N)]

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in dic.keys():
  if dic[keys] == maxim:
    ans.append(keys)
    
ans.sort()

for i in range(len(ans)):
  print(ans[i])
import math


num = int(input())

for i in range(num):
    ax,ay,ar,bx,by,br = map(float,input().split(' '))
    d = (ax - bx)*(ax - bx) + (ay * by)
    if d < abs(br - ar):
        if ar > br:
            print(2)
        else:
            print(-2)
    elif d <= r1 + r2:
        print(1)
    else:
        print(0)

### FIXED CODE ###



import math 

num = int(input())
for i in range(num):
    ax,ay,ar,bx,by,br=map(float,input().split())
    d = ((ax-bx)* (ax - bx))+((ay-by)*(ay-by))
    r1 = (ar+br)*(ar+br)
    r2 = (ar-br)*(ar-br)
    if d <= r1 and d >= r2:
        print(1);
    elif d<r2 and ar>=br:
        print(2)
    elif d < r2 and ar <= br:
        print(-2)
    else:
        print(0)
a,b,n = map(int,input().split())
if a+b>=c:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a,b,c = map(int,input().split())
if a+b>=c:
  print('Yes')
else:
  print('No')
n = int(input())
s = input()
if n%2==1:
  print("NO") 
elif:
  s1 = ""
  s2 = ""
  for i in range(0, n/2):
    s1+=s[i]
    s2+=s[n/2 + i]
  if(s1 == s2):
    print("YES")
  else:
    print("NO")


### FIXED CODE ###

n = int(input())
s = input()
if n%2==1:
    print("No") 
else:
    s1 = ""
    s2 = ""
    for i in range(0, n//2):
        s1+=s[i]
        s2+=s[n//2 + i]
    if(s1 == s2):
        print("Yes")
    else:
        print("No")
numlist = list(input())
if sum(numlist) == 17:
  print("YES")
else:
  print("NO")
  

### FIXED CODE ###

A, B, C = map(int, input().split())
if A*B*C == 5*5*7:
  print("YES")
else:
  print("NO")
print(swapcase(input()))

### FIXED CODE ###

print(input().swapcase())
print("NYoe s"[eval(input().replace(" ","<=")::2)])

### FIXED CODE ###

a,b,c=map(int,input().split());print("NYoe s"[a<=c<=b::2])
x = input()

if x = "ABC":
  print("ARC")
else:
  print("ABC")

### FIXED CODE ###

x = input()

if x == "ABC":
  print("ARC")
else:
  print("ABC")
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 i in range(101):
    for j in range(101):
        h1 = h[0] + abs(i - x[0]) + abs(j - y[0])
        flag = True
        for k in range(1, N):
            h2 = h[k] + abs(i - x[k]) + abs(j - y[k])
            if h1 != h2:
                flag = False
                break
        if flag:
            ans = [str(i), str(j), str(h1)]
            break
    if flag:
        break

print(ans[0] + " " + ans[1] + " " + ans[2])

### FIXED CODE ###

N = int(input())

x = [0] * N
y = [0] * N
h = [0] * N

for i in range(N):
    xyh = list(map(int, input().split()))
    x[i] = xyh[0]
    y[i] = xyh[1]
    h[i] = xyh[2]
    if xyh[2] != 0:
        Cx = xyh[0]
        Cy = xyh[1]
        CH = xyh[2]

for i in range(101):
    for j in range(101):
        flag = True
        H = CH + abs(i - Cx) + abs(j - Cy)
        for k in range(N):
            if h[k] != max(H - abs(i - x[k]) - abs(j - y[k]), 0):
                flag = False
                break
        if flag:
            print(i, j, H)
n=int(input())
dp=[10**5]*n
dp[0]=0
for i in range(n+1):
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=6
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=9
print(dp[n])


### FIXED CODE ###

n=int(input())
dp=[10**5]*(n+1)
dp[0]=0
for i in range(n+1):
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=6
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=9
print(dp[n])
import math
from functools import reduce
 
n,m = map(int,input().split())
x = list(map(int,input().split()))
 
x.append(m)
x.sort() 
 
aa = []
for i in range(len(x)-1):
    a = x[i+1] - x[i]
    aa.append(a)
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)

if len(x) == 1:
    print(abs(x[0]-m))
else:
    set_aa = [a for a in set(aa)]
    print(gcd(*set_aa))

### FIXED CODE ###

n,m = map(int,input().split())
aa = list(map(int,input().split()))
 
bb = [abs(a-m) for a in aa]

def gcd(a,b):
    while b:
        a, b = b, a % b
    return a
    
if len(aa) == 1:
    print(abs(aa[0]-m))
else:
    while len(bb) > 1:
        a, b = bb.pop(), bb.pop()
        bb.append(gcd(a,b))
    print(bb[0])
# -*- coding: utf-8 -*-

N, K = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]

l.sort(reverse=True)
print(sum(l[:K]))

### FIXED CODE ###

# -*- coding: utf-8 -*-

A, B = [int(x) for x in input().split()]

if A % 3 == 0:
    print ("Possible")
elif B % 3 == 0:
    print("Possible")
elif (A + B) % 3 == 0:
    print("Possible")
else:
    print("Impossible")
nums = list(map(int,input().split()))
flag1 = 1 in nums and 9 in nums and 7 in nums and 4 in nums
if flag1 == True:
   print(“YES”)
else:
   print(“NO”)

### FIXED CODE ###

nums = list(map(int,input().split()))
flag1 = 1 in nums and 9 in nums and 7 in nums and 4 in nums
if flag1 == True:
    print("YES")
else:
    print("NO")
import re
index = re.search(input(),'hi')
if index != -1:
    print("Yes")
else if :
    print("No")

### FIXED CODE ###

import re
index = re.fullmatch(r'(hi)+', input())
if index:
    print("Yes")
else:
    print("No")
import math

a = []
b = []
ans = 0
for i in range(5):
    a.append(int(input()))
ans = sum(a)
for i in range(5):
    tmp = a[i] % 10
    if tmp != 0:
        b.append(10 - tmp)
print(ans + sum(b) - max(b))


### FIXED CODE ###

import math

a = []
b = []
ans = 0
for i in range(5):
    a.append(int(input()))
ans = sum(a)
for i in range(5):
    tmp = a[i] % 10
    if tmp != 0:
        b.append(10 - tmp)
if len(b) == 0:
    print(ans)
else:
    print(ans + sum(b) - max(b))
n, m = map(int, input().split())
a = [list(input()) for _ in range(n)]
b = [list(input()) for _ in range(m)]

for nj in range(0, n - m):
    for ni in range(0, n - m):
        for i in range(m):
            for j in range(m):
                if a[nj][ni] == b[m-1][m-1]:
                    print("Yes")
                    exit()
                if a[nj][ni] != b[j][i]:
                    break
                nj += 1
            ni += 1

print("No")
    

### FIXED CODE ###

n, m = map(int, input().split())
a = [list(input()) for _ in range(n)]
b = [list(input()) for _ in range(m)]

si, sj = 0, 0
c = 0
while si <= n - m:
    ni, nj = si, sj
    rest = m ** 2
    for i in range(m):
        nj = sj
        for j in range(m):
            # print(ni, nj, i, j)
            if a[ni][nj] != b[i][j]:
                break
            nj +=1
            rest -= 1
        ni += 1
        # print()
    if rest == 0:
        print("Yes")
        exit()
    sj += 1
    if sj > n - m:
        si += 1
        sj = 0

print("No")
from math import factorial

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

def product(iterable):
    prod = 1
    for n in iterable:
        prod *= n
    return prod

def npr(n, r):
    return product(range(n - r + 1, n + 1))

def ncr(n, r):
    if r > n // 2:
        r = n - r
    return npr(n, r) // factorial(r)

v.sort();
revv=list(reversed(v))
print(sum(v[-a:])/a)

revpos=revv.index(v[-a]);
num=v.count(v[-a]);
ans=0;
if a == revpos:
    print(1);
else:
    for i in range(a-revpos, b-revpos+1):
        ans+=ncr(num, i);
    print(ans);


### FIXED CODE ###

from math import factorial

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

def product(iterable):
    prod = 1
    for n in iterable:
        prod *= n
    return prod

def npr(n, r):
    return product(range(n - r + 1, n + 1))

def ncr(n, r):
    if r > n // 2:
        r = n - r
    return npr(n, r) // factorial(r)

v.sort();
revv=list(reversed(v))
print(sum(v[-a:])/a)
revpos=revv.index(v[-a]);
num=v.count(v[-a]);
ans=0
if v[-1] == v[-a] == v[-a-1]:
    for i in range(a-revpos, b-revpos+1):
        if i > num:
            continue;
        ans+=ncr(num, i);
    print(ans);    
else:
    print(ncr(num,a-revpos));
def main():
    def ex_value(dice):
      n = 0
      for i in range(1,dice+1):
        n += i*1/dice
      return(n)
    n,k = map(int, input().split())
    list_p = list(map(int, input().split()))
    list_ex_val = list(map(ex_value, list_p))
    sum_k=[]
    for i in range(n-k+1):
        sum_k.append(sum(list_ex_val[i:i+k]))
    print(max(sum_k))

if __name__ == '__main__':
    main()

### FIXED CODE ###

s,t = map(str, input().split())
a,b = map(int, input().split())
u = str(input())

if s == u:
    print(a-1, b)
else:
    print(a, b-1)
N, D = [int (x) for x in input().split()]
X = N / (2 * D + 1)
if (X.is_integer()) print(X)
else print(X + 1)

### FIXED CODE ###

N, D = (int(x) for x in input().split())
X = N / (2 * D + 1)
#print(X)
if (X.is_integer()):
  print(int(X))
else:
  print(int(X) + 1)
import sys
#大きすぎるとダメ
sys.setrecursionlimit(2501)
h,w=map(int,input().split())
s=[list(input()) for i in range(h)]
inf=1000000000000000
d=[[inf]*w for i in range(h)]


def dfs(i,j):
    global h,w,s
    nex=[(0,-1),(0,1),(-1,0),(1,0)]
    for k in range(4):
        l,m=i+nex[k][0],j+nex[k][1]
        if 0<=i+nex[k][0]<h and 0<=j+nex[k][1]<w:
            if s[l][m]=="." and d[l][m]>d[i][j]+1:
                d[l][m]=d[i][j]+1
                dfs(l,m)
d[0][0]=0
dfs(0,0)
ans=0
for i in range(h):
    for j in range(w):
        if s[i][j]==".":
            ans+=1
if d[h-1][w-1]==inf:
    print(-1)
else:
    print(ans-d[h-1][w-1]-1)




### FIXED CODE ###

#一個だけRE、わからねえ
#解答見る
import sys
sys.setrecursionlimit(1005)
h,w=map(int,input().split())

def go_next(I,J,n):
    n+=1
    global dp,w,h
    if n>1000:
        return
    if 0<=I<h-1:
        if x[I+1][J]=="." and dp[I+1][J]>dp[I][J]+1:
            dp[I+1][J]=dp[I][J]+1
            go_next(I+1,J,n)
    if 0<I<=h-1:
        if x[I-1][J]=="." and dp[I-1][J]>dp[I][J]+1:
            dp[I-1][J]=dp[I][J]+1
            go_next(I-1,J,n)
    if 0<=J<w-1:
        if x[I][J+1]=="." and dp[I][J+1]>dp[I][J]+1:
            dp[I][J+1]=dp[I][J]+1
            go_next(I,J+1,n)
    if 0<J<=w-1:
        if x[I][J-1]=="." and dp[I][J-1]>dp[I][J]+1:
            dp[I][J-1]=dp[I][J]+1
            go_next(I,J-1,n)

x=[]
for i in range(h):
    x.append(list(input()))
#print(x)
c=0
for i in range(h):
    for j in range(w):
        if x[i][j]==".":
            c+=1
dp=[[10000000000 for i in range(w)]for j in range(h)]
dp[0][0]=1
go_next(0,0,0)
if dp[h-1][w-1]==10000000000:
    print(-1)
else:
    print(c-dp[h-1][w-1])
#!usr/bin/env python3

import sys


def string_to_list_spliter():
    n = sys.stdin.readline()
    lst = [int(i) for i in sys.stdin.readline().split()]
    return lst


def main():
    lst = string_to_list_spliter()
    print(min(lst), max(lst), sum())


if __name__ == '__main__':
    main()

### FIXED CODE ###

#!usr/bin/env python3

import sys


def string_to_list_spliter():
    lst = [int(i) for i in sys.stdin.readline().split()]
    return lst


def main():
    # XXX: N????????´??°??????????????????????????????AOJ?????£???????????????
    n = sys.stdin.readline()
    lst = string_to_list_spliter()
    print(min(lst), max(lst), sum(lst))


if __name__ == '__main__':
    main()
import math
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
if a(n-m)<math.ceil(sum(a)//(4*m)):
  print('No')
else:
  print('Yes')


### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
count=0
for i in a:
  if i>=sum(a)/(4*m):
    count+=1
if count>=m:
  print('Yes')
else:
  print('No')