Harryxun/stf_run huggingface dataset:
n = int(input())
AS = list(int,input().split())
AS.sort()
BS = list(int,input().split())
BS.sort()
CS = list(int,input().split())
CS.sort()
import bisect
AB  = [0 for _ in range(n)]
BC  = [0 for _ in range(n)]
a = 0
for b in range(n):
  AB[b] = bisect.bisect_left(AS,BS[b])
  
for b in range(n):
  BC[b] = n-bisect.bisect_left(CS,BS[b])

ans = 0
for i in range(n):
  ans += AB[b] * BS[b]
print(ans)
    

### FIXED CODE ###

n = int(input())
AS = list(map(int,input().split()))
AS.sort()
BS = list(map(int,input().split()))
CS = list(map(int,input().split()))
CS.sort()
import bisect
  
ans = 0
for b in range(n):
  ans += bisect.bisect_left(AS,BS[b])*(n-bisect.bisect_right(CS,BS[b]))

print(ans)
var N = 20;
var X = 12;
var T = 6;
var Z = N/X-N%T;
var time = Z*T;
print(time);

### FIXED CODE ###

A, B, C = map(int, input().split())

if A%B == 0:
	Z = A//B
else :
    Z = A//B + 1
time = Z*C

print(time)
a,b,c=int(input().sprit())
list=[a,b,c]
sorted(list)
if list==[5,5,7]：
  print("YES")
  else：
  print("NO")

### FIXED CODE ###

a,b,c=map(int,input().split())
list=[a,b,c]
list.sort()
if list==[5,5,7]:
    print("YES")
else:
    print("NO")
n = list(input())
for i in 3:
    if n[i] == "1":
        n[i] = "9"
    elif n[i] == "9":
        n[i] = "1"
for i in 3:
    print(i, end = "")

### FIXED CODE ###

n = list(input())

for i in range(3):
    if n[i] == "1":
        n[i] = "9"
    elif n[i] == "9":
        n[i] = "1"

for j in range(3):
  print(n[j], end="")
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
from math import pi, ceil, floor
import numpy as np
from collections import defaultdict, deque,Counter
from operator import itemgetter
from bisect import bisect_left, bisect_right, insort_left, insort_right
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
# INF = float("inf")


def main():
    n, m, q = map(int, input().split())
    l = [tuple(map(int, input().split())) for _ in range(q)]
    ans = 0
    for i in range(2 ** q):  # とるかとらないかの2択
        check = [0] * q
        for j in range(q):
            if i >> j & 1:
                check[j] = 1
        # print(check)
        A = [1] * n
        used = [0] * n
        tmp = 0
        for k in range(q):
            if check[k]:  # とる時
                a, b, c, d = l[k]
                a -= 1
                b -= 1
                if not used[b]:  # 使ってない時は変更できる
                    A[b] = c + A[a]
                    tmp += d
                    used[b] = 1  # 変更ずみにする
                    used[a] = 1
                    if A[b] > m:  # m以上の場合はダメ
                        tmp = 0
                        break
                elif A[b] == c + A[a]:  # たまたま変更してからあってたら追加
                    tmp += d
                else:  # 条件に合わない場合
                    tmp = 0
                    break
        ans = max(ans, tmp)
    print(ans)



if __name__ == '__main__':
    main()

### FIXED CODE ###

from itertools import permutations, accumulate, combinations, combinations_with_replacement
import sys
input = sys.stdin.readline


def main():
    n, m, q = map(int, input().split())
    # <方針>：Aを全列挙する
    ans = 0
    a = [0] * q
    b = [0] * q
    c = [0] * q
    d = [0] * q
    for i in range(q):
        a[i], b[i], c[i], d[i] = map(int, input().split())
        a[i] -= 1
        b[i] -= 1
    for A in combinations_with_replacement(range(1, m + 1), n):
        tmp = 0
        for i in range(q):
            if A[b[i]] - A[a[i]] == c[i]:
                tmp += d[i]
        ans = max(ans, tmp)
    print(ans)


