Harryxun/stf_run huggingface dataset:
import math

N = int(raw_input())
CSF = [map(float, raw_input().split()) for _ in range(N-1)]

for i in range(N-1):
    ans = CSF[i][0] + CSF[i][1]
    for j in range(i+1, N-1):
        C, S, F = CSF[j][0], CSF[j][1], CSF[j][2]
        if t < ans:
            n = math.ceil((ans - S) / F)
            ans = C + S + u * n
        else:
            ans = C + S
 
    print int(ans)

print 0

### FIXED CODE ###

# coding: utf-8
import math

N = int(raw_input())
CSF = [map(float, raw_input().split()) for _ in range(N-1)]

for i in range(N-1):
    ans = CSF[i][0] + CSF[i][1]
    for j in range(i+1, N-1):
        s, t, u = CSF[j][0], CSF[j][1], CSF[j][2]
        if t < ans:
            n = int(math.ceil((ans - t) / u))
            ans = int(s + t + u * n)
        else:
            ans = s + t

    print int(ans)

print 0
i=0
while 1:
    x = raw_index()
    i++
    print "Case" i":"x
    break()

### FIXED CODE ###


i=0
while 1:
    x = raw_input()
    if x == "0":
        break
    i = i+1
    print "Case %s: %s" %(i,x)
N , K = map(int, input().split())
s = input()

print(s[:K-1]+s[K].lower()+s[K:])


### FIXED CODE ###

N , K = map(int, input().split())
s = input()
o = []
for i in range(N):
  if i == K - 1:
    o.append(s[i].lower())
  else:
    o.append(s[i])

print("".join(o))
n,a = map(int,input().split())
print(n * n - a)

### FIXED CODE ###

n = int(input())
a = int(input())
print(n * n - a)
import math 
while 1 :
	e = int(raw_input())
	if e == 0:
		break
	z = 0
	m = e
	while math.pow(z,3) <= e:
		y = 0
		while y ** 2 <= e - math.pow(z,3):
			m = min(e + y + z - y**2 - math.pow(z,3), m)
			y += 1
		z += 1
	print y, z
	print int(m)
quit()

### FIXED CODE ###

from math import sqrt
while 1 :
	e = int(raw_input())
	if e == 0:
		break
	z = 0
	m = float("inf")
	while z ** 3 <= e:
		y = int(sqrt(e - z**3))
		m = min(m, e  - y**2 - z**3 + y + z)
		z += 1
	print int(m)
d=input()
a,b=map([d[:2],d[2:]])
temp=[]
for i in [a,b]:
    if 1 <= i <=12:
        temp.append(2)
    elif 0 <= i <= 99:
        temp.append(1)
    else:
        temp.append(0)

if sum(temp) == 4:
    print('AMBIGUOUS')
elif sum(temp) == 3:
    if temp[0]==2:
        print('MMYY')
    else:
        print('YYMM')
else:
    print('NA')

### FIXED CODE ###

d=input()
a,b=map(int, [d[:2],d[2:]])
temp=[]
for i in [a,b]:
    if 1 <= i <=12:
        temp.append(2)
    elif 0 <= i <= 99:
        temp.append(1)
    else:
        temp.append(0)

if sum(temp) == 4:
    print('AMBIGUOUS')
elif sum(temp) == 3:
    if temp[0]==2:
        print('MMYY')
    else:
        print('YYMM')
else:
    print('NA')
N, K = mapt(int, input().split())

print(N-K+1)

### FIXED CODE ###

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

print(N-K+1)
while True:
	d = int(input())
	ans = 0
	x = d
	while x < 600:
		ans += (x**2)*dx += d
	print(ans)


### FIXED CODE ###

