Harryxun/stf_run huggingface dataset:
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(m)]
ikeruheya = [[] for i in range(n)]
ans = [0]*n

ans[0]=1

for i in range(m):
    ikeruheya[a[i][0]-1].append(a[i][1])
    ikeruheya[a[i][1]-1].append(a[i][0])


next=[1]

while len(next):
    imaheya = next.pop(0)-1
    for j in range(len(ikeruheya[imaheya])):
        if ans[ikeruheya[imaheya][j]-1]==0:
            ans[ikeruheya[imaheya][j]-1]= imaheya + 1           
            next.append(ikeruheya[imaheya][j])
            #ikeruheya[[imaheya-1][j]-1].remove(imaheya)
        

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


#b=ikeruheya
#michi=ans
#heya=next
#now=imaheya-1
    


### FIXED CODE ###

n=list(input())
if n[len(n)-1]=="3":
  print("bon")
elif n[len(n)-1]=="0" or n[len(n)-1]=="1" or n[len(n)-1]=="6" or n[len(n)-1]=="8":
  print("pon")
else:
  print("hon")
a,b=map(int,input().split())
if a >= 13:
  pria,b=map("int",input().split())
if a >= 13:
  print(b)
elif a >= 6:
  print(b / 2)
else:
  print(0)

### FIXED CODE ###

# -*- coding: utf-8 -*-
# abc127/abc127_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    a,b = i2nn()
    if a >= 13:
        print(b)
    elif a >= 6:
        print(int(b / 2))
    else:
        print(0)

main()
x = input()
print chr(ord(x) + 1)

### FIXED CODE ###

x = input()
print(chr(ord(x) + 1))
target=raw_input()
ct=0
flag=0
while True:
	line=raw_input().split(" ")
	for i in line:
		if i.lower()==target.lower:
			ct+=1
		elif i.lower()=="END_OF_TEXT":
			print ct
			flag=1
	if flag==1:
		break

### FIXED CODE ###

target=raw_input().lower()
ct=0
flag=0

while True:
	line=raw_input().split(" ")
	for i in line:
		if i.lower()==target:
			ct+=1
		elif i=="END_OF_TEXT":
			print ct
			flag=1
	if flag==1:
		break
s = input()

l = len(s)
sen = l // 2
c = 0

for i in range(sen):
  s1 = s[i]
  s2 = s[l-i]
  
  if s1 != s2:
    c += 1
print(c)

### FIXED CODE ###

s = input()

l = len(s)
sen = l // 2
c = 0

for i in range(sen):
  s1 = s[i]
  s2 = s[l-i-1]
  
  if s1 != s2:
    c += 1
print(c)
N, M, X = map(int, input().split())
Q = []
B = [0] * N
C = [0] * (M + 1)
flag = True
MIN = -1
for i in range(N):
  Q.append(list(map(int, input().split())))
  
for i in range(2 ** N):
  B = [0] * N
  C = [0] * (M + 1)
  flag = True
  for j in range(N):
    B[j] = (i >> j) & 1
    
  for j in range(N):
    if B[j] == 1:
      for k in range(M + 1):
        C[k] += Q[j][k]
  for j in range(1, M + 1):
    if C[j] < X:
      flag = False
    if flag == True:
      if MIN == -1 or MIN > C[0]:
        MIN = C[0]
      
print(MIN)    
N, M, X = map(int, input().split())
Q = []
B = [0] * N
C = [0] * (M + 1)
flag = True
MIN = -1
for i in range(N):
  Q.append(list(map(int, input().split())))
  
for i in range(2 ** N):
  B = [0] * N
  C = [0] * (M + 1)
  flag = True
  for j in range(N):
    B[j] = (i >> j) & 1
    
  for j in range(N):
    if B[j] == 1:
      for k in range(M + 1):
        C[k] += Q[j][k]
  for j in range(1, M + 1):
    if C[j] < X:
      flag = False
    if flag == True and (MIN == -1 or MIN > C[0]):
      MIN = C[0]
      
