Harryxun/stf_run huggingface dataset:
import fractions
from functools import reduce

def main():
    n,m=map(int,input().split())
    a=list(map(int,input().split()))
    for i,aa in enumerate(a):
        j = 0

        while aa % 2 == 0:
            aa //= 2
            j+=1
        if i == 0:
            modtmp = j
        else:
            if modtemp != j:
                print(0)
                return

    for i,aa in enumerate(a):
        a[i] = aa//2
    tmp = lcm(*a)
    # print(tmp)
    cnt =0
    # print(a)

    up = m//tmp
    if up % 2 == 0:
        up = up//2
    else:
        up = up//2 + 1

    nowtmp = tmp
    cnt = 0
    ans = 0
    a.sort()
    # print(nowtmp)
    # print(up)
    before = 0
    before_aa = 0
    print(up)
    return
    for i, aa in enumerate(a):
        if before_aa == aa:
            continue
        if aa == 1:
            print(up)
            return
        if aa <= nowtmp and aa>before:
            cnt += 1

        elif aa> nowtmp :
            ans += cnt * up
            up -=1
            cnt = 0
            nowtmp += tmp
            before += tmp
    ans += cnt * up
    print(ans)

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
if __name__=='__main__':
    main()


### FIXED CODE ###

import fractions
from functools import reduce

def main():
    n,m=map(int,input().split())
    a=list(map(int,input().split()))
    
    for i,aa in enumerate(a):
        j = 0

        while aa % 2 == 0:
            aa //= 2
            j+=1
        if i == 0:
            modtmp = j
        else:
            if modtmp != j:
                print(0)
                return

    for i,aa in enumerate(a):
        a[i] = aa//2
    tmp = lcm(*a)
    # print(tmp)
    cnt =0
    # print(a)

    up = m//tmp
    if up % 2 == 0:
        up = up//2
    else:
        up = up//2 + 1

    nowtmp = tmp
    cnt = 0
    ans = 0
    a.sort()
    # print(nowtmp)
    # print(up)
    before = 0
    before_aa = 0
    print(up)
    return
    for i, aa in enumerate(a):
        if before_aa == aa:
            continue
        if aa == 1:
            print(up)
            return
        if aa <= nowtmp and aa>before:
            cnt += 1

        elif aa> nowtmp :
            ans += cnt * up
            up -=1
            cnt = 0
            nowtmp += tmp
            before += tmp
    ans += cnt * up
    print(ans)

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
if __name__=='__main__':
    main()
n,m = list(map(int, input().split()))
s = input()
t = input()
import math

# 良い文字列が作れるなら、答えはLCM(n, m)となる
lcm = n * m // math.gcd(n, m)

S = len(s)
T = len(t)
x = ['*'] * lcm
for i,c in enumerate(s):
    # (pos, char)
    x[lcm//S*i] = c

for i,c in enumerate(t):
    # (pos, char)
    pos, char = lcm//T*i, c
    if x[pos] != '*' and x[pos] != char:
        print(-1)
        exit()

print(lcm)

### FIXED CODE ###

n,m = list(map(int, input().split()))
s = input()
t = input()
import math

# 良い文字列が作れるなら、答えはLCM(n, m)となる
lcm = n * m // math.gcd(n, m)

x = {}
for i,c in enumerate(s):
    # (pos, char)
    x[lcm//n*i] = c

for i,c in enumerate(t):
    # (pos, char)
    pos, char = lcm//m*i, c
    if pos in x and x[pos] != char:
        print(-1)
        exit()

print(lcm)
from collections import deque


def solve():
    H, W = map(int, input().split())
    CH, CW = map(int, input().split())
    DH, DW = map(int, input().split())
    S = ["##"+input()+"##" for _ in range(H)]
    for i in range(2):
        S.insert(0, "#"*(W+4))
        S.append("#"*(W+4))

    inf = int(1e9)
    cost = [[inf for _ in range(W+4)] for _ in range(H+4)]
    cost0 = deque()
    ans = -1

    cost0.append((CH+1, CW+1, 0))
    cost[CH+1][CW+1] = 0

    move = [(1, 0), (0, 1), (-1, 0), (0, -1)]
    warp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)]+move]

    cost1 = deque()

    while cost0:
        h, w, c = cost0.popleft()
        cost1.append((h, w, c))

        for i, j in move:
            dh = h+i
            dw = w+j
            if S[dh][dw] == "." and c < cost[dh][dw]:
                cost[dh][dw] = c
                cost0.appendleft((dh, dw, cost[dh][dw]))

        if len(cost0) == 0:
            while cost1:
                h, w, c = cost1.popleft()
                for i, j in warp:
                    dh = h+i
                    dw = h+j
                    if S[dh][dw] == "." and c+1 < cost[dh][dw]:
                        cost[dh][dw] = c+1
                        cost0.append((dh, dw, cost[dh][dw]))

        if cost[DH+1][DW+1] != inf:
            ans = cost[DH+1][DW+1]

    print(ans)


