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

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

b=[]

for i in range(n):
  b.append(a[i])
  b.reverse()

for j in range(n):
  print(b[j], end=' ')

### FIXED CODE ###

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

ans=[0]*n
for i in range(n):
  if i%2 ==0:
    ans[n//2+i//2]=a[i]
  else:
    ans[n//2-i//2-1]=a[i]

print(str(ans).replace("[","").replace("]","").replace(",","") if n%2 ==0 else str(ans[::-1]).replace("[","").replace("]","").replace(",","") )
### BUGGY CODE ###

N, C = map(int, raw_input().split())
 
D = [ [int(i) for i in raw_input().split()] for _ in xrange(C) ]
c = [ [int(i) for i in raw_input().split()] for _ in xrange(N) ]
 
costD = [ [0, 0, 0] for _ in xrange(C)]
 
for c0 in xrange(C):
    for i in xrange(N):
        for j in xrange(N):
            costD[c0][(i+j)%3] += D[c[i][j]-1][c0]
 
kohoD = []
 
for c1 in xrange(C):
    for c2 in xrange(C):
        if c1 == c2:
            continue
        for c3 in xrange(C):
            if c1 == c3 or c2 == c3:
                continue
            kohoD += [(costD[c1][0] + costD[c2][1] + costD[c3][2])]
 
print(min(kohoD))

### FIXED CODE ###

import itertools
 
 
def main():
    N, C = map(int, input().split())
    D = [list(map(int, input().split())) for _ in range(C)]
    CC = [list(map(lambda x: int(x) - 1, input().split())) for _ in range(N)]
 
    cost = [[0 for _ in range(C)] for _ in range(3)]
    for c in range(C):
        for i in range(N):
            for j in range(N):
                cost[(i + j) % 3][c] += D[CC[i][j]][c]
 
    res = float("inf")
    color = [i for i in range(C)]
    for i, c in enumerate(list(itertools.permutations(color, 3))):
        tmp = 0
        for it in range(3):
            tmp += cost[it][c[it]]
        res = min(res, tmp)
 
    print(res)
 
main()
### BUGGY CODE ###

N,K = map(int,input().split())
points1 = []
points2 = []
for i in range(N):
	x,y = tuple((map(int,input().split())))
	points1.append((x,y))
	points2.append(y)
points1.sort()
points2.sort()

xDict = {}
index = 0
for x,y in points1:
	if index in xDict:
		if xDict[index] != x:
			index += 1
			xDict[index] = x
	else:
		xDict[index] = x

yDict = {}
index = 0
for y in points2:
	if index in yDict:
		if yDict[index] != y:
			index += 1 
			yDict[index] = y
	else:
		yDict[index] = y

nPoints = [[0 for j in range(len(yDict))] for i in range(len(xDict))]

for kx,vx in xDict.items():
	for ky,vy in yDict.items():
		exists = 1 if (vx,vy) in points1 else 0
		if kx == 0 and ky == 0:
			nPoints[kx][ky] += exists
		elif kx == 0 and ky > 0:
			nPoints[kx][ky] += nPoints[kx][ky-1] + exists
		elif kx > 0 and ky == 0:
			nPoints[kx][ky] += nPoints[kx-1][ky] + exists
		else:
			nPoints[kx][ky] += nPoints[kx-1][ky] + nPoints[kx][ky-1] - nPoints[kx-1][ky-1] + exists

ans = -1
for x1 in range(len(xDict)):
	for x2 in range(x1+1):
		for y1 in range(len(yDict)):
			for y2 in range(y1+1):
				point = nPoints[x1][y1]
				if x2 > 0:
					point -= nPoints[x2-1][y1]
				if y2 > 0:
					point -= nPoints[x1][y2-1]
				if x2 > 0 and y2 > 0:
					point += nPoints[x2-1][y2-1]
				if point >= K:
					area = (xDict[x1]-xDict[x2]) * (yDict[y1]-yDict[y2])
					if ans < 0:
						ans = area
					else:
						ans = min(ans, area)
print(ans)

### FIXED CODE ###

N,K = map(int,input().split())
points1 = []
points2 = []
for i in range(N):
	x,y = tuple((map(int,input().split())))
	points1.append((x,y))
	points2.append(y)
points1.sort()
points2.sort()

xDict = {}
index = 0
for x,y in points1:
	if index in xDict:
		if xDict[index] != x:
			index += 1
			xDict[index] = x
	else:
		xDict[index] = x

yDict = {}
index = 0
for y in points2:
	if index in yDict:
		if yDict[index] != y:
			index += 1 
			yDict[index] = y
	else:
		yDict[index] = y

nPoints = [[0 for j in range(len(yDict))] for i in range(len(xDict))]

for kx,vx in xDict.items():
	for ky,vy in yDict.items():
		exists = 1 if (vx,vy) in points1 else 0
		if kx == 0 and ky == 0:
			nPoints[kx][ky] += exists
		elif kx == 0 and ky > 0:
			nPoints[kx][ky] += nPoints[kx][ky-1] + exists
		elif kx > 0 and ky == 0:
			nPoints[kx][ky] += nPoints[kx-1][ky] + exists
		else:
			nPoints[kx][ky] += nPoints[kx-1][ky] + nPoints[kx][ky-1] - nPoints[kx-1][ky-1] + exists

ans = -1
for x1 in range(len(xDict)):
	for x2 in range(x1+1,-1,-1):
		for y1 in range(len(yDict)):
			for y2 in range(y1+1,-1,-1):
				point = nPoints[x1][y1]
				if x2 > 0:
					point -= nPoints[x2-1][y1]
				if y2 > 0:
					point -= nPoints[x1][y2-1]
				if x2 > 0 and y2 > 0:
					point += nPoints[x2-1][y2-1]
				if point >= K:
					area = (xDict[x1]-xDict[x2]) * (yDict[y1]-yDict[y2])
					if ans < 0:
						ans = area
					else:
						ans = min(ans, area)
					break
print(ans)
### BUGGY CODE ###

#coding:utf-8

n = int(input())
s = input()

count = 0
r_list = []
g_list = []
b_list = []

for k,i in enumerate(s):
    if i == 'R':
        r_list.append(k)
    elif i == 'G':
        g_list.append(k)
    elif i == 'B':
        b_list.append(k)

count = len(r_list) * len(g_list) * len(b_list)

for i in range(n-2):
    si = s[i]
    for j in range(i+1,n-1):
        sj = s[j]
        c_set = {'R','G','B'}
        c_set = c_set - {si,sj}
        nk = 2 * j - i
        if c_set == {'R'} and nk in r_list:
            count -= 1
        elif c_set == {'G'} and nk in g_list:
            count -= 1
        elif c_set == {'B'} and nk in b_list:
            count -= 1        

print("{}".format(count))

### FIXED CODE ###

#coding:utf-8

n = int(input())
s = input()

count = 0
r, g, b = 0, 0, 0

for i in s:
    if i == 'R':
        r += 1
    elif i == 'G':
        g += 1
    elif i == 'B':
        b += 1

count = r * g * b

for i in range(n-2):
    si = s[i]
    for j in range(i+1,n-1):
        sj = s[j]
        nk = 2 * j - i
        if not nk < n:
            break
        snk = s[nk]
        if {si, sj, snk} == {'R','G','B'}:
            count -= 1

print("{}".format(count))
### BUGGY CODE ###

from itertools import product

n=int(input())
s=[int(input()) for _ in [0]*n]

m=0
for t in product([0,1],repeat=len(s)):
    v=sum([i*j for i,j in zip(s,t)])
    if m<v and v%10!=0:
        m=v
print(m)

### FIXED CODE ###

n=int(input())
s=sorted([int(input()) for _ in [0]*n])

if sum(s)%10==0:
    f=False
    for i in s:
        if i%10!=0:
            f=True
            break
    if f:
        s.remove(i)
        print(sum(s))
    else:
        print(0)
else:
    print(sum(s))
### BUGGY CODE ###

import sys,math,copy
input = sys.stdin.readline

N=int(input().strip())
A=[int(x) for x in input().strip().split()]
def gcd(a,b):
    if b==0:
        return a
    
    return gcd(b,a%b)

ANS=[]
L=[0]
R=[0]
for i in range(len(A)):
    L.append(gcd(A[i],L[i]))
    R=[gcd(A[-1-i],R[0])]+R

for i in range(len(L)-1):
    ANS.append(gcd(L[i],R[i+1]))

print(max(ANS))


### FIXED CODE ###

import sys,math,copy
from fractions import gcd
input = sys.stdin.readline

N=int(input().strip())
A=[int(x) for x in input().strip().split()]
# def gcd(a,b):
#     if b==0:
#         return a
    
#     return gcd(b,a%b)

ANS=[]
L=[0]
R=[0]
for i in range(len(A)):
    L.append(gcd(A[i],L[-1]))
    R.append(gcd(A[-1-i],R[-1]))

R.reverse()
for i in range(len(L)-1):
    ANS.append(gcd(L[i],R[i+1]))

print(max(ANS))
### BUGGY CODE ###

import sys

s = sys.stdin.readline().rstrip()
q = int(input())
cnt = 0
for i in range(q):
    query = sys.stdin.readline().split()
    if query[0] == '1':
        cnt = (cnt + 1)%2
    else:
        if (int(query[1]) + cnt)%2 == 1:
            s = "".join([query[2], s])
        else:
            s = "".join([s, query[2]])

if cnt:
    s = s[::-1]
print(s)

### FIXED CODE ###

import sys
from collections import deque

s = deque([sys.stdin.readline().rstrip()])
q = int(input())
cnt = 0
for i in range(q):
    query = sys.stdin.readline().split()
    if query[0] == '1':
        cnt = (cnt + 1)%2
    else:
        if (int(query[1]) + cnt)%2 == 1:
            s.appendleft(query[2])
        else:
            s.append(query[2])
s = "".join(s)
if cnt:
    s = s[::-1]
print(s)
### BUGGY CODE ###

n = int(input())
a = [int(input()) for i in range(n)]

for i in range(n):
    b = a[:]
    del b[i]
    print(max(b))


### FIXED CODE ###

n = int(input())
a = [int(input()) for i in range(n)]
b = sorted(a)

for A in a:
    if A == b[n - 1]:
        print(b[n - 2])
    else:
        print(b[n - 1])
### BUGGY CODE ###

import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

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

cons = [0] * (N + 1)
cur = 0
mn, mx = 0, 0
for j in range(N + 1):
    i = N - j
    mn = ((mn + 1) // 2) + A[i]
    mx = mx + A[i]
    if mn > 2 ** i:
        print(-1)
        exit()
    cons[i] = (mn, mx)

ans = 0
cnt_node = 1
for i in range(N + 1):
    mn, mx = cons[i]
    now = min(mx, cnt_node)
    ans += now
    cnt_node = (now - A[i]) * 2
print(ans)



### FIXED CODE ###

import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

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

cons = []
cur = 0
mn, mx = 0, 0
for i in range(N, -1, -1):
    mn = ((mn + 1) // 2) + A[i]
    mx = mx + A[i]
    if mn > 2 ** i:
        print(-1)
        exit()
    cons.append((mn, mx))
cons = list(reversed(cons))
ans = 0
cnt_node = 1
for i in range(N + 1):
    mn, mx = cons[i]
    now = min(mx, cnt_node)
    ans += now
    cnt_node = (now - A[i]) * 2
print(ans)
### BUGGY CODE ###

n,m=[int(i) for i in input().split()]
voyage=[tuple(int(i) for i in input().split()) for _ in range(m)]
for i in range(m):
    if voyage[i][0]==1:
        if (voyage[i][1],n) in voyage:
            print("POSSIBLE")
            break
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

n,m=[int(i) for i in input().split()]
a_to_b=[0]*n
for i in range(m):
    a,b=[int(j) for j in input().split()]
    if a==1:
        a_to_b[b]+=1
    if b==n:
        a_to_b[a]+=1
if 2 in a_to_b:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
### BUGGY CODE ###

n = int(input())
d_list = [int(i) for i in input().rstrip().split(' ')]

cnt = 0

for i in range(1, max(d_list)+1):
  cnt_low = 0
  cnt_high = 0
  for d in d_list:
    if i >= d:
      cnt_high += 1
    else:
      cnt_low += 1

  if cnt_high == cnt_low:
    cnt += 1
      
print(cnt)

### FIXED CODE ###

n = int(input())
d_list = [int(i) for i in input().rstrip().split(' ')]
d_list.sort()

a = int(n/2) -1
b = int(n/2)

if d_list[a] == d_list[b]:
  print(0)
else:
  print(d_list[b] - d_list[a])
### BUGGY CODE ###

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

for i in range(k):
    if a > 0:
        a = a - 1
    elif b > 0:
        b = b - 1

print(a, b)


### FIXED CODE ###

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

a_ans = max(a - k, 0)
b_ans = max(b - max(k - a, 0), 0)
print(a_ans, b_ans)
### BUGGY CODE ###

n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
m = 10**9+7

dp = [1, 1]
if 1 in a:
  dp[1] = 0

for i in range(2, n+1):
  t = 0 if i in a else (dp[i-2] + dp[i-1]) % m
  dp.append(t)

print(dp[-1])


### FIXED CODE ###

n, m = map(int, input().split())
a = set(int(input()) for _ in range(m))
m = 10**9+7

dp = [0 for _ in range(n+1)]
dp[0] = 1
dp[1] = 1
if 1 in a:
  dp[1] = 0

for i in range(2, n+1):
  dp[i] = 0 if i in a else (dp[i-2] + dp[i-1]) % m

print(dp[-1])
### BUGGY CODE ###

# -*- coding: utf-8 -*-

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

counter = 0

for i in range(N):
    sumval = 0
    for j in range(i, N, 1):
        sumval += A[j]
        if(sumval == 0):
            counter += 1

print(counter)

### FIXED CODE ###

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

sum_list = [None] * (N+1)

sum_list[0] = 0
for i in range(N):
    sum_list[i+1] = sum_list[i] + A[i]

output = 0
sum_list_sorted = sorted(sum_list)
i = 0
while i < N:
    k = 1
    for j in range(i+1, N+1):
        if sum_list_sorted[i] == sum_list_sorted[j]:
            k += 1
        else:
            break
    output += k * (k-1) // 2
    i += k
    
print(output)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
INF = int(1e18)
ans = 1
for i in range(N): ans*=A[i]
if(ans>INF): print(-1)
else: print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
INF = int(1e18)
ans = 1
for i in range(N):
  if(A[i]==0):
    print(0)
    exit()
for i in range(N):
  ans*=A[i]
  if(ans>INF):
    print(-1)
    exit()
print(ans)
### BUGGY CODE ###

from collections import *
from heapq import *
from itertools import *
from fractions import gcd

from decimal import *
import copy
from bisect import *
import time
import sys
import math
input=lambda :sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
K=int(input())
#A,B=map(int,input().split())
#A=list(map(int,input().split()))
z=0
for a in range(1,K+1):
    for b in range(1,K+1):
        d=gcd(a,b)
        if d==1:
            z+=K
        else:
            for c in range(1,K+1):
                z+=gcd(c,d)
print(z)


### FIXED CODE ###

from collections import *
from heapq import *
from itertools import *
from fractions import gcd

from decimal import *
import copy
from bisect import *
import time
import sys
import math
input=lambda :sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
K=int(input())
#A,B=map(int,input().split())
#A=list(map(int,input().split()))
z=0
dic=defaultdict(int)
for a in range(1,K+1):
    for b in range(1,K+1):
        d=gcd(a,b)
        dic[d]+=1
for d in dic:

    for c in range(1,K+1):
        z+=dic[d]*gcd(c,d)
print(z)
### BUGGY CODE ###

N=int(input())
lst=[]
for i in range(N):
  text=input()
  lst=lst+[sorted(text)]
lst=sorted(lst)      
count=0
i=0
while(i<N-1):
  j=1
  while(lst[i]==lst[i+j]):
    count=count+j
    j=j+1
    if (i+j >= N):
      break
  i=i+j
print(count)

  

### FIXED CODE ###

N=int(input())
d={}
for i in range(N):
  text=''.join(sorted(input()))
  if text in d :
    d[text]+=1
  else:
    d[text]=1
count=0
for v in d.values() :
  count+=(v-1)*v/2
print(int(count))
### BUGGY CODE ###

import heapq
from fractions import Fraction

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

a = list(map(lambda x: Fraction(1, int(x)), input().split()))

heapq.heapify(a)

for i in range(m):
    x = heapq.heappop(a)
    heapq.heappush(a, Fraction(x.numerator * 2, x.denominator))

s = 0


for j in range(n):
    s += int(Fraction(a[j].denominator, a[j].numerator))

print(s)


### FIXED CODE ###

import heapq
from fractions import Fraction

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

a = list(map(lambda x: Fraction(1, int(x)), input().split()))

heapq.heapify(a)

for i in range(m):
    x = heapq.heappop(a)
    y = Fraction(x.numerator * 2, x.denominator)
    if y.numerator < y.denominator:
        heapq.heappush(a, y)
    elif len(a) == 0:
        break

s = 0


for j in range(len(a)):
    s += int(Fraction(a[j].denominator, a[j].numerator))

print(s)
### BUGGY CODE ###

def sieve_of_eratosthenes(N):
    prime_list = [True for _ in range(N + 1)]
    prime_list[0] = False
    prime_list[1] = False
    for p in range(2, int(N ** 0.5) + 1):
        if prime_list[p]:
            for i in range(2 * p, N + 1, p):
                prime_list[i] = False

    return prime_list


Q = int(input())
Max_ = 10**5
prime_list = sieve_of_eratosthenes(Max_)
prime_check_list = [0]*(Max_ + 1)
for i in range(1, Max_ + 1, 2):
    if prime_list[i] and prime_list[(i + 1) // 2]:
        prime_check_list[i] = 1
for _ in range(Q):
    l, r = map(int, input().split())
    print(sum(prime_check_list[l:r+1]))

### FIXED CODE ###

def sieve_of_eratosthenes(N):
    prime_list = [True for _ in range(N + 1)]
    prime_list[0] = False
    prime_list[1] = False
    for p in range(2, int(N ** 0.5) + 1):
        if prime_list[p]:
            for i in range(2 * p, N + 1, p):
                prime_list[i] = False

    return prime_list


Q = int(input())
Max_ = 10**5
prime_list = sieve_of_eratosthenes(Max_)
count_list = [0]*(Max_+1)
count = 0
for i in range(Max_+1):
    if prime_list[i] and prime_list[(i + 1) // 2]:
        count += 1
    count_list[i] = count
for _ in range(Q):
    l, r = map(int, input().split())
    print(count_list[r] - count_list[l-1])
### BUGGY CODE ###

S=int(input())
cond=0

if S<=10**9:
 print(0,0,1,0,0,S)
else:
 for x2 in reversed(range(1,10**9+1,3)):
   if int(S/x2)>0 and int(S/x2)+1 <=10**9:
      print(0,0,x2,1,x2-S%x2,int(S/x2)+1)
      break



### FIXED CODE ###

S=int(input())
cond=0

if S<=10**9:
 print(0,0,1,0,0,S)
elif S==10**18:
 print(0,0,10**9,0,0,10**9)
else:
 for x2 in reversed(range(1,10**9+1)):
   if int(S/x2)+1 <=10**9:
      print(0,0,x2,1,x2-S%x2,int(S/x2)+1)
      break
### BUGGY CODE ###

a,b = map(int,input().split())
min_count = min(a,b)
list_d = [1]
count = 0
flag = True
ans = [1]
for i in range(2,min_count+1):
    if a%i==0 and b%i==0:
        list_d.append(i)
a = list_d[1:]

for i in a:
    flag = True
    for j in list_d[1:list_d.index(i)]:
        if i%j == 0:
            flag = False
            break
    if flag:
        ans.append(i)

print(len(ans))


### FIXED CODE ###


a,b = map(int,input().split())
def gcd(x,y):
    if y == 0:
        return x
    else:
        return gcd(y,x%y)
def waru(max_gcd,x):
    if max_gcd%x != 0:
        return max_gcd
    else:
        return waru(max_gcd//i,x)

count = 0
max_gcd = gcd(a,b)

for i in range(2,max_gcd+1):
    if i*i > max_gcd:
        break
    if max_gcd%i == 0:
        count += 1
        max_gcd = waru(max_gcd,i)
if max_gcd == 1:
    print(count+1)
else:
    print(count+2)
### BUGGY CODE ###

N = int(input())
lst = []
for i in range(N):
    S = str(input())
    if S not in lst:
        lst.append(S)

print(len(lst))


### FIXED CODE ###

N = int(input())
lst = {}
for i in range(N):
    S = str(input())
    if S not in lst.keys():
        lst[S] = []

print(len(lst))
### BUGGY CODE ###

n=int(input())
for i in range(10**9):
    if i**2>n:print((i-1)**2)

### FIXED CODE ###

n=int(input())
for i in range(10**9):
    if i**2>n:
        print((i-1)**2)
        break
### BUGGY CODE ###

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

res = 1
for t in a:
    res *= t

if res > 10**18:
    print(-1)
else:
    print(res)

### FIXED CODE ###

import sys
n = int(input())
a = sorted(list(map(int, input().split())))

res = 1
for t in a:
    res *= t
    if res > 10**18:
        print(-1)
        sys.exit()
    if res == 0:
        print(res)
        sys.exit()
else:
    print(res)
### BUGGY CODE ###

from sys import exit
from itertools import product
import numpy as np
HWK,*sss = open(0).read().splitlines()
H,W,K = map(int, HWK.split())
sss = [list(map(int, list(ss))) for ss in sss]
sss = np.add.accumulate(sss)

if H == 1 or W == 1:
    print(0--sss[-1][-1]//K)
    exit()

ans = float('inf')
for flgs in product([0,1], repeat=H-1):
    cnt = 0
    hh = [h for h, flg in zip(range(H-1), flgs) if flg]
    cnt += len(hh)
    hh.append(-1)
    tsss = sss[hh]
    tsss = np.concatenate((tsss[:1], np.diff(tsss, axis=0)), axis=0)
    
    tmp = np.zeros(tsss.shape[0])
    for w in range(W):
        cur = tsss[:,w]
        new = tmp + cur
        if new.max() <= K:
            tmp = new
        else:
            cnt += 1
            if cur.max() > K:
                continue
            else:
                tmp = cur
#     print(cnt, ans, tsss)
    ans = min(ans, cnt)

print(ans)

### FIXED CODE ###

from sys import exit
from itertools import product
import numpy as np
HWK,*sss = open(0).read().splitlines()
H,W,K = map(int, HWK.split())
sss = [list(map(int, list(ss))) for ss in sss]
sss = np.cumsum(sss, axis=0)
 
if H == 1 or W == 1:
    print(0--sss[-1][-1]//K)
    exit()
 
ans = float('inf')
for flgs in product([False, True], repeat=H-1):
    cnt = sum(flgs)
    tsss = sss[[*flgs, True]]
    tsss = np.concatenate((tsss[:1], np.diff(tsss, axis=0)), axis=0).T
 
    tmp = 0
    succ = True
    for cur in tsss:
        new = tmp + cur
        if new.max() <= K:
            tmp = new
        else:
            cnt += 1
            if cur.max() > K:
                succ = False
                break
            else:
                tmp = cur
#     print(flgs)
#     print(cnt, ans, tsss)
    if succ:
        ans = min(ans, cnt)
 
print(ans)
### BUGGY CODE ###

S = input()
mod_bucket = [0] * 2019
mod_bucket[0] += 1

for i in range(len(S)):
    mod = int(S[i:]) % 2019
    mod_bucket[mod] += 1

ans = sum([mod*(mod-1)/2 for mod in mod_bucket])
print(int(ans))


### FIXED CODE ###

S = input()
mod_bucket = [0] * 2019
mod_bucket[0] += 1

_S = S[::-1]
mod = 0
p = 1
for i in range(len(S)):
    mod = (p * int(_S[i]) + mod) % 2019
    mod_bucket[mod] += 1
    p *= 10
    p %= 2019

ans = sum([mod*(mod-1)/2 for mod in mod_bucket])
print(int(ans))
### BUGGY CODE ###

hlist = list(str(input()))
ch = 0
hh = 0
f = 0 #홍수구역인지 아닌지 판단
s = 0
slist = []
chlist = []
for i in range(len(hlist)):
    if (hlist[i] == '/'):
        ch += 1
    elif (hlist[i] == '\\' ):
        ch -= 1
    chlist.append(ch)
ch = 0
for i in range(len(hlist)):
    if (hlist[i] == '/'):
        ch += 1
    elif (hlist[i] == '\\' ):
        ch -= 1
    
    if (hh > max(chlist[i:])):
        hh = max(chlist[i:])
    elif (ch > hh):
        hh = ch
    elif (ch < hh):
        f = 1
    elif (ch == hh and chlist[i] == chlist[i-1] + 1):
        f = 0
        s += 1/2
        slist.append(s)
    
    if (f == 1):
        if (hlist[i] == '/'):
            s += (hh - ch + 1/2)
        elif (hlist[i] == '\\'):
            s += (hh - ch - 1/2)
        elif (hlist[i] == '_'):
            s += (hh - ch)
    elif (f == 0):
        s = 0

print(int(sum(slist)))
if len(slist) != 0:
    print(len(slist), end = ' ')
else:
    print(len(slist), end = '')
for i in range(len(slist)):
    if (i == len(slist) - 1):
        print(int((slist[i])), end = '')
    else:
        print(int((slist[i])), end = ' ')
print()


### FIXED CODE ###

s=j=0
a=[];b=[];d=[]
for i,x in enumerate(input()):
    if x=='\\':a+=[i]
    elif x=='/' and a:
        j=a.pop()
        c=i-j;s+=c
        while b and b[-1]>j:c+=d.pop();b.pop()
        b+=[j];d+=[c]
print(s)
print(len(b),*(d))
### BUGGY CODE ###

n, a, b = map(int, input().split())
list_enemy = [int(input()) for _ in range(n)]
list_enemy.sort(reverse=True)
sub_list = list_enemy
count = 0
while len(sub_list) > 0:
  temp_list = [one_e - b for one_e in sub_list[1:] if one_e - b > 0]
  if sub_list[0] > a:
    temp_list.insert(0, sub_list[0] - a)
  sub_list = temp_list
  sub_list.sort(reverse=True)
  count += 1
print(count)

### FIXED CODE ###

import math
n, a, b = map(int, input().split())
list_enemy = [int(input()) for _ in range(n)]
list_enemy.sort(reverse=True)

diff_dam = a - b
min_a = math.ceil(list_enemy[-1] / a)
max_a = math.ceil(list_enemy[0] / b)
while max_a - min_a > 1:
  mid_a = min_a + (max_a - min_a) // 2
  count = 0
  for one_enemy in list_enemy:
    rest_h = one_enemy - (b * mid_a)
    if rest_h > 0:
      count += math.ceil(rest_h / diff_dam)
    else:
      break
  if count <= mid_a:
    max_a = mid_a
  else:
    min_a = mid_a
print(max_a)