Harryxun/stf_run huggingface dataset:
N,X = int(input())
m = []
for i in range(N):
    m.append(int(input()))
summation = sum(m)
min_d = min(m)
print(N+int((X - suumation)/min_d))


### FIXED CODE ###

N,X = [int(i) for i in input().split()]
m = []
for i in range(N):
    m.append(int(input()))
summation = sum(m)
min_d = min(m)
print(N+int((X - summation)/min_d))
N = int(input())
mod = 998244353
# DP ナップサックぽいやつ
# DP[i][j] := a_0からa_iまでの部分集合で和がjになるものの個数
# 配るDPの方が場合分けがなくて簡潔に書ける 計算量増えるかも
# DP[i-1][j]→DP[i][j]とDP[i][j + a_i ]に配る

aaa = [int(input()) for _ in range(N)]
sum_aaa = sum(aaa)

sum_now = 0
DP = [[0] * (sum_aaa+1) for i in range(N)]
DP2 = [[0] * (sum_aaa+1) for i in range(N)]

a = aaa[0]
DP[0][0] = 2
DP[0][a] = 1

DP2[0][0] = 1
DP2[0][a] = 1

sum_now += a

for i in range(1, N):
	a = aaa[i]
	sum_now += a
	for j in range(sum_now + 1):

		if (j >= a):
			DP[i][j] = DP[i-1][j]*2 + DP[i-1][j-a]
		else:
			DP[i][j] = DP[i-1][j]*2

		while (DP[i][j] > mod):
			DP[i][j] -= mod

	for j in range(min(sum_now + 1, int(sum_aaa /2)+1)):
		if (j >= a):
			DP2[i][j] = DP2[i-1][j] + DP2[i-1][j-a]
		else:
			DP2[i][j] = DP2[i-1][j]

		while (DP2[i][j] > mod):
			DP2[i][j] -= mod

