Harryxun/stf_run huggingface dataset:
N = int(input())
A = list(map(int, input().split()))

sum_even = sum(map(lambda i: A[i] if A[i] > 0 else 0, range(1, N, 2)))
sum_odd  = sum(map(lambda i: A[i] if A[i] > 0 else 0, range(0, N, 2)))

if sum_even == 0 and sum_odd == 0:
    max_ = max(A)
    print(max_)
    index = A.index(max_)
    print(len(A)-1)
    for _ in range(index):
        print(1)
    for j in range(N-index-1):
        print(N - index - j)
    exit()

print(max(sum_even, sum_odd))
EVEN = sum_even >= sum_odd
ans = []

if EVEN:
    A = A[1:]
    ans.append(1)
if len(A)%2 == 0:
    ans.append(len(A))
    A = A[:-1]

while len(A) > 1:
    if A[0] <= 0:
        ans.append(1)
        ans.append(1)
        A = A[2:]
    else:
        if A[2] <= 0:
            ans.append(3)
            A.pop(2)
            if len(A) == 2:
                ans.append(2)
                A.pop(1)
            else:
                ans.append(3)
                A.pop(2)
        else:
            ans.append(2)
            A.pop(1)
            A[0] += A.pop(1)
print(len(ans))
for a in ans:
    print(a)

### FIXED CODE ###

N = int(input())

red = []
blue = []
count = 0

dellist = lambda items, indexes: [item for index, item in enumerate(items) if index not in indexes]

for n in range(2*N):
    v = list(map(int, input().split()))
    if n < N:
        red.append(v)
    else:
        blue.append(v)


for x in range(2*N):

    for k in range(2):
        r_remove_list = []
        b_remove_list = []

        for i, b in enumerate(blue):
            if b[k] == x:
                cand = -1
                max_ = -1
                max_j = -1
                for j, r in enumerate(red):
                    if r[k] < x:
                        if r[1-k] < b[1-k] and max_ < r[1-k]:
                            cand = j
                            max_ = r[1-k]
                            max_j = j
                if cand >= 0:
                    r_remove_list.append(max_j)
                    b_remove_list.append(i)

        blue = dellist(blue,b_remove_list)
        red = dellist(red,r_remove_list)
        count += len(b_remove_list)


print(count)
k=input()
ans=7
ans2=10
prev=7
if ans%k==0:
    print(1)
else:
    for i in range(0, k + 1, 1):
        ans=7*ans2+prev
        if ans%k==0:
            print(i+2)
            break
        prev=ans
        ans2=ans2*10



### FIXED CODE ###

k=int(input())
ans=7
ans2=10
prev=7
hbe=False
if ans%k==0:
    print(1)
    hbe=True
else:
    for i in range(0, k + 1, 1):
        ans=(7*ans2+prev)%k
        if ans%k==0:
            print(i+2)
            hbe=True
            break
        prev=ans
        ans2=(ans2*10)%k
if hbe==False:
    print(-1)
import math

N, K = map(int, input().split())
lst = [int(x) for x in input().split()]
dp = [math.inf] * N
dp[0] = 0
dp[1] = abs(lst[0] - lst[1])
for i in range(2, N):
    j = K
    while j > 0:
        if i - j >= 0:
            dp[i] = min(dp[i], dp[i - j] + abs(lst[i - j] - lst[i]))
        j -= 1
print(dp[-1])


### FIXED CODE ###

import numpy as np

N, K = map(int, input().split())
lst = np.array([int(x) for x in input().split()])
dp = np.zeros(N, dtype=int)

for i in range(1, N):
    start = max(i - K, 0)
    dp[i] = np.min(dp[start:i] + np.abs(lst[start:i] - lst[i]))
print(dp[-1])
# coding : utf-8

s = input()
K = int(input())

strlist = sorted(range(len(s)), key=lambda k :list(s)[k], reverse=False)
s_len = len(s)
strset = set(s[strlist[0]])

calcEnd = False
for i in range(len(s)):
    #for j in range(i+1, len(s)+1):
    j_index = min(i+1, len(s) -1)
    for j in range(strlist[j_index], len(s)):
        #strset.add(s[i:j])
        strset.add(s[strlist[i]:j])

    if s[strlist[i+1]] != s[strlist[i]]:
        if len(strset) >= K:
            calcEnd = True
            break

    if calcEnd:
        break


strsetsort = sorted(strset, reverse=False)
ans = strsetsort[K-1]
print(ans)

