Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
l = []
m = []
s = []
j = 0
for i in range(1, 1001):
    j += i
    s.append(j)
c = 0
for i in range(n-k+1):
    ans = 0
    a = p[i:i+k]
    for b in a:
        ans += s[b-1]/b
    l.append(ans)
    c = max(c, ans)
print(c)

### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
l = []
y = 0
for x in range(1, 1001):
    y += x
    l.append(y/x)
m = []
for i in p:
    m.append(l[i-1])
s = [0]
z = 0
for i in m:
    z += i
    s.append(z)
ans = 0
for i in range(n-k+1):
    ans = max(ans, s[i+k] - s[i])
print(ans)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
k=0
ans=0
while k<n:
  if a[k]==k and a[k+1]==k:
    k+=2
    ans+=1
  elif a[k]==k and a[k+1]!=k:
    k+=1
    ans+=1
  else:
    pass
print(ans)
    
    

### FIXED CODE ###

N = int(input())
P = list(map(int,input().split()))
ans = 0
for i in range(N - 1):
  if P[i] == i+1:
    P[i],P[i+1] = P[i+1],P[i]
    ans += 1
if P[-1] == N:
  ans += 1
print(ans)
### BUGGY CODE ###

# coding: utf-8
# Your code here!
def divisor_list(N): #素因数分解
    res = []
    i = 1
    while i*i < N:
        if N%i == 0:
            res.append(i)
            res.append(N//i)
        i += 1
    if i*i == N: res.append(i)
    return sorted(res)

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n,k = [int(i) for i in readline().split()]
a = [int(i) for i in readline().split()]


l = reversed(divisor_list(sum(a)))


def check(x):
    res = []
    for ai in a:
        c = ai%x
        d = ai%x-x
        if abs(c) > abs(d): res.append(d)
        else: res.append(c)
    res.sort(key = abs)
    
    d = sum(res)

    if d > 0:
        idx = -1
        while d != 0:
            if res[idx]>0:
                d -= x
                res[idx] -= x
                idx -= 1
    if d < 0:
        idx = -1
        while d != 0:
            if res[idx]<0:
                d += x
                res[idx] += x
                idx -= 1
                
    c = sum([x for x in res if x > 0])        

#    print(x,c,res)
    return (c <= k)



for x in l:
    if check(x):
        print(x)
        exit()




















### FIXED CODE ###

# coding: utf-8
# Your code here!
def divisor_list(N): #素因数分解
    res = []
    i = 1
    while i*i < N:
        if N%i == 0:
            res.append(i)
            res.append(N//i)
        i += 1
    if i*i == N: res.append(i)
    return sorted(res)

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n,k = [int(i) for i in readline().split()]
aaa = [int(i) for i in readline().split()]


l = list(reversed(divisor_list(sum(aaa))))


def check(x):
    res = []
    for ai in aaa:
        c = ai%x
        d = ai%x-x
        if abs(c) > abs(d): res.append(d)
        else: res.append(c)
    res.sort(key = abs)
    
    d = sum(res)
    if d > 0:
        idx = -1
        while d > 0:
            if res[idx]>0:
                d -= x
                res[idx] -= x
            idx -= 1
    elif d < 0:
        idx = -1
        while d < 0:
            if res[idx]<0:
                d += x
                res[idx] += x
            idx -= 1
                
    c = sum([i for i in res if i > 0])        

#    print(x,c,res)
    return (c <= k)



for x in l:
    if check(x):
        print(x)
        exit()
### BUGGY CODE ###

import collections

n = int(input())
ls = [input() for i in range(n)]    
c = collections.Counter(ls)

count = c.most_common()[0][1]
ans = []

for i in range(len(c)):
    p = c.most_common()
    if p[i][1] == count:
        ans.append(p[i][0])
    else:
        break   
ans = sorted(ans)
for i in ans:
    print(i)

### FIXED CODE ###

import collections
from collections import Counter

n = int(input())
ls = [input() for i in range(n)]    
c = Counter(ls).most_common()

count = c[0][1]
ans = []

for i in range(len(c)):
    if c[i][1] == count:
        ans.append(c[i][0])
    else:
        break   
ans = sorted(ans)
for i in ans:
    print(i)
### BUGGY CODE ###

from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))

result = [-1 for _ in range(n)]
tree = [[] for _ in range(n)]
for _i in range(n-1):
    u, v = map(int, input().split())
    u, v = u-1, v-1
    tree[u].append(v)
    tree[v].append(u)
