Harryxun/stf_run huggingface dataset:
# 初期入力
from collections import Counter
from copy import deepcopy
import sys
input = sys.stdin.readline
N,K = (int(x) for x in input().split())
A = list(map(int, input().split()))
connection ={}
for i,v in enumerate(A):
    connection[i+1] =v 

#巡回してるか
passed=[1]
nex =connection[1]
lap =[]
lap_num =0
pass_set =set()
for i in range(1,N+1):
    passed.append(nex)
    if nex not in pass_set:
        pass_set.add(nex)
        nex =connection[nex]
    else:
        #lap =deepcopy(passed)
        break
#巡回している部分の町の数    
indx_s =passed.index(nex) +1
indx_f =len(passed)
lap_num =indx_f -indx_s

if indx_f < K:
    mod =(K -indx_s) % lap_num
    ans =passed[indx_s +mod]
else:
    ans =passed[K]
print(ans)

### FIXED CODE ###

# 初期入力
from collections import Counter
from copy import deepcopy
import sys
input = sys.stdin.readline
N,K = (int(x) for x in input().split())
A = list(map(int, input().split()))
connection ={}
for i,v in enumerate(A):
    connection[i+1] =v 

#巡回してるか
passed=[1]
nex =connection[1]
lap =[]
lap_num =0
pass_set =set(passed)
for i in range(1,N+1):
    passed.append(nex)
    if nex not in pass_set:
        pass_set.add(nex)
        nex =connection[nex]
    else:
        #lap =deepcopy(passed)
        break
#巡回している部分の町の数    
indx_s =passed.index(nex) +1
indx_f =len(passed)
lap_num =indx_f -indx_s

if indx_f < K:
    mod =(K -indx_s) % lap_num
    ans =passed[indx_s +mod]
else:
    ans =passed[K]
print(ans)
# E - Multiplication 4
import heapq
N, K = map(int, input().split())
A = list(int(a) for a in input().split())
MOD = 10**9 + 7

# N = K の時
if N == K:
    ans = 1
    for a in A:
        ans = (ans * a) % MOD

