Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(100000000000)
 
ma_map = [ -1, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]
N, M = (int(i) for i in input().split())
ma = list(int(i) for i in input().split())
memo = [-1] * 100000
 
def dfs(num):
	if memo[num] != -1: return memo[num]
	if num == 0: return 0
 
	ret = -1
	for p in ma:
		if 0 <= num - ma_map[p]:
			ret = max(dfs(num - ma_map[p]) * 10 + p, ret)
 
	memo[num] = ret
	return ret
 
ma.sort()
print(dfs(N))

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

ma_map = [ -1, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]
N, M = (int(i) for i in input().split())
ma = list(int(i) for i in input().split())
memo = [-1] * 100000

def dfs(num):
	if memo[num] != -1: return memo[num]
	if num == 0: return 0

	ret = -1
	for p in ma:
		if 0 <= num - ma_map[p]:
			d = dfs(num - ma_map[p])
			if d == -1: continue
			ret = max(dfs(num - ma_map[p]) * 10 + p, ret)

	memo[num] = ret
	return ret

ma.sort()
print("{}".format(dfs(N)))
(N*(N+1)/2)-(N//3*(N//3+1)/2)-(N//5*(N//5+1)/2)+(N//15*(N//15+1)/2)

### FIXED CODE ###

N=int(input())
print(((N*(N+1))-(N//3*(N//3+1)*3)-(N//5*(N//5+1)*5)+(N//15*(N//15+1)*15))//2)
H, A = input().split(" ")
H = int(H)
A = int(A)
return (H+A-1)//A

### FIXED CODE ###

H, A = input().split(" ")
H = int(H)
A = int(A)
print((H+A-1)//A)
H, A = map(int, input().split())
if N % A == 0:
    print(H // A)
else:
    print(H // A + 1)

### FIXED CODE ###

H, A = map(int, input().split())
if H % A == 0:
    print(H // A)
else:
    print(H // A + 1)
inputs=[int(input()) for i in range(5)]
summ=0
k=0
for i in inputs:
    if i%10==0:
        summ=summ+i
    else:
        s,m=divmod(i,10)
        summ=summ+(s+1)*10
		if 10-m>10-k:
          k=m
summ=summ-10+k
print(summ)


### FIXED CODE ###

inputs = [int(input()) for i in range(5)]
summ = 0
k = 10
for i in inputs:
    if i % 10 == 0:
        summ = summ + i
    else:
        s, m = divmod(i, 10)
        summ = summ + (s + 1) * 10
        if m < k:
            k = m

summ = summ -((10-k)%10)
print(summ)
import numpy as np
n,k=map(int,input().split())
print(len(np.base_repr(n,base=k)))

### FIXED CODE ###

N,R=map(int,input().split())
for i in range(1000000000):
	if R**i>N:
		print(i)
		break
import operator

n=int(input().strip())
lst=input().split(' ')
map(int, lst)

d1 = {}
d2 = {}

for i in range(len(lst)):
    if i % 2 == 0:
        if lst[i] in d1:
            d1[lst[i]] += 1
        else:
            d1[lst[i]] = 1
    else:
        if lst[i] in d2:
            d2[lst[i]] += 1
        else:
            d2[lst[i]] = 1

sd1 = sorted(d1.values(), reverse=True)
sd2 = sorted(d2.values(), reverse=True)
key1 = max(d1.items(), key=operator.itemgetter(1))[0]
key2 = max(d2.items(), key=operator.itemgetter(1))[0]

if(key1 == key2):

    v11 = sd1[0]
    if(len(d1) == 1):
        v12 = 0
    else:
        v12 = sd1[1]

    v21 = sd2[0]
    if(len(d2) == 1):
        v22 = 0
    else:
        v22 = sd2[1]

    print(min(n-v11-v22, n-v12-v21))

else:
    print(n-sd1[0]-sd2[key2])


### FIXED CODE ###

import operator

n=int(input().strip())
lst=input().split(' ')
map(int, lst)

d1 = {}
d2 = {}

for i in range(len(lst)):
    if i % 2 == 0:
        if lst[i] in d1:
            d1[lst[i]] += 1
        else:
            d1[lst[i]] = 1
    else:
        if lst[i] in d2:
            d2[lst[i]] += 1
        else:
            d2[lst[i]] = 1

sd1 = sorted(d1.values(), reverse=True)
sd2 = sorted(d2.values(), reverse=True)
key1 = max(d1.items(), key=operator.itemgetter(1))[0]
key2 = max(d2.items(), key=operator.itemgetter(1))[0]

if(key1 == key2):

    v11 = sd1[0]
    if(len(d1) == 1):
        v12 = 0
    else:
        v12 = sd1[1]

    v21 = sd2[0]
    if(len(d2) == 1):
        v22 = 0
    else:
        v22 = sd2[1]

    print(min(n-v11-v22, n-v12-v21))

else:
    print(n-sd1[0]-sd2[0])
import sys
input = sys.stdin.readline
N = int(input())
S = input().rstrip()
Q = int(input())
qs = [input().split() for i in range(Q)]

def ctoi(c):
    return ord(c) - ord('a')

class BinaryIndexedTree:
    def __init__(self,size):
        self.N = size
        self.bit = [0]*size
    def add(self,x,w):
        while x < self.N:
            self.bit[x] += w
            x += (x & -x)
    def sum(self,x):
        ret = 0
        while x > 0:
            ret += self.bit[x]
            x -= (x & -x)
        return ret
bits = [BinaryIndexedTree(N) for _ in range(26)]

for i,c in enumerate(S):
    bits[ctoi(c)].add(i+1,1)

s = list(S)
ans = []
for a,b,c in qs:
    if a=='1':
        x = int(b)
        bits[ctoi(c)].add(x,1)
        bits[ctoi(s[x-1])].add(x,-1)
        s[x-1] = c
    else:
        tmp = 0
        for i in range(26):
            if bits[i].sum(int(c)) - bits[i].sum(int(b)-1) > 0:
                tmp += 1
        ans.append(tmp)
print(*ans, sep='\n')

### FIXED CODE ###

import sys
input = sys.stdin.readline
N = int(input())
S = input().rstrip()
Q = int(input())
qs = [input().split() for i in range(Q)]

def ctoi(c):
    return ord(c) - ord('a')

bit = [[0]*(N+2) for _ in range(26)]
def bit_add(x,w,ci):
    while x <= N+1:
        bit[ci][x] += w
        x += (x & -x)
def bit_sum(x,ci):
    ret = 0
    while x > 0:
        ret += bit[ci][x]
        x -= (x & -x)
    return ret

for i,c in enumerate(S):
    bit_add(i+1,1,ctoi(c))

s = list(S)
ans = []
for a,b,c in qs:
    if a=='1':
        x = int(b)
        bit_add(x,1,ctoi(c))
        bit_add(x,-1, ctoi(s[x-1]))
        s[x-1] = c
    else:
        tmp = 0
        for i in range(26):
            if bit_sum(int(c),i) - bit_sum(int(b)-1,i) > 0:
                tmp += 1
        ans.append(tmp)
print(*ans, sep='\n')
def inpl():
    return list(map(int, input().split()))


N, M = inpl()

lines = [[] for _ in range(N)]
for _ in range(M):
    a, b = inpl()
    a -= 1
    b -= 1
    lines[a].append(b)
    lines[b].append(a)


ans = [-1] * N


def dfs(s, b):
    global ans

    if ans[s] != -1:
        return
    else:
        ans[s] = b
        for t in lines[s]:
            dfs(t, s)


dfs(0, 0)


print("YES")
for a in ans[1:]:
    print(a + 1)


### FIXED CODE ###


import sys
import queue
sys.setrecursionlimit(10**7)


def inpl():
    return list(map(int, input().split()))


N, M = inpl()

lines = [[] for _ in range(N)]
for _ in range(M):
    a, b = inpl()
    a -= 1
    b -= 1
    lines[a].append(b)
    lines[b].append(a)


ans = [-1] * N


q = queue.Queue()
q.put((0, 0))
while not q.empty():
    s, b = q.get()

    if ans[s] != -1:
        continue
    else:
        ans[s] = b
        for t in lines[s]:
            q.put((t, s))


print("Yes")
for a in ans[1:]:
    print(a + 1)
from collections import deque
mod = 10 ** 9 + 7

x,y = map(int,input().split())
dp = [[0] * (y + 1) for _ in range(x + 1)]
dp[0][0] = 1

que = deque()
a = 0
b = 0
que.append([a,b])

while a != x or b != y:
    if not que:
        break
    else:
        a,b = que.popleft()
    if a + 1 <= x and b + 2 <= y:
        que.append([a + 1,b + 2])
        dp[a + 1][b + 2]+=dp[a][b]
        dp[a + 1][b + 2]%=mod
    if a + 2 <= x and b + 1 <= y:
        que.append([a + 2,b + 1])
        dp[a + 2][b + 1]+=dp[a][b]
        dp[a + 2][b + 1]%=mod

print(dp[x][y]%mod)

### FIXED CODE ###

#組み合わせ総数
mod = 10 ** 9 + 7
def comb(n, k):
    res = 1
    for i in range(n - k + 1, n + 1):
        res = res * i % mod
    for i in range(1, k + 1):
        res = res * pow(i, mod - 2, mod) % mod
    return res

x,y = map(int,input().split())

if (x + y) % 3 != 0:
    print(0)
    exit()

m = (2 * x - y) // 3
n = x - 2 * m

if n >= 0 and m >= 0:
    print(comb(m + n,min(m,n)))
else:
    print(0)
def modpow(a,n,p):
    if n==0:
        return 1
    x=modpow(a,n//2,p)
    x=(x*x)%p
    if (n%2)==1:
        x=(x*a)%p
    return x%p
def modinv(a,p):
    return modpow(a,p-2,p)
def ggcd(a,b):
    if(b==0):
        return a
    return ggcd(b,a%b)
import math
import fractions
import collections
import itertools
import pprint
N=int(input())
l1=[]
adivb=[]
bis0=0
bdiva=[]
ais0=0
both0=0
p=10**9+7
fish=[list(map(int,input().split())) for _ in range(N)]
fishcomp=[]
d={}
for i in range(N):
    g=ggcd(abs(fish[i][0]),abs(fish[i][1]))
    a=fish[i][0]//g
    b=fish[i][1]//g
    if (b==0)and(a>0):
        a=1
    elif b<0:
        a=-a
        b=-b
    fishcomp.append([a,b])
    if (a!=0)and(b!=0):
        if d.get(a)==None:
            d[a]={}
            d[a][b]=1
        else:
            if d[a].get(b)==None:
                d[a][b]=1
            else:
                val=d[a].get(b)
                d[a][b]=val+1
    else:
        both0=both0+1
#print(d)
fishcomp=list(map(list,set(map(tuple,fishcomp))))
#print(fishcomp)
length=N-both0
sets=[]
for i in fishcomp:
    a=i[0]
    b=i[1]
    val1=d[a][b]
    #print(a,b,val1)
    if d.get(-b)!=None:
        if d[-b].get(a)!=None:
            val2=d[-b][a]
            sets.append([val1,val2])
            length=length-(val2+val1)
#print(sets,length)
pro=1
for i in sets:
    pro=(pro*(pow(2,i[0],p)+pow(2,i[1],p)-1))%p
#print(pro)
print((pow(2,length,p)*pro-1+both0)%p)

### FIXED CODE ###

def modpow(a,n,p):
    if n==0:
        return 1
    x=modpow(a,n//2,p)
    x=(x*x)%p
    if (n%2)==1:
        x=(x*a)%p
    return x%p
def modinv(a,p):
    return modpow(a,p-2,p)
def ggcd(a,b):
    if(b==0):
        return a
    return ggcd(b,a%b)
import math
import fractions
import collections
import itertools
import pprint
N=int(input())
l1=[]
adivb=[]
bis0=0
bdiva=[]
ais0=0
both0=0
p=10**9+7
fish=[list(map(int,input().split())) for _ in range(N)]
fishcomp=[]
d={}
for i in range(N):
    a=fish[i][0]
    b=fish[i][1]
    g=ggcd(abs(a),abs(b))
    if g!=0:
        a=a//g
        b=b//g
    if (b==0)and(a>0):
        a=1
    elif b<0:
        a=-a
        b=-b
    if (a!=0)or(b!=0):
        if d.get(a)==None:
            d[a]={}
            d[a][b]=1
        else:
            if d[a].get(b)==None:
                d[a][b]=1
            else:
                val=d[a].get(b)
                d[a][b]=val+1
        fishcomp.append([a, b])
    else:
        both0=both0+1
#print(d)
#print(fishcomp)
fishcomp=list(map(list,set(map(tuple,fishcomp))))
#print(fishcomp)
length=N-both0
sets=[]
for i in fishcomp:
    a=i[0]
    b=i[1]
    val1=d[a][b]
    #print(a,b,val1)
    if d.get(-b)!=None:
        if d[-b].get(a)!=None:
            val2=d[-b][a]
            sets.append([val1,val2])
            length=length-(val2+val1)
#print(sets,length)
pro=1
for i in sets:
    pro=(pro*(pow(2,i[0],p)+pow(2,i[1],p)-1))%p
#print(pro)
print((pow(2,length,p)*pro-1+both0)%p)
def calc_h(cx,cy,xyh_item):
  return(abs(cx-xyh_item[0])+abs(cy-xyh_item[1])+xyh_item[2])

n=int(input())
xyh=[[int(x) for x in input().split()] for _ in range(n)]
xyh=[item for item in xyh if item[2]!=0]

anslist=[]

for x in range(101):
  for y in range(101):
    c=0
    tmp=calc_h(x,y,xyh[0])
    for i in range(1,n):
      if tmp!=calc_h(x,y,xyh[i]):
        break
      else:
        c+=1
    anslist.append([c,x,y,tmp])

anslist.sort(key=lambda x:x[0])
print(*anslist[-1][1:])

### FIXED CODE ###

def calc_h(cx,cy,xyh_item):
  res=abs(cx-xyh_item[0])+abs(cy-xyh_item[1])+xyh_item[2]
  return res

n=int(input())
xyh=[[int(x) for x in input().split()] for _ in range(n)]
xyh.sort(key=lambda x:x[0],reverse=True)

#平地の情報(ピラミッドの根元を除く)は役にたたないので捨てる
xyh0=[]
xyh1=[]
for item in xyh:
  if item[2]==0:
    xyh0.append(item)
  else:
    xyh1.append(item)

xyh=xyh1

for item0 in xyh0:
  if any([calc_h(item1[0],item1[1],item0)==item1[2] for item1 in xyh1]):
    xyh.append(item0)

n=len(xyh)

anslist=[]

for x in range(101):
  for y in range(101):
    c=0
    tmp=calc_h(x,y,xyh[0])
    for i in range(1,n):
      if tmp!=calc_h(x,y,xyh[i]):
        break
      else:
        c+=1
    #if c==n-1:
    #  print(x,y,tmp)
    anslist.append([c,x,y,tmp])


anslist.sort(key=lambda x:x[0])
print(*anslist[-1][1:])
s=input()

ds=list(s)


c1=0
while ds[c1]!='A'
  c1+=1

c2=-1
while ds[c2]!='Z':
  c2-=1

print(s[c1:c2])



### FIXED CODE ###

from collections import deque
s=input()

ds=deque(s)
flag=True

while ds[0]!='A' or ds[-1]!='Z':
  if ds[0]!='A':
    ds.popleft()
  if ds[-1]!='Z':
    ds.pop()
print(len(ds))
N = int(input())
A = int(input())
B = int(input())

if N==1:
  print("Hello World")
else:
  print(A+B)


### FIXED CODE ###

N = int(input())

if N==1:
  print("Hello World")
else:
  A = int(input())
  B = int(input())
  print(A+B)
N=int(input());A=input();v=[int(i)%4for i in A[::2]];print('Yes'if v.count(0)+v.count(2)//2>=N//2 else'No')

### FIXED CODE ###

N=int(input());A=input().split();v=[int(i)%4 for i in A];print('Yes' if v.count(0)+v.count(2)//2>=N//2 else 'No')
n = input()
arr = list(map(int, input().split()))
while len(arr) > 1:
  arr = sorted(arr)
  v1 = arr.pop(0)
  v2 = arr.pop(0)
  arr.appned((v1 + v2) / 2)
print(arr[0])

### FIXED CODE ###

n=int(input())
arr=list(map(int, input().split()))
while len(arr)>1:
  arr = sorted(arr)
  v1 = arr.pop(0)
  v2 = arr.pop(0)
  arr.append((v1 + v2) / 2)
print(arr[0])
s = input()
t = input()
m, n = len(s), len(t)
dp = [[0 for _ in range(n+1)] for _ in range(m+1)]

for i in range(1, m+1):
  for j in range(1, n+1):
    if s[i] == t[j]:
      dp[i][j] = d[i-1][j-1] + 1
    else:
      dp[i][j] = max(dp[i-1][j], dp[i][j-1])

res = ''
i, j = m, n
while i > 0 and j > 0:
  if dp[i][j] == dp[i-1][j]:
    i -= 1
  elif dp[i][j] == dp[i][j-1]:
    j -= 1
  else:
    i -= 1
    j -= 1
    res += s[i]
print(res[::-1])

### FIXED CODE ###

s = input()
t = input()
m, n = len(s), len(t)
dp = [[0 for _ in range(n+1)] for _ in range(m+1)]

for i in range(1, m+1):
  for j in range(1, n+1):
    if s[i-1] == t[j-1]:
      dp[i][j] = dp[i-1][j-1] + 1
    else:
      dp[i][j] = max(dp[i-1][j], dp[i][j-1])

res = ''
i, j = m, n
while i > 0 and j > 0:
  if dp[i][j] == dp[i-1][j]:
    i -= 1
  elif dp[i][j] == dp[i][j-1]:
    j -= 1
  else:
    i -= 1
    j -= 1
    res = s[i] + res
print(res)
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a,b=map(int(input().split()))

print(max(0,a-2*b))

### FIXED CODE ###

import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a,b=map(int,input().split())

print(max(0,a-2*b))
for i,j in [[1:100],[1:100]]:
  print(i*j)

### FIXED CODE ###

a,b = map(int,input().split())
print(a*b)
from fractions import gcd

N=int(input())
d={}
#l=[]
MOD = 1000000007
nz=0
for _ in range(N):
    a,b=map(int,input().split())
    if a==0 and b==0:
        nz+=1
        #p=(0,0)
    elif a==0:
        p=(0,1)
    elif b==0:
        p=(1,0)
    else:
        c=gcd(a,b)
        if b > 0:
            p=(a//c,b//c)
        else: # b < 0
            p=(-a//c,-b//c)
    
    #l.append(p)
    if p in d:
        d[p]+=1
    else:
        d[p] = 1

ans=1
#for p in l:
while len(d) > 0:
    p,np=d.popitem()
    if p==(1,0):
        q=(0,1)
    elif p==(0,1):
        q=(1,0)
    else:
        pa,pb=p
        if pa > 0:
            q=(-pb,pa)
        else: #pa < 0
            q=(pb,-pa)
    if q in d:
        nq=d.pop(q)
    else:
        nq=0
    
    ans *= ((2**np + 2**nq - 1) % MOD)
    ans %= MOD

ans -= 1
ans += nz
ans %= MOD
print(ans)

### FIXED CODE ###

from fractions import gcd

N=int(input())
d={}
#l=[]
MOD = 1000000007
nz=0
for _ in range(N):
    a,b=map(int,input().split())
    if a==0 and b==0:
        nz+=1
        #p=(0,0)
        continue
    elif a==0:
        p=(0,1)
    elif b==0:
        p=(1,0)
    else:
        c=gcd(a,b)
        a,b=a//c,b//c
        if b > 0:
            p=(a,b)
        else: # b < 0
            p=(-a,-b)
    
    #l.append(p)
    if p in d:
        d[p]+=1
    else:
        d[p] = 1

ans=1
#for p in l:
while len(d) > 0:
    p,np=d.popitem()
    if p==(1,0):
        q=(0,1)
    elif p==(0,1):
        q=(1,0)
    else:
        pa,pb=p
        if pa > 0:
            q=(-pb,pa)
        else: #pa < 0
            q=(pb,-pa)
    if q in d:
        nq=d.pop(q)
    else:
        nq=0
    
    ans *= ((2**np + 2**nq - 1) % MOD)
    ans %= MOD

ans -= 1
ans += nz
ans %= MOD
print(ans)
N,D= map(int, input().split())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]

def f(x,y,D):
  s=0
  for i in range(N)
  　　if (x[i]*x[i] + y[i]*y[i])<= D*D:
     　　s=s+1
  return s

print(s)

### FIXED CODE ###

N,D = map(int, input().split())
XY = [map(int, input().split()) for _ in range(N)]
X,Y = [list(i) for i in zip(*XY)]

s=0
for i in range (N):
  if X[i]*X[i]+Y[i]*Y[i]<=D*D:
    s=s+1
print(s)
import math
a,b = list(map(int, input().split()))

def gcd( x, y ):
    while y != 0:
        x, y = y, x%y
    return x

def lcm(x, y):
    return (x * y) // gcd(x, y)

print(lcm(a, b))

### FIXED CODE ###

a = int(input())
b = int(input())
l = list(range(4))
del l[0]
l.remove(a)
l.remove(b)
print(l[0])
import sys
input = sys.stdin.readline

def main():
    N,W = map(int,input().split())
    info = []
    for i in range(N):
        w,v = map(int,input().split())
        if i == 0:
            w1 = w
        w = w - (w1-1)
        info.append((w,v))
    # dp[i][j][k]
    # dp[i][j][k] = max(dp[i-1][j][k],dp[i-1][j-w][k-1])
    # dp[0][j][0] = 0
    # ans = max(dp[N][j][k] w1*k + j <= W)
    dp = [[[0]*(N+1) for _ in range(400)] for _ in range(N+1)]
    for i in range(1,N+1):
        w = info[i-1][0]; v = info[i-1][1]
        for j in range(400):
            for k in range(1,N+1):
                dp[i][j][k] = dp[i-1][j][k]
                if j - w >= 0:
                    if dp[i][j][k] < dp[i-1][j-w][k-1] + v:
                        dp[i][j][k] = dp[i-1][j-w][k-1] + v

    ans = -1
    for k in range(N+1):
        for j in range(W-(w1-1)*k + 1):
            if dp[N][j][k] > ans:
                ans = dp[N][j][k]
    print(ans)

main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

N,W = map(int,input().split())
info = []
for i in range(N):
    w,v = map(int,input().split())
    if i == 0:
        w1 = w
    w = w - (w1-1)
    info.append((w,v))
# dp[i][j][k]
# dp[i][j][k] = max(dp[i-1][j][k],dp[i-1][j-w][k-1])
# dp[0][j][0] = 0
# ans = max(dp[N][j][k] w1*k + j <= W)
dp = [[[0]*(N+1) for _ in range(400)] for _ in range(N+1)]
for i in range(1,N+1):
    w = info[i-1][0]; v = info[i-1][1]
    for j in range(400):
        for k in range(1,N+1):
            dp[i][j][k] = dp[i-1][j][k]
            if j - w >= 0:
                if dp[i][j][k] < dp[i-1][j-w][k-1] + v:
                    dp[i][j][k] = dp[i-1][j-w][k-1] + v
ans = -1
for j in range(400):
    for k in range(N+1):
        if not((w1-1)*k + j <= W):
            continue
        if dp[N][j][k] > ans:
            ans = dp[N][j][k]
print(ans)
#! -*- coding:utf-8 -*-
import math
import sys
a,b,c = map(int,input().split())
x = b - a
y = c - b
if x/y == 1:
    print('YES')
else:
    print('NO')


### FIXED CODE ###

#! -*- coding:utf-8 -*-
import math
import sys
a,b,c = map(int,input().split())
x = b - a
y = c - b
if x == y:
    print('YES')
else:
    print('NO')
a, b, c = map(int, input.split())
print(len(set((a, b, c))))

### FIXED CODE ###

a, b, c = map(int, input().split())
print(len(set((a, b, c))))
N=int(input())
S=input()
i=S.index(".")
if i==0:
    print(0)
else:
    print(S.count("."))

### FIXED CODE ###

N=int(input())
S=input()
num=S.count(".")
ans=num
for i in S:
    if i=="#":
        num+=1
    else:
        num-=1
    ans=min(ans,num)
print(ans)
D = int(input())

if D ==25;
  print("Christmas)"
if D ==24;
  print("Christmas Eve")
if D ==23;
  print("Christmas Eve Eve")
if D ==22;
  print("Crhistmas Eve Eve Eve")
 
 
 

### FIXED CODE ###

D = int(input())
if D == 25:
  print("Christmas")
elif D == 24:
  print("Christmas Eve")
elif D == 23:
  print("Christmas Eve Eve")
elif D == 22:
  print("Christmas Eve Eve Eve")
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
suf = 0
for i in range (n):
  suf += b[a[i - 1] ]
  if (a[i] != n )and(a[i - 1]  + 1 == a[i]):
    suf += c[a[i - 1]]
print(suf)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
suf = 0
for i in range (n):
  suf += b[i]
  if i >= 1 and a[i - 1]  + 1 == a[i]:
    suf += c[a[i - 1] - 1]
print(suf)
def do_calc(data):
    from collections import deque
    s = deque()  # ??????????????¨??????????????????
    while data:
        elem = data[0]
        data = data[1:]
        if elem == '+' or elem == '-' or elem == '*':
            try:
                a = s.pop()
                b = s.pop()
                if elem == '+':
                    s.append(b + a)
                elif elem == '-':
                    s.append(b - a)
                elif elem == '*':
                    s.append(b * a)
            except IndexError:
                return None
        else:
            s.append(int(elem))
    try:
        result = s.pop()
    except IndexError:
        return None
    else:
        return result


if __name__ == '__main__':
    # ??????????????\???
    data = [int(x) for x in input().split(' ')]
    # data = ['1', '2', '+', '3', '4', '-', '*']

    # ???????????????
    result = do_calc(data)

    # ???????????????
    print(result)

### FIXED CODE ###

def do_calc(data):
    from collections import deque
    s = deque()  # ??????????????¨??????????????????
    while data:
        elem = data[0]  # ?????????????????????????????????

        # ???????????§????????°?????´??????????????????pop??§????????????????¨????????????????????????????????????????
        if elem == '+' or elem == '-' or elem == '*':
            a = s.pop()
            b = s.pop()
            if elem == '+':
                s.append(b + a)
            elif elem == '-':
                s.append(b - a)
            elif elem == '*':
                s.append(b * a)
        # ??°?????§????????°????????????????????????
        else:
            s.append(int(elem))

        # ?¬??????????????????????????????????????????????????????¨??????
        data = data[1:]
    return s.pop()


if __name__ == '__main__':
    # ??????????????\???
    data = [x for x in input().split(' ')]
    # data = ['1', '2', '+', '3', '4', '-', '*']

    # ???????????????
    result = do_calc(data)

    # ???????????????
    print(result)
def f(T,P):
 for i in range(len(T)):P!=T[i:i+len(P)]or print(i)
if'__main__'__name__:f(input(),input())


### FIXED CODE ###

T,P=input(),input()
for i,t in enumerate(T):
 if t==P[0]and P==T[i:i+len(P)]:print(i)
from collections import Counter
n=int(input())
a=[input() for _ in range(n)]
c=Counter(s)
sort(c.items())
max_cnt=max(c.values())
names=[name for k,v in c if v==max_cnt]
print(names)

### FIXED CODE ###

from collections import Counter
n=int(input())
a=[input() for _ in range(n)]
c=Counter(a)
max_cnt=max(c.values())
names=[name for name,v in c.items() if v==max_cnt]
names.sort()
print(*names,sep='\n')
A,B,K = map(int,input().split())

C=[]
for i in range(1,B):
  if A%i==0 and B%i==0:
    C.append(i)

print(C)
print(C[-K])
  

### FIXED CODE ###

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

C=[]
for i in range(1,101):
  if A%i==0 and B%i==0:
    C.append(i)

#print(A,B,K)
#print(C)
print(C[-K])
def rightMinNumber(L):
    min = L[len(L)-1]
    min_index = len(L) - 1
    for i in range(len(L)-2,-1,-1):
        if L[i] < min:
            min = L[i]
            min_index = i
    a.append(min)
    if min_index+1 == len(L) and min_index > 0:
        rightMinNumber(lL)
    elif min_index + 1 < len(L):
        rL = L[min_index+1:]
        rightMinNumber(rL)

N = int(input())
B = (int(i) for i in input().split())
#出力
a = []
#Bのエンコーダを作る
x = 0

#Bの正当性を調べる。
for i in range(N):
    if B[i] > i:
        x = -1
        break
if x == -1:
    print(x)
else :
    rightMinNumber(B)
    for i in range(N):
        print(a[i])


### FIXED CODE ###

def main():
    N = int(input())
    B = [int(_) for _ in input().split()]

    #出力用
    outs = []

    for i in range(N):
        for k in range(N-1-i,-1,-1):
            if B[k] == k+1:
                del B[k]
                outs.insert(0,k+1)
                break
        else:
            print(-1)
            return

    for out in outs:
        print(out)

if __name__ == '__main__':
    main()