INF = float('inf')
dp = [INF for _i in range(n+1)]


def dfs(p, d, x):
    i = bisect_left(d, a[p])
    d[i] = a[p]
    result[p] = bisect_left(d, INF)
    for j in tree[p]:
        if j != x:
            dfs(j, d.copy(), p)

dfs(0, dp, -1)

for i in result:
    print(i)

### FIXED CODE ###

from bisect import bisect_left
import sys
sys.setrecursionlimit(10 ** 9)
n = int(input())
a = list(map(int, input().split()))

result = [-1 for _ in range(n)]
tree = [[] for _ in range(n)]
for _i in range(n-1):
    u, v = map(int, input().split())
    u, v = u-1, v-1
    tree[u].append(v)
    tree[v].append(u)
INF = float('inf')
dp = [INF for _i in range(n+1)]


def dfs(p, x):
    i = bisect_left(dp, a[p])
    old = dp[i]
    dp[i] = a[p]
    result[p] = bisect_left(dp, INF)
    for j in tree[p]:
        if j != x:
            dfs(j, p)
    dp[i] = old
    

dfs(0, -1)

for i in result:
    print(i)
### BUGGY CODE ###

o = list(input())
e = list(input())
c = ""
for i in range(len(o)):
    c += o[i]
    while e:
        c += e[i]

print(c)

### FIXED CODE ###

o = list(input())
e = list(input())
c = ""
for i in range(len(o)):
    c += o[i]
    if i < len(e):
        c += e[i]

print(c)
### BUGGY CODE ###

#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
  return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

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

n,m,s,t = II()
u,v,a,b = Line(m)

c = []
for i in range(m):
  c.append([u[i]-1,v[i]-1,a[i]])
  c.append([v[i]-1,u[i]-1,a[i]])

from heapq import heappop, heappush
inf=float('inf')
d=[inf for _ in range(n)]
d[s-1]=0
prev=[None]*n
p=dict()
for i,j,k in c: p[i]=p.get(i,[])+[(j,k)]

q=[]
heappush(q,(d[s-1],s-1))
rem = n
while q and rem:
  du, u1 = heappop(q)
  if d[u1]<du: continue
  rem -= 1
  for v1,weight in p.get(u1,[]):
    alt=du+weight
    if d[v1]>alt:
      d[v1]=alt
      prev[v1]=u1
      heappush(q, (alt,v1))

c2 = []
for i in range(m):
  c2.append([u[i]-1,v[i]-1,b[i]])
  c2.append([v[i]-1,u[i]-1,b[i]])

d2=[inf for _ in range(n)]
d2[t-1]=0
prev=[None]*n
p=dict()
for i,j,k in c2: p[i]=p.get(i,[])+[(j,k)]

q=[]
heappush(q,(d2[t-1],t-1))
rem = n
while q:
  du, u2 = heappop(q)
  if d2[u2]<du: continue
  rem -= 1
  for v2,weight in p.get(u2,[]):
    alt=du+weight
    if d2[v2]>alt:
      d2[v2]=alt
      prev[v2]=u2
      heappush(q, (alt,v2))

ans = [d[n-1]+d2[n-1]]
for i in range(1,n):
  ans.append(min(ans[i-1],d[n-1-i]+d2[n-1-i]))

for i in range(n):
  print(10**15-ans[n-1-i])

### FIXED CODE ###

#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
  return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

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

n,m,s,t = II()
u,v,a,b = Line(m)

from heapq import heappop, heappush
def dijkstra(E,s,n):
  inf=float('inf')
  d=[inf for _ in range(n)]
  d[s]=0
  q=[]
  heappush(q,(0,s))
  while q:
    du, u1 = heappop(q)
    if d[u1]<du: continue
    for v1,weight in E[u1].items():
      alt=du+weight
      if d[v1]>alt:
        d[v1]=alt
        heappush(q, (alt,v1))
  return d

p = [dict() for _ in range(n)]
p2 = [dict() for _ in range(n)]
for i in range(m):
  p[u[i]-1][v[i]-1] = a[i]
  p[v[i]-1][u[i]-1] = a[i]
  p2[u[i]-1][v[i]-1] = b[i]
  p2[v[i]-1][u[i]-1] = b[i]

d = dijkstra(p,s-1,n)
d2 = dijkstra(p2,t-1,n)