else:
    pos = []
    neg = []
    for a in A:
        if a >= 0:
            pos.append(a)
        else:
            neg.append(a)

    # 必ずマイナスになる時＝全てがマイナスの値であり、
    # かつKが奇数の時
    if len(neg) == N and K&1 == 1:
        neg.sort(reverse=True)
        ans = 1
        for i in range(K):
            ans = (ans * neg[i]) % MOD

    # それ以外のプラスになるケース
    # プラスの要素とマイナスの要素を絶対値の大きい順にソートし、
    # Kが奇数であれば、プラスのリストから1つ選び、
    # 残りの偶数個のKに対して、２つずつを選んだ時の
    # 大きい方から取得していく
    else:
        pos.sort(reverse=True)
        pos2 = []
        ans = 1
        ini = 0
        rem = K
        if K&1 == 1:
            ans = (ans * pos[0]) % MOD
            ini = 1
            rem -= 1
        for i in range(0, len(pos)//2, 2):
            heapq.heappush(pos2, (pos[i*2+ini] * pos[i*2+ini+1])*-1)
        neg.sort()
        neg2 = []
        for i in range(0, len(neg)//2, 2):
            heapq.heappush(neg2, (neg[i*2] * neg[i*2+1]) * -1)
        while rem > 0:
            if (pos2 != [] and neg2 != [] and pos2[0] <= neg2[0]) or (pos2 != [] and neg2 == []):
                tmp = heapq.heappop(pos2) * -1
            else:
                tmp = heapq.heappop(neg2) * -1
            ans = (ans * tmp) % MOD
            rem -= 2

print(ans)

### FIXED CODE ###

# E - Multiplication 4
import heapq
N, K = map(int, input().split())
A = list(int(a) for a in input().split())
MOD = 10**9 + 7

# N = K の時
if N == K:
    ans = 1
    for a in A:
        ans = (ans * a) % MOD

else:
    pos = []
    neg = []
    for a in A:
        if a >= 0:
            pos.append(a)
        else:
            neg.append(a)

    # 必ずマイナスになる時＝全てがマイナスの値であり、
    # かつKが奇数の時
    if len(neg) == N and K&1 == 1:
        neg.sort(reverse=True)
        ans = 1
        for i in range(K):
            ans = (ans * neg[i]) % MOD

    # それ以外のプラスになるケース
    # プラスの要素とマイナスの要素を絶対値の大きい順にソートし、
    # Kが奇数であれば、プラスのリストから1つ選び、
    # 残りの偶数個のKに対して、２つずつを選んだ時の
    # 大きい方から取得していく
    else:
        pos.sort(reverse=True)
        pos2 = []
        ans = 1
        ini = 0
        rem = K
        if K&1 == 1:
            ans = (ans * pos[0]) % MOD
            ini = 1
            rem -= 1
        for i in range(0, (len(pos)-ini)//2):
            heapq.heappush(pos2, (pos[i*2+ini] * pos[i*2+ini+1])*-1)
        neg.sort()
        neg2 = []
        for i in range(0, len(neg)//2):
            heapq.heappush(neg2, (neg[i*2] * neg[i*2+1]) * -1)
        while rem > 0:
            if (pos2 != [] and neg2 == []) or (pos2 != [] and neg2 != [] and pos2[0] <= neg2[0]):
                tmp = heapq.heappop(pos2) * -1
            else:
                tmp = heapq.heappop(neg2) * -1
            ans = (ans * tmp) % MOD
            rem -= 2

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


### FIXED CODE ###

r=int(input())
if r<1200:
    print('ABC')
elif r<2800:
    print('ARC')
else:
    print('AGC')
import math
N, K=map(int, input().split())
A=list(map(int, input().split()))
i=1
j=10**9
while True:
    k=(i+j)//2
    if sum([math.ceil(a/k)-1 for a in A])<=K:
        if k-1>0 and sum([math.ceil(a/(k-1))-1 for a in A])>K:
            print(k)
            break
        else:
            j=k-1
    else:
        i=k+1

### FIXED CODE ###

import math
N, K=map(int, input().split())
A=list(map(int, input().split()))
i=1
j=10**9
while True:
    k=(i+j)//2
    if k>0 and sum([math.ceil(a/k)-1 for a in A])<=K:
        if k==1 or sum([math.ceil(a/(k-1))-1 for a in A])>K:
            print(k)
            break
        else:
            j=k-1
    else:
        i=k+1
x, y, z, k = map(int, input().split())
l_a = list(map(int, input().split()))
l_b = list(map(int, input().split()))
l_c = list(map(int, input().split()))
print(list(itertools.product(l_a, l_b, l_c)))
l = [sum(i) for i in list(itertools.product(l_a, l_b, l_c))]
print(sorted(l, reverse=True)[:k])

### FIXED CODE ###

input_list = [int(input()) for i in range(5)]
k = int(input())
if input_list[4] - input_list[0] <= k:
  print('Yay!')
else:
  print(':(')
x, y, a, b, c = map(int, input().split())
arrayP = list(map(int, input().split()))
arrayQ = list(map(int, input().split()))
arrayR = list(map(int, input().split()))
arrayP.sort(reverse=True)
arrayQ.sort(reverse=True)
arrayR.sort(reverse=True)
arrayAns = []
for i in range(x):
    arrayAns.append(int(arrayP[i]))
for i in range(y):
    arrayAns.append(int(arrayQ[i]))
arrayAns.sort()
for i in range(len(arrayR)):
    if arrayAns[0] <= int(arrayR[i]):
        arrayAns[0] = int(arrayR[i])
        arrayAns.sort()
    else:
        break
print(sum(arrayAns))


### FIXED CODE ###

s = input()
if s[2] == s[3]:
    if s[4] == s[5]:
        print("Yes")
    else:
        print("No")
else:
    print("No")
import sys
dataset = sys.stdin.readlines()

for item in dataset:
    a, b, c, d, e, f = list(map(int, item.split()))
    k1 = e * (a/d)
    k2 = f * (a/d)

    y = (c * d - f * a)/(b * d - e * a)
    x = (c * e - b * f) / (a * e - b * d)
    if x == 0:
        x = 0
    print("{:.3f} {:.3f}".format(x, y))

### FIXED CODE ###

import sys
dataset = sys.stdin.readlines()

for item in dataset:
    a, b, c, d, e, f = list(map(int, item.split()))

    y = (c * d - f * a)/(b * d - e * a)
    x = (c * e - b * f) / (a * e - b * d)
    if x == 0:
        x = 0
    print("{:.3f} {:.3f}".format(x, y))
n = int(input())
a = list(map(int,input().split()))
ans = ''

for i in range(n):
    if i % 2 == 0:
        ans = ans + str(a[i]) + 
    else:
        ans = str(a[i]) + ans
        
print(ans)

### FIXED CODE ###

n = int(input())
a = list(input().split())
print(" ".join(a[::-2] + a[n%2::2]))
n,a,b = list(map(int, input().split()))

q=n//(a+b)
mod=n%(a+b)
ans=a*q
if a < mod:
    ans+=a
else:
    ans+=mod
print(ans)

### FIXED CODE ###


a = input()

if a == 'AAA' or a == 'BBB':
    print('No')
else:
    print('Yes')
k, x = list(map(int, input().split()))
print(' '.join([i for i in range(x-k+1, x+k)]))

### FIXED CODE ###

k, x = list(map(int, input().split()))
print(' '.join([str(i) for i in range(x-k+1, x+k)]))
n, W = map(int, input().split())
w, v = [], []

for i in range(n):
    temp1, temp2 = map(int, input().split())
    w.append(temp1)
    v.append(temp2)

c#print(w, v)
#dp[i] = max(dp[i-1], dp[i]) + dp[i-2]

def solve(total, i):
    if i > n-1:
	return 0
    weight, val = w[i], v[i]
    if total + weight <= W:
        chose = val + solve(total + weight, i+1)
        unchose = solve(total, i+1)
        return max(chose, unchose)
    else:
        return 0

print(solve(0, 0))

### FIXED CODE ###

n, W = map(int, input().split())
w = [0]*(n+1)
v = [0]*(n+1)

#dp = [[None for i in range(W+1)] for j in range(n+1)]
dp = [[0 for i in range(W+1)] for j in range(n+1)]

for i in range(n):
    w[i], v[i] = map(int, input().split())

def knap(i, j):
    if dp[i][j] is not None:
        return dp[i][j]

    res = 0

    if i == n:
       	res = 0
    elif j < w[i]:
        res = knap(i+1, j)
    else:
        res = max(knap(i+1, j), knap(i+1, j-w[i]) + v[i])

    dp[i][j] = res
    return dp[i][j]

for i in reversed(range(n)):
    for j in range(W+1):
#        res = 0
        # if i == n-1:
        #     res = 0
        if j < w[i]:
            dp[i][j] = dp[i+1][j]
        else:
            dp[i][j] = max(dp[i+1][j], dp[i+1][j-w[i]] + v[i])

#print(knap(0, W))
print(dp[0][W])
n = int(input())
for f in range(100//4+1):
	for s in range(100//7+1):
    	ans = f*4 + s*7
        if ans == n:
        	print("Yes")
			exit()
print("No")

### FIXED CODE ###

n = int(input())
for f in range(100//4+1):
	for s in range(100//7+1):
		ans = f*4 + s*7
		if ans == n:
			print("Yes")
			exit()
print("No")
n = int(input())
if(n %2=1):
  n *= 2
print(n)

### FIXED CODE ###

n = int(input())
if(n %2==1):
  n *= 2
print(n)
n=int(input())
x=list(input().split())
x=[int(s) for s in x]
b_li=[]
for i in range(min(x),max(x)):
    a_li=[]
    for j in range(n):
        a=(x[j]-i)**2
        a_li.append(a)
    b=sum(a_li)
    b_li.append(b)
print(min(b_li))


### FIXED CODE ###

n=int(input())
x=list(input().split())
x=[int(s) for s in x]
if n==1 or len(set(x))==1:
    print(0)
else:
    b_li=[]
    for i in range(min(x),max(x)):
        a_li=[]
        for j in range(n):
            a=(x[j]-i)**2
            a_li.append(a)
        b=sum(a_li)
        b_li.append(b)
    print(min(b_li))
a =input()
b =ABC+a
print(b)

### FIXED CODE ###

a =input()
b ="ABC"+a
print(b)
import sys
from bisect import insort_left
from collections import *

N = int(input())
An = list(map(int, input().split()))[0:N]

An_pos = [ a for a in An if a >= 0]
An_neg = [ a for a in An if a < 0]

if len(An_neg) % 2 == 0:
    print(sum(An_pos) - sum(An_neg))
    sys.exit(0)
    pass

min_neg = min(min(An_pos), -max(An_neg))
print(sum(An_pos) - sum(An_neg) - 2*min_neg)


### FIXED CODE ###

from itertools import chain

N = int(input())
An = list(map(int, input().split()[0:N]))

An_pos = [ a for a in An if a >= 0]
An_neg = [ -a for a in An if a < 0]

ans = sum(An_pos) + sum(An_neg)

if len(An_neg) % 2 == 1:
    ans -= 2 * min(chain(An_pos, An_neg))
    pass

print(ans)
S = input()
for k in range(len(S)/5):
    for word in ["dream", "dreamer", "erase", "eraser"]:
        if S.endswith(word):
            S=S.rstrip(word)
if len(S)==0:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

S = input()
for k in range(int(len(S)/5)):
    for word in ["dream", "dreamer", "erase", "eraser"]:
        if S.endswith(word):
            S=S[:-len(word)]
if len(S)==0:
    print("YES")
else:
    print("NO")
n,c=map(int,input().split())
lists=[[] for i in range(31)]
for i in range(n):
    s,t,c=map(int,input().split())
    lists[c].append((s,t))
for i in range(31):
    lists[c]=sorted(lists[c],key=lambda x:x[0])

for i in range(31):
    if len(lists[i])>=2:
        sublists=[]
        start=lists[i][0][0]
        end=lists[i][0][1]
        for j in range(1,len(lists[i])):
                if end==lists[i][j][0]:
                    start=start
                    end=lists[i][j][1]

                elif end!=lists[j][0]:
                    sublists.append((start,end))
                    start=lists[i][j][0]
                    end=lists[i][j][1]
                if j==len(lists[i])-1:
                    sublists.append((start,end))

        lists[i]=sublists

### FIXED CODE ###


N, C = map(int, input().split())
stc = [list(map(int, input().split())) for _ in range(N)]
 
record = [[0] * 10 ** 5 for _ in range(C)]
for s, t, c in stc:
    for i in range(s, t + 1):
        record[c-1][i-1] = 1
 
ans = 0
for i in range(10 ** 5):
    cnt = 0
    for j in range(C):
        cnt += record[j][i]
    ans = max(ans, cnt)
 
print(ans)
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    

N=int(input())
h=list(map(int,input().split()))
dp=[float("inf") for _ in range(N)]
dp[0]=0
for i in range(N-1):
	for j in range(1,min(K+1,N-i)):
		dp[i+j] = min(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
print(dp[N - 1])

### FIXED CODE ###

import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    

N,K=map(int,input().split())
h=list(map(int,input().split()))
dp=[float("inf") for _ in range(N)]
dp[0]=0
for i in range(N-1):
	for j in range(1,min(K+1,N-i)):
		dp[i+j] = min(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
print(dp[N - 1])
import math
A,B = input().split()
A = int(A)
B = int(round(B*100))
ans = A*B
print(math.floor(ans/100))

### FIXED CODE ###

import math
A,B = input().split()
A = int(A)
B = round(float(B)*100)
ans = A*B
print(ans//100)
n = input()
dish = []
for i in range(int(n)):
    tmp = [int(each) for each in input().split()]
    dish.append((tmp[0] - tmp[1], tmp[1] - tmp[0]))

point = [0, 0]

player = 0
while len(dish) > 0:

    sorted(dish, key=lambda v: dish[player], reverse=True)
    point[player] += point[player]
    player = int(not player)
print(point[0] - point[1])

### FIXED CODE ###

n = input()
dishes = []
for i in range(int(n)):
    tmp = [int(each) for each in input().split()]
    dishes.append((abs(tmp[0] + tmp[1]), tmp[0], tmp[1]))

dishes = sorted(dishes, key=lambda x: x[0], reverse=True)

point = [0, 0]
player = 0
while len(dishes) > 0:
    dish = dishes.pop(0)
    point[player] += dish[player + 1]
    player = int(not player)
print(point[0] - point[1])
import sys
import numpy as numpy
input = sys.stdin.readline

N,M = map(int,input().split())
XY = [[] for i in range(N + 1)]

path = [-1] * (N + 1)

for i in range(M):
  x,y = map(int,input().split())
  XY[x - 1].append(y - 1)

  
def recur(n):
  if path[n] != -1:
    return path[n]
  
  elif XY[n] == []:
    path[n] = 0
    return path[n]
        
  else:
    ret = 0
    for chi in XY[n]:
      ret = max(ret,recur(chi) + 1)
    
    path[n] = ret
    return path[n]
    
for i in range(N):
  recur(i)

print(max(path))

### FIXED CODE ###

import sys
import numpy as numpy
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 5)

N,M = map(int,input().split())
XY = [[] for i in range(N + 1)]

path = [-1] * (N + 1)

for i in range(M):
  x,y = map(int,input().split())
  XY[x - 1].append(y - 1)

  
def recur(n):
  if path[n] != -1:
    return path[n]
  
  elif XY[n] == []:
    path[n] = 0
    return path[n]
        
  else:
    ret = 0
    for chi in XY[n]:
      ret = max(ret,recur(chi) + 1)
    
    path[n] = ret
    return path[n]
    
for i in range(N):
  recur(i)

print(max(path))
N, M = map(int, input().sprit())
A = list(map(int, input().split()))
a = sum(A)
ans = N -a
if ans >= 0:
    print(ans)
else:
    print(-1)
    
        


### FIXED CODE ###

N,M = map(int, input().split())
A = list(map(int, input().split()))
a = sum(A)
ans = N -a
if ans >= 0:
    print(ans)
else:
    print(-1)
n,y = map(int,input().split())

for i in range(n+1):
    for j in range(n+1):
        k = n - i - j
        if 10000 * i + 5000 * j + 1000 * k == y and y >= 0:
            print(i,j,k)
            exit()
print('-1 -1 -1'):

### FIXED CODE ###

n,y = map(int,input().split())

for i in range(n+1):
    for j in range(n+1):
        k = n - i - j
        if (10000 * i + 5000 * j + 1000 * k) == y and k >= 0:
            print(i,j,k)
            exit()
print('-1 -1 -1')
N = int(input())
arr = []
temp = N
n = 0
if N == 1:
    print(0)
else:
    for i in range(2, int(-(-N**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt=cnt+1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])

    for i in range(len(arr)):
        a = 0
        b = arr[i]
        while a < b[1]:
            a = a+a+1
            n = n+1
    print(n)

### FIXED CODE ###

A, B = map(int,input().split())
print(A*B)
a, p = map(int, input().split())
print((a * 3 + p) // 2)


### FIXED CODE ###

a, p = map(int, input().split())
print((a * 3 + p) // 2)
N = input()
As = list(map(int, input().split()))

result = 0
for i in range(N-1):
    result+=As[i]*sum(As[i+1:])
print(result%(1*10**9+7))


### FIXED CODE ###

N = int(input())
As = list(map(int, input().split()))

result = 0
before_sum = sum(As)
for i in range(N-1):
    before_sum-=As[i]
    result+=As[i]*(before_sum)
print(result%(1*10**9+7))
num = int(input())

count = 0
flag = False
for i in range(num):
    a,b = read().split()
    if a == b:
        count += 1
        if count >= 3:
            print("Yes")
            flag = True
            break
    else:
        count = 0
if flag:
    print("No")

### FIXED CODE ###

num = int(input())

count = 0
flag = False
for i in range(num):
    a,b = input().split()
    if a == b:
        count += 1
        if count >= 3:
            print("Yes")
            flag = True
            break
    else:
        count = 0
if not flag:
    print("No")
N,M=map(int, input().split())
a = [0]*M
for i in range(M):
  a[i] = int(input())

def step(n):
  if n==0:
    return(1)
  elif n==1:
    return(1)
  else:
    return(step(n-1)+step(n-2))

if M==0:
  print(step(N))
else:
  b = [0]*(M+1)
  b[0] = step(a[0]-1)
  if M>=2:
    for i in range(M-1):
      if a[i+1]-a[i] == 1:
        b[i+1] = 0
      elif a[i+1]-a[i] == 0:
        b[i+1] = 1
      else:
        b[i+1] = step(a[i+1]-a[i]-2)
  b[M] = step(N-a[M-1]-1)

answer = 1
for i in range(M+1):
  answer = answer*b[i]%1000000007
print(answer)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000000)

N,M=map(int, input().split())
a = [0]*M
for i in range(M):
  a[i] = int(input())

def memoize(f):
  table = {}
  def func(*args):
    if not args in table:
      table[args] = f(*args)
    return table[args]
  return func

@memoize

def step(n):
  if n==0:
    return(1)
  elif n==1:
    return(1)
  else:
    return((step(n-1)+step(n-2))%1000000007)

if M==0:
  print(step(N))
else:
  b = [0]*(M+1)
  b[0] = step(a[0]-1)
  if M>=2:
    for i in range(M-1):
      if a[i+1]-a[i] == 1:
        b[i+1] = 0
      else:
        b[i+1] = step(a[i+1]-a[i]-2)
  b[M] = step(N-a[M-1]-1)

  answer = 1
  for i in range(M+1):
    answer = answer*b[i]%1000000007
  print(answer)
a,b = map(int, input().split())
if a == 'H':
  print(b)
else:
  print('HD'.replace(b,''))

### FIXED CODE ###

a,b = input().split()
if a == 'H':
  print(b)
else:
  print('HD'.replace(b,''))
a,b,c,k=map(int,input().split())
printmin((a-max(k-a-b,0)),k)

### FIXED CODE ###

a,b,c,k=map(int,input().split())
print(min((a-max(k-a-b,0)),k))
s = input()
m = int(input())

c = []

if len(s) < 100:

    for i in range(len(s)):
        for k in range(1,len(s)+1):
            c.append(s[i:i+k])

    b = sorted(list(set(c)))

    print(b[m-1])

else:
    po = []
    for i in range(len(s)):
        po.append(s[i])
    po = sorted(set(po))
    print(po[m-1])


### FIXED CODE ###

s = input()
m = int(input())

c = []


for i in range(len(s)):
    for k in range(1,m+1):
        c.append(s[i:i+k])

b = sorted(list(set(c)))


print(b[m-1])
a=int(input())
b=int(input())
print(f"{a*b},{(a+b)*2}")


### FIXED CODE ###

a,b=map(int,input().split())
print(a*b,(a+b)*2)
n,k = map(int,input().split())
l1 = list(map(int,input().split()))
l = list(i-1 for i in l1)
bit = list(0 for i in range(n))
bit[0] =1
mi = [0]
m = l[0]
er = 0
while er ==0:
  if bit[m]==1:
    a = mi.index(m)
    r = mi[a:]
    er  =1
  else:
    bit[m] = 1
    mi.append(m)
    m = l[m]
 # print(bit)
be = mi[:a]+r
#print(be,r)
if k<= len(be):
  print(be[k])
else:
  w = k-len(be)
  u = (w%len(r))
  print(r[u]+1)

### FIXED CODE ###

n,k = map(int,input().split())
l1 = list(map(int,input().split()))
l = list(i-1 for i in l1)
bit = list(0 for i in range(n))
bit[0] =1
mi = [0]
m = l[0]
er = 0
while er ==0:
  if bit[m]==1:
    a = mi.index(m)
    r = mi[a:]
    er  =1
  else:
    bit[m] = 1
    mi.append(m)
    m = l[m]
 # print(bit)
be = mi[:a]+r
#print(be,r)
if k< len(be):
  print(be[k]+1)
else:
  w = k-len(be)+1
  u = (w%len(r))-1
  print(r[u]+1)
s=str(input())

if s=="hi" or s=="hihi" or s=="hihihi" or s=="hihihihi" or s=="hihihihihi":
  print("Yes")
elif:
  print("No")

### FIXED CODE ###

s=str(input())

if s=="hi" or s=="hihi" or s=="hihihi" or s=="hihihihi" or s=="hihihihihi":
  print("Yes")
else:
  print("No")
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
time_of_A = [A[0]]
for i in range(1, N):
  time_of_A.append(time_of_A[i-1]+A[i])
B = list(map(int, input().split()))
time_of_B = [B[0]]
for i in range(1, M):
  time_of_B.append(time_of_B[i-1]+B[i])

book = []
for i in range(N):
  if time_of_A[i] <= K:
    book.append(i+1)

start = M-1
for i in range(N):
  j = start
  time = 10 ** 9 + 1
  while time > K and j >= 0:
    time = time_of_A[i] + time_of_B[j]
    j -= 1
  if time <= K:
    book.append(i+j+3)
    j +=1
    start = j
  else:
    break
print(max(book))

### FIXED CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
time_of_A = [A[0]]
for i in range(1, N):
  time_of_A.append(time_of_A[i-1]+A[i])
B = list(map(int, input().split()))
time_of_B = [B[0]]
for i in range(1, M):
  time_of_B.append(time_of_B[i-1]+B[i])

book = [0]
for i in range(N):
  if time_of_A[i] <= K:
    book.append(i+1)
for i in range(M):
  if time_of_B[i] <= K:
    book.append(i+1)


start = M-1
for i in range(N):
  j = start
  time = 10 ** 9 + 1
  while time > K and j >= 0:
    time = time_of_A[i] + time_of_B[j]
    j -= 1
  if time <= K:
    book.append(i+j+3)
    j +=1
    start = j
  else:
    break
print(max(book))
from math import sqrt, ceil

n, q = map(int, input().split())
unit = ceil(sqrt(n))

l = [(0, [0] * unit) for _ in range(unit)]

while q:
    op, s, t = map(int, input().split())
    sd, sm = s // unit, s % unit
    if op:
        td, tm = t // unit, t % unit
        if sd == td:
            print(sum(l[sd][1][sm:tm + 1]))
        else:
            unit_sum = sum((tup[0] for tup in l[sd + 1:td]))
            s_sum = sum(l[sd][1][sm:])
            t_sum = sum(l[td][1][:tm + 1])
            print(unit_sum + s_sum + t_sum)
    else:
        tup = l[sd]
        tup[1][sm] += t
        l[sd] = (tup[0] + t, tup[1])
    q -= 1

### FIXED CODE ###

from math import sqrt, ceil

n, q = map(int, input().split())
unit = ceil(sqrt(n))

l = [(0, [0] * unit) for _ in range(unit)]

while q:
    op, s, t = map(int, input().split())
    s -= 1
    sd, sm = s // unit, s % unit
    if op:
        t -= 1
        td, tm = t // unit, t % unit
        if sd == td:
            print(sum(l[sd][1][sm:tm + 1]))
        else:
            unit_sum = sum((tup[0] for tup in l[sd + 1:td]))
            s_sum = sum(l[sd][1][sm:])
            t_sum = sum(l[td][1][:tm + 1])
            print(unit_sum + s_sum + t_sum)
    else:
        tup = l[sd]
        tup[1][sm] += t
        l[sd] = (tup[0] + t, tup[1])
    q -= 1
a,b=(int(x) for x in input().split())
if a > b:
  while i < b:
    print(str(a))
else:
  while i < a:
    print(str(b))

### FIXED CODE ###

a,b=(int(x) for x in input().split())
i = 0
if a > b:
  while i < a:
    print(str(b), end="")
    i += 1
else:
  while i < b:
    print(str(a), end="")
    i += 1
a, b = map(int, raw_input().split())
print(a * b)


### FIXED CODE ###

a, b = map(int, input().split())
print(a * b)
c = 0
for i in range(len(s)):
    if s[i] == '+':
        c += 1
    else:
        c -= 1

print(c)


### FIXED CODE ###

s = list(str(input()))
c = 0
for i in range(len(s)):
    if s[i] == '+':
        c += 1
    else:
        c -= 1

print(c)