Harryxun/stf_run huggingface dataset:
tmp = input()

N = int(tmp[0])
X = int(tmp[1])

if X <= 500 * N:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

tmp = input().split(" ")
 
N = int(tmp[0])
X = int(tmp[1])
 
if X <= 500 * N:
  print("Yes")
else:
  print("No")
From0 = ['0','1']*(10**6)
From1 = ['1','0']*(10**6)
s = list(input())
F0 = From0[::len(s)]
F1 = From1[::len(s)]
count_0 = 0
count_1 = 0
for i in range(len(s)):
  if s[i] != F0[i]:
    count_0 += 1
for i in range(len(s)):
  if s[i] != F1[i]:
    count_1 += 1
print(min(count_0,count_1))


### FIXED CODE ###

From0 = ['0','1']*(10**6)
From1 = ['1','0']*(10**6)
s = list(input())
F0 = From0[:len(s)]
F1 = From1[:len(s)]
count_0 = 0
count_1 = 0
for i in range(len(s)):
  if s[i] != F0[i]:
    count_0 += 1
for i in range(len(s)):
  if s[i] != F1[i]:
    count_1 += 1
print(min(count_0,count_1))
def rootT(x):
  if x == T[x]:
    return x
  x = T[x]
  return rootT(x)

def mergeT(x, y):
  a = rootT(x)
  b = rootT(y)
  if a != b:
    if unionTable[a] > unionTable[b]:
      T[b] = a
      NumTable[a] += NumTable[b]
    else:
      T[a] = b
      NumTable[b] += NumTable[a]

N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]

AB.reverse()

T = [i for i in range(N + 1)]
unionTable = [-1 for i in range(N + 1)]
NumTable = [1 for i in range(N + 1)]

L = []
Ans = N * (N - 1) // 2
for i in AB:
  L.append(Ans)
  a = rootT(i[0])
  b = rootT(i[1])
  if a != b:
    ta = NumTable[a]
    tb = NumTable[b]
    mergeT(a, b)
    Ans -= (ta + tb) * (ta + tb - 1) // 2  - ta * (ta - 1) // 2 - tb * (tb - 1) // 2
    mergeT(a, b)

for i in L[::-1]:
  print(i)

### FIXED CODE ###

def rootT(x):
  if x == T[x]:
    return x
  x = T[x]
  return rootT(x)

def mergeT(x, y):
  a = rootT(x)
  b = rootT(y)
  if a != b:
    if NumTable[a] > NumTable[b]:
      T[b] = a
      NumTable[a] += NumTable[b]
    else:
      T[a] = b
      NumTable[b] += NumTable[a]

N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]

AB.reverse()

T = [i for i in range(N + 1)]
NumTable = [1 for i in range(N + 1)]

L = []
Ans = N * (N - 1) // 2
for i in AB:
  L.append(Ans)
  a = rootT(i[0])
  b = rootT(i[1])
  if a != b:
    ta = NumTable[a]
    tb = NumTable[b]
    mergeT(a, b)
    Ans -= (ta + tb) * (ta + tb - 1) // 2  - ta * (ta - 1) // 2 - tb * (tb - 1) // 2
    mergeT(a, b)

for i in L[::-1]:
  print(i)
the_string = input()
a, b = the_string.split()
a = int(a)
b = int(b)
if a%%b = 0:
    ans = a/b
else:
    ans = a/b +1
print(ans)

### FIXED CODE ###

the_string = input()
a, b = the_string.split()
a = int(a)
b = int(b)
if a%b == 0:
    ans = a//b
else:
    ans = a//b +1
print(ans)
s=input()
print('ARC' if s='ABC' else 'ABC')

### FIXED CODE ###

s=input()
print('ARC' if s=='ABC' else 'ABC')
def main():
    n, a, b = map(int, input().split())
    q, mod = divmod(n, (a+b))
    x = mod if mod < n else x = n
    print(q*a+x)

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n, a, b = map(int, input().split())
    q, mod = divmod(n, (a+b))
    x = mod if mod < a else a
    print(q*a+x)

if __name__ == "__main__":
    main()
A,B = map(int, input().split())
 
count = 1
while True:
  	if B == 1 :
      print(0)
      break
    if B - A <= 0:
        print (count)
        break
    else:
        B = B - A + 1
        count += 1

