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

a = [0 for i in range(N)]
b = [0 for i in range(N)]
c = [0 for i in range(M)]
d = [0 for i in range(M)]

for i in range(N):
    a[i],b[i] = map(int,input().split())

for i in range(M):
    c[i],d[i] = map(int,input().split())

for i in range(N):
    for j in range(M):
        dist = []
        tmp = abs(a[i]-c[i]) + abs(b[i]-d[i])
        dist.append(tmp)

    print(dist.index(min(dist)))

### FIXED CODE ###

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

a = [0 for i in range(N)]
b = [0 for i in range(N)]
c = [0 for i in range(M)]
d = [0 for i in range(M)]

for i in range(N):
    a[i],b[i] = map(int,input().split())

for i in range(M):
    c[i],d[i] = map(int,input().split())

for i in range(N):
    dist = []

    for j in range(M):
        tmp = abs(a[i]-c[j]) + abs(b[i]-d[j])
        dist.append(tmp)

    print(dist.index(min(dist)) + 1)
def main(n: int, s: str):
    ans = ""
    for _s in s:
        ans += ascii[(ascii.index(_s) + n) % 26]

    print(ans)


if __name__ == "__main__":
    n = int(input())
    s = input()

    main(n, s)


### FIXED CODE ###

from string import ascii_uppercase as ascii


def main(n: int, s: str):
    ans = ""
    for _s in s:
        ans += ascii[(ascii.index(_s) + n) % 26]

    print(ans)


if __name__ == "__main__":
    n = int(input())
    s = input()

    main(n, s)
N, K = map(int, input().split())  # 0~NのN+1個の数字, K個以上選んで出来上がる数
ans = 0
MOD = 10**9+7
# 出来上がる数字の幅を考える
for k in range(K, N+2):  # K~N+1までループを回す
  upper = k*(2N-(k-1))//2
  lower = k*(k-1)//2
  ans += upper - lower + 1
  ans %= MOD
print(ans)

### FIXED CODE ###

N, K = map(int, input().split())  # 0~NのN+1個の整数, K個以上選ぶ, 注意 ; 3, 5 と 1, 3, 4は別物になる。0と5, 2と3 を選んだパターンは同じになる

MOD = 10**9+7
ans = 0
for k in range(K, N+2):
    ans += k*(2*N-(k-1))//2 - k*(k-1)//2 + 1
    ans %= MOD
print(ans)
import numpy as np
A,B,N = map(int,input().split())
narray = np.asarray(range(1,N+1))
store = np.zeros(len(narray),np.int64)
AxPerB = (A * narray) / B
xPerB = (narray / B)
store += AxPerB.astype(np.int64) - A * xPerB.astype(np.int64)
print(store.max())


### FIXED CODE ###

A,B,N = map(int,input().split())
def f(x):
    return int((A *( x % B ) - (A * x % B)) / B)
if N >= B-1:
    print(f(B-1))
else:
    print(f(N))
