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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

ozo = set([-1, 0, 1])
x = int(input())
for j in range(10 ** 7):
  c = x + j ** 5 # プラス
  f = factorization(c)
  if c in ozo:
    print(c, j)
    exit()
  if len(f) == 1 and f[0][1] == 5:
    print(f[0][0], j)
    exit()
  c = x - j ** 5 # マイナス
  if c in ozo:
    print(c, j)
    exit()
  if c < 0:
    c *= -1
    f = factorization(c)
    if len(f) == 1 and f[0][1] == 5:
      print(-f[0][0], -j)
      exit()
  else:
    f = factorization(c)
    if len(f) == 1 and f[0][1] == 5:
      print(f[0][0], -j)
      exit()

### FIXED CODE ###

x = int(input())
for i in range(-150, 150):
  for j in range(-150, 150):
    if i ** 5 - j ** 5 == x:
      print(i, j)
      exit()
### BUGGY CODE ###

N = int(input())

for i in range(1,N+1):
    ans = 0
    L = int(i**0.5)
    for x in range(1,L+1):
        for y in range(1,L+1):
            for z in range(1,L+1):
                num = x*x+y*y+z*z+x*y+y*z+z*x
                if num == i:
                    ans += 1
    print(ans)
        

### FIXED CODE ###

N = int(input())
A = [0]*(N+1)
L = int(N**0.5)+1
for x in range(1,L+1):
    for y in range(1,L+1):
        for z in range(1,L+1):
            num = x*x+y*y+z*z+x*y+y*z+z*x
            if num <= N:
                A[num] += 1
    

for i in range(1,N+1):
    print(A[i])
### BUGGY CODE ###

N = int(input())
A = [int(n) for n in input().split()]
ans = 0
dp = []
s = 0
for a in A[::-1]:
    s += a
    dp.insert(0, s)
for i in range(0, N-1):
    ans += A[i]*dp[i+1]
print(ans%(10**9+7))


### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
mod = 10**9 + 7
sum_A = sum(A)
ans = 0
for i in A:
  ans += i * (sum_A := sum_A - i) % mod
  
print(ans % mod)
### BUGGY CODE ###

N = int(input())
A = [int(input()) for i in range(N)]

for i in range(N):
    X = A[0:i] + A[i+1:]
    Y = set(X)
    print(max(Y))

### FIXED CODE ###

N = int(input())
A = [int(input()) for i in range(N)]

B = A[:]

a1 = max(A)
A.remove(a1)
a2 = max(A)

for i in range(N):
    if B[i] != a1:
        print(a1)
    else:
        print(a2)
### BUGGY CODE ###


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

A_list = list(map(int,input().split()))

ans = 0

for i in range(M):
    bi,ci = map(int,input().split())
    for j in range(bi):
        if min(A_list) < ci:
            A_list[A_list.index(min(A_list))] = ci

print(sum(A_list))


### FIXED CODE ###


#AのリストにCのリストを加えて大きい順に並べ替えてNまでの和を求める
N,M = map(int,input().split())

#Aの入力
A_list = list(map(int,input().split()))

C_list = []

#Cのリストに追加する
for i in range(M):
    bi,ci = map(int,input().split())
    C_list.append([bi,ci])

#C_listをCの値でソート
C_list=sorted(C_list, reverse=True, key=lambda x:x[1])

count = 0
for bi,ci in C_list:
    count += bi
    if count > N:
        #countがNより大きくなったらNより大きくなった分だけ使う
        bi = N - count + bi
    A_list.extend([ci]*bi)

#A_Listを大きい順に並べ替える
A_list=sorted(A_list,reverse=True)

#N番目までの総和を求める
print(sum(A_list[0:N]))
### BUGGY CODE ###

k, s = map(int, input().split())
cnt = 0
for x in range(s+1):
    for y in range(s+1):
        for z in range(s+1):
            if 0 <= x <= k and 0 <= y <= k and 0 <= z <= k and x + y + z == s:
                cnt += 1
print(cnt)

### FIXED CODE ###

#review

def solve(k, s):
    ans = 0
    for x in range(k+1):
        for y in range(k+1):
            z = s - x - y
            if 0 <= z <= k:
                ans += 1
            elif z < 0:
                break
    return ans
 
 