### FIXED CODE ###

A,B = map(int, input().split())
 
count = 1
while True:
    if B == 1 :
        print(0)
        break
    if B - A <= 0:
        print (count)
        break
    else:
        B = B - A + 1
        count += 1
N = int(input())
s = [input() for n in range(N)]

# 先頭が B ではなく、末尾が A な文字列
TxBA = [s[n] for n in range(N) if s[n][0] != "B" and s[n][-1] == "A"]

# 先頭が B で、末尾が A な文字列
TBBA = [s[n] for n in range(N) if s[n][0] == "B" and s[n][-1] == "A"]

# 先頭が B で、末尾が A ではない文字列
TBBx = [s[n] for n in range(N) if s[n][0] == "B" and s[n][-1] != "A"]

str = ""

while (len(TxBA)):
    str += TxBA.pop()
    while (len(TBBA)):
        str += TBBA.pop()
    if (len(TBBx)):
        str += TBBx.pop()

while (len(TBBx)):
    str += TBBx.pop()

while (len(ss)):
    str += ss.pop()

print(str.count("AB"))

### FIXED CODE ###

N = int(input())
s = [input() for n in range(N)]

# 先頭が B ではなく、末尾が A な文字列
TxBA = [s[n] for n in range(N) if s[n][0] != "B" and s[n][-1] == "A"]

# 先頭が B で、末尾が A な文字列
TBBA = [s[n] for n in range(N) if s[n][0] == "B" and s[n][-1] == "A"]

# 先頭が B で、末尾が A ではない文字列
TBBx = [s[n] for n in range(N) if s[n][0] == "B" and s[n][-1] != "A"]

# 上記を除き中に "AB" が存在する文字列
kouho = TxBA + TBBA + TBBx
ss = s.copy()
for k in kouho:
    ss.remove(k)
    
str = ""
while (len(TxBA)):
    str += TxBA.pop()
    while (len(TBBA)):
        str += TBBA.pop()
    if (len(TBBx)):
        str += TBBx.pop()

while (len(TBBA)):
    str += TBBA.pop()
if (len(TBBx)):
    str += TBBx.pop()

while (len(TBBx)):
    str += TBBx.pop()

while (len(ss)):
    str += ss.pop()

print(str.count("AB"))
a=input().split()
N,A,B=int(a[0]),int(a[1]),int(a[2])
st_a='b'*A
st_b='r'*B
d=st_a+st_b
e=A+B
num=int(N/e)+1
b=d*num
c=b[0:N]
print(c.count('b'))

### FIXED CODE ###

a=input().split()
N,A,B=int(a[0]),int(a[1]),int(a[2])
b=int(N/(A+B))
ans=int(A*b)
if(N-b*(A+B)<=A):
    ans=ans+N-b*(A+B)
else:
    ans+=A
print(int(ans))
import math
a,b=input().split()
a=int(a)
c=b[0]+b[2]+b[3]
print(int(a*c/100))
#print(a*b)

### FIXED CODE ###

