Harryxun/stf_run huggingface dataset:
from itertools import product
n,k = map(int,input().split())
L = []
for i in range(n):
    a,b = map(int,input().split())
    L.append([0,a,b])
for i in range(n):
    L[i][0] = 100*(i+1)
#print(L)
li = [0,1]
re = []

def cer(v):
    for i in range(n-1,0,-1):
        if v[i] == 0:
            return i
            
for v in product(li,repeat = n):
    score = 0
    scorenomi = 0
    num = 0
    for i in range(n):
        score += (L[i][0]*L[i][1] + L[i][2])*v[i]
        scorenomi +=L[i][0]*L[i][1]*v[i]
        num +=L[i][1]*v[i]
    if score < k:
        j = 1
        score2 = 0
        while j <= L[cer(v)][1]:
            score2 = L[cer(v)][0]*j
            if score + score2 >=k:
                break
            j +=1
        #print(num,i,j,num + j,score,score2,score + score2,v)
    if score+ score2 >=k:
        print(num +j)
        exit()
    re.append([score,scorenomi,num,v])
re.sort()
for i in range(len(re)):
    if re[i][0] >=k:
        print(re[i][2])
        exit()

### FIXED CODE ###

n,k = map(int,input().split())
L = []
for i in range(n):
    a,b = map(int,input().split())
    L.append([(i+1)*100,a,b])