if __name__ == '__main__':
    main()
s, t = input(), input()
s.sort()
t.sort(reverse=True)
if s < t:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s, t = list(input()), list(input())
s.sort()
t.sort(reverse=True)
S = ''.join(s)
T = ''.join(t)
if S < T:
    print('Yes')
else:
    print('No')
import os

def main():
  args = list(map(int, input().split()))
  nb = args[0]
  nl = args[1]
  if nb == 0 or (nl % 2 == 1):
    print('No')
    return
  if (nl / 4.0) > nb:
    print('No')
    return
  if (nl % ((nb - 1) * 2)) % 2 == 0:
    print('Yes')
  else:
    print('No')

if __name__ == '__main__':
  main()


### FIXED CODE ###

import os

def main():
  args = list(map(int, input().split()))
  nb = args[0]
  nl = args[1]
  if nb == 0 or (nl % 2 == 1) or nl == 0 or nb > nl or (nl / 4.0) > nb:
    print('No')
    return
  for i in range(nb + 1):
    if ((nb - i) * 4 + i * 2) == nl:
      print('Yes')
      return
  print('No')

if __name__ == '__main__':
  main()
from collections import deque
N, M = map(int, input().split())
A = list(int(input()) for _ in range(M))
A = deque(A)
P = 10**9 + 7

dp = [0] * (N+1)
dp[0] = 1
dp[1] = 1
if N == 1:
    print(1)
    quit()

a = -1
if len(A):
    a = A.popleft()
    if 1 == a:
        dp[1] = 0
        a = A.popleft()

for i in range(2, N+1):
    if i != a:
        dp[i] = (dp[i-1] + dp[i-2]) % P
    else:
        dp[i] = 0
        if len(A):
            a = A.popleft()
print(dp[N])

### FIXED CODE ###

N, M = map(int, input().split())
if N == 1:
    print(1)
    quit()
if M > N//2:
    print(0)
    quit()

A = list(int(input()) for _ in range(M))
idx = 0
P = 10**9 + 7

dp = [0] * (N+1)
dp[0] = 1
dp[1] = 1
a = -1
if len(A):
    if 1 == A[idx]:
        dp[1] = 0
        if idx < M-1:
            idx += 1

if len(A):
    for i in range(2, N+1):
        if i != A[idx]:
            dp[i] = (dp[i-1] + dp[i-2]) % P
        else:
            dp[i] = 0
            if idx < M-1:
                idx += 1
else:
    for i in range(2, N+1):
        dp[i] = (dp[i-1] + dp[i-2]) % P
print(dp[N])
n = int(input())
a = list(map(int, input().split()))
a.sort()
if a[0] == 0 and a[1] == 0:
    print(0)
    exit()
count = 1
ans = 1
for i in range(n-1):
    if a[i] == a[i+1]:
        count += 1
    else:
        ans *= count
        count = 1

    if count > 3:
        print(0)
        exit()
ans *= count
print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a.sort()
if n == 1:
    if a[0] == 0:
        print(1)
    else:
        print(0)
    exit()

mod = 10**9 + 7
if n % 2 == 1:
    if a[0] == 0 and a[1] == 0:
        print(0)
        exit()
    ans = 1
    for i in range(1, n, 2):
        if not(a[i] == a[i+1] and a[i] == i+1):
            print(0)
            exit()
        else:
            ans *= 2
    print(ans % mod)
else:
    ans = 1
    for i in range(0, n, 2):
        if not(a[i] == a[i+1] and a[i] == i+1):
            print(0)
            exit()
        else:
            ans *= 2
    print(ans % mod)
N, K = map(int,input().split())
a = [0] + list(map(int,input().split()))

journey = [1]

for i in range(N+1000):
    nxt = a[journey[-1]]
    journey.append(nxt)

if K <= N:
    print(journey[K])
    exit()

loop_start = N-1
loop_end   = N
 
while(journey[loop_start] != journey[loop_end]):
    loop_start -= 1
    
period = loop_end - loop_start