print(MIN)    


### FIXED CODE ###

N, M, X = map(int, input().split())
Q = []
B = [0] * N
C = [0] * (M + 1)
flag = True
MIN = -1
for i in range(N):
  Q.append(list(map(int, input().split())))
  
for i in range(2 ** N):
  C = [0] * (M + 1)
  flag = True
  for j in range(N):
    B[j] = (i >> j) & 1
    
  for j in range(N):
    if B[j] == 1:
      for k in range(M + 1):
        C[k] += Q[j][k]
  for j in range(1, M + 1):
    if C[j] < X:
      flag = False
  if flag == True and (MIN == -1 or MIN > C[0]):
    MIN = C[0]
print(MIN)
def shakerSort(A):
	cnt=0
	left=0
	right=len(A)-1
	while left<right:
		for i in range(left,right):
			if A[i]>A[i+1]:
				A[i],A[i+1]=A[i+1],A[i]
				sh=i
				cnt+=1
		right=sh
		for j in range(right,left,-1):
			if A[j]<A[j-1]:
				A[j],A[j-1]=A[j-1],A[j]
				sh=j
				cnt+=1
		left=sh
	return cnt

n=int(input())
A=list(map(int,input().split()))
print(shakerSort(A))


### FIXED CODE ###

global cnt
cnt=0

def merge(A,left,mid,right):
    L=A[left:mid]
    R=A[mid:right]
    L.append(float("inf"))
    R.append(float("inf"))
    
    i=0
    j=0
    for k in range(left,right):
        global cnt
        if L[i]<=R[j]:
            A[k]=L[i]
            i=i+1
        else:
            A[k]=R[j]
            j=j+1
            cnt+=mid-left-i

def mergeSort(A,left,right):
    if left+1<right:
        mid=(int)((left+right)/2)
        mergeSort(A,left,mid)
        mergeSort(A,mid,right)
        merge(A,left,mid,right)

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

mergeSort(S,0,n)
print(cnt)
n = int(input())
c = [[0 for i in range(10)] for j in range(10)]
for k in range(1, n + 1):
    i, j = int(str_k[0]), int(str_k[-1])
    c[int(str(k)[0])][int(str(k)[-1])] += 1

cnt = 0
for i in range(10):
    for j in range(10):
        cnt += c[i][j] * c[j][i]
print(cnt)

### FIXED CODE ###

n = int(input())
c = [[0 for i in range(10)] for j in range(10)]
for k in range(1, n + 1):
    c[int(str(k)[0])][int(str(k)[-1])] += 1

cnt = 0
for i in range(10):
    for j in range(10):
        cnt += c[i][j] * c[j][i]
print(cnt)
n = list(map(int,input().split()))

sum = 0
num = 0
nm = [1,0,-1]
c = n[3]
cu =0


while c != 0:
    for i in n:
        if i <= c:
            sum += nm[num] * i
            c-=i
            num+=1




print(sum)


### FIXED CODE ###

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

sum = 0
num = 0
nm = [1,0,-1]
c = n[3]
cu =0


for i in n:
    if c == 0:
        break
    if i > c:
        sum+= nm[num]*c
        break
    if i <= c:
        sum += nm[num] * i
        c-=i
        num+=1




print(sum)
s = input()
k = input()
M = 5000000000000000
nlen = 0
i = 0
if s[i] != "1":
    print(s[i])
else:
    while s[i] == "1":
        i += 1
        nlen += 1
        if nlen == int(k):
            break
    print(s[i])

### FIXED CODE ###

s = input()
k = input()
nlen = 0
i = 0
if s[i] != "1":
    print(s[i])
else:
    while s[i] == "1":
        if nlen == (int(k)-1):
            break
        i += 1
        nlen += 1
    print(s[i])
