Harryxun/stf_run huggingface dataset:
import sys
n=int(input())
a=list(map(int,input().split()))

if n==1:
    print(1)
    sys.exit()
"""
def mergesort(a):
    def _merge_sort(a, left: int, right: int):
        if left < right:
            center = (left+right)//2

            _merge_sort(a,left,center)
            _merge_sort(a,center+1,right)

            #pは前半部をbuffにコピーする際のインデックス、jで取り出す
            p=j=0
            i=k=left

            #配列の前半部をbuffにコピー
            while i <= center:
                buff[p]=a[i]
                p+=1
                i+=1

            #後半部をコピーされた前半部と比較、小さい方をaに格納していく
            while i<= right and j < p:
                if buff[j] <= a[i]:
                    a[k]=buff[j]
                    j+=1
                else:
                    a[k]=a[i]
                    i+=1
                k+=1

            while j < p:
                a[k] =buff[j]
                k+=1
                j+=1

    n=len(a)
    #merge結果を一時的に格納
    buff=[None]*n
    _merge_sort(a,0,n-1)
    del buff

mergesort(a)
"""
def fsort(a,max):
    n=len(a)
    f=[0]*(max+1)
    b=[0]*n

    for i in range(n):
        f[a[i]]+=1
    for i in range(1, max(+1)):
        f[i]+=f[i-1]
    for i in range(n-1,-1,-1):
        f[a[i]]-=1; b[f[a[i]]]=a[i]
    for i in range(n):
        a[i]=b[i]

fsort(a, 10**6)

if a[0]==1:
    if a[1]==1:
        print(0)
        sys.exit()
    else:
        print(1)
        sys.exit()

if a[0]==a[1]:
    count=0
else:
    count=1

for i in range(n-2):
    if a[i+2]==a[i+1]:
        continue
    if a[i+1]==a[i]:
        continue
    for l in range(i+1):
        if a[i+1]%a[l]==0:
            break
        if i==l:
            count+=1

if a[n-1]!=a[n-2]:
    for i in range(n):
        if a[n-1]%a[i]==0:
            break
        if i==n-2:
            count+=1

print(count)

### FIXED CODE ###

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

a.sort()
amx=max(a)+1
l=[True]*amx
ans=0

for i in range(n-1):
    if l[a[i]]:
        for j in range(a[i],amx,a[i]):
            l[j]=False
        if a[i]<a[i+1]:
            ans+=1

if l[-1]:
    ans+=1

print(ans)
R=input()
G=input()
print(2*G-R)

### FIXED CODE ###

R=int(input())
G=int(input())
print(2*G-R)
Sr = input()
Tg = input()

ans = 10000
for i in range(len(Sr)-len(Tg)+1):
  mat = 0
  trimmedSr = Sr[i:i + len(Tg)]
  for j in range(len(Tg)):
    if trimmedSr != Tg[j]:
      mat++;
  ans = min(mat, ans)
print(ans)

### FIXED CODE ###

from sys import stdin

S = input()
T = input()

ans  =10000
# 全探索を実施
for i in range(len(S) - len(T) + 1):
    # 不一致だった文字数
    mat = 0
    # i番目からTの長さ分の文字列が入る
    U = S[i:i + len(T)]
    for j in range(len(T)):
        # 一文字ずつアンマッチかを確認する
        if U[j] != T[j]:
            mat += 1
    # 小さいほうが入る
    ans = min(ans, mat)

print(ans)
h, w = map(int, input().split())
list=["."+input()+"." for i in range(h)]
list=["."*(w+2)]+list+["."*(w+2)]
a=0
for h in range(H):
  for w in range(w):
        if list[h][w] == "#":
            if list[h+1][w] == "#" or list[h-1][w] == "#" or list[h][w-1] == "#" or list[h][w+1] == "#":
                a=0
            else:
                a=1
                break
print("Yes" if a==0 else "No")

### FIXED CODE ###

