Harryxun/stf_run huggingface dataset:
a,b,c,d,e,f = map(int, input().split())
g = max(a, b)
h = min(a, b)
salt = []
water = []
concentration = 0

for i in range(int(e*f/(c*100)) + 1):
    j = 0
    while e*f/100 >= c*i +d*j:
        salt.append(c*i+d*j)
        j += 1
salt.sort()

for i in range(int(f/(100*g))+1):
    j = 0
    while f >= 100*(g*i+h*j):
        water.append(100*(g*i+h*j))
        j += 1
water.sort()
water = water[1:]

for i in range(len(water)):
    addsalt = min(water[i] * e // 100, f - water[i])
    while addsalt not in salt and addsalt > 0:
        addsalt -=1
    if concentration < addsalt / (water[i] + addsalt):
        concentration = addsalt / (water[i] + addsalt)
        salt1 = addsalt
        water1 = water[i]

print(salt1+water1, salt1)

### FIXED CODE ###

a,b,c,d,e,f = map(int, input().split())
g = max(a, b)
h = min(a, b)
salt = []
water = []
concentration = 0

for i in range(int(e*f/(c*100)) + 1):
    j = 0
    while e*f/100 >= c*i +d*j:
        salt.append(c*i+d*j)
        j += 1
salt.sort()

for i in range(int(f/(100*g)) + 1):
    j = 0
    while f >= 100*(g*i+h*j):
        water.append(100*(g*i+h*j))
        j += 1
water.sort()
water = water[1:]

for i in range(len(water)):
    addsalt = min(water[i] * e // 100, f - water[i])
    while addsalt not in salt:
        addsalt -=1
    if concentration < addsalt / (water[i] + addsalt):
        concentration = addsalt / (water[i] + addsalt)
        salt1 = addsalt
        water1 = water[i]

try:
    print(salt1+water1, salt1)
except NameError:
    print(water[0], 0)
weekday = [SUN,MON,TUE,WED,THU,FRI,SAT]
s = input()

if(s == "SUN"):
    print("7")
if(s == "MON"):
    print("6")
if(s == "TUE"):
    print("5")
if(s == "WED"):
    print("4")
if(s == "THU"):
    print("3")
if(s == "FRI"):
    print("2")
if(s == "SAT"):
    print("1")

### FIXED CODE ###

n = input()

if(n == "SUN"):
    print(7)
elif (n == "MON"):
    print(6)
elif (n == "TUE"):
    print(5)
elif (n == "WED"):
    print(4)
elif (n == "THU"):
    print(3)
elif (n == "FRI"):
    print(2)
elif (n == "SAT"):
    print(1)
N, M = map(int, input().split())
num = ['a'] * N
for i in range(M):
    s, c = map(int, input().split())
    if num[s-1] == 'a':
        num[s-1] = str(c)
    elif num[s-1] == str(c):
        continue
    else:
        num.append('B')

if M == 0 and N != 1:
    num[0] = 1
elif M == 0 and N == 1:
    num[0] = 0
elif num[0] == 'a' and M != 0:
    num[0] = '1'

for i in range(1,N):
    if num[i] == 'a':
        num[i] = '0'

if num[-1] == 'B':
    print(-1)
elif N == 1:
    print(''.join(num) if num[-1] != 'B' else -1)
elif num[0] == '0':
    print(-1)
else:
    print(''.join(num) if num[-1] != 'B' else -1)

### FIXED CODE ###

import sys
N,M = map(int, input().split())
num = ['B'] * N
for _ in range(M):
    s,c = map(int, input().split())
    if num[s-1] != 'B' and num[s-1] != c:
        num.append('No')
    else:
        num[s-1] = c

if N == 1 and num[0] == 'B':
    num[0] = 0
    
if N > 1 and num[0] == 'B':
    num[0] = 1

if 'No' in num:
    print(-1)
    sys.exit()
elif N > 1 and num[0] == 0:
    print(-1)
    sys.exit()
    
for i in range(1,N):
    if num[i] == 'B':
        num[i] = 0

for i in range(N):
    num[i] = str(num[i])

print(''.join(num))
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read() for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret

# 全探索だと
# 3^N通りになってTLEだこれ

# 制限がなければ、iごとにmaxを取っておわりO(N)

# iの時の最善の状態が[i,j](jは行動)のとき、i+1最善の状態は[i+1,k](k!=j)となる
# これはDPで実装できそう！


# import numpy as np

N = read_a_int()
ABC = np.array(read_matrix(N))
# A, B, C = read_col(N, 3)

dp = np.full((N, 3), -float('inf'))
# 0->a,1->b,2->c

dp[0, :] = ABC[0]

for i in range(N - 1):
    dp[i + 1, 0] = dp[i, 1:].max()+ABC[i+1, 0]
    dp[i + 1, 1] = dp[i, (0, 2)].max() + ABC[i+1, 1]
    dp[i + 1, 2] = dp[i, :2].max()+ABC[i+1, 2]

# print(dp)
print(int(dp[N-1].max()))

### FIXED CODE ###

import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read() for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret

# 全探索だと
# 3^N通りになってTLEだこれ

# 制限がなければ、iごとにmaxを取っておわりO(N)

# iの時の最善の状態が[i,j](jは行動)のとき、i+1最善の状態は[i+1,k](k!=j)となる
# これはDPで実装できそう！


# import numpy as np

N = read_a_int()
# ABC = np.array(read_matrix(N))
# # A, B, C = read_col(N, 3)

# dp = np.full((N, 3), -float('inf'))
# # 0->a,1->b,2->c

# dp[0, :] = ABC[0]

# for i in range(N - 1):
#     dp[i + 1, 0] = dp[i, 1:].max()+ABC[i+1, 0]
#     dp[i + 1, 1] = dp[i, (0, 2)].max() + ABC[i+1, 1]
#     dp[i + 1, 2] = dp[i, :2].max()+ABC[i+1, 2]

# # print(dp)
# print(int(dp[N-1].max()))

# TLEしたのでpypy3仕様にかきなおし

ABC = read_matrix(N)

# dp = np.full((N, 3), -float('inf'))
dp = [[-float('inf') for _ in range(3)] for _ in range(N)]
# 0->a,1->b,2->c

for i in range(3):
    dp[0][i] = ABC[0][i]

for i in range(N - 1):

    for j in range(3):
        iterlist = [0, 1, 2]
        iterlist.remove(j)
        dp[i+1][j] = max([dp[i][k] + ABC[i+1][j] for k in iterlist])

# print(dp)
print(int(max(dp[-1])))
arr = input()
arr = ''.join(reversed(arr))
print(arr[:arr.index('B')])


### FIXED CODE ###

arr = input()
new = ""
for x in arr:
    if x == "B":
        if new:
            new = new[:-1]
    else:
        new += x
print(new)
N,K=map(int,input().split())
import math
s=N
q=0 #qは０点になる場合の数
if N>=K:
  for i in range(K):
    if (K//i)%2!=0:
      q+=int(math.log(K//i,2))+1
    else:
      q+=int(math.log(K//i,2))
else:
  for i in range(N+1):
    if (K//i)%2!=0:
      q+=int(math.log(K//i,2))+1
    else:
      q+=int(math.log(K//i,2))
print(s/(s+q))
    
  
  

### FIXED CODE ###

N,K=map(int,input().split())
i=0
q=0 #確率
for j in range(1,N+1):
  while j*(2**i)<K:
    i+=1
  q+=(1/N)*((1/2)**i)
  i=0
print(q)
import numpy as np
import itertools
def p(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
n=int(input())
p=p(n)
if len(p)==1:
    print(p[0]-1)
    exit()
a=10**12
b=1
for i in p:
    b*=i
pp=int(len(p)**0.5) 
for k in range(pp,min(len(p),pp+5)):    
    for i in itertools.combinations(p, k):
        c=np.prod(i)
        a=min(a,c+b//c)
print(a-2)

### FIXED CODE ###

n=int(input())
a=10**12
for i in range(1,int(n**0.5)+2):
    if n%i==0:
        a=min(a,i+n//i-2)
print(a)
# coding: utf8
# 日本語を入力できるようにするために上記一文が必要

import math

N = int(input())

if N == 1:
        print(0)
elif N == 2:
        print(1)
else:
        ans = math.factorial(N)*(10**(N -2))


print(ans%(10**9+7))

### FIXED CODE ###

# coding: utf8
# 日本語を入力できるようにするために上記一文が必要

x = int(input())

if x == 0:
        print(1)
elif x == 1:
        print(0)
N = list(input())
f_N = 0
[f_N += int(i) for i in N]
print('Yes') if int(''.join(N))%f_N == 0 else print('No')

### FIXED CODE ###

N = list(input())
f_N = 0
for i in N:
  f_N += int(i)
print('Yes') if int(''.join(N))%f_N == 0 else print('No')
lh, lw = input().split()
h, w = input().split()

print(lh * lw - lh * w - lw * h + h + w)


### FIXED CODE ###

lh, lw = map(int, input().split())
h, w = map(int, input().split())

print(lh * lw - lh * w - lw * h + h * w)
# 早くなるおまじない
import sys
input = sys.stdin.buffer.readline

# 再帰関数の呼び出し制限
sys.setrecursionlimit(3 * 10 ** 5)

# 深さが一つ前のやつのresの値を足す
# dfsはおk，ここで累積和を使う発想が出てこなかった
def dfs(node, prev):
    visited.add(node)
    if prev != 0:
        res[node-1] += res[prev-1]
    for i in dic[node]:
        if i not in visited:
            prev = node
            dfs(i, prev)


def main():
    n,q = map(int,input().split())

    dic = {}
    for i in range(n-1):
        aa, bb = map(int,input().split())

        if aa not in dic:
            dic[aa] = set()
            dic[aa].add(bb)
        else:
            dic[aa].add(bb)

        if bb not in dic:
            dic[bb] = set()
            dic[bb].add(aa)
        else:
            dic[bb].add(aa)


    p = []
    x = []
    for _ in range(q):
        s, t = map(int,input().split())
        p.append(s)
        x.append(t)

    res = [0]*n
    for i in range(q):
        res[p[i]-1] += x[i]

    visited = set()

    dfs(1, 0)
    print(*res, sep=" ")

if __name__ == '__main__':
    main()

### FIXED CODE ###

# 早くなるおまじない
import sys
input = sys.stdin.buffer.readline

# 再帰関数の呼び出し制限
sys.setrecursionlimit(3 * 10 ** 5)

# 深さが一つ前のやつのresの値を足す
# dfsはおk，ここで累積和を使う発想が出てこなかった
# def dfs(node, prev):
#     visited.add(node)
#     if prev != 0:
#         res[node-1] += res[prev-1]
#     for i in dic[node]:
#         if i not in visited:
#             prev = node
#             dfs(i, prev)

def dfs(node, prev, visited, res, dic):
    visited.add(node)
    if prev != 0:
        res[node-1] += res[prev-1]
    for i in dic[node]:
        if i not in visited:
            prev = node
            dfs(i, prev, visited, res, dic)


def main():
    n,q = map(int,input().split())

    dic = {}
    for i in range(n-1):
        aa, bb = map(int,input().split())

        if aa not in dic:
            dic[aa] = set()
            dic[aa].add(bb)
        else:
            dic[aa].add(bb)

        if bb not in dic:
            dic[bb] = set()
            dic[bb].add(aa)
        else:
            dic[bb].add(aa)


    p = []
    x = []
    for _ in range(q):
        s, t = map(int,input().split())
        p.append(s)
        x.append(t)

    res = [0]*n
    for i in range(q):
        res[p[i]-1] += x[i]

    visited = set()

    dfs(1, 0, visited, res, dic)
    print(*res, sep=" ")

if __name__ == '__main__':
    main()
W, H, x, y, r = map(int, input().split())
 
if (x + r) <= W and (x - r) >= 0 and (y + r) <= H and (y - r) >= 0:
    print("Yes")
else:
    print("No"

### FIXED CODE ###

W, H, x, y, r = map(int, input().split())
 
if (x + r) <= W and (x - r) >= 0 and (y + r) <= H and (y - r) >= 0:
    print("Yes")
else:
    print("No")
N = int(input())
A = [int(input()) for _ in range(N)]

paper = [0] * 100000

for a in A:
    paper[a - 1] += 1

ans = len(list(filter(lambda x: x % 2 == 1, paper)))
print(ans)


### FIXED CODE ###

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

paper = {}

for a in A:
    paper.setdefault(a - 1, 0)
    paper[a - 1] += 1

ans = len(list(filter(lambda x: x % 2 == 1, paper.values())))
print(ans)
import heapq
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
ansC = []

N, K = LI()
V = LI()
dp = [[[0]]*(K+1) for _ in range(K+1)]
right = [0]*N
left = [0]*N
#right[1] = V[-1]
#left[1] = V[0]

for i in range(min(N,K+1)):
    for j in range(min(N+1,K-i+1)):
        dp[i][j] = [V[:i]+V[N-j:]+[0]]
        dp[i][j][0].sort()

#print(dp)

for i in range(min(N,K)):
    for j in range(min(N,K)):
        if i+j!=0:
            t = K - (i + j)
            for l in range(t):
                if dp[i][j]!=[]:
                    m = dp[i][j][0][0]
#                    print(m)
                    if m < 0:
                        del dp[i][j][0][0]
#            print(i,j)
#            print(dp[i][j])
            if dp[i][j][0]:
#                print(dp[i][j][0])
                ansC.append(sum(dp[i][j][0][::]))

#print(ansC)
print(max(ansC))

### FIXED CODE ###

import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
ansC = []

N, K = LI()
V = LI()
dp = [[[0]]*(K+1) for _ in range(K+1)]
right = [0]*N
left = [0]*N
#right[1] = V[-1]
#left[1] = V[0]

for i in range(min(N+1,K+1)):
    for j in range(min(N+1,K-i+1)):
        if i<N-j:
            dp[i][j] = [V[:i]+V[N-j:]+[0]]
        else:
            dp[i][j] = [V+[0]]
        dp[i][j][0].sort()

#print(dp)

for i in range(min(N+1,K+1)):
    for j in range(max(0,min(N+1,K-i+1))):
        if i+j!=0:
            t = max(K - (i + j),0)
            for l in range(t):
                if dp[i][j]!=[]:
                    m = dp[i][j][0][0]
#                    print(m)
                    if m < 0:
                        del dp[i][j][0][0]
#            print(i,j)
#            print(dp[i][j])
            if dp[i][j][0]:
#                print(dp[i][j][0])
                ansC.append(sum(dp[i][j][0][::]))

#print(ansC)
if ansC:
    print(max(ansC))
else:
    print("0")
A = []
n = int(raw_input())
stack = []
for i in range(n):
	A.append(raw_input())

for i in A:
	if "insert" in i:
		stack.insert(0, i[7:])
	elif "delete " in i and len(stack) > 0:
		stack.remove(i[7:])
	elif "deleteFirst" in i and len(stack) > 0:
		stack.pop(0)
	elif "deleteLast" in i and len(stack) > 0:
		stack.pop()
if len(stack) > 0:
    print " ".join(stack)

### FIXED CODE ###

from collections import deque
n = int(raw_input())
stack = deque()
for i in range(n):
	i = raw_input()
	if "insert" in i:
		stack.appendleft(int(i[7:]))
	elif "delete " in i:
		if int(i[7:]) in stack:
		    stack.remove(int(i[7:]))
	elif "deleteFirst" in i:
		stack.popleft()
	elif "deleteLast" in i:
		stack.pop()
print " ".join(map(str, stack))
# -*- coding: utf-8 -*-
"""
Created on Sun Nov  4 21:46:51 2018

@author: sk
"""

a = str(input())

char_list = list(a)


if a(0)==a(1):
  if a(1)==a(2):
    print("Yes")
  else :
    print("No")

elif a(1)==a(2):
  if a(2)==a(3):
    print("Yes")
  else :
    print("No")

      
    
    
    
  
       





### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Nov  4 21:46:51 2018

@author: sk
"""

# -*- coding: utf-8 -*-
"""
Created on Sun Nov  4 21:46:51 2018

@author: sk
"""


b =str( input())

a = list(b)



if b[0]==b[1]:
  if b[1]==b[2]:
    print("Yes")
  else :
    print("No")

elif b[1]==b[2]:
  if b[2]==b[3]:
    print("Yes")
  else :
    print("No")
else:
  print("No")
# -*- coding: utf-8 -*-
"""
D - Patisserie ABC
https://abc100.contest.atcoder.jp/tasks/abc100_d

"""
import sys
from sys import stdin
input = stdin.readline


from heapq import heappop, heappush


def solve(cakes, M):
    result = []
    for xx in [1, -1]:
        for yy in [1, -1]:
            for zz in [1, -1]:
                hq = []
                for x, y, z in cakes:
                    x *= xx
                    y *= yy
                    z *= zz
                    heappush(hq, -(x+y+z))
                ans = 0
                for _ in range(M):
                    ans += heappop(hq)
                result.append(-ans)
    return sorted(result)[-1]


def main(args):
    duplicate = set()
    N, M = map(int, input().split())

    cakes = []
    for _ in range(N):
        x, y, z = map(int, input().split())
        if not (x, y, z) in duplicate:
            cakes.append((x, y, z))
        duplicate.add((x, y, z))
    ans = solve(cakes, M)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
D - Patisserie ABC
https://abc100.contest.atcoder.jp/tasks/abc100_d

"""
import sys
from sys import stdin
input = stdin.readline


from heapq import heappop, heappush


def solve(cakes, M):
    result = []
    for xx in [1, -1]:
        for yy in [1, -1]:
            for zz in [1, -1]:
                hq = []
                for x, y, z in cakes:
                    x *= xx
                    y *= yy
                    z *= zz
                    heappush(hq, -(x+y+z))
                ans = 0
                for _ in range(M):
                    ans += heappop(hq)
                result.append(-ans)
    return sorted(result)[-1]


def main(args):
    N, M = map(int, input().split())

    cakes = []
    for _ in range(N):
        x, y, z = map(int, input().split())
        cakes.append((x, y, z))
    ans = solve(cakes, M)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
(a,b,c) = map(int, raw(input().split)
print len[x for x in range(a,b+1) if c % x == 0]


### FIXED CODE ###

(a,b,c) = map(int, raw_input().split())
print len([x for x in range(a,b+1) if c % x == 0])
S=input()
print("NYoe s"[len(re.sub("[RUD]",'',S[0::2]))==0==len(re.sub("[LUD]",'',S[1::2]))::2])

### FIXED CODE ###

import re
S=input()
print("NYoe s"[len(re.sub("[RUD]",'',S[0::2]))==0==len(re.sub("[LUD]",'',S[1::2]))::2])
num = 1
for i in int(input()):
    if i == 0:
        break
    print("Case {0}: {1}".format(num,i))
    num +=1

### FIXED CODE ###

num = 1
while True:
    x = int(input())
    if x == 0: break
    print ("Case {0}: {1}".format(num,x))
    num += 1
n, k = map(int,input().split())
a = list(map(int,input().split()))
mod = 10**9 + 7

plus = []
minus = []

for i in a:
	if i >= 0:
		plus.append(i)
	else:
		minus.append(i)

plus.sort(key=lambda x:-x)
minus.sort()

#print(plus, minus)

"""
貪欲チックに求める
numplus … 前からnumplus番目まで掛け合わせる
numminus … 前からnumminus番目まで掛け合わせる

入力例2に合わせるのは場合分けが必要だが, minusは2個単位で管理する.
"""
numplus = k
numminus = 0

"""
kがplusを超える場合, うまく処理ができないのでリスト参照できる範囲まで下げる.
"""
while numplus > len(plus):
	numplus -= 2
	numminus += 2

if numplus < 0:
	numminus += numplus
	ans = 1
	tmp = sorted(a, key=lambda x:-x)
	for i in range(numminus):
		ans = ans * tmp[i] % mod
	print(ans)
	exit()

#print(numplus, numminus)

tmpplus = -1
tmpminus = -1

while numplus-2 >= 0 and numminus+2 <= len(minus):
	if plus[numplus-1] * plus[numplus-2] <= plus[numminus] * plus[numminus+1]:
		numplus -= 2
		numminus += 2
		tmpminus = numminus
		tmpplus = numplus
	else:
		break

#print(tmpminus, tmpplus)

ans = 1
for i in range(numplus):
	ans = ans * plus[i] % mod
for i in range(numminus):
	ans = ans * minus[i] % mod
print(ans)

### FIXED CODE ###

n, k = map(int,input().split())
a = list(map(int,input().split()))
mod = 10**9 + 7

plus = []
minus = []

for i in a:
	if i >= 0:
		plus.append(i)
	else:
		minus.append(i)

plus.sort(key = lambda x:-x)
minus.sort()

#print(plus, minus)

"""
貪欲チックに求める
numplus … 前からnumplus番目まで掛け合わせる
numminus … 前からnumminus番目まで掛け合わせる

入力例2に合わせるのは場合分けが必要だが, minusは2個単位で管理する.
"""

numplus = k
numminus = 0

"""
kがplusを超える場合, うまく処理ができないのでリスト参照できる範囲まで下げる.
"""
while numplus > len(plus):
	numplus -= 2
	numminus += 2

#print(numplus, numminus)

while numplus-2 >= 0 and numminus+1 < len(minus):
	if plus[numplus-1] * plus[numplus-2] <= minus[numminus] * minus[numminus+1]:
		numplus -= 2
		numminus += 2
	else:
		break

#print(numplus, numminus)

ans = 1

if numplus >= 0 and numminus >= 0 and numminus <= len(minus) and numplus <= len(plus):
	for i in range(numplus):
		ans = ans * plus[i] % mod
	for i in range(numminus):
		ans = ans * minus[i] % mod
else:
	"""
	これは, ansが負になる場合や, minusが1個だけの場合, minusしかない場合, plusしかない場合に使える.
	"""
	#print("ここに来ました！")
	tmp = sorted(a, key=lambda x:-x)
	for i in range(k):
		ans = ans * tmp[i]%mod

print(ans)
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_9_B
#???????????? 17:55~

def maxHeapify(heap, index):
    left_index = 2 * index
    right_index = 2 * index + 1
    left = heap[left_index] if left_index < len(heap) else -1
    right = heap[right_index] if right_index < len(heap) else -1
    largest_index = heap.index(max([left, right, heap[index]]))

    if not largest_index == index:
        heap[index], heap[largest_index] = heap[largest_index], heap[index]
        maxHeapify(heap, largest_index)
    
def main():
    n_node = int(input())
    target_list = [""] + [int(n) for n in input().split()]
    for i in range(1, int(len(target_list) / 2) + 1)[::-1]:
        maxHeapify(target_list, i)
        
    print(*target_list)
if __name__ == "__main__":
    main()

### FIXED CODE ###

#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_9_B
#???????????? 17:55~

def maxHeapify(heap, index):
    left_index = 2 * index
    right_index = 2 * index + 1
    largest_index = index
    
    if left_index < len(heap) and heap[left_index] > heap[index]:
        largest_index = left_index

    if right_index < len(heap) and heap[right_index] > heap[largest_index]:
        largest_index = right_index

    if largest_index != index:
        heap[index], heap[largest_index] = heap[largest_index], heap[index]
        maxHeapify(heap, largest_index)
    
def main():
    n_node = int(input())
    target_list = [""] + [int(n) for n in input().split()]
    for i in range(1, int(len(target_list) / 2) + 1)[::-1]:
        maxHeapify(target_list, i)
        
    print(*target_list)
if __name__ == "__main__":
    main()
if N > rootN:
    res*=2

### FIXED CODE ###

#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    ps=[]
    for i in range(2,int((N**0.5))+1):
        if N%i==0:
            cnt=0
            for j in range(40):
                if N%i==0:
                    N//=i
                    cnt+=1
            ps.append([i,cnt])
    if N!=1:
        ps.append([N,1])
        
    ans=0
    for p in ps:
        ans+=int(((8*p[1]+1)**0.5-1)/2)
    print(ans)
    
    
if __name__=="__main__":
    main()
def insertionSort( nums, n, g ):
	global cnt
	for i in range( g, n ):
		v = nums[i]
		j = i - g
		while 0 <= j and v < nums[j]:
			nums[ j+g ] = nums[j]
			j -= g
			cnt += 1
		nums[ j+g ] = v
		
n = int( input( ) )
nums = []
for i in range( n ):
	nums.append( int( input( ) ) )

g = []
val = 1
while val <= n:
	g.append( val )
	val = 3*val+1
g.reverse( )
m = len( g )
print( m )
print( " ".join( map( str, g ) ) )
cnt = 0
for i in range( m ):
	insertionSort( nums, n, g[i] )
print( cnt )
print( "\n".join( map( str, nums ) ) )

### FIXED CODE ###

import sys
 
def insertionSort( nums, n, g ):
    cnt = 0
    i = g
    while i < n:
        v = nums[i]
        j = i - g
        while 0 <= j and v < nums[j]:
            nums[ j+g ] = nums[j]
            j -= g
            cnt += 1
        nums[ j+g ] = v
        i += 1
    return cnt
         
def shellSort( nums, n ):
    g = []
    val = 1
    while val <= n:
        g.append( val )
        val = 3*val+1
     
    g.reverse( )
    m = len( g )
    print( m )
    print( " ".join( map( str, g ) ) )
    cnt = 0
    for i in range( m ):
        cnt += insertionSort( nums, n, g[i] )
    print( cnt )
     
n = int( sys.stdin.readline( ) )
nums = []
for i in range( n ):
    nums.append( int( sys.stdin.readline( ) ) )
 
shellSort( nums, n )
print( "\n".join( map( str, nums ) ) )
import math

def solve(k):
    l = int(math.log2(k + 1))
    if k + 1 == 2 ** l:
        ans = 0
        for i in range(l):
            if v[i] > 0:
                ans += v[i]
        return ans
    else:
        return max(solve(k - 2 ** l) + v[l], solve(2 ** l - 1))

N, K = map(int, input().split())
A = list(map(int, input().split()))
bit = [0] * 40
for i in A:
    for j in range(40):
        bit[j] += (i >> j) & 1
w = [0] * 40
v = [0] * 40
for i in range(40):
    w[i] = 1 << i
    v[i] = (N - bit[i] - bit[i]) * w[i]
print(solve(K))


### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
bit = [0] * 41
for i in A:
    for j in range(41):
        bit[j] += (i >> j) & 1
x = {}
for i in range(41):
    x[i, 0] = 2 ** i * bit[i]
    x[i, 1] = 2 ** i * (N - bit[i])
ans = sum(A)
for i in range(41):
    if ((K + 1) >> i) & 1 == 0:
        continue
    f = 0
    for j in range(i):
        f += max(x[j, 0], x[j, 1])
    f += x[i, 0]
    for j in range(i + 1, 41):
        f += x[j, ((K + 1) >> j) & 1]
    ans = max(ans, f)
print(ans)