Harryxun/stf_run huggingface dataset:
n,x=map(int,input().split())
a=list(map(int,input()split()))
sum=0
count=1
for i in range(x):
  sum+=a[i]
  if sum<=x:
    count+=1
print(count)

### FIXED CODE ###

n,x=map(int,input().split())
a=list(map(int,input().split()))
sum=0
count=1
for i in range(n):
  sum+=a[i]
  if sum<=x:
    count+=1
print(count)
from itertools import permutations

n = int(input())
nums1 = list(map(int,input(),split("")))
nums2 = list(map(int,input(),split("")))

t1 = tuple(nums1)
t2 = tuple(nums2)

index = 1
a = b = -1

for perm in permtations(list(range(1,n+1))):
    if perm == t1:
        a = index
    if perm == t2:
        b = index
    index +=  1

print(abs(a-b))

### FIXED CODE ###

from itertools import permutations

n = int(input())
nums1 = list(map(int,input().split(" ")))
nums2 = list(map(int,input().split(" ")))

t1 = tuple(nums1)
t2 = tuple(nums2)

index = 1
a = b = -1

for perm in permutations(list(range(1,n+1))):
    if perm == t1:
        a = index
    if perm == t2:
        b = index
    index += 1

print(abs(a-b))
mem = [0] * 26
s = raw_input().upper()
for c in s:
  mem[ord(c) - ord('A')] += 1
for i in range(26):
  print chr(i + ord('a')) + " : %d" % mem[i]

### FIXED CODE ###

import sys
mem = [0] * 26
for s in sys.stdin:
  for c in s.upper():
    if(c < 'A' or c > 'Z'):
      continue
    mem[ord(c) - ord('A')] += 1
for i in range(26):
  print chr(i + ord('a')) + " : %d" % mem[i]
x = int(input())
res = 0
for b in range(1, int(math.sqrt(X))+1): # sqrt(X)付近まで探索
    for p in range(2, int(math.sqrt(X))+2): # sqrt(X)付近まで探索
        val = b**p
        if (val <= X) and (val > res): # X以下かつその値が最大値なら値を更新
            res = val
print(res)


### FIXED CODE ###

import math
X = int(input())
res = 0
for b in range(1, int(math.sqrt(X))+1): # sqrt(X)付近まで探索
    for p in range(2, int(math.sqrt(X))+2): # sqrt(X)付近まで探索
        val = b**p
        if (val <= X) and (val > res): # X以下かつその値が最大値なら値を更新
            res = val
print(res)
n=int(input())
a=[int(input()) for _ range(n)]
b=[int(input()) for _ range(n)]

ans=0
for i in range(n):
  if a[i]>b[i]:
    ans+=a[i]

print(ans)

### FIXED CODE ###

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

ans=0
for i in range(n):
  if a[i]>b[i]:
    ans+=a[i]-b[i]

print(ans)
S = input()
ls = len(S)
box = [1]*ls

Sc = S
Sc = Sc.replace("RL", "X")

counter = 0
mval = 0

print(Sc)

for i in Sc:
    if i != "X":
        counter += 1
        mval = max(counter, mval)
    else:
        counter = 0

if mval % 2 == 0:
    pass
else:
    mval += 1


for i in range(mval):
    boxc = box.copy()
    for j, k in enumerate(S):
        if box[j] == 0:
            continue

        if k == "R":
            box[j+1] += boxc[j]
            box[j] -= boxc[j]
        else:
            box[j-1] += boxc[j]
            box[j] -= boxc[j]

print(*box)

### FIXED CODE ###

S = list(str(input()))
ls = len(S)
a = [1]*ls
for i in range(ls-2):
    if S[i] == S[i+1] == "R":
        a[i+2] += a[i]
        a[i] = 0
for i in range(ls)[::-1]:
    if S[i] == S[i-1] == "L":
        a[i-2] += a[i]
        a[i] = 0
print(" ".join(map(str, a)))
n = int(input())
x = list(map(int, input().split()))
y = sorted(x)
for i in x:
  if i > y[n/2-1]:
    print(y[n/2-1])
  else:
    print(y[n/2])

### FIXED CODE ###

