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

from collections import deque
from functools import lru_cache
import sys
sys.setrecursionlimit(10**5)

N = int(input())
E = [[] for _ in range(N)]
for _ in range(N-1):
    x,y = map(int, input().split())
    E[x-1].append(y-1)
    E[y-1].append(x-1)
    
parents = [-1]*N
q = deque()
q.append(0)
while q:
    t = q.popleft()
    for i in E[t]:
        if i == parents[t]:
            continue
        q.append(i)
        parents[i] = t
        
mod = 10**9+7
dp = [[1]*2 for _ in range(N)]
flag = [0]*N

@lru_cache(maxsize=None)
def f(v, j):
    if flag[v]:
        return dp[v][j]
    flag[v] = 1
    for i in E[v]:
        if i == parents[v]:
            continue
        dp[v][0] *= (f(i, 0) + f(i, 1))
        dp[v][1] *= f(i, 0)
        dp[v][0] %= mod
        dp[v][1] %= mod
    return dp[v][j]

print((f(0, 0)+f(0, 1))%mod)

### FIXED CODE ###

from collections import deque
import sys
sys.setrecursionlimit(10**6)

N = int(input())
E = [[] for _ in range(N)]
for _ in range(N-1):
    x,y = map(int, input().split())
    E[x-1].append(y-1)
    E[y-1].append(x-1)
    
parents = [-1]*N
q = deque()
q.append(0)
while q:
    t = q.popleft()
    for i in E[t]:
        if i == parents[t]:
            continue
        q.append(i)
        parents[i] = t
        
mod = 10**9+7
dp = [[1]*2 for _ in range(N)]
flag = [0]*N

def f(v, j):
    if flag[v]:
        return dp[v][j]
    flag[v] = 1
    for i in E[v]:
        if i == parents[v]:
            continue
        dp[v][0] *= (f(i, 0) + f(i, 1))
        dp[v][1] *= f(i, 0)
        dp[v][0] %= mod
        dp[v][1] %= mod
    return dp[v][j]

print((f(0, 0)+f(0, 1))%mod)
### BUGGY CODE ###

A,B=map(int,input().split())
C=B-A
now=A
XOR=A
for i in range(C):
    now+=1
    XOR^=now
print(XOR)

### FIXED CODE ###