K %= period
while K < N:
  K += period

print(journey[K])


### FIXED CODE ###

N, K = map(int,input().split())
a = [0] + list(map(int,input().split()))

journey = [1]

for i in range(2*N+1000):
    nxt = a[journey[-1]]
    journey.append(nxt)

if K <= N:
    print(journey[K])
    exit()

loop_start = N-1
loop_end   = N
 
while(journey[loop_start] != journey[loop_end]):
    loop_start -= 1
    
period = loop_end - loop_start

K %= period
while K < N:
  K += period

print(journey[K])
s = input()
s_len = len(s)
if s_len % 2:
  print("No")
else:
  prev = 0
  count = 0
  for i in range(1, (s_len//2)+1):
    if [prev:i*2] != "hi":
      print("No")
      break
    else:
      count += 1
      prev = i * 2
  if count == s_len:
    print("Yes")

### FIXED CODE ###

s = input()
s_len = len(s)
if s_len % 2:
  print("No")
else:
  prev = 0
  count = 0
  for i in range(1, (s_len//2)+1):
    if s[prev*2:i*2] != "hi":
      print("No")
      break
    else:
      count += 1
      prev = i
  if count == s_len // 2:
    print("Yes")
a,b,c,k=map(int,input().split())
cake1=sort(map(int,input().split()),reverse=True)[:max(a,k)]
cake2=sort(map(int,input().split()),reverse=True)[:max(b,k)]
cake3=sort(map(int,input().split()),reverse=True)[:max(c,k)]
res=[]
for i in range(min(a,k)):
  for j in range(min(b,k)):
    for l in range(min(c,k)):
      if (a+1)*(b+1)*(c+1)<k:
        res.append(cake1[i]+cake2[j]+cake3[l])
res.sort(reverse=True)
for i in range(k):
  print(res[i])


### FIXED CODE ###

x, y, z, k = map(int, input().split())

xlist = sorted(list(map(int,input().split())), reverse=True)[:min(x, k)]
ylist = sorted(list(map(int,input().split())), reverse=True)[:min(y, k)]
zlist = sorted(list(map(int,input().split())), reverse=True)[:min(z, k)]


anslist = [0]
for i in range(min(x, k)):
    for j in range(min(y, k)):
        for l in range(min(z, k)):
            if (i+1)*(j+1)*(l+1) <= k:
                anslist.append(xlist[i] + ylist[j] + zlist[l])
            else:
                break

anslist = sorted(anslist, reverse=True)
for i in range(k):
    print(anslist[i])
N = int(input())

N = int(input())
power = 1
for i in range(N):
  power = power*(i+1) % (10**9+7)
  
print(power)

### FIXED CODE ###

N = int(input())
power = 1
for i in range(N):
  power = power*(i+1) % (10**9+7)
  
print(power)
N = int(input())
List = [int(input()) for i in range(N)]
x = len(List)

while sum(List) % 10 == 0:
  List.remove(min(List))
  if len(List) == 0:
    print(0)
    stop
  
print(sum(List))

### FIXED CODE ###

N=int(input())
List=[int(input()) for i in range(N)]
List.sort()
LIst=[]
total=sum(List)
for i in List:
  if i % 10 != 0:
      LIst.append(i)
      
if total % 10 != 0:
    print(total)
elif LIst == []:
    print(0)
else:
    print(total-LIst[0])
# -*- coding: utf-8 -*-
import numpy as np
def fnSolv():
  iNum, iK = map(int, input().split())
  naHn  = np.array(list(map(int, input().split())))
  naDP  = np.zeros(iNum, dtype='int64')
  naLen = np.ones(iK) * 10**9
  for iI0 in range(1, iK+1):
    naLen = naDP[0:iI0] + np.abs(- naHn[0:iI0] + naHn[iI0])
    naDP[iI0] = naLen.min()
  if iNum >= iK+1:
    for iI0 in range(iK+1, iNum):
      naLen = naDP[iI0-iK:iI0] + np.abs(- naHn[iI0-iK:iI0] + naHn[iI0])
      naDP[iI0] = naLen.min()
  print(naDP[iNum-1])

if __name__ == '__main__':
  fnSolv()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np
def fnSolv():
  iNum, iK = map(int, input().split())
  naHn  = np.array(list(map(int, input().split())))
  naDP  = np.zeros(iNum, dtype='int64')
  naLen = np.ones(iK) * 10**9
  for iI0 in range(1, iNum):
    iK0 = min([iK, iI0])
    naLen = naDP[iI0-iK0:iI0] + np.abs(- naHn[iI0-iK0:iI0] + naHn[iI0])
    naDP[iI0] = naLen.min()
  print(naDP[iNum-1])

if __name__ == '__main__':
  fnSolv()
# -*- coding: utf-8 -*-
from functools import reduce

def gcd(a, b):
    x = max(a, b)
    y = min(a, b)
    z = y
    while x%y != 0:
        z = x%y
        x = y
        y = z
    else:
        return z

def gcd_list(numbers):
    return reduce(math.gcd, numbers)


N = int(input())

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

print(gcd_list(A))

### FIXED CODE ###

# -*- coding: utf-8 -*-
from functools import reduce

def gcd(a, b):
    x = max(a, b)
    y = min(a, b)
    z = y
    while x%y != 0:
        z = x%y
        x = y
        y = z
    else:
        return z
            

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


N = int(input())

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

print(gcd_list(A))
l,r,d=map(int, split())
sum = 0
for i in range(l,r+1):
    if i % 2 == 0:
        sum += 1
print(sum)

### FIXED CODE ###

l,r,d=map(int, input().split())
sum = 0
for i in range(l,r+1):
    if i % d == 0:
        sum += 1
print(sum)
# coding: utf-8

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

c = 0
count = 0
imp = 0

while imp == 0:
    for i in range(0..N+1):
        if A[i] % 2 == 0:
            c += 1
            continue
        else:
            imp = 1
            break

    if c == N and imp == 0:
        for i in range(0..N+1):
            A[i] = int(A[i] / 2)
            count += 1

print(count)

### FIXED CODE ###

# coding: utf-8

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

count = 0
imp = 0

while True:
    for i in range(0, N):
        if int(A[i]) % 2 == 1:
            imp = 1
            break

    if imp == 1:
        break

    for i in range(0, N):
        A[i] = int(A[i] / 2)
    count += 1

print(count)
a, b = map(int,input().split())
d = (int)a/b
r = a%b
f = a/b
print("%d %d %.5f" %(d,r,f))

 

### FIXED CODE ###

a, b = map(int,input().split())
d = a // b 
r = a % b
f = a / b
print("%d %d %f" %(d,r,f))
def solve(N, W, w, v):
    dp = [[0]*(W+1) for _ in range(N+2)]
    for i in range(N):
        for sum_w in range(W):
            if sum_w+w[i] <=W:
                dp[i+1][sum_w+w[i]] = max(dp[i][sum_w+w[i]], dp[i][sum_w]+v[i])
        dp[i+2] = dp[i+1].copy()
    return max(dp[-1])

N, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]
w,v=[], []
for i in wv:
    w.append(i[0])
    v.append(i[1])

print(solve(N, W, w, v))

### FIXED CODE ###

import copy

def solve(N, W, w, v):
    dp = [[0]*(W+1) for _ in range(N+2)]
    for i in range(N):
        for sum_w in range(W):
            if sum_w+w[i] <=W:
                dp[i+1][sum_w+w[i]] = max(dp[i][sum_w+w[i]], dp[i][sum_w]+v[i])
        dp[i+2] = copy.copy(dp[i+1])
    return max(dp[-1])

N, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]
w,v=[], []
for i in wv:
    w.append(i[0])
    v.append(i[1])

print(solve(N, W, w, v))
X=input()
if (X>40||X<-40):
  return 0
  if(X=>30):
    print(Yes)
  else:
    print(No)


### FIXED CODE ###

x=input()
X=int(x)
if(X>=30 and X<=40):
  print('Yes')
elif(X>=-40 and X<30):
  print('No')
N,A,B=map(int,input().split())
ball=('b'*A+'r'*B)*10**7
if B <= N:
    print(ball.count('b',0,N))
else:
    print(N)



### FIXED CODE ###

N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9

def dfs(cur, a, b, c):
	if cur == N:
		return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
	ret0 = dfs(cur + 1, a, b, c)
 	ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
	ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
	ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
	return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))

