Harryxun/stf_run huggingface dataset:
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n = ni()
color = nl()
g = [list() for _ in range(n)]
for _ in range(n-1):
    a, b = nm()
    g[a-1].append(b-1)
    g[b-1].append(a-1)

size = [1]*n
h = [list() for _ in range(n+1)]
sst = [0]*n
def dfs(v, p):
    h[color[v]].append(v)
    for x in g[v]:
        if x == p: continue
        size[v] += dfs(x, v)
    h[color[v]].append(v)
    return size[v]
dfs(0, -1)
# print(size)
acc = [0]*(n+10)
ans = [n*(n+1)//2]*(n+1)
for col in range(1, n+1):
    # print(h[col])
    acc[-1] = 0
    p = [-1]
    for v in h[col]:
        if p[-1] == v:
            p.pop()
            q = size[v] - acc[v] - 1
            ans[col] -= q*(q+1)//2
            # print(v, q)
            acc[p[-1]] += size[v]
        else:
            p.append(v)
    q = n - acc[-1]
    # print(-1, q)
    ans[col] -= q*(q+1)//2
print(*ans[1:], sep='\n')

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n = ni()
color = nl()
g = [list() for _ in range(n)]
for _ in range(n-1):
    a, b = nm()
    g[a-1].append(b-1)
    g[b-1].append(a-1)

size = [1]*n
par = [-1]*n
h = [list() for _ in range(n+1)]
idx = [0]*n
def dfs(v, p):
    h[color[v]].append(v)
    for x in g[v]:
        if x == p: continue
        par[x] = v
        size[v] += dfs(x, v)
        h[color[v]].append(v)
    h[color[v]].append(v)
    return size[v]
dfs(0, -1)
# print(size)
for v in range(n):
    if idx[v] < len(g[v]) and g[v][idx[v]] == par[v]:
        idx[v] += 1
acc = [0]*(n+10)
ans = [n*(n+1)//2]*(n+1)
for col in range(1, n+1):
    # print(h[col])
    acc[-1] = 0
    p = [-1]
    for v in h[col]:
        if p[-1] == v:
            p.pop()
            if idx[v] >= len(g[v]):
                acc[p[-1]] += size[v]
                continue
            q = size[g[v][idx[v]]] - acc[v]
            idx[v] += 1
            if idx[v] < len(g[v]) and g[v][idx[v]] == par[v]:
              idx[v] += 1
            ans[col] -= q*(q+1)//2
            acc[v] = 0
            # print(v, q)
            p.append(v)
        else:
            p.append(v)
    q = n - acc[-1]
    # print(-1, q)
    ans[col] -= q*(q+1)//2
print(*ans[1:], sep='\n')
x,t = map(int,input().splist())
print(max(0,x-t)

### FIXED CODE ###

x,t = map(int,input().split())
print(max(0,x-t))
num = list(map(int,input().split()))
a=0
b=0
for i in range(3):
	if num[i]==5:
		a+=1
	if num[i]==7:
		b+=1
if a==2 and b==1:
	print(YES)
else:
	print(NO)

### FIXED CODE ###

word = list(map(int,input().split()))
#print(word) ['5', '5', '7']
a=0
b=0
for i in range(3):
    if word[i]==int(5):
        a=a+1
for i in range(3):
    if word[i]==int(7):
        b=b+1
if a==2 and b==1:
	print("YES")
else:
  	print("NO")
def A(x):
  if ord(x) - ord('a') >= 0:
    print('a')
  else:
    print('A')


def B(n, k, p_list):
  p_list = sorted(p_list)
  print(sum(p_list[:k]))


def _get_base_x(n, x):
  a = [
      'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
      'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
  ]
  b = []
  while True:
    s = n // x
    y = n % x
    b = b + [y]
    if s == 0:
      break
    n = s
  b.reverse()
  ret = []
  for i in b:
    ret.append(a[i - 1])
  print(''.join(ret))


def C(x):
  _get_base_x(x, 26)


def main():
  # letter = input()
  # A(letter)
  # for x in ['A', 'Z', 'a', 'z']:
  #   A(x)

  # n, k = map(int, input().split())
  # p_list = map(int, input().split())
  # B(n, k, p_list)
  C(input())


if __name__ == '__main__':
  main()


### FIXED CODE ###

def A(x):
  if ord(x) - ord('a') >= 0:
    print('a')
  else:
    print('A')


def B(n, k, p_list):
  p_list = sorted(p_list)
  print(sum(p_list[:k]))


def C(N):
  for i in range(99):
    if N < 26**i:
      ans = []
      for j in range(i):
        ans += chr(ord('a') + N % 26)
        N //= 26
      return ''.join(ans[::-1])
    else:
      N -= 26**i


def main():
  # letter = input()
  # A(letter)
  # for x in ['A', 'Z', 'a', 'z']:
  #   A(x)

  # n, k = map(int, input().split())
  # p_list = map(int, input().split())
  # B(n, k, p_list)
  print(C(int(input())))
  #for i in range(1, 27):
  #  print(C(26 + i))
  # C(703)
  # C(18279)
  # C(475254)


if __name__ == '__main__':
  main()
import sys
sys.setrecursionlimit(2000000)
input = sys.stdin.readline
class UnionFind():
    def __init__(self,n):
        self.n=n
        self.parents = [i for i in range(n+1)]
        #dist[x]はxとその親との間の距離を保持している
        self.dist = [0]*(n+1)
    def find(self,x):
        if self.parents[x]==x:
            return x
        else:
            a = self.parents[x]
            self.parents[x]=self.find(self.parents[x])
            self.dist[x] += self.dist[a]
            return self.parents[x]
    def unite(self,l,r,d):
        rRoot = self.find(r)
        lRoot = self.find(l)
        if rRoot == lRoot:
            if self.dist[l] - self.dist[r] != d:
                print("No")
                exit()
        else:
            #rRootとlRoot、どちらが親になるべきか決める
            newLDist = d + self.dist[r]
            if newLDist>=self.dist[l]:
                self.parents[lRoot] = rRoot
                self.dist[lRoot] = newLDist-self.dist[l]
            else:
                self.parents[rRoot] = LRoot
                self.dist[rRoot] = self.dist[l]-newLDist

N,M = map(int,input().split())
tree = UnionFind(N)
for _ in range(M):
    l,r,d = map(int,input().split())
    tree.unite(l,r,d)
print("Yes")

### FIXED CODE ###

"""
unionFind木を使う。
根に対する距離を記録していく。
"""
import sys
sys.setrecursionlimit(2000000)
input = sys.stdin.readline
class UnionFind():
    def __init__(self,n):
        self.n=n
        self.parents = [i for i in range(n+1)]
        self.distance = [0]*(n+1)

    def find(self,x):
        if self.parents[x]==x:
            return x,0
        else:
            self.parents[x],dist2=self.find(self.parents[x])
            self.distance[x] += dist2
            return self.parents[x],self.distance[x]

    def union(self,l,r,dist):
        lRoot,lDist = self.find(l)
        rRoot,rDist = self.find(r)
        #まず、位置関係に矛盾がないかを調べる
        #lRootはlよりlDist右にいる
        #rRootはrよりrDist右にいる
        #lRoot=rRootのとき、lDist-rDist != distなら矛盾。
        if lRoot==rRoot and lDist-rDist != dist:
            print("No")
            exit()

        #より左にいる根を右にいる根にマージする
        if lDist < dist+rDist:
            #lRootがrRootよりも左の場合
            self.parents[lRoot]=rRoot
            self.distance[lRoot]=(dist+rDist)-lDist
        else:
            self.parents[rRoot]=lRoot
            self.distance[rRoot]=lDist-(dist+rDist)

N,M = map(int,input().split())
tree = UnionFind(N)
for i in range(M):
    L,R,D = map(int,input().split())
    tree.union(L,R,D)

print('Yes')
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
  for j in range(i + 1, n):
    result += (a[i] % (10**9 + 7)) * (a[i] % (10**9 + 7))
result = result % (10**9 + 7)
print(result)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
sum_a = 0
result = 0
for i in range(n):
  sum_a += a[i]
for j in range(n):
  sum_a -= a[j]
  result += sum_a * a[j]
print(result % (10**9 + 7))
A=int(input())
op=input()
B=int(input())
if op == '+':
    print(A+B)
else:
    print(A-B)

### FIXED CODE ###

A,op,B=map(str,input().split())
if op == '+':
    print(int(A)+int(B))
else:
    print(int(A)-int(B))
K,X = map(int,input().split)())
if K*500>=X:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

K,X = map(int,input().split())
if K*500>=X:
    print('Yes')
else:
    print('No')
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
n=int(input())
a=list(map(int, input().split()))
a.sort()
num=a[1]
alist=[0]*(num+2)
for i in range(n):
  for j in make_divisors(a[i]):
    if j<=num:
      alist[j]+=1
ans=0
for i in range(num+2):
  if alist[i]>=n-1:
    ans=i
print(ans)

### FIXED CODE ###

import math
n=int(input())
a=list(map(int, input().split()))
alist=[]
gcd1=a[0]
for i in range(0,n):
  gcd1=math.gcd(gcd1,a[i])
  alist.append(gcd1)
blist=[]
gcd2=a[n-1]
for i in range(n-1,-1,-1):
  gcd2=math.gcd(gcd2,a[i])
  blist.append(gcd2)
clist=[alist[n-2],blist[n-2]]
for i in range(n-2):
  clist.append(math.gcd(alist[i],blist[n-i-3]))
print(max(clist))
a,b = map(int,input()split())
print('#'*(b+2))
for _ in range(a):
  c = input()
  print('#{}#'.format(c))
print('#'*(b+2))

### FIXED CODE ###

a,b = map(int,input().split())
ans = []
for _ in range(a):
  c = input()
  ans.append('#{}#'.format(c))
print('#'*(b+2))
for _ in ans:
    print(_)
print('#'*(b+2))
n=int(input())
D=[[0 for _ in range(9)] for _ in range(9)]
for i in range(n):
    s=str(n)
    D[s[0]][s[-1]]+=1
a=0
for i in range(1,10):
    for j in range(1,10):
        a+=D[i][j]*D[j][i]
print(a)

### FIXED CODE ###

n=int(input())
D=[[0 for _ in range(10)] for _ in range(10)]
for i in range(1,n+1):
    s=str(i)
    D[int(s[0])][int(s[-1])]+=1
a=0
for i in range(10):
    for j in range(10):
        a+=D[i][j]*D[j][i]
print(a)
n = int(input())
c = [0 if x=='W' else 1 for x in input() ]
cnt = 0
while 1 in c[c.index(0):]:
  c[-(c[::-1].index(1)+1)] = 0
  c[c.index(0)] = 1
  cnt += 1
print(cnt)

### FIXED CODE ###

n = int(input())
c = input()
print(c[:c.count('R')].count('W'))
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

def war():
 if max([X]+x) < min([Y]+y):
    print('No War')
else:
  print('War')

war()

### FIXED CODE ###

N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

ans = 'No War' if max([X] + x) < min([Y] + y) else 'War'
print(ans)
N, K = map(int, input().split())
p = list(map(int, input().split()))

S = [0]*(N+1)
for i in range(N):
  S[i+1] = S[i] + (1+p[i])/2

ans = 0
for i in range(N-K+1):
  diff = S[i+K] - S[i]
  ans = max(ans, diff)
print(ans)

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
if len(a)==len(set(a)):
    print('YES')
else:
    print('NO')
A=int(input())
B=int(input())
N=int(input())

int train=A*N
int taxi=B
if (train<=taxi):
  print(train)
else:
  print(taxi)

### FIXED CODE ###

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

train=a[0]*a[1]
taxi=a[2]
if (train<=taxi):
  print(train)
else:
  print(taxi)
n = int(input())
i = 0
flag = false
while(7*i<=n):
  if (n-7*i)%4 == 0:
    flag = true
    break
if flag:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

n = int(input())
i = 0
flag = False
while(7*i<=n):
  if (n-7*i)%4 == 0:
    flag = True
    break
  i+=1
if flag:
  print("Yes")
else:
  print("No")
import numpy as np
h, w, m = map(int, input().split())
arr = np.zeros([h, w], dtype=np.int8)
for _ in range(m):
    c_h, c_w = map(int, input().split())
    arr[c_h-1, c_w-1] = 1
    
row_sum = np.sum(arr, axis=1)
col_sum = np.sum(arr, axis=0)
row_max_pos = np.argwhere(row_sum == np.max(row_sum))
col_max_pos = np.argwhere(col_sum == np.max(col_sum))
    
row_max = int(max(row_sum))
col_max = int(max(col_sum))

ans = []
for i in row_max_pos:
    for j in col_max_pos:
        if arr[i,j] == 1:
            ans.append(row_max + col_max-1)
        else:
            ans.append(row_max + col_max-1)

### FIXED CODE ###

h, w, m = map(int, input().split())
h_cnt = [0 for i in range(h)]
w_cnt = [0 for i in range(w)]
bomb = set()

for i in range(m):
    _h, _w = map(int, input().split())
    h_cnt[_h-1] += 1
    w_cnt[_w-1] += 1
    bomb.add(((_h-1),(_w-1))) #爆破対象の位置を判断

h_max = max(h_cnt)
w_max = max(w_cnt)

max_h = []
max_w = []

for i in range(h):
    if h_cnt[i] == h_max:
        max_h.append(i)

for i in range(w):
    if w_cnt[i] == w_max:
        max_w.append(i)

flg = True

for i in max_h:
    for j in max_w:
        if (i,j) not in bomb:
            flg = False
            break
print(h_max+w_max-1 if flg else h_max+w_max)
a,b = input().split()

if (a*b % 2 == 0):
  print("Even")
else:
  print('Odd')

### FIXED CODE ###

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

if (a*b % 2 == 0):
  print("Even")
else:
  print('Odd')
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

P = []
M = []
for i in A:
  if i < 0:
    M.append(abs(i))
  if i > 0:
    P.append(i)

if len(M) + len(P) < K:
  print(0)
  exit()
elif len(M) + len(P) == K:
  ans = 1
  for i in M:
    ans = ans * i % MOD
  for i in P:
    ans = ans * i % MOD
  if len(M) % 2 == 1:
    ans *= -1
    ans += MOD
  print(ans)
  exit()

M.sort(reverse = True)
P.sort(reverse = True)

if len(P) == 0:
  ans = 1
  if K % 2 == 0:
    x = 1 / 0
    for i in range(K):
      ans = ans * M[i] % MOD
  else:
    for i in range(K):
      ans = ans * -M[-1 -i] % MOD
    while ans < 0:
      ans += MOD
  print(ans)
else:
  ans = 1
  pn = 0
  mn = 0
  if K % 2 == 1:
    K -= 1
    ans *= P[0]
    pn = 1
  for i in range(K // 2):
    if pn + 2 > len(P):
      ans = ans * M[mn] * M[mn + 1] % MOD
      mn += 2
    elif mn + 2 > len(M):
      ans = ans * P[pn] * P[pn + 1] % MOD
      pn += 2
    else:
      p = P[pn] * P[pn + 1]
      m = M[mn] * M[mn + 1]
      if p > m:
        ans = ans * p % MOD
        pn += 2
      else:
        ans = ans * m % MOD
        mn += 2
  print(ans)


### FIXED CODE ###

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

P = []
M = []
Z = 0
for i in A:
  if i < 0:
    M.append(abs(i))
  if i > 0:
    P.append(i)
  if i == 0:
    Z += 1

if len(M) + len(P) < K:
  print(0)
  exit()
elif len(M) + len(P) == K:
  ans = 1
  for i in M:
    ans = ans * i % MOD
  for i in P:
    ans = ans * i % MOD
  if len(M) % 2 == 1:
    ans *= -1
    ans += MOD
  print(ans)
  exit()

M.sort(reverse = True)
P.sort(reverse = True)

if len(P) == 0:
  ans = 1
  if K % 2 == 0:
    for i in range(K):
      ans = ans * M[i] % MOD
  else:
    if Z != 0:
      print(0)
      exit()
    for i in range(K):
      ans = ans * -M[-1 -i] % MOD
    while ans < 0:
      ans += MOD
  print(ans)
else:
  ans = 1
  pn = 0
  mn = 0
  if K % 2 == 1:
    K -= 1
    ans *= P[0]
    pn = 1
  for i in range(K // 2):
    if pn + 2 > len(P):
      ans = ans * M[mn] * M[mn + 1] % MOD
      mn += 2
    elif mn + 2 > len(M):
      ans = ans * P[pn] * P[pn + 1] % MOD
      pn += 2
    else:
      p = P[pn] * P[pn + 1]
      m = M[mn] * M[mn + 1]
      if p > m:
        ans = ans * p % MOD
        pn += 2
      else:
        ans = ans * m % MOD
        mn += 2
  print(ans)
vals = [int(i) for i in input().split()]
    a = vals[0]
    b = vals[1]
    c = vals[2]
    d = vals[3]
    res2 = a//d + (1 if(a % d > 0) else 0)
    res1 = c//b + (1 if(c % b) > 0 else 0)
    res = "Yes" if(res1 <= res2) else "No"
    print(res)

### FIXED CODE ###

vals = [int(i) for i in input().split()]
a = vals[0]
b = vals[1]
c = vals[2]
d = vals[3]
res2 = a//d + (1 if(a % d > 0) else 0)
res1 = c//b + (1 if(c % b > 0) else 0)
res = "Yes" if(res1 <= res2) else "No"
print(res)
int(x)
print(x**3)

### FIXED CODE ###

x = input()
x = int(x)
print(x**3)
def euclidean(a,b):
    _ = a % b
    while 1:
        if b % _ == 0:
            break
        else:
            _ = b % _
    return _

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

a = max(A, B)
b = min(A, B)
e = euclidean(a,b)

by = []
r = int(e ** (1 / 2))
for i in range(1, r + 1):
    if e % i == 0:
        by.append(i)
        j = e // i
        if j != i:
            by.append(j)
by.sort()
print(by)
print(by[K - 1])

### FIXED CODE ###

def euclidean(a,b):
  _ = a % b
  if _ == 0:
    return b
  else:
    while 1:
      if b % _ == 0 :
        break
      else:
        _ = b % _
    return _
  
A, B, K = map(int, input().split())
 
a = max(A, B)
b = min(A, B)
e = euclidean(a, b)
by = []
r = int(e ** (1 / 2))
 
for i in range(1, r + 1):
  if e % i == 0:
    by.append(i)
    j = e // i
    if j != i:
      by.append(j)
by.sort(reverse = True)
print(by[K - 1])
n = list(map(int,input().split()))
x = list(map(int,input().split()))
y = sorted(x)
l = y[n/2-2]
r = y[n/2-1]
for i in range(n):
    if x[i] <= l:print(r)
    else:print(l)


### FIXED CODE ###

n = int(input())
x = list(map(int,input().split()))
y = sorted(x)
l = y[n//2-1]
r = y[n//2]
for i in range(n):
    if x[i] <= l:print(r)
    else:print(l)
inp = input()
inp = input()

def mp(nums):
  n = 1
  limit = 10**18
  for num in nums:
    n *=num
    if n > limit:
      print(-1)
      return
  print(n)

mp([int(x) for x in inp.split(" ")])


### FIXED CODE ###

inp=input()
num = [int(x) for x in inp.split(" ")]
print(num[0]*num[1])
a,b,k=map(int,input().split())
if k>=0 and k <=a:
  print(a-k,b)
elif k>a, k<=a+b:
  print(0, b-(k-a))
else:
  print(0,0)

### FIXED CODE ###

a,b,k=map(int,input().split())
if k>=0 and k <=a:
  print(a-k,b)
elif k>a and k<=a+b:
  print(0, b-(k-a))
else:
  print(0,0)
n,m,k = map(int,input().split())

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

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

c = [0]
d = 0
for i in range(n):
    d += a[i]
    c.append(d)
    if d > k:
        break

e = [0]
f = 0
for i in range(n):
    f += b[i]
    e.append(f)
    if f > k:
        break

p = len(c)
q = len(e)

ans = 0
j = q-1
for i in range(p):
    if c[i] > k:
        break
    else:
        while c[i] + e[j] > k:
            j -= 1
    ans = max(i + j,ans)

print(ans)

### FIXED CODE ###

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

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

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


c = [0]
d = 0
for i in range(n):
    d += a[i]
    c.append(d)

e = [0]
f = 0
for i in range(m):
    f += b[i]
    e.append(f)


ans = 0
j = m
for i in range(n+1):
    if c[i] > k:
        break
    else:
        while c[i] + e[j] > k:
            j -= 1
    ans = max(i + j,ans)

print(ans)
a = input()
b = input()

A = int (a)
B = int (b)

x = a*b

y = int(x)

print(x)

### FIXED CODE ###

A,B=input().split()
A = int(A)
B1,B2 = B.split(".")
t = A*(int(B1)*100 + int(B2))
print(int(t//100))
def move(now, goal, m):
    global rlt
    if m==goal:
        rlt += 1
        return

    if m>goal: return

    move(m, goal, m+1)
    move(m, goal, m+2)


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

A = [int(input()) for i in range(M)]

for i in range(1, len(A)):
    if A[i]-A[i-1]==1:
        print(0)
        exit()

ans = 0

m = []
now = 0
rlt = 0
for a in A:
    move(now, a-1, now+1)
    move(now, a-1, now+2)
    m.append(rlt)
    rlt = 0

now = A[len(A)-1]+1
move(now, N, now+1)
move(now, N, now+2)
m.append(rlt)

ans = 1

for i in m:
    ans *= i

print(ans%1000000007)



### FIXED CODE ###

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

oks = [True]*(N+1)

for i in range(M):
    a = int(input())
    oks[a] = False

dp = [0]*(N+1)

dp[0]=1
if oks[1]==True: dp[1] = 1

for i in range(2, N+1):
    if oks[i]==True:
        dp[i] = (dp[i-1] + dp[i-2]) % (1e9+7)

print(int(dp[N]))
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
a.sort()
b = 1
ans = 0
for i in range(k - 1, n):
    ans += b * a[i]
    ans -= b * a[n - i - 1]
    ans %= mod
    b *= (i + 1) / (i + 1 - (k - 1))
    b = int(b)
print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
a.sort()
b = 1
ans = 0
for i in range(k - 1, n):
    ans += b * (a[i] - a[n - i - 1])
    ans %= mod
    b = (i + 1) * b
    c = i + 1 - (k - 1)
    b = pow(c, mod - 2, mod) * b % mod
print(ans)
N, M, K = map(int, input().split())

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


class X:
    def __init__(self, K, A, B, N, M):
        self.A = A
        self.B = B
        self.K = K
        self.N = N
        self.M = M
        self.ret = 0

    def helper(self, i, j, time, num_a, num_b):
        if time > self.K:
            return

        self.ret = max(self.ret, num_a + num_b)

        if num_a < self.N:
            self.helper(i + 1, j, time + self.A[i], num_a + 1, num_b)

        if num_b < self.M:
            self.helper(i, j + 1, time + self.B[j], num_a, num_b + 1)

        return

    def run(self):
        self.helper(0, 0, 0, 0, 0)

        return self.ret


c = X(K, A, B, N, M)
print(c.run())


### FIXED CODE ###

import bisect

N, M, K = map(int, input().split())

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

A_sum = A.copy()
B_sum = B.copy()

for i in range(1, N):
    A_sum[i] = A_sum[i - 1] + A[i]

A_sum = [0] + A_sum

for i in range(1, M):
    B_sum[i] = B_sum[i - 1] + B[i]


max_ = 0
for i, n in enumerate(A_sum):
    if n > K:
        continue

    target = K - n
    v = bisect.bisect_left(B_sum, target)

    if v != M and B_sum[v] == target:
        v += 1

    max_ = max(max_, i + v)

print(max_)
S = input()
T = input()
cnt = 0
for i in range(len(S)):
  if cnt > 30:
    break
  if S[i] != T[i]:
    X = S[i]
    S = S.replace(S[i],"X")
    S = S.replace(T[i],X)
    S = S.replace("X",T[i])
    cnt += 1
  print(S)
print("Yes" if S == T else "No")

### FIXED CODE ###

S = input()
T = input()
cnt = 0
for i in range(len(S)):
  if cnt > 30:
    break
  if S[i] != T[i]:
    X = S[i]
    S = S.replace(S[i],"X")
    if T[i] in S:
      S = S.replace(T[i],X)
    S = S.replace("X",T[i])
    cnt += 1
print("Yes" if S == T else "No")
a,b=(int(x) for x in input().split())
 
import math 
 
i=0
while i<10001:
  i++
  if math.float(i)==a and math.float(i)==b:
    print(i)
else:
  print(-1)

### FIXED CODE ###

a,b=(int(x) for x in input().split())
 
import math 
 
i=0
while i<10001:
  i+=1
  if math.floor(i*0.08)==a and math.floor(i*0.1)==b:
    print(i)
    break
else:
  print(-1)
n,m=map(int,input().split())
lst=[[] for i in range(n)]
visited=[True]+[False]*(n-1)
ans=[0]*n

for i in range(m):
      a,b=map(int,input().split())
      lst[a-1].append(b-1)
      lst[b-1].append(a-1)

Q=[0]

While Q:
  v=Q.pop(0)
  for i in lst[v]:
        if visited[i]==False:
              visited[i]=True
              ans[i]=v
              Q.append(v)

print('Yes')

for i in range(1,n):
      print(ans[i])

### FIXED CODE ###

n,m=map(int,input().split())
lst=[[] for i in range(n)]
visited=[False for i in range(n)]
ans=[0]*n

for i in range(m):
      a,b=map(int,input().split())
      lst[a-1].append(b-1)
      lst[b-1].append(a-1)

Q=[0]
visited[0]=True

while Q:
  v=Q.pop(0)
  for i in lst[v]:
        if visited[i]==False:
              visited[i]=True
              ans[i]=v
              Q.append(i)

print('Yes')

for i in range(1,n):
      print(ans[i]+1)
a=[]
b=[]
for i in range(input()):
    if i%3!=0 and i%5!=0:
        a.append(i)
    else:
        b.append(i)
print(sum(a))

### FIXED CODE ###

a=[]
for i in range(1,int(input())+1):
    if i%3!=0 and i%5!=0:
        a.append(i)
print(sum(a))