if __name__ == "__main__":
    solve()


### FIXED CODE ###

from collections import deque


def solve():
    H, W = map(int, input().split())
    CH, CW = map(int, input().split())
    DH, DW = map(int, input().split())
    S = ["##"+input()+"##" for _ in range(H)]
    for i in range(2):
        S.insert(0, "#"*(W+4))
        S.append("#"*(W+4))

    inf = int(1e9)
    cost = [[inf for _ in range(W+4)] for _ in range(H+4)]
    cost0 = deque()
    ans = -1

    cost0.append((CH+1, CW+1, 0))
    cost[CH+1][CW+1] = 0

    move = [(1, 0), (0, 1), (-1, 0), (0, -1)]
    warp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)]+move]

    cost1 = deque()

    while cost0:
        h, w, c = cost0.popleft()
        cost1.append((h, w, c))

        for i, j in move:
            dh = h+i
            dw = w+j
            if S[dh][dw] == "." and c < cost[dh][dw]:
                cost[dh][dw] = c
                cost0.appendleft((dh, dw, cost[dh][dw]))

        if len(cost0) == 0:
            while cost1:
                h, w, c = cost1.popleft()
                for i, j in warp:
                    dh = h+i
                    dw = w+j
                    if S[dh][dw] == "." and c+1 < cost[dh][dw]:
                        cost[dh][dw] = c+1
                        cost0.append((dh, dw, cost[dh][dw]))

        if cost[DH+1][DW+1] != inf:
            ans = cost[DH+1][DW+1]

    print(ans)


if __name__ == "__main__":
    solve()
N,Q = map(int, input().split())
S = input()

t = [0]*Q
d = [0]*Q
for q in range(Q):
    t[q],d[q] = map(str, input().split())


s1 = 0
sN = N-1

for q in reversed(range(Q)):
    if t[q] == S[s1]:
        if d[q] == 'L':
            s1 += 1
    if t[q] == S[sN]:
        if d[q] == 'R':
            sN -= 1
    #print(s1,sN)


print(sN-s1+1)

### FIXED CODE ###

N,Q = map(int, input().split())
S = input()

t = [0]*Q
d = [0]*Q
for q in range(Q):
    t[q],d[q] = map(str, input().split())


s1 = 0
sN = N-1

for q in reversed(range(Q)):
    if t[q] == S[s1] and d[q] == 'L':
        s1 += 1
    elif s1 > 0:
        if d[q] == 'R' and S[s1-1] == t[q]:
            s1 -= 1
    if t[q] == S[sN] and d[q] == 'R':
        sN -= 1
    elif sN < N-1:
        if d[q] == 'L' and S[sN+1] == t[q]:
            sN += 1
    if s1 > sN:
        break
    #print(s1,sN)


print(sN-s1+1)
a,b=input()
n=int(a)
s=b
half=int(n/2)
print(s[:half]==s[half:])

### FIXED CODE ###