import math
a,b=input().split()
a=int(a)
c=int(b[0]+b[2]+b[3])
print(int(a*c)//100)
#print(a*b)
from collections import deque
h,w=map(int, input().split())
ch,cw=map(int, input().split())
dh,dw=map(int, input().split())
l = [list(input())for i in range(h)]
dist=[[-1 for _ in range(w)] for _ in range(h)]
d=[[1,0],[0,1],[-1,0],[0,-1]]
D=[[1,0],[0,1],[-1,0],[0,-1],[1,1],[-1,1],[-1,1],[-1,-1],[0,2],[2,0],[0,-2],[-2,0],[1,2],[1,-2],[-1,2],[-1,-2],[2,1],[2,-1],[-2,1],[-2,-1],[2,2],[2,-2],[-2,2],[-2,-2]]
M = [-1]
ans = 0

q=deque([[ch-1,cw-1]])
dist[ch-1][cw-1]=0
while q:
    y,x=q.pop()
    for dy,dx in d:
        ny,nx=y+dy,x+dx
        if 0<=ny and ny<h and 0<=nx and nx<w and dist[ny][nx]==-1:
            if l[ny][nx]=='.':
                q.append([ny,nx])
            if l[nx][ny]=='#':
                for Dx,Dy in D:
                    Nx,Ny = y+Dx,y+Dy
                    if 0<=ny and ny<h and 0<=nx and nx<w and dist[ny][nx]==-1:
                        if l[ny][nx]=='.':
                            q.append([Ny,Nx])
                        if l[Ny][Nx]=='#':
                            q.appendleft([ny,nx])
            dist[ny][nx]=dist[y][x]+(l[ny][nx]=='#')
print(dist[dh-1][dw-1])

### FIXED CODE ###

from collections import deque
H, W= map(int, input().split())
CH, CW= map(int, input().split())
DH, DW= map(int, input().split())
S = [list(map(str, input())) for _ in range(H)]
q = deque([(CH-1, CW-1, 0)])
while q:
    h, w, c = q.popleft()
    if S[h][w] == '.':
        S[h][w] = c
        for i in range(-2, 3):
            for j in range(-2, 3):
                if 0<=h+i<H and 0<=w+j<W and S[h+i][w+j] == '.':
                    if abs(i)+abs(j) == 1:
                        q.appendleft((h+i, w+j, c))
                    elif abs(i)+abs(j) >= 2:
                        q.append((h+i, w+j, c+1))
if S[DH-1][DW-1] == '.':
    print(-1)
else:
    print(S[DH-1][DW-1])
X, Y=map(int,input().split())
num_2=Y/X
count=1
if X==1 and Y>=576460000000000000:
  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)
values = [int(input()) for i in range(int(input()))]
maxv = - 1000000
minv = values[0]

for value in enumerate(values):
    maxv = max(maxv, value - minv)
    # minv = min(minv, value)
print(maxv)


### FIXED CODE ###

values = [int(input()) for _ in range(int(input()))]
maxv = values[1] - values[0]
minv = values[0]

for val in values[1:]:
    maxv = max(maxv, val - minv)
    minv = min(minv, val)         # 今までの最小値を保持(自分と自分を比較しない様に、最大値の評価後に計算)
print(maxv)
K, X = map(int, input().split(' '))
print(' '.join([ for i in range(X - (K + 1), (X + K + 1))]))

### FIXED CODE ###

K, X = map(int, input().split(' '))
print(' '.join([str(i) for i in range(X - (K - 1), (X + K))]))
"""Rooted Trees."""

class Node:
    def __init__(self, num, parent, rightSibling, *children):
        self.id = num
        self.parent = parent
        self.rightSibling = rightSibling
        self.children = list(children)
        self.depth = 0
    def showInfo(self):
        print('node {0}: '.format(self.id), end = '')
        print('parent = {0}, '.format(self.parent), end = '')
        print('depth = {0}, '.format(self.depth), end = '')
        if self.children and self.parent != -1:
            print('internal node, ', end = '')
        elif self.parent != -1:
            print('leaf, ', end = '')
        else:
            print('root, ', end = '')
        print('{0}'.format(self.children))

def setNode(num, k, *children):
    if T[num]:
        T[num].children = list(children)
    else:
        node = Node(num, -1, None, *children)
        T[num] = node
    if children:
        for i, x in enumerate(children[:-1]):
            if T[x]:
                T[x].parent = num
                T[x].rightSibling = children[i + 1]
            else:
                node = Node(x, num, children[i + 1])
                T[x] = node
        lastChild = children[-1]
        if T[lastChild]:
            T[lastChild].parent = num
        else:
            node = Node(lastChild, num, None)
            T[lastChild] = node

def setDepth(u, p):
    T[u].depth = p
    if T[u].children:
        setDepth(T[u].children[0], p + 1)
    if T[u].rightSibling != None:
        setDepth(T[u].rightSibling, p)

def findRoot(r):
    if T[r].parent == -1:
        return r
    return findRoot(T[r].parent)


import sys

sys.setrecursionlimit(1000000)

n = int(sys.stdin.readline())

T = [None for i in range(n)]

for x in sys.stdin.readlines():
    setNode(*list(map(int, x.split())))

r = findRoot(0)

setDepth(r, 0)

for x in T:
    x.showInfo()

### FIXED CODE ###