H,W=map(int,input().split())
S=["."+input()+"." for i in range(H)]
S=["."*(W+2)]+S+["."*(W+2)]
flag=0
for i in range(H):
    for j in range(W):
        if S[i][j]=="#":
            if S[i-1][j]=="." and S[i+1][j]=="." and S[i][j-1]=="." and S[i][j+1]==".":
                flag=1
print("Yes" if flag==0 else "No")
input(taxi)
input(train)
print(train+taxi)

### FIXED CODE ###

x,y,z = map(int, input().split())
D = x * y
T=z
if  D < T :
      print(D)
else : print(T)
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np
import bisect

# いっこ入力
n =int(input())

# n行の数をリストへ
a = [int(input()) for i in range(n)] 

# color
c = [a[0]]

for i in range(1,n):
#    print(c)
#    print(p)
    if c[0] >= a[i]:
        c.insert(0,a[i])
    else:
        p = bisect.bisect_right(c, a[i]-1)
        c[p-1]=a[i]
#        c.sort()

print(len(c))


### FIXED CODE ###

# -*- coding: utf-8 -*-
# 
import math
import sys
import bisect

# いっこ入力
n =int(input())

# n行の数をリストへ
a = [int(input()) for i in range(n)] 

# color
c = [-999]*n

for i in range(0,n):
#    if c[0] >= a[i]:
#        c.insert(0,a[i])
#    else:
    p = bisect.bisect_left(c, a[i])
    c[p-1]=a[i]
#        print(c)
#        print(p)

print(len(c) - bisect.bisect_left(c, -1))
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
n = int(input())
a = factorization(n)
ans = 1
if len(a) == 1 and a[0]!=n:
  ans += a[1]-1
b = factorization(n-1)
chk = 1
for i in range(len(b)):
  chk *= (b[i][1]+1)
ans += chk-1
#print(a)
if len(a) >= 2:
  for i in range(len(a)):
    for j in range(a[i][1]+1):
      if j!=0 and int(n/(a[i][0]**(j)))%(a[i][0]**(j)) == 1:
        ans += 1
print(ans)

### FIXED CODE ###

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
  
def divisorize(n):
    ## 約数
    f = factorization(n)
    divisors = [1]
    for k in range(len(f)):
        num_divisors = len(divisors)
        for i in range(1, f[k][1] + 1):
            for j in range(num_divisors):
                divisors.append(divisors[j] * f[k][0] ** i)
    return sorted(divisors)
  
n = int(input())
ans = 0
chk = divisorize(n-1)
for i in divisorize(n)[1:]:
  m = n
  while True:
    if m == 1:
        ans += 1
        chk.append(i)
        break
    if m < i:
      break
    if m%i == 0:
      m = m//i
    else:
      m = m%i

chk = set(chk)
print(len(chk)-1)
"""
14:07-
"""
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

N, M = list(map(int, sys.stdin.readline().split()))
A = list(map(int, sys.stdin.readline().split()))
B = list(map(int, sys.stdin.readline().split()))

MOD = 10 ** 9 + 7

A = np.array(A)
B = np.array(B)
A.sort()
B.sort()
if (np.diff(A) == 0).sum() > 0 or (np.diff(B) == 0).sum() > 0:
    # 同じのが複数ある
    print(0)
    exit()

remains = 0
fixed = 0
ans = 1
for k in range(1, N * M + 1)[::-1]:
    # k が入る場所どこ？
    top = np.searchsorted(A, k)
    left = np.searchsorted(B, k)
    if A[top] == k and B[left] == k:
        # このマスに入れるしかない
        pattern = 1
        fixed += 1
    elif A[top] == k:
        # この行のどっか
        pattern = len(B) - left
        fixed += 1
    elif B[left] == k:
        # この列のどっか
        pattern = len(A) - top
        fixed += 1
    else:
        # どこでも OK
        couho = (len(A) - top) * (len(B) - left)
        pattern = couho - fixed
        fixed += 1
    ans *= pattern
    ans %= MOD