n = int(input())
s = input()
if n % 2:
    print("No")
    exit()
half = s[0:n // 2]
print("Yes" if s == half + half else "No")
n,m,c = map(int,input().split())
input_b = map(int,input().split())
a_list=[input() for i in range(n)]
for i in range(n):
  answer = c
  count = 0
  aitems = [map(int,a_list[i].split())]
  for j in range(m):
    answer += input_b[m] * aitems[m]
  if answer > 0
    count+=1
print count

### FIXED CODE ###

n,m,c = map(int,input().split())
input_b = list(map(int,input().split()))
a_list=[input() for i in range(n)]
count = 0
for i in range(n):
  answer = c
  aitems = list(map(int,a_list[i].split()))
  for j in range(m):
    answer += input_b[j] * aitems[j]
  if answer > 0:
    count+=1
print(count)
N = input()
a = [input() for i in range(N)]
l = map(int, a[1].split())
m = map(int, a[2].split())
if a[0] == 1:
  t = l[0] + l[1]
  print(p)
else:
  f = a[0]
  t = 0
  for i in range(len(f-1)):
    t = t + l[i]
  t = t + m[f-1] + m[f]
  print(t)

### FIXED CODE ###

import sys
a = []
for line in sys.stdin:
    a.append(int(line))
q = a[0] - a[1]
p = q % a[2]
print(p)
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = ans + (len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))

### FIXED CODE ###

import math
n = input()
a = list(map(int, input().split()))
ans = 0
for i in a:
    ans = ans + (len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))
S=input()
T=input()

differnce=0

for i in range(len(S)):
  if [S[i]!=T[i])
      difference +=1

print(difference)




### FIXED CODE ###

S=input()
T=input()
difference=0
for i in range(len(S)):
  if S[i]!=T[i]:
    difference+=1
print(difference)
import numpy as np
from sys import stdin
input = stdin.readline
N = int(input())
A = list(map(str, input().split()))
A = np.array(A)
number = np.zeros(N, dtype = int)
for i in range(N):
  number[i] = A.count('i + 1')
total = 0
for k in range(N):
  tmp = number[k]
  total += tmp * (tmp-1) // 2
for j in range(N):
  print(total - number[A[j]-1] + 1)


### FIXED CODE ###

import numpy as np
from sys import stdin
input = stdin.readline
N = int(input())
A = list(map(int, input().split()))
number = np.zeros(N, dtype = int)
total = 0

dic = {}
a = sorted(A)
now_key = a[0]
value = 1
dic[now_key] = 1
for i in range(1,N):
  if a[i] == now_key:
    value += 1
  else:
    dic[now_key] = value
    if value >= 2:
      total += value * (value-1) // 2
    now_key = a[i]
    value = 1
dic[now_key] = value
if value >= 2:
  total += value * (value-1)//2
for j in A:
  print(total - dic[j] + 1)
a = input()
if(int(a[5]) = 1):
    print("TBD")
elif(int(a[6]) > 4):
    print("TBD")
else:
    print("Heisei")

### FIXED CODE ###

a = input()
if(a[5] == "1"):
    print("TBD")
elif(int(a[6]) > 4):
    print("TBD")
else:
    print("Heisei")
w,h,x,y,r = map(input().split())
print(['No','Yes'][(r<=x<=w-r)*(r<=y<=h-r)])


### FIXED CODE ###

w,h,x,y,r = map(int,input().split())
print(['No','Yes'][r<=x<=w-r and r<=y<=h-r])
import sys;input=sys.stdin.readline

def main():
    n,q=map(int,input().split())
    event=[]
    stop=set()
    for i in range(n):
        s,t,x=map(int,input().split())
        event.append((s-x,x))
        event.append((t-x,-x))
    for i in range(q):
        event.append((int(input()),str(i)))
    
    event.sort(key=lambda x:x[0])
    ans=[-1]*q
    minstop=float("inf")
    for t,x in event:
        if type(x)==str:
            ans[int(x)]=str(minstop)
            continue
        elif x>=0:
            stop.add(x)
        elif x<0 and len(stop)>0:
            stop.remove(-x)
        if minstop!=x:
            minstop=min(stop or [-1])
    print("\n".join(ans))
    
