Harryxun/stf_run huggingface dataset:
S = input()

# 2^n-1の2進数は全組み合わせを表す
combs = pow(2, len(S) - 1)
total = 0
for i in range(combs):
    # i番目の組み合わせ（2進数）
    comb_i = format(i, '0' + str(len(S)) + 'b')
    if len(comb_i) > 1:
        comb_i = comb_i[1:]

    tmp = S[0]
    for j in range(len(comb_i)):
        b = int(comb_i[j])
        if b == 1:
            tmp += "+"
        tmp += S[j + 1]
    total += eval(tmp)
print(total)



### FIXED CODE ###

import sys

S = input()

# 2^n-1の2進数は全組み合わせを表す
combs = pow(2, len(S) - 1)
if len(S) == 1:
    print(S)
    sys.exit()

total = 0
for i in range(combs):
    # i番目の組み合わせ（2進数）
    comb_i = format(i, '0' + str(len(S)) + 'b')
    if len(comb_i) > 1:
        comb_i = comb_i[1:]

    tmp = S[0]
    for j in range(len(comb_i)):
        b = int(comb_i[j])
        if b == 1:
            tmp += "+"
        tmp += S[j + 1]
    total += eval(tmp)
print(total)
import math
N = int(input())

n = N
ans = 0
n_dig = math.floor(math.log10(N)) + 1 # Nの桁数
mai = [0] * n_dig # 枚数

for i in range(n_dig):
    d = n % 10
    n //= 10
    if d < 1 + 10 - d:
        mai[i] = d
    else:
        mai[i] = d - 10 # おつり
        mai[i+1] = 1

    ans += min(d, 1 + 10 - d)
    if n == 0: break

print(sum([abs(m) for m in mai]))

### FIXED CODE ###

n = "0" + input()

ans = 0
n_dig = len(n) # Nの桁数

carry = 0
d_next = int(n[n_dig - 1])

for i in range(n_dig - 1, 0, -1):  # n[0]はダミーなのでn[1]で止める
    d = d_next
    d_next = int(n[i - 1])

    if carry + d <= 4 or (carry + d == 5 and d_next <= 4):
        ans += d + carry
        carry = 0  # 繰り上がり
    else:
        ans += 10 - d - carry
        carry = 1

print(ans + carry)
n = int(input())
table = map(int,input().split())
print("{} {} {}".format(max(table[n]),min(table[n]),sum(table[n]))))


### FIXED CODE ###

n = input()
table = list(map(int,input().split()))
print("{} {} {}".format(min(table),max(table),sum(table)))
import sys
N, X = map(int, input().split())
L = list(map(int, input().split()))
cnt = 0
total = 0
for i in range(N+1):
  if total <= X:
    cnt += 1
    total += L[i]
  else:
    print(cnt)
    sys.exit()

### FIXED CODE ###


N, X = map(int, input().split())
L = list(map(int, input().split()))
cnt = 1
total = 0
for i in range(N):
  total += L[i]
  if total <= X:
    cnt += 1
  else:
    break