### FIXED CODE ###

N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9

def dfs(cur, a, b, c):
  if cur == N:
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))
from functools import lru_cache

def sub():
    N, M = [int(e) for e in input().split()]
    
    class ListDict(dict):
        def __missing__(self, key):
            self[key] = []
            return self[key]

    d_edge = ListDict()
    for _ in range(M):
        h, t = [int(e) for e in input().split()]
        d_edge[h].append(t)

    # for k, v in d_edge.items():
    #     print(k,v)
    
    mem_dp_value = {}
    def dp(a_head):
        if a_head in mem_dp_value:
            return mem_dp_value[a_head]

        tails = d_edge[a_head]
        if len(tails) == 0:
            return 0
        tmps = [dp(t) for t in tails]
        ans = max(tmps) + 1
        mem_dp_value[a_head] = ans
        return ans
    
    heads = list(d_edge.keys())
    rr = [dp(h) for h in heads]
    print(max(rr))


if __name__ == "__main__":
    sub()


### FIXED CODE ###

from collections import defaultdict, deque
def sub():

    N, M = [int(e) for e in input().split()]
    es = [[int(x) for x in input().split()] for _ in range(M)]

    outs = defaultdict(list)
    ins = defaultdict(int)
    for v1, v2 in es:
        outs[v1].append(v2)
        ins[v2] += 1

    q = deque(v1 for v1 in range(1, N+1) if ins[v1] == 0)
    dp_table = [0 for i in range(N+1)]
    res = []
    while q:
        v1 = q.popleft()
        res.append(v1)
        for v2 in outs[v1]:
            ins[v2] -= 1
            if ins[v2] == 0:
                q.append(v2)
                dp_table[v2] = max(dp_table[v2], dp_table[v1] + 1)
    print(max(dp_table))

