Harryxun/stf_run huggingface dataset:
n = int(input())
a_ls = list(map(int, input().split()))
a_ls.sort()
num_total = a_ls[-1]
a_ls.pop()
def isOK(index, key, l):
    if l[index] >= key:
        return True
    else:
        return False
def meguru_search(l, key):
    '''
    key以上の値を持つ最小のインデックスを返す
    '''
    left = -1
    right = len(l)

    while (right - left) > 1:
        mid = left + (right - left) // 2
        # 直感的に記憶　
            # 「含まれている」んだったら「含むを許容（等号付き）する右側」はmidまで動かして問題ない
                # 新しいrightの位置がkeyの位置だとしても、「含む」は許容されてる
            # 「含まれていない」んだったら「含まない(<)左の壁」をそこまで動かしてもkeyを通り過ぎることはない
        if isOK(mid, key, l):
            right = mid
        else:
            left = mid
    
    # whileを抜ける時、rightとleftは一個差で、かつkeyがrightの位置にある
    return right

if num_total % 2 == 0:
    Max = num_total // 2
else:
    Max = num_total // 2 + 1
Maxind1 = meguru_search(a_ls, Max)
Maxind2 = Maxind1 - 1
abs_1 = abs(Max - a_ls[Maxind1])
abs_2 = abs(Max - a_ls[Maxind2])
if abs_1 > abs_2:
    r = a_ls[Maxind2]
else:
    r = a_ls[Maxind1]
print(num_total, r)
    


### FIXED CODE ###

n = int(input())
a_ls = list(map(int, input().split()))
if n > 2:
    a_ls.sort()
    num_total = a_ls[-1]
    a_ls.pop()
    def isOK(index, key, l):
        if l[index] >= key:
            return True
        else:
            return False
    def meguru_search(l, key):
        '''
        key以上の値を持つ最小のインデックスを返す
        '''
        left = -1
        right = len(l)

        while (right - left) > 1:
            mid = left + (right - left) // 2
            # 直感的に記憶　
                # 「含まれている」んだったら「含むを許容（等号付き）する右側」はmidまで動かして問題ない
                    # 新しいrightの位置がkeyの位置だとしても、「含む」は許容されてる
                # 「含まれていない」んだったら「含まない(<)左の壁」をそこまで動かしてもkeyを通り過ぎることはない
            if isOK(mid, key, l):
                right = mid
            else:
                left = mid
        
        # whileを抜ける時、rightとleftは一個差で、かつkeyがrightの位置にある
        return right

    if num_total % 2 == 0:
        Max = num_total // 2
    else:
        Max = num_total // 2 + 1
    Maxind1 = meguru_search(a_ls, Max)
    Maxind2 = Maxind1 - 1
    abs_1 = abs(Max - a_ls[Maxind1])
    abs_2 = abs(Max - a_ls[Maxind2])
    if abs_1 > abs_2:
        r = a_ls[Maxind2]
    else:
        r = a_ls[Maxind1]
    print(num_total, r)
else:
    print(max(a_ls), min(a_ls))
n=int(input())
a=[]
b=[]
c=[]
for i in range(n):
    d,e,f=map(int,input().split())
    a.append(d)
    b.append(e)
    c.append(f)
dp[0]=[a[0],b[0],c[0]]
for i in range(1,n):
    dp[i]=[dp[i-1][0]+max(b[i],c[i]),dp[i-1][1]+max(a[i],c[i]),dp[i-1][2]+max(b[i],a[i])]
print(dp[n-1])

### FIXED CODE ###

n=int(input())
dp=[0,0,0]
for i in range(n):
    a,b,c=map(int,input().split())
    dp=[max(dp[1],dp[2])+a,max(dp[0],dp[2])+b,max(dp[0],dp[1])+c]
print(max(dp))
a_sort =sorted(a)
cou = 0
for i in range(N):
    if x >= a_sort[i]:
        cou += 1
        x -= a_sort[i]
print(cou)

### FIXED CODE ###

N, x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a_sort =sorted(a)
cou = 0
for i in range(N):
    if x >= a_sort[i]:
        x -= a_sort[i]
        cou += 1
if x > 0 and cou == N:
    print(cou-1)
else:
    print(cou)
#!/usr/bin/env python3

from collections import defaultdict