print(cnt)
print(["TBD","Heisei"][int(20190430>=int(str(input()).replace("/","")))]

### FIXED CODE ###

print(["TBD","Heisei"][int(20190430>=int(str(input()).replace("/","")))])
a1, a2, a3 = map(int, input())
if (a1+a2+a3)>21:
  print("bust")
else:
  print("win")

### FIXED CODE ###

a1, a2, a3 = map(int, input().split())
if (a1+a2+a3)>21:
  print("bust")
else:
  print("win")
H , W = map(int, input() .split(""))


if H % 2 ==0:
    N = H * W / 2

else:
    N = int(H * W / 2) + 1

print(N)



### FIXED CODE ###

H , W = map(int, input() .split())

if W == 1:
    N = 1

elif H == 1:
    N = 1

else:   
    if H % 2 ==0:
        N = H * W / 2
        
            
    elif H % 2 ==1:
        if W % 2 ==0:
            N = H * W / 2
        else:
            N = int(H * W / 2) + 1

print(int(N))
a,b,c,d=(int(x) for x in input().split())

x = range(a,b+1)
y = range(c,d+1)

X = list(x)
Y = list(y)

max = X[0] * Y[0]

for i in range(1, len(X)):
	for j in range(1, len(Y)):
		if max < X[i] * Y[j]:
			max = X[i] * Y[j]
print(max)


### FIXED CODE ###

a,b,c,d = map(int, input().split())
list = [a*c, a*d, b*c, b*d]
print(max(list))
i = {1,2,4,8,16,32,64,128}
k = int(input())
 
for p in range(len(i)):
  if k == 1:
    print(1)
  elif k < i[p]:
    print(i[p-1])
    break

### FIXED CODE ###

i = [1,2,4,8,16,32,64,128]
k = int(input())
 
for p in range(len(i)):
  if k == 1:
    print(1)
    break
  elif k < i[p]:
    print(i[p-1])
    break
length=len(s)-2
return s[0]+length+s[-1]

### FIXED CODE ###

s=input()
length=len(s)-2
print(s[0]+str(length)+s[-1])
a,b,c = (int, raw_input().split())
n = [a,b,c]
x = n.sort()
for i in x:
    print i,

### FIXED CODE ###

a,b,c = map(int, raw_input().split())
n = [a,b,c]
n.sort()
for i in n:
    print i,
a,b = map(int,input.split())
if a==i and b==1:
  print(1)
else:
  print(min(a,b)-1)

### FIXED CODE ###

a,b = map(int,input().split())
if a<=b:
  print(a)
else:
  print(a-1)
mport sys
K = int(input())
A,B = map(int,input().split())
for i in range(A,B+1):
  if i%K==0:
    print("OK")
    sys.exit()
print("NG")

### FIXED CODE ###

import sys
K = int(input())
A,B = map(int,input().split())
for i in range(A,B+1):
  if i%K==0:
    print("OK")
    sys.exit(0)
print("NG")
import fractions as fr
import copy
from functools import reduce
 
N = int(input())
yaku = [0]*N
X = input().split()
X = list(set(X))
X = list(map(int, X))
 
 
def gcd_list(numbers):
    return reduce(fr.gcd, numbers)
 
 
for i in range(N):
    Xwork = copy.copy(X)
    del(Xwork[i])
    yaku[i] = gcd_list(Xwork)
 
print(max(yaku))

### FIXED CODE ###

from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
L_A = [0] * (N+1)
R_A = [0] * (N+1)
for i in range(N):
    L_A[1+i] = gcd(L_A[i], A[i])
for i in reversed(range(N)):
    R_A[i] = gcd(R_A[i+1], A[i])
print(max(gcd(L_A[i], R_A[i+1]) for i in range(N)))
s1, s2, s3 = map(str, input().split())
lst = [s[0], s[1], s[2]].capitallize()
print(''.join(lst))

### FIXED CODE ###

s1, s2, s3 = map(str, input().split())
lst = [s1[0].capitalize(), s2[0].capitalize(), s3[0].capitalize()]
print(''.join(lst))
import math
import collections
from collections import defaultdict

N = int(input())
iwa = []
mod = 10**9+7

for i in range(N):
    a, b = map(int,input().split())
    if a == 0 and b == 0:
        continue
    elif b == 0:
        iwa.appned((1,0))
    elif a == 0:
        iwa.append((0,1))
    elif b > 0:
        c = math.gcd(a,b)
        iwa.append((a/c, b/c))#bは正
    else:
        c = math.gcd(a,b)
        iwa.append((-a/c, -b/c))#bは正
        
S = set(iwa)
I = collections.Counter(iwa)
#print(I)
jdg = defaultdict(int)

ans = 1
for i in S:
    if jdg[i] == 1:
        continue
    elif i == (1,0) or i == (0,1):
        k = I[(1,0)]
        l = I[(0,1)]
        if min(k,l) == 0:
            ans *= pow(2,max(l,k),mod)
        else:
            ans *= (pow(2,l,mod)-1) + (pow(2,k,mod)-1)+1
            ans %= mod
        jdg[(1,0)] = 1
        jdg[(0,1)] = 1
    else:
        k = I[i]
        a, b = i
        if a < 0:
            l = I[(b,-a)]
            jdg[(b, -a)] = 1
        else:
            l = I[(-b,a)]
            jdg[(-b,a)] = 1
        if min(l,k) == 0:
            ans *= pow(2,max(l,k),mod)
        else:
            ans *= (pow(2,l,mod)-1) + (pow(2,k,mod)-1)+1
            ans %= mod
        jdg[i] = 1
print(ans-1)

### FIXED CODE ###

from math import gcd
from collections import defaultdict

N = int(input())
AB = [tuple(map(int, input().split())) for _ in range(N)]
MOD = 10**9 + 7

d = defaultdict(int)#defaultdictで数えあげ
cnt_00 = 0
cnt_0b = 0
cnt_a0 = 0
for a,b in AB:
    if a == b == 0:
        cnt_00 += 1
    elif a == 0:
        cnt_a0 += 1
    elif b == 0:
        cnt_0b += 1
    else:
        num_gcd = gcd(a,b)
        grad = 1 if a * b > 0 else -1
        a //= num_gcd
        b //= num_gcd
        d[(grad, abs(a), abs(b))] += 1

ans = 1
for k in d.keys():
    if d[k] == 0:
        continue
    
    grad, a, b = k[0], k[1], k[2]
    if (-grad, b, a) in d:
        
        # 傾き a/bのものを一つ以上選ぶ場合（-b/aは選ばない） + -b/aから一つ以上選ぶ場合（a/bは選ばない） + どちらからも選ばない場合
        ans *= (pow(2, d[(grad, a, b)], MOD)-1) + (pow(2, d[(-grad, b, a)], MOD)-1) + 1
        ans %= MOD
        d[(grad, a, b)] = 0
        d[(-grad, b, a)] = 0
    else:
        # a/bから0個以上選ぶ場合
        ans *= pow(2, d[(grad, a, b)], MOD)
        ans %= MOD
        d[(grad, a, b)] = 0

# a,bの一方のみ0の場合 + どちらからも選ばない場合
ans *= (pow(2, cnt_a0, MOD)-1) + (pow(2, cnt_0b, MOD)-1) + 1
ans %= MOD

# 0,0のみを１つだけ入れる場合
ans += cnt_00
# なにも選ばない場合を除く
ans -= 1

ans %= MOD

print(ans)
N = int(input())
H =list(map(int, input().split()))
count = []
count_tmp = 0
for i in range(N-1):
    if H[i] >= H[i+1]:
        count_tmp += 1
        if i == N-2:
            count.append(count_tmp)
    else:
        print(i)
        count.append(count_tmp)
        count_tmp = 0
print(max(count))

### FIXED CODE ###

N = int(input())
H =list(map(int, input().split()))
count = []
count_tmp = 0
if N == 1:
    print(0)
else:
    for i in range(N-1):
        if H[i] >= H[i+1]:
            count_tmp += 1
            if i == N-2:
                count.append(count_tmp)
        else:
            count.append(count_tmp)
            count_tmp = 0
    print(max(count))
X = int(input())
c = 0
for i in range(100):
    for j in range(100):
        if i**5-j**5==X:
            a = i
            b = j
            c += 1
            break
    if c ==0:
        for j in range(100):
            if i**5+j**5==X:
            a = i
            b = j
            break
print(a b)            

### FIXED CODE ###

X = int(input())
c = 0
for i in range(-200,200):
    for j in range(-200,200):
        if i**5-j**5==X:
            a = i
            b = j
            print(a, b)    
            c = 1
            break
    if c != 0:
        break
# -*- coding: utf-8 -*-
n = int(input())
arr = [int(i) for i in input().split(" ")]
l = len(arr)
count = 1
for i in range(0, l-3):
    if arr[i] < arr[i+1] and arr[i*1] < arr[i*2]:
        count += 1
    elif arr[i+2] < arr[i+1] and arr[i*1] < arr[i2]:
        count += 1
print(count)


### FIXED CODE ###

# -*- coding: utf-8 -*-
n = int(input())
arr = [int(i) for i in input().split(" ")]
l = len(arr)
count = 0
for i in range(0, l-2):
    m = arr[i+1]
    tmp = [arr[i], arr[i+1], arr[i+2]]
    tmp.sort()
    if m == tmp[1]:
        count += 1
print(count)
from math import gcd

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

def main():
    N, M = map(int, input().split())
    A = list(set(map(int, input().split())))
    if len(A) == 1:
        l = A[0]
    else:
        l = lcm(A[0], A[1])
        for i in A[2:]:
            l = lcm(l, i)
    print((M + l // 2) // l)

main()


### FIXED CODE ###

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

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

def invalid(a, b):
    if a > b:
        a, b = b, a
    return (b % a == 0 and ((b - a) // 2) % a != 0)

def main():
    N, M = map(int, input().split())
    A = list(set(map(int, input().split())))
    A.sort(reverse=True)
    if len(A) == 1:
        l = A[0]
    else:
        if invalid(A[0], A[1]):
            return 0
        l = lcm(A[0], A[1])
        for i in A[2:]:
            if invalid(l, i):
                return 0
            if l % i == 0:
                continue
            if l // 2 > M:
                return 0
            l = lcm(l, i)
    return (M + l // 2) // l

print(main())
n=int(input())
while True:
  if n==0:
    break
  for i in range(n):
    m,e,j=map(int,input().split())
    if m==100 or e==100 or j==100:
      print('{}'.format('A'))
    elif (m+e)/2>=90:
       print('{}'.format('A'))
    elif (m+e+j)/3>=80:
       print('{}'.format('A'))
    elif (m+e+j)/3>=70:
       print('{}'.format('B'))
    elif (m+e+j)/3>=50:
      if m>=80 or e>=80:
          print('{}'.format('B'))
      else:
        print('{}'.format('C'))
    else:
      print('{}'.format('C'))


### FIXED CODE ###

while True:
  n=int(input())
  if n==0:
    break
  for i in range(n):
    m,e,j=map(int,input().split())
    if m==100 or e==100 or j==100:
      print('{}'.format('A'))
    elif ((m+e)/2)>=90:
       print('{}'.format('A'))
    elif ((m+e+j)/3)>=80:
       print('{}'.format('A'))
    elif ((m+e+j)/3)>=70:
       print('{}'.format('B'))
    elif ((m+e+j)/3)>=50:
      if m>=80 or e>=80:
          print('{}'.format('B'))
      else:
        print('{}'.format('C'))
    else:
      print('{}'.format('C'))
N = int(input())
max_num = 1
cnt = 0
list_num = [int(x) for x input().split()]
for x in list_num:
	if max_num <= a:
		cnt += 1
		max_num = a
print(cnt)

### FIXED CODE ###

N = int(input())
max_num = 1
cnt = 0
list_num = [int(x) for x in input().split()]
for i in range(len(list_num)):
	if max_num <= list_num[i]:
		cnt += 1
		max_num = list_num[i]
print(cnt)
import sys
     
    s = sys.stdin.read().strip()
    c = 0
    l = len(s)
    for i in range(int(l/2)):
      if s[i] != s[l-i-1]:
        c += 1
    print(c)

### FIXED CODE ###

import sys

s = sys.stdin.read().strip()
c = 0
l = len(s)
for i in range(int(l/2)):
  if s[i] != s[l-i-1]:
    c += 1
print(c)
n, k = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
if n-k <= 0:
    print(0)
else:
    ans = sum(H[:n-k])
print(ans)


### FIXED CODE ###

n, k = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
if n-k <= 0:
    print(0)
    exit()
else:
    ans = sum(H[:n-k])
print(ans)
from collections import defaultdict
from fractions import Fraction

memo = {}
gl_ans = 10 ** 10

def dfs(i, a, b, c):
    global gl_ans
    if a != 0 and b != 0 and Fraction(a, b) == Fraction(Ma, Mb):
        gl_ans = min(gl_ans, c)
        return c

    if i == N:
        return 10 ** 10

    if (i, a, b, c) in memo:
        return memo[(i, a, b)]

    if c > gl_ans:
        return 10 ** 10

    ans = dfs(i + 1, a + l[i][0], b + l[i][1], c + l[i][2])
    ans = min(ans, dfs(i + 1, a, b, c))

    memo[(i, a, b, c)] = ans

    return ans


if __name__ == '__main__':

    N, Ma, Mb = map(int, input().split())
    l = []
    for _ in range(N):
        a, b, c = map(int, input().split())
        l.append((a, b, c))

    s = dfs(0, 0, 0, 0)
    if s >= 10 ** 10:
        print(-1)
    else:
        print(s)
        

### FIXED CODE ###

from collections import defaultdict
from fractions import Fraction

INF = int(1e14)


def main():
    N, Ma, Mb = map(int, input().split())
    l = []
    for _ in range(N):
        l.append(tuple(map(int, input().split())))

    ans = INF
    dp = [[[INF] * 401 for i in range(401)] for j in range(N + 1)]
    dp[0][0][0] = 0

    max_a, max_b = 1, 1
    for i in range(N):

        for a in range(max_a, -1, -1):
            for b in range(max_b, -1, -1):
                if dp[i][a][b] != INF:
                    dp[i + 1][a + l[i][0]][b + l[i][1]] = min(dp[i + 1][a + l[i][0]][b + l[i][1]], dp[i][a][b] + l[i][2])
                    dp[i + 1][a][b] = min(dp[i + 1][a][b], dp[i][a][b])

                    max_a = max(max_a, a + l[i][0])
                    max_b = max(max_b, b + l[i][1])

    for a in range(1, len(dp[0])):
        for b in range(1, len(dp[1])):
            if a * Mb == b * Ma:
                ans = min(ans, dp[N][a][b])

    print((-1 if ans == INF else ans))

if __name__ == '__main__':
    main()
n= input()
s=[]
for i in range(n):
  s.append(input())
  
print(set(s))


### FIXED CODE ###

n= int(input())
s=[]
for i in range(n):
  s.append(input())
  
print(len(set(s)))
N = int(input())

T = [[] for i in range(N)]
F = [None for i in range(N-1)]
for i,n in enumerate(range(N-1)):
    a,b = map(int,input().split())
    T[a-1].append(b-1)
    F[i] = b-1

# print(T)

R = [None for i in range(N)]
def dfs(cur, mx, color):
    R[cur] = color
    if color == -1:
        mx = max(len(T[cur]), mx)
    else:
        mx = max(len(T[cur])+1, mx)
    d = 0
    mmx = mx
    for i,t in enumerate(T[cur], start=1):
        if i==color:
            d=1
        mmx = max(mmx, dfs(t, mx, i+d))
        # dfs(t, mx, i)
    return mmx
M = dfs(0, 1, -1)
# print(R)
# print(F)
# print(M)
# for i,f in enumerate(F):
#     print(R[f])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

N = int(input())

E = []
T = [[] for i in range(N)]
for i,n in enumerate(range(N-1)):
    a,b = map(int,input().split())
    E.append((a-1,b-1))
    T[a-1].append(b-1)

# print(E)
# print(T)



R = [None for i in range(N)]
def dfs(using, cur):
    R[cur] = using
    i=0
    for t in T[cur]:
        if i==using:
            i+=1
        dfs(i,t)
        i+=1


dfs(-1, 0)

print(max(R)+1)
# print(K)
for e in E:
    print(R[e[1]]+1)

# print(K)
s = input()
n = len(s)
l = [[]for i in range(26)]

for i, c in enumerate(s * 2):
    l[ord(c) - ord('a')].append(i)


from bisect import *

shukai = 0
now = 0

t = input()
for c in t:
    x = ord(c) - ord('a')
    if len(l[x]) == 0:
        print(-1)
        exit()
    i = bisect(l[x], now)
    now = l[x][i] + 1
    if now >= n:
        now -= n
        shukai += 1


print(shukai * n + now)


### FIXED CODE ###

s = input()
n = len(s)
l = [[]for i in range(26)]

for i, c in enumerate(s * 2):
    l[ord(c) - ord('a')].append(i)


from bisect import *

shukai = 0
now = 0

t = input()
for c in t:
    x = ord(c) - ord('a')
    if len(l[x]) == 0:
        print(-1)
        exit()
    i = bisect_left(l[x], now)
    now = l[x][i] + 1

    if now >= n:
        now -= n
        shukai += 1


print(shukai * n + now)
#-*-coding:utf-8-*-

def main():
    r = int(input())
    if r < 2000:
        print('ABC')
    elif r >= 1200 ans r < 2800:
        print('ARC')
    else:
        print('AGC')

if __name__ == '__main__':
    main()

### FIXED CODE ###

#-*-coding:utf-8-*-

def main():
    r = int(input())
    if r < 1200:
        print('ABC')
    elif r >= 1200 and r < 2800:
        print('ARC')
    else:
        print('AGC')

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


n,m = list(map(int, input().split()))
from collections import defaultdict
ns = defaultdict(set)
ins = defaultdict(set)
ds = [0]*n
sts = [None]*m
for i in range(m):
    s,t = map(int, input().split())
    s -= 1
    t -= 1
    ns[t].add(s)
    ins[s].add(t)
    ds[s] += 1
    sts[i] = (s,t)
ps = [None]*n
ts = [None]*n

def sub(x):
    global ps,ts
    if x is not None:
        s,t = x
#         s,t = sts[x]
        if ds[s]<=1:
            return None
        ns[t].remove(s)
        ds[s] -= 1
    ps[0] = 1
    ts[0] = 0
    start = 1
    for i in range(start, n):
        pp = 0
        tt = 0
        for v in ns[i]:
            if ps[v]==0:
                continue
            if ds[v]>0:
                pp += ps[v]/ds[v]
                tt += (ts[v]+1)*ps[v]/ds[v]
        ps[i] = pp
        if pp>0:
            ts[i] = tt/pp
    if x is not None:
        ns[t].add(s)
        ds[s] += 1
    return ts[n-1]
ans = sub(None)
ips = ps[:]
its = ts[:]
for i in range(n):
    if len(ins[i])>=2:
        mm = min(its[j] for j in ins[i])
        for j in ins[i]:
            if its[j]==mm:
                break
        res = sub((i,j))
        if res is not None:
            ans = min(ans, res)
print(ans)

### 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,m = list(map(int, input().split()))
from collections import defaultdict
ns = defaultdict(set)
ins = defaultdict(set)
ds = [0]*n
sts = [None]*m
for i in range(m):
    s,t = map(int, input().split())
    s -= 1
    t -= 1
    ns[t].add(s)
    ins[s].add(t)
    ds[s] += 1
    sts[i] = (s,t)
ts = [None]*n

def sub(x):
    global ts
    if x is not None:
        s,t = x
#         s,t = sts[x]
        if ds[s]<=1:
            return None
        ns[t].remove(s)
        ins[s].remove(t)
        ds[s] -= 1
    ts[n-1] = 0
    for i in range(n-2, -1, -1):
        tt = 0
        for v in ins[i]:
            tt += (ts[v])
        ts[i] = tt/len(ins[i]) + 1
    if x is not None:
        ns[t].add(s)
        ins[s].add(t)
        ds[s] += 1
    return ts[0]
ans = sub(None)
its = ts[:]
for i in range(n):
    if len(ins[i])>=2:
        mm = max(its[j] for j in ins[i])
        for j in ins[i]:
            if its[j]==mm:
                break
        res = sub((i,j))
        if res is not None:
            ans = min(ans, res)
print(ans)
x = int(input())

num = x // 3
rem = x % 3

if rem == 1:
    res = (num+1)*(num**2)

elif rem == 2:
    res = ((num + 1) ** 2) * num

else:
    res = num ** 3

res2 = (x/3)**3
if res > res2:
    print(res)
else:

### FIXED CODE ###

x = int(input())

num = x // 3
rem = x % 3

if rem == 1:
    res = (num+1)*(num**2)

elif rem == 2:
    res = ((num + 1) ** 2) * num

else:
    res = num ** 3

res2 = (x/3)**3
if res > res2:
    print(res)
else:
    print(res2)
n, m, k = map(int, input().split())
a_lsit = list(map(int, input().split()))
b_list = list(map(int, input().split()))

i = 0
j = 0
ans = 0

while k >= 0:
    if i <= n-1 and j <= m-1:
        k -= min(a_lsit[i], b_list[j])
        if a_lsit[i] < b_list[j]:
            i += 1
        else:
            j += 1
    elif i > n-1:
        k -= b_list[j]
        j += 1
    elif j > m-1:
        k -= a_lsit[i]
        i += 1

    if k < 0:
        break

    ans += 1
    
print(ans)

### FIXED CODE ###

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

sa = [0] * (n+1)
sb = [0] * (m+1)
r = m
ans = 0

for i in range(n):
    sa[i+1] = sa[i] + a[i]
for i in range(m):
    sb[i+1] = sb[i] + b[i]

for i in range(n+1):
    if sa[i] > k:
        break
    while sa[i] + sb[r] > k:
        r -= 1
    ans = max(ans, i+r)
print(ans)
N = int(input())
A = list(map(int, input().split()))
A_set = list(set(A))
Ad = {a_set: A.count(a_set) for a_set in A_set}
score_sum = sum([(x>1) * x * (x-1) / 2 for x in list(Ad.values())])
Ad_score = {ad_key: score_sum - (ad_value -1) * (ad_value > 0) for ad_key, ad_value in Ad.items()}
A_out = [str(int(Ad_score[a])) for a in A]

print('\n'.join(A_out))


### FIXED CODE ###

N, M = map(int, input().split())
print(int((N!=0) * N * (N-1)/2 + (M!=0) * M *(M-1)/2))
S = input()
T = input()

n = 1

for a in range len(S)

if S[a] = T[a] :
    n += 1

return n

### FIXED CODE ###

S = input()
T = input()

n = 0

for a in range(len(S)) :

    if not S[a] == T[a] :
        n += 1

print(n)
import numpy as np
from functools import reduce

def gcd(*numbers):
    return reduce(np.gcd, numbers)

N, X = map(int, input().split())
x = np.array(list(map(int, input().split())))
if N == 1:
    print(np.abs(x[0] - X))
else:
    x = np.abs(x - X)
    print(min(gcd(x)))

### FIXED CODE ###

import numpy as np
import fractions
from functools import reduce

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

N, X = map(int, input().split())
x = np.array(list(map(int, input().split())))
if N == 1:
    print(np.abs(x[0] - X))
else:
    x = np.abs(x - X)
    print(gcd(x))
S=input()
T=input()
lS=len(s)
lT=len(t)
ans=[[""]*lS for _ in range(lT)]
for iT in range(lT):
  for iS in range(lS):
    if S[iS]==T[iT]:
      if iS-1>=0 and iT-1>=0:
        ans[iT][iS]=ans[iT-1][iS-1]+S[iS]
      else:
        ans[iT][iS]=S[iS]
    else:
      if iS-1>=0 and (iT-1<0 or len(ans[iT][iS-1])>=len(ans[iT-1][iS])):
        ans[iT][iS]=ans[iT][iS-1]
      elif iT-1>=0 and (iS-1<0 or len(ans[iT-1][iS])>=len(ans[iT][iS-1])):
        ans[iT][iS]=ans[iT-1][iS]
print(ans[lT-1][lS-1])


### FIXED CODE ###

import sys
def main():
  S=list(sys.stdin.readline())[:-1]
  T=list(sys.stdin.readline())[:-1]
  lS=len(S)
  lT=len(T)
  dp=[[0]*(lS+1) for _ in range(lT+1)]
  for iT in range(lT):
    for iS in range(lS):
      if S[iS]==T[iT]:
        dp[iT+1][iS+1] = max(dp[iT+1][iS],dp[iT][iS+1],dp[iT][iS]+1)
      else:
        dp[iT+1][iS+1] = max(dp[iT+1][iS],dp[iT][iS+1])

  iS = lS
  iT = lT
  ans = ""
  while(iS>0 and iT>0):
    if dp[iT][iS]==dp[iT-1][iS-1]:
      iS -= 1
      iT -= 1
    elif dp[iT][iS]==dp[iT][iS-1]:
      iS -= 1
    elif dp[iT][iS]==dp[iT-1][iS]:
      iT -= 1
    else:
      ans = S[iS-1]+ans
      iS -= 1
      iT -= 1
  print(ans)

if __name__ == '__main__':
  main()