ans = [0]*n
ans[0] = d[n-1]+d2[n-1]
for i in range(1,n):
  ans[i] = min(ans[i-1],d[n-1-i]+d2[n-1-i])

for i in ans[::-1]:
  print(10**15-i)
### BUGGY CODE ###

N = int(input())

u_list = []
v_list = []
w_list = []

for _ in range(N-1):
  u, v, w = map(int, input().split())
  u_list.append(u-1)
  v_list.append(v-1)
  w_list.append(w)
  
color_dict = dict()
uvw_list = list(zip(u_list, v_list, w_list))
color_dict[0] = 1

def eval_single(u, v, w, color_dict):
  skip = True

  if u in color_dict:
    color_dict[v] = assign_color(color_dict[u], w)
    skip = False
    
  if v in color_dict:
    color_dict[u] = assign_color(color_dict[v], w)
    skip = False
    
  return skip, color_dict
  

def assign_color(color, w):
  if w%2==0:
    return color
  else:
    return color*(-1)
  
while True:
  ind_list = []
  for ind, (u, v, w) in enumerate(uvw_list):
    skip, color_dict = eval_single(u, v, w, color_dict)
    
    if skip:
      ind_list.append(ind)

  uvw_list = [uvw_list[ind] for ind in ind_list]
  
  #print(len(color_dict))
  if len(color_dict) == N:
    break

for i in range(N):
  color = color_dict[i]
  if color == -1:
    print(0)
  else:
    print(1)


### FIXED CODE ###

N = int(input())

u_list = []
v_list = []
w_list = []

for _ in range(N-1):
  u, v, w = map(int, input().split())
  u_list.append(u-1)
  v_list.append(v-1)
  w_list.append(w)
  
color_dict = dict()
uvw_list = list(zip(u_list, v_list, w_list))
color_dict[u_list[0]] = 1

def eval_single(u, v, w, color_dict):
  skip = True

  if u in color_dict:
    color_dict[v] = assign_color(color_dict[u], w)
    skip = False
    
  if v in color_dict:
    color_dict[u] = assign_color(color_dict[v], w)
    skip = False
    
  return skip, color_dict
  

def assign_color(color, w):
  if w%2==0:
    return color
  else:
    return color*(-1)+1
  
while True:
  ind_list = []
  for ind, (u, v, w) in enumerate(uvw_list):
    skip, color_dict = eval_single(u, v, w, color_dict)
    
    if skip:
      ind_list.append(ind)

  uvw_list = [uvw_list[ind] for ind in ind_list]
  
  if len(color_dict) == N:
    break

for i in range(N):
  print(color_dict[i])
### BUGGY CODE ###

n=int(input())
arr=list(map(int,input().split()))
for i in arr:
	if arr.count(i)>1:
		print("NO")
		break
else:
	print("YES")

### FIXED CODE ###

n=int(input())
arr=set(map(int,input().split()))
print("YES" if n==len(arr) else "NO")
### BUGGY CODE ###

from sys import stdin
import numpy as np
def main():
    #入力
    readline=stdin.readline
    n,k=map(int,readline().split())
    h=np.array(list(map(int,readline().split())),dtype=np.int64)
    before=np.arange(1,k+1,dtype=np.int64)

    dp=np.zeros(n,dtype=np.int64)
    for i in range(n):
        dp[i]=(dp[np.maximum(0,i-before)]+np.abs(h[i]-h[np.maximum(0,i-before)])).min()

    print(dp[n-1])

if __name__=="__main__":
    main()

### FIXED CODE ###

def main():
    N,K=map(int,input().split())
    h=list(map(int,input().split()))
    dp=[10**10]*N
    dp[0]=0
    for i in range(N):
        for j in range(1,min(K+1,N-i)):
            dp[i+j]=min(dp[i+j],dp[i]+abs(h[i]-h[i+j]))
    print(dp[N-1])

if __name__=="__main__":
    main()
### BUGGY CODE ###

n = int(input())
s = input()

ans = 0
sn = len(s)

r = []
if s[0] == "R":
    r.append(1)
else:
    r.append(0)

for i in range(1, sn):
    if s[i] == "R":
        r.append(r[-1] + 1)
    else:
        r.append(r[-1])

g = []
if s[0] == "G":
    g.append(1)
else:
    g.append(0)