if __name__ == "__main__":
    sub()
r,g,d=map(int, input().spilit)
if (100r+10g+D)%4=0:
  print('YES')
else: print('NO')

### FIXED CODE ###

a,b,c= map(int, input().split())
if (100*a+10*b+c) % 4 == 0:
    print('YES')
else:
    print('NO')
while True:
    try:
        s=int(input().split(" "))
        s.sort
        if s[0]**2+s[1]**2=s[2]**:
            print("YES")
        else:
            print("NO")
    except:
        break

### FIXED CODE ###

n=int(input())
for i in range(n):
        s=input().split(" ")
        s=[int(j) for j in s]
        s.sort()
        
        if(s[0]**2+s[1]**2==s[2]**2):
            print("YES")

        else:
            print("NO")
import math

N,X = map(int,input().split())
x = input().split()
xls = []

for n in range(0,N):
    xls.append(int(x[n]))

xls.append(X)
xls.sort(reverse = True)

tousa = []

for n in range(0,N):
    tousa.append(xls[n]-xls[n+1])

if len(tousa) == 1:
    print(tousa[0])
    exit()
gcd = math.gcd(tousa[0],tousa[1])

for n in range(0,N):
    gcd = math.gcd(gcd,tousa[n])
    
print(gcd)


### FIXED CODE ###

import math

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


N,X = map(int,input().split())
x = input().split()
xls = []
 
for n in range(0,N):
    xls.append(int(x[n]))
 
xls.append(X)
xls.sort(reverse = True)
 
tousa = []
 
for n in range(0,N):
    tousa.append(xls[n]-xls[n+1])
 
if len(tousa) == 1:
    print(tousa[0])
    exit()