#D問題
A,B = map(int,input().split())
def f(n):
    if n%2 == 0:
        if (n//2)%2 == 0:
            return n
        else:
            return n+1
    else:
        if ((n-1)//2)%2 == 0:
            return 1
        else:
            return 0
        
FB = f(B)
FA = f(A-1)
print(FB^FA)
### BUGGY CODE ###

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

LR = [[] for i in range(M)]

for i in range(M):
	L,R = map(int, input().split())
	for j in range(L,R + 1):
		LR[i].append(j)
	LR[i] = set(LR[i])

for i in range(M):
	LR[i] = LR[i] & LR[i-1]
    

print(len(LR[M-1]))

### FIXED CODE ###

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

inf = []
sup = []

for i in range(0,M):
	L,R = map(int,input().split())
	inf.append(L)
	sup.append(R)
	
inf = max(inf)
sup = min(sup)

ran = sup - inf

if ran >= 0:
	print(ran + 1)
else:print(0)
### BUGGY CODE ###

n, x, y = map(int, input().split())
anslist = [0] * n
list = []
for m in range(1, n + 1):
    for n in range(m, n + 1):
        if m != n:
            list.append([m, n])
while len(list) != 0:
    dis = list[0][1] - list[0][0]
    warpdis = (abs(x - list[0][0])) + (abs(list[0][1] - y)) + 1
    anslist[min(dis, warpdis)] += 1
    list.pop(0)
for i in range(1, n):
    print(anslist[i])

### FIXED CODE ###

from collections import deque

n, x, y = map(int, input().split())
dist = [[i - 1, i + 1] for i in range(n)]
dist[0].pop(0)
dist[-1].pop()
dist[x - 1].append(y - 1)
dist[y - 1].append(x - 1)
list = [0] * n

def line(num):
    pos = deque([[num, 0]])
    dp = [-1] * n

    while len(pos) > 0:
        now, depth = pos.popleft()
        dp[num] = 0
        for i in dist[now]:
            if dp[i] > 0:
                continue
            dp[i] = depth + 1
            pos.append([i, depth + 1])
    for i in dp:
        list[i] += 1
for i in range(n):
    line(i)
for i in range(1, n):
    print(int(list[i] / 2))
### BUGGY CODE ###

Q = 10**9+7
from collections import deque
from itertools import accumulate
#import sys
#input = sys.stdin.readline
def main():
    N, K = map( int, input().split())
    ans = 0
    d = deque()
    e = deque()
    M = int(N**(1/2))*2
    for i in range(1, int(N**(1/2))+1):
        if i**2 == N:
            d.append(i)
            M -= 1
            continue
        d.append(i)
        e.appendleft(N//i)
    T = list(d)+list(e)
    CT = [1]*M
    for i in range(1,M):
        CT[i] = T[i] - T[i-1]
    accT = list( map(lambda x:x%Q, accumulate(CT) ))
    dp = [[0]*M for _ in range(K)]
    for i in range(M):
        dp[1][i] = accT[-i-1]*CT[i]%Q
    for k in range(1, K-1):
        accT[0] = dp[k][0]
        for i in range(M-1):
            accT[i+1] = (accT[i]+dp[k][i+1])%Q
        for i in range(M):
            dp[k+1][i] = accT[-i-1]*CT[i]%Q
    print(sum(dp[K-1])%Q)
    
if __name__ == '__main__':
    main()


### FIXED CODE ###

Q = 10**9+7
from collections import deque
from itertools import accumulate
#import sys
#input = sys.stdin.readline
def main():
    N, K = map( int, input().split())
    ans = 0
    d = deque()
    e = deque()
    M = int(N**(1/2))*2
    for i in range(1, int(N**(1/2))+1):
        if i**2 == N:
            d.append(i)
            M -= 1
            continue
        d.append(i)
        e.appendleft(N//i)
    T = list(d)+list(e)
    CT = [1]*M
    for i in range(1,M):
        CT[i] = T[i] - T[i-1]
    accT = list( map(lambda x:x%Q, accumulate(CT) ))
    dp = [[0]*M for _ in range(K)]
    for i in range(M):
        dp[1][i] = accT[-i-1]*CT[i]%Q
    for k in range(1, K-1):
        accT[0] = dp[k][0]
        for i in range(M-1):
            accT[i+1] = (accT[i]+dp[k][i+1])%Q
        for i in range(M):
            dp[k+1][i] = accT[-i-1]*CT[i]%Q
    print(sum(dp[K-1])%Q)
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

n = int(input())
ls = list(map(int, input().split()))
ans = 1
for l in ls:
    ans *= l
if (ans > 1000000000000000000):
    print(-1)
else:
    print(ans)

### FIXED CODE ###

def main():
    n = int(input())
    ls = list(map(int, input().split()))
    ans = 1
    if 0 in ls:
        print(0)
        return
    for l in ls:
        ans *= l
        if (ans > 1000000000000000000):
            print(-1)
            return
    print(ans)
    return
if __name__ == '__main__':
    main()
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
#print(N, A)
x = []
y = []
for i in range(N -1):
    amin = min(A)
    A.remove(min(A))
    amax = max(A)
    A.remove(max(A))
    #print(A, amin, amax)
    if i != N - 2:
        amin2 = abs(min(A))
        amax2 = abs(max(A))
        #print(amax2, amin2)
        if i == N - 3:
            if A[0] < 0:
                A.append(amax - amin)
                x.append(amax)
                y.append(amin)
            else:
                A.append(amin - amax)
                x.append(amin)
                y.append(amax)
        else:
            if amax2 > amin2:
                A.append(amin - amax)
                x.append(amin)
                y.append(amax)
            else:
                A.append(amax - amin)
                x.append(amax)
                y.append(amin)
    else:
        A.append(amax - amin)
        x.append(amax)
        y.append(amin)

    #print("A", A)

print(A[0])
#print(x, y)
for i in range(N - 1):
    print(x[i], y[i])

### FIXED CODE ###

import collections
N = int(input())
A = list(map(int, input().split()))
A.sort()
A2 = collections.deque(A)
#print(N, A)
x = [0] * (N-1)
y = [0] * (N-1)
for i in range(N -1):
    amin = A2.popleft()
    amax = A2.pop()
    mainasuflag = 0
    plusflag = 0
    if i != N - 2:
        if A2[0] > 0:
            mainasuflag = 1
        if A2[len(A2) - 1] < 0:
            plusflag = 1
        amin2 = abs(A2[0])
        amax2 = abs(A2[len(A2) -1])
        if i == N - 3:
            if A2[0] > 0:
                A2.appendleft(amin - amax)
                x[i] = amin
                y[i] = amax
            else:
                A2.append(amax - amin)
                x[i] = amax
                y[i] = amin
        else:
            if mainasuflag == 1:
                A2.appendleft(amin - amax)
                x[i] = amin
                y[i] = amax
            elif plusflag == 1:
                A2.append(amax - amin)
                x[i] = amax
                y[i] = amin
            else:
                if amax2 >= amin2:
                    A2.appendleft(amin - amax)
                    x[i] = amin
                    y[i] = amax
                else:
                    A2.append(amax - amin)
                    x[i] = amax
                    y[i] = amin

    else:
        A2.append(amax - amin)
        x[i] = amax
        y[i] = amin

    #print("A", A2, mainasuflag, plusflag)

print(A2[0])
#print(x, y)
for i in range(N - 1):
    print(x[i], y[i])
### BUGGY CODE ###

# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

def main():
    # 約数
    N = ir()
    A = lr()
    A.sort()
    answer = 0
    bl = [False] * (A[-1]+1)

    def make_divisors(n):  # nの約数を列挙
        divisors = []
        for i in range(1, int(n**0.5)+1):
            if n % i == 0:
                divisors.append(i)
                if i != n // i:
                    divisors.append(n//i)
        divisors.sort()
        return divisors

    for i, a in enumerate(A):
        if i < N-1 and a == A[i+1]:
            bl[a] = True
            continue
        divs = make_divisors(a)
        flag = True
        for x in divs:
            if bl[x]:
                flag = False
                break
        bl[a] = True
        if flag:
            answer += 1

    print(answer)

main()

### FIXED CODE ###

# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = lr()
A.sort()
bl = [True] * (A[-1]+1)
answer = 0
for i, a in enumerate(A):
    if i < N-1 and A[i+1] == a:
        pass
    elif bl[a]:
        answer += 1
    if bl[a]:
        bl[a] = False
        next = a + a
        while next <= A[-1]:
            bl[next] = False
            next += a

print(answer)
### BUGGY CODE ###

import random, math
random.seed()
def gen(a, b, num):
    result = set()
    while 1:
        while 1:
            v = random.randint(a, b)//2*2+1
            if v not in result:
                break
        for x in range(3, int(math.sqrt(v))+1, 2):
            if v % x == 0:
                break
        else:
            result.add(v)
            if len(result) == num:
                break
    return result
class RH():
    def __init__(self, s, base, mod):
        self.base = base
        self.mod = mod
        self.rev = pow(base, mod-2, mod)

        l = len(s)
        self.h = h = [0]*(l+1)
        tmp = 0
        for i in range(l):
            num = ord(s[i])
            tmp = (tmp*base + num) % mod
            h[i+1] = tmp
    def calc(self, l, r):
        return (self.h[r] - self.h[l] * pow(self.base, r-l, self.mod) + self.mod) % self.mod
class RRH():
    def __init__(self, s, num=10, primes=None):
        primes = primes or gen(2, 10**3, num)
        MOD = 10**9+7
        self.rhs = [RH(s, p, MOD) for p in primes]
    def calc(self, l, r):
        return [rh.calc(l, r) for rh in self.rhs]

T = input(); P = input()
primes = gen(2, 10**3, 10)
HT = RRH(T, primes=primes)
HP = RRH(P, primes=primes)

pv = HP.calc(0, len(P))
for i in range(len(T)-len(P)+1):
    if HT.calc(i, i+len(P)) == pv:
        print(i)

### FIXED CODE ###

import sys
readline = sys.stdin.readline
write = sys.stdout.write

class KMP:
    def __init__(self, W):
        L = len(W)
        T = [0] * (L+1)
        T[0] = -1
        c = 0
        for p in range(1, L):
            if W[p] == W[c]:
                T[p] = T[c]
            else:
                T[p] = c
                c = T[c]
                while c >= 0 and W[p] != W[c]:
                    c = T[c]
            c += 1
        T[L] = c
        self.T = T
        self.W = W

    def search(self, S):
        W = self.W; T = self.T
        R = []
        LS = len(S); LW = len(W)
        # S[i], W[j]
        i = j = 0
        while i < LS:
            if S[i] == W[j]:
                i += 1; j += 1
                if j == LW:
                    R.append(i-j)
                    j = T[j]
            else:
                j = T[j]
                if j < 0:
                    i += 1
                    j += 1
        return R

def solve():
    T = readline().strip()
    P = readline().strip()
    kmp = KMP(P)
    res = kmp.search(T)
    for p in res:
        write("%d\n" % p)
solve()
### BUGGY CODE ###

N = int(input())
T = [0]*100000
X= [0]*100000
Y= [0]*100000
x = 0
y = 0

for n in range(N):
        T[n],X[n],Y[n] = (map(int, input().split()))

flag = 1
for n in range(N):
    #print(n)
    if flag == 0:
        continue


    if n == 0:
        count = T[n]
    else:
        count = T[n] - T[n-1]
        x = X[n-1]
        y = Y[n-1]
    c = 0
    end = 0
    while True:
        if end == 1:
            break
        s_x = X[n] - x
        s_y = Y[n] - y
        #print(str(x)+' '+str(y))

        if ((s_x >= 0 or s_y >= 0) )and (c!=count):
            if s_x >0:
                x +=1
                c += 1
            elif s_x < 0:
                x -= 1
                c+=1
            elif s_y > 0:
                y +=1
                c += 1
            elif s_y < 0:
                y -= 1
                c+=1
            elif s_x==0:
                c +=2
        elif c==count:
            if (x == X[n] and y ==Y[n]):
                flag = 1
                end=1
            else:
                flag=0
                end =1


if flag == 1:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

N = int(input())
T = [0]*100000
X= [0]*100000
Y= [0]*100000
x = 0
y = 0

for n in range(N):
        T[n],X[n],Y[n] = (map(int, input().split()))

flag = 1
for n in range(N):
    #print(n)
    if flag == 0:
        continue


    if n == 0:
        count = T[n]
    else:
        count = T[n] - T[n-1]
        x = X[n-1]
        y = Y[n-1]
    c = 0
    end = 0
    while True:
        if end == 1:
            break
        s_x = X[n] - x
        s_y = Y[n] - y
    #    print(str(s_x)+' '+str(s_y))

        if ((s_x != 0 or s_y !=0) )and (c!=count):
            if s_x >0:
                x +=1
                c += 1
            elif s_x < 0:
                x -= 1
                c+=1
            elif s_y > 0:
                y +=1
                c += 1
            elif s_y < 0:
                y -= 1
                c+=1
        elif  ((s_x == 0 and s_y == 0) )and (c!=count):
                x +=1
                c +=1
        elif c==count:
            if (x == X[n] and y ==Y[n]):
                flag = 1
                end=1
            else:
                flag=0
                end =1



if flag == 1:
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

N = int(input())
S = str(input())
ans = 0
for i in range(1000):
    t = ""
    x = i
    for j in range(3):
        t += str(x % 10)
        x //= 10

    ti = 0
    for k in range(N):
        if S[k] == t[ti]:
            ti += 1
            if ti == 3:
                break

    if ti == 3:
        ans += 1

print(ans)

### FIXED CODE ###

N = int(input())
S = input()
ans = 0
# 000 - 999 まで全探索
for i in range(1000):
    t = str(i).zfill(3)

    # 1桁目が存在するか
    if t[0] in S:
        t1 = S.index(t[0])
        # 2桁目を1桁目のidx + 1から探す
        if t[1] in S[t1 + 1:]:
            # 1桁目のidx + 2桁目のidx + 1 桁目から3文字目を探す
            t2 = t1 + S[t1 + 1:].index(t[1]) + 1
            if t[2] in S[t2 + 1:]:
                ans += 1

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

#n,d=map(int,input().split())
n=int(input())
a=list(int(input())for _ in range(n))
#print("-----------")
for i in range(n):
        tmp=a[i]
        a[i]=0
        print(max(a))
        a[i]=tmp


### FIXED CODE ###

import copy
#n,d=map(int,input().split())
n=int(input())
a=list(int(input())for _ in range(n))
A=copy.deepcopy(a)
A.sort(reverse=True)
#print("-----------")
for i in range(n):
        if a[i]!=A[0]:
                print(A[0])
        else:
                print(A[1])
### BUGGY CODE ###

import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod = 998244353
INF = 10**18
eps = 10**-7

n,k = map(int,readline().split())
vec = [0]*(n+1)
for i in range(k):
    l,r = map(int,readline().split())
    for j in range(l,r+1):
        vec[j] = 1

to = []

for i in range(1,n+1):
    if vec[i] == 1:
        to.append(i)

dp = [0]*(n+1)
dp[1] = 1
for i in range(1,n+1):
    for j in to:
        if (i+j > n):
            break
        dp[i+j] = (dp[i]+dp[i+j])%mod

print(dp[n])



### FIXED CODE ###

import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod = 998244353
INF = 10**18
eps = 10**-7

n,k = map(int,readline().split())
LR = [list(map(int,readline().split())) for i in range(k)]



dp = [0]*(2*n+10)

imos = [0]*(2*n+10)
dp[1] = 1
for i in range(1,n+1):
    imos[i] = (imos[i-1]+imos[i])%mod
    dp[i] = (dp[i]+imos[i])%mod
    for (l,r) in LR:
        imos[i+l] += dp[i]
        imos[i+r+1] -= dp[i]

print(dp[n])
### BUGGY CODE ###

n = int(input())
length = list(map(int, input().split()))
length = sorted(length)
count = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
               if length[k] < length[i]+length[j]:
                   count += 1
               else:
                   break
                
print(count)

### FIXED CODE ###

import bisect
n = int(input())
length = list(map(int, input().split()))
length = sorted(length)
count = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        insert_index = bisect.bisect_left(length, length[i]+length[j])
        count += insert_index-j-1               
print(count)
### BUGGY CODE ###

N = int(input())
S = input()
R = [i+1 for i in range(N) if S[i] == 'R']
G = [i+1 for i in range(N) if S[i] == 'G']
B = [i+1 for i in range(N) if S[i] == 'B']

ans = 0

for r in R:
    for g in G:
        for b in B:
            a,b,c = sorted([r,g,b])
            if b - a != c - b:
                ans += 1
print(ans)

### FIXED CODE ###

n=int(input())
s=input()
c=s.count
a=c('R')*c('G')*c('B')
for i in range(n):
  for j in range(i+2,n,2):
    if s[i]!=s[i+j>>1]!=s[j]!=s[i]:
      a-=1
print(a)
### BUGGY CODE ###

import sys
import re
readline = sys.stdin.readline
def MAIN():
    T = readline().strip()
    P = readline().strip()
    pat = re.compile(P)
    t = 0
    ans = []
    while True:
        t = pat.search(T, t)
        if t is None:
            break
        ans.append(t.span()[0])
        t = t.span()[0] + 1
    if ans:
        print("\n".join(map(str, ans)))
MAIN()



### FIXED CODE ###

def kmpTable(w):
    lw = len(w)
    nx = [-1] * (lw + 1)
    j = -1
    for i in range(lw):
        while j >= 0 and w[i] != w[j]:
            j = nx[j]
        j += 1
        nx[i + 1] = j
    return tuple(nx)
def kmpSearch(s, w):
    ls = len(s)
    start = 0
    w_idx = 0
    ret = []
    nx = kmpTable(w)
    while start + w_idx < ls:
        if s[start + w_idx] == w[w_idx]:
            w_idx += 1
            if w_idx == len(w):
                ret.append(start)
                start = start + w_idx - nx[w_idx]
                w_idx = nx[w_idx]
        else:
            if w_idx == 0:
                start += 1
            else:
                start = start + w_idx - nx[w_idx]
                w_idx = nx[w_idx]
    return ret
T = input()
P = input()
ans = kmpSearch(T, P)

if ans:
    print(*ans, sep="\n")
#    print("\n".join(map(str, ans)))
### BUGGY CODE ###

N = int(input())
S = input()
while S[0] != 'D':
    S = S[1:]
S = S[::-1]
while S[0] != 'C':
    S = S[1:]
S = S[::-1]

N = len(S)

def cal(k):
    M = 0
    C = 0
    MC = 0
    for i in range(min(k,N)):
        if S[i] == 'M':
            M += 1
        elif S[i] == 'C':
            C += 1
            MC += M
    d = {}
    for i in range(N):
        if S[i] == 'D':
            d[i] = MC
        elif S[i] == 'M':
            M -= 1
            MC -= C
        elif S[i] == 'C':
            C -= 1
        if i+k < N:
            if S[i+k] == 'M':
                M += 1
            elif S[i+k] == 'C':
                C += 1
                MC += M
    res = 0
    for i in d:
        res += d[i]

    return res
        
Q = int(input())
K = list(map(int,input().split()))
for k in K:
    print(cal(k))

### FIXED CODE ###

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

def cal(k):
    M = 0
    C = 0
    MC = 0
    res = 0
    k = min(k,N)
    for i in range(k):
        if S[i] == 'M':
            M += 1
        elif S[i] == 'C':
            C += 1
            MC += M
    for i in range(N-k):
        if S[i] == 'D':
            res += MC
        elif S[i] == 'M':
            M -= 1
            MC -= C
        elif S[i] == 'C':
            C -= 1
        if S[i+k] == 'M':
            M += 1
        elif S[i+k] == 'C':
            C += 1
            MC += M
    for i in range(N-k,N):
        if S[i] == 'D':
            res += MC
        elif S[i] == 'M':
            M -= 1
            MC -= C
        elif S[i] == 'C':
            C -= 1

    return res

Q = int(input())
K = list(map(int,input().split()))
for k in K:
    print(cal(k))
### BUGGY CODE ###

from bisect import*
n,m,*a=map(int,open(0).read().split())
a.sort()
exec('insort(a,a.pop()//2);'*m)
print(sum(a))

### FIXED CODE ###

from heapq import*;n,m,*a=[-int(i)for i in open(0).read().split()];heapify(a);exec('heappush(a,0--heappop(a)//2);'*-m);print(-sum(a))
### BUGGY CODE ###

from numpy import*;B=searchsorted;a,b=loadtxt(open(0),skiprows=1);c=0;l=2**29
while l>1:h=l;l//=2;b%=h;a%=h;y=sort(hstack((b-h,b)));c+=sum(B(y,h-a)-B(y,l-a))%2*l
print(c)

### FIXED CODE ###

from numpy import*;B,I=searchsorted,lambda:int32(input().split());input();a,b=I(),I();c=0
for k in range(29):l=2**k;h=l*2;x,y=a%h,sort(b%h);y=hstack((y-h,y));c+=sum(B(y,h-x)-B(y,l-x))%2*l
print(c)
### BUGGY CODE ###

N = int(input())

color = []
color.append(int(input()))

for i in range(N-1):
  A = int(input())
  for X in range(len(color)):
    if color[X] < A:
      color[X] = A
      X = 10**6
      break
  
  if X != 10**6:
    color.append(A)

print(len(color))

### FIXED CODE ###

from bisect import bisect_left, bisect_right

N = int(input())

color = []
color.append(int(input()))

for i in range(N-1):
  A = int(input())
  
  if color[-1] >= A:
    color.append(A)

  else:
    color.reverse()
    l = bisect_left(color,A)
    color[l-1] = A
    color.reverse()


print(len(color))
### BUGGY CODE ###

n, k = [int(x) for x in input().split()]
# ps = [int(x) for x in input().split()]

calc_expectedval = (lambda p: sum(range(p+1)) / p)
expected_vals = [calc_expectedval(int(x)) for x in input().split()]

# expected_vals = [sum(range(p+1)) / p for p in ps]

maxval = 0
for i in range(n - k + 1):
  candidate = sum(expected_vals[i:i+k])
  if candidate > maxval:
    maxval = candidate

print(maxval)


### FIXED CODE ###

n, k = [int(x) for x in input().split()]
# ps = [int(x) for x in input().split()]

continuous_sum = (lambda n: (n + 1) * (n // 2) + (0 if n %2 == 0 else n // 2 + 1))
calc_expectedval = (lambda p: continuous_sum(p) / p)
expected_vals = [calc_expectedval(int(x)) for x in input().split()]

prevval = sum(expected_vals[0:0+k])
maxval = prevval
for i in range(n - k):
  candidate = prevval - expected_vals[i] + expected_vals[i + k]
  if candidate > maxval:
    maxval = candidate
  prevval = candidate

print(maxval)
### BUGGY CODE ###

N = int(input())
life = list(map(int, input().split()))
min = 1000000000000
while len(life) >1:
    for i in life:
        if i < min: min = i
    life_array=[]
    for i in life:
        if i%min != 0 and i not in life_array: life_array.append(i%min)
    life = [min] + life_array

print(life[0])

### FIXED CODE ###

N = int(input())
life = list(map(int, input().split()))
while len(life) >1:
    life.sort()
    life_array = [life[0]] + [i%life[0] for i in life if i%life[0] !=0]
    life = life_array
    #for i in life_array:
        #if i not in life:
            #life.append(i)
 
print(life[0])