for i in range(1, sn):
    if s[i] == "G":
        g.append(g[-1] + 1)
    else:
        g.append(g[-1])

b = []
if s[0] == "B":
    b.append(1)
else:
    b.append(0)

for i in range(1, sn):
    if s[i] == "B":
        b.append(b[-1] + 1)
    else:
        b.append(b[-1])

for i in range(n - 2):
    for j in range(i + 1, n - 1):
        if s[i] != s[j]:
            target_idx = j + (j - i)

            if "B" != s[i] and "B" != s[j]:
                ans += b[-1] - b[j]
                if target_idx >= sn:
                    continue
                if s[target_idx] == "B":
                    ans -= 1
            elif "G" != s[i] and "G" != s[j]:
                ans += g[-1] - g[j]
                if target_idx >= sn:
                    continue
                if s[target_idx] == "G":
                    ans -= 1
            else:
                ans += r[-1] - r[j]
                if target_idx >= sn:
                    continue
                if s[target_idx] == "R":
                    ans -= 1

print(ans)


### FIXED CODE ###

n = int(input())
s = input()

ans = 0
sn = len(s)

r = []
if s[0] == "R":
    r.append(1)
else:
    r.append(0)
g = []
if s[0] == "G":
    g.append(1)
else:
    g.append(0)
b = []
if s[0] == "B":
    b.append(1)
else:
    b.append(0)

for i in range(1, sn):
    if s[i] == "R":
        r.append(r[-1] + 1)
        g.append(g[- 1])
        b.append(b[- 1])
    elif s[i] == "G":
        r.append(r[-1])
        g.append(g[-1] + 1)
        b.append(b[- 1])
    elif s[i] == "B":
        r.append(r[-1])
        g.append(g[-1])
        b.append(b[-1] + 1)
    else:
        r.append(r[-1])
        g.append(g[- 1])
        b.append(b[- 1])

for i in range(n - 2):
    for j in range(i + 1, n - 1):
        if s[i] != s[j]:
            tmp = dict()
            tmp[s[i]] = 0
            tmp[s[j]] = 0
            target_idx = j + (j - i)

            if tmp.get("B", 1) == 1:
                ans += b[-1] - b[j]
                if target_idx >= sn:
                    continue
                if s[target_idx] == "B":
                    ans -= 1
            elif tmp.get("G", 1) == 1:
                ans += g[-1] - g[j]
                if target_idx >= sn:
                    continue
                if s[target_idx] == "G":
                    ans -= 1
            else:
                ans += r[-1] - r[j]
                if target_idx >= sn:
                    continue
                if s[target_idx] == "R":
                    ans -= 1

print(ans)
### BUGGY CODE ###

N,X,Y = map(int,input().split())
Alist = [[0 for i in range(N)] for j in range(N)]
for i in range(N):
    for j in range(i,N):
        Alist[i][j] = j-i
Alist[X-1][Y-1] = 1
for i in range(N):
    for j in range(i,N):
        Alist[i][j] = min(Alist[i][j],abs(X-1-i)+abs(Y-1-j)+1)
p = [0 for i in range(N)]
for i in range(N):
    for j in range(i,N):
        k = Alist[i][j]
        p[k] = p[k] + 1
for s in range(1,N):
    print(p[s])

### FIXED CODE ###

N,X,Y = map(int,input().split())
Alist = [[0 for i in range(N)] for j in range(N)]
p = [0 for i in range(N)]
for i in range(N):
    for j in range(i,N):
        k = min(j-i,abs(X-1-i)+abs(Y-1-j)+1)
        p[k] = p[k] + 1        
for s in range(1,N):
    print(p[s])
### BUGGY CODE ###

N = int(input())
Ai = list(map(int, input().split()))
Ai.insert(0, 0)
for i in range(1, N + 1 ,1):
    buka = Ai.count(i)
    print(buka)

### FIXED CODE ###

N = int(input())
Az = [0 for i in range(N)]
Ai = list(map(int, input().split()))

for i in Ai:
    Az[i-1] += 1
for j in Az:
    print(j)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

N = int(input())
S = [ord(c) for c in input().rstrip()]
Q = int(input())
k = list(map(int, input().split()))

dd = ord('D')
mm = ord('M')
cc = ord('C')