# print(DP2)
minimum_invalid_length = int((sum_now+1)//2)
num_too_long = sum (DP[N-1][minimum_invalid_length:])
if (sum_aaa %2 == 0):
	num_too_long -= DP2[N-1][int(sum_aaa /2)]
# print(num_too_long)
# print(sum(aaa))
print((3** N - num_too_long * 3) % mod )


### FIXED CODE ###

N = int(input())
S = input()

# 白→黒　が許容される状態

ans = N + 1

# 所与→全黒
ans = S.count(".")
prev = ans

for i in range(N):
	if S[i] == "#":
		now = prev + 1
	else:
		now = prev - 1


	if now < ans:
		ans = now
	prev = now

print(ans)
import math
r = int(input())
circle_squre = r * r * math.pi
circle_length = (r*2) * math.pi

print('{:.5f}'.format(circle_squre),'{:.5f}'.format(circle_length))

### FIXED CODE ###

from math import pi
r = float(input())
circle_squre = r * r * pi
circle_length = (r*2) * pi

print('{}'.format(circle_squre),'{}'.format(circle_length))
#   D


N, M = map(int, input().split())

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

Bs_and_Cs_lst = []

for _ in range(M):
    B, C = map(int, input().split())

    Bs_and_Cs_lst.append((C, B))


As_lst.sort()
Bs_and_Cs_lst.sort(reverse=True)


p = 0
finish = False
for C, B in Bs_and_Cs_lst:
    for i in range(B):
        if As_lst[p+i] < C:
            As_lst[p+i] = C
        else:
            finish = True
            break
    if finish:
        break
    p += B


print(sum(As_lst))

### FIXED CODE ###


N, M = map(int, input().split())

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

Bs_and_Cs_lst = []

for _ in range(M):
    B, C = map(int, input().split())

    Bs_and_Cs_lst.append((C, B))


As_lst.sort()
Bs_and_Cs_lst.sort(reverse=True)


p = 0
finish = False
for C, B in Bs_and_Cs_lst:
    for i in range(B):
        if p + i >= N:
            finish = True
            break

        if As_lst[p+i] < C:
            As_lst[p+i] = C
        else:
            finish = True
            break
    if finish:
        break
    p += B


max_count = 0
for i in range(N):
    max_count += As_lst[i]

print(max_count)
d, n = map(i, input().split())
 
if d==0:
	print(n)
elif d==1:
	print(n*100)
elif d==2:
	print(n*10000)

### FIXED CODE ###

d, n = map(int, input().split())
 
if d==0:
	if n<100:
		print(n)
	else:
		print(101)    
elif d==1:
	if n<100:
		print(n*100)
	else:
		print(10100)
elif d==2:
	if n<100:
		print(n*10000)
	else:
		print(n*10000+10000)
n=int(input())
for i in range(n+1):
	if int(i*1.08)==n:
  		print(i)
    	exit()
print(':(')

### FIXED CODE ###

n=int(input())
for i in range(n+1):
    if int(i*1.08)==n:
        print(i)
        exit()
print(':(')
import sys
sys.setrecursionlimit(25000)
n, m = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(m):
    x, y = map(lambda x: int(x)-1, input().split())
    G[x].append(y)

# iを始点としたときの有効パスの最大長さ
dp = [-1] * n
 
def rec(s):
    if dp[s] != -1:
        return dp[s]

    ret = 0
    for ns in G[s]:
        ret = max(ret, rec(ns)+1)
    dp[s] = ret
    return ret

ml = 0    
for i in range(n):
    ml = max(ml, rec(i))
print(ml)

### FIXED CODE ###

import sys
sys.setrecursionlimit(500000)
n, m = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(m):
    x, y = map(lambda x: int(x)-1, input().split())
    G[x].append(y)

# iを始点としたときの有効パスの最大長さ
dp = [-1] * n
 
def rec(s):
    if dp[s] != -1:
        return dp[s]

    ret = 0
    for ns in G[s]:
        ret = max(ret, rec(ns)+1)
    dp[s] = ret
    return ret

ml = 0    
for i in range(n):
    ml = max(ml, rec(i))
print(ml)
a,b,c = map(int,input().split())
k = int(input())

cnt = 0
while a>b:
  b *= 2
  cnt += 1
  
while b>c:
  c * = 2
  cnt += 1
  
if cnt <= k:
  print("Yes")
else:
  print("No")
  

### FIXED CODE ###

A,B,C = map(int,input().split())
K = int(input())

ans = 0
while 1:
    if A < B:
        break
    else:
        B *= 2
        ans += 1

while 1:
    if B < C:
        break
    else:
         C *= 2
         ans += 1

if ans <= K:
    print("Yes")
else:
    print("No")
import math

INF = float("inf")

V, E = map(int, input().split())
es = []

for _ in range(E):
    a, b, c = map(int, input().split())
    es.append([a-1, b-1, -c])

d = [INF] * V
d[1] = 0

updated = False
for _ in range(V - 1):
    for e in es:
        if math.isinf(d[e[0]]):
            continue
        if d[e[1]] > d[e[0]] + e[2]:
            d[e[1]] = d[e[0]] + e[2]
    if not updated:
        break

negative = [False] * V

for _ in range(V):
    for e in es:
        if math.isinf(d[e[0]]):
            continue
        if d[e[1]] > d[e[0]] + e[2]:
            negative[e[1]] = True
            d[e[1]] = d[e[0]] + e[2]
        elif negative[e[1]]:
            d[e[1]] = True
print(-d[V] if not negative[V] else "inf")


### FIXED CODE ###

import math

INF = float("inf")

V, E = map(int, input().split())
es = []

for _ in range(E):
    a, b, c = map(int, input().split())
    es.append([a-1, b-1, -c])

d = [INF] * V
d[0] = 0
cnt = [0] * V

for _ in range(V):
    updated = False
    for e in es:
        if math.isinf(d[e[0]]):
            continue
        if d[e[1]] > d[e[0]] + e[2]:
            d[e[1]] = d[e[0]] + e[2]
            cnt[e[1]] += 1
            updated = True
    if not updated:
        break

print(-d[V-1] if cnt[V-1] < V else "inf")
N,K,M=map(int,input().split())
An=list(map(int,input().split()))
rest=M*N-sum(An)
if rest<=K:
        print(max(rest,0))
else:
        print(-1)

### FIXED CODE ###

print(chr(ord(input())+1))
time = map(int, input().split())
h=0
h = int(time/(60*60))
m=int(time/60-h*60)
s=int(time-h*60*60-m*60)
print(str(h)+":"+str(m)+":"+str(s))


### FIXED CODE ###

time =int(input())
h = int(time/(60*60))
m=int(time/60-h*60)
s=int(time-h*60*60-m*60)
print(str(h)+":"+str(m)+":"+str(s))
n = int(input())
a_list = list(map(int, input().split()))
alice = 0
bob = 0
tmp_value = 0
tmp_index = 0

while len(a_list) > 0:
    for i in range(len(a_list)):
        if tmp_value < a_list[i]:
            tmp_value = a_list[i]
            tmp_index = i
    alice += tmp_value
    del a_list[tmp_index]
    tmp_value, tmp_index = 0, 0
    if len(a_list) == 0:
        break
    for k in range(len(a_list)):                                                                                  
        if tmp_value < a_list[k]:
            tmp_value = a_list[k]
            tmp_index = k
    bob += tmp_value
    del a_list[tmp_index]

print(str(alice - bob))


### FIXED CODE ###

n = int(input())
a_list = list(map(int, input().split()))
alice = 0
bob = 0


for i in range(len(a_list)):
    if i % 2:
        bob += sorted(a_list, reverse=True)[i]
    else:
        alice += sorted(a_list, reverse=True)[i]

print(str(alice - bob))
length = input()
input_str = input()

if len(input_str) > length:
    print(input_str + '...')
else:
    print(input_str)

### FIXED CODE ###

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

if len(s) > k:
    print(s[0:k] + '...')
else:
    print(s)
a=input()
print(a+a**2+a**3)

### FIXED CODE ###

a=int(input())
print(a+a ** 2+a ** 3)
import sys
import bisect
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
dp = [float('inf')] * (N + 1)
ans = [0] * N

def dfs(s,edge):
    global ans, dp
    index = bisect.bisect_left(dp[s], A[s])
    old = dp[index]
    length = bisect.bisect_left(dp[s], float('inf'))
    ans[index] = length
    for i in edge[s]:
        if i == s:
            continue
        dfs(i,edge)
    dp[index] = old

def main():
    N = int(input())
    A = list(map(int, input().split()))
    edge = [[] for _ in range(N)]
    for _ in range(N-1):
        u, v = map(int, input().split())
        u -= 1
        v -= 1
        edge[u].append(v)
        edge[v].append(u)

    dfs(0,edge)
    for i in range(N):
        print(ans[i])


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
import bisect
from collections import deque
sys.setrecursionlimit(4100000)
input = sys.stdin.readline

def main():
    N = int(input())
    A = list(map(int, input().split()))
    edge = [[] for _ in range(N)]
    for i in range(N-1):
        u, v = map(int, input().split())
        u -= 1
        v -= 1
        edge[u].append(v)
        edge[v].append(u)

    ans = [0] * (N + 1)
    LIS = [-1]
    
    def dfs(v, p = N):
        if A[v] > LIS[-1]:
            LIS.append(A[v])
            ans[v] = ans[p] + 1
            for u in edge[v]:
                if u == p:
                    continue
                dfs(u,v)
            LIS.pop()
        else:
            ans[v] = ans[p]
            idx = bisect.bisect_left(LIS, A[v])
            old = LIS[idx]
            LIS[idx] = A[v]
            for u in edge[v]:
                if u == p:
                    continue
                dfs(u,v)
            LIS[idx] = old
    dfs(0)
    for i in range(N):
        print(ans[i])

if __name__ == "__main__":
    main()
mport sys
N,M=map(int, input().split())
a=[]
b=[]
c=[]
for m in range (0,M):
  A,B,C=map(int, input().split() )
  a+=[A]
  b+=[B]
  c+=[C]
V=[0]+[-10**12]*(N-1)# iに到達するときの最大得点
 
for n in range(N-1):
  for m in range(M):
    u=a[m]
    v=b[m]
    if V[b[m]-1]<V[a[m]-1]+c[m]:#共に有限の時はやる
      V[b[m]-1]=V[a[m]-1]+c[m]
 
moji2=[0]*N
for n in range(N):
  for m in range(M):
    u=a[m]
    v=b[m]
    if V[b[m]-1]<V[a[m]-1]+c[m]:#共に有限の時はやる
        V[b[m]-1]=V[a[m]-1]+c[m]
        moji2[b[m]-1]=1
      if moji2[N-1]:
        print("inf")
        sys.exit()
else:
  print(V[N-1])

### FIXED CODE ###

import sys
N,M=map(int, input().split())
a=[]
b=[]
c=[]
for m in range (0,M):
  A,B,C=map(int, input().split() )
  a+=[A]
  b+=[B]
  c+=[C]
V=[0]+[-10**12]*(N-1)# iに到達するときの最大得点
 
for n in range(N-1):
  for m in range(M):
    u=a[m]
    v=b[m]
    if V[b[m]-1]<V[a[m]-1]+c[m]:#共に有限の時はやる
      V[b[m]-1]=V[a[m]-1]+c[m]
 
moji2=[0]*N
for n in range(N):
  for m in range(M):
    u=a[m]
    v=b[m]
    if V[b[m]-1]<V[a[m]-1]+c[m]:#共に有限の時はやる
      V[b[m]-1]=V[a[m]-1]+c[m]
      moji2[b[m]-1]=1
      if moji2[N-1]:
        print("inf")
        sys.exit()
print(V[N-1])
N = input()
a = int(N[1])
b = int(N[2])
c = int(N[3])
d == a+b+c

print(d)



### FIXED CODE ###

N = input()
a = int(N[0])+int(N[1])+int(N[2])

print(a)
N = int(input())
 
import numpy as np
 
G = np.array([list(map(int,input().split())) for i in range(N)])
 
import scipy.sparse.csgraph as csg
 
G2 = csg.floyd_warshall(G,directed=False)
 
if np.any(G != G2):
  print(-1)
else:
  G = G2
  T = csg.minimum_spanning_tree(G)
  total = np.sum(T)
  T = csg.floyd_warshall(T,directed=False,overwrite=True)
 
  import heapq as hq
 
  remaining = []
  delta = T!=G
 
  indices = set()
  for i,j in zip(*np.nonzero(delta)):
    indices.add(i)
    if i > j:
      remaining.append((G[i,j],i,j))
  
  hq.heapify(remaining)
  while remaining:
    d,i,j = hq.heappop(remaining)
    delta[i,j] = True
    delta[j,i] = True
    if d != T[i,j]:
      T[i,j] = d
      T[j,i] = d
      total += d
      T2 = csg.dijkstra(T,directed=False,indices=list(indices))
      for i,j in enumerate(indices):
        T[j] = T2[i]
    
    if np.all(delta[i]):
      indices.discard(i)
    if np.all(delta[j]):
      indices.discard(j)
 
  print(int(total))

### FIXED CODE ###


N = int(input())

import numpy as np

G = np.array([list(map(int,input().split())) for i in range(N)], dtype=np.uint32)

import scipy.sparse.csgraph as csg

G2 = csg.floyd_warshall(G,directed=False)

if np.any(G != G2):
  print(-1)
else:
  G[G==0] = 2*10**9
  t = 0
  for i in range(N):
    for j in range(i+1,N):
      n = np.min(G[i]+G[j])
      if n > G[i,j]:
        t += G[i,j]


  print(t)
a = input()
ans = 0
i = 1
for i in range(0,a,1):
    if i%3 == 0:
        i += 1
        continue
    elif i%5 == 0:
        i += 1
        continue
    ans += a
    
print(ans)


### FIXED CODE ###

a = int(input())
ans = 0
i = 1
while i <= a:
    if i%15 == 0:
        i += 1
        continue
    elif i%3 == 0:
        i += 1
        continue
    elif i%5 == 0:
        i += 1
        continue
    ans += i
    i += 1
    
print(ans)
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
if e-a>k:
    print(":(")
else:
    print("Yay!")

### FIXED CODE ###

a=int(input())
b=input()
c=input()
d=input()
e=int(input())
k=int(input())
if e-a>k:
    print(":(")
else:
    print("Yay!")
N = int(input())
A = list(map(int,input().split())
a = 0
b = 0
while True:
    if len(A) >= 2:
        a = a + max(A)
        A.remove(max(A))
        b = b + max(A)
        A.remove(max(A))
    elif len(A) == 1:
        a = a + A[0]
    else:
        break
print(a-b)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
a = 0
b = 0
A.sort(reverse=True)
for i in range(N):
    if i%2 == 0:
        a = a + A[i]
    if i%2 == 1:
        b = b + A[i]
print(a-b)
def(a, b)
  c = a * b
  if(c / 2 == 0)
  	print("Even")
  else
    print("Odd")
  

### FIXED CODE ###

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

c = a * b
if(c % 2 == 0):
  print("Even")
else:
  print("Odd")
s = input()
n = len(s)
m = 2019
a = 0
r = [0 for _ in range(m+1)]
r[0] = 1
for i in range(0,n):
    z = (int(s[n-i-1])*pow(10,i,m) + z)%m
    a += r[z]
    r[z] += 1
print(a)


### FIXED CODE ###

s = input()
n = len(s)
m = 2019

a = 0
r = [0 for _ in range(m+1)]
r[0] = 1
z = 0
j = 1
for i in range(0,n):
    j = j * 10 % m
    ss = int(s[n-i-1])*j + z
    z = ss%m



    a += r[z]
    r[z] += 1

print(a)
from collections import deque

h, w = map(int, input().split())
field = []
for i in range(h):
    field.append(list(input()))

out = 0
for i in range(h):
    for j in range(w):
        if field[i][j] == '.':
            seen = [[0 for m in range(w)] for n in range(h)]
            seen[i][j] = 1
            q = deque([])
            q.append((i, j, 0))

            while q:
                y, x, cnt = q.popleft()
                # print(y, x, cnt)
                for ny, nx in (y, x + 1), (y, x - 1), (y + 1, x), (y - 1, x):
                    if 0 <= ny < h and 0 <= nx < w:
                        if field[ny][nx] == '.' and not seen[ny][nx]:
                            q.append((ny, nx, cnt + 1))
                            seen[y][x] = 1
        out = max(out, cnt)
print(out)


### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())
field = []

for i in range(h):
    field.append(list(input()))

out = 0
for i in range(h):
    for j in range(w):
        if field[i][j] == '.':
            seen = [[0 for m in range(w)] for n in range(h)]
            seen[i][j] = 1
            q = deque([])
            q.append((i, j, 0))
            while q:
                (y, x, cnt) = q.popleft()
                # print(y,x)
                # print(seen)
                for ny, nx in (y, x + 1), (y, x - 1), (y + 1, x), (y - 1, x):
                    if ny < 0 or ny >= h or nx < 0 or nx >= w:
                        pass
                    elif field[ny][nx] == '.' and seen[ny][nx] == 0:
                        q.append((ny, nx, cnt + 1))
                        seen[ny][nx] = 1

            out = max(out, cnt)
print(out)
r,D,x = [int(i) for i in input().split()]
n=2000
X=r*x-D
x=X
while n <=2010: 
  print(x) 
  X=r*x-D
  x=X
  n=n+1
        

### FIXED CODE ###

A,B =map(int,input().split())
if A>=13: print(B)
elif A>=6: print(int(B/2))
else : print (0)
t = sum(map(int, input())
if t % 2 == 0:
    print(t//2)
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

t = sum(map(int, input().split()))
if t % 2 == 0:
        print(t//2)
else:
        print("IMPOSSIBLE")
r = list(map(int,input().split()))
s = "".join(r)
if s%4==0:
	print("Yes")
else:
	print("No")

### FIXED CODE ###

r = list(map(str,input().split()))
s = "".join(r)
if int(s)%4==0:
	print("YES")
else:
	print("NO")
oukei=0 
count=1

N,X =map(int, input().split())
L= list(map(int, input().split()))
    

for i in range(N):
    goukei +=L[i]
    
    if(goukei>X):
        break
    else:
        count +=1
        
print(count)

### FIXED CODE ###

goukei=0 
count=1

N,X =map(int, input().split())
L= list(map(int, input().split()))
    

for i in range(N):
    goukei +=L[i]
    
    if(goukei>X):
        break
    else:
        count +=1
        
print(count)
A,B,K = int(input()).split()
 
if A >= K:
  A = A-K
else:
  if B >= (K-A):
    A = 0
    B = B - (K-A)
  else:
    A = 0
    B = 0
    
print(A,B)

### FIXED CODE ###

A,B,K = map(int, input().split())
 
if A >= K:
  A = A-K
else:
  if B >= (K-A):
    B = B - (K-A)
    A = 0
  else:
    A = 0
    B = 0
    
print(A,B)
s = input()
weather = ['Sunny','Cludy','Rainy']
print(weather[(weather.index(s) + 1) % 3])

### FIXED CODE ###

s = input()
weather = ['Sunny','Cloudy','Rainy']
print(weather[(weather.index(s) + 1) % 3])
x = int(input(),16)-int(input(),16)
if x > 0:
  print(">")
elif x < 0:
  print("<")
else:
  print("=")

### FIXED CODE ###

x, y = input().split()
d = int(x,16)-int(y,16)
if d > 0:
  print(">")
elif d < 0:
  print("<")
else:
  print("=")
d = 0

while d == 0:
    i = raw_input()
    x, y = i.split()
    x = int(x)
    y = int(y)
    
    if x == 0 and y == 0:
        d = 2
    else:
        if x > y:
            tmp = y
            y = x
            x = tmp
        print("%d %d" %(x,y))
        

### FIXED CODE ###

i = 1

while i == 1:
    r = raw_input()
    x, y = r.split()
    x = int(x)
    y = int(y)
    
    if x == 0 and y == 0:
        i = 0
    elif x > y:
        print ("%d %d" %(y, x))
    else:
        print ("%d %d" %(x, y))
n, a, b = map(int, input().split())
    fst = (n - 1) * b + a
    sec = (n - 1) * a + b
    if a > b:
      print(0)
    elif n == 1 and a != b:
      print(0)
    else:
      print(fst - sec + 1)

### FIXED CODE ###

n, a, b = map(int, input().split())
fst = (n - 1) * b + a
sec = (n - 1) * a + b
if a > b:
  print(0)
elif n == 1 and a != b:
  print(0)
else:
  print(fst - sec + 1)
N = int(input())
li = []
a = []
b = []
for i in range(N):
  li.append(int(input()))
li.sort(reverse = True)
for i in li[0::2]:
  a.append(i)
for i in li [1::2]:
  b.append(i)
print(sum(a) - sum(b))

### FIXED CODE ###

N = int(input())
li = list(map(int,input().split()))
a = []
b = []

li.sort(reverse = True)
for i in li[0::2]:
  a.append(i)
for i in li [1::2]:
  b.append(i)
print(sum(a) - sum(b))
S = int(input())
if S == "ABC":
  print("ARC")
else:
  print("ABC")



### FIXED CODE ###

S = input()
if S == "ABC":
  print("ARC")
else:
  print("ABC")
s=input()
if s%2==0:
    print(s//2)
else:
    print(s//2+1)

### FIXED CODE ###

n=int(input())
if n%2==0:
    print(n//2)
else:
    print(n//2+1)
# -*- coding: utf-8 -*-
def solve():
    N, K = map(int, input().split())
    N_1 = [set() for _ in range(N+1)]
    for _ in range(N-1):
        a, b = map(int, input().split())
        N_1[a].add(b)
        N_1[b].add(a)
        
    checked = set()
    q = {1}
    res = 1
    while q:
        n = q.pop()
        q |= N_1[n] - checked
        fixed = len(set.union(*(N_1[m] for m in N_1[n]), N_1[n]-{n}) & checked)
        res *= K - fixed
        checked.add(n)
        if res < 0:
            return str(0)
        else:
            res %= 10**9+7
    return str(res)


if __name__ == '__main__':
    print(solve())


### FIXED CODE ###

# -*- coding: utf-8 -*-
def solve():
    N, K = map(int, input().split())
    N_1 = [{1},{0}]+[set() for _ in range(N-1)]
    for _ in range(N-1):
        a, b = map(int, input().split())
        N_1[a].add(b)
        N_1[b].add(a)
    checked, q = set(), {0}
    res = 1
    while q:
        n = q.pop()
        checked.add(n)
        q.update(set.difference(N_1[n], checked))
        K_ = K-min(2,n)
        for i in range(len(N_1[n])-(n>0)):
            if K_ == i:
                return str(0)
            res = (res*(K_-i))%(10**9+7)
    return str(res)
if __name__ == '__main__':
    print(solve())
n = input()
w = []
Flag = Trure 
for i in range(n):
  w.append(input())
for i in range(n-1):
  if w[i][-1] != w[i+1][0]:
    Flag = False
if len(w) = len(set(w)):
  Flag = False
print("Yes" if Flag else "No")

### FIXED CODE ###

n = int(input())
w = []
Flag = True 
for i in range(n):
  w.append(input())
for i in range(n-1):
  if w[i][-1] != w[i+1][0]:
    Flag = False
if len(w) != len(set(w)):
  Flag = False
print("Yes" if Flag else "No")
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import functools

input = sys.stdin.readline
n, x = map(int, input().split())
a = input().split()
b = list(map(int, a))
b.append(x)
b.sort()
c = []
if len(b) == 2:
    print(b[1] - b[0])
    exit(0)
for i in range(1, n - 1):
    c.append(b[i] - b[i - 1])


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

ans = c[0]
for i in range(len(c)):
    ans = gcd(c[i], ans)
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys

input = sys.stdin.readline
n, x = map(int, input().split())
a = input().split()
b = list(map(int, a))
b.append(x)
b.sort()
if len(b) == 2:
    print(b[1] - b[0])
    exit(0)
c = [abs(a - x) for a in b]


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


ans = c[0]
for i in range(len(c)):
    ans = gcd(c[i], ans)
print(ans)
n, l = map(int, input().split())
S = list()
result = ''
while l > 0:
    S.append(input())
    l -= 1

for i in sorted(S):
    result += i 

print(result)

### FIXED CODE ###

n, l = map(int, input().split())
S = list()
result = ''
while n > 0:
    S.append(input())
    n -= 1

for i in sorted(S):
    result += i 

print(result)
import math

r= float(input().rstrip().split(' ')

a = r * 2math.PI

b = r * math.PI

print(a, b)

### FIXED CODE ###

import math

r= float(input())

a = r * r * math.pi

b = 2 * math.pi * r

print(a, b)
S = input()
is_hitachi = True
if len(S) >= 2:
    for i in range(0, len(S), 2):
        if not (S[i] == 'h' and S[i + 1] == 'i'):
            is_hitachi = False
    print('YNeos'[not is_hitachi::2])
else:
    print('No')
    

### FIXED CODE ###

S = input()
is_hitachi = True
if len(S) %2 == 0:
    for i in range(0, len(S), 2):
        if not (S[i] == 'h' and S[i + 1] == 'i'):
            is_hitachi = False
    print('YNeos'[not is_hitachi::2])
else:
    print('No')
n = int(input())
s = input()
s = s + "0"
s2 = input()
MOD = 10**9 + 7

al = []
for i in range(n):
    if s[i] != s[i+1]:
        al.append(a0)
        a0 = 1
    else:
        a0 += 1

if al[0] == 1:
    ans = 3
else:
    ans = 6

for i in range(len(al)-1):
    if al[i] == 1:
        ans = ans * 2 % MOD
    else:
        if al[i+1] == 2:
            ans = ans * 3 % MOD
            
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
s = s + "0"
s2 = input()
MOD = 10**9 + 7

al = []
a0 = 1
for i in range(n):
    if s[i] != s[i+1]:
        al.append(a0)
        a0 = 1
    else:
        a0 += 1

if al[0] == 1:
    ans = 3
else:
    ans = 6

for i in range(len(al)-1):
    if al[i] == 1:
        ans = ans * 2 % MOD
    else:
        if al[i+1] == 2:
            ans = ans * 3 % MOD
            
print(ans)
N = input()
if N % 9 == 0:
  print('yes')
else:
  print('no')

### FIXED CODE ###

N=int(input())
if N%9 == 0:
    print("Yes")
else:
    print("No")