class Graph(object):
    """ Graph data structure, undirected by default. """

    def __init__(self, connections, directed=False):
        self._graph = defaultdict(set)
        self._directed = directed
        self.add_connections(connections)

    def add_connections(self, connections):
        """ Add connections (list of tuple pairs) to graph """

        for u, v in connections:
            self.add(u, v)

    def add(self, u, v):
        """ Add connection between node u and node v """

        self._graph[u].add(v)
        if not self._directed:
            self._graph[v].add(u)

    def get_adj(self, v):
        """ Get adjacency list of node v """
        return self._graph[v]

    def __str__(self):
        return '{}({})'.format(self.__class__.__name__, dict(self._graph))


# -----
N, Q = map(int, input().split())
connections = []
for _ in range(N - 1):
    a, b = map(int, input().split())
    connections.append((a, b))
query = []
for _ in range(Q):
    p, x = map(int, input().split())
    query.append([p, x])
# print(N, Q)
# print(connections, query)

g = Graph(connections, directed=True)
# print(g)

keys = [v for v in range(1, N + 1)]
values = [0 for _ in range(N)]
counter = dict(zip(keys, values))
# print(counter)


def dfs(g, p, x):
    counter[p] += x
    for p_next in g.get_adj(p):
        dfs(g, p_next, x)


for p, x in query:
    dfs(g, p, x)

for c in counter.values():
    print(c, end=" ")


### FIXED CODE ###

#!/usr/bin/env python3

import sys

input = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 6)

N, Q = map(int, input().split())

edges = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)

query = []
for _ in range(Q):
    p, x = map(int, input().split())
    query.append([p, x])

counter = [0 for _ in range(N)]
for p, x in query:
    counter[p - 1] += x


def dfs(v, parent):
    for v_next in edges[v]:
        if v_next != parent:
            counter[v_next] += counter[v]
            dfs(v_next, v)


root = 0
dfs(root, None)

print(*counter)
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

n,m = map(int,input().split())
S = input()
T = input()