for l in k:
    D = M = tmp = ans = 0
    for i in range(N):
        if i >= l:
            if S[i-l] == dd:
                tmp -= M
                D -= 1
            if S[i-l] == mm:
                M -= 1
        if S[i] == dd:
            D += 1
        if S[i] == mm:
            M += 1
            tmp += D
        if S[i] == cc:
            ans += tmp
    print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N = int(input())
    S = input().rstrip()
    Q = int(input())
    k = list(map(int, input().split()))

    for l in k:
        D = 0
        M = 0
        tmp = 0
        ans = 0
        for i in range(N):
            if i >= l:
                if S[i-l] == 'D':
                    tmp -= M
                    D -= 1
                if S[i-l] == 'M':
                    M -= 1
            if S[i] == 'D':
                D += 1
            if S[i] == 'M':
                M += 1
                tmp += D
            if S[i] == 'C':
                ans += tmp
        print(ans)

main()
### BUGGY CODE ###

import numpy as np
N, K, Q = list(map(int, input().split()))

p = [K] * N
p = np.array(p)

for _ in range(Q):
    A = int(input()) - 1
    p -= 1
    p[A] += 1

for pp in p:
    if pp > 0:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

# import numpy as np
N, K, Q = list(map(int, input().split()))

p = [0] * N
# p = np.array(p)

# for _ in range(Q):
#     A = int(input()) - 1
#     p -= 1
#     p[A] += 1

for _ in range(Q):
    A = int(input()) - 1
    p[A] += 1

sum_p = sum(p)
# print(p)
for pp in p:
    if (pp + K) > sum_p:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

n = int(input())
s = list(input())

ans = 0
list1 = ["", "", ""]
for i in range(n):
    for j in range(n):
        for k in range(n):
            if i < j < k:
                if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
                    if j - i != k - j:
                        ans += 1
print(ans)


### FIXED CODE ###

n = int(input())
s = list(input())

ans = s.count("R") * s.count("G") * s.count("B")

for i in range(n):
    for d in range(n):
        j = i + d
        k = i + 2 * d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
            ans -= 1

print(ans)
### BUGGY CODE ###

S = input()
T = input()
dic = {}
for i,s in enumerate(S):
  if s not in dic:
    dic[s] = [i]
  else:
    dic[s].append(i)
#print(dic)
ind = -1
loop = 0
for t in T:
  if t not in dic:
    ans = -1
    break
  if dic[t][-1]<=ind:
    loop += 1
    ind = dic[t][0]
  else:
    for i in dic[t]:
      if i > ind:
        ind = i
        break
  #print(ind)
#print(loop,ind)
else:
  ans = len(S)*loop+ind+1
          
print(ans)   

#print(*ans[1:], sep='\n')


### FIXED CODE ###

S = input()
T = input()
dic = {}
for i,s in enumerate(S):
  if s not in dic:
    dic[s] = [i]
  else:
    dic[s].append(i)
#print(dic)
ind = -1
loop = 0
import bisect
for t in T:
  if t not in dic:
    ans = -1
    break
  if dic[t][-1]<=ind:
    loop += 1
    ind = dic[t][0]
  else:
    i = bisect.bisect_right(dic[t],ind)
    ind = dic[t][i]
  #print(ind)
#print(loop,ind)
else:
  ans = len(S)*loop+ind+1
          
print(ans)   

#print(*ans[1:], sep='\n')
### BUGGY CODE ###

n,q=[int(i) for i in input().split()]
s=input()
for i in range(q):
    l,r=[int(i) for i in input().split()]
    st=s[l-1:r]
    print(st.count("AC"))

### FIXED CODE ###

from collections import deque
n,q=map(int,input().split())
s=input()
AC=deque()
count=0
for i in range(n):
    if i!=0:
        if s[i-1:i+1]=="AC":
            count+=1
    AC.append(count)
for _ in range(q):
    l,r=map(int,input().split())
    print(AC[r-1]-AC[l-1])
### BUGGY CODE ###

def maxLengthBeginningFrom(i, string):
    ans = 0
    substring = string[i:]
    zArray = efficientZ(substring)
    for j in range(len(zArray)):
        ans = max(ans, min(j, zArray[j]))
    return ans