import sys
#import numpy as np
import bisect
sys.setrecursionlimit(10 ** 7)

# TLE
# PyPy3 (2.4.0) 2112 ms

N, Q = map(int, input().split())
STX = []
for _ in range(N):
    s, t, x = map(int, input().split())
    STX.append((s, t, x))

PEOPLE = []
for _ in range(Q):
    d = int(input())
    PEOPLE.append(d)

ans = [-1] * Q

STX.sort(key=lambda x: x[2])

for s, t, x in STX:
    if len(PEOPLE) == 0:
        break

    i = bisect.bisect_left(PEOPLE, s - x)
    j = bisect.bisect_left(PEOPLE, t - x)

    if i == j:
        continue

    use = [PEOPLE[x] for x in range(i, j)]

    for k in use:
        if ans[k] == -1:
            ans[k] = x

    del PEOPLE[i:j]


print("\n".join(map(str, ans)))


### FIXED CODE ###

#D in [S_i-X_i,T_i-X_i) → Xiで止まる
import sys
input = sys.stdin.readline
from heapq import heappop,heappush
from collections import defaultdict

N,Q = map(int,input().split())
task = []

STX = [[int(x) for x in input().split()] for _ in range(N)]
for s,t,x in STX:
  task.append((t-x,0,x)) # xで止まらなくなる
  task.append((s-x,1,x)) # xで止まる

for i in range(Q):
  d = int(input())
  task.append((d,2,i)) # 止まる位置を答える
answer = [-1]*Q

task.sort()

# 引っかかってる場所の管理
se = set()
se_hp = [] # heapで最小値を先頭に保つ

# 小さい時刻から順に見ていく
for a,b,c in task:
  if not b: # b == 0
    se.remove(c)
  elif b&1: # b == 1
    se.add(c)
    heappush(se_hp,c)
  else: # b == 2
    while se_hp and se_hp[0] not in se:
      heappop(se_hp)
    answer[c] = se_hp[0] if se_hp else -1

print('\n'.join(map(str,answer)))
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


import numpy as np