gcdd = gcd(tousa[0],tousa[1])
 
for n in range(0,N):
    gcdd = gcd(gcdd,tousa[n])
    
print(gcdd)
n = int(input())
a = [int(input()) for i in range(n)]
c = sorted(a,reverse=True)
if a.count(max(a))>1:
    for i in n:
        print(max(a))
else:
    for i in range(n):
        if i==a.index(max(a)):
            print(c[1])
        else:
            print(max(a))
    

    

### FIXED CODE ###

n = int(input())
a = [int(input()) for i in range(n)]
c = sorted(a,reverse=True)
b = max(a)
if a.count(b)>1:
    for i in range(n):
        print(b)
    exit()
for i in a:
    if i==b:
        print(c[1])
    else:
        print(b)
splited = input().split(' ')
N = int(splited[0])
K = int(splited[1])

if(K == 1):
    return 0
else
    return N - K

### FIXED CODE ###

splited = input().split(' ')
N = int(splited[0])
K = int(splited[1])
 
if(K == 1):
    print(0)
else:
    print(N - K)
h,w,m=map(int,input().split())
hw=[list(map(int,input().split())) for _ in range(m)]
numh=[[i,0] for i in range(h)]
numw=[[i,0] for i in range(w)]
m=[[0]*w for _ in range(h)]
for hi,wi in hw:
  numh[hi-1][1]+=1
  numw[wi-1][1]+=1
  m[hi-1][wi-1]=1
numh.sort(key=lambda x:x[1])
numw.sort(key=lambda x:x[1])
ansh=numh[-1][1]
answ=numw[-1][1]
if ansh+answ==1:
  print(1)
  exit()
# 答えはansh+answまたはansh+answ-1
hk=set(())
while numh and numh[-1][1]==ansh:
  hk.add(numh.pop()[0])
wk=set(())
while numw and numw[-1][1]==answ:
  wk.add(numw.pop()[0])

for wi in wk:
  for hi in hk:
    if m[hi][wi]==0:
      print(ansh+answ)
      exit()
print(ansh+answ-1)

### FIXED CODE ###

h,w,m=map(int,input().split())
hw=[list(map(int,input().split())) for _ in range(m)]
numh=[[i,0] for i in range(h)]
numw=[[i,0] for i in range(w)]
d=set(())
for hi,wi in hw:
  numh[hi-1][1]+=1
  numw[wi-1][1]+=1
  d.add((hi-1,wi-1))
numh.sort(key=lambda x:x[1])
numw.sort(key=lambda x:x[1])
ansh=numh[-1][1]
answ=numw[-1][1]
if ansh+answ==1:
  print(1)
  exit()
# 答えはansh+answまたはansh+answ-1
hk=set(())
while numh and numh[-1][1]==ansh:
  hk.add(numh.pop()[0])
wk=set(())
while numw and numw[-1][1]==answ:
  wk.add(numw.pop()[0])

for wi in wk:
  for hi in hk:
    if (hi,wi) not in d:
      print(ansh+answ)
      exit()
print(ansh+answ-1)
str=input()
x=len(str)
if x=2:
  print(str)
else:
  print(str[::-1])

### FIXED CODE ###

str=input()
x=len(str)
if x==2:
   print(str)
else:
   print(str[::-1])
N = int(input())
A = input().rstrip().split(' ')
sum = 0
for a in A:
    sum += 1/a
print(1/sum)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().rstrip().split(' ')))
sum = 0
for a in A:
    sum += 1/a
print(1/sum)
def binary_search(key):
    '''
    条件を満たす最小/最大のindexを求める
    '''
    ok = 10 ** 9 + 1  # 条件を満たすindexの上限値/下限値
    ng = -1           # 条件を満たさないindexの下限値/上限値
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2

        cnt = 0
        for v in a:
            cnt += (v + mid - 1) // mid - 1

        if cnt <= key:  # midが条件を満たすか否か
            ok = mid
        else:
            ng = mid
    
    return ok


n, k = map(int, input().split())
a = list(map(int, input().split()))