ABCD = int(input())
a = int(ABCD//10e2)
b = int((ABCD-a*10e2)//10e1)
c = int((ABCD-a*10e2-b*10e1)//10)
d = int(ABCD-a*10e2-b*10e1-c*10)
if a+b+c+d == 7:
    print(str(a)+"+"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a-b+c+d == 7:
    print(str(a)+"-"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a+b-c+d == 7:
    print(str(a)+"+"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a+b+c-d == 7:
    print(str(a)+"+"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a-b-c+d == 7:
    print(str(a)+"-"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a-b+c-d == 7:
    print(str(a)+"-"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a+b-c-d == 7:
    print(str(a)+"+"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
elif a-b-c-d == 7:
    print(str(a)+"-"+str(b)+"-"+str(c)+"-
    "+str(d)+"=7")


### FIXED CODE ###

ABCD = int(input())
a = int(ABCD//10e2)
b = int((ABCD-a*10e2)//10e1)
c = int((ABCD-a*10e2-b*10e1)//10)
d = int(ABCD-a*10e2-b*10e1-c*10)
if a+b+c+d == 7:
    print(str(a)+"+"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a-b+c+d == 7:
    print(str(a)+"-"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a+b-c+d == 7:
    print(str(a)+"+"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a+b+c-d == 7:
    print(str(a)+"+"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a-b-c+d == 7:
    print(str(a)+"-"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a-b+c-d == 7:
    print(str(a)+"-"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a+b-c-d == 7:
    print(str(a)+"+"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
elif a-b-c-d == 7:
    print(str(a)+"-"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
s = str(input())

length = len(s)

n = length//2

m = 0

for i in range(length):
  x = (i+1)*(-1)
  if s[i]==s[k]:
    m += 1
print(m)
    

### FIXED CODE ###

s = str(input())
 
length = len(s)
 
n = length//2
 
m = 0
 
for i in range(n):
  x = (i+1)*(-1)
  if s[i]!=s[x]:
    m += 1
print(m)
import bisect
N=int(input())
A=[int(input()) for _ in range(N)]
color=[]
A=A[::-1]
for a in A:
    i=bisect.bisect_left(color,a)
    if i==len(color):
        color.append(a)
    else:
        color[i]=a
print(len(color))

### FIXED CODE ###

r=int(input())
print(3*r**2)
a = input().isupper()
if ture == a:
  print("A")
else:
  print("a")

### FIXED CODE ###

a = input().islower()

if a == 0:
  print("A")
else:
  print("a")
order = list(raw_input())
price = 700
for x in order:
	if x == 'o':
		price = price + 100
print(price)


### FIXED CODE ###

order = input()
order = list(order)
price = 700
for x in order:
	if x == 'o':
		price = price + 100
print(price)
import math
A,B,H,M = map(int,input().split())
A2 = A**2
B2 = B**2
a = 30*H + 0.5*M
b = M*6
F  = 0

ab = min(abs(a-b),abs(360-a-b))
ab_angle = -2*A*B*ab
ans = math.sqrt(A2 + B2 +ab_angle)
print(ans)

### FIXED CODE ###

import math
A,B,H,M = map(int,input().split())
a = 30*H + 0.5*M
b = M*6
if abs(a-b) < 180:
    ab = abs(a-b)
else:
    ab = 360 - abs(a-b)
ab1 = round(math.cos(math.radians(ab)),20)
ans = round(math.sqrt(A**2 + B**2 - 2 * A* B*ab1),20)
print(round(ans,20))
import math
n = int(input())
for i in range(n):
    count = 0
    for x in range(1, 101):
        for y in range(1, 101):
            for x in range(1, 101):
                if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == (i + 1):
                    count += 1
    print(count)

### FIXED CODE ###

n = int(input())
ans=[0]*(n+1)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            a = x * x + y * y + z * z + x * y + y * z + z * x
            if n >= a >= 1:
                ans[a] += 1
print(*ans[1:],sep="\n")
a = input()
print(a**3)

### FIXED CODE ###

a = input()
print(int(a)**3)
n = int(input())
a =[int(x) for x in input().split()]

def solve(n,i):
	if n%2!=0:
		return i
	else:
		return(n//2,i+1)

cnt = 0

for i in a:
	cnt +=solve(i,0)

print(cnt)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
cnt = 0
for i in range(n):
    while 1:
        if a[i]%2==0:
            a[i] = int(a[i]//2)
            cnt+=1
        else:
            break
    
print(cnt)
n, m = map(int, input().split())

ends = []
starts = []
possible = False
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        starts.append([a, b])
    elif b == n:
        ends.append([a, b])

starts.sort(key=lambda x: x[1])
ends.sort(key=lambda x: x[0])

i = 0
j = 0
while i != len(starts) and j != len(ends):
    to = starts[i][1]
    fr = ends[j][0]

    if to == fr:
        possible = True
        break

    if to > fr:
        i += 1
    elif fr > to:
        j += 1

while j != len(ends):
    fr = ends[j][0]
    if to == fr:
        possible = True
        break

    j += 1

while i != len(starts):

    to = starts[i][1]
    if to == fr:
        possible = True
        break

    i += 1

print("POSSIBLE") if possible else print("IMPOSSIBLE")


### FIXED CODE ###

n,m = input().split()
n = int(n)
m = int(m)
l = [[] for i in range(n)]
for i in range(m):
    a,b = input().split()
    a = int(a)
    b = int(b)
    l[a-1].append(b-1)
    l[b-1].append(a-1)

f = False
for i in l[0]:
    for j in l[i]:
        if j == n-1:
            f = True
            break
if f:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
def main():
    s = input()
    k = int(input())

    m = 0
    ans = ""

    for i in range(len(s)):
        if s[i] != "1":
            m = i+1
            ans = s[i]
            break
    
    if k <= m:
        print(1)
    else:
        print(int(ans))



if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    s = input()
    k = int(input())

    m = 0
    ans = ""

    for i in range(len(s)):
        if s[i] != "1":
            m = i+1
            ans = s[i]
            break
    
    if k < m:
        print(1)
    elif m == 0:
        print(1)
    else:
        print(int(ans))



if __name__ == "__main__":
    main()
N, M = map(int, input().split())

dic = {i:set() for i in range(1, N+1)}

for _ in range(M):
    a, b = map(int, input().split())
    dic[a].add(b)
    dic[b].add(a)


l1 = [float('inf')]*N
l1[0] = 0
ans = [0] * N
x = {1}

k1 = 1
rooms = dic[k1]

def search(k1, dic, l1, ans, x):

    if x == {i for i in range(1, N)}:
        return

    rooms = dic[k1]
    for room in rooms:
        x.add(room)
        print(room)
        if l1[k1-1] + 1 < l1[room-1]:
            l1[room-1] = l1[k1-1] + 1
            ans[room-1] = k1
            search(room, dic, l1, ans, x)



search(k1, dic, l1, ans, x)

if float('inf') in l1:
    print('No')
else:
    print('Yes')
    for n in ans[1:]:
        print(n)


### FIXED CODE ###

N, M = map(int, input().split())
A, B = [], []
dic = {i:[] for i in range(1, N+1)}
for _ in range(M):
    a, b = map(int, input().split())
    dic[a].append(b)
    dic[b].append(a)

node = [float('inf')] * N
node[0] = 0 #1までの距離
route = [0]*N #ランプ置く部屋
rooms = [1] #次調べる部屋
st = {1}

for r1 in rooms:
    for r2 in dic[r1]:
        if node[r1-1] + 1 <= node[r2-1]:
            node[r2-1] = node[r1-1] + 1
            route[r2-1] = r1
            if not r2 in st:
                rooms.append(r2)
                st.add(r2)
            try:
                dic[r2].remove(r1)
            except:
                continue

if float('inf') in node:
    print('No')
else:
    print('Yes')
    for i in route[1:]:
        print(i)
from itertools import permutations

n=int(input())
l=list(map(int,input().split()))
t=list(map(int,input().split()))
s="".join(l)
h="".join(t)

l1=list()

for i in permutations(s):
  l1.append(i)
  
print(abs(l1.find(s)-l1.find(h)))

### FIXED CODE ###

from itertools import permutations

n=int(input())
l=list(map(str,input().split()))
t=list(map(str,input().split()))
s="".join(l)
h="".join(t)

l1=list()

for i in permutations(s):
    k="".join(i)
    l1.append(k)
 
l1.sort()

print(abs(l1.index(s)-l1.index(h)))
from collections import Counter
from scipy.special import comb
from operator import mul
from functools import reduce


def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


N = int(input())
lst_s = ["".join(sorted(input())) for _ in range(N)]
lst_s.sort()

cnt_s = Counter(lst_s)

ans = 0
for v in cnt_s.values():
    if v == 1:
        continue
    else:
        ans += cmb(v, 2)
print(ans)

### FIXED CODE ###

from collections import Counter
from operator import mul
from functools import reduce


def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


N = int(input())
lst_s = ["".join(sorted(input())) for _ in range(N)]
lst_s.sort()

cnt_s = Counter(lst_s)

ans = 0
for v in cnt_s.values():
    if v == 1:
        continue
    else:
        ans += cmb(v, 2)
print(ans)
import statistics

a=int(input())
while True:
	if a==0:
		break
	else:
	num=list(map(int,input().split()))
	print(statistics.pstdev(num))



### FIXED CODE ###

import statistics

while True:
	a=int(input())
	num=[]
	if a==0:
		break
	else:
		num=list(map(int,input().split()))
	print(statistics.pstdev(num))
n,x,y = map(int,input().split())
g = [[]for i in range(n)]
g[0].append(1)
g[n-1].append(n-2)
g[x-1].append(y-1)
g[y-1].append(x-1)
for i in range(1,n-1):
  g[i].append(i-1)
  g[i].append(i+1)
ans = [0]*(n-1)
def dfs(b,c):
  for i in g[b]:
    if a[i] > c+1:
      a[i] = c+1
      dfs(i,c+1)
    
for i in range(n):
  a = [999999999]*n
  a[i] = 0
  dfs(i,0)
  for j in a:
    if j == 0:
      continue
    ans[j-1] += 1
for i in ans:
  print(i//2)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
from collections import deque
n,x,y = map(int,input().split())
g = [[]for i in range(n)]
g[0].append(1)
g[n-1].append(n-2)
g[x-1].append(y-1)
g[y-1].append(x-1)
for i in range(1,n-1):
  g[i].append(i-1)
  g[i].append(i+1)
ans = [0]*(n-1)
def dfs(b,c):
  for i in g[b]:
    if a[i] > c+1:
      a[i] = c+1
      que.append([i,c+1])
    
for i in range(n):
  a = [999999999]*n
  a[i] = 0
  que = deque()
  que.append([i,0])
  while que:
    x,y = que.popleft()
    dfs(x,y)
  for j in a:
    if j == 0:
      continue
    ans[j-1] += 1
for i in ans:
  print(i//2)
n = int(input())
ans = 0
for i in range(1,n+1,2) :
	cnt = 0
	for j in range(1,i+1) :
		if i % j == 0 :
        	cnt += 1
	if cnt == 8 :
		ans += 1
print(ans)     


### FIXED CODE ###

n = int(input())
cnt = 0
divisor = []
for i in range(1,n+1,2) :
        for j in range(1,i+1) :
                if i % j == 0 :
                        cnt += 1
        divisor.append(cnt)
        cnt = 0
ans = 0
for i in divisor :
        if i == 8 :
                ans += 1
print(ans)
N, L = map(int, input().split())
l = [input() for _ in range(L)]
l.sort()
s = ""
for i in range(L):
  s += l[i]
print(s)

### FIXED CODE ###

N, L = map(int, input().split())
l = [input() for _ in range(N)]
l = sorted(l)
s = ""
for i in range(N):
  s += l[i]
print(s)
n = int,input()

integer = int(0)
v = input().split()

c = input().split()

for i in range(n):
    if int(v[i])>int(c[i]):
       integer += int(v[i])-int(c[i])
       continue
print(integer)


### FIXED CODE ###

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

i = T//A
print(B*i)
def main():
    n=int(input())
    s=input()
    ans=0
    f00=[False if str(i) in set(str(s)) else True for i in range(10)]
    f0=f00.copy()
    for i0 in range(n-2):
        if all(f0):
            break
        if not f0[int(s[i0])]:
            f1=f00.copy()
            for i1 in range(i0+1,n-1):
                if all(f1):
                    break
                if not f1[int(s[i1])]:
                    ans+=len( set( s[i1+1:] ) )
                    f1[int(s[i1])]=True
        f0[int(s[i0])]=True
    print(ans)
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n=int(input())
    s=input()
    ans=0
    f00=[False if str(i) in set(str(s)) else True for i in range(10)]
    f0=f00.copy()
    for i0 in range(n-2):
        if all(f0):
            break
        if not f0[int(s[i0])]:
            f1=f00.copy()
            for i1 in range(i0+1,n-1):
                if all(f1):
                    break
                if not f1[int(s[i1])]:
                    ans+=len( set( s[i1+1:] ) )
                    f1[int(s[i1])]=True
        f0[int(s[i0])]=True
    print(ans)
if __name__ == '__main__':
    main()
a=int(input())
b=int(input())
c=a + b
 
if  a%3==0 or b%3==0 or c%3==0: print("Possible")
else: print("Impossible")

### FIXED CODE ###

a,b=map(int,input().split())
c=a + b
 
if  a%3==0 or b%3==0 or c%3==0: print("Possible")
else: print("Impossible")
def re(r,k,l):
    if k==0:return r
    while(k<l[0]):
        l=l[1:]
    return re(r+1,k-l[0],l)





n=int(input())
i=1
l6=[]
ans=10**5
while(i<n):
    l6.append(i)
    i*=6
i=1
l9=[]
while(i<n):
    l9.append(i)
    i*=9
l6.sort(reverse=True)
l9.sort(reverse=True)
for i in range(n):
    ans=min(ans,re(0,n-i,l6)+re(0,i,l9))
print(ans)

### FIXED CODE ###

import sys

sys.setrecursionlimit(2000000)

def re(r,k,l):
    if k==0:return r
    while(k<l[0]):
        l=l[1:]
    return re(r+1,k-l[0],l)





n=int(input())
i=1
l6=[]
ans=10**5
while(i<=n):
    l6.append(i)
    i*=6
i=1
l9=[]
while(i<=n):
    l9.append(i)
    i*=9
l6.sort(reverse=True)
l9.sort(reverse=True)
for i in range(n+1):
    ans=min(ans,re(0,n-i,l6)+re(0,i,l9))
print(ans)
A,B,C = map(input().split())

arr = [A, B, C]
fives = 0
sevens = 0

for num in arr:
    if num == 5:
        fives += 1
    if num == 7:
        sevens += 1

if fives == 2 and sevens == 1:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

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

arr = [A, B, C]
fives = 0
sevens = 0

for num in arr:
    if num == 5:
        fives += 1
    if num == 7:
        sevens += 1

if fives == 2 and sevens == 1:
    print("YES")
else:
    print("NO")
from collections import Counter
n = int(input())
string_list=[input() for i in range(n)]
c = collections.Counter(string_list)
print(len(c))



### FIXED CODE ###

n = int(input())
s = [input() for _ in range(n)]
print(len(set(s)))
n,m = map(int,input().split())
ans = [input().split() for _ in range(m)]
ac = []
wn = []
acn,wan = 0,0
for i in ans:
  for j in range(len(ac)):
    if i[0] != ac[j]:
      if i[1] == 'AC' :
        wan += wn.count(i[0])
        ac += [i[0]]
        acn += 1
      else :
        wn += [i[0]]
print(acn,wan)

### FIXED CODE ###

print(chr(ord(input())+1))
import sys

def split(g):
  gl = g[:-1]
  gr = g[1:]
  sub = [b - a for a, b in zip(gl, gr)]
  i = sub.index(max(sub)) + 1
  return g[:i], g[i:]


def main():
  input = sys.stdin.readline
  N, M = map(int, input().split())
  g = [int(a) for a in input().split()]
  g = sorted(g)
  ans = 0
  if N < M:
    for _ in range(N-1):
      s, g = split(g)
      ans += s[-1] - s[0]
    ans += g[-1] - g[0]
  print(ans)


if __name__ == '__main__':
  main()

### FIXED CODE ###

import sys

def main():
  input = sys.stdin.readline
  N, M = map(int, input().split())
  ans = 0
  if N < M:
    g = [int(a) for a in input().split()]
    g = sorted(g)
    L = g[:-1]
    R = g[1:]
    sub = [b - a for a, b in zip(L, R)]
    sub = sorted(sub)
    ans = sum(sub[:(M-N)])
  print(ans)


if __name__ == '__main__':
  main()
while True:
  count = input()
  if count == 0: break
  previous_cube = [0, 1, 2, 3, 4, 5]
  operation = {'North':[1, 5, 2, 3, 0, 4], 'East':[3, 1, 0, 5, 4, 2], 'West': [2, 1, 5, 0, 4, 3], 'South':[4, 0, 2, 3, 5, 1], 'Right':[0, 2, 4, 1, 3, 5], 'Left':[0, 3, 1, 4, 2, 5]}
  sum = 1
  for i in xrange(count):
    new_cube = []
    for e in xrange(5):
      new_cube.append(previous_cube[operation[raw_input().strip()][e]])
    sum += new_cube[0]
    previous_cube = new_cube
  print sum

### FIXED CODE ###

while 1:
  n = input()
  if n == 0:  break
  d = range(1, 7)
  ans = 1
  for i in range(n):
    c = raw_input()[0]
    if c == 'N': S = [1,5,2,3,0,4]
    elif c == "S": S = [4,0,2,3,5,1]
    elif c == "E": S = [3,1,0,5,4,2]
    elif c == "W": S = [2,1,5,0,4,3]
    elif c == "R": S = [0,2,4,1,3,5]
    elif c == "L": S = [0,3,1,4,2,5]
    d = [d[s] for s in S]
    ans += d[0]
  print ans
import math

a, b, h, m = map(int, input().split())

deg_h = 360 / 12
deg_m = 360 / 60

H = h * deg_h + m * deg_m
M = m * deg_m
deg = abs(H - M)

if deg > 180:
    deg = 360 - deg

rad = (deg*math.pi) / 180
c = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(rad))
print(c)


### FIXED CODE ###

n = input()

if(n[-1] == '0' or n[-1] == '6' or n[-1] == '1' or n[-1] == '8'):
    print('pon')
elif(n[-1] == '3'):
    print('bon')
else:
    print('hon')
n,m,x,y=map(int,input())
a=max(list(map(int,input().split())))
b=min(list(map(int,input().split())))
print("No War" if a<b and x<b else "War")

### FIXED CODE ###

n,m,x,y=map(int,input().split())
a=max(list(map(int,input().split())))
b=min(list(map(int,input().split())))
print("No War" if a<b and x<b and a<y else "War")
N, K = map(int, input().split())
h_list = []
for i in range(N):
    h = int(input())
    h_list.append(h)
h_list = sorted(h_list, reverse = True)
for i in range(N-K+1):
    cnt = h_list[i]-h_list[i+K-1]
    min1 = min(min1, cnt)
print(min1)

### FIXED CODE ###

N, K = map(int, input().split())
h_list = []
min1 = 10**10
for i in range(N):
    h = int(input())
    h_list.append(h)
h_list = sorted(h_list, reverse = True)
for i in range(N-K+1):
    cnt = h_list[i]-h_list[i+K-1]
    min1 = min(min1, cnt)
print(min1)
r = int(input())

ans = 2 * math.pi * r
print(ans)

### FIXED CODE ###

import math

r = int(input())

ans = 2 * math.pi * r
print(ans)
n = int(input())
l = list(map(int,input().split()))
a = [l[0]]
if n % 2 ==1:
  for i in range(1,n):
    if i % 2 == 1:
      a.insert(0,l[i])
    else:
      a.append(l[i])
else:
  for i in range(1,n):
    if i % 2 == 1:
      a.appen(l[i])
    else:
      a.insert(0,l[i])
print(a)
  

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
if n % 2 == 0:
  a = l[::-2]+ l[0::2]
else:
  a = l[::-2]+ l[1::2]
print(*a)
def euclid(A,B):

    big = max(A,B)
    small = min(A,B)

    r = big % small
    while r != 0:
        big = small
        small = r
        r = big % small
    
    return small


def LCM(A,B):
    return int(A*B/euclid(A,B))
    

N = int(input())

time = 1
for i in range(N):
    T = int(input())
    time = LCM(time,T)

print(time)

### FIXED CODE ###

def euclid(A,B):

    big = max(A,B)
    small = min(A,B)

    r = big % small
    while r != 0:
        big = small
        small = r
        r = big % small
    
    return small


def LCM(A,B):
    return A*B//euclid(A,B)
    

N = int(input())

time = 1
for i in range(N):
    T = int(input())
    time = LCM(time,T)

print(time)
def main(f, e):
    if f==0 or e==0:
        print("NA")
        return 0
    if f <13:
        elif e < 13:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if e < 13:
            print("YYMM")
        else:
            print("NA")

if __name__ == "__main__":
    S = input()

    a = int(S[:2])
    b = int(S[2:])
    main(a, b)
        


### FIXED CODE ###

def main(f, e):
    if 0 <f <13:
        if 0<e<13:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if 0<e<13:
            print("YYMM")
        else:
            print("NA")
if __name__ == "__main__":
    S = input()

    a = int(S[:2])
    b = int(S[2:])
    main(a, b)
s = input()
if s[2] == 2[3] and s[4] == s[5]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s = input()
if s[2] == s[3] and s[4] == s[5]:
  print("Yes")
else:
  print("No")
def solve():
    rec = list(range(1000000))
    odd_rec = rec.copy()
    
    for i in range(2, 181):
        t = i * (i + 1) * (i + 2) // 6
        if t % 2 == 0:
            for i, tpl in enumerate(zip(rec[t:], rec), start=t):
                a, b = tpl
                b += 1
                if b < a:
                    rec[i] = b
        else:
            z_rec = zip(rec[t:], rec, odd_rec[t:], odd_rec)
            for i, tpl in enumerate(z_rec, start=t):
                a, b, c, d = tpl
                b += 1
                if b < a:
                    rec[i] = b
                d += 1
                if d < c:
                    odd_rec[i] = d
    
    import sys
    #file_input = sys.stdin
    file_input = open("1167_in", 'r')#
    n = int(file_input.readline())
    while n:
        print(rec[n], odd_rec[n])
        n = int(file_input.readline())

solve()


### FIXED CODE ###

def solve():
    rec = [1000000] * 1000000
    rec[0] = 0
    odd_rec = rec.copy()
    
    for i in range(1, 181):
        t = i * (i + 1) * (i + 2) // 6
        for i, tpl in enumerate(zip(rec[t:t*3+1], rec), start=t):
            a, b = tpl
            b += 1
            if b < a:
                rec[i] = b
        if t % 2:
            for i, tpl in enumerate(zip(odd_rec[t:t*34+1], odd_rec), start=t):
                a, b = tpl
                b += 1
                if b < a:
                    odd_rec[i] = b
    
    import sys
    file_input = sys.stdin
    n = int(file_input.readline())
    while n:
        print(rec[n], odd_rec[n])
        n = int(file_input.readline())

solve()
n,cc = raw_input(),collections.Counter(map(int, raw_input().split()))
print max([cc[k] + cc[k+1] + cc[k-1] for k in cc] or [0)


### FIXED CODE ###

import collections
n,cc = raw_input(),collections.Counter(map(int, raw_input().split()))
print max([cc[k] + cc[k+1] + cc[k-1] for k in cc] or [0])