#print(L)
ans = 10**10
if k < L[-1][0]*L[-1][1]:
    if k%L[-1][0] != 0:
        ans = (k//L[-1][0]+1)
    else:
        ans = (k//L[-1][0])

for i in range(1<<n):
    li = []
    score,score_zan,cnt = 0,0,0
    for j in range(n):
        if i>>j&1:
            score +=(L[j][0]*L[j][1] + L[j][2])
            cnt +=L[j][1]
            score_zan = k-score
        else:
            li.append(L[j])
    if score > 0 and score_zan <= 0:
        ans = min(ans,cnt)
    li.sort(reverse = True)
    #print(score,li,cnt,score_zan)
    if li and score_zan > 0:
        if score_zan < li[0][0]*li[0][1]:
            ans = min(ans,cnt + score_zan//li[0][0])
print(ans)
n, w = map(int, input().split())
s = [list(map(int, input().split())) for i in range(n)]
ws = [x[0] for x in s]
v = [x[1] for x in s]

dp = [[0]*(w+1) for _ in range(n+1)]

for sum_w in range(w+1):
    for i in range(1, n+1):
        if ws[i-1] <= sum_w:
            dp[i][sum_w] = max(dp[i-1][sum_w], dp[i-1][sum_w-ws[i-1]]+v[i-1])
        else:
            dp[i][sum_w] = dp[i-1][sum_w]

print(dp[-1][-1])


### FIXED CODE ###

from pprint import pprint
n, w = map(int, input().split())
s = [list(map(int, input().split())) for i in range(n)]
ws = [x[0] for x in s]
vs = [x[1] for x in s]
max_v = sum(vs)
INF = float("inf")
dp = [[INF]*(max_v+1) for _ in range(n+1)]
dp[0][0] = 0
for i in range(1, n+1):
    for sum_v in range(max_v+1):
        if vs[i-1] <= sum_v:
            dp[i][sum_v] = min(dp[i-1][sum_v], dp[i-1][sum_v-vs[i-1]]+ws[i-1])
        else:
            dp[i][sum_v] = dp[i-1][sum_v]
ans = 0
for sum_v in range(max_v+1):
    if dp[n][sum_v] <= w:
        ans = sum_v
print(ans)
n = int(input())
dishes = list(map(int, input().split()))
points = list(map(int, input().split()))
bonuses = list(map(int, input().split()))

score = 
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i == prev + 1: score += bonuses[i-1]
  prev = i


### FIXED CODE ###

n = int(input())
dishes = list(map(int, input().split()))
points = list(map(int, input().split()))
bonuses = list(map(int, input().split()))

score = 0
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i == prev + 1: score += bonuses[i-2]
  prev = i

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

    # 全探索するとN!なのでN=2000のときO(N^2000)となるので無理
    # DPで解く
    # dp[i][l] = 係数が大きい順にi個左右の端どちらにつめるか決めて、左をl回(右はn-l回)選んだときの指標最大値

    # 降順にAをソート+元のインデックスも保存しておく
    sortedA = sorted(A[[a,i] for i,a in enumerate(A)], reverse=True)
    # DP
    dp = [[0]*(N+1) for _ in range(N+1)]
    for i in range(N):
        for l in range(i+1):
            r = i-l
            dp[i+1][l] = max(dp[i+1][l], dp[i][l]+sortedA[i][0]*abs((N-r-1)-sortedA[i][1]))
            dp[i+1][l+1] = max(dp[i+1][l+1], dp[i][l]+sortedA[i][0]*abs(l-sortedA[i][1]))
    print(max(dp[N]))

main()


### FIXED CODE ###

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

    # 全探索するとN!なのでN=2000のときO(N^2000)となるので無理
    # DPで解く
    # dp[i][l] = 係数が大きい順にi個左右の端どちらにつめるか決めて、左をl回(右はn-l回)選んだときの指標最大値

    # 降順にAをソート+元のインデックスも保存しておく
    Awithidx = [[a,i] for i,a in enumerate(A)]
    sortedA = sorted(Awithidx, reverse=True)
    # DP
    dp = [[0]*(N+1) for _ in range(N+1)]
    for i in range(N):
        a = sortedA[i][0]
        idx = sortedA[i][1]
        for l in range(i+1):
            r = i-l
            dp[i+1][l] = max(dp[i+1][l], dp[i][l]+a*abs((N-r-1)-idx))
            dp[i+1][l+1] = max(dp[i+1][l+1], dp[i][l]+a*abs(l-idx))
    print(max(dp[N]))

main()
x=input()
if x=='7' or x=='5' or x=='3': print('YES') else print('NO')

### FIXED CODE ###

x=input()
if x=='7' or x=='5' or x=='3':
    print("YES")
else:
    print("NO")
if (A == 5 and B == 5 and C == 7) or (A == 5, B == 7, C == 5) or (A==7, B==5, C==5):
	return(YES)
else: return(NO)

### FIXED CODE ###

S = list(map(int, input().split()))
S.sort()
if S == [5,5,7]:
  print("YES")
else:
  print("NO")
N = int(input())
A = input()
A = A.split()
A = [int(c) for c in A]
A.sort()
B = set(A)
C= N-len(B)
count = 0
for i in range(N):
    for j in range(i + C):
        if A[i] % A[j] == 0 and i != j:
            count += 1
            break
print(N-count)

### FIXED CODE ###

N = int(input())
A_list = list(map(int, input().split()))
A_list.sort()
A_max = A_list[-1]
count = 0
cnt_list = [1] * ((10 ** 6) + 1)
for i in range(len(A_list)-1):
    if cnt_list[A_list[i]] == 1:
        for j in range((A_max // A_list[i]) + 1):
            cnt_list[A_list[i] * j] = 0
        if A_list[i] != A_list[i+1]:
            count += 1
if cnt_list[A_list[-1]] == 1:
    count += 1
print(count)
import sympy

N=int(input())
count=0
for i in range(1,N+1):
    n=N//i
    count=n*(i+i*n)//(2)+count
print(count)


### FIXED CODE ###



N=int(input())
count=0
for i in range(1,N+1):
    n=N//i
    count=n*(i+i*n)//(2)+count
print(count)
I,O,R,J,L,S,Z=map(int,input().split())
ans=O
m=min(I,J,L):
I-=m
J-=m
L-=m
ans+=m*3
ans+=I//2*2
ans+=J//2*2
ans+=L//2*2
print(ans)

### FIXED CODE ###

I,O,R,J,L,S,Z=map(int,input().split())
a=(I//2+J//2+L//2)*2
b=0
if I*J*L!=0:b=(2*((I-1)//2+(J-1)//2+(L-1)//2)+3)
print(max(a,b)+O)
a,b,c= map(int, input().split())
print(a+' '+b+' '+c)

### FIXED CODE ###

X,Y,Z=list(map(int, input().split()))
print(str(Z)+' '+str(X)+' '+str(Y))
n=int(input())
k=int(input())

now=1
for i in range(n):
  if now*2 >=k
  	now+=k
  else:
    now*=2
print(now)


### FIXED CODE ###

n=int(input())
k=int(input())

now=1
for i in range(n):
  if now*2 >=now+k:
  	now+=k
  else:
    now*=2
print(now)
n = int(input())
nums = list(map(int,input().split()))

l = [0]*200001

for num in nums:
    l[num] += 1

if max(nums) == 1:
    print('YES')

else:
    print('NO')

### FIXED CODE ###

n = int(input())
nums = list(map(int,input().split()))
c = 0
nums = sorted(nums)

for i in range(n-1):
    if nums[i] == nums[i+1]:
        c += 1
        break
    
if c != 0:
    print('NO')

else:
    print('YES')
L,R=map(int,input().split())
ans=100100100
for i in range(min(R-L,2000),min(R,2001):
  for j in range(i+1,min(R,2002)):
    if ans>((i*j)%2019):
      ans=((i*j)%2019)
print(ans)

### FIXED CODE ###

L,R=map(int,input().split())
ans=2018
if R-L>=673:
    print(0)
    exit()
for i in range(R-L):
    for j in range(i+1,R-L+1):
        if ans>((L+i)*(L+j))%2019:
            ans=((L+i)*(L+j))%2019
print(ans)
S = input()

if S.replace("dream"," ").replace("dreamer"," ").replace("erase"," ").replace("eraser"," "):
  print("NO")
else:
  print("YES


### FIXED CODE ###

S = input()

if S.replace("eraser","").replace("erase","").replace("dreamer","").replace("dream",""):
  print("NO")
else:
  print("YES")
'''C - Welcome to AtCoder
高橋君は AtCoder のコンテストに参加しています。

このコンテストでは、 N 問の問題が出題されます。
高橋君はコンテスト中に M回の提出を行いました。

i 回目の提出は pi番目の問題への提出であり、結果は Si (AC または WA) でした。
高橋君の正答数は、AC を 1回以上出した問題の数です。
高橋君のペナルティ数は、高橋君が AC を 1 回以上出した各問題において、初めて AC を出すまでに出した WA の数の総和です。
高橋君の正答数とペナルティ数を答えてください。

入力
入力は以下の形式で標準入力から与えられる。

N M
p1 S1
:
pM SM

2 5
1 WA
1 AC
2 WA
2 AC
2 WA
>
2 2

100000 3
7777 AC
7777 AC
7777 AC
>
1 0

6 0
>
0 0
'''
import numpy as np

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

AC = np.array([0]*N) # 正解を入れる箱
WA = np.array([0]*N) # 不正解を入れる箱

for _ in range(M):
    p, S = input().split()
    
    if AC[int(p)-1] ==0 and S == "WA": # まだ「正解が出てない & 不正解」
        WA[int(p)-1] += 1              # なら不正解の箱に＋１
    else:
        AC[int(p)-1] = 1               # それ以外は正解の箱に１
    
print(sum(AC), sum(WA*AC)) # ただし不正解の箱は最後まで正解が出なかった問題はペナルティ無しにする必要があるので、正解の箱の中身と掛け合わせて消しておく。



### FIXED CODE ###

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

smallest_so_far = float("inf")
cnt = 0

for the_num in P:
    if the_num < smallest_so_far :
        smallest_so_far = the_num
        cnt += 1
print(cnt)
X, Y = map(int, input().split())

# 最終状態は(0,1), (1,1)のいずれか
# 最終状態の1手前は勝ち確状態、その1手前は負け確状態
# 1手前に戻すには片方の山からi個石を取り、もう片方の山に2i個加える
# 1手前に戻しつつ山の状態を列挙して、与えられた状態を探索する
# ただし、石の個数の合計が与えられた石の個数の合計を超えたら探索を打ち切る

# 山の状態を探索し、与えられた状態と一致したらフラグを保存する
def recur_search(x,y,Alice_win_flg):
    if [x,y] == [X,Y] or [x,y] == [Y,X]:
        Alice_win_flg_list.append(Alice_win_flg)
        return
    elif x+y > X+Y or x < 0 or y < 0:
        return
    else:
        for i in range(1, x+1):
            recur_search(x-i, y+2*i, 1^Alice_win_flg)
            recur_search(y+2*i, x-i, 1^Alice_win_flg)

Alice_win_flg_list = []
recur_search(1,0,0)
recur_search(1,1,0)

# 1つでもAlice勝ちパターンがあるなら先手のAliceの勝ち
print("Alice" if sum(Alice_win_flg_list) > 0 else "Brown")

### FIXED CODE ###

X, Y = map(int, input().split())
print("Alice" if abs(X-Y)>=2 else "Brown")
n,m=map(int,input().split())
st=[]
for i in range(n):
  s_d=list(input())
  st.append(s_d)
cp=[]
for i in range(m):
  c_d=list(input())
  cp.append(c_d)
sc=[]
for i in range(n):
  scd=[]
  for j in range(m):
    scd_d=abs(st[i][0]-cp[j][0])+abs(st[i][1]-cp[j][1])
    scd.append(scd_d)
  sc.append(min(scd))
  
for i in range(n):
  print(sc[i])

### FIXED CODE ###

n,m=map(int,input().split())
st=[]
for i in range(n):
  s_d=list(map(int,input().split()))
  st.append(s_d)
cp=[]
for i in range(m):
  c_d=list(map(int,input().split()))
  cp.append(c_d)
sc=[]
for i in range(n):
  scd=[]
  for j in range(m):
    scd_d=abs(st[i][0]-cp[j][0])+abs(st[i][1]-cp[j][1])
    scd.append(scd_d)
  sc.append(scd.index(min(scd))+1)
  
for i in range(n):
  print(sc[i])
import networkx as nx
n, m = 4,4
AB = [[1,2],[2,3],[3,4],[4,2]]
G = nx.Graph()
G.add_nodes_from(range(1, n+1))
G.add_edges_from(zip(AB[::2], AB[1::2]))
print('Yes')
d = dict(nx.bfs_predecessors(G, 1))
for i in range(2, n+1):
    print(d[i])

### FIXED CODE ###

import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from collections import Counter,defaultdict,deque
# from itertools import permutations, combinations
# from heapq import heappop, heappush
# from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n,m = inpm()
way = [[] for _ in range(n+1)]
for i in range(m):
    a,b = inpm()
    way[a].append(b)
    way[b].append(a)

ans = [0 for i in range(n+1)]
q = queue.Queue()
q.put((1,0))
while not q.empty():
    room,sign = q.get()
    if ans[room] != 0:
        continue
    ans[room] = sign

    for i in way[room]:
        q.put((i,room))

print('Yes')
for i in range(2,n+1):
    print(ans[i])
import itertools


    
    vec = [A1,A2,A3]
    com = list(itertools.permutations(vec))
    
    
    all_cos = [0,0,0,0,0,0]
    for i in range(6):
        tmp_com = com[i]
        
        tmp_A1 = tmp_com[0]
        tmp_A2 = tmp_com[1]
        tmp_A3 = tmp_com[2]
        
        cos1 = 0
        cos2 = abs(tmp_A1 - tmp_A2)
        cos3 = abs(tmp_A2 - tmp_A3)
        
        all_cos[i] = cos1 + cos2 + cos3
    
    res = min(all_cos)
    print(res)



### FIXED CODE ###

import itertools

A1,A2,A3 = map(int,input().split())
    
vec = [A1,A2,A3]
com = list(itertools.permutations(vec))
    
all_cos = [0,0,0,0,0,0]
for i in range(6):
    tmp_com = com[i]
        
    tmp_A1 = tmp_com[0]
    tmp_A2 = tmp_com[1]
    tmp_A3 = tmp_com[2]
        
    cos1 = 0
    cos2 = abs(tmp_A1 - tmp_A2)
    cos3 = abs(tmp_A2 - tmp_A3)
        
    all_cos[i] = cos1 + cos2 + cos3
    
res = min(all_cos)
print(res)
n = int(input())
d = list(map(int,input().split()))
db = [0] * n
MOD = 998244353

#距離iの頂点の数をdb[i]に保存
for i in range(n):
    db[d[i]] += 1

#末尾に連続する0を削除
if (db[n-1] == 0):
    l = n-1
    for i in range(1,n):
        tmp = db[n-i]
        if (tmp == 0) : l = n-i 
        else : break
    
    del db[l:n]


if (d[0] != 0)|(db[0] != 1):
    print(0)
    exit()
if (len(db) <= 2):
    print(len(db)-1)
    exit()

db.append(1)
ans = 1

for i in range(len(db)-1):
    tmp = (db[i]**db[i+1]) % MOD
    ans *= tmp

print(ans)

### FIXED CODE ###

n = int(input())
if (n % 2 == 0):print(n//2-1)
else : print(n//2)
A = [int(i) for i in input().split()]

ans = 0
ans += B[0]
if min(B[1:]) == 0:
	for b in B[1:]:
		if b%2 == 0:
			ans += 2
elif not sum([i%2 for i in B[1:]])%3:
	ans += sum(B[1:])
else:
	ans += sum(B[1:])-1
print(ans)


### FIXED CODE ###

A = [int(i) for i in input().split()]
B = [A[1],A[0],A[3],A[4]]
ans = 0
ans += B[0]
if min(B[1:]) == 0:
	for b in B[1:]:
		ans += b//2*2
elif not sum([i%2 for i in B[1:]])%3:
	ans += sum(B[1:])
else:
	ans += sum(B[1:])-1
print(ans)
#C
N, K = map(int, input().split())
A = list(map(int, input().split()))
p=[]
import numpy as np
for i in range(N-K+1):
    if i==0:
        ans=np.prod(A[i:i+K])
    else:
        ans=ans*A[i+K-1]/A[i-1]
    p.append(int(ans))
for j in range(len(p)-1):
    if p[j]<p[j+1]:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

#C
N, K = map(int, input().split())
A = list(map(int, input().split()))
p=[]
for i in range(N-K):
    if A[i+K]>A[i]:
        p.append(1)
    else:
        p.append(0)

for j in range(len(p)):
    if p[j]==1:
        print('Yes')
    else:
        print('No')
a, b = map(int, input().split())


def get_height(n):
    return n * (n + 1) // 2


h = get_height(b - a)

print(i - b)




### FIXED CODE ###

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


def get_height(n):
    return n * (n + 1) // 2


h = get_height(b - a)

print(h - b)
import sys
H_W = list(map(int,input().split()))
H = H_W[0]
W = H_W[1]
b = [[0 for i in range(W)] for j in range(H)]
a = [[str(c) for c in l.strip()] for l in sys.stdin]

# .を0に, #を1にした新しい配列bを作る
for i in range(H):
    for j in range(W):
        if a[i][j] == '#':
            b[i][j] = 1

# 列と行ごとにすべて0のものを探す
w = [0] * W
h = [0] * H
for i in range(H):
    for j in range(W):
        h[i] = h[i] + b[i][j]
        w[j] = w[j] + b[i][j]

# 全ての要素が0の列と行を削除する
for i in range(H):
    if h[i] == 0:
        del a[i]
        H = H -1
    if w[i] == 0:
        for j in range(H):
            del a[j][i]
        W = W - 1
# 答え
for i in range(H):
    flag = 0
    for j in range(W):
        if flag == 0:
            ans = a[i][j]
            flag = 1
        else:
            ans = ans + a[i][j]
    print(ans)
    

### FIXED CODE ###

import sys
H_W = list(map(int,input().split()))
H = H_W[0]
W = H_W[1]
b = [[0 for i in range(W)] for j in range(H)]
a = [[str(c) for c in l.strip()] for l in sys.stdin]

# .を0に, #を1にした新しい配列bを作る
for i in range(H):
    for j in range(W):
        if a[i][j] == '#':
            b[i][j] = 1

# 列と行ごとにすべて0のものを探す
w = [0] * W
h = [0] * H
for i in range(H):
    for j in range(W):
        h[i] = h[i] + b[i][j]
        w[j] = w[j] + b[i][j]

#print(h)
#print(w)
# 全ての要素が0の列と行を削除する
i = 0
c = 0
j = 0
for i in range(H):
    if h[i] == 0:
        del a[j]
        H = H - 1
        j = j - 1
    j = j + 1
#print(a)

k = 0
for i in range(W):
    if w[i] == 0:
        for j in range(H):
            del a[j][k]
        W = W - 1
        k = k - 1
    k = k + 1
#print(a)
# 答え
for i in range(H):
    flag = 0
    for j in range(W):
        if flag == 0:
            ans = a[i][j]
            flag = 1
        else:
            ans = ans + a[i][j]
    print(ans)
import copy
# from math import gcd


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

def lcm(a, b):
    return (a // gcd(a, b)) * b
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        # # mがlcmの半分よりも小さかったら0
        # if (a_lcm / 2) > m:
        #     print(0)
        #     exit()
    for a in A:
        if a_lcm / 2 % a == 0:
            print(0)
            exit()
    # mがlcmの半分よりも小さかったら0
    if (a_lcm / 2) > m:
        print(0)
        exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy
# from math import gcd


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

def lcm(a, b):
    return (a // gcd(a, b)) * b
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        # mがlcmの半分よりも小さかったら0
        if (a_lcm / 2) > m:
            print(0)
            exit()
    for a in A:
        if (a_lcm / 2) % a == 0:
            print(0)
            exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()
print((int(input())-1)*(int(input())-1))

### FIXED CODE ###

m,n = map(int,input().split())
print((m-1)*(n-1))
n, w = map(int, input().split())

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

prev = [None for _ in range(n)]
dist = [float('inf') for _ in range(n)]


def dfs(start):
    for n_r in edge[start]:
        if dist[n_r] > dist[start] + 1:
            dist[n_r] = dist[start] + 1
            prev[n_r] = start
        else:
            continue
        dfs(n_r)


dist[0] = 0
dfs(0)
if None in prev[1:]:
    print('No')
else:
    print('Yes')
    for i in prev[1:]:
        print(i + 1)


### FIXED CODE ###

import heapq


def dijkstra_heap(s):
    d = [float("inf")] * n
    prev = [float("inf")] * n
    d[s] = 0
    edgelist = [[d[s], s]]
    heapq.heapify(edgelist)

    while edgelist:
        dis, v = heapq.heappop(edgelist)
        if d[v] < dis:
            continue

        for e in edge[v]:
            if d[e] > dis + 1:
                d[e] = dis + 1
                heapq.heappush(edgelist, [dis + 1, e])
                prev[e] = v
    return d, prev


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

edge = [[] for i in range(n)]
for i in range(w):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    edge[x].append(y)
    edge[y].append(x)
d, prev = dijkstra_heap(0)

if float('inf') in prev[1:]:
    print('No')
else:
    print('Yes')
    for i in prev[1:]:
        print(i + 1)
#! /usr/bin/python
from math import gcd
from functools import reduce
#N, X = 3, 3
#CITY = [1, 7, 11]
#
#N, X = 3, 81
#CITY = [33, 105, 57]

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

nanka = [abs(X - c) for c in CITY]
print(reduce(lambda x, y: gcd(x, y), nanka))


### FIXED CODE ###

#! /usr/bin/python
#from math import gcd
from fractions import gcd
from functools import reduce
#N, X = 3, 3
#CITY = [1, 7, 11]
#
#N, X = 3, 81
#CITY = [33, 105, 57]

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

nanka = [abs(X - c) for c in CITY]
print(reduce(lambda x, y: gcd(x, y), nanka))
import math
n = int(input())
if n % 2 == 1:
  print(0)
  quit()

l = int(math.log10(n))+1
cnt = 0
for i in range(1,10*l):
  cnt += (n // 5 ** i) // 2
print(cnt)


### FIXED CODE ###

import math
n = int(input())
if n % 2 == 1:
  print(0)
  quit()
if n == 0:
  print(0)
  quit()

l = int(math.log10(n))+1
cnt = 0
for i in range(1,10*l):
  cnt += (n // 5 ** i) // 2
print(cnt)
n = int(input())
p = list(map(float, input().split()))

def dfs(cur, n, p, cnt, res, memo):
  if cur == n:
    if cnt > 0:
      return res
    return 0
  if (cur, cnt, res) in memo:
    return memo[(cur, cnt, res)]
  r = dfs(cur+1, n, p, cnt+1, res*p[cur], memo) + dfs(cur+1, n, p, cnt-1, res*(1-p[cur]), memo)
  memo[(cur, cnt, res)] = r
  return memo[(cur, cnt, res)]

print(dfs(0, n, p, 0, 1, {}))

### FIXED CODE ###

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

dp = [[0 for _ in range(n+1)] for _ in range(n+1)]

dp[0][0] = 1

for i in range(1, n+1):
  dp[i][0] = dp[i-1][0] * (1-p[i-1])
  
for i in range(1, n+1):
  for j in range(1, i+1):
    dp[i][j] = dp[i-1][j] * (1-p[i-1]) + dp[i-1][j-1] * p[i-1]
    
print(sum(dp[-1][(n+1)//2:]))
import math

N = int(input())
A = list(map(int, input().split(' ')))

lcm = 1
for a in A:
    lcm *= (a // math.gcd(lcm, a)) % (10**9 + 7)

for i in range(len(A)):
    A[i] = int(lcm / A[i])

print(sum(A) % (10**9 + 7))



### FIXED CODE ###

import fractions

N = int(input())
A = list(map(int, input().split(' ')))

lcm = 1
for a in A:
    lcm *= (a // fractions.gcd(lcm, a)) % (10**9 + 7)

for i in range(len(A)):
    A[i] = lcm // A[i]

print(sum(A) % (10**9 + 7))
#coding:utf-8

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

h=[]
for i in range(N):
    h_i = int(input())
    h.append(h_i)

h = sorted(h)

min_val = 100000000000
for i in range(N-K+1):
    min_val = min(abs(h[i+K-1] - h[i]), min_val)
print(min_val)    


### FIXED CODE ###

#coding:utf-8

D = str(input())

if D == '22':
    print('Christmas Eve Eve Eve')
elif D == '23':
    print('Christmas Eve Eve')
elif D == '24':
    print('Christmas Eve')
elif D == '25':
    print('Christmas')
r=int(input())
p=3.14159265358979
print("{0:.5f} {1:.5f}".format(p*r**2,2*p*r))

### FIXED CODE ###

r=float(input())
p=3.14159265358979
print("{0:.5f} {1:.5f}".format(p*r**2,2*p*r))
2 3 10

### FIXED CODE ###

a, b, c = map(int, input().split())
aa = (a+b-c)**2
bb = 4*a*b
if a + b <= c:
    if aa > bb:
        print("Yes")
    else:
        print("No")
else:
    print("No")
def main():
  N = int(input())
  li = list(map(int, input().split()))

  num_of_operation = 0
  
  while True:
    for num in li:
      if num % 2 == 1:
        break
    
    for i in range(N):
      li[i] //= 2
    num_of_operation += 1
  
  print(num_of_operation)

if __name__ == '__main__':
  main()


### FIXED CODE ###

s = input()

ans = 0
for i in s:
  ans += int(i)
print(ans)
import sys
sys.setrecursionlimit(10 ** 5)
n,q = map(int,input().split())
tree = [[] for _ in range(n)]
point = [0] * n

for _ in range(n-1):
    a,b = map(int,input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)
    
for _ in range(q):
    a,b = map(int,input().split())
    a -= 1
    point[a] += b
    
def dfs(now, prev = -1):
    for next in tree[now]:
        if next == prev:
            continue
        point[next] += point[now]
        
        dfs(next, now)
        
dfs(0)
print(*point)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
import sys
def input():
    return sys.stdin.readline()[:-1]

n,q = map(int,input().split())
tree = [[] for _ in range(n)]
point = [0] * n

for _ in range(n-1):
    a,b = map(int,input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)
    
for _ in range(q):
    a,b = map(int,input().split())
    a -= 1
    point[a] += b
    
def dfs(now, prev = -1):
    for next in tree[now]:
        if next == prev:
            continue
        point[next] += point[now]
        
        dfs(next, now)
        
dfs(0)
print(*point)