print(binary_search(k))

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))

hi = 10 ** 9
lo = 0
while hi - lo > 1:
    mid = (hi + lo) // 2

    cnt = 0
    for v in a:
        cnt += (v + mid - 1) // mid - 1

    if cnt <= k:
        hi = mid
    else:
        lo = mid

print(hi)
a, b = map(int, input().split())
num_list = list(map(int, input().split()))
k_sum = sum(num_list[0:b])
max_sum = k_sum
for i, j in zip(num_list[0:], num_list[k:]):
    k_sum -= i
    k_sum += j
    max_sum = max(max_sum, k_sum)
out = (max_sum + b) / 2
print(out)

### FIXED CODE ###

a, b = map(int, input().split())
num_list = list(map(int, input().split()))
k_sum = sum(num_list[0:b])
max_sum = k_sum
for i, j in zip(num_list[0:], num_list[b:]):
    k_sum -= i
    k_sum += j
    max_sum = max(max_sum, k_sum)
out = (max_sum + b) / 2
print(out)
radius = int(input())
answer = 2 * math.pi * radius
print(answer)

### FIXED CODE ###

from math import pi
radius = int(input())
answer = 2 * pi * radius
print(answer)
S = input()
T = input()
count = 0
for i in range(3):
  if s[i] == T[i]:
    count += 1
print(count)

### FIXED CODE ###

S = input()
T = input()
count = 0
for i in range(3):
  if S[i] == T[i]:
    count += 1
print(count)
n = int(input())
list = {1,2,4,8,16,32,64}

for i in range(7):
    if n <= list[i]:
        print(list[i-1])
        break


### FIXED CODE ###

n = int(input())
lst = [1,2,4,8,16,32,64,128]

for i in range(len(lst)):
    if n < lst[i]:
        print(lst[i-1])
        break
N=int(input())
B=list(map(int,input().split()))

A=[0,]
for i in range(N+1):
  a=min(B[i],B[i-1])
  A.append(a)
  
print(sum(A))

### FIXED CODE ###

N=int(input())
B=list(map(int,input().split()))
A=[]
B.insert(0,1000000)
B.append(1000000)
for i in range(1,N+1):
  a=min(B[i],B[i-1])
  A.append(a)
print(sum(A))
import numpy as np

N, Ma, Mb = map(int, input().split())

items = []
for i in range(N):
  items.append(list(map(int, input().split())))

items = np.array(items)

import itertools
l = list(itertools.product([False,True], repeat=N))

min_cost = 1000000000000000000
for comb in l[1:]:
  idx = np.where(comb)
  cost = items[idx,2].sum()
  if (items[idx,0].sum() == items[idx,1].sum()) & (cost < min_cost):
    min_cost = cost
print(min_cost)

### FIXED CODE ###

N, Ma, Mb = map(int, input().split())

items = []
mas = []
mbs = []
costs = []
for i in range(N):
  ma, mb, c = map(int, input().split())
  mas.append(ma)
  mbs.append(mb)
  costs.append(c)

max_cost = 5000
dp = [[[max_cost for k in range((N+1)*10)] for j in range((N+1)*10)] for i in range(N+1)]
dp[0][0][0] = 0

for i in range(N):
  for j in range(N*10):
    for k in range(N*10):
      if dp[i][j][k] == max_cost:
        continue
      if dp[i+1][j][k] > dp[i][j][k]:
        dp[i+1][j][k] = dp[i][j][k]
      if dp[i+1][j+mas[i]][k+mbs[i]] > dp[i][j][k] + costs[i]:
        dp[i+1][j+mas[i]][k+mbs[i]] = dp[i][j][k] + costs[i]
        
min_cost = max_cost
for wa in range(1, N*10):
  for wb in range(1, N*10):
    if (wa * Mb != wb * Ma):
      continue;
    if min_cost > dp[N][wa][wb]:
      min_cost = dp[N][wa][wb]

  
if min_cost == max_cost:
  print("-1")
else:
  print(min_cost)