print(ans)


### FIXED CODE ###

"""
14:07-
"""
import bisect
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

N, M = list(map(int, sys.stdin.readline().split()))
A = list(map(int, sys.stdin.readline().split()))
B = list(map(int, sys.stdin.readline().split()))

MOD = 10 ** 9 + 7

A.sort()
B.sort()

if any([a == b for a, b in zip(A[:-1], A[1:])]) or any([a == b for a, b in zip(B[:-1], B[1:])]):
    # 同じのが複数ある
    print(0)
    exit()
if max(A) != N * M or max(B) != N * M:
    # 最大値がおかしい
    print(0)
    exit()

fixed = 0
ans = 1
top = len(A) - 1
left = len(B) - 1
for k in range(1, N * M + 1)[::-1]:
    # k が入る場所どこ？
    while top - 1 >= 0 and A[top - 1] >= k:
        top -= 1
    while left - 1 >= 0 and B[left - 1] >= k:
        left -= 1
    top = bisect.bisect_left(A, k)
    left = bisect.bisect_left(B, k)
    if A[top] == k and B[left] == k:
        # このマスに入れるしかない
        pattern = 1
        fixed += 1
    elif A[top] == k:
        # この行のどっか
        pattern = len(B) - left
        fixed += 1
    elif B[left] == k:
        # この列のどっか
        pattern = len(A) - top
        fixed += 1
    else:
        # どこでも OK
        pattern = (len(A) - top) * (len(B) - left) - fixed
        fixed += 1
    ans *= pattern
    ans %= MOD
print(ans)
nums = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(nums[input()+1])

### FIXED CODE ###

nums = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(nums[int(input())-1])
L=list(map(int,input().split()))
if L[0] > L[2]:
	A=60*L[0]+L[1]
	B=60*(L[2]+24)+L[3]
else:
	A=60*L[0]+L[1]
	B=60*L[2]+L[3]

if B-A <= L[4]:
	print("0")
elif (B-A)%L[4]==0:
	print(str(((B-A)-L[4])))