### FIXED CODE ###

# coding: utf-8

s = input()
K = int(input())

n = len(s)

# sにでてくる英小文字1文字ごとをUTF-8コードのリストで管理する
pos = [[] for __ in range(256)]
for i in range(n):
    pos[ord(s[i])].append(i)

strset = set()
for c in range(ord('a'), ord('z')+1):
    for i in pos[c]:
        for j in range(K):
            strset.add(s[i:i+j+1])

    # 最初の1文字が最も若い英小文字で始まるすべての部分文字列がK以上なら、それより後ろになる文字列は調べなくて良い
    if len(strset) > K:
        break


strlist = list(strset)
strlist.sort()
print(strlist[K-1])
n, m = map(int, input().split())

import math
if n == m:
    dog = math.factorial(n)
    mon = math.factorial(m)
    ans = dog * mon * 2
elif n == m + 1 or n == m - 1:
    dog = math.factorial(n)
    mon = math.factorial(m)
    ans = dog * mon
else:
    ans = 0

print(ans　// (10 ** 9 + 7))

### FIXED CODE ###

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

import math
if n == m:
    dog = math.factorial(n)
    mon = math.factorial(m)
    ans = dog * mon * 2
elif n == m + 1 or n == m - 1:
    dog = math.factorial(n)
    mon = math.factorial(m)
    ans = dog * mon
else:
    ans = 0

print(ans % (10 ** 9 + 7))
N = int(input())
A = sorted(list(map(int, input().split())), reversed=True)
if N == 1:
  print(A[0])
  exit()
print(sum(A[0::2]) - sum(A[1::2]))

### FIXED CODE ###

N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
if N == 1:
  print(A[0])
  exit()
print(sum(A[0::2]) - sum(A[1::2]))
print(round(input()/2)-1)

### FIXED CODE ###

print(int((int(input())-1)/2))
k = int(input())
for i in range(1,10):
     if k // i <= 9 and k % i == 0:
            print("Yes")
        	exit
     
print("No")

### FIXED CODE ###

k = int(input())
for i in range(1,10):
    if k // i <= 9 and k % i == 0:
       print("Yes")
       exit()
     
print("No")
c=0
while True:
    n=input()
    if n==0:
        break
    c+=1
    x0, y0=map(int,raw_input().split())
    prev_x, prev_y=x0, y0
    tmp=0
    for i in range(n):
        x,y=map(int,raw_input().split())
        tmp+=prev_x*y - prev_y*x
        prev_x, prev_y=x, y
    tmp+=prev_x*y0 - prev_y*x0
    print c, 0.5*abs(tmp)
    
   

### FIXED CODE ###

c=0
while True:
    n=input()
    if n==0:
        break
    c+=1
    x0, y0=map(int,raw_input().split())
    prev_x, prev_y=x0, y0
    tmp=0
    for i in range(n-1):
        x,y=map(int,raw_input().split())
        tmp+=prev_x*y - prev_y*x
        prev_x, prev_y=x, y
    tmp+=prev_x*y0 - prev_y*x0
    print c, 0.5*abs(tmp)
    skip=raw_input()
[print(t*x)for t,x in[[int(i) for i in　input().split()]]] 

### FIXED CODE ###

[print(t/x)for t,x in[[int(i) for i in input().split()]]]
def main():
    n, k = list(map(int, input().split()))
    daice = list(map(int, input().split()))
    daice_kitai = [0]

    tmp = 0
    for i in range(1, 7):
        tmp += i
        daice_kitai.append(tmp * (1 / i))
    for i in range(0, len(daice) - k + 1):
        count = 0
        tmp = 0
        for j in range(i, i + k):
            tmp += daice_kitai[daice[j]]
        count = tmp if tmp > count else count
    print(count)


if __name__ == '__main__':
    main()

### FIXED CODE ###


url = "https://atcoder.jp//contests/abc154/tasks/abc154_d"

def search_ind(lis, k):
    tmp = sum(lis[0:k])
    m = tmp
    inds = [0, k - 1]
    for i in range(0, len(lis) - k):
        tmp = tmp - lis[i] + lis[i + k]
        # print(tmp, lis[i + k])
        if tmp > m:
            inds = [i + 1, i + k]
            m = tmp
    return inds

def main():
    n, k = list(map(int, input().split()))
    daice = list(map(int, input().split()))
    f, t = search_ind(daice, k)
    kitai = daice[f:t + 1]
    ans = 0
    for v in kitai:
        sumt = 0
        for i in range(1, v + 1):
            sumt += i * (1 / v)
        ans += sumt
    print(ans)




if __name__ == '__main__':
    main()
a,b,c = map(int,input().split())
if a == b
	print(c)
else if a == c
	print(b)
else if b == c
	print(a)

### FIXED CODE ###

a,b,c = map(int,input().split())
if a == b:
	print(c)
elif a == c:
	print(b)
elif b == c:
	print(a)
std_n = int(input())
std_tuple = tuple(map(int, input().split()))
std_set = set(map(int, input().split()))

if std_set == {0}:
    print("Yes")
elif len(std_set) == 2:
    if 0 in std_set:
        if std_tuple.count(0) * 3 == std_n:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif len(std_set) == 3:
    a, b, c = tuple(std_set)
    if std_tuple.count(a) == std_tuple.count(b) == std_tuple.count(c):
        if int(str(int(format(a, "b")) ^ int(format(b, "b"))), 2) == c:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")


### FIXED CODE ###

std_n = int(input())
std_list = tuple(map(int, input().split()))
std_set = set(std_list)

if std_set == {0}:
    print("Yes")
    exit()
elif len(std_set) == 2:
    if 0 in std_set:
        if std_list.count(0) * 3 == std_n:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
elif len(std_set) == 3:
    a, b, c = tuple(std_set)
    if (std_list.count(a) == std_list.count(b)) and (std_list.count(b) == std_list.count(c)):
        if a ^ b == c:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
else:
    print("No")
    exit()

############


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

unq = list(set(nums))


def answer(ans):
    print(ans)
    exit()


if len(unq) > 3:
    answer("No")

if len(unq) == 3:
    a, b, c = unq
    if a ^ b ^ c != 0:
        answer("No")
    if nums.count(a) == nums.count(b) == nums.count(c):
        answer("Yes")
    else:
        answer("No")

if len(unq) == 2:
    a, b = sorted(unq)
    if a != 0:
        answer("No")
    if nums.count(a) * 2 == nums.count(b):
        answer("Yes")
    else:
        answer("No")

if len(unq) == 1:
    a = unq[0]
    if a != 0:
        answer("No")
    else:
        answer("Yes")
# coding: utf-8
import sys

ys.setrecursionlimit(200000)

H,W=map(int,input().split())

canvas=[]

flg=True

def bfs(y,x):
    cnt[0]+=1
    canvas[y][x]="."
    dx=[1,0,-1,0]
    dy=[0,1,0,-1]
    for i in range(4):
        ny=y+dy[i]
        nx=x+dx[i]
        
        if 0<=nx<=W-1 and 0<=ny<=H-1:
            if canvas[ny][nx]=="#":
                bfs(ny,nx)

for i in range(H):
    row=list(input())
    canvas.append(row)


for i in range(H):
    for j in range(W):
        if canvas[i][j]=="#":
            cnt=[0]
            bfs(i,j)
            if cnt[0]==1:
                flg=False

if flg:
    print("Yes")
else:
    print("No")
    

### FIXED CODE ###

# coding: utf-8
import sys

sys.setrecursionlimit(200000)

H,W=map(int,input().split())

canvas=[]

flg=True

def bfs(y,x):
    cnt[0]+=1
    canvas[y][x]="."
    dx=[1,0,-1,0]
    dy=[0,1,0,-1]
    for i in range(4):
        ny=y+dy[i]
        nx=x+dx[i]
        
        if 0<=nx<=W-1 and 0<=ny<=H-1:
            if canvas[ny][nx]=="#":
                bfs(ny,nx)

for i in range(H):
    row=list(input())
    canvas.append(row)


for i in range(H):
    for j in range(W):
        if canvas[i][j]=="#":
            cnt=[0]
            bfs(i,j)
            if cnt[0]==1:
                flg=False

if flg:
    print("Yes")
else:
    print("No")
import math
N = int(input())
A = list(map(int, input().split()))

DP_first = [0] * N
DP_last = [0] * N

DP_first[0] = A[0]
DP_last[0] = A[-1]

for i in range(1, N):
    DP_first[i] = math.gcd(DP_first[i-1], A[i])
    DP_last[i] = math.gcd(DP_last[i-1], A[-1-i])

ans = max(DP_first[N-2], DP_last[N-2])
for i in range(1, N-1):
    ans = max(ans, math.gcd(DP_first[i-1], DP_last[N-2-i]))
print(ans)


### FIXED CODE ###

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

DP_first = [0] * N
DP_last = [0] * N

DP_first[0] = A[0]
DP_last[0] = A[-1]

for i in range(1, N):
    DP_first[i] = fractions.gcd(DP_first[i-1], A[i])
    DP_last[i] = fractions.gcd(DP_last[i-1], A[-1-i])

ans = max(DP_first[N-2], DP_last[N-2])
for i in range(1, N-1):
    ans = max(ans, fractions.gcd(DP_first[i-1], DP_last[N-2-i]))
print(ans)
from math import *

cnt = [[0] * 19 for i in range(19)]

ans = 0
for _ in range(int(input())):
    t = float(input())
    b = int(t * 1000000000.0)
    x, y = 0, 0
    while b % 2 == 0 and x <= 18:
        x += 1
        b //= 2
    while b % 5 == 0 and x <= 18:
        y += 1
        b //= 5
    #print(x, y)
    for i in range(19):
        for j in range(19):
            if i + x >= 18 and j + y >= 18:
                ans += cnt[i][j]
    cnt[x][y] += 1
print(ans)


### FIXED CODE ###

from math import *
#import sys 
#cin = sys.stdin()

cnt = [[0] * 20 for i in range(20)]

ans = 0
for _ in range(int(input())):
    t = input().strip().split('.')
    if (len(t) > 1):
        b = int(t[0])*1000000000 + int(t[1]) * 10 ** (9 - len(t[1]))
    else:
        b = int(t[0]) * 1000000000
    x, y = 0, 0
    while (b % 2 == 0) and (x <= 18):
        x += 1
        b //= 2
    while (b % 5 == 0) and (y <= 18):
        y += 1
        b //= 5
    #print(x, y)
    for i in range(20):
        for j in range(20):
            if (i + x >= 18) and (j + y >= 18):
                ans += cnt[i][j]
    cnt[x][y] += 1
print(ans)
n,k=map(int,input().split())
a=tuple(map(int,input().split()))
l=[0]
for i in range(1,n):
  b=a[i]
  l+=[min(l[-j]+abs(b-a[-j])for j in range(1,min(i,k)+1))]
  if i>k:
    del a[0]
    del l[0]
print(l[-1])


### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
l=[0]
for i in range(1,n):
  b=a[i]
  l.append(min(l[j]+abs(b-a[j])for j in range(i-min(k,i),i)))
print(l[-1])
import numpy as np
n,l=int(input()),list(map(float,input().split()))
dp=np.full([n+1,n+1],0.0)
dp[0][0]=1.0
for i in range(1,n+1):
    for j in range(i+1):
        if j==0:
            dp[i][j]=dp[i-1][j]*(1.0-l[i-1])
        else:
            dp[i][j]=dp[i-1][j]*(1.0-l[i-1])+dp[i-1][j-1]*l[i-1]
a=0.0
for i in range((n+1)//2,n+1):
    a+=dp[n][i]
print(a)

### FIXED CODE ###

n,l=int(input()),list(map(float,input().split()))
dp=[[0.0]*(n+1) for _ in range(n+1)]
dp[0][0]=1.0
for i in range(1,n+1):
    for j in range(i+1):
        if j==0:
            dp[i][j]=dp[i-1][j]*(1.0-l[i-1])
        else:
            dp[i][j]=dp[i-1][j]*(1.0-l[i-1])+dp[i-1][j-1]*l[i-1]
print(sum(dp[n][((n+1)//2):]))
n,x=int(input()),input()
o=x.count("1")
l=[0]*(o+1)
A=int(x,2)
a=A%(o+1)
b=A%(o-1)
for i in range(1,o+1):l[i]=l[i%bin(i).count("1")]+1
mp=[1]*n
mm= [1]*n
for i in range(1,n):
  mp[i]=mp[i-1]*2%(o+1)
  mm[i]=mm[i-1]*2%(o-1)
for i,v in enumerate(x):
  if v=="0":
    print(l[(a+mp[-1-i])%(o+1)]+1)
  else:
    if o==1:print(0)
    else:print(l[(b+mm[-1-i])%(o-1)]+1)
    

### FIXED CODE ###

n,x=int(input()),input()
o=x.count("1")
if o==1:
    for i,v in enumerate(x):
        if v=="1":print(0)
        else:
            if i!=n-1:
                if x[-1]=="0":print(1)
                else:print(2)
            else:print(2)

else:
    m=o-1
    M=o+1
    mp,mm={0:1},{0:1}
    for i in range(1,n):
        mp[i]=mp[i-1]*2%M
        mm[i]=mm[i-1]*2%m
    A=int(x,2)
    a=A%m
    b=A%M
    rest={0:0}
    for i in range(1,o+1):
        rest[i]=1+rest[i%bin(i).count("1")]
    for i,v in enumerate(x):
        if v=="1":
            print(1+rest[(a-mm[n-i-1])%m])
        else:
            print(1+rest[(b+mp[n-i-1])%M])
S, W = map(int,input().split())
if S>W:
  print("safe"if S>W"unsafe"else)


### FIXED CODE ###

S, W = map(int,input().split())
print("safe"if S>W else"unsafe")
r = int(input())
if r >= 2800 :
  print('AGC')
elif r >= 1200 :
  print('ARC'):
else:
  print('ABC')
  

### FIXED CODE ###

r = int(input())
if r >= 2800 :
  print('AGC')
elif r >= 1200:
  print('ARC')
else:
  print('ABC')
S = str(input())
T = str(input())

from collections import defaultdict
s = defaultdict(int)
t = defaultdict(int)

for i in S:
	s[i] += 1

for j in T:
	t[j] += 1

ss = sorted(s.values())
tt = sorted(t.values())

if ss == tt:
	print('Yes')
else:
	print('No')
		

### FIXED CODE ###

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

answer = A[0]*10 + A[1] + A[2] 

print(answer)
N,M = map(int, input().split())
As = list(map(int, input().split()))
As.sort()
for i in range(M):
    B,C = map(int, input().split())
    j = 0
    while As[j] < C and B > 0:
        As[j] = C
        j += 1
        B -= 1
    As.sort()
ans = 0
for i in range(N):
    ans += As[i]

print(ans)


### FIXED CODE ###

N,M = map(int, input().split())
As = list(map(int, input().split()))
As.sort()
BCs = [0 for i in range(M)]
for i in range(M):
    BCs[i] = list(map(int, input().split()))
BCs.sort(key=lambda x: x[1])
mark = 0
ans = 0
for i in reversed(range(M)):
    B = BCs[i][0]
    C = BCs[i][1]
    j = mark
    if As[j] >= C:
        break
    while As[j] < C and B > 0:
        As[j] = C
        j += 1
        if j >= N:
            break
        B -= 1
    
    ans += (j - mark)*C
    mark = j
    if j >= N:
        break
    
for i in range(mark,N):
    ans += As[i]

print(ans)
while True:
    no = []
    n = int(input())
    if (n == 0):
        exit
    
    for i in range(n):
        datas = map(int, input().split())
        li = list(datas) 
        e = li[0]
        p = li[1]
        q = li[2]

        s = p * q
        if (1000000 < s and (e in no) == False):
            print(e)
            no.append(e)
    
    if (len(no) == 0):
        print("NA")




### FIXED CODE ###

while True:
    no = {}
    n = int(input())
    if (n == 0):
        break
    
    for i in range(n):
        datas = map(int, input().split())
        li = list(datas) 
        e = li[0]
        p = li[1]
        q = li[2]

        s = p * q
        if (e not in no):
            no[e] = s
        else:
            no[e] += s

    na = True    
    for k in no.keys():
        if (1000000 <= no[k]):
            print(k)
            na = False
    
    if (na == True):
        print("NA")
x, y = map(int, input().split())

if x*4<y:
    print("No")

elif y/2<x:
    print ("No")

elif y % 2 == 0:
    print("Yes")

else:
    print("No")


### FIXED CODE ###

lst = []

a, b, c, d, e = map(int, input().split())

lst.append(a)
lst.append(b)
lst.append(c)
lst.append(d)
lst.append(e)

n=lst.index(0)
print(n+1)
def prog(x):
    n = len(x)
    y = [int(i * 10**9) for i in x]
    #y

    def count25(s): # count25(0)
        if s.find('.') == -1:
            s += '.'
        s = s.rstrip('0')
        decimal_point = s.find('.')
        int_part = s[:decimal_point]
        float_part = s[decimal_point+1:]
        float_part += '0' * (9 - len(float_part))
        n = int(int_part + float_part)
        if n == 0:
            return (0, 0)
        two = five = 0
        while n % 2 == 0:
            two += 1
            n //= 2
        while n % 5 == 0:
            five += 1
            n //= 5
        return (two, five)

    two = [0] * n
    five = [0] * n
    for i in range(n):
        two[i], five[i] = count25(y[i])
    count = 0
    for i in range(n - 1):
        two_i = 18 - two[i]
        five_i = 18 - five[i]
        for j in range(i + 1, n):
            #if min(two[i] + two[j], five[i] + five[j]) >= 18:
            if two[j] >= two_i and five[j] >= five_i:
                #print(min(two1,two2) + min(five1, five2), two1, two2, five1, five2)
                #print(y[i] * y[j], (y[i] * y[j]) / 10**18)
                #print(y[i] / 10**9, y[j] / 10**9)
                #print('=================')
                count += 1
    print(count)

n = int(input())
x = [0] * n
x = [input() for i in range(n)]
prog(x)


### FIXED CODE ###

def conv(s):
    if s.find('.') == -1:
        s += '.'
    s = s.rstrip('0')
    t = len(s) - s.find('.') - 1
    a = int(s.replace('.', ''))
    if a == 0:
        return (0, 0)
    x, y = -t, -t
    while a % 5 == 0:
        x += 1
        a //= 5
    while a % 2 == 0:
        y += 1
        a //= 2
    return (x, y)


N, *A = open(0).read().split()
N = int(N)

d = {}
for a in A:
    t = conv(a)
    d.setdefault(t, 0)
    d[t] += 1

result = 0
xs = list(d.keys())
for i in range(len(xs)):
    x, y = xs[i]
    t = d[xs[i]]
    if x >= 0 and y >= 0:
        result += t * (t - 1) // 2
    for j in range(i + 1, len(xs)):
        m, n = xs[j]
        if x + m >= 0 and y + n >= 0:
            result += t * d[xs[j]]
print(result)
n = int(input())
ans = 0
for b in range(1001):
  for p in range(2,10):
    if b**p > x:
      break
    ans = max(ans, b**p)
print(ans)    

### FIXED CODE ###

x = int(input())
ans = [b**p for b in range(1001) for p in range(2,10)
      if b**p <= x]
print(max(ans))
import sys
from io import StringIO
import unittest

def resolve():
    n = int(input())

    print(sum(list(range(n + 1))) - n)

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """2"""
        output = """1"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """13"""
        output = """78"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """1"""
        output = """0"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

### FIXED CODE ###

import sys
from io import StringIO
import unittest

def resolve():
    n = int(input())

    ans = n * (n - 1) // 2
    print(int(ans))

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """2"""
        output = """1"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """13"""
        output = """78"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """1"""
        output = """0"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()
import sys
sys.setrecursionlimit(100000)
n, m = map(int,input().split())
mark = [-2] * (n-1)
dist = [0] * (n-1)
path = [[] for _ in range(n-1)]
path0 = []

def search(i):
    d = dist[i]
    for p in path[i]:
        if dist[p] > d or dist[p] == 0:
            dist[p] = d + 1
            mark[p] = i
            search(p)

for _ in range(m):
    a, b = map(lambda x: int(x)-2, input().split())
    if a == -1:
        path0.append(b)
        dist[b] = 1
        mark[b] = -1
    elif b == -1:
        path0.append(a)
        dist[a] = 1
        mark[a] = -1
    else:
        path[a].append(b)
        path[b].append(a)

for p in path0:
    search(p)

if mark.count(-2) > 0:
    print("No")
else:
    print("Yes")
    for i in mark: print(i+2)


### FIXED CODE ###

import sys
sys.setrecursionlimit(2*100000)
n, m = map(int,input().split())
mark = [-2] * (n-1)
dist = [0] * (n-1)
path = [[] for _ in range(n-1)]
path0 = []

for _ in range(m):
    a, b = map(lambda x: int(x)-2, input().split())
    if a == -1:
        path0.append(b)
        dist[b] = 1
        mark[b] = -1
    elif b == -1:
        path0.append(a)
        dist[a] = 1
        mark[a] = -1
    else:
        path[a].append(b)
        path[b].append(a)

while len(path0) > 0:
    i = path0.pop(0)
    d = dist[i]
    for p in path[i]:
        if dist[p] > d + 1 or dist[p] == 0:
            dist[p] = d + 1
            mark[p] = i
            path0.append(p)

print("Yes")
for i in mark: print(i+2)