def efficientZ(string):
    """
    引数: string
    戻り値: 数値からなる配列。0番目の値は0．空文字列に対しては[]を返す。
    >>> efficientZ("ababa")
    [0,0,3,0,1]
    >>> efficientZ("aaaaa")
    [0,4,3,2,1]
    """
    length = len(string)
    Z = [0 for _ in range(length)]
    left = 0
    right = 0
    for i in range(1, length):
        if i >= right: 
            j = 0
            while i + j < length:
                if (string[j] == string[i + j]):
                    j += 1
                else:
                    break
            Z[i] = j
            left = i
            right = i + j
        else:
            correspondingValue = Z[i - left]
            if i + correspondingValue < right:
                Z[i] = correspondingValue
            else:
                j = right - i
                while i + j < length:
                    if string[i + j] == string[j]:
                        j += 1
                    else:
                        break
                Z[i] = j
                left = i
                right = i + j
    return Z 

N = int(input())
S = input()
ans = 0
for i in range(len(S)):
    ans = max(ans,maxLengthBeginningFrom(i, S))
print(ans)

### FIXED CODE ###

import math
MOD = pow(2,61) - 1
def charToNum(char):
    return ord(char) - 96

def check(string,subLen):
    if subLen == 0: return True
    #長さsubLenの部分文字列すべてについてローリングハッシュを計算して、
    #一致するものがあるかどうかを計算する。
    # setOfRollingHash = set()
    dictOfRollingHash = {}
    totalLen = len(string)
    h = 0
    b = 1
    for i in range(subLen):
        c = string[subLen - 1 - i]
        h += charToNum(c) * b
        b *= 27
        b %= MOD
    h %= MOD
    dictOfRollingHash[h] = 0
    maxBase = pow(27,subLen - 1,MOD) 
    for i in range(1,totalLen - subLen + 1):
        h -= maxBase * charToNum(string[i - 1])
        h *= 27
        h += charToNum(string[i + subLen - 1])
        h %= MOD
        if h in dictOfRollingHash:
            if i - dictOfRollingHash[h] >= subLen:
                return True
        else:
            dictOfRollingHash[h] = i
    return False

N = int(input())
S = input()
ok = 0
ng = N + 1
while abs(ok-ng) > 1:
    mid = (ok+ng)//2
    if check(S,mid):
        ok = mid
    else:
        ng = mid
print(ok)
### BUGGY CODE ###

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

AB = []
for i in range(X):
    for j in range(Y):
        AB.append(A[i]+B[j])

AB.sort(reverse = True)
AB = AB[:K+1]
ABC = []
for i in range(len(AB)):
    for j in range(Z):
        ABC.append(AB[i]+C[j])
ABC.sort(reverse = True)
for i in range(K):
    print(ABC[i])


### FIXED CODE ###

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

AB = []
for i in range(X):
    for j in range(Y):
        AB.append(A[i]+B[j])

AB.sort(reverse = True)
AB = AB[:K+1]
ABC = []
for i in range(len(AB)):
    for j in range(Z):
        ABC.append(AB[i]+C[j])
ABC.sort(reverse = True)
for i in range(K):
    print(ABC[i])
### BUGGY CODE ###

n,k = map(int,input().split())
p = list(map(int, input().split()))
kt = [0]*n
ans = 0

for i in range(n):
    kt[i] = (p[i]+1) / 2
    
for i in range(k-1,n):
    ans = max(ans , sum(kt[i+1-k:i+1]))
    
print(ans)

### FIXED CODE ###

n,k = map(int,input().split())
p = list(map(int, input().split()))
kt = [0]*n
ans = sum(p[0:k])
prev = sum(p[0:k])

for i in range(k,n):
    prev = prev - p[i-k] + p[i]
    ans = max(ans , prev)
      
print((ans+k)/2)
### BUGGY CODE ###

from collections import deque

N, M = map(int, input().split())
A = []
B = []
route = [[False for _ in range(N)] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    route[a-1][b-1] = True
    route[b-1][a-1] = True

print('Yes')

q = deque()
d = [-1] * N
d[0] = 0
q.append(0)

while len(q) != 0:
    x = q.popleft()
    for i in range(1, N):
        if route[x][i] and d[i] == -1:
            d[i] = x + 1
            q.append(i)

for i in range(1, N):
    print(d[i])


### FIXED CODE ###

from collections import deque

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

route = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    route[a - 1].append(b - 1)
    route[b - 1].append(a - 1)

print('Yes')

q = deque()
d = [-1] * N
d[0] = 0
q.append(0)

while q:
    x = q.popleft()
    for i in route[x]:
        if d[i] == -1:
            d[i] = x + 1
            q.append(i)

for i in range(1, N):
    print(d[i])