if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys;input=sys.stdin.readline

n,q=map(int, input().split())
event=[]
for _ in range(n):
    s,t,x=map(int,input().split())
    event.append((s-x-0.5,1,x))
    event.append((t-x-0.5,-1,x))
for i in range(q):
    event.append((int(input()),0,i))
    
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*q
for t,e,x in event:
    if e > 0:
        stop.add(x)
        if x<minstop:
            minstop=x
            is_stop=True
    elif e<0:
        stop.remove(x)
        if minstop==x:
            is_stop=False
    elif len(stop)>0:
        if not is_stop:
             minstop=min(stop)
             is_stop=True
        ans[x]=minstop
        
print('\n'.join(map(str, ans)))
asum = 1

for x in range(2,100)
    asum += x

print(asum)


### FIXED CODE ###

N = int(input())

print(int(N*(N+1)/2))
# -*- coding:utf-8 -*-

def solve():
    a, b, h = list(map(int, input().split()))
    print(int((a+b)*h//2))

if __name__ == "__main__":
    solve()


### FIXED CODE ###

# -*- coding:utf-8 -*-

def solve():
    a = int(input())
    b = int(input())
    h = int(input())
    print(int((a+b)*h//2))

if __name__ == "__main__":
    solve()
for n in sys.stdin:
    ans = []
    n = int(n)
    nb = format(n,'b')
    nb.reverse
    nb += " "*(10-len(nb))
    for i in xrange(10):
    	if nb[i] == 1:
    		answer.append(str(2**i))
    print ' '.join(answer)

### FIXED CODE ###

import sys
nyu = sys.stdin.read()
nyu = map(int,nyu.split())
for n in nyu:
   	ans = []
	for b in [512,256,128,64,32,16,8,4,2,1]:
		if n >= b:
			n -= b
			ans.append(b)
	ans.reverse()
	ans = map(str,ans)
	ans = ' '.join(ans)
	print ans
a = int(input())
b = int(input())
if a == b:
   print("a==b")
if a > b:
   print("a > b")

print("a < b")

### FIXED CODE ###

a,b = map(int,input().split()) 
if a > b:
   print("a > b")
elif a < b:
   print("a < b")
else:
   print("a == b")
a, b = input().split()
print(min(int(a*int(b)), int(b*int(a))


### FIXED CODE ###

a, b = input().split()
print(max(int(a*int(b)), int(b*int(a))))
n,k = map(int,input().split())
ans = 0
for i in range(1,n+1):
    if i >= k:
        ans += 1/n
    else:
        if k//i == 0 :
            num = 1
        else:
            num = int((np.log2(k//i)+1)//1)
        ans += (1/n)*(1/2)**num
    
print(ans)

### FIXED CODE ###

import numpy as np
import math 
n,k = map(int,input().split())
ans = 0
for i in range(1,n+1):
    if i >= k:
        ans += 1/n
    else:
        num = math.ceil(np.log2(k/i))
        ans += (1/n)*(1/2)**num
    
print(ans)
from sys import stdin
from math import gcd


rs = lambda: stdin.readline().strip()
ri = lambda: int(rs())
rsl = lambda: stdin.readline().split()
rim = lambda: map(int, rsl())
ril = lambda: list(rim())


N = ri()
integers = list(rim())

lowest = [float('-inf'), float('-inf')]
for i in range(len(integers)-1):
    for j in range(i+1, len(integers)):
        temp = gcd(integers[i], integers[j])
        if temp > min(lowest):
            lowest[lowest.index(min(lowest))] = temp

print(max(lowest))

### FIXED CODE ###

from sys import stdin, exit
from fractions import gcd


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

# List if length of 2 or shorter
if len(A) <= 2:
    print(max(A))
    exit()

# Left Side = [A0, 0, 0, 0, 0]
left_side = [0 for _ in range(N)]
left_side[0] = A[0]

# Right Side = [0, 0, 0, 0, An]
right_side = [0 for _ in range(N)]
right_side[-1] = A[-1]

for i in range(N - 1):  # DP: L1 = gcd(L0, A1); Maximum GCD on very RIGHT of list  (Dir -->)
    left_side[i + 1] = gcd(left_side[i], A[i + 1])

for i in range(1, N):   # DP: Rn-2 = gcd(An-2, Rn-1); Maximum GCD on very LEFT of list  (Dir <--)
    right_side[-1 * (i+1)] = gcd(A[-1*(i+1)], right_side[-1*i])

max_gcd = 1

# Left
max_gcd = max(max_gcd, right_side[1])
# Max of Right and Left
max_gcd = max(max_gcd, left_side[-2])

for i in range(1, N - 1):
    left = left_side[i - 1]
    # We exclude the number at i here, and compare whether new gcd is greater than previous
    right = right_side[i + 1]

    max_gcd = max(max_gcd, gcd(left, right))

print(max_gcd)
A, B, N = list(input().split())
A = float(A)
B = float(B)
N = int(N)

tmp_pre = 0
for i in range(1, N+1):
  tmp = math.floor(A*i/B) - A*math.floor(i/B)
  if tmp > tmp_pre:
    tmp_pre = tmp
print(int(tmp_pre))

### FIXED CODE ###

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

if B==1:
  print(0)
else:
  tb = B - 1
  tp_pre = 0
  while(True):
    tp = (A*tb)//B - A*(tb//B)
    if tp > tp_pre:
      tp_pre = tp
    tb += B
    if tb > N:
      break
  if (B > N):
    print((A*N)//B - A*(N//B))
  else:
    print(int(tp_pre))
A = input()
s = 0
for i in range(0,3):
  if A[i]="1":
    s = s + 1
print(s)    

### FIXED CODE ###

A = input()
s = 0
for i in range(len(A)):
  if A[i]=="1":
    s = s + 1
print(s)
a = [int(i) for i in input().split()] 

return np.array([a[0]+a[1],a[0]^a[1],a[0]*a[1]]).max()



### FIXED CODE ###

import numpy as np
a = [int(i) for i in input().split()] 

print(np.array([a[0]+a[1],a[0]-a[1],a[0]*a[1]]).max())
import math
from sympy import primerange
inn = n = int(input())
num = int(math.sqrt(n)) + 1
primlist = list(primerange(2,num)) 
for i in primlist:
    if inn % i == 0:
        while inn % num != 0:
            num -= 1
        else:
            print(num+ inn//num -2)
            break        
else:
    print(inn-1)

### FIXED CODE ###

n = int(input())
ans = 0
t = int(n**(1/2)+1)


for i in range(t, 0, -1):
    if n%i == 0:
        ans += i
        ans += n//i
        break

print(ans-2)
n=int(input())
a=[int(j) for j in input().split()]

dp=np.array([[0]*n for i in range((n//2)+1)])

def f(l,m):
    if l==[]:
        return -10**100
    if m==1:
        return max(l)
    if -(-len(l)//2)<m:
        return -10**100
    return max(f(l[1:],m),l[0]+f(l[2:],m-1))

print(f(a,n//2))

### FIXED CODE ###

n=int(input())
a=[int(j) for j in input().split()]
p=[0]*n
d=[0]*n
for i in range(n):
    p[i]=a[i]+p[i-2]
    if (i&1):
        d[i]=max(p[i-1],a[i]+d[i-2])
    else:
        d[i]=max(d[i-1],a[i]+d[i-2])
print(d[-1])
def solve(string):
    n, *h = map(int, string.split())
    count = 1
    for i in range(1, n):
        if max(h[:i]) <= h[i]:
            count += 1
    return str(count)


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


### FIXED CODE ###

def solve(string):
    n, *h = map(int, string.split())
    count = 1
    for i in range(1, n):
        if max(h[:i]) <= h[i]:
            count += 1
    return str(count)


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))
import statistics

def resolve():
    n = input()
    x = list(map(int, input().split()))
    m = round(statistics.mean(x))
    sum = 0
    for val in x:
        sum += (val - m) ** 2
    print(sum)

if __name__ == '__main__':
        resolve()

### FIXED CODE ###

import numpy as np

def resolve():
    input()
    x = list(map(int, input().split()))
    m = int(round(np.mean(x)))
    sum = 0
    for val in x:
        sum += (val - m) ** 2
    print(sum)

if __name__ == '__main__':
    resolve()
n = int(input())
cake = [input() for i range(n)]
    
print(len(set(cake)))


### FIXED CODE ###

n = int(input())
cake = []
for i in range(n):
    cake.append(int(input()))
    
cake.sort()
kagami = [cake[0]]
num = cake[0]
for i in cake:
    if i > num:
        kagami.append(i)
        num = i
print(len(kagami))
n = int(input())
a=[]
for i in range(1,10):
  for j in range(1,10):
    a.append(i*j)
c=0
b = 0
for i in range(1,82):
  if a[i]==n:
    c=1
    print("Yes")
    break
  else:
    b = 1

if b==1 and c!=1:
  print("No")

### FIXED CODE ###

n = int(input())
a=[]
for i in range(1,10):
  for j in range(1,10):
    a.append(i*j)
c=0
b = 0
for i in range(81):
  if a[i]==n:
    c=1
    print("Yes")
    break
  else:
    b = 1

if b==1 and c!=1:
  print("No")
import collections
import fractions

n = int(input())
m = 0
mod = 10 ** 6 + 7
c = []
d = []
frac = {}
tmp = 0
for _ in range(n):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        tmp += 1
        m += 1
        continue
    try:
        if b == 0: frac[float('inf')] += 1
        else: frac[fractions.Fraction(a, b)] += 1
    except KeyError:
        if b == 0: frac[float('inf')] = 1
        else: frac[fractions.Fraction(a, b)] = 1
n -= tmp

for key, value in frac.items():
    if key > 0: continue
    try:
        if key == float('inf'):
            d.append(frac[fractions.Fraction(0)])
        else:
            d.append(frac[-1 / key])
        c.append(value)
    except KeyError:
        continue

ans = pow(2, n - sum(c) - sum(d), mod)
for i, j in zip(c, d):
    tmp = (pow(2, i, mod) + pow(2, j, mod) - 1)
    ans = (ans * (pow(2, i, mod) + pow(2, j, mod) - 1)) % mod
ans -= 1 + m

print(ans)

### FIXED CODE ###

import collections
import math

n = int(input())
m = 0
mod = 10 ** 9 + 7
c = []
d = []
frac = []

for _ in range(n):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        n -= 1
        m += 1
        continue
    if a == 0:
        frac.append('0/1')
    elif b == 0:
        frac.append(('1/0'))
    else:
        gcd = abs(math.gcd(a, b))
        sign = 1 if a * b > 0 else -1
        a = sign * abs(a) // gcd
        b = abs(b) // gcd
        frac.append('{}/{}'.format(a, b))

frac = collections.Counter(frac)

def inverse(key):
    if key == '0/1':
        return '1/0'
    elif key == '1/0':
        return '0/1'
    elif key[0] != '-':
        a, b = key.split('/')
        return '-{}/{}'.format(b, a)
    else:
        a, b = key[1:].split('/')
        return '{}/{}'.format(b, a)

for key, value in frac.items():
    if key[0] == '-' or key[0] == '0': continue
    if frac[inverse(key)] > 0:
        c.append(value)
        d.append(frac[inverse(key)])

ans = pow(2, n - sum(c) - sum(d), mod)
for i, j in zip(c, d):
    tmp = (pow(2, i, mod) + pow(2, j, mod) - 1) % mod
    ans = ans * tmp % mod
ans = (ans - 1 + m) % mod

print(ans)
S1 = input()
S2 = '2' + S1[0]
res = 0

if len(S1) == 1:
    print(0)

else:
    for s in S1:
        if S2[-1] == s:
            S2 += s
        else:
            S2 = S2[:-1:]
            res += 2

    print(res)


### FIXED CODE ###

S1 = input()
S2 = ''
res = 0

for s in S1:
    if len(S2) == 0 or S2[-1] == s:
        S2 += s
    else:
        S2 = S2[:-1:]
        res += 2

print(res)
N,M=map(int,input().split())
box=[[] for i in range(M)]
for i in range(M):
    a,b=map(int,input().split())
    box[a-1].append(b-1)
    box[b-1].append(a-1)
ans=[0]*(N)
que=[]
ans[0]=1
for i in range(N):
    if ans[i]!=0:
        que+=box[i]
    while len(que)>0:
        c=que.pop()
        if ans[c]==0:
            ans[c]=i+1
for i in range(1,N):
    if ans[i]==0:
        flag=0
        break
    else:
        flag=1
if flag==0:
    print("No")
else:
    print("Yes")
    for i in range(1,N):
        print(ans[i])


### FIXED CODE ###

N,M=map(int,input().split())
box=[[] for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    box[a-1].append(b-1)
    box[b-1].append(a-1)
ans=[None]*(N)
ans[0]=0
que=[0]
while len(que)>0:
    index=que.pop(0)
    for x in box[index]:
        if ans[x]==None:
            ans[x]=index+1
            que.append(x)
print("Yes")
for i in range(1,N):
    print(ans[i])
import sys
input=lambda: sys.stdin.readline().rstrip()
from collections import defaultdict
n=int(input())
D=defaultdict(int)
i=1
while i*(i+1)//2<=10**5:
  D[i*(i+1)//2]=i
  i+=1
if D[n]==0:
  print("No")
else:
  print("Yes")
  k=D[n]+1
  print(k)
  A=[[0]*(k) for _ in range(k)]
  for i in range(k):
    A[i][0]=k-1
  D=dict()
  D[1]=1*k+1
  for i in range(2,n+1):
    d1,d2=D[i-1]//k,D[i-1]%k
    if d2==k-d1:
      D[i]=(d1+1)*k+1
    else:
      D[i]=d1*k+d2+1
  for i in range(1,n+1):
    d1,d2=D[i]//k,D[i]%k
    A[d1-1][d1+d2-1]=i
    A[d1+d2-1][d1]=i
  for a in A:
    print(*A)


### FIXED CODE ###

n=int(input())
nn=int((n*2)**0.5)
if n*2!=nn*(nn+1):
  print("No")
else:
  print("Yes")
  print(nn+1)
  Ans=[[0]*nn for _ in range(nn+1)]
  for i in range(nn):
    for j in range(nn-i):
      Ans[i][i+j]+=nn*i-i*(i-1)//2+j+1
      Ans[i+j+1][i]+=nn*i-i*(i-1)//2+j+1
  for a in Ans:
    print(nn,*a)
a,b,c,k =map(int,input().split())

if k<=1:
    if abs(a-b)>=10**18:
        print("Unfair")
    else:
        print(a-b)
elif k==1:
    if abs(a-b)>=10**18:
        print("Unfair")
    else:
        print(b-a)
else:
    m = int(2(2**(k-1)-(-1)**(k-1))/3)
    n = int((2**k-(-1)**k)/3)
    ans = (a-b)*(m-n)
    if abs(ans)>=10**18:
        print("Unfair")
    else:
        print(ans)        


### FIXED CODE ###


if __name__ == "__main__":
    a,b,c,k = map(int,input().split())
    if k%2 == 0:
        if abs(a-b)>10**18:
            print("Unfair")
        else:
            print(a-b)
    else:
        if abs(a-b)>10**18:
            print("Unfair")
        else:
            print(b-a)