def main():
    k, s = map(int, input().split())
    ans = solve(k, s)
    print(ans)
 
 
if __name__ == '__main__':
    main()
### BUGGY CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

def invalid(a, b):
    if a > b:
        a, b = b, a
    return (b % a == 0 and ((b - a) // 2) % a != 0)

def main():
    N, M = map(int, input().split())
    A = list(set(map(int, input().split())))
    A.sort()
    if len(A) == 1:
        l = A[0]
    else:
        if invalid(A[0], A[1]):
            return 0
        l = lcm(A[0], A[1])
        for i in A[2:]:
            if invalid(l, i):
                return 0
            if l % i == 0:
                continue
            l = lcm(l, i)
    return (M + l // 2) // l

print(main())


### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

def invalid(a, b):
    if a > b:
        a, b = b, a
    return (b % a == 0 and ((b - a) // 2) % a != 0)

def main():
    N, M = map(int, input().split())
    A = list(set(map(int, input().split())))
    A.sort(reverse=True)
    if len(A) == 1:
        l = A[0]
    else:
        if invalid(A[0], A[1]):
            return 0
        l = lcm(A[0], A[1])
        for i in A[2:]:
            if invalid(l, i):
                return 0
            if l % i == 0:
                continue
            if l // 2 > M:
                return 0
            l = lcm(l, i)
    return (M + l // 2) // l

print(main())
### BUGGY CODE ###

n, m = list(map(int, input().split()))
lisA = [int(i) for i in input().split()]
#print(n, m)
#print(lisA)

lisA.sort(reverse=True)
half0 = lisA[0] / 2
count = 0
for i in range(m):
	if (count > n - 1):
		count = 0
	if (lisA[count] < half0):
		lisA.sort(reverse=True)
		half0 = lisA[0]
		count = 0
	lisA[count] //= 2
	count += 1
print(sum(lisA))

### FIXED CODE ###

n, m = list(map(int, input().split()))
lisA = [int(i) for i in input().split()]
#print(n, m)
#print(lisA)

lisA.sort(reverse=True)
half0 = lisA[0] // 2
count = 0
for i in range(m):
	if (count > n - 1):
		count = 0
	if (lisA[count] < half0):
		lisA.sort(reverse=True)
		half0 = lisA[0] // 2
		count = 0
	lisA[count] //= 2
	count += 1
print(sum(lisA))
### BUGGY CODE ###

n  = int(input())
m  = 10 ** 9 + 7
xs = [int(x) for x in input().split()]
bs = [0] * 60
b  = 1

for x in xs:
	e = 0
	
	while 0 < x:
		if x % 2 == 1:
			bs[e] += 1
			
		e  += 1
		x //= 2

b = 1
r = 0

for i in range(0, 60):
	r  += ((n - bs[i]) * bs[i]) * b
	b <<= 1
	
print(r % m)


### FIXED CODE ###

n  = int(input())
m  = 10 ** 9 + 7
xs = [int(x) for x in input().split()]
bs = [0] * 60
b  = 1

for x in xs:
	e = 0
	
	while 0 < x:
		if x % 2 == 1:
			bs[e] += 1
			
		e  += 1
		x //= 2

b = 1
r = 0

for i in range(0, 60):
	r  += ((n - bs[i]) * bs[i]) * b
	b <<= 1
	
print(r % m)
### BUGGY CODE ###

import numpy as np

n, m = map(int, input().split())
A = np.array(list(map(int, input().split())))

ans = 0
for l in range(n):
    for r in range(l, n):
        if A[l:r + 1].sum() % m == 0:
            ans += 1
print(ans)

### FIXED CODE ###

import numpy as np
from collections import Counter
import math

n, m = map(int, input().split())
A = np.array(list(map(int, input().split())))


def combinations(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

acc_sum = [0]
tmp = 0
for i in range(n):
    tmp += A[i]
    acc_sum.append(tmp % m)
acc_sum = Counter(acc_sum)
ans = 0
for k in acc_sum:
    if acc_sum[k] >= 2:
        ans += combinations(acc_sum[k], 2)
print(ans)
### BUGGY CODE ###

def main():
    X, Y = map(int, input().split())
    Z = 0

    while X >= 0:
        if 2 * X + 4 * Z == Y:
            print("Yes")
            return
        elif 2 * X + 4 * Z < Y:
            X -= 1
            Z += 1
    print("No")


if __name__ == "__main__":
    main()


### FIXED CODE ###

from numba import jit


@jit
def solve(X, Y, Z):
    while X >= 0:
        if 2 * X + 4 * Z == Y:
            return True
        elif 2 * X + 4 * Z < Y:
            X -= 1
            Z += 1
        else:
            return False
    return False


def main():
    X, Y = map(int, input().split())
    Z = 0

    if solve(X, Y, Z):
        print("Yes")
    else:
        print("No")


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

n, m = map(int, input().split())
A = []
A.append([0 for _ in range(m+2)])
for _ in range(n):
    A.append([0] + [1 for _ in range(m)] + [0])
A.append([0 for _ in range(m+2)])

for i in range(1, n+1):
    for j in range(1, m+1):
        A[i][j-1] *= -1
        A[i][j] *= -1
        A[i][j+1] *= -1
        A[i+1][j-1] *= -1
        A[i+1][j] *= -1
        A[i+1][j+1] *= -1
        A[i-1][j-1] *= -1
        A[i-1][j] *= -1
        A[i-1][j+1] *= -1
        
import itertools
print(list(itertools.chain.from_iterable(A)).count(-1))

### FIXED CODE ###

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

import itertools
print(abs(m*n - ((n-1)*2 + (m-1)*2)))
### BUGGY CODE ###

from collections import deque,defaultdict
H,W = map(int,input().split())
s = [["#"]*(W+2)] + [list("#"+input()+"#") for _ in range(H)] + [["#"]*(W+2)]
Q = deque([(1,1,1)])
cnt = 0
for S in s[1:-1]:
    cnt += S.count(".")

while Q:
    x,y,d = Q.popleft()
    s[x][y] = "#"
    if x == H and y == W:
        route = d
        break
    for dx,dy in [(1,0),(-1,0),(0,1),(0,-1)]:
        if s[x+dx][y+dy] == ".":
            Q.append((x+dx,y+dy,d+1))
else:
    print(-1)
    exit()

print(cnt-route)


### FIXED CODE ###

from collections import deque,defaultdict
H,W = map(int,input().split())
s = [["#"]*(W+2)] + [list("#"+input()+"#") for _ in range(H)] + [["#"]*(W+2)]
Q = deque([(1,1,1)])
cnt = 0
for S in s[1:-1]:
    cnt += S.count(".")

while Q:
    x,y,d = Q.popleft()
    s[x][y] = "#"
    if x == H and y == W:
        route = d
        break
    for dx,dy in [(1,0),(-1,0),(0,1),(0,-1)]:
        if s[x+dx][y+dy] == ".":
            Q.append((x+dx,y+dy,d+1))
            s[x+dx][y+dy] = "#"
else:
    print(-1)
    exit()

print(cnt-route)
### BUGGY CODE ###

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

ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        ans += A[i] * A[j]

print(ans % int(1e9 + 7))


### FIXED CODE ###

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

s = sum(A)
ans = 0
for i in range(n-1):
    s -= A[i]
    ans = (ans + A[i] * s) % int(1e9 + 7)

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

import math

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

# 以下を割引券の枚数分繰り返す
# 品物の値段を高い順にソート
# 最も高い品物に割引券を1枚使う
for i in range(M):
	A.sort(reverse=True)
	A[0] = math.floor(A[0] / 2)

print(sum(A))

### FIXED CODE ###

import heapq

N, M = map(int, input().split())
A = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(A)

# 以下を割引券の枚数分繰り返す
# 最も高い品物に割引券を1枚使う
for _ in range(M):
	min = heapq.heappop(A)
	heapq.heappush(A, (-1) * (-min // 2))

print(-sum(A))
### BUGGY CODE ###

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

q = int(input())
list_Q = [ list(map(int,input().split(" "))) for i in range(q)]

num = pow(10,5)
list_PRE = [0]*(2*num+10)
list_PRE[2] = 1
for i in range(1, 2*num+10, 2):
    if len(prime_factorize(i)) == 1:
        list_PRE[i] = 1

list_2017 = [0]*(2*num+10)
for i in range(1, num+1, 2):
    if list_PRE[i] == 1 and list_PRE[(i+1)//2] == 1:
        list_2017[i] = 1

for i, j in list_Q:
    print(sum(list_2017[i:j+1]))

### FIXED CODE ###

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

q = int(input())
list_Q = [ list(map(int,input().split(" "))) for i in range(q)]

num = pow(10, 5)
list_PRE = [0]*(2*num+10)
list_PRE[2] = 1
for i in range(1, 2*num+10, 2):
    if len(prime_factorize(i)) == 1:
        list_PRE[i] = 1

list_2017 = [0]*(2*num+10)
for i in range(1, num+1, 2):
    if list_PRE[i] == 1 and list_PRE[(i+1)//2] == 1:
        list_2017[i] = 1

list_ANS = []
cnt = 0
for i in list_2017:
    if i == 1:
        cnt += 1
        list_ANS.append(cnt)
    else:
        list_ANS.append(cnt)

for i, j in list_Q:
    print(list_ANS[j]-list_ANS[i-1])
### BUGGY CODE ###

#!/usr/bin/env python3

import math
a, b, n = list(map(int, input().split()))

ans = 0
for x in range(1, min(b+1, n+1)):
    ans_tmp = math.floor(a*x/b) - a * math.floor(x/b)
    ans = max(ans, ans_tmp)
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3

import math
a, b, n = list(map(int, input().split()))

if b-1 <= n:
    x = b-1
    ans = math.floor(a*x/b) - a * math.floor(x/b)
else:
    x = n
    ans = math.floor(a*x/b) - a * math.floor(x/b)
print(ans)
### BUGGY CODE ###

n,d,a = map(int,input().split())
event = []
for i in range(n):
  x,h = map(int,input().split())
  h = (h-1)//a + 1
  event.append([x,0,i,h])
for i in range(n):
  tmp = event[i][0] + 2 * d
  event.append([tmp,1,i,0])
event.sort()
#print(event)
use = [0 for _ in range(n)]
now = 0
ans = 0
for j in range(2*n):
  x,d,i,h = event[j]
  if d == 0:
    if h <= now:
      pass
    else:
      h -= now
      now += h
      use[i] = h
      ans += h
  else:
    now -= use[i]
  #print(x,d,i,ans,now)
print(ans)

### FIXED CODE ###

n,d,a = map(int,input().split())
raw = []
event = []
for i in range(n):
  x,h = map(int,input().split())
  event.append([x,0,i,h])
for i in range(n):
  tmp = event[i][0] + 2 * d
  event.append([tmp,1,i])
event.sort()
#print(event)
use = [0 for _ in range(n)]
now = 0
ans = 0
for j in range(2*n):
  x,d,i = event[j][:3]
  if d == 0:
    h = event[j][3]
    if h <= now * a:
      pass
    else:
      h -= now * a
      tmp = (h-1)//a+1
      now += tmp
      use[i] = tmp
      ans += tmp
  else:
    now -= use[i]
  #print(x,d,i,ans,now)
print(ans)
### BUGGY CODE ###

import sys
import fractions
input = sys.stdin.readline
N = int(input())
list_A = list(map(int, input().split()))
ans = list_A[0]
sum = 0
if list_A[0] == list_A[-1]:
    print(N%(7+10**9))
else:
    for i in range(1, N):
        ans *= list_A[i] // fractions.gcd(ans, list_A[i])
    for a in list_A:
        sum += ans//a
    print(sum%(7+10**9))

### FIXED CODE ###

import sys
import fractions
input = sys.stdin.readline
N = int(input())
list_A = list(map(int, input().split()))
ans = list_A[0]
sum = 0
for i in range(1, N):
  ans = ans * list_A[i] // fractions.gcd(ans, list_A[i])
for a in list_A:
  sum += ans//a
print(sum%(7+10**9))
### BUGGY CODE ###

#coding: UTF-8

def is_prime(target_num):
    if target_num  == 2:
        return True
    elif target_num % 2 == 0:
        return False
    for i in range(3, target_num / 2 + 1, 2):
        if target_num % i == 0:
            return False
    return True

def count_prime_numbers(target_num):
    prime_count = 0
    for i in range(2, target_num + 1):
        if is_prime(i):
            prime_count += 1
    return prime_count

while True:
    try:
        input_str = raw_input()
    except EOFError:
        break
    
    print count_prime_numbers(int(input_str))

### FIXED CODE ###

max_n = 999999
prime_list = [1] * (max_n + 1)

# 0, 1は素数ではない
prime_list[0:2] = [0, 0]

# 
for i in range(2, int(max_n**0.5) + 1):
    if prime_list[i] == 1:
        prime_list[i**2::i] = [0] * len(prime_list[i**2::i])

while True:
    try:
        n = int(input())
        print(sum(prime_list[:n + 1]))

    except EOFError:
        break
### BUGGY CODE ###

from functools import reduce
# from math import gcd

N, X = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]

def main():
    ds = list(map(lambda n: abs(X - n), P))
    # ans = reduce(lambda a, b: gcd(a, b), ds)
    d = min(ds)
    while d > 0:
        if all(map(lambda distance: distance % d == 0, ds)) == True:
            break
        d = d - 1
    ans = d
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

from functools import reduce
from fractions import gcd

N, X = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]

def main():
    ds = list(map(lambda n: abs(X - n), P))
    ans = reduce(lambda a, b: gcd(a, b), ds)
    print(ans)

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

h,n,*L=map(int,open(0).read().split())
dp=[0]+[9e9]*h
for a,b in zip(*[iter(L)]*2):
	for i in range(h):
		dp[min(i+a,h)]=min(dp[min(i+a,h)],dp[i]+b)
print(dp[h])

### FIXED CODE ###

h,n,*L=map(int,open(0).read().split())
dp=[float('inf')]*(h+10100)
dp[0]=0
for a,b in zip(*[iter(L)]*2):
    for i in range(h):
        t=dp[i]+b
        if t<dp[i+a]:
            dp[i+a]=dp[i]+b
print(min(dp[h:]))
### BUGGY CODE ###

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

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
s = 1
f = 1
x = 1000000000000000000
l.sort()
if l[0]==0:
  print(0)
elif l[0]==1 and l[-1]==1:
  print(1)
else:
  l = l[::-1]
  for i in l:
      s *= i
      if s>x:
          print(-1)
          f = 0
          break
  if f==1:
    print(s)
### BUGGY CODE ###

# reference https://maspypy.com/atcoder-%e5%8f%82%e5%8a%a0%e6%84%9f%e6%83%b3-2019-02-09abc-154
from functools import lru_cache

N = int(input())
K = int(input())


# @lru_cache(None)
def F(N, K):
    # print("NK", N, K)
    """N以下で0でないものがちょうどK個。0を含める"""
    # assert N >= 0
    if N < 10:
        if K == 0:
            return 1
        if K == 1:
            return N
        return 0  # 求める数字は作れない
    q, r = divmod(N, 10)
    # print("qr", q, r)
    ret = 0
    if K >= 1:  # 1 の位が nonzero (1 の位で 0 でない数字 を消費するので、第 2 引数は K - 1)
        ret += F(q, K-1) * r  # smaller than 1 の位
        ret += F(q-1, K-1) * (9-r)  # bigger than 1 の位
    ret += F(q, K)  # 1の位が zero (1 の位で 0 でない数字 を消費していないので、第 2 引数は K)
    return ret


print(F(N, K))


### FIXED CODE ###

# reference https://maspypy.com/atcoder-%e5%8f%82%e5%8a%a0%e6%84%9f%e6%83%b3-2019-02-09abc-154
from functools import lru_cache

N = int(input())
K = int(input())


@lru_cache(None)
def F(N, K):
    # print("NK", N, K)
    """N以下で0でないものがちょうどK個。0を含める"""
    # assert N >= 0
    if N < 10:
        if K == 0:
            return 1
        if K == 1:
            return N
        return 0  # 求める数字は作れない
    q, r = divmod(N, 10)
    # print("qr", q, r)
    ret = 0
    if K >= 1:  # 1 の位が nonzero (1 の位で 0 でない数字 を消費するので、第 2 引数は K - 1)
        ret += F(q, K-1) * r  # smaller than 1 の位
        ret += F(q-1, K-1) * (9-r)  # bigger than 1 の位
    ret += F(q, K)  # 1の位が zero (1 の位で 0 でない数字 を消費していないので、第 2 引数は K)
    return ret


print(F(N, K))
### BUGGY CODE ###

from collections import deque
import sys

def main():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    edges = [[] for _ in range(N)]
    for _ in range(M):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        edges[a].append(b)
        edges[b].append(a)

    visited = [False] * N
    rooms = [-1] * N
    def bfs(u):
        q = deque()
        q.append((u, -1))
        while 0 < len(q):
            (v, p) = q.popleft()
            visited[v] = True
            if rooms[v] == -1 and p != -1:
                rooms[v] = p
            for e in edges[v]:
                if visited[e]:
                    continue
                q.append((e, v))

    bfs(0)
    print("Yes")
    for x in rooms[1:]:
        print(x + 1)

if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import deque

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

rooms = [-1] * N
def bfs(u):
    q = deque()
    q.append(u)
    while 0 < len(q):
        v = q.popleft()
        for e in edges[v]:
            if rooms[e] == -1:
                rooms[e] = v + 1
                q.append(e)

bfs(0)
print("Yes")
print(*rooms[1:], sep="\n")
### BUGGY CODE ###

n = int(input())
if n%2 == 1:
    print(0)
else:
    num = 1
    counter = 0
    for i in range(2, n, 2):
        num *= i
    for j in range(1, n):
        if num%pow(10, j) == 0:
            counter+=1
        else:
            break
    print(counter)


### FIXED CODE ###

n = int(input())
if n%2 == 1:
    print(0)
else:
    counter = 0
    for i in range(1, n):
        num = n/pow(5, i)
        if num >= 1:
            counter += (n//pow(5, i))//2
        else:
            break
    print(counter)
### BUGGY CODE ###

import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

import string

def main():
    n = i_input()
    a = i_list()
    b = []
    for i,k in enumerate(a):
        if i%2==0:
            b.append(k)
        else:
            b.insert(0,k)
    if len(a)%2==0:
        print(" ".join(map(str, b)))
    else:
        print(" ".join(map(str, reversed(b))))



if __name__=="__main__":
    main()


### FIXED CODE ###

import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

import string

def main():
    n = i_input()
    a = i_list()
    even = []
    odd = []
    for i,k in enumerate(a):
        if i%2==0:
            even.append(k)
        else:
            odd.append(k)

    even.reverse()
    even.extend(odd)
    if n%2==0:
        even.reverse()
    print(" ".join(map(str, even)))



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

# N = int(input())
import sys
from functools import lru_cache

sys.setrecursionlimit(100000)


N, K = [int(i) for i in input().split()]
h = [0] + [int(i) for i in input().split()]


@lru_cache(maxsize=None)
def solve(n):
    if n <= 1:
        return 0
    cost = []
    for i in range(1, K+1):
        if n > i:
            cost.append(solve(n-i) + abs(h[n] - h[n-i]))
    return min(cost)

print(solve(N))




### FIXED CODE ###

# N = int(input())


N, K = [int(i) for i in input().split()]
h = [0] + [int(i) for i in input().split()]
INF = 10 ** 9
dp = [INF for i in range(N+1)]
dp[1] = 0
for j in range(1, N+1):
    for i in range(1, K+1):
        if j > i:
            dp[j] = min(dp[j], dp[j-i] + abs(h[j] - h[j-i]))

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

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

row_x = input().split()
for i in range(m):
    row_x[i] = int(row_x[i])

if n >= m:
    print(0)
else:
    difference = []
    x = sorted(row_x)

    for i in range(m-1):
        difference.append(x[i+1]-x[i])

    for i in range(n-1):
        difference.remove(max(difference))

    print(sum(difference))

### FIXED CODE ###

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

if n >= m:
    print(0)
    exit()
else:
    difference = []
    x.sort()
 
    for i in range(m-1):
        difference.append(x[i+1]-x[i])
 
    difference.sort()
 
    print(sum(difference[:m-n]))
### BUGGY CODE ###

N = int(input())
str = "Christmas"

if N != 25:
	while N >= 22:
		str += " Eve"
        
print(str)
  

### FIXED CODE ###

N = int(input())
str = "Christmas"
 
if N != 25:
	while N < 25:
		str += " Eve"
		N += 1
        
print(str)