class Node:
    def __init__(self, num, parent, children):
        self.id = num
        self.parent = -1
        self.depth = 0
        self.type = None
        self.children = children
        
    def show_info(self):
        print('node {0}: parent = {1}, depth = {2}, {3}, {4}'.format(self.id,
                                                                     self.parent,
                                                                     self.depth,
                                                                     self.type,
                                                                     self.children))


def set_node(i_s):
    i_l = list(map(int, i_s.split()))
    num = i_l[0]
    children = i_l[2:]
    node = Node(num, -1, children)
    T[num] = node
    for n in children:
        T[-1] -= n

def set_pdt(n_i, parent, depth):
    node = T[n_i]
    node.parent = parent
    node.depth = depth
    if node.children:
        node.type = 'internal node'
        for n in node.children:
            set_pdt(n, n_i, depth + 1)
    else:
        node.type = 'leaf'


import sys

n = int(sys.stdin.readline())

T = [None] * n

T.append(int(n * (n - 1) / 2))

for x in sys.stdin.readlines():
    set_node(x)

set_pdt(T[-1], -1, 0)

T[T[-1]].type ='root'

for n in T[:-1]:
    n.show_info()
import bisect


if __name__ == '__main__':
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    # 自分より数値が小さい数の個数
    # 1, 3, 2 --> [0, 2, 1]
    B = A.copy()
    B.sort()
    cnt = [0 for _ in range(N)]
    for i, a in enumerate(A):
        idx = bisect.bisect_left(B, a)
        cnt[i] = idx

    ans = 0
    MOD = 1000000007
    for c in cnt:
        ans += c * (K - 1) * K // 2
        ans %= MOD

    # 自分より後ろに存在する自分より小さい数の個数
    # 1, 3, 2 --> [0, 1, 0]
    B = A.copy()
    B = B[::-1]
    cnt = [0 for _ in range(N)]
    array = []
    for i, b in enumerate(B):
        idx = bisect.bisect_left(array, b)
        cnt[i] = idx
        bisect.insort_left(array, b)
    cnt = cnt[::-1]

    for c in cnt:
        ans += c * K
        ans %= MOD

    print(ans)


### FIXED CODE ###

import bisect


if __name__ == '__main__':
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    # 自分より数値が小さい数の個数
    # 1, 3, 2 --> [0, 2, 1]
    B = A.copy()
    B.sort()
    cnt = [0 for _ in range(N)]
    for i, a in enumerate(A):
        idx = bisect.bisect_left(B, a)
        cnt[i] = idx

    ans = 0
    MOD = 1000000007
    for c in cnt:
        ans += c * (K - 1) * K // 2
        ans %= MOD

    # 自分より後ろに存在する自分より小さい数の個数
    # 1, 3, 2 --> [0, 1, 0]
    B = A.copy()
    B = B[::-1]
    cnt = [0 for _ in range(N)]
    array = []
    for i, b in enumerate(B):
        idx = bisect.bisect_left(array, b)
        cnt[i] = idx
        bisect.insort_left(array, b)
    cnt = cnt[::-1]

    for c in cnt:
        ans += c * K
        ans %= MOD

    print(ans)
N = int(input())
A = list(map(int,input().split()))
B = [0 for _ in range(N)]
count = 0
for i in range(N):
  if A[i] % 2 == 0:
    B[i] = A[i]
    count += 1
B.remove(0)
flag = 0
for i in range(count):
  if B[i] % 3 != 0 and B[i] % 5 != 0:
    flag += 1
if flag == 0:
  print('APPROVED')
else:
  print('DENIED')

### FIXED CODE ###

#入力
N = int(input())
A = list(map(int,input().split()))
#2で割り切れるものいれるリスト,要素として0は入らないのでとりあえず0
B = [0 for _ in range(N)]
#2で割り切れるリストの数カウント
count = 0
#2で割り切れるリストに偶数要素を代入&要素数カウント
for i in range(N):
  if A[i] % 2 == 0:
    B[i] = A[i]
    count += 1
#0は後からいれた要素ではありえないので削除
C = [i for i in B if i != 0]
#3と5のどちらでも割り切れない場合はだめ
flag = 0
for i in range(count):
  if C[i] % 3 != 0 and C[i] % 5 != 0:
    flag += 1
if flag == 0:
  print('APPROVED')
else:
  print('DENIED')
