Harryxun/stf_run huggingface dataset:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

from collections import Counter, defaultdict
c = Counter(a)
n1, n2, n3 = c[1], c[2], c[3]
n0 = c[0]
def glist(*l, fill=None):
    if len(l)==1:
        return [fill]*l[0]
    ll = l[1:]
    return [glist(*ll) for _ in range(l[0])]

count = 0
S = sum(a)
sub = glist(301,301,301)

for s in range(S+1):
    for i1 in range(s+1):
        for i2 in range((s-i1)//2+1):
            d,m = divmod((s-i1-2*i2), 3)
            if m:
                continue
            i3 = d
            count += 1
            if i1==i2==i3==0:
                sub[i1][i2][i3] = 0
                continue
            ans = 1
            p = 0
            if i1>0:
                ans += i1/n * sub[i1-1][i2][i3]
                p += i1/n
            if i2>0:
                ans += i2/n * sub[i1+1][i2-1][i3]
                p += i2/n
            if i3>0:
                ans += i3/n * sub[i1][i2+1][i3-1]
                p += i3/n
            ans = ans/p
            sub[i1][i2][i3] = ans
print(sub[n1][n2][n3])

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

from collections import Counter, defaultdict
c = Counter(a)
n1, n2, n3 = c[1], c[2], c[3]
n0 = c[0]
def glist(*l, fill=None):
    if len(l)==1:
        return [fill]*l[0]
    ll = l[1:]
    return [glist(*ll) for _ in range(l[0])]

count = 0
S = sum(a)
sub = glist(n1+n2+n3+1,n2+n3+1,n3+1)
sub[0][0][0] = 0
#     for i1 in range(min(n+1, s+1)):
#         for i2 in range(min(n+1, (s-i1)//2+1)):
for i3 in range(n3+1):
    for i2 in range(n2+n3+1-i3):
        for i1 in range(n1+n2+n3 - (i2+i3) + 1):
            if i1==i2==i3==0 or i1+i2+i3>n:
                continue
#             print(i1,i2,i3)
            ans = n
            p = 0
            if i1>0:
                ans += i1 * sub[i1-1][i2][i3]
                p += i1
            if i2>0:
                ans += i2 * sub[i1+1][i2-1][i3]
                p += i2
            if i3>0:
                ans += i3 * sub[i1][i2+1][i3-1]
                p += i3
            ans = ans/p
            sub[i1][i2][i3] = ans
print(sub[n1][n2][n3])
n = int(input())
s = list(input() for i in range(n))

import collections
A = collections.Counter(S)
 
B = max(A.values())
C = [i for i in A if A[i] == B]
C = sorted(C)
 
for i in C:
    print(i)

### FIXED CODE ###

n = int(input())
s = list(input() for i in range(n))

import collections
A = collections.Counter(s)
 
B = max(A.values())
C = [i for i in A if A[i] == B]
C = sorted(C)
 
for i in C:
    print(i)
a, b, c = map(int, input().split())

s = a + b + c

if s.count('5') == 2 and s.count('7') == 1:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = input().split(" ")
if s.count('5') == 2 and s.count('7') == 1:
	print("YES")
else:
	print("NO")
N = int(input())
S = list(input())
K = int(input())

for i in range(N):
  if S[i] != S[K]:
    S[i] = "*"
    
print(*S, sep="")



### FIXED CODE ###

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

for i in range(N):
  if S[i] != S[K-1]:
    S[i] = "*"
    
print(*S, sep="")
def main():
    N, P = map(int, input().split())

    i = 0
    while i**N <= P:
        i += 1

    i -= 1

    for j in range(i, 0, -1):
        if P % j**N == 0:
            print(j)
            break


main()


### FIXED CODE ###

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


def main():
    N, P = map(int, input().split())
    A = factorization(P)

    B = []
    for a, b in A:
        if b >= N:
            B.append((a, b // N))

    ans = 1
    for a, b in B:
        ans *= a**b
    print(ans)


main()
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

# from functools import reduce
# from math import gcd as gcd_base  # from fractions import gcd
# gcd = lambda *numbers: reduce(gcd_base, numbers)  # 3 数以上の最大公約数

# lcm_base = lambda x, y: (x * y) // gcd_base(x, y)
# lcm = lambda *numbers: reduce(lcm_base, numbers, 1)  # 3 数以上の最小公倍数
# 最小公倍数
# def gcd(a, b):
#     if a < b:
#         a, b = b, a
#     while a % b != 0:
#         a, b = b, a % b
#     return b


## 最大公約数 
def lcm(a, b):
    y = a*b // gcd(a, b)
    return y

def many_lcm(l):
    for i in range(len(l)-1):
        if i == 0:
            ans = lcm(l[0], l[1])
        else:
            ans = lcm(l[i+1], ans)
    return ans
N = INT()
A = LIST()

lm = many_lcm(A)
# print(l)
B = []
for a in A:
    B.append(lm // a)
print(sum(B) % mod)





### FIXED CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

# from functools import reduce
# from math import gcd as gcd_base  # from fractions import gcd
# gcd = lambda *numbers: reduce(gcd_base, numbers)  # 3 数以上の最大公約数

# lcm_base = lambda x, y: (x * y) // gcd_base(x, y)
# lcm = lambda *numbers: reduce(lcm_base, numbers, 1)  # 3 数以上の最小公倍数
# 最小公倍数
# def gcd(a, b):
#     if a < b:
#         a, b = b, a
#     while a % b != 0:
#         a, b = b, a % b
#     return b



def many_lcm(l):
    tmp = l[0]
    for i in range(1, len(l)):
        tmp = tmp * l[i]//gcd(tmp, l[i])
    return tmp
N = INT()
A = LIST()

lm = many_lcm(A)
ans = 0
for a in A:
    ans += lm // a
    
print(ans % mod)
N, M, X = map(int,input().split())
skill_book = []
for i in range(N):
    skill_book.append(list(map(int, input().split())))
box = []
flag = 1
for i in range(1 << M):
    total = [0] * (M + 1)
    for j in range(M):
        if (i >> j) & 1:
            total = [x + y for (x, y) in zip(total, skill_book[j])]
    over = 1
    for j in range(1, len(total)):
        if not (total[j] >= X):
            over = 0
    if over == 1 and len(total) > 0:
        box.append(total[0])

print(min(box))

### FIXED CODE ###

N, M, X = map(int,input().split())
skill_book = []
for i in range(N):
    skill_book.append(list(map(int, input().split())))
box = []
flag = 1
for i in range(1 << N):
    total = [0] * (M + 1)
    for j in range(N):
        if (i >> j) & 1:
            total = [x + y for (x, y) in zip(total, skill_book[j])]
    over = 1
    for j in range(1, len(total)):
        if not (total[j] >= X):
            over = 0
    if over == 1 and len(total) > 0:
        box.append(total[0])
if len(box) > 0:
    print(min(box))
else:
    print('-1')
C1 = list(input().split())
C2 = list(input().split())

ans = 'Yes'

for i in range(3):
    if C1[i] == C2[-i-1]:
        continue
    else:
        ans = 'No'
print(ans)


### FIXED CODE ###

C1 = list(input())
C2 = list(input())

ans = 'YES'

for i in range(3):
    if C1[i] == C2[-i-1]:
        continue
    else:
        ans = 'NO'
print(ans)
n = int(input())
hint_ls = [0] * n
for i in range(n):
    x,y,h = map(int,input().split())
    hint_ls[i] = [x,y,h]
target_ls = [[i,j] for i in range(101) for j in range(101)]
for x_target, y_target in target_ls:
    res = True
    for i in range(n):
        x_hint, y_hint, h_hint = hint_ls[i]
        if h_hint != 0:
            h_target_new = h_hint + abs(x_hint - x_target) + abs(y_hint - y_target)
            if i>= 1:
                if not h_target_new == h_target_old:
                    res = False
            h_target_old = h_target_new
        else:
            if h_target_old > abs(x_hint - x_target) + abs(y_hint - y_target):
                res = False
    if res:
        x_ans,y_ans,h_ans = x_target, y_target, h_target_new

print(x_ans, y_ans, h_ans)

### FIXED CODE ###

import sys
n = int(input())
inf_ls = [[0]*3 for _ in range(n)]
for i in range(n):
    x,y,h = map(int,input().split())
    inf_ls[i] = x,y,h
for Cx in range(101):
    for Cy in range(101):
        this_is_C = True
        H_set = set()
        zero_ls = []
        for i in range(n):
            x,y,h = inf_ls[i]
            if h > 0:
                H = abs(x-Cx) + abs(y-Cy) + h
                H_set.add(H)
            else:
                zero_ls.append([x,y])
        if len(H_set) != 1:
            this_is_C = False
            continue
        H = list(H_set)[0]
        for x,y in zero_ls:
            if H - abs(x-Cx) - abs(y-Cy) > 0:
                this_is_C = False
        if this_is_C:
            print(Cx,Cy,H)
            exit()
n,k = map(int,input().split())
coin = [0]*n
for i in range(k-1):
    coin[i] += 1
while k > 1:
    k /= 2
    for i in range(min(int(k),n)):
        coin[i] += 1
ans = 0
for i in range(n):
    ans += (1/2)**coin[i]
print(ans / n)


### FIXED CODE ###

n,k = map(int,input().split())
coin = [0]*n
while k > 1:
    for i in range(min(int(k-1/1e10),n)):
        coin[i] += 1
    k /= 2
ans = 0
for i in range(n):
    ans += 1 / (2**coin[i] * n)
print(ans)
from math import sqrt
x1, y1, x2, y2 = [float(iv) for iv in input().split()]
print(sqrt(abs(x2-x1)**2 + abs(y2-y1)**2))

### FIXED CODE ###

from math import sqrt
x1, y1, x2, y2 = [float(iv) for iv in raw_input().split()]
print sqrt(abs(x2-x1)**2 + abs(y2-y1)**2)
c1 = input().split()
c2 = input().split()
c=[]
a =‘YES’
for k in range(3):
    c.append([c1[k]]+[c2[k]])
for j in range(3):
    if c[0][j] = c[1][3-j-1]:
        continue
    else: 
        a=‘NO’
        break
print(a)

### FIXED CODE ###

a = input()
b = input()
alist = list(a)
blist = list(b)
ans = "YES"
for i in range(3):
    if alist[i] == blist[2-i]:
        continue
    else:
        ans =("NO")
print(ans)
h,w=map(int,input().split())
a=[list(map(int,input().split()))for i in range(h)]
b=[list(map(int,input().split()))for i in range(h)]
c=[[abs(a[i][j]-b[i][j])for j in range(w)]for i in range(h)]
d=[[set()for i in range(w+1)]for j in range(h+1)]
d[1][1]=set([-c[0][0],c[0][0]])
for x in range(1,w+1):
    for y in range(1,h+1):
        if not (i==1 and j==1):
            a=d[x-1][y]|d[x][y-1]
            for i in a:
                d[x][y].add(i-c[x-1][y-1])
                if i+c[x-1][y-1]<=80*(h+w-x-y+1)
                    d[x][y].add(i+c[x-1][y-1])
print(abs(min(d[h][w],key=abs)))

### FIXED CODE ###

h,w=map(int,input().split())
a=[list(map(int,input().split()))for i in range(h)]
b=[list(map(int,input().split()))for i in range(h)]
s=[0]*w
s[0]=p=1<<6400
for i in range(h):
    for j in range(w):
        d=abs(a[i][j]-b[i][j])
        if j>0:
            s[j]|=s[j-1]
        s[j]=(s[j]<<d)|(s[j]>>d)
t=s[-1]
for i in range(6401):
    if t&(p<<i) or t&(p>>i):
        print(i)
        break
N = int(input())

sum = 0.0

for i in range(N):
    x = float(input())
    u = input()

    if u == "JPY":
        sum = sum + x
    else:
        sum = sum + x * 380000

print(sum)


### FIXED CODE ###

N = int(input())

sum = 0.0

for i in range(N):
    S = input()
    S = S.split()

    x = float(S[0])
    u = S[1]

    if u == "JPY":
        sum = sum + x
    else:
        sum = sum + x * 380000

print(sum)
n = int(input())
h = map(int, input().split())
ans = True
minv = 0

for i in range(len(h)-1):
    down = False
    
    if h[i] > h[i+1]:
        if h[i] - h[i+1] > 1:
            ans = False
            break
        else:
            if h[i]-1 >= minv:
                h[i] -= 1
                minv = h[i]
                down = True
            else:
                ans = False
                break
    if not down and  i!=0 and h[i-1] < h[i]:
        h[i] -= 1
        minv = h[i]


print("Yes") if ans else print("No")

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
ans = True
minv = 0

for i in range(len(h)-1):
    down = False
    
    if h[i] > h[i+1]:
        if h[i] - h[i+1] > 1:
            ans = False
            break
        else:
            if h[i]-1 >= minv:
                h[i] -= 1
                minv = h[i]
                down = True
            else:
                ans = False
                break
    if not down and  i!=0 and h[i-1] < h[i]:
        h[i] -= 1
        minv = h[i]


print("Yes") if ans else print("No")
from collections import defaultdict
dic = defaultdict(int)
N, X, M = map(int, input().split())
A = [X]
ans = X
if N>1:
    temp = 1
    dic[X]=temp
    for i in range(2, N+1):
        a = A[-1]*A[-1]%M
        if dic[a]>0:

            fir = dic[a]
            break
        A.append(a)
        ans+=a
        temp+=1
        dic[a]=temp
    T = temp-fir+1#周期
    Tsum = 0 #周期の和
    TempSum = 0 #後半あまりの和
    M=N-fir+1 # 先頭のぞく 
    amari = M%T # 後半あまり
    for k in dic:
        if dic[k]>=fir and dic[k]<=temp:
            Tsum+=k
        if dic[k]>=fir and dic[k]<fir+amari:
            TempSum += k
    ans+=TempSum
    ans+=Tsum*(M//T-1)
    print(ans)
else:
    print(ans)

### FIXED CODE ###

from collections import defaultdict
dic = defaultdict(int)
N, X, M = map(int, input().split())
A = [X]
ans = X
fir = -1
if N>1:
    temp = 1
    dic[X]=temp
    for i in range(2, N+1):
        a = A[-1]*A[-1]%M
        if dic[a]>0:
            fir = dic[a]
            break
        A.append(a)
        ans+=a
        temp+=1
        dic[a]=temp
    if fir!=-1:
        T = temp-fir+1#周期
        Tsum = 0 #周期の和
        TempSum = 0 #後半あまりの和
        M=N-fir+1 # 先頭のぞく 
        amari = M%T # 後半あまり
        for k in dic:
            if dic[k]>=fir and dic[k]<=temp:
                Tsum+=k
            if dic[k]>=fir and dic[k]<fir+amari:
                TempSum += k
        ans+=TempSum
        ans+=Tsum*(M//T-1)
    print(ans)
else:
    print(ans)
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
M=set(tuple(map(int,input().split())) for _ in range(m))
d={i:set() for i in range(1,n+1)}

for a,b in M:
    if a>b:
        a,b=b,a
    d[a].add(b)

val = max(d,key=d.get)
for i in d[val]:
    if d[i]!=set():
        d[val]|=d[i]
print(len(d[val])+1)



### FIXED CODE ###

n,m=map(int,input().split())
d={i:set() for i in range(1,n+1)}
for i in range(m):
    a,b=map(int,input().split())
    d[a].add(b)
    d[b].add(a)

vis = set()
res = 0
for i in range(1,n+1):
    if i not in vis:
        stack=[i]
        ans=1
        vis.add(i)
        while stack:
            cur=stack.pop()
            for j in d[cur]:
                if j not in vis:
                    vis.add(j)
                    ans+=1
                    stack.append(j)
        res=max(res,ans)
print(res)
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
for i in range(0,n):
    ans += b[a[i]-1]
    if i != 0 and a[i-1]+1 == a[i]:
        ans += c[a[i]-1]
print(ans)


### FIXED CODE ###

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

ans = 0
for i in range(0,n):
    ans += b[a[i]-1]
    if i != 0 and a[i-1]+1 == a[i]:
        ans += c[a[i-1]-1]
print(ans)
s, t = input(), input()
a, b = input(), input()
u = input()
if s == t:
  a = a - 1
else:
  b = b - 1
print(a, b)

### FIXED CODE ###

input1 = input()
s = str(input1).split(' ')[0]
t = str(input1).split(' ')[1]
input2 = input()
a = int(str(input2).split(' ')[0])
b = int(str(input2).split(' ')[1])
u = str(input())
if s == u:
  a = a - 1
else:
  b = b - 1
print(a, ' ', b)
LEN = int(input())
mem = []
for i in range(0,LEN):
    mem.append(int(input()))
    LEN-=1
    if LEN == 0:
        break
print('%d %d %d',min(mem),max(mem),sum(mem))


### FIXED CODE ###

LEN = int(input())
mem = input().split(" ")
for i in range(0, LEN):
    mem[i] = int(mem[i])
print(min(mem),max(mem),sum(mem))
x,y = map(int,input().split())

for i in range(x):
  if 2 * i + 4 * (x - i) == y:
    print('Yes')
    sys.exit()
print('No')

### FIXED CODE ###

x,y = map(int,input().split())
 
for i in range(x+1):
  if 2 * i + 4 * (x - i) == y:
    print('Yes')
    exit()
print('No')
def gcd(a, b) -> int:
  if(a < b):
    tmp = a
    a = b
    b = tmp
  if b == 0:
    return a
  return gcd(a % b, b)

def lcm(a, b) -> int:
  g = gcd(a, b)
  return int((a * b) / g)

N = int(input())
ans = int(1)
for i in range(N):
  t = int(input())
  ans = lcm(ans, t)
print(ans)

### FIXED CODE ###

def gcd(a, b) -> int:
  if(a < b):
    tmp = a
    a = b
    b = tmp
  if b == 0:
    return a
  return gcd(a % b, b)

def lcm(a, b) -> int:
  g = gcd(a, b)
  return a * (b // g)

N = int(input())
ans = int(1)
for i in range(N):
  t = int(input())
  ans = lcm(ans, t)
print(ans)
s = input()
t = input()
l = len(t)
ans = 0
a = 0
list1 = []
for i in range(len(s) - l + 1):
  ss = list(s[i:i+l])
  for j in range(l):
    if ss[j] ==t[j]:
      ans += 1
      list1.append(ans)
    else:
      pass
  ans = 0
m =  max(list1)
print(l-m)

### FIXED CODE ###

s = input()
t = input()
l = len(t)
ans = 0
a = 0
list1 = [0]
for i in range(len(s) - l + 1):
  ss = list(s[i:i+l])
  for j in range(l):
    if ss[j] ==t[j]:
      ans += 1
      list1.append(ans)
    else:
      pass
  ans = 0
m =  max(list1)
print(l-m)
A, B, K = map(int, input().strip().split(" "))

if A > K:
    A -= K
    K = 0

else:
    K -= A
    A = 0

if B > K:
    B -= K
    K = 0

else:
    B = 0
    
print("{} {}".format(A, B))

### FIXED CODE ###


S, T = input().strip().split(" ")

print("{}{}".format(T, S))
a, b, c = map(int, input().split())

if c-(a-b)>0:
    print(c-(a-b))
else:
    print(0

### FIXED CODE ###

a, b, c = map(int, input().split())

if c-(a-b)>0:
    print(c-(a-b))
else:
    print(0)
def bitcount(N):  # 立ってるbitの数
    bitcnt = [0]
    for _ in range(N):
        bitcnt += [i + 1 for i in bitcnt]
    return bitcnt


n, x = int(input()), input()

num, cnt = int(x, 2), x.count('1')
lbit = bitcount(18)
for i in range(n):
    ans = 1
    if x[i] == '0':
        ctmp = cnt + 1
        tmp = (num + pow(2, n - (i + 1), ctmp)) % ctmp
    elif x[i] == '1':
        ctmp = cnt - 1
        tmp = (num - pow(2, n - (i + 1), ctmp)) % ctmp
    ctmp = lbit[tmp]
    while tmp > 0:
        ans += 1
        tmp %= ctmp
        ctmp = lbit[tmp]
    print(ans)


### FIXED CODE ###

def bitcount(N):  # 立ってるbitの数
    bitcnt = [0]
    for _ in range(N):
        bitcnt += [i + 1 for i in bitcnt]
    return bitcnt


n, x = int(input()), input()

num, cnt = int(x, 2), x.count('1')
lbit = bitcount(18)
for i in range(n):
    ans = 1
    if x[i] == '0':
        ctmp = cnt + 1
        tmp = num % ctmp + pow(2, n - (i + 1), ctmp)
    elif x[i] == '1':
        ctmp = cnt - 1
        if ctmp == 0:
            print(0)
            continue
        tmp = num % ctmp - pow(2, n - (i + 1), ctmp)
    tmp %= ctmp
    ctmp = lbit[tmp]
    while tmp > 0:
        ans += 1
        tmp %= ctmp
        ctmp = lbit[tmp]
    print(ans)
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return int(a/gcd(a,b)*b)
    
n = int(input())
ans=1
for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
    
print(ans)

### FIXED CODE ###

def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return b * a//gcd(a,b)
    
n = int(input())
ans=1
for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
    
print(ans)
import sys 

N = int(input())
sys.setrecursionlimit(N+1)

memo = dict()
INF = N 

def withdraw(ammount):
    if ammount == 0:
        return 0
    if ammount in memo:
        return memo[ammount]

    answer = INF 
    answer = ammount

    unit = 6 
    while unit < ammount:
        answer = min(answer, withdraw(ammount-unit)+1)
        unit *= 6

    unit = 9 
    while unit < ammount:
        answer = min(answer, withdraw(ammount-unit)+1)
        unit *= 9

    memo[ammount] = answer
    return answer

print(withdraw(N))

### FIXED CODE ###

import sys

N = int(input())
sys.setrecursionlimit(N*10)

memo = dict()
INF = N

def withdraw(amount):
    if amount == 0:
        return 0
    if amount in memo:
        return memo[amount]

    answer = amount
    
    unit = 6
    while unit <= amount:
        answer = min(answer, withdraw(amount-unit)+1)
        unit *= 6

    unit = 9
    while unit <= amount:
        answer = min(answer, withdraw(amount-unit)+1)
        unit *= 9

    memo[amount] = answer
    return answer

print(withdraw(N))
if S == "ABC":
    print("ARC")
else S == "ARC":
    print("ABC")

### FIXED CODE ###

S = input()

if S == "ABC":
    print("ARC")
else:
    print("ABC")
n = int(input())
p = [int(i) for i in range(n)]
s = 0
for i in range(1,n-1):
  l1 = p[i-1,i+2]
  l2 = l1.copy()
  l2.sort()
  if l1[1] == l2[2]:
    s += 1
print(s)
  

### FIXED CODE ###

n = int(input())
p = [int(i) for i in input().split()]
s = 0
for i in range(1,n-1):
  l1 = p[i-1:i+2]
  l2 = l1.copy()
  l2.sort()
  if l1[1] == l2[1]:
    s += 1
print(s)
X,Y = int(input().split(' '))
print(X + (Y/2))

### FIXED CODE ###

X,Y = input().split(' ')
x = int(X)
y = int(Y)

print(x + (y//2))
n = int(input())
a = list(map(int, input().split()))
q = int(input())

bckt = [0]*(n+1)
for i in a:
    bckt[i] += 1
    
s = sum(a)

for i in range(q):
    b, c = map(int, input().split())
    q = bckt[b]
    bckt[c] += q
    bckt[b] -= q
    s += (c*q - b*q)
    print(s)
    

### FIXED CODE ###

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

bckt = [0]*(int(1e5)+1)
for i in a:
    bckt[i] += 1
    
s = sum(a)

for i in range(q):
    b, c = map(int, input().split())
    q = bckt[b]
    bckt[c] += q
    bckt[b] -= q
    s += (c*q - b*q)
    print(s)
N,Cut = map(int,input().split())
log_ls = list(map(int,input().split()))

Max = max(log_ls)

def max_less_K(k):
    times = 0
    for log in log_ls:
        times += log // k
    if times <= Cut:
        return True
    else:
        return False

def return_min_ind_whose_value_not_less_than():
    r = Max
    l = 0
    while True:
        next_k = (r+l) // 2
        if max_less_K(next_k):
            r = next_k
        else:
            l = next_k
        if r - l == 1:
            return r

ans = return_min_ind_whose_value_not_less_than()
print(ans)


### FIXED CODE ###

N,K = map(int,input().split())
log_ls = list(map(int,input().split()))

Max = max(log_ls)

def less_k(min_length,log_ls = log_ls,K=K):
    times = 0
    for log in log_ls:
        if log % min_length == 0:
            times += log // min_length -1
        else:
            times += log // min_length
    if times <= K:
        return True
    else:
        return False
#print(less_k(5,[10,10],2))

def return_min_length():
    r = Max
    l = -1
    while True:
        next_length = (r+l) // 2
        if next_length == 0 or not less_k(next_length):
            l = next_length
        else:
            r = next_length
        if r - l == 1:
            return r

ans = return_min_length()
print(ans)