while True:
	try: d = int(input())
	except: break
	print(sum([(i*d)**2*d for i in range(600//d)]))
n = raw_input()
n = int(n)
minv = raw_input()
minv = iny(minv)
maxv = -1000000000
  
for j in range(n-1):
  num = raw_input()
  num = int(num)  
  diff = num - minv
  if maxv < diff:
    maxv = diff
  if num < minv:
    minv = num
  
print maxv

### FIXED CODE ###

n = raw_input()
n = int(n)
minv = raw_input()
minv = int(minv)
maxv = -1000000000
  
for j in range(n-1):
  num = raw_input()
  num = int(num)  
  diff = num - minv
  if maxv < diff:
    maxv = diff
  if num < minv:
    minv = num
  
print maxv
# (c) midandfeed
import math
r = int(input())
print("{0:.6f} {0:.6f}".format( math.pi*(pow(r,2)), math.pi*(2*r) ))

### FIXED CODE ###

# (c) midandfeed
import math
r = float(input())
area = math.pi * (pow(r,2))
circ = math.pi * 2 * r
print("{} {}".format(area, circ))
x=(input())
print(x*x*x)


### FIXED CODE ###

x=int(input())
print(x*x*x)
n,m=map(int,input().split())
lst=[]
for i in range(m):
  P,Y=map(int,input().split())
  lst.append([P,Y])
lst.sort(key=lambda x:(x[0],x[1]))
lst[0][1]=1
for j in range(m-1):
  if lst[j][0]==lst[j+1][0]:
    lst[j+1][1]=lst[j][1]+1
  else:
    lst[j+1][1]=1
def plus0(s):
  while len(s)<6:
    s='0'+s
for k in range(m):
  print(plus0(str(lst[k][0]))+plus0(str(lst[k][1])))
  
  





### FIXED CODE ###

n,m=map(int,input().split())
lst=[]
for i in range(m):
  p,y=map(int,input().split())
  lst.append([i,p,y])
lst.sort(key=lambda x:(x[1],x[2]))
j=1
Lst=[]
for i in range(m):
  if lst[i][1]==lst[min(m-1,i+1)][1]:
    s=str(lst[i][1])
    t=str(j)
    u=s.zfill(6)+t.zfill(6)
    j+=1
    Lst.append([lst[i][0],u])
  else:
    s=str(lst[i][1])
    t=str(j)
    u=s.zfill(6)+t.zfill(6)
    j-=j-1
    Lst.append([lst[i][0],u])
Lst.sort(key=lambda x:x[0])
for k in range(m):
  print(Lst[k][1])
s=input()
n=0
for i in range(3):
    if s[i]==s[i+1]:
        n+=1
    else:
        n+=0
if n>0
    print('Bad')
else:
    print('Good')

### FIXED CODE ###

s=input()
n=0
for i in range(3):
    if s[i]==s[i+1]:
        n+=1
    else:
        n+=0
if n>=1:
    print('Bad')
else:
    print('Good')
n = int(input())
x = input()
ones = 0
for i in x:
    if i=='1':
        ones += 1
mods = [0, 0]
for i in range(n):
    if x[n-i-1]=='1':
        if ones>0:
            mods[0] += pow(2, i, ones-1)
        if ones<n:
            mods[1] += pow(2, i, ones+1)
mods[0] %= ones-1
mods[1] %= ones+1
def f(x):
    if x==0:
        return 1
    cnt = 1
    while x>0:
        p = bin(x).count('1')
        x %= p
        cnt += 1
    return cnt
for i in range(n-1, -1, -1):
    if x[n-i-1]=='1':
        init = (mods[0] - pow(2, i, ones-1))%(ones-1)
    else:
        init = (mods[1] + pow(2, i, ones+1))%(ones+1)
    if x[n-i-1]=='1' and ones==1:
        print(0)
    else:
        print(f(init))

### FIXED CODE ###

n = int(input())
x = input()
ones = 0
for i in x:
    if i=='1':
        ones += 1
mods = [0, 0]
for i in range(n):
    if x[n-i-1]=='1':
        if ones>1:
            mods[0] += pow(2, i, ones-1)
        mods[1] += pow(2, i, ones+1)
if ones>1:
    mods[0] %= ones-1
mods[1] %= ones+1
def f(x):
    if x==0:
        return 1
    cnt = 1
    while x>0:
        p = bin(x).count('1')
        x %= p
        cnt += 1
    return cnt
for i in range(n-1, -1, -1):
    if x[n-i-1]=='1' and ones==1:
        print(0)
        continue
    if x[n-i-1]=='1':
        init = (mods[0] - pow(2, i, ones-1))%(ones-1)
    else:
        init = (mods[1] + pow(2, i, ones+1))%(ones+1)
    print(f(init))
#!/usr/bin/env python3

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

F12 = []

for i in range(1, B):
    x = i
    f1 = int(A*x/B) 
    f2 = A * int(x/B)
    F12.append(f1-f2)

if N < B:
    print(F12[N-1])
else:
    print(F12[-1])


### FIXED CODE ###

#!/usr/bin/env python3

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

f1 = 0
f2 = 0
if N >=B:
    f1 = int(A*(B-1)/B)
    f2 = A*int((B-1)/B)
else:
    f1 = int(A*N/B)
    f2 = A*int(N/B)

ans = f1-f2
print(ans)
def calc():
    summ  = sum(A)
    #print(summ)
    
    low = summ / (4*M)
    #print(low)

    newlist = [i for i in A if i >= low]
    #print(newlist)

    num = len(newlist)
    #print(num)

    if M <= num:
        print ("Yes")
    else:
        print ("No")

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

#N, M = 5, 2
#A = [110, 2, 20, 10, 0]
calc()


### FIXED CODE ###

#def calc():
    #summ  = sum(A)
    #print(summ)
    
    #low = summ / (4*M)
    #print(low)

    #newlist = [i for i in A if i >= low]
    #print(newlist)

    #num = len(newlist)
    #print(num)

    #if M <= num:
        #print ("Yes")
    #else:
        #print ("No")

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

#N, M = 5, 2
#A = [110, 2, 20, 10, 0]
#calc()

S = sum(A)
cnt = 0

for i in A:
    if i >= S / (4*M):
        cnt += 1
if cnt >= M:
    print("Yes")
else:
    print("No")
N = int(input())
lst = list(map(int, input().split()))
S = sum(lst)
ans = []

for i in range(2, N, 2):
  S -= 2 *lst[i-1]
  
ans.append(S)

for i in range(1, N):
  ans.append(2 * lst[i-1] - ans[i-1])
print("".join(ans))

### FIXED CODE ###

N = int(input())
lst = list(map(int, input().split()))
S = sum(lst)
ans = []

for i in range(2, N, 2):
  S -= 2 *lst[i-1]
  
ans.append(S)

for i in range(1, N):
  ans.append(2 * lst[i-1] - ans[i-1])

s = " ".join([str(n) for n in ans])
print(s)
N = int(input())
H = list(map(int,input().split()))

A = [0]*N
A[1] = abs(H[1] - H[0])

for i in range(2,N):
  on = A[i-1] + abs(H[i] - H[i-1])
  tw = A[i-2] + abs(H[i] - H[i-2])
  A[i] = min(on , tw)

print(A[N])


### FIXED CODE ###

N = int(input())
H = list(map(int,input().split()))

A = [0]*N
A[1] = abs(H[1] - H[0])

for i in range(2,N):
  on = A[i-1] + abs(H[i] - H[i-1])
  tw = A[i-2] + abs(H[i] - H[i-2])
  A[i] = min(on , tw)

print(A[N-1])
n,k = map(int,input().split())
alist = list(map(int,input().split()))

memo = []
p = 1
vis = ['.']*n

while vis[p-1] == '.':
    memo.append(p)
    vis[p-1] = 'v'
    p = alist[p-1]

loopstart = memo.index(p)
if k < len(alist):
    print(memo[k])
else:
    print(memo[loopstart+(k-loopstart)%(len(memo)-loopstart)])


### FIXED CODE ###

n,k = map(int,input().split())
alist = list(map(int,input().split()))
memo = []
p = 1
vis = ['.']*n
while vis[p-1] == '.':
    memo.append(p)
    vis[p-1] = 'v'
    p = alist[p-1]

loop = memo.index(p)
if k < len(memo):
    print(memo[k])
else:
    print(memo[loop+(k-loop)%(len(memo)-loop)])
K = int(input())
A = [int(i) for i in input().split()]

Max, Min = 0, 0
error = -1

def N_max(a, Max, Min):
    if Max > a and Min%a != 0:
        return a*(Min//a + 2) - 1
    elif Max > a and Min%a == 0:
        return a*(Min//a + 1) - 1
    else:
        return a*2 -1
        
def N_min(a, m):
    if m > a:
        return a*(m//a + 1)
    else:
        return a

for i in range(K)[::-1]:

    if A[-1] == 2:
        if i == 0:                      #最後の処理
            Max = N_max(A[i], Max, Min)
            Min = N_min(A[i], Min)
            print(Min, Max)
            break
        
        elif A[i-1]/A[i] < 2:          #次の値が2倍以下（最後以外）
            Max = N_max(A[i], Max, Min)
            Min = N_min(A[i], Min)

        else:
            print(error)
            break
 
    else:
        print(error)
        break


### FIXED CODE ###

N, A, B = [int(i) for i in input().split()]
print("Alice") if (A-B)%2 == 0 else print("Borys")
s = raw_input()
t = raw_input()

if sorted(*s) < sorted(*t, reverse=True):
  print 'Yes'
else:
  print 'No'

### FIXED CODE ###

s = raw_input()
t = raw_input()

if sorted(s) < sorted(t, reverse=True):
  print 'Yes'
else:
  print 'No'
N = int(input())
A = [int(x) for x in input().split()]

d = dict()
for i in range(N):
    d[A[i]] = d.get(A[i], 0) + 1

if len(d) > 3:
    print('No')

else:
    k = list(d.keys())
    v = list(d.values())
    
    # a1 ^ a2 ^ a3 = 0 and an: N/3
    if len(d) == 3 and k[0]^k[1]^k[2] == 0 and v[0]==v[1]==v[2]:
        print('Yes')
    
    # a1: 2N/3, 0: N/3
    elif len(d) == 2 and (k[0] == 0 and v[1] == 2*v[0]) or (k[1] == 0 and v[0] == 2*v[1]):
        print('Yes')
    
    # 0: N
    elif len(d) == 1 and k[0] == 0:
        print('Yes')
    
    else:
        print('No')

### FIXED CODE ###

from collections import Counter

N = int(input())
A = [int(x) for x in input().split()]

d = Counter(A)

if len(d) > 3:
    print('No')

else:
    k = list(d.keys())
    v = list(d.values())
    
    # a1 ^ a2 ^ a3 = 0 and an: N/3
    if len(d) == 3 and k[0]^k[1]^k[2] == 0 and v[0]==v[1]==v[2]:
        print('Yes')
    
    # a1: 2N/3, 0: N/3
    elif len(d) == 2 and ((k[0] == 0 and v[1] == 2*v[0]) or (k[1] == 0 and v[0] == 2*v[1])):
        print('Yes')
    
    # 0: N
    elif len(d) == 1 and k[0] == 0:
        print('Yes')
    
    else:
        print('No')
a, b = map(int, input().split())
if (a % 2 != 0) and (b % 2 != 0):
  return "Odd"
else:
  return "Een"

### FIXED CODE ###

a, b = map(int, input().split())
if (a % 2 != 0) and (b % 2 != 0):
  print("Odd")
else:
  print("Even")
s = input()
newS = ""

for i in range(len(s)):
    if s[i]=="?" and len(s)!= 1 and i==0 and s[i+1]=="D":
        newS+="P"
    elif len(s)&1 and i==len(s)-1 and s[i]=="?":
        newS+="D"
    elif s[i]=="?":
        if i!=0 and i!=len(s)-1:
            if newS[i-1]=="P":
                newS+="D"
            elif newS[i-1]=="D" and  (s[i+1]=="D" or s[i+1]=="?"):
                newS+="P"
        else:
            if i==0:
                if s[i+1]=="D":
                    newS+="P"
                elif s[i+1]=="P" or s[i+1]=="?":
                    newS+="D"
            else:
                newS+="D"
    else:
        newS+=s[i]
print(newS)


### FIXED CODE ###

s = input()
newS = ""
for i in range(len(s)):
    if s[i]=="?":
        newS+="D"
    else:
        newS+=s[i]
print(newS)
R,G,B,N = list(map(int, input().split()))

ans = 0
for r in range(N//R+1):
    for g in range(tmp//G+1):
        check = (tmp - R*r - G*g)
        if check%B == 0 and check > 0:
            ans += 1

print(ans)

### FIXED CODE ###

R,G,B,N = list(map(int, input().split()))
ans=0
for r in range(N//R+1):
    x = N-R*r
    for g in range(x//G+1):
        if (x-G*g)%B==0:
            ans+=1
print(ans)
x,a,b = map(int, input().split())
if x-a!=0:
	print(0)
else:
	print((x-a)%b)


### FIXED CODE ###

x = int(input())
a = int(input())
b = int(input())
if x-a==0:
   print(0)
else:
   print((x-a)%b)
from decimal import *
getcontext().prec = 28
n, k = map(int,input().split())
a = list(map(int,input().split()))
inner = Decimal(0)
outer = Decimal(0)
for i in range(0,n):
    for j in range(0,n):
        if a[i] > a[j]:
            outer += 1
            if i < j:
                inner += 1

b = (Decimal(Decimal(inner) * Decimal(k)) + Decimal(Decimal(outer) * Decimal(Decimal(k) * Decimal(k-1)) / 2))
print(Decimal(Decimal(b)%Decimal(1000000007)))

### FIXED CODE ###

m, d = map(int,input().split())
ans = 0

for i in range(1,m+1):
    for j in range(1, d + 1):
        if i == int(j/10)*int(j%10) and int(j%10) >= 2 and int(j/10) >= 2:
            ans += 1

print(ans)
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1] 

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
print(g1)
n,k= map(int,input().split())
m = n - k +1 
for i in range(1,k+1):
    print(nCr(m,i,mod)*nCr(k,i-1,mod))


### FIXED CODE ###

n, k = map(int,input().split())
m = n - k + 1 
def nCr(l,r,mod):
    if (r<0 or r>l):
        return 0
    r = min(r,l-r)
    return g1[l] * g2[r] * g2[l-r] % mod
mod = 10**9 + 7
N = 10**5
g1 = [1,1]
g2 = [1,1]
inverse = [0,1]
for i in range(2,N+1):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
for i in range(1,k+1):
    print(nCr(m,i,mod)*nCr(k-1,i-1,mod)%mod)
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 19 22:03:19 2020

@author: liang
"""

N, X, M = map(int,input().split())
mod_set = {X}
mod_lis = [X]
A = [0]*(10**5+1)
A[0] = X
for i in range(1,N):
    tmp = A[i-1]**2%M
    if tmp in mod_set:
        break
    A[i] = tmp
    mod_set.add(tmp)
    mod_lis.append(tmp)

j = mod_lis.index(tmp)
T = i - j
ans = 0
if T != 0:  
    ans += sum(mod_lis[:j])
    T_sum = sum(mod_lis[j:])
    """
    【切り捨て演算は必ず()をつけて先に計算】
    """
    ans += T_sum * ((N-j)//T)
    #print((N-j)//T, T_sum)
    T_lis = mod_lis[j:i]   
    ans += sum(T_lis[:(N-j)%T])
else:
    ans = sum(mod_lis)
#print(T_lis)
#print((N-j)%T)
#print(T_lis[:10])
print(ans)
#print(T_sum)
#print(sum(T_lis))

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Sep 19 22:58:03 2020

@author: liang
"""

N,X,M=map(int,input().split())
a = X
hist = [a]
indices = [-1]*M
indices[a] = 0
flag=0
for i in range(1,min(10**6,N)):
  a = a**2 % M
  if indices[a] != -1:
    idx = indices[a]
    flag=1
    break
  hist.append(a)
  indices[a] = i
  
if flag==0:
  print(sum(hist))
  exit()
  
cycle = hist[idx:]
margin = hist[:idx]
q,r = divmod((N-len(margin)),len(cycle))
ans = 0
ans += sum(margin)
ans += sum(cycle)*q
#print(q,sum(cycle))
ans += sum(cycle[:r])
#print(r)
#print(cycle[:10])
print(ans)
from collections import deque

mod=10**9+7

N,M=map(int,input().split())
dp=[1,1]
a=deque()
for i in range(M):
    a.append(int(input()))
if a[0]==1:
    dp[1]=0
    a.popleft()
for i in range(2,N+1):
    if len(a)>0 and i==a[0]:
        dp.append(0)
        a.popleft()
    else:
        dp.append((dp[-1]+dp[-2])%mod)
print(dp[-1])

### FIXED CODE ###

mod=10**9+7

N,M=map(int,input().split())
a=[int(input()) for _ in range(M)]
dp=[1,1]
m=0
if M>0 and a[0]==1:
    dp[1]=0
    m+=1
for i in range(2,N+1):
    if m<M and i==a[m]:
        dp.append(0)
        m+=1
    else:
        dp.append((dp[-1]+dp[-2])%mod)
print(dp[-1])
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

MODN = (10 ** 9) + 7

INF = 10 ** 10

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

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


# K個の青ボールとN-K個の赤ボール
# 同じ色のボールは区別可能
N, K = [int(x) for x in stdin.readline().rstrip().split()]

blue_num = K
red_num = N - K

#red_p = permutations_count(red_num, 1)
pos_cand_num = red_num + 1

for i in range(1, K+1):
    ans = combinations_count(pos_cand_num, i) % MODN * combinations_count(K-1, i-1) % MODN
    print(ans) 

### FIXED CODE ###

from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

MOD = (10 ** 9) + 7

INF = 10 ** 10

MAX = 510000

def com_init():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD


def com(n, k):
    if n < k:
        return 0
    if (n < 0) or (k < 0):
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


if __name__ == "__main__":
    # K個の青ボールとN-K個の赤ボール
    # 同じ色のボールは区別可能
    N, K = [int(x) for x in stdin.readline().rstrip().split()]
    
    fac = [0] * MAX
    finv = [0] * MAX
    inv = [0] * MAX

    com_init()

    for i in range(1, K+1):
        ans = com(N-K+1, i) * com(K-1, i-1) % MOD
        print(ans)
input1 = input().rstrip().split(" ")
h = input().rstrip().split(" ")
yoi = [1 for i in range(int(input1[0]))]
root =  [input().rstrip().split(" ") for i in range(int(input1[1]))]
print(int(root[0][1]))
for i in range(int(input1[1])):
    a=int(root[i][0])-1
    b=int(root[i][1])-1
    if h[a]> h[b]:
        yoi[b] = 0
    elif h[a] < h[b]:
        yoi[a] = 0
    else:
        yoi[a] = 0
        yoi[b] = 0
print (sum(yoi))


### FIXED CODE ###

# coding: utf-8
# Your code here!
input1 = input().rstrip()
if input1=="ABC":
    print("ARC")
elif input1=="ARC":
    print("ABC")
else:
    print(0)
N, M = map(int, input().split())
mod = 10**9 + 7
if abs(N - M) > 1:
    print(0)
elif abs(N - M) == 0:
    ans = mod_factorial(N, mod) * mod_factorial(M, mod) * 2
    print(ans % mod)
else:
    ans = mod_factorial(N, mod) * mod_factorial(M, mod)
    print(ans % mod)
def mod_factorial(a, mod):
    ans = 1
    while a != 1:
        ans *= a
        ans = ans % mod
        a -= 1
    return ans

### FIXED CODE ###

N, M = map(int, input().split())
def mod_factorial(a, mod):
    ans = 1
    while a != 1:
        ans *= a
        ans = ans % mod
        a -= 1
    return ans

mod = 10**9 + 7
if abs(N - M) > 1:
    print(0)
elif abs(N - M) == 0:
    ans = mod_factorial(N, mod) * mod_factorial(M, mod) * 2
    print(ans % mod)
else:
    ans = mod_factorial(N, mod) * mod_factorial(M, mod)
    print(ans % mod)
n, k, q = map(int, input().split())
ar = [k for i in range(n)]
for i in range(q):
  index = int(input())
  ar[index] += 1
for i in range(n):
  if ar[i] - q > 0:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

n, k, q = map(int, input().split())
ar = [k for i in range(n)]
for i in range(q):
  index = int(input())
  ar[index-1] += 1
for i in range(n):
  if ar[i] - q > 0:
    print("Yes")
  else:
    print("No")
class Dice:
    def __init__(self):
        self.omote=1
        self.sita=2
        self.migi=3
        self.ue=5
        self.hidari=4
        self.ura=6

    def North(self):
        self.omote,self.ue,self.ura,self.sita=self.sita,self.omote,self.ue,self.ura

    def East(self):
        self.omote,self.hidari,self.ura,self.migi=self.hidari,self.ura,self.migi,self.omote

    def West(self):
        self.omote,self.migi,self.ura,self.hidari=self.migi,self.ura,self.hidari,self.omote

    def South(self):
        self.omote,self.ue,self.ura,self.sita=self.ue,self.ura,self.sita,self.omote

    def Right(self):
        self.sita,self.migi,self.ue,self.hidari=self.migi,self.ue,self.hidari,self.sita

    def Left(self):
        self.sita,self.hidari,self.ue,self.migi=self.hidari,self.ue,self.migi,self.sita


while(True):
    n=int(input())
    if n==0:
        break
    sum=1
    dice=Dice()
    dice_def={"North":dice.North,"East":dice.East,"South":dice.South,"West":dice.West,"Right":dice.Right,"Left":dice.Left}
    for i in range(n):
        dice_def[input()]()
        sum+=dice.omote
    print(sum)

### FIXED CODE ###

class Dice:
    def __init__(self):
        self.omote=1
        self.sita=2
        self.migi=3
        self.ue=5
        self.hidari=4
        self.ura=6

    def North(self):
        self.omote,self.ue,self.ura,self.sita=self.sita,self.omote,self.ue,self.ura

    def East(self):
        self.omote,self.hidari,self.ura,self.migi=self.hidari,self.ura,self.migi,self.omote

    def West(self):
        self.omote,self.migi,self.ura,self.hidari=self.migi,self.ura,self.hidari,self.omote

    def South(self):
        self.omote,self.ue,self.ura,self.sita=self.ue,self.ura,self.sita,self.omote

    def Right(self):
        self.sita,self.migi,self.ue,self.hidari=self.migi,self.ue,self.hidari,self.sita

    def Left(self):
        self.sita,self.hidari,self.ue,self.migi=self.hidari,self.ue,self.migi,self.sita

n=int(input())
while(n!=0):
    sum=1
    dice=Dice()
    dice_def={"North":dice.North,"East":dice.East,"South":dice.South,"West":dice.West,"Right":dice.Right,"Left":dice.Left}
    for i in range(n):
        dice_def[input().strip()]()
        sum+=dice.omote
    print(sum)
    n=int(input())
import numpy as np
N, M = map(int, input().split())

A = np.zeros((N,M))
for i in range(N):
    a = list(map(int, input().split()))
    A[i, 0:len(a)] = a

A = A[(A != 0) & (A < M)]
len(np.unique(A))

### FIXED CODE ###

import numpy as np
N, M = map(int, input().split())

A = np.zeros((N,M))
for i in range(N):
    a = list(map(int, input().split()))
    a = a[1:]
    A[i, 0:len(a)] = a

for i in range(N):
    a = A[i]
    a = a[(a != 0) & (a <= M)]
    if i == 0:
        s = set(list(a))
    else:
        _s = set(list(a))
        s &= _s

print(len(s))
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    a = list(map(int, readline().split()))

    odd = a[0::2]
    even = a[1::2]

    if n % 2 == 0:
        print(*even[::-1], *odd)
    else:
        print(*odd[::-1], *even)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    a = list(map(int, readline().split()))

    odd = a[0::2]
    even = a[1::2]

    if n % 2 == 0:
        res = even[::-1] + odd
        print(*res)
    else:
        res = odd[::-1] + even
        print(*res)


if __name__ == '__main__':
    main()