N = int(input())
if N>0 or N<=100:
    A = []
    for i in range(0,N):
      B = int(input())
      if B>0 or B<=1000:
          A.append(B)
 
    sum1 = 1/A[0]
 
    for i in range(0,N-1):
      sum1 = sum1 + 1/A[i+1]
 
    result = int(1/sum1)
    print(result)

### FIXED CODE ###

try:
    N = int(input())
    if N>0 or N<=100:
        S = input()
        A = S.split()
        A = list(map(int, A)) 
 
        sum1 = 1/A[0]
 
        for i in range(0,N-1):
         sum1 = sum1 + 1/A[i+1]
 
        result = 1/sum1
        print(result)

except:
        print("Error")
n=int(input())

a=[]

for i in range(n):
    b=int(input())
    a.append(b)
    
a.sort()

ans=["" for i in range(n)]

ans[n//2]=a[-1]
a.remove(a[-1])
l=(n//2)-1
r=(n//2)+1

for i in range(n-1):
    if i%4==0:
        ans[l]=a[0]
        a.remove(a[0])
        l-=1
    elif i%4==1:
        ans[r]=a[0]
        a.remove(a[0])
        r+=1
    elif i%4==2:
        ans[l]=a[-1]
        a.remove(a[-1])
        l-=1
    elif i%4==3:
        ans[r]=a[-1]
        a.remove(a[-1])
        r-=1

ans.append(ans[0])     
num=0
num2=0
num3=0


for i in range(n):
    num+=abs(ans[i]-ans[i+1])

num-=min(abs(ans[0]-ans[1]),abs(ans[-1]-ans[-2]),abs(ans[-2]-ans[-3]))
        
print(num)




### FIXED CODE ###

n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
l.sort()
if n%2==0:
    ln=l[:n//2]
    lx=l[n//2:]
    print(2*(sum(lx)-sum(ln))-lx[0]+ln[-1])
else:
    ln=l[:n//2]
    lm=l[n//2]
    lx=l[n//2+1:]
    p=sum(lx)
    q=sum(ln)
    print(max(2*(p-q)+ln[-1]-lm,2*(p-q)-lx[0]+lm))
#標準入力
N = int(input())
S = []
S = [list(map(int, input().split())) for i in range(N)]

ans = 1
i = 0
j = 0
for _ in range(N):
  if i==N:
    break
  try:
    a =(S[i+1][1]-S[i][1])/(S[i+1][0]-S[i][0])
    b = S[i][1]-a*S[i][0]
    for _ in range(N):
      if j == N:
        i = N
        break
      if S[j][1]!=a*S[j][0]+b:
        ans+=1
        break
      else:
        S.remove(S[j])
        N -= 1
      j +=1  
  except:

    for _ in range(N):
      if j == N:
        i = N
        break
      if S[j][0]!=S[i][0]:
        ans+=1
        break
      else: 
        S.remove(S[j])
        N -= 1
      j+=1
    
print(ans)



### FIXED CODE ###

from collections import Counter
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
 
counter = Counter(((b1[0] - b2[0], b1[1] - b2[1])for b1 in xy for b2 in xy if b1 != b2))
print(N - (list(counter.most_common())+[(0,0)])[0][1])
s = input()

list = ["dream", "dreamer", "erase", "eraser"]

for i in list:
    s = s.replace(i, "x")

s.sort()

if s[0] == s[-1] and s[-1] == "x":
    print("YES")
else:
    print("NO") 

### FIXED CODE ###

s = input()
n = len(s)

list = ["dream", "dreamer", "erase", "eraser"]

s = s[::-1]

while True:
    if s.startswith(list[0][::-1]):
        n -= 5
        s = s[5:]
    elif s.startswith(list[1][::-1]):
        n -= 7
        s = s[7:]
    elif s.startswith(list[2][::-1]):
        n -= 5
        s = s[5:]
    elif s.startswith(list[3][::-1]):
        n -= 6
        s = s[6:]
    else:
        break

if s == "":
    print("YES")
else:
    print("NO")
a = input()
b = a.split()
N = int(b[0])
S = list(b[1])
K = int(b[2])
lit = S[K-1]
for i in range(N):
    if S[i] != lit:
        S[i] = "*"
        
print("".join(S)) 

### FIXED CODE ###

a = input()
b = list(map(int, a.split()))
if b[0] <= b[2] <= b[1]:
  print('Yes')
  
elif b[1] <= b[2] <= b[0]:
  print('Yes')
  
else:
  print('No')
import sys
n = int(input())
graph = [[] for _ in range(n)]
for _ in range(n-1):
    a, b, c = map(int, input().split())
    a-=1
    b-=1
    graph[a].append((b, c))
    graph[b].append((a, c))
q, k = map(int, input().split())
k -= 1
xy = []
for _ in range(q):
    x, y = map(int, input().split())
    x-=1
    y-=1
    xy.append((x, y))

def DFS(node, p_node, length):
    l[node] = length
    for i, j in graph[node]:
        if i==p_node:
            continue
        DFS(i, node, length+j)

l = [0]*n
DFS(k, -1, 0)
for x, y in xy:
    print(l[x]+l[y])


### FIXED CODE ###

import sys
n = int(input())
graph = [[] for _ in range(n)]
for _ in range(n-1):
    a, b, c = map(int, input().split())
    a-=1
    b-=1
    graph[a].append((b, c))
    graph[b].append((a, c))
q, k = map(int, input().split())
k -= 1
xy = []
for _ in range(q):
    x, y = map(int, input().split())
    x-=1
    y-=1
    xy.append((x, y))

def DFS(node, p_node, length):
    l[node] = length
    for i, j in graph[node]:
        if i==p_node:
            continue
        DFS(i, node, length+j)
sys.setrecursionlimit(2 * n)
l = [0]*n
DFS(k, -1, 0)
for x, y in xy:
    print(l[x]+l[y])
from collections import deafualtdict
n=int(input())
ar=list(map(int,input().split()))
d=defaultdict(int)
for i in ar:
  d[i]+=1
for i in range (1,n+1):
  if i in d.keys():
    print(d[i])
  else:
    print(0)


### FIXED CODE ###

from collections import defaultdict
n=int(input())
ar=list(map(int,input().split()))
d=defaultdict(int)
for i in ar:
  d[i]+=1
for i in range (1,n+1):
  if i in d.keys():
    print(d[i])
  else:
    print(0)
N = int(input())
B = list(map(int,input().split()))
ans = 0

for i in range(N):
    if i == 0:
        ans += B[0]
    elif i == N-1:
        ans += B[-1]
    else:
        ans += min(B[i-1],B[i])
print(ans)


### FIXED CODE ###

S = input()
if S == 'Sunny':
    print('Cloudy')
elif S == 'Cloudy':
    print('Rainy')
elif S == 'Rainy':
    print('Sunny')
N=int(input())
def fact(n):
  if n==0 or n==1:
    return 1
  else:
    return n*fack(n-1)
print(fack(3))

### FIXED CODE ###

N=int(input())
print(N*N*N)
from sys import stdin

s = stdin.readline().rstrip()
t = stdin.readline().rstrip()


if(s == t[:-1]):
    print('Yes')
else:
    pring('No')


### FIXED CODE ###

from sys import stdin

s = stdin.readline().rstrip()
t = stdin.readline().rstrip()


if(s == t[:-1]):
    print('Yes')
else:
    print('No')
A,B,C,D=map(int,input().split())

if (A+B)>(C+D):
  print('left')
elif (A+B)=(C+D):
  print('Balanced')
else:
  print('Right')

### FIXED CODE ###

A,B,C,D=map(int,input().split())
 
if (A+B)>(C+D):
  print('Left')
elif (A+B)==(C+D):
  print('Balanced')
else:
  print('Right')
N = int(input())
E = [[] for i in range(N+1)]
for i in range(N-1):
    a,b = map(int,input().split(' '))
    E[a].append((b,i))
    E[b].append((a,i))
K = max(len(e) for e in E)
print(K)
ans = [-1]*(N-1)
def dfs(v=1, p=0, p_col=-1):
    col = 1
    for u, idx in E[v]:
        if u != p:
            if col == p_col:
                col += 1
            ans[idx] = col
            dfs(u, v, col)
            col += 1
dfs()
for i in ans[1:]:
    print(i)

### FIXED CODE ###

import sys
sys.setrecursionlimit(500000)
N = int(input())
E = [[] for i in range(N + 1)]
for i in range(N - 1):
    a, b = map(int, input().split(' '))
    E[a].append((b, i))
    E[b].append((a, i))
K = max(len(e) for e in E)
print(K)
ans = [-1] * (N - 1)


def dfs(v=1, p=0, p_col=-1):
    col = 1
    for u, idx in E[v]:
        if u != p:
            if col == p_col:
                col += 1
            ans[idx] = col
            dfs(u, v, col)
            col += 1


dfs()
for i in ans:
    print(i)
from collections import deque

def main():
    N, M = map(int, input().split())
    link = [[] for _ in range(N+1)]
    value = [0 for _ in range(N+1)]

    for _ in range(M):
        l, r, d = map(int, input().split())
        link[l].append((r, d))
        link[r].append((l, -d))

    searched = set()
    q = deque()
    for u in range(N+1):
        if u in searched:
            continue
        q.append(u)
        searched.add(u)
        value[u] = 0

        # search
        while q:
            x = q.popleft()
            for y, d in link[x]:
                if y not in searched:
                    value[y] = value[x] + d
                    q.append(y)
                    searched.add(y)

    # verify
    for x in range(N+1):
        for y, d in link[x]:
            if value[y] != value[x] + d:
                print('No')
                return
    else:
        print('Yes')

if __name__ == '__main__':
    main()

### FIXED CODE ###

x = int(input())
a = int(input())
b = int(input())
print((x-a)%b)
ab=input().split()
a=int(ab[0])
b=int(ab[1][0]+ab[1][2]+ab[1][3])
 
s=a*b
print(string(s)[:-1])

### FIXED CODE ###

ab=input().split()
a=int(ab[0])
b=int(ab[1][0]+ab[1][2]+ab[1][3])
 
s=a*b
print(s//100)
n,q = map(int,input().split())
s = input()
lr = [list(map(int,input().split())) for i in range(q)]
anslist = []
for i in range(n):
  if s[i] == 'A' and s[i+1] == 'C':
    anslist.append([i,i+1])
for i in range(q):
  cnt = 0
  for j in range(len(anslist)):
    if lr[i][0]-1 <= anslist[j][0] and anslist[j][1] <= lr[i][1]-1:
      cnt += 1
  print(cnt) 



### FIXED CODE ###

n,q = map(int,input().split())
s = input()
lr = [list(map(int,input().split()))for i in range(q)]

a = [0]*n
p = 0
for i in range(1,n):
    if s[i-1] == 'A' and s[i] == 'C':
        p += 1
    a[i] = p
ans = []
for i in range(q):
    ans.append(a[lr[i][1]-1]-a[lr[i][0]-1])
for i in range(q):
    print(ans[i])
N = input()
s = list(input() for i range(N))
M = input()
t = list(input() for i range(M))

s_set = list(set(s))
ans = 0
for name in s_set:
    count = s.count(name) - t.count(name)
    ans = max(count, ans)
    
print(ans)


### FIXED CODE ###

N = int(input())
s = list(input() for i in range(N))
M = int(input())
t = list(input() for i in range(M))

s_set = list(set(s))
ans = 0
for name in s_set:
    count = s.count(name) - t.count(name)
    ans = max(count, ans)

print(ans)
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
l = list(set(s))
print(max(0,max(s.count(l[i]) - t.count(l[i]) for i in l)))

### FIXED CODE ###

n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

ans = 0

for i in set(s):
    a = sum(k == i for k in s) - sum(k == i for k in t)
    ans = max(a,ans)
print(ans)
N = int(input())
A = list(map(int, input().split()))
j = 0
A.sort()
for n in A:
	if n%2 == 1:
		j = 1
a = 0
for n in range(1, len(A)-1):
	if A[n] % A[0] == 1
		a = 1
if a == 0:
	j = 3
if A[0] == A[-1]:
	j = 2
if j == 0:
	print(2)
elif j == 1:
	print(1)
elif j == 3:
	print(A[0])
else:
	print(A[0])

### FIXED CODE ###

def gcd(a, b):
    if a%b ==0:
        return b
    else:
        return gcd(b, a%b)

n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(n-1):
    a[i+1]  = gcd(a[i], a[i+1])
print(a[n-1])