peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n,d = map(int,input().split())

print((n//(d*2+1))+1)
# Judge status: Accepted

def resolve():
    N = int(input())
    A = list(map(int, input().split()))

    S = 0
    for i in range(N):
        S ^= A[i]
    for i in range(N):
        A[i] ^= S
    print(*A)

if __name__ == "__main__":
    resolve()
# Judge status: Accepted
from decimal import Decimal, ROUND_DOWN

A, B = input().split()
X = Decimal('0')

A = Decimal(A)
B = Decimal(B)

X = (A*B).quantize(Decimal('0'), rounding=ROUND_DOWN)

print(X)
# Judge status: Accepted
K=int(input())
from collections import deque
q=deque([i for i in range(1,10)])
for i in range(K-1):
    tmp=q.popleft()
    if tmp%10!=0:
        q.append(10*tmp+(tmp-1)%10)
    q.append(10*tmp+tmp%10)
    if tmp%10!=9:
        q.append(10*tmp+(tmp+1)%10)
print(q.popleft())
# Judge status: Accepted
a=list(map(int,input().split()))
b=list(map(int,input().split()))
no=1
for i in range(1,a[0]):
    b[i]+=b[i-1]
for i in range(0,a[0]):
    if(a[1]>=b[i]):
        no+=1
    else:
        break
print(no)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    k,a,b=map(int,input().split())
    if b-a<=2 or k<=a:
        print(k+1)
    else:
        print(a+(b-a)*((k-a+1)//2)+(k-a+1)%2)

if __name__=='__main__':
    main()
# Judge status: Wrong Answer
#import math
#import bisect
#import numpy as np
#import itertools
#import copy
import sys

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

def main():
    n = int(input())
    h = list(map(int,ipti().split()))

    for i in range(1, n):
        if h[i] - h[i-1] <= 0:
            h[i-1] -= 1

    for i in range(1, n):
        if h[i] - h[i-1] < 0:
            print('No')
            sys.exit()

    print('Yes')

if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
print((N * (N-1)) // 2)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
print(a*b%2)
# Judge status: Wrong Answer
s=str(input())
if s== 'AAA' or s=='BBB':
  print('No')
else:
  print('Yes')
# Judge status: Wrong Answer
n = list(input())

for i in n:
    if n.count(i)%2 != 0:
        print("N0")
        exit()
print("Yes")
# Judge status: Accepted
s, t = raw_input(), raw_input()
def f(a,b):
	if len(a) != len(b): return False

	for u,v in zip(a,b):
		if u != v and u != '?':
			return False
	return True
cand = -1
for i in range(len(s)):
	if f(s[i:i + len(t)],t):
		cand = i

if cand == -1:
	print 'UNRESTORABLE'
else:
	print s[:cand].replace('?', 'a') + t + s[cand+len(t):].replace('?','a')
# Judge status: Accepted
t,s = input().split()
print(s+t)
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    X, A, B = map(int, input().split())

    if B <= A:
        ans = "delicious"
    elif B <= A + X:
        ans = "safe"
    else:
        ans = "dangerous"

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n,m=map(int,input().split())
a=[list(input()) for _ in range(n)]
b=[list(input()) for _ in range(m)]

eq = False
find = False
for i in range(n-m+1):
  for j in range(n-m+1):
    for p in range(m):
      for q in range(m):
        if a[p+i][q+j] == b[p][q]:
          eq = True
        else:
          eq = False
          break
      if not eq:
        break
    if eq:
      find = True
      break
  if find:
    break
if find:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
s=input()
print(sum(s[i]!=s[-1-i])for i in range(len(s)//2))
# Judge status: Accepted
n = [0] + list(map(int, list(input())))
ans = 0
c_in = 0

while n:
    s = n.pop()
    s += c_in
    if 0 <= s <= 4:
        ans += s
        c_in = 0
    elif 6 <= s:
        ans += abs(10 - s)
        c_in = 1
    else:
        ans += 5
        if 5 <= n[-1]:
            c_in = 1
        else:
            c_in = 0

print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

N=int(input().rstrip('\n'))
As = [int(x) for x in input().rstrip('\n').split()]
res = [0]*N
for i in range(N,0,-1):
  now = sum(res[i-1::i])%2
  if now!=As[i-1]:
    res[i-1] += 1
print(sum(res))
print(*[x+1 for x in range(N) if res[x]>0])
# Judge status: Accepted
a,b,c,d = map(int,input().split())

if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N,P = map(int,input().split())
A = list(map(int,input().split()))

if all(a%2==0 for a in A):
    print(0 if P else 2**N)
else:
    print(2**(N-1))
# Judge status: Wrong Answer
N = int(input())
ans = 0
for i in range(N):
    if i*i <= N: ans = i*i
    else: break
print(ans)
# Judge status: Accepted
a, b, k = map(int, input().split())

c = 1
for i in range(min(a, b) + 1, 0, -1):
    if a % i == 0 and b % i == 0:
        if c == k:
            print(i)
        c += 1
# Judge status: Accepted
n = int(input())
def ok(x):
    for i in range(1,10):
        for j in range(1,10):
            if i*j==x:
                return True
                break

if ok(n)==True:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 17:01:05 2020

@author: shinba
"""

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

if a == 1:
    if b == 1:
        print("Draw")
    else:
        print("Alice")
elif b == 1:
    print("Bob")
else:
    if a > b:
        print("Alice")
    elif b > a:
        print("Bob")
    else:
        print("Draw")
# Judge status: Accepted
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    s = ["".join(sorted(str(readline().rstrip().decode('utf-8')))) for _ in range(n)]
    s = collections.Counter(s).most_common()
    t = 0
    for k, v in s:
        if v > 1:
            t += (1 + v - 1) * (v - 1) // 2
    print(t)


if __name__ == '__main__':
    solve()
# Judge status: Accepted
d,n=map(int,input().split())
print(pow(100,d)*n if n<100 else pow(100,d)*101)
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))

now=0
visited=set()
visited.add((0))
visited2=[0]


while True:
  k-=1
  now=a[now]-1

  if k==0:
    print(now+1)
    exit()

  
  if now in visited:
    visited.add((now))
    visited2.append(now)
    break

  visited.add((now))
  visited2.append(now)


xxx=visited2[-1]
cnt=[]
for i in range(len(visited2)):
  if visited2[i]==xxx:
    cnt.append(i)


k%=cnt[1]-cnt[0]


if k!=0:
  for i in range(k):
    now=a[now]-1
  

print(now+1)
# Judge status: Wrong Answer
O = input()
E = input()

ans = ''
for o, e in zip(O, E):
    ans += o+e

print(ans)
# Judge status: Accepted
n = int(input())
st = 0
sx, sy = 0, 0
ng = False
for _ in range(n):
    t, x, y = map(int, input().split())
    dt = (t - st)
    dx = abs(sx - x)
    dy = abs(sy - y)

    if dt%2 == (dx+dy)%2 and dx+dy <= dt:
        st = t
        sx = x
        sy = y
    else:
        ng = True
        break
print('No' if ng else 'Yes')
# Judge status: Wrong Answer
N = int(input())

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

for i in range(len(A)-1):
  before = A[i] + A[i+1]
  after = -1*A[i] + (-1)*A[i+1]

  if A[i] >= 0 and i != len(A)-1:
    continue

  if A[i] < 0 and i != len(A)-1:
    A[i] *= -1
    A[i+1] *= -1 
    continue

  if after >= before:
    A[i] *= -1
    A[i+1] *= -1

print(sum(A))
# Judge status: Wrong Answer
n, k = map(int, input().split())
kids = list()
for i in range(k):
    d = input()
    kids += list(map(int, input().split()))
res = 0
print(kids)
for i in range(1,n+1):
    if i not in kids:
        res+= 1
print(res)
# Judge status: Accepted
import math
a,b=input().split()
c=int(a+b)
if int(math.sqrt(c))**2==c:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
S = list(input())
maxCommon = 1
for i in range(1, N-1):
    commonNum = len(list(set(S[0:i]) & set(S[i:])))
    if commonNum > maxCommon:
        maxCommon = commonNum
print(maxCommon)
# Judge status: Wrong Answer
a=set(input())
if len(a)<=2:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
a=list(map(int,input().split()))
if max(a)*2==sum(a):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N = int(input())
memo = [-1]*(N+1)
import sys
sys.setrecursionlimit(10**8)
def rec(n):
    if n == 0:return 0
    if memo[n] != -1:return memo[n]

    res = float('inf')

    pow6 = 1
    while pow6 <= n:
        res = min(res,rec(n-pow6)+1)
        pow6 *= 6

    pow9 = 1
    while pow9 <= n:
        res = min(res,rec(n-pow9)+1)
        pow9 *= 9

    memo[n] = res
    return memo[n]

print(rec(N))
# Judge status: Accepted
N = int(input())
D = list(map(int, input().split()))
dp = [0] * N
for i in D:
  dp[i] += 1
ans = 1 if dp[0] == 1 and D[0] == 0 else 0
for i in range(1, N):
  ans *= dp[i-1] ** dp[i]
  ans %= 998244353
print(ans)
# Judge status: Wrong Answer
n, m = map(int, input().split())
A = list(map(int, input().split()))

for a in A:
    if n < 0:
        print(-1)
        break
    n -= a
else:
    print(n)
# Judge status: Accepted
s = int(input())

c = s // 500
d = s % 500

e = d //5

h = c*1000 + e*5

print(h)
# Judge status: Accepted
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()
if s == u:
  print(a - 1, b)
else:
  print(a, b - 1)
# Judge status: Wrong Answer
s=input()
fs=int(s[:2])
ls=int(s[2:])
if 1<=fs<=12 and 13<=ls:
    print('MMYY')
elif 1<=fs<=12 and 1<=ls<=12:
    print('AMBIGUOUS')
elif fs>=13 and 1<=ls<=12:
    print('YYMM')
else:
    print('NA')
# Judge status: Accepted
A,B,T=map(int, input().split())
tmp=int(T/A)
print(tmp*B)
# Judge status: Wrong Answer
l = int(input())*10
Ma = 0

for i in range(1, l+1, 1):
    for j in range(1, l-i+1, 1):
        z = l - (i+j)
        result = z*i*j
        if(result>Ma):
            Ma = result
print(Ma/1000)
# Judge status: Wrong Answer
# coding: utf-8
from collections import Counter
alp = "abcdefghijklmnopqrstyvwxyz"
S = []
count = {}
for a in alp:
    count[a] = 51
N = int(input())
for i in range(N):
    s = input()
    S.append(s[:])
ans = []
for a in alp:
    cnt = 0
    min_ = 10**9
    for s in S:
        if a in s:
            cnt += 1
            min_ = min(min_, s.count(a))
    if cnt == N:
        for i in range(min_):
            ans.append(a)
ans.sort()
print("".join(ans))
# Judge status: Accepted
a, b, k = map(int, input().split())
if a - k > 0:
    a = a - k
elif a - k < 0:
    if b - (k - a) > 0:
        b = b - (k - a)
        a = 0
    else:
        b = 0
        a = 0
else:
    a = 0
print(a, b)
# Judge status: Accepted
def II(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
ans,pena=0,0
N,M=MI()
P=[0]*N
PENA=[0]*N
for i in range(M):
  p,s=input().split()
  p=int(p)
  p-=1
  if s=='AC':
    if P[p]==0:
      ans+=1
      P[p]=1
      if PENA[p]!=0:
        pena+=PENA[p]
  if s=='WA':
    if P[p]==0:
      PENA[p]+=1
print(ans,pena)
# Judge status: Accepted
n = int(input())
ab = []
for i in range(n):
    ai, bi = map(int,input().split())
    abi = [ai,bi]
    ab.append(abi)
sorted_ab = sorted(ab,key=lambda x : x[1])

fin = 0
for j in range(n):
    fin += sorted_ab[j][0]
    if fin > sorted_ab[j][1]:
        print("No")
        quit()
print("Yes")
# Judge status: Accepted
import sys
import heapq
from bisect import insort_right
input = sys.stdin.readline
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = [-a for a in A]
heapq.heapify(A)
  
for i in range(M):
  tmp = heapq.heappop(A)
  heapq.heappush(A,int(tmp/2))
print(sum([-a for a in A]))
# Judge status: Accepted
_=input()
s=input()
ans=1
for i in set(s):
    ans*=s.count(i)+1
    ans%=10**9+7
print(ans-1)
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))

ans=10**9+10
s=sum(a)
now=0
snuke=0
for i in range(N-1):
    snuke+=a[i]
    now=s-2*snuke
    ans=min(abs(now),ans)
    
print(ans)
# Judge status: Accepted
from collections import deque

CONST = 1000000007

n,m = map(int,input().split())
lis = deque([int(input()) for _ in range(m)])
lis.append(n+1)
nhole = lis.popleft()

memo = deque([0, 1])
for i in range(1,n+1):
    if i == nhole:
        memo.append(0)
        nhole = lis.popleft()
    else:
        memo.append((memo[-1] + memo[-2])%CONST)
print(memo[-1])
# Judge status: Wrong Answer
h = int(input())


print((2**(int(h/2)+1))-1)
# Judge status: Accepted
s=input()
k=int(input())

tmp=len(s)
for i in range(len(s)):
    if s[i]!='1':
        tmp=i
        num=s[i]
        break
if k>tmp:
    print(num)
else:
    print('1')
# Judge status: Accepted
l,r=map(int,input().split())
ans=10**9+7
if l==0 or (r-l>=2019):
    print(0)
else:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans=min(ans,(i%2019)*(j%2019)%2019)
    print(ans)
# Judge status: Accepted
a, b, c = map(int,input().split())
sum = a+b+c
flag = False
if sum/2 == a + b:
  flag = True
if sum/2 == b + c:
  flag = True
if sum/2 == c + a:
  flag = True

if flag == True:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
s = set(list(input()))
ans = 'Yes'
if ('N' in s)!=('S' in s) or ('W' in s)!=('E' in s):ans = 'No'
print(ans)
# Judge status: Wrong Answer
A=int(input())
B=int(input())
if A==2 and B==3:
  print(1)
elif A==3 and B==1:
  print(2)
elif A==1 and B==3:
  print(2)
elif A==3 and B==1:
  print(1)
else:
  print(3)
# Judge status: Accepted
N = int(input())

my_list = []

for i in range(N):
    sp = input().split()
    sp[1] = int(sp[1])
    sp.insert(0, i+1)
    
    my_list.append(sp)
    
my_list.sort(key = lambda x: x[2], reverse=True)
my_list.sort(key = lambda x: x[1])

for i in my_list:
    print(i[0])
# Judge status: Accepted
import collections
n = int(input())
a = list(map(int, input().split()))
a = collections.Counter(a)
ans = []
for i, j in a.items():
    if j >= 2:
        for _ in range(j):
            ans.append(i)
ans.sort(reverse=True)
if len(ans) <= 3:
    print(0)
else:
    print(ans[0]*ans[3])
# Judge status: Accepted
from functools import reduce
#!/usr/bin/env python3

import math


def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def main():
    N = int(input())
    T = [int(input()) for i in range(N)]
    ans = lcm_list(T)
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
a,b=map(int, input().split())

if a<b :
    for i in range(b) :
        print(a)
else :
    for i in range(a) :
        print(b)
# Judge status: Wrong Answer
j = 1
a = 1
i = int(input())

while i > 1:
    i /= 2
    j *= 2
    a += j

print(a)
# Judge status: Accepted

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

minX = min(X)
maxX = max(X)
if minX==maxX:
    print(0)
    quit()

HP = []
for p in range(minX, maxX):
    hp = 0
    for x in X:
        hp += (x-p)**2
    HP.append(hp)

print(min(HP))
# Judge status: Accepted
a, b, k = map(int, input().split())

m = set(range(a, min(a+k, b)))
n = set(range(max(a, b-k+1), b+1))
l = m | n

for i in sorted(l):
    print(i)
# Judge status: Wrong Answer
X = int(input())
if X % 3 == 0 or X % 3 == 0 or X % 7 == 0:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n, k = (int(x) for x in input().split())

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

if n == k:
    print(1)
elif k == 2:
    print(n-1)
else:
    rem = n % (k-1)
    m = (n - rem) / (k-1)
    if rem <= 1:
        print(int(m))
    else:
        print(int(m+1))
# Judge status: Accepted
a, b, c, x, y = map(int, input().split())
ans = 0
min_ = min(x, y)
res = abs(x-y)
if a+b < 2*c:
    ans += min_*(a+b)
else:
    ans += min_*2*c
if x>y and res*a < res*2*c:
    ans += res*a
elif x<y and res*b < res*2*c:
    ans += res*b
else:
    ans += res*2*c
print(ans)
# Judge status: Wrong Answer
X ,Y = map(int, input().split())
l = []
ans = 0

for i in range(Y-X):
    if i == 0:
        t = X
        l.append(t)
    else:
        t = t * 2
        if t <=Y:
            l.append(t)
        else:
            break

ans = len(l)
print(ans)
# Judge status: Wrong Answer
import itertools
n, m, q = map(int, input().split())
list_score = [ list(map(int,input().split(" "))) for i in range(q)]
list_NUM = [i for i in range(1, m+1)]
ans = 0

if q < n:
    for l in list_score:
        ans += l[3]
else:
    for l in itertools.product(list_NUM, repeat=n):
        cnt = 0
        for h in list_score:
            if l[h[1]-1] - l[h[0]-1] == h[2]:
                cnt += h[3]

        ans = max(ans, cnt)

print(ans)
# Judge status: Accepted
n,a,b = map(int,input().split())
cnt = 0

for i in range(n+1):
    ans = 0
    tmp = i
    while(tmp>0):
        ans += tmp%10
        tmp = tmp//10
        #print(ans, tmp)
    
    if(a<=ans and ans<=b):
        cnt+=i

print(cnt)
# Judge status: Accepted
k,n,*a=map(int,open(0).read().split())
a+=[k+a[0]]
print(k-max(y-x for x,y in zip(a,a[1:])))
# Judge status: Accepted
d, n = map(int,input().split())

i = 0
count = 0
beki = 0

beki = 100 ** d

while not count == n:
    i += 1
    if i % 100 == 0:
        continue
    count += 1

print(i * beki)
# Judge status: Accepted
a=[]
for i in input():
    if i=="S":
        a+=i
    
    if a:
        if i=="T" and a[-1]=="T":
            a+=i
        if i=="T" and a[-1]=="S":
            a.pop(-1)
    elif i=="T" and len(a)==0:
        a+=i    
print(len(a))
# Judge status: Accepted
N=input()
ans=0
for n in N:
    ans+=int(n)
if ans==1:
    ans=10
print(ans)
# Judge status: Wrong Answer
import numpy
a,b,c = map(int,input().split())
chka= numpy.sqrt(a) + numpy.sqrt(b)
chkc = numpy.sqrt(c)

if chka < chkc:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import numpy as np
r = int(input())

print(2 * np.pi * r)
# Judge status: Accepted
N = int(input())
t = 0
x = 0
y = 0
for i in range(N):
    t1,x1,y1 = map(int,input().split())
    if abs(x1-x) + abs(y1-y) > t1-t or (abs(x1-x) + abs(y1-y) - (t1-t)) % 2 != 0:
        print('No')
        exit(0)
    t,x,y = t1,x1,y1
print('Yes')
# Judge status: Accepted
A, B, K = map(int, input().split())

ans1 = [i for i in range(A, A + K) if A <= i and i <= B]
ans2 = [i for i in range(B, B - K, -1) if A <= i and i <= B]

ans = ans1 + ans2
ans = list(set(ans))
ans.sort()
for ans in ans:
    print(ans)
# Judge status: Accepted
N,L = map(int,input().split())
c = 0
if L >= 0:
    skip = 0
else:
    if N - (-L) > 0:
        skip = L*-1
    else:
        skip = N-1
for i in range(N):
    if i == skip:
        continue
    c += L+i
print(c)
# Judge status: Accepted
S = str(input())
abc = [S[0], S[1], S[2]]
if "a" in abc and "b" in abc and "c" in abc:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
d, n = map(int, input().split())

print(100**d * n if n!=100 else 100**d * 101)
# Judge status: Accepted
def main():
    count=0
    n=int(input())
    x = [list(map(int, input().split())) for i in range(n)]
    for i in range(n):
        if x[i][0]==x[i][1]:
            count=count+1
        else:
            count=0

        if count==3:
            print("Yes")
            break


    if count!=3:
        print("No")





if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
H = list(map(int, input().split()))
q = 0
s = [0]
for i in range(N-1):
  if H[i] >= H[i+1]:
    p = q + 1
    s.append(p)
    q = q + 1
  else:
    s.append(0)
    q = 0

s.sort()
ans = s[-1]
print(ans)
# Judge status: Accepted
N = int(input())
A = [int(input()) for i in range(N)]
arr = []
from bisect import bisect
for a in A:
    i = bisect(arr, -a)
    if i == len(arr):
        arr.append(-a)
    else:
        arr[i] = -a
print(len(arr))
# Judge status: Accepted
A,V = input().split()
B,W = input().split()

A = int(A)
V = int(V)
B = int(B)
W = int(W)

T = int(input())



def solve():

    distance = abs(B-A)
    closer = abs(V-W)

    if V <= W:
        print("NO")
        return

    time = distance/closer
    if time <= T:
        print("YES")
        return
    else:
        print("NO")
        return


solve()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

a.sort()

print(sum(a[n:3*n-1:2]))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
for i,j in enumerate(a):
    b[j-1] = str(i+1)
print(" ".join(b))
# Judge status: Accepted
A, B = map(int, input().split(' '))

if A >= 10 or B >= 10:
    print('-1')
else:
    print(A*B)
# Judge status: Accepted
import heapq


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

A = [a * -1 for a in A]

heapq.heapify(A)
for _ in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A, (-a // 2) * (-1))

print(-sum(A))
# Judge status: Accepted
n = int(input())
k = [0] * n
l = [0] * n
for i in range(n):
  x, y = [int(i) for i in input().split()]
  k[i] = x + y
  l[i] = x - y
print(max(max(k)-min(k), max(l)-min(l)))
# Judge status: Wrong Answer
k, s = 5, 15

count = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                count += 1

print(count)
# Judge status: Accepted

a,b,c = map(int,input().split())

if (b//a) <= c:
    print(int(b//a))
else:
    print(c)
# Judge status: Accepted
N = input()

if int(N)>= 1000:
    print("ABD")

else:
    print("ABC")
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    a=list(input().split())
    akisu=a[0::2]
    agusu=a[1::2][::-1]
    b=agusu+akisu
    if n%2==0:
        print(*b)
    else:
        print(*b[::-1])
resolve()
# Judge status: Wrong Answer
n=int(input())
c=1

for i in range(1,n+1):
    if i>1:
        y=0
        for j in range(1,i+1):
            
            if i%j ==0:
                y=y+1
                print(y)
        c=c+(i*y)
        print(c)
print(c)
# Judge status: Accepted
n,k = map(int, input().split())
a = list(map(int, input().split()))

visit = [0] * n
visit[0] = 1
keiro = [1]

s = 1
now = 1

while True:
    x = a[now - 1]
    if visit[x - 1] == 1:
        break
    now = x
    visit[x - 1] = 1
    keiro.append(x)

l1 = len(keiro)
l2 = keiro.index(x)

if k < l1:
    print(keiro[k])
else:
    p = (k - l2) % (l1 - l2)
    print(keiro[l2 + p])
# Judge status: Wrong Answer
import numpy as np
n, k = map(int, input().split())
a = list(map(int, input().split()))
cum_a = np.cumprod(a)
cum_a = np.hstack([np.ones(1), cum_a])
for i in range(n - k):
    s = cum_a[i + k] / cum_a[i]
    t = cum_a[i + k + 1] / cum_a[i + 1]
    if s < t:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
n = int(input())
s=(n-1)
#ab = n//2 if n%2==0 else n//2 + 1
for x in range(2,n//2):
    if n%x==0:
        s+=(n//x - 1)
    else:
        s+=(n//x)
print(s + n//2)
# Judge status: Accepted
sh, sm, eh, em, K = map(int, input().split())

time = 60*(eh-sh) + em - sm
print(time - K)
# Judge status: Accepted
N,K = map(int,input().split())
A = list(map(int,input().split()))

def f(n):
    now = 0
    for i in range(N):
        now += (A[i]-1)//x
    if now <= K:
        return True
    else:
        return False

l = 0; r = 10**10
while r-l > 1:
    x = (l+r)//2
    if f(x):
        r = x
    else:
        l = x
print(r)
# Judge status: Wrong Answer
import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right,bisect
n,m,k=map(int,stdin.readline().split())
a=list(map(int,stdin.readline().split()))
b=list(map(int,stdin.readline().split()))
prea=[]
ans=0
for i in a:
    ans+=i 
    prea.append(ans)
final=0
temp=0
for i in range(m):
    temp+=b[i]
    if(temp>k):
        break
    temp2=bisect(prea,k-temp)
    final=max(final,temp2+i+1)
print(final)
# Judge status: Wrong Answer
N = int( input() )
h = [int(x) for x in input().split()]

h     = [0] + h
dp    = [0]*( len(h) )
for ii in range( 2, len(dp) ):
    from_1 = abs(h[ii] - h[ii-1])
    from_2 = abs(h[ii] - h[ii-2])
    dp[ii] = min( dp[ii-1] + from_1, dp[ii-2] + from_2 )
    
print(dp[-1])
# Judge status: Wrong Answer
N,A,B = map(int,input().split())
K = 0
for i in range(1,N+1):
  if A <= sum(list(map(int,str(i)))) <= B:
    K += 1
print(K)
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
n=0
for i in range(min(a,b),0,-1):
    if (a/i==a//i) and (b/i==b//i):
        print(i)
        n+=1
        if n==k:
            print(i)
            exit()