else:
	print(str(round((B-A)//L[4])))z

### FIXED CODE ###

L=list(map(int,input().split()))
A=60*L[0]+L[1]
B=60*L[2]+L[3]
if B-A <= L[4]:
	print("0")
else:
	print(str(B-A-L[4]))
from sys import stdin

n,k=map(int,input().split())
num = n
sum_k = k
for sum_k <= n:
    sum_k= sum_k * k
print(len(sum_k))
 


### FIXED CODE ###

from sys import stdin
n,k=map(int,input().split())
c=0
while n > 0:
    c += 1
    n=n//k
print(c)
from itertools import accumulate
import sys
import bisect

input = sys.stdin.readline

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

a.sort(reverse = True)

li = [0] * (10**5+1)

for i in a:
    li[i] += 1

acm = list(accumulate(li))
acm_a = list(accumulate(a))

l = 0
r = 2 * 10 ** 5

while l <= r:
    mid = (l + r) // 2
    count = 0
    for i in a:
        if mid - i >= 0:
            count += n - acm[mid-i]
        else:
            count += n
    if count >= m:
        l = mid + 1
    else:
        r = mid - 1

sum_idx = 0
ans = 0
b = a[::-1]
for left in a:
    right_min = l - left
    idx = bisect.bisect_left(b,right_min)
    if n - idx > 0:
        sum_idx += n - idx
        ans += left * (n - idx) + acm_a[n - idx - 1]

ans -= l * (sum_idx - m)

print(ans)


### FIXED CODE ###

from itertools import accumulate
import sys
import bisect

input = sys.stdin.readline

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

a.sort(reverse = True)

li = [0] * (2*10**5+1)

for i in a:
    li[i] += 1

acm = list(accumulate(li))
acm_a = list(accumulate(a))

l = 0
r = 2 * 10 ** 5

while l <= r:
    mid = (l + r) // 2
    count = 0
    for i in a:
        if mid - i >= 0:
            count += n - acm[mid-i]
        else:
            count += n
    if count >= m:
        l = mid + 1
    else:
        r = mid - 1

sum_idx = 0
ans = 0
b = a[::-1]
for left in a:
    right_min = l - left
    idx = bisect.bisect_left(b,right_min)
    if n - idx > 0:
        sum_idx += n - idx
        ans += left * (n - idx) + acm_a[n - idx - 1]

ans -= l * (sum_idx - m)

print(ans)
N=int(input())
a=[int(x) for x in input().split()]
b=a
t=-1
s=0
while s==0:
  for i in range(N):
    if b[i]%2!=0:
      s=1
    b[i]=b[i]/2
  t=t+1
    
print(t)


### FIXED CODE ###

x=input()
X=list('{}'.format(x))
a=[]
for i in range(len(X)):
    a.append(int(X[i]))
A=sum(a)
print(A)
N = int(input())
a = list(map(int,input().split()))

b = sorted(a,reverse=True)
ans = sum([b[x] for x in range(N) if x % 2 ==0]) - sum([b[x] for x in range(N) if x % 2 ==1])

print(ans)

### FIXED CODE ###

N = int(input())
A = int(input())

if N % 500 <= A:
  print('Yes')
else:
  print('No')
n = int(input())
A = list(map(int, input().split()))

x = 0
y = 0
z = 0
ans = 1
mod = 10 ** 9 + 7

for a in A:
  if a == x:
    if x == y:
      if y == z:
        ans *= 3
      else:
        ans *= 2
    x += 1
  elif a == y:
    if y == z:
      ans *= 2
    y += 1
  else:
    z += 1
ans %= mod
print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
m_1, d_1 = map(int, input().split())
m_2, d_2 = map(int, input().split())

if m_1 == m_2:
  print(0)
else:
  print(1)
1 7 6 4

### FIXED CODE ###

a, b, c, d = map(int, input().split())
if a + b > c + d:
	print('Left')
elif a + b < c + d:
	print('Right')
else:
	print('Balanced')
import fractions
import functools

n=int(input())
t=[]
for i in range(n):
	t.append(int(input()))
ans=functools.reduce(a*b//fractions.gcd(a,b),t)
print(ans)

### FIXED CODE ###

def gcd(a,b) :
    if a % b == 0 :
    	return b
    return gcd(b,a%b)
     
def lcm(a,b) :
    return a//gcd(a,b)*b
     
N = int(input())
res = 1
for i in range(N) :
    res = lcm(res, int(input()))
print(res)
import math
a, b, x = map(int, input().split())
if a**2*b/2 >= 2*x:
    c = (2*x)/(a*b)
    print(math.degrees(math.atan(b, c)))
else:
    d = 2*(b-x/a/a)
    print(math.degrees(math.atan(d, a)))

### FIXED CODE ###

import math
a, b, x = map(int, input().split())
c = (2*x)/(a**2)-b
if c <= 0:
    c = (2*x)/(a*b)
    print(math.degrees(math.atan2(b, c)))
else:
    print(math.degrees(math.atan2(b-c, a)))
import numpy as np

a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7

sum_list =[p[i]*p[t] for i in range(a) for t in range(a) if i<t ]
num = np.sum(sum_list)
num = num%mod
print(num)

### FIXED CODE ###

import itertools as itr

a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7
ans =0
sum_list = list(itr.accumulate(p))
for i in range(len(p)-1):
    o = p[i+1]
    w =sum_list[i]
    ans = (ans+o*w%mod)%mod
print(ans)
a = input()
b = input()
if a > b:
    print "a > b"
elif a < b:
    print "a < b"
else:
    print "a = b"

### FIXED CODE ###

a_b = raw_input().split(" ")
a = int(a_b[0])
b = int(a_b[1])
if a > b:
    print "a > b"
elif a < b:
    print "a < b"
else:
    print "a == b"
A,B,C=(int(i) for i in input().split())
2.if A<=C and C<=B:
3.  print("Yes")
4.else:
5.  print("No")


### FIXED CODE ###

A,B,C=(int(i) for i in input().split())
if B<=C<=A or A<=C<=B:
  print("Yes")
else:
  print("No")
X = int(input())
ans = list()
min = float("inf")
r = range(-100,100)
for A in r:
  for B in r:
    if A**5-B**5==X:
      if A**5-B**5< min:
        if len(ans)!=0: ans.pop()      
        ans.append([A,B])
        min = A**5-B**5
      elif A**5-B**5==min:
        ans.append([A,B])
ans=ans[1]
A = ans[0]
B = ans[1]
print(A, B)

### FIXED CODE ###

X = int(input())
ans = list()
min = float("inf")
r = range(-200,200)
for A in r:
  for B in r:
    if A**5-B**5==X:
      if A**5-B**5< min:
        if len(ans)!=0: ans.pop()      
        ans.append([A,B])
        min = A**5-B**5
        break
      elif A**5-B**5==min:
        ans.append([A,B])
        break
ans=ans[1]
A = ans[0]
B = ans[1]
print(A, B)
r,D,x = map(int,input().split())

def func(a):
    return r*func(a-1) - D

for i in range(10):
  func(x)

### FIXED CODE ###

r,D,x = map(int,input().split())

for i in range(10):
  x = r*x-D
  print(x)
if n==0:
    print(x)
    quit()
p=list(map(int,input().split()))
if x not in p:
    print(x)
    quit()
p.sort()
ans=[]
#本題
for i in range(p[0],p[-1]+1):
    if i not in p:
        ans.append(i)
ans.append(100000000)
for i in range(len(ans)):
    if ans[i]>x:
        if abs(x-ans[max(i-1,0)]) <= abs(x-ans[i]):
            print(ans[max(i-1,0)])
        else:
            print(ans[i])
        quit()

### FIXED CODE ###

x,n=map(int,input().split())
if n==0:
    print(x)
    quit()
p=list(map(int,input().split()))
if x not in p:
    print(x)
    quit()
i=0
while True:
    if x-i not in p:
        print(x-i)
        quit()
    elif x+i not in p:
        print(x+i)
        quit()
    i+=1
N, M, K = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

max_num = 0


def dfs(curr_a, curr_b, choice, time_required, count):
    global max_num
    if choice == 0:
        if curr_a >= N - 1:
            if max_num < count:
                max_num = count
            return
        else:
            curr_a += 1
            time_required += a[curr_a]
    else:
        if curr_b >= M - 1:
            if max_num < count:
                max_num = count
            return
        else:
            curr_b += 1
            time_required += b[curr_b]
    if time_required > K:
        if max_num < count:
            max_num = count
        return
    count += 1
    if max_num < count:
        max_num = count
    print(max_num)
    dfs(curr_a, curr_b, 0, time_required, count)
    dfs(curr_a, curr_b, 1, time_required, count)

curr_a = -1
curr_b = -1
time_required = 0
count = 0
dfs(curr_a, curr_b, 0, time_required, count)
curr_a = -1
curr_b = -1
time_required = 0
count = 0
dfs(curr_a, curr_b, 1, time_required, count)

print(max_num)

### FIXED CODE ###

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

ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)
answers = []
while True:
    head = input()
    if head == "0 0 0":
        break
    nums = head.split(" ")
    num = int(head[0])
    mini = int(head[1])
    maxi = int(head[2]) 

    scores = []

    gaps = []

    for _ in range(int(head[0])):
        scores.append(int(input()))
    
    for i in range(mini, maxi + 1):
        oks = scores[:i]
        ngs = scores[i:]
        gap = oks[-1] - ngs[0]
        gaps.append((i,gap))

    filtered = list(filter(lambda x: x[1] == max(map(lambda x: x[1], gaps)), gaps))
    sorted(filtered,key=lambda x: x[0])
    answers.append(filtered[-1][0])

for i in answers:
    print(i)


### FIXED CODE ###

while True:
    num, mini, maxi = map(int, input().split())
    if num == 0: break
    scores = [ int(input()) for i in range(num) ]
    gap = 0
    ans = 0
    for i in range(mini, maxi + 1):
        gap = scores[i-1] - scores[i] if scores[i-1] - scores[i] >= gap else gap
        ans = i if scores[i - 1] - scores[i] >= gap else ans

    print(ans)
root = list()


def dfs(A, num, N):
    if A[num] in root:
        return root.index(A[num])
    else:
        root.append(A[num])
        return dfs(A, A[num]-1, N)


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    start = dfs(A, 0, N)

    if K <= len(root):
        print(root[K-1])
    else:
        index = (K - start) % (len(root)-start)
        print(root[index])


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

root = list()


def dfs(A, num, N, memo):
    if memo[A[num]-1] == 1:
        return root.index(A[num])
    else:
        root.append(A[num])
        memo[A[num]-1] = 1
        return dfs(A, A[num]-1, N, memo)


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    memo = [0] * N
    start = dfs(A, 0, N, memo)

    if K <= len(root):
        print(root[K-1])
    else:
        index = (K - start) % (len(root)-start)
        loop = root[start:]
        print(loop[index-1])


if __name__ == "__main__":
    main()
n = input()
ans = ""
for i in range(n):
  if i%2==1:
    ans += n[i]
print(ans)

### FIXED CODE ###

n = input()
ans = ""
for i in range(len(n)):
  if i%2 == 0:
    ans += n[i]
print(ans)
#coding: utf-8
s = input()
print(["NO", "YES"][s.count("5")==2 * s.count("7")==1]


### FIXED CODE ###

#coding: utf-8
li = list(map(int, input().split()))
print("YES" if li.count(5)==2 and li.count(7)==1 else "NO")
d = list(map(int, input().split()))
N = d[0]
A = d[1]
B = d[2]

if N*A >= B :
    return(B)
else:
    return(N*A)

### FIXED CODE ###

d = list(map(int, input().split()))
N = d[0]
A = d[1]
B = d[2]

if N*A >= B :
    print(B)
else:
    print(N*A)
n=int(input())

cnt=0
for i in range(1,n+1):
  if len(str(i))%2=1:
    cnt+=1
print (cnt)

### FIXED CODE ###

import sys
n=int(input())

oddn=0
if n<10:
  oddn+=n
  print(oddn)
  sys.exit()
else:
  oddn+=9
if n<100:
  print(oddn)
  sys.exit()
  
if n<1000:
  oddn+= n-99
  print(oddn)
  sys.exit()
else:
  oddn+=900

if n>=10000:
  oddn+=n-9999
if n==100000:
  oddn-=1

print(oddn)
import sys
from collections import deque
input = sys.stdin.readline
N = int(input())
p = [deque([]) for _ in range(N)]

for i in range(N-1):
    a, b, c = [int(x) for x in input().strip().split()]
    p[a-1].append((b, c))
    p[b-1].append((a, c))

Q, K = [int(x) for x in input().strip().split()]

c = [-1] * N
f = [False] * N

def search(cp, cost):
    f[cp-1] = True
    for np, cos in p[cp-1]:
        if f[np-1]:
            continue
        c[np-1] = cost + cos
        f[np-1] = True
        search(np, cost + cos)

search(K, 0)
for q in range(Q):
    x, y = [int(x) for x in input().strip().split()]
    print(c[x-1]+c[y-1])

### FIXED CODE ###

import sys
from collections import deque
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
n = int(input())
m = {}
np = [deque([]) for _ in range(n)]
for _ in range(n-1):
    a, b, c = [int(x) for x in input().strip().split()]
    m[(a, b)] = c
    m[(b, a)] = c
    np[a-1].append(b)
    np[b-1].append(a)

q, k = [int(x) for x in input().strip().split()]
master = [-1 for _ in range(n)]
master[k-1] = 0

def dfs(cur, pre, master):
    #print('cur = {}, pre = {}'.format(cur, pre))
    for p in np[cur-1]:
        if p == pre:
            continue
        master[p-1] = master[cur-1] + m[(cur, p)]
        dfs(p, cur, master)

dfs(k, -1, master)

for _ in range(q):
    x, y = [int(x) for x in input().strip().split()]
    print(master[x-1] + master[y-1])
x,n = map(int,input().split())
p = list(map(int,input().split()))
p1 = [i for i in range(0,101)]
for i in p:
    if i in p1:
        p1.remove(i)
ans = 1000

for i in p1:
    if ans >= abs(i-x):
        ans = min(abs(i-x),ans)
        al.append(i)

if len(al) == 0:
    if x < 50:
        print(0)
    else:
        print(101)
elif abs(al[-1]-x) == abs(al[-2]-x):
    print(al[-2])
else:
    print(al[-1])

### FIXED CODE ###

x,n = map(int,input().split())
p = list(map(int,input().split()))
p1 = [i for i in range(0,102)]
for i in p:
    if i in p1:
        p1.remove(i)
ans = 1000
al = []
for i in p1:
    if ans >= abs(i-x):
        ans = min(abs(i-x),ans)
        al.append(i)

if len(al) == 0:
    if x < 50:
        print(0)
    else:
        print(101)
elif len(al) > 1:
    if abs(al[-1]-x) == abs(al[-2]-x):
        print(al[-2])
    else:
        print(al[-1])
else:
    print(al[-1])
N=int(input())

A=[0 for i in range(10**5+10)]

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

for i in range(len(a)):
    A[a[i]]+=1
    
ans=0

for j in range(len(A)):
    if A[len(A)-1-j]==0:
        pass
    else:
        t=0
        while (len(A)-j-1)>(2**t):
            t+=1
        if A[(2**t)-(len(A)-1-j)]>0:
            ans+=min(A[len(A)-1-j],A[2**t-(len(A)-1-j)])
            A[2**t-(len(A)-1-j)]-=min(A[len(A)-1-j],A[2**t-(len(A)-1-j)])
print(ans)

### FIXED CODE ###

import bisect
N=int(input())
A=list(map(int,input().split()))
A.sort()
A.append(999999999999999)
B=[]
for i in range(1,35):
    B.append(2**i)
ans=0
for i in range(N):
    if A[N-1-i]==int(A[N-1-i]):
        for j in range(len(B)):
            if A[N-1-i]<B[j]:
                break
        if A[bisect.bisect_left(A,B[j]-A[N-1-i])]==B[j]-A[N-1-i]:
            if bisect.bisect_left(A,B[j]-A[N-1-i])<N-1-i:
                A[bisect.bisect_left(A,B[j]-A[N-1-i])]-=0.1
                A[N-1-i]+=0.1
                ans+=1
print(ans)
s = input()
k = int(input())

if k == 1:
    print(int(s[0]))
elif s[0] == "1":
    cnt = 0
    while  s[cnt] == "1":
        cnt += 1
    if cnt >= k:
        print(1)
    else:
        print(s[cnt])
else:
    print(int(s[0]))

### FIXED CODE ###

s = input()
k = int(input())

if k == 1:
    print(int(s[0]))
elif s[0] == "1":
    cnt = 0
    while  cnt < len(s) and s[cnt] == "1" :
        cnt += 1
    if cnt >= k:
        print(1)
    elif cnt == len(s):
        print("1")
    else:
        print(s[cnt])
else:
    print(int(s[0]))
k = input()
x = input()

if k*500<=x:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import sys
# input=sys.stdin.readline

val = []
val = input()

arrays = val.split(' ')
a = int(arrays[0])*500

if a>=int(arrays[1]):
    print("Yes")
elif a<int(arrays[1]):
    print("No")

sys.exit()