n = int(input())
x = list(map(int, input().split()))
y = sorted(x)
for i in x:
  if i > y[n//2-1]:
    print(y[n//2-1])
  else:
    print(y[n//2])
n,m = input().split()
r,b = map(int,input().split())
i = input()
if i == n:
  r = r -1
  print(r + ' ' + b)
else:
  b = b-1
  print(r + ' ' + b)

### FIXED CODE ###

n,m = input().split()
r,b = map(int,input().split())
t = input()
if n == t:
  print(str(r-1) + ' ' + str(b))
else:
  print(str(r) + ' ' + str(b-1))
N, M, K = map(int, input().split())
mod = 998244353
# 全て異なる色で塗った場合のリストを作る
d = [0] * (N+1)
d[0] = M
for i in range(N):
    d[i+1] = d[i] * (M-1) % mod

def createFacArr(n, mod):
    '''
    二項係数計算用の配列の作成

    Parameters
    n : int
        配列のサイズ
    mod : int
        あまり

    Returns
    fac : list
        階乗のリスト
    finv : list
        modの逆元のリスト
    ivn : list
    '''
    fac = [0] * n
    finv = [0] * n
    inv = [0] * n
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, n):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i] * (mod // i) % mod
        finv[i] = finv[i-1] * inv[i] % mod
    return fac, finv

def comb(n ,k, mod, fac, finv):
    '''
    二項係数の計算

    Parameters
    n : int
        元集合
    k : int
        元集合から選択する数
    mod : int
        あまり
    fac : list
        階乗のリスト
    finv : list
        逆元のリスト
    
    Returns
    c : int
        nCkの組み合わせの数
    '''
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod

fac, finv = createFacArr(N, mod)
ans = d[N-1]
#print(d)
for i in range(K):
    ans += d[N-2-i] * comb(N-1, i+1, mod, fac, finv)
    ans %= mod

print(ans)


### FIXED CODE ###

N, M, K = map(int, input().split())
mod = 998244353
# 全て異なる色で塗った場合のリストを作る
d = [0] * (N+1)
d[0] = M
for i in range(N):
    d[i+1] = d[i] * (M-1) % mod

def createFacArr(n, mod):
    fac = [0] * n
    finv = [0] * n
    inv = [0] * n
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, n):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i] * (mod // i) % mod
        finv[i] = finv[i-1] * inv[i] % mod
    return fac, finv

def comb(n ,k, mod, fac, finv):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod

fac, finv = createFacArr(N+10, mod)
ans = d[N-1]
#print(d)
for i in range(K):
    ans += d[N-2-i] * comb(N-1, i+1, mod, fac, finv)
    ans %= mod

print(ans)
while True:
 h,w=map(int,input().split())
 if h==0:break
 for y in range(h):
  ''.join([*]**w)

### FIXED CODE ###

while 1:
 h,w=map(int,input().split())
 if h==0:break
 print(('#'*w+'\n')*h)
#00:27
h,w = map(int,input().split())
raw = []
for _ in range(h):
  raw.append(input())
ver = [[] for _ in range(w)]
hrz = [[] for _ in range(w)]
for x in range(h):
  st = 0
  for y in range(w):
    if raw[x][y] == '#':
      for k in range(st,y):
        ver[x].append(y-st)
      ver[x].append(0)
      st = y + 1
  for k in range(st,w):
    ver[x].append(w-st)
#print(ver)
for y in range(w):
  st = 0
  for x in range(h):
    if raw[x][y] == '#':
      for k in range(st,x):
        hrz[k].append(x-st)
      hrz[x].append(0)
      st = x + 1
  for k in range(st,h):
    hrz[k].append(h-st)
#print(hrz)
ans = 0
for x in range(h):
  for y in range(w):
    ans = max(ans,ver[x][y]+hrz[x][y]-1)
print(ans)

### FIXED CODE ###

#21:10
h,w = map(int,input().split())
raw = []
for x in range(h):
  raw.append(input())
xx = []
for x in range(h):
  now = []
  tmp = 0
  for y in range(w):
    if raw[x][y] == '.':
      tmp += 1
    else:
      now += [tmp] * tmp
      tmp = 0
      now.append(0)
  now += [tmp] * tmp
  xx.append(now)
yy = []
for y in range(w):
  now = []
  tmp = 0
  for x in range(h):
    if raw[x][y] == '.':
      tmp += 1
    else:
      now += [tmp] * tmp
      tmp = 0
      now.append(0)
  now += [tmp] * tmp
  yy.append(now)
'''
for x in range(h):
  print(xx[x])
for y in range(w):
  print(yy[y])
'''
maxi = 0
for x in range(h):
  for y in range(w):
    maxi = max(maxi,xx[x][y]+yy[y][x]-1)
print(maxi)
from math import sqrt

def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0:
        a, b = b, a%b
    return b

def divisor(a):
    lim = int(sqrt(a))
    divset = set()
    for i in range(1, lim + 1):
        if a % i == 0:
            divset |= {i, a//i}
    return divset

def is_prime(a):
    lim = int(sqrt(a))
    for i in range(2, lim + 1):
        if a != i and a % i == 0: return False
    else: return True

N = int(input())
A = [int(input()) for n in range(N+1)]

primes = [int(i) for i in range(2, N+1)]
primes = set(primes)
for i in range(2, N+1):
    temp = set()
    for p in primes:
        if p % i > 0 or p == i: temp |= {p}
    primes = temp

ans = []
for p in primes:
    for i in range(p-1):
        coefficient = 0
        index_a = i
        while index_a <= N:
            coefficient += A[index_a] % p
            coefficient %= p
            index_a += p-1
        if coefficient % p > 0: break
    else: ans.append(p)
        
gcd_of_A = abs(A[N])
for a in A[:N]:
    if a != 0: gcd_of_A = gcd(abs(a), gcd_of_A)

commondiv = divisor(gcd_of_A)
for d in commondiv:
    if d > N and is_prime(d): ans.append(d)

ans.sort()
for a in ans: print(a)

### FIXED CODE ###

def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0:
        a, b = b, a%b
    return b

def divisor(a):
    i = 1
    divset = set()
    while i * i <= a:
        if a % i == 0: divset |= {i, a//i}
        i += 1
    divset.remove(1)
    return divset

def is_prime(a):
    if a <= 3: 
        prime = [False, False, True, True]
        return prime[a]
    i = 2
    while i * i <= a:
        if a % i == 0: return False
        i += 1
    else: return True

N = int(input())
A = [None] * (N+1)
for i in reversed(range(N+1)):
    A[i] = int(input())

primes_bool = [True] * (N + 1)
primes = []
for p in range(2, N+1):
    if primes_bool[p]:
        primes.append(p)
        p_mult = p * 2
        while p_mult <= N:
            primes_bool[p_mult] = False
            p_mult += p

ans = []
used = set()
gcd_of_A = abs(A[N])
for a in A[:N]:
    if a != 0: gcd_of_A = gcd(abs(a), gcd_of_A)

commondiv = divisor(gcd_of_A)
for d in commondiv:
    if d > 1 and is_prime(d): 
        ans.append(d)
        used |= {d}

for p in primes:
    if A[0] % p == 0:
        for i in range(1, p):
            coefficient = 0
            index_a = i
            while index_a <= N:
                coefficient += A[index_a]
                coefficient %= p
                index_a += p-1
            if coefficient > 0: break
        else:
            if p not in used: ans.append(p)

ans.sort()
for a in ans: print(a)
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC= [list(map(int, input().split()))]
for i in range(1,Q):
    BC.append(list(map(int, input().split())))

num = [0]*10**5

#Aの要素の数を管理するリストnumを作成
for k in range(len(A)):
    num[A[k]+1] += 1

counter = 0 #Biと一致した要素の数
s = sum(A) #合計を初期化

for q in range(Q):
    counter = num[BC[q][0]+1]
    num[BC[q][1]+1] += counter #Ciの数に加える
    num[BC[q][0]+1]=0 #Biと等しい値を0個に
    s += (BC[q][1]- BC[q][0])*counter
    print(s)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC= [list(map(int, input().split()))]
for _ in range(1,Q):
    BC.append(list(map(int, input().split())))

num = [0]*10**5

#Aの要素の数を管理するリストnumを作成
for k in range(len(A)):
    num[A[k]-1] += 1

counter = 0 #Biと一致した要素の数
s = sum(A) #合計を初期化

for q in range(Q):
    counter = num[BC[q][0]-1]
    num[BC[q][1]-1] += counter #Ciの数に加える
    num[BC[q][0]-1]=0 #Biと等しい値を0個に
    s += (BC[q][1]- BC[q][0])*counter
    print(s)
def f(K, S):
    num=0
    for a in range(K+1):
      if S-a>=0 and S-a<=2*K:
        if S-a<=K:
          num+=S-a+1
        else:
          num+=min((S-a)-K,K)+1
    return num

  
(K,S)=input()
print(f(K,S))

### FIXED CODE ###

def f(K, S):
    num=0
    for a in range(K+1):
      if S-a>=0 and S-a<=2*K:
        if S-a<=K:
          num+=S-a+1
        else:
          num+=(K-((S-a)-K))+1
    return num

  
K,S=(int(x) for x in input().split())
print(f(K,S))
def insertion_sort(A, n, g, cnt):
  for i in range(g, n):
    v = A[i]
    j = i - g
    while j >= 0 and A[j] > v:
      A[j + g] = A[j]
      j = j - g
      cnt += 1
    A[j + g] = v
  return cnt

def shell_sort(A, n):
  cnt = 0
  m = 5
  G = [5,4,3,2,1]
  for i in range(m):
    cnt = insertion_sort(A, n, G[i], cnt)
  return m, G, cnt

data = []
for i in range(int(input())):
  data.append(int(input()))

m, G, cnt = shell_sort(data, 5)
print(m)
print(" ".join(map(str, G)))
print(cnt)
for i in data: print(i)

### FIXED CODE ###

def insertion_sort(A, n, g, cnt):
  for i in range(g, n):
    v = A[i]
    j = i - g
    while j >= 0 and A[j] > v:
      A[j + g] = A[j]
      j = j - g
      cnt += 1
    A[j + g] = v
  return cnt

def shell_sort(A, n):
  cnt = 0
  G = []
  h = 1
  while h <= n:
    G.append(h)
    h = h * 3 + 1
  m = len(G)
  G = G[::-1]

  for i in range(m):
    cnt = insertion_sort(A, n, G[i], cnt)

  return m, G, cnt

data = []
for i in range(int(input())):
  data.append(int(input()))

m, G, cnt = shell_sort(data, len(data))
print(m)
print(" ".join(map(str, G)))
print(cnt)
for i in data: print(i)
a, b, c = [int(i) for i in input().split()]

total = 0
for d in range(a, b+1)
      if c % d == 0:
         total += 1
      
print(total)

### FIXED CODE ###

a, b, c = [int(i) for i in input().split()]

total = 0
for d in range(a, b+1):
      if c % d == 0:
         total += 1
      
print(total)
n,k=map(int,input().split())
A=list(map(int,input().split()))
A=[0]+A
B=[]
C=[0]+[-1]*n
now_city=1
seen=set()

#【ループ回数】200000
for i in range(1,len(A)):
    print("Baah")
if k <= len(B):
    print("Baah")
else:
    k = k- len(B)
    #x = k % len(route)
    if x ==0:
        print("Baah")
    else:
        print("Baah")

### FIXED CODE ###

n,k = map(int,input().split())
s = list(map(int,input().split()))
# print(s)
now_city = 1
s_l_city = 1
t = [0] #何回そこを通ったか
f = [0] #何回目にそこを通ったか
a=0
b = 0#サイクルありなし
f_l=0#ループの最初

#【ループ回数】200000
for i in range(n):
    t.append(0)
    f.append(-1)
# print(s)
sycle = 0
#【ループ回数】200000
for i in range(1,n+10):
    now_city = s[now_city-1]

    if t[now_city-1]==1:
        #  print(i,f[j])
         sycle=i-f[now_city-1]
         f_l=f[now_city-1]
        #  f_l=i
        #  a = 1
         b = i
        #  s_l_city=now_city
        #  print("ループの最初の数字",now_city,"最初は"+str(f_l)+"回目","周期は",sycle)
         break
    t[now_city-1]+=1
    f[now_city-1]=i
# print(t)
# print(f_l)
# print(f_l,sycle,s_l_city)

if k>b:
    # now_city=s_l_city
    for _ in range((k-f_l)%sycle):

        now_city = s[now_city-1]
    # print((k-f_l)%sycle)
    print(now_city)
else:
    # print("ループなし")
    now_city=1
    for _ in range(k):
        now_city=s[now_city-1]
    print(now_city)
N = int(input())
box = list(map(int, input().split()))
count = 0
for i in range(N):
    if box%2 ==0:
        box/=2
        count ++
    elif box%2 !=0:
        break
print(count)

### FIXED CODE ###

import numpy as np
N = int(input())
box = list(map(int, input().split()))
box = np.array(box)
count=0
while(True):
  if any([i % 2 != 0 for i in box]):
    break
  elif all([i % 2 == 0 for i in box]):
    box /= 2
    count +=1
print(count)
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

dishes=[I() for i in range(0,5)]
rounded = []
for i in dishes:
    if i%10 != 0:
        i += 10 - i % 10
    rounded.append(i)
result=10**10
for i in range(len(dishes)):
    # order i in the end
    result = min(result, sum([r for ridx, r in rounded if ridx != i]) + dishes[i])
    
print(result)
    
    

### FIXED CODE ###

import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

v = []
for i in range(5):
    v.append(I())

# 全探索？
# 1の位が一に一番近いものを求める
str_v = [str(i) for i in v]
min_first_digit = None
for sidx, s in enumerate(str_v):
    if s[-1] == '0':
        continue
    if min_first_digit == None:
        min_first_digit = [sidx , s[-1]]
        continue
    if s[-1] < min_first_digit[1]:
        min_first_digit = [sidx, s[-1]]

if min_first_digit == None:
    print(sum(v))
else:
    result = 0
    for vidx, item in enumerate(v):
        if vidx != min_first_digit[0]:
            result += item
            if item % 10 != 0:
                result += 10 - item % 10
    result += v[min_first_digit[0]]
    print(result)
#B
import sys
s=input()
t=input()
length=0
ans=[0]*(len(s)-len(t))
for i in range(len(s)-len(t)):
    for j in range(len(t)):
        if s[i+j]==t[j]:
            ans[i]+=1
print(len(t)-max(ans))


### FIXED CODE ###

# B
import sys
s = input()
t = input()
length = 0
ans = [0]*(len(s)-len(t)+1)
for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if s[i+j] == t[j]:
            ans[i] += 1
print(len(t)-max(ans))
A=[[int(i) for i in input().split()] for _ in range(3)]
N=int(input())
for _ in range(N):
    b=int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j]==b:
                A[i][j]=-1
flag=False
for h in range(3):
    cnt=0
    for w in range(3):
        if A[h][w]==-1:
            cnt+=1
    if cnt==3:
        flag=True
for w in range(3):
    cnt=0
    for h in range(3):
        if A[h][w]==-1:
            cnt+=1
    if cnt==3:
        flag=True
cnt=0
if A[d][d]==-1:
    cnt+=1
if cnt==3:
    flag=True
cnt=0
if A[d][-d]==-1:
    cnt+=1
if cnt==3:
    flag=True
print('Yes' if flag else 'No')


### FIXED CODE ###

A=[[int(i) for i in input().split()] for _ in range(3)]
N=int(input())
for _ in range(N):
    b=int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j]==b:
                A[i][j]=-1
flag=False
for h in range(3):
    cnt=0
    for w in range(3):
        if A[h][w]==-1:
            cnt+=1
    if cnt==3:
        flag=True
for w in range(3):
    cnt=0
    for h in range(3):
        if A[h][w]==-1:
            cnt+=1
    if cnt==3:
        flag=True
cnt=0
for d in range(3):
    if A[d][d]==-1:
        cnt+=1
if cnt==3:
    flag=True
cnt=0
for d in range(3):
    if A[d][2-d]==-1:
        cnt+=1
if cnt==3:
    flag=True
print('Yes' if flag else 'No')
max=0
N=int(input())
K=int(input())
t=list(input().split())
s=[int(n) for n in t]
for i in range(N-K):
    x=0
    for j in range(K):
        x+=s[i+j]
    if max<x :
        max=x
print((max+4)/2)

### FIXED CODE ###

N, K = map(int,input().split())
t=list(input().split())
s=[int(n) for n in t]
max=x=sum(s[:K])
for i in range(N-K):
    x+=(s[K+i]-s[i])
    if max<x :
        max=x
print((max+K)/2)
a,b = map(input().split())
print(a*b)

### FIXED CODE ###

a,b = map(int,input().split())
print(a*b)
def cf(x1,x2):
    count=[]
    for i in range(2,max(int(math.sqrt(x1)),int(math.sqrt(x2))+1)):
        if x1 % i == 0 and x2 % i == 0:
            count.append(i)
    return count

A,B = map(int,input().split())
li = cf(A,B)
c = 1
for i in li:
    for j in li:
        if i % j == 0:
            if i == j:
                c +=1
            else:
                break
print(c)

### FIXED CODE ###

import math
import collections
def f(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 = n//f
        else:f += 2
    if n != 1:
        a.append(n)
    return a

a,b = map(int,input().split())
a = set(collections.Counter(f(a)).keys())
b = set(collections.Counter(f(b)).keys())
print(len(a&b)+1)
s = str(input())
K = int(input())
L = []
M = []
con = 0
for i in s:
  L.append(i)
L = list(set(L))
L.sort()
for j in range(len(s)):
    if s[j] == L[0]:
      for k in range(1,6):
        if j + k >=len(s):
          M.append(s[j:])
          break
        else:
          M.append(s[j:j+k])

for l in range(len(s)):
  if s[l] == L[1]:
    for m in range(1,6):
      if l + m >= len(s):
        M.append(s[l:])
        break
      else:
        M.append(s[l:l+m]) 
if len(M) < K:
  for n in range(len(s)):
    if s[n] == L[2]:
      for o in range(1,6):
        if n + o >=len(s):
          M.append(s[n:])
          break
        else:
          M.append(s[n:n+o])
M = list(set(M))
M.sort()
print(M)
print(M[K - 1])  
          


### FIXED CODE ###

s = str(input())
K = int(input())
L = []
M = []
con = 0
for i in s:
  L.append(i)
L = list(set(L))
L.sort()
for j in range(len(s)):
    if s[j] == L[0]:
      for k in range(1,6):
        if j + k >=len(s):
          M.append(s[j:])
          break
        else:
          M.append(s[j:j+k])
if len(L) != 1:
  for l in range(len(s)):
    if s[l] == L[1]:
      for m in range(1,6):
        if l + m >= len(s):
          M.append(s[l:])
          break
        else:
          M.append(s[l:l+m]) 
if len(M) < K:
  for n in range(len(s)):
    if s[n] == L[2]:
      for o in range(1,6):
        if n + o >=len(s):
          M.append(s[n:])
          break
        else:
          M.append(s[n:n+o])
M = list(set(M))
M.sort()
print(M[K - 1])
a,b,c=map(int,input().split())
sum=a+b+c

if sum>21:
    print("bust")
  
  else:
    print("win")


### FIXED CODE ###

a,b,c=map(int,input().split())
val=a+b+c
if val > 21:
    print("bust")
else:
    print("win")
input_char = input()
a = int(input_char.split()[0])
b = int(input_char.split()[1])
unused_tap = 1
count = 0

while(1):
    if unused_tap >= b:
        print(count)
        break
    
    unused_tap = unused_tap-1 + a 
    count += 1



### FIXED CODE ###

S = input()
T = input()
days = 0

for i in range(3):
    if S == T:
        days = 3
        break
    if S[i] == T[i]:
        days += 1
    
print(days)
s=input()+'T'
x,y=map(int,input().split())
if 'T' in s:
  pos=s.index('T')
  x-=pos
  s=s[pos+1:]
arr=s.split('T')
xarr=[]
yarr=[]
for i in range(len(arr)):
  l=len(arr[i])
  if l==0:
    continue
  if i%2==0:
    yarr.append(l)
  else:
    xarr.append(l)
if len(xarr)!=0:
  xsum=sum(xarr)
else:
  xsum=0
if len(yarr)!=0:
  ysum=sum(yarr)
else:
  ysum=0
x+=xsum
y+=ysum
if x%2==1 or y%2==1:
  print('No')
else:
  xdp=[0]*(xsum+100)
  xdp[0]=1
  for val in xarr:
    for i in range(xsum+99,-1,-1):
      if i-val<0:
        break
      if xdp[i-val]==1:
        xdp[i]=1
  ydp=[0]*(ysum+100)
  ydp[0]=1
  for val in yarr:
    for i in range(ysum+99,-1,-1):
      if i-val<0:
        break
      if ydp[i-val]==1:
        ydp[i]=1
  if xdp[x//2]==0:
    print('No')
  else:
    if ydp[y//2]==0:
      print('No')
    else:
      print('Yes')

### FIXED CODE ###

s=input()+'T'
x,y=map(int,input().split())
if 'T' in s:
  pos=s.index('T')
  x-=pos
  s=s[pos+1:]
arr=s.split('T')
xarr=[]
yarr=[]
for i in range(len(arr)):
  l=len(arr[i])
  if l==0:
    continue
  if i%2==0:
    yarr.append(l)
  else:
    xarr.append(l)
x+=sum(xarr)
y+=sum(yarr)
if x%2==1 or y%2==1:
  print('No')
else:
  #DP for xarr,yarr
  xdp=[0]*8005
  xdp[0]=1
  for val in xarr:
    for i in range(8004,-1,-1):
      if i-val<0:
        break
      if xdp[i-val]==1:
        xdp[i]=1
  ydp=[0]*8005
  ydp[0]=1
  for val in yarr:
    for i in range(8004,-1,-1):
      if i-val<0:
        break
      if ydp[i-val]==1:
        ydp[i]=1
  if xdp[x//2]==0:
    print('No')
  else:
    if ydp[y//2]==0:
      print('No')
    else:
      print('Yes')