l = lcm(n,m)
c_max = max(n,m)
ans_s = [" "]*(l+1)
ans_t = [" "]*(l+1)
for i in range(n):
    ans_s[i*l//n+1] = S[i]
for i in range(m):
    ans_t[i*l//m+1] = T[i]
    
ans = l
for i in range(l+1):
    if ans_s[i] != " " and ans_t[i] != " " and ans_s[i] != ans_t[i]:
        ans = -1

print(ans)


### FIXED CODE ###

import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

n,m = map(int,input().split())
S = input()
T = input()

l = lcm(n,m)
i = 0
j = 0
ans = l
while i < n or j < m:
    temp_n = i*l//n+1
    temp_m = j*l//m+1
    if temp_n == temp_m:
        if S[i] != T[j]:
            ans = -1
            break
        i += 1
        j += 1
    elif temp_m > temp_n:
        i += 1
    else:
        j += 1

print(ans)
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n, m = MAP()
ans = [-1]*n

for i in range(m):
    s, c = MAP()
    s -= 1
    if ans[s] == -1 or ans[s] == c:
        ans[s] = c
    else:
        print(-1)
        exit()

if n != 1 and ans[0] == 0:
    print(-1)
    exit()
else:
    for i in range(m):
        if ans[i] == -1:
            if n != 1 and i == 0:
                ans[i] = 1
            else:
                ans[i] = 0
    print(*ans, sep='')

### FIXED CODE ###

from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n, m = MAP()
ans = [-1]*n

for i in range(m):
    s, c = MAP()
    s -= 1
    if ans[s] == -1 or ans[s] == c:
        ans[s] = c
    else:
        print(-1)
        exit()

if ans[0] == 0:
    if n == 1:
        print(0)
    else:
        print(-1)
    exit()
else:
    for i in range(n):
        if ans[i] == -1:
            if n != 1 and i == 0:
                ans[i] = 1
            else:
                ans[i] = 0
    print(*ans, sep='')
tx = [map(int, input().split())]
cx = sorted(tx)

for i in range(2):
    if cx[i] == cx[i+1]:
        print(sum(cx) - 2*int(cx[i]))
        break

### FIXED CODE ###

a, b, c = map(int, input().split())
lst = sorted([a, b, c])

for i in range(2):
    if lst[i] == lst[i+1]:
        print(sum(lst) - 2*lst[i])
n=input()
a=list(map(int,input().split()))
for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            pass
        else:
            print('DENIED')
            exit(0)
print('APPROVED')


### FIXED CODE ###

a=list(map(int,input().split()))
a.sort()
if a[0]==a[1]!=a[2] or a[0]!=a[1]==a[2]:
    print('Yes')
else:
    print('No')
S = input()
i = 0

while True:
    if len(S) == 0:
        print('YES')
        exit()
    if len(S) < 5:
        print('NO')
        exit()
    if S[:5] == 'dream':
        if S[5:7] == 'er':
            if S[7] == 'a':
                S = S[5:]
            else :
                S = S[7:]
        else :
            S = S[5:]
    elif S[:5] == 'erase':
        if S[5] == 'r':
            S = S[6:]
        else :
            S = S[5:]
    else :
        print('NO')
        exit()

### FIXED CODE ###

S = input()

while True:
    if len(S) == 0:
        print('YES')
        exit()
    if len(S) < 5:
        print('NO')
        exit()
    if S[:5] == 'dream':
        if len(S) > 6 and S[5:7] == 'er':
            if len(S) > 7 and S[7] == 'a':
                S = S[5:]
            else :
                S = S[7:]
        else :
            S = S[5:]
    elif S[:5] == 'erase':
        if len(S) > 5 and S[5] == 'r':
            S = S[6:]
        else :
            S = S[5:]
    else :
        print('NO')
        exit()
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1E9 + 9;
const int INF = 1<<29; 

long long f(long long x){
    if(x == 1) return 1;
    return f(x/2) * 2 + 1;
}

int main(){
    long long H;
    cin >> H;
    cout << f(H) << endl;
    return 0;
}

### FIXED CODE ###

import numpy as np
import math
H = int(input())

cnt = np.log2(H)
cnt = math.floor(cnt)
cnt = 2**(cnt + 1) - 1
print(cnt)
N,X = (input().split())
L = list(map(int, input().split()))
x = int(X)
n = int(N) + 1
position = 0
count = 0
while position <= x:
    position += L[count]
    count += 1
if n > count:
    print(count)
else:
    print(n)


### FIXED CODE ###

n, x = list(map(int, input().split()))
li = list(map(int, input().split()))

ans = 1
pos = 0
for i in range(n):
	pos = pos + li[i]
	if pos <= x:
		ans += 1
print(ans)
n, m = map(int, input().split())
a = set()
for i in range(m):
    a.add(int(input()))
dp = [0] * (n+1)
dp[0] = 1
if not(1 in a):
    dp[1] = 1
if not(2 in a):
    dp[2] = 1
for i in range(2,n+1):
    if i-1 in a:
        dp[i] = dp[i-2]
        dp[i-1] = 0
    else:
        dp[i] = dp[i-1] + dp[i-2]
#print(dp)
print((dp[n])%1000000007)

### FIXED CODE ###

n, m = map(int, input().split())
a = set()
for i in range(m):
    a.add(int(input()))
dp = [0] * (n+1)
dp[0] = 1
if not(1 in a):
    dp[1] = 1

for i in range(2,n+1):
    if i-1 in a:
        dp[i] = dp[i-2]
        dp[i-1] = 0
    else:
        dp[i] = dp[i-1] + dp[i-2]
#print(dp)
print((dp[n])%1000000007)
import math
a,b = map(int,input().split())
ans = a * b // math.gcd(a, b)
print(ans)

### FIXED CODE ###

import fractions
a,b = map(int,input().split())
ans = a * b // fractions.gcd(a, b)
print(ans)
import math
a,b,c=map(int,input().split())
if a+b<c and 4*a*b<(c-a-b)**2
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a,b,c=map(int,input().split())
if a+b<c and 4*a*b<(c-a-b)**2:
    print("Yes")
else:
    print("No")
def gcd(a,b):
    if a<b:
        t = a
        a = b
        b = t
    if b == 0:
        return a
    t = b
    b = a%b
    a = t
    return gcd(a,b)

def lcm(a,b):
    return a*b/gcd(a,b)

N = int(input())
ans = int(input())
for k in range(N-1):
    ans = int(lcm(ans, int(input())))

print(ans)


### FIXED CODE ###

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

def lcm(a,b):
    return a*b//gcd(a,b)

N = int(input())
ans = 1
for k in range(N):
    ans = lcm(ans, int(input()))

print(ans)
N=int(input())

l=list(map(int,input().split()))
l[0]-=1
switch=True

for i in range(N-1):

    if l[i+1]==l[i]:
        pass
    elif l[i+1]>l[i]:
        l[i+1]-=1
    else:
        print("No")
        Switch=False
        break
    if i==N-2:
        print("Yes")
        Switch=False
    
if Switch:
    print("No")



### FIXED CODE ###

N=int(input())

l=list(map(int,input().split()))
l[0]-=1
Switch=True

for i in range(N-1):

    if l[i+1]==l[i]:
        pass
    elif l[i+1]>l[i]:
        l[i+1]-=1
    else:
        print("No")
        Switch=False
        break
    if i==N-2:
        print("Yes")
        Switch=False
    
if Switch:
    print("Yes")
MOD = 10 ** 9 + 7
n, m = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

# 前計算
for i in range(n - 1):
    x[i] = x[i + 1] - x[i]

for i in range(m - 1):
    y[i] = y[i + 1] - y[i]

N = [n - 1]
for i in range((n)//2 - 1):
    N.append((N[i] + (n - 1 - 2 * (i + 1))) % MOD)

M = [m - 1]
for i in range((m)//2 - 1):
    M.append((M[i] + (m - 1- 2 * (i + 1))) % MOD)

if N[0] % 2 == 0:
    N += N[::-1]
elif N[0] != 1:
    N += N[1::-1]
if M[0] % 2 == 0:
    M += M[::-1]
elif M[0] != 1:
    M += M[1::-1]

X_sum = 0
for i in range(n - 1):
    X_sum += x[i] * N[i]
    X_sum %= MOD

Y_sum = 0
for i in range(m - 1):
    Y_sum += y[i] * M[i]
    Y_sum %= MOD

print ((X_sum * Y_sum) % MOD)

### FIXED CODE ###

MOD = 10 ** 9 + 7
n, m = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

# 前計算
for i in range(n - 1):
    x[i] = x[i + 1] - x[i]

for i in range(m - 1):
    y[i] = y[i + 1] - y[i]

N = [n - 1]
for i in range(n - 3, 0, -2):
    N.append(N[-1] + i)
    # N.append((N[i] + (n - 1 - 2 * (i + 1))) % MOD)

M = [m - 1]
for i in range(m - 3, 0, -2):
    M.append(M[-1] + i)
    # M.append((M[i] + (m - 1- 2 * (i + 1))) % MOD)

if N[0] % 2 == 0:
    N += N[::-1]
elif N[0] != 1:
    N += N[-2::-1]

if M[0] % 2 == 0:
    M += M[::-1]
elif M[0] != 1:
    M += M[-2::-1]

# print (x)
# print (y)
# print (N)
# print (M)

if len(x) - 1 > len(N):
    while True:
        pass

if len(y) - 1 > len(M):
    while True:
        pass


X_sum = 0
for i in range(n - 1):
    X_sum += x[i] * N[i]
    X_sum %= MOD

Y_sum = 0
for i in range(m - 1):
    Y_sum += y[i] * M[i]
    Y_sum %= MOD

print ((X_sum * Y_sum) % MOD)
input = input()
num = 0

for i in range(3):
  if (input[i] == 1):
    num++

print(i)

### FIXED CODE ###

input = str(input())
num = 0

for i in input:
  if i == "1":
    num += 1
    
print(num)
if S[K-1] == "A":
    S[K-1] = "a"
elif S[K-1] == "B":
    S[K-1] = "b"
elif S[K-1] == "C":
    S[K-1] = "c"

print("".join(S))

### FIXED CODE ###

n, k = map(int,input().split())
s = list(input())
 
if s[k-1] == "A":
  s[k-1] = "a"
elif s[k-1] == "B":
  s[k-1] = "b"
elif s[k-1] == "C":
  s[k-1] = "c"
 
print("".join(s))
n = int(input())
mod = 10 ** 9 + 7
import numpy as np
a = list(map(int, input().split())
s=0
ss=0
for i in range(n):
    ss += a[i]%mod
    s += ss * a[i] % mod
print(s)


### FIXED CODE ###

n = int(input())
mod = 10 ** 9 + 7
import numpy as np
a = list(map(int, input().split()))
s=0
ss=0
for i in range(n):
    if i > 0:
        ss += a[i-1]%mod
    s += ss * a[i] % mod
print(s%mod)
X, N = map(int, input().split())
P = list(map(int, input().split()))

if N == 0:
    print(X)
    sys.exit()

p_set = set(P)

if not (X in p_set):
    print(X)
    sys.exit()

for i in range(1, 100):
    if not (X-i in p_set):
        print(X-i)
        break
    if not (X+i in p_set):
        print(X+i)
        break

### FIXED CODE ###

import sys

X, N = map(int, input().split())
P = list(map(int, input().split()))

if N == 0:
    print(X)
    sys.exit()

p_set = set(P)

if not (X in p_set):
    print(X)
    sys.exit()

for i in range(1, 100):
    if not (X-i in p_set):
        print(X-i)
        break
    if not (X+i in p_set):
        print(X+i)
        break
N=int(input())
A=list(map(int,input().split()))
s=0
for i in range(N-1):
  for j in range(i+1,N):
    if all(A[i]!=A[j]):
      print("YES")
    else:
      print("NO")

### FIXED CODE ###

N=int(input())
A=map(int,input().split())
n=len(set(A))
if N!=n:
  print("NO")
else:
  print("YES")
from math import pi
r=float(raw_input)

print ("{0:6f}{1:6f}").format(r*r*pi,2*r*pi)

### FIXED CODE ###

from math import pi
r=float(raw_input())
print ("{0:.6f} {1:6f}").format(r*r*pi,2*r*pi)
n, m = [int(s) for s in input().split()]
s = [int(s) for s in input()]
board = [None]*(n+1)
left = 0
for i in range(1,n+1):
    if s[i]:
        continue
    left = max(left, i-m)
    while s[left]:
        left += 1
        if left >= i:
            break
    if left < i:
        board[i] = left
if board[n] is None:
    print(-1)
else:
    steps = []
    j = n
    while j > 0:
        step = j - board[j]
        steps.append(step)
        j = board[j]
    print(' '.join(str(s) for s in steps[::-1]))

### FIXED CODE ###


n, m = [int(s) for s in input().split()]
s = [int(s) for s in input()]
board = [None]*(n+1)
left = 0
board[left] = 0
for i in range(1,n+1):
    if s[i]:
        continue
    left = max(left, i-m)
    while board[left] is None:
        left += 1
        if left == i:
            break
    if left < i:
        board[i] = left
# print(board)
if board[n] is None:
    print(-1)
else:
    steps = []
    j = n
    while True:
        step = j - board[j]
        steps.append(step)
        j = board[j]
        if j==0:
            break
    print(' '.join(str(s) for s in steps[::-1]))
def exists(value,n,ms,cs):
    if (len(value) != n):
        return False
    if len(value) < max(ms):
        return False
    if not all([value[i-1] == c for i,c in zip(ms,cs)]:
        return False
    return True
def unzip(li):
    return list(map(list, zip(*li)))
n,m = [int(e) for e in input().split()]
m = [input().split() for e in range(m)]
ms,cs = unzip(m)
ms = [int(e) for e in ms]
result = -1
for i in range(1000):
    if exists(str(i),n,ms,cs):
        result = i
        break
print(result)

### FIXED CODE ###

n,m = map(int,input().split())
sc = [[i for i in map(int,input().split())] for j in range(m)]
start = 0
goal = 0
if n==1:
  start = 0
  goal = 9
elif n==2:
  start = 10
  goal = 99
elif n==3:
  start = 100
  goal = 999

flag = 1
ans = -1
for num in range(start,goal+1):
  flag = 1
  for i in range(m):
    if str(num)[sc[i][0]-1] != str(sc[i][1]): #両辺ともちゃんとstrで変換
      flag = 0
  if flag == 1:
    ans = num
    break

print(ans)
while 1:
   H, W = map(int, raw_input().split())
           
   if H == 0 and W == 0:
      break
   for i in range(H):
      if i%2 == 0:
         if W%2 == 0:
            print "#."*(W/2)
         else:
            print "#."*(w/2)+"#"
      else:
         if W%2 == 0:
            print ".#"*(W/2)
         else:
            print ".#"*(w/2)+"."
   print ""

### FIXED CODE ###

while 1:
   H, W = map(int, raw_input().split())
           
   if H == 0 and W == 0:
      break
   for i in range(H):
      if i%2 == 0:
         if W%2 == 0:
            print "#."*(W/2)
         elif W%2 == 1:
            print "#."*(W/2)+"#"
      elif i%2 == 1:
         if W%2 == 0:
            print ".#"*(W/2)
         elif W%2 == 1:
            print ".#"*(W/2)+"."
   print ""
word = string(input().lower())
texts = []
while TRUE:
  str = input()
  if str == 'END_OF_TEXT':
    break
  str = str.lower()
  texts.extends([s.lower() for s in str.split()] )
    

ans = texts.count(word)

print ans

### FIXED CODE ###

word = input().lower()
texts = []
while True:
  str = input()
  if str == 'END_OF_TEXT':
    break
  texts.extend([s.lower() for s in str.split()] )
    

ans = texts.count(word)

print(ans)
a, b, c, d, e, k = map(int, input().split())
print("Yey!" if (e-a)<=k else ":(")

### FIXED CODE ###

a, b, c, d, e, k = [int(input()) for i in range(6)]
print("Yay!" if (e-a)<=k else ":(")
d=T*S
if d>D:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

A=input()
A=A.split()
D=int(A[0])
T=int(A[1])
S=int(A[2])

if S*T>=D:
  print("Yes")
else:
  print("No")
a, b, c, d = input().split(" ")
print(abs(a - c) >= d || (abs(a - b) >= d && abs(b - c) >= d))


### FIXED CODE ###

a, b, c, d = input().split(" ")
a = int(a)
b = int(b)
c = int(c)
d = int(d)
if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
    print("Yes")
else:
    print("No")
import numpy as np

def solve(n, k, aaa, fff):
  aaa = np.sort(aaa)
  fff = np.sort(fff)[::-1]
  
  l = 0
  r = 10**12
  while l<=r:
    m = (l+r)//2
    req = np.clip(aaa - m//fff, 0, Nonw).sum()

    if req < k:
      r = m-1
    else:
      l = m+1

  return l


N, K = map(int,input().split())
aaa = np.array(list(map(int,input().split())))
fff = np.array(list(map(int,input().split())))

print(solve(N, K, aaa, fff)


### FIXED CODE ###

import numpy as np

def solve(n, k, aaa, fff):
  aaa = np.sort(aaa)
  fff = np.sort(fff)[::-1]
  
  l = 0
  r = 10**12
  while l<=r:
    m = (l+r)//2
    req = np.clip(aaa - m//fff, 0, None).sum()

    if req <= k:
      r = m-1
    else:
      l = m+1

  return l


N, K = map(int,input().split())
aaa = np.array(list(map(int,input().split())))
fff = np.array(list(map(int,input().split())))

print(solve(N, K, aaa, fff))
a=list(input().split())
if a[1]==a[2]==a[3]:
  print('No')
else:
  print('Yes')


### FIXED CODE ###

a=list(input())
if a[0]==a[1]==a[2]:
  print('No')
else:
  print('Yes')
NK = list(map(int, input().split()))
a = [0]*NK[0]
for i in range(len(a)):
    a[i] = int(input())
a.sort()

b = [0]*NK[1]
offsets = [0]*(NK[0]-NK[1]+1)
for i in range(len(offsets)):
    for j in range(NK[1]):
        b[j] = a[i+j]
    offsets[i] = b[K-1] - b[0]

print(min(offsets))


### FIXED CODE ###

NK = list(map(int, input().split()))
a = [0]*NK[0]
for i in range(len(a)):
    a[i] = int(input())
a.sort()
N = NK[0]
K = NK[1]

minimum = a[N-1]
for i in range(N-K+1):
    offset = a[i+K-1] - a[i]
    if minimum > offset:
        minimum = offset

print(minimum)
import sympy

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

count = 0
z = sympy.divisors(N)

if N == 1:
    print(0)
    exit()

elif len(z) == 2:
    print(1)
    exit()

else:
    for i in range(1, len(z)):
        if N%z[i] == 0:
            count += 1
            N = N/z[i]

print(count)


### FIXED CODE ###

import collections
N = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
# = [list(map(int, input().split())) for i in range(N)]
count = 0

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

c = collections.Counter(prime_factorize(N))
C = list(c.items())

if len(list(c.keys()))==1:
    for j in range(1, C[0][1]+1):
        if N%(C[0][0]**j) == 0:
            count += 1
            N /= C[0][0]**j

else:
    for i in range(len(C)):
        for j in range(1, C[i][1]+1):
            if N%(C[i][0]**j) == 0:
                count += 1
                N /= (C[i][0]**j)

print(count)
n, k = map(int, input().split())
import math
def kai(x):
  if x == 0:
    return 1
  else:
    return math.factorial(x)
  
for i in range(1, k+1):
  print(int(((kai(k-1)*kai(n-k+1)/(kai(i-1)*kai(k-i)*kai(i)*kai(n-k+1-i))) % (10**9 +7))//1))




### FIXED CODE ###

n, k = map(int, input().split())
import math
mod = (10**9) +7
def kai(x):
  if x == 0:
    return 1
  elif x < 0:
    return 1
  else:
    return math.factorial(x)
  
for i in range(1, k+1):
  if n - k  + 1 >= i:
    result = (kai(k-1)*kai(n-k+1))//(kai(i-1)*kai(k-i)*kai(i)*kai(n-k+1-i))
    result2 = result % mod
    print(result2)
  else:
    print(0)