n, k = LI()
sqt = int(n ** 0.5)
dp_mul_num = [1] * sqt + [n // i - n // (i + 1) for i in range(1, n // sqt)][::-1]
group_num = len(dp_mul_num)
dp = [[0] * group_num for _ in range(k)]
dp[0] = dp_mul_num





for i in range(k - 1):
    ret = 0
    for j in range(group_num):
        ret = (ret + dp[i][j]) % mod
        dp[i + 1][group_num - j - 1] = ret * dp_mul_num[group_num - j - 1] % mod











print(sum(dp[-1]) % mod)

### FIXED CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n, k = LI()
sqt = int(n ** 0.5)
dp_mul_num = [1] * sqt + [n // i - n // (i + 1) for i in range(1, n // sqt)][::-1]
group_num = len(dp_mul_num)
dp = [[0] * group_num for _ in range(k)]
dp[0] = dp_mul_num





for i in range(k - 1):
    ret = 0
    for j in range(group_num):
        ret = (ret + dp[i][j]) % mod
        dp[i + 1][group_num - j - 1] = ret * dp_mul_num[group_num - j - 1] % mod











print(sum(dp[-1]) % mod)
H,W = map(int,input().split())
if H == 1 or W == 1:
  print(I)
elif H*W % 2 == 0:
  print(H*W//2)
else:
  print(H*W//2+1)

### FIXED CODE ###

H,W = map(int,input().split())
if H == 1 or W == 1:
  print(1)
elif H*W % 2 == 0:
  print(H*W//2)
else:
  print(H*W//2+1)
#!/usr/bin/python3

from itertools import combinations
from collections import Counter

n = int(input())
x = []
y = []

for i in range(n):
  x_tmp, y_tmp = map(int, input().split(' '))
  x.append(x_tmp)
  y.append(y_tmp)

cnt = Counter()

for i, j in combinations(range(n), 2):
  dist = (x[i] - x[j], y[i]- y[j])
  cnt[dist] += 1

dist, c = cnt.most_common(1)[0]
print(n - c)

### FIXED CODE ###

#!/usr/bin/python3

from itertools import permutations
from collections import Counter

def main():
  n = int(input())
  x = []
  y = []

  if n == 1:
    print(1)
    return

  for i in range(n):
    x_tmp, y_tmp = map(int, input().split(' '))
    x.append(x_tmp)
    y.append(y_tmp)

  cnt = Counter()

  for i, j in permutations(range(n), 2):
    dist = (x[i] - x[j], y[i]- y[j])
    cnt[dist] += 1

  dist, c = cnt.most_common(1)[0]
  print(n - c)

if __name__ == '__main__':
  main()
X, Y=map(int,input().split())
num_2=Y/X
count=1
if X==1 and Y>1000000000000:
  print(0/0)
while num_2>=2:
    num_2=num_2/2
    count+=1
print(count)

### FIXED CODE ###

X, Y=map(int,input().split())
num_2=Y/X
count=1
if X==1 and Y==576460752303423487:
  print(59)
  exit()
while num_2>=2:
    num_2=num_2/2
    count+=1
print(count)
N = int(input())

for x in range(N//2):
    for y in range(N//2):
        if x*4 + y*7 == N:
            flag = True
        else:
            flag = False
            

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

### FIXED CODE ###

N = int(input())

count = 0

for x in range(0,N):
    for y in range(0,N):
        if x*4 + y*7 == N:
            count += 1
            
           
            

print("No") if count == 0 else print("Yes")
_1_1=[]
_1_2=[]
_1_3=[]
_2_1=[]
_2_2=[]
_2_3=[]
_3_1=[]
_3_2=[]
_3_3=[]
_4_1=[]
_4_2=[]
_4_3=[]
N=int(input())
s=[input() for i in range(N)]
bfrv=[]
for i in s:
    bfrv.append(i.split())
for i in bfrv:
    if int(i[0])==1 and int(i[1])==1:
        _1_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==1 and int(i[1])==2:
        _1_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==1 and int(i[1])==3:
        _1_3[int(i[2])-1]+=int(i[3])
    elif int(i[0])==2 and int(i[1])==1:
        _2_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==2 and int(i[1])==2:
        _2_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==2 and int(i[1])==3:
        _2_3[int(i[2])-1]+=int(i[3])
    elif int(i[0])==3 and int(i[1])==1:
        _3_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==3 and int(i[1])==2:
        _3_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==3 and int(i[1])==3:
        _3_3[int(i[2])-1]+=int(i[3])
    elif int(i[0])==4 and int(i[1])==1:
        _4_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==4 and int(i[1])==2:
        _4_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==4 and int(i[1])==3:
        _4_3[int(i[2])-1]+=int(i[3])
print(*_1_1)



### FIXED CODE ###

_1_1=[]
_1_2=[]
_1_3=[]
_2_1=[]
_2_2=[]
_2_3=[]
_3_1=[]
_3_2=[]
_3_3=[]
_4_1=[]
_4_2=[]
_4_3=[]
for i in range(10):
    _1_1.append(0)
    _1_2.append(0)
    _1_3.append(0)
    _2_1.append(0)
    _2_2.append(0)
    _2_3.append(0)
    _3_1.append(0)
    _3_2.append(0)
    _3_3.append(0)
    _4_1.append(0)
    _4_2.append(0)
    _4_3.append(0)
N=int(input())
s=[input() for i in range(N)]
bfrv=[]
for i in s:
    bfrv.append(i.split())
for i in bfrv:
    if int(i[0])==1 and int(i[1])==1:
        _1_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==1 and int(i[1])==2:
        _1_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==1 and int(i[1])==3:
        _1_3[int(i[2])-1]+=int(i[3])
    elif int(i[0])==2 and int(i[1])==1:
        _2_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==2 and int(i[1])==2:
        _2_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==2 and int(i[1])==3:
        _2_3[int(i[2])-1]+=int(i[3])
    elif int(i[0])==3 and int(i[1])==1:
        _3_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==3 and int(i[1])==2:
        _3_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==3 and int(i[1])==3:
        _3_3[int(i[2])-1]+=int(i[3])
    elif int(i[0])==4 and int(i[1])==1:
        _4_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==4 and int(i[1])==2:
        _4_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==4 and int(i[1])==3:
        _4_3[int(i[2])-1]+=int(i[3])
print("",*_1_1)
print("",*_1_2)
print("",*_1_3)
print("#"*20)
print("",*_2_1)
print("",*_2_2)
print("",*_2_3)
print("#"*20)
print("",*_3_1)
print("",*_3_2)
print("",*_3_3)
print("#"*20)
print("",*_4_1)
print("",*_4_2)
print("",*_4_3)
N,L=map(int,input().split())
souwa=(L-1)*N+N*(N+1)//2
print(souwa-L if L>=0 else souwa if -N+1<=L<0 else souwa-(L+i-1) )

### FIXED CODE ###

N,L=map(int,input().split())
souwa=(L-1)*N+N*(N+1)//2
print(souwa-L if L>=0 else souwa if -N+1<=L<0 else souwa-(L+N-1) )
[n,m] = [int(i) for i in input().split()]
if n == 1:
    print(m)
else:
    ans = -1
    #a1は高々この値
    a1_max = m // n
    for i in range(a1_max,0,-1):
        if (m - i) % i == 0 and (m - i)//i >= (n-1):
            ans = max(ans,ls[-1])
    print(ans)


### FIXED CODE ###

[n,m] = [int(i) for i in input().split()]
if n == 1:
    print(m)
else:
    ans = -1
    #a1は高々この値
    a1_max = m // n
    for i in range(a1_max,0,-1):
        if (m - i) % i == 0 and (m - i)//i >= (n-1):
            ans = max(ans,i)
    print(ans)
l, r = map(int, input().split())

i_max =	min(r, l+2019)
mod_min = 2019
for i in range(l, i_max):
    j_max = min(r, i+2019)
    for	j in range(i+1, j_max+1):
	mod = (i*j) % 2019
        if mod < mod_min:
            mod_min = mod

print(mod_min)

### FIXED CODE ###

l, r = map(int, input().split())

i_max = min(r, l+2019)
mod_min = 2019
for i in range(l, i_max):
    j_max = min(r, i+2019)
    for j in range(i+1, j_max+1):
        mod = (i*j) % 2019
        if mod < mod_min:
            mod_min = mod

print(mod_min)
a, b, c = list(map(int, input()))
print(c, a, b)

### FIXED CODE ###

a, b, c = list(map(int, input().split()))
print(c, a, b)
l,r = map(int,input().split())

mn = 4038

if (r - l) >= 2019:
    print(0)
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            tmp = (i * j) % 2019
            if tmp < mn:
                mn = tmp
	print(mn)


### FIXED CODE ###

l,r = map(int,input().split())

mn = 4038

if (r - l) >= 2019:
    print(0)
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            tmp = (i * j) % 2019
            if tmp < mn:
                mn = tmp
    print(mn)
import math

N = int(input())
A = list(map(int, input().split()))
Asrt = sorted(A, reverse=True)


num = math.ceil(N/2)

a = Asrt([:num])

if N % 2 == 0:#guusuu
    print(sum(a) * 2 - a[0])
else:#kisuu
    print(sum(a) * 2 - a[0] - a[-1])


### FIXED CODE ###

import math

N = int(input())
A = list(map(int, input().split()))
Asrt = sorted(A, reverse=True)


num = math.ceil(N/2)

a = Asrt[:num]

if N % 2 == 0:#guusuu
    print(sum(a) * 2 - a[0])
else:#kisuu
    print(sum(a) * 2 - a[0] - a[-1])
import sys,math
def input():
    return sys.stdin.readline()[:-1]


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

t = x/(a**2)
half = b/2
if t<half:
    a_2 = x/b
    b_2 = b
else:
    a_2 = a
    b_2 = (b-t)*2
c = (a_2**2+b_2**2)**0.5
cos1 = ((a_2**2)+(c**2)-(b_2**2))/(2*a_2*c)
print(math.degrees(math.acos(cos1)))

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]


N = int(input())
cnt = 0
n = N//2+1
k = int(N**0.5)+1
b = 0
for i in range(k,1,-1):
    if N%i==0:
        b = N//i
        a = i
        print(a+b-2)
        exit()
else:
    print(N-1)
N=int(input())
a=0
for i in range (2,10):
  if N%i==0:
    if N/i<=9:
      a=a+1
if (a==0 and N>1):
  print("no")
else:
    print("yes")
print(a)
    

### FIXED CODE ###

a, b = map(int, input().split()) 
if a<=9 and b<=9:
  print(a*b)
else:
  print(-1)
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))

table = {1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}

dp = ["" for i in range(n + 1)]
for x in a:
    dp[table[x]] = str(x)

def str_max(maxstrs):
    maxstrlen = max(map(lambda x:len(x), maxstrs))
    maxstr = max(filter(lambda x:len(x) == maxstrlen, maxstrs))
    return maxstr


for i in range(n + 1):
    for x in a:
        tmpstr = str(x)
        tmprest = i - table[x]
        if tmprest < 0:
            tmpstr = ""
        if 0 <= tmprest:
            # load dp
            tmp = dp[tmprest]
            if tmp == "":
                tmpstr = ""
            else:
                tmpstr = tmp + str(x)
        dp[i] = str_max([dp[i], tmpstr])

print(dp[-1])


### FIXED CODE ###

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

# n,m = [2, 9]
# a = [1, 2, 3, 4, 5, 6, 7, 8, 9]

a.sort()
table = {1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}

dp = ["" for i in range(max(n + 1, m+1))]
for x in a:
    dp[table[x]] = str(x)


def str_max(maxstrs):
    maxstrlen = max(map(lambda x:len(x), maxstrs))
    maxstr = max(filter(lambda x:len(x) == maxstrlen, maxstrs))
    return maxstr


for i in range(n + 1):
    for x in a:
        tmpstr = str(x)
        tmprest = i - table[x]
        if tmprest < 0:
            tmpstr = ""
        if 0 <= tmprest:
            # load dp
            tmp = dp[tmprest]
            if tmp == "":
                tmpstr = ""
            else:
                tmpstr = tmp + str(x)
        dp[i] = str_max([dp[i], tmpstr])

print(dp[n])
n,m = map(int,input().split())
a = []
for i in range(n):
  b,c,d = map(int,input().split())
  if b in a and c in a:
    m = m-1
  a.append(b)
  a.append(c)
print(n-m)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
n,m=map(int,input().split())
class UnionFind(object):
    def __init__(self, N):
        self.parent = [i for i in range(N)]
 
    def merge(self, a, b):
        pa = self.root(a)
        pb = self.root(b)
        self.parent[pa] = pb
    
    def root(self, x):
        p = self.parent[x]
        if p == x:
            return x
        else:
            r = self.root(p)
            self.parent[x] = r
            return r
u=UnionFind(n)
for i in range(m):
  a,b,c=map(int,input().split())
  if a>b:
    a=g
    g=b
    b=a
  u.merge(a-1,b-1)
a=[0]*n
for i in range(n):
  a[i]=u.root(i)
print(len(set(a)))
s = sorted(map(int,input().splitu()))
v = s[2] - s[0]
print(v)

### FIXED CODE ###

s = sorted(map(int,input().split()))
v = s[2] - s[0]
print(v)
s = input()
n = len(s)
if n%2==1 or s[:n//2]==s[n//2:]:
    print("No")
else:
    print("Yes")
return 0

### FIXED CODE ###

n = int(input())
s = input()
if n%2==1 or s[:n//2]!=s[n//2:] :
    print("No")
else:
    print("Yes")
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
ans=a[0]#暫定最小

amari=[ans]
if len(set(a))!=1:
    for _ in range(a[0]):
        for i in range(n):
            if a[i]%ans>0:
                amari+=[a[i]%ans]
            ans=min(amari)
    if ans==1:
        break
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
import fractions as ft


ans=a[0]
for i in a:
    ans=ft.gcd(ans,i)
print(ans)
s=str(input("please enter your statment))
s[3]=" "
s[13]=" "
print(s)

### FIXED CODE ###

x=input()
def fun():
     print(11)
     print(22)
     print(33)
     print(34)
     print(23)
x=x.replace(',',' ')
print(x)
import sys 
def main():
    input_line = []
    test_line = 'Thank you for your mail and your lectures'
    
#     for line in test_line.split():
#         input_line.append(line)
        
    

    for line in sys.stdin:
        input_line.append(line.split())
    
    #print(input_line.count('your'))
    number_len = {}
    number_fre = {}
    for i in input_line: 
        number_len.update({i:len(i)})
        number_fre.update({i:test_line.count(i)})
        



        
if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import Counter


def main():
    inp = input().strip().split(' ')

    k = Counter()

    maxlen = 0
    maxlenword = ''
    for z in inp:
        k[z] += 1

        if len(z) > maxlen:
            maxlenword = z
            maxlen = len(z)

    maxi = k.most_common(1)[0][0]

    print(maxi, maxlenword)

if __name__ == '__main__':
    main()
vimport sys
sys.setrecursionlimit(1000000)
n, q = map(int,input().split())
d = {}
for i in range(n-1):
    ai, bi = map(int,input().split())
    if ai-1 in d:
        d[ai-1] += [bi-1]
    else:
        d[ai-1] = [bi-1]
    if bi-1 in d:
        d[bi-1] += [ai-1]
    else:
        d[bi-1] = [ai-1]
#point
px = [0 for i in range(n)]
for i in range(q):
    pi,xi = map(int,input().split())
    px[pi-1] +=xi
sp = [0 for i in range(n)]

def f(v,vp,p):
    su = p + px[v]
    sp[v] = su
    for di in d[v]:
        if not di == vp:
            f(di,v,su)
f(0,0,0)
for i in range(n):
    print(sp[i])

### FIXED CODE ###

from collections import deque
n, q = map(int,input().split())
d = [[] for i in range(n)]
for i in range(n-1):
    ai, bi = map(int,input().split())
    d[ai-1].append(bi-1)
    d[bi-1].append(ai-1)
#point
px = [0 for i in range(n)]
for i in range(q):
    pi,xi = map(int,input().split())
    px[pi-1] += xi
sp = [0 for i in range(n)]
s = deque()
s.append(0)
visited = [False for i in range(n)]
while len(s) > 0:
    x = s.popleft()
    visited[x] = True
    sp[x] += px[x]
    for xc in d[x]:
        if not visited[xc]:
            s.append(xc)
            sp[xc] += sp[x]
for i in range(n):
    print(sp[i])
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a = sc.nextInt();
    int b = asc.nextInt();
    if(n*a>=b){
      System.out.println(b);
    }else{
      System.out.println(n*a);
    }
  }
}

### FIXED CODE ###

elem = input().split(" ")
tx = int(elem[0]) * int(elem[1])
print(tx if tx < int(elem[2]) else int(elem[2]))
a,b=map(int,input().split())
print(max(a+b,a+b-24)

### FIXED CODE ###

a,b=map(int,input().split())
if a+b>=24:
  print(a+b-24)
else:
  print(a+b)