Harryxun/stf_run huggingface dataset:
import math

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

ans = "not coprime"

a, b = als[1], als[0]
while a % b != 0:
    a, b = b, a % b

for i in range(2, n):
    a = als[i]
    while a % b != 0:
        a, b = b, a % b
    if b == 1:
        ans = "setwise coprime"
        break

existeven = False

failed = False

for i in range(n):
    if als[i]%2 == 0:
        if existeven:
            failed = True
            break
        else:
            existeven = True

if not failed:
    for i in range(3, int(math.sqrt(maxa))+1, 2):
        existfactrial = False
        failed = False
        for j in range(n):
            if als[j]%i == 0:
                if existfactrial:
                    failed = True
                    break
                else:
                    existfactrial = True
        if failed:
            break
    if not failed:
        ans = "pairwise coprime"

print(ans)
        

    

### FIXED CODE ###

import math
from collections import deque

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

ans = "not coprime"

a, b = als[1], als[0]
if a < b:
    a,b = b,a
while a % b != 0:
    a, b = b, a % b
    if n == 2 and b == 1:
        ans = "pairwise coprime"
        failed = True

for i in range(2, n):
    a = als[i]
    if a < b:
        a,b = b,a 
    while a % b != 0:
        a, b = b, a % b
if b == 1:
    ans = "setwise coprime"
    # break

existeven = False

failed = False

for i in range(n):
    if als[i] >= 2 and als[i]%2 == 0:
        if existeven:
            failed = True
            break
        else:
            existeven = True

maxa = max(als)

afterchecklist = deque([])


if not failed:
    for i in range(3, int(math.sqrt(maxa))+2, 2):
        existfactrial = False
        failed = False
        for j in range(n):
            if als[j] >= i and als[j]%i == 0:
                afterchecklist.append(als[j]/i)
                if existfactrial:
                    failed = True
                    break
                else:
                    existfactrial = True
        if failed:
            break
    if not failed:
        for i in list(afterchecklist):
            existfactrial = False
            failed = False
            for j in range(n):
                if i != 1 and als[j] >= i and als[j]%i == 0:
                    if existfactrial:
                        failed = True
                        break
                    else:
                        existfactrial = True
            if failed:
                break
        if not failed:
            ans = "pairwise coprime"

print(ans)
import copy
import heapq

tmp = list(map(int, input().split()))
n = tmp[0]
k = tmp[1]
v = list(map(int, input().split()))

a = [[0] * (k+1) for i in range(n+1)]
b = [[0] * (k+1) for i in range(n+1)]
ha = []
hb = []
for i in range(1, n+1):
  a[i][0] = a[i-1][0] + v[i-1]
  b[i][0] = b[i-1][0] + v[n-i]
  if v[i-1] < 0:
    heapq.heappush(ha, v[i-1])
  if v[n-i] < 0:
    heapq.heappush(hb, v[n-i])
  cha = copy.deepcopy(ha)
  chb = copy.deepcopy(hb)
  for j in range(1, k+1):
    if len(cha) != 0:
      a[i][j] = a[i][j-1] - heapq.heappop(cha)
    else:
      a[i][j] = a[i][j-1]
  for j in range(1, k+1):
    if len(chb) != 0:
      b[i][j] = b[i][j-1] - heapq.heappop(chb)
    else:
      b[i][j] = b[i][j-1]

maxv = 0
for i in range(0, k+1):
  maxa = 0
  maxb = 0
  for j in range(0,i+1):
    if a[j][i-j] > maxa:
      maxa = a[j][i-j]
  for j in range(0,k-i+1):
    if b[j][k-i-j] > maxb:
      maxb = b[j][k-i-j]
#  print('MAXA=' + str(maxa) + ' MAXB=' + str(maxb))    
  if (maxa + maxb) > maxv:
    maxv = maxa + maxb
print (maxv)

### FIXED CODE ###

import copy
import heapq

tmp = list(map(int, input().split()))
n = tmp[0]
k = tmp[1]
v = list(map(int, input().split()))

a = [[0] * (k+1) for i in range(n+1)]
b = [[0] * (k+1) for i in range(n+1)]
ha = []
hb = []
for i in range(1, n+1):
  a[i][0] = a[i-1][0] + v[i-1]
  b[i][0] = b[i-1][0] + v[n-i]
  if v[i-1] < 0:
    heapq.heappush(ha, v[i-1])
  if v[n-i] < 0:
    heapq.heappush(hb, v[n-i])
  cha = copy.deepcopy(ha)
  chb = copy.deepcopy(hb)
  for j in range(1, k+1):
    if len(cha) != 0:
      a[i][j] = a[i][j-1] - heapq.heappop(cha)
    else:
      a[i][j] = a[i][j-1]
  for j in range(1, k+1):
    if len(chb) != 0:
      b[i][j] = b[i][j-1] - heapq.heappop(chb)
    else:
      b[i][j] = b[i][j-1]

maxv = 0
for i in range(0, k+1):
  for j in range(0,min(n+1, i+1)):
    for l in range(0,min(n+1, k-i+1)):
      tmp = a[j][i-j] + b[l][k-i-l]
      if (j+l) <= n and tmp > maxv:
        maxv = tmp
print (maxv)
N,K=map(int, input().split())
A = list(map(int, input().split()))

A = [0] + A

visited = [1]
now = 1
short = 0
while True:
  next = A[now]
  if next in visited:
    break
  if len(visited)==K:
    short = 1
    break
  visited.append(next)
  now = next

if short: print(visited[K])
else:
  initial = visited.index(next)
  cycle = len(visited[initial:])
  if K >= cycle:
    residual = (K - initial) % cycle
    print(visited[initial+residual])
  else:
    print(visited[K])

### FIXED CODE ###

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

vis=[0]*(N+1)
now=1
vis[now] = 1
his=[now]
while 1:
  new = A[now-1]
  if vis[new]==0:
    vis[new]=1
    his.append(new)
    now = new
  else:
    idx = his.index(new)
    cycle = his[idx:]
    margin = his[:idx]
    break
    
if K <= len(margin):
  print(his[K])
  exit()
  
K -= len(margin)
K %= len(cycle)

print(cycle[K])
N = int(input())

S = "abcdefghijklmnopqrstu"

s = ""
while N // 26 > 0:
    s += S[N%26-1]
    N //= 26
s += S[N-1]

print(s[::-1])

### FIXED CODE ###

N = int(input())

S = "abcdefghijklmnopqrstuvwxyz"

ans = ""
while N > 0:
    N -= 1
    ans += S[N%26]
    N //= 26

print(ans[::-1])
N=int(input())
listA = list(map(int,input().split()))
listB = list(map(int,input().split()))
listC = list(map(int,input().split()))

listD = [ListA,ListB]
sorted(listD)
print(sum(listD[1]))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
b= list(map(int,input().split()))
c = list(map(int,input().split()))
 
m=0
 
for i in range (0,n):
  m += b[a[i]-1]
  if i !=0 and a[i]==a[i-1]+1:
    m += c[a[i-1]-1]
print(m)
N = int(input())
M = int(input())
List = [int(input()) for i in range(M)]

for i in range(M):
    N = N - i
    if N < 0:
        print(-1)
        break
print(N)

### FIXED CODE ###

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

L = N - sum(HW)
if L < 0:
    print(-1)
else:
    print(L)
n = int(input())
d = list(map(int, input().split()))
count = 0
for i in range(len(d)):
    for j in range(i+1, len(d)):
        count += d[i] * d[j]
print(count)7

### FIXED CODE ###

n = int(input())
d = list(map(int, input().split()))
count = 0
for i in range(len(d)):
    for j in range(i+1, len(d)):
        count += d[i] * d[j]
print(count)
for i in range(1,100):
    a=int(input("Enter the height a in meters="))
    b=int(input("Enter the height b in meters="))
    c=int(input("Enter the height c in meters="))
    if(b-a==c-b):
        print("Yes")
        print('Since'+str(b)+ '-' +str(a)+ '=' +str(c)+ '-' +str(b)+ ',this arrangement of poles is beautiful.')
    elif(c-b==b-a):
        print("Yes")
        print('Since'+str(c)+ '-' +str(b)+ '=' +str(b)+ '-' +str(a)+ ',this arrangement of poles is beautiful.')
    else:
        print("NO")
        print('Since'+str(b)+ '-' +str(a)+ '≠' +str(c)+ '-' +str(b)+ ',this arrangement of poles is not beautiful.')


### FIXED CODE ###

a,b,c=map(int,input().split())
if b-a == c-b:
    print("YES")
else:
    print("NO")
import numpy as np
N, *X = map(int,open(0).read().split())

X = np.array(X)
g0 = sum(X)//len(X)
g1 = sum(X)//len(X)+1

print(min(sum((X-g0)**2),sum((X-g1)**2)))

### FIXED CODE ###

import numpy as np
N, *X = map(int,open(0).read().split())

X = np.array(X)
g0 = sum(X)//len(X)
g1 = sum(X)//len(X)+1

print(min(sum((X-g0)**2),sum((X-g1)**2)))
A,B = map(int,input().split())
S = input()
L = list(range(10))
flag = True
for i in range(A+B+1):
    if ( i == A ):
        if (S[i] != "-"):
            flag = False
    else:
        if (not (int(S[i]) in L)):
            flag = False
if flag:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

A,B = map(int,input().split())
S = input()
L = list(map(str,list(range(10))))
flag = True
for i in range(A+B+1):
    if ( i == A ):
        if (S[i] != "-"):
            flag = False
    else:
        if (not (S[i] in L)):
            flag = False
if flag:
    print("Yes")
else:
    print("No")
import math

A,B = map(int, input().split())
print(A*B//math.gcd(A,B))


### FIXED CODE ###

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

count = 1
while True:
    if count*A%B == 0:
        print(count*A)
        break
    else:
        count += 1
S = input()
r, ans = 3, 0
for l in range(len(S)):
    while r < len(S):
        if int(S[0:l]) % 2019 == 0:
            ans += 1
            break
        if int(S[l:r+1]) % 2019 == 0:
            ans += 1
            break
        if int(S[r+1:len(S)) % 2019 == 0:
            ans += 1
            break
        r += 1
    r = l + 3
print(ans)


### FIXED CODE ###

import sys
from collections import deque
def input():
    return sys.stdin.readline()[:-1]

S = deque(map(int, list(input())))
num = 0
dict = {}
dict[0] = 1
ans = 0

for i in range(len(S)):
    num += S.pop() * pow(10,i,2019)
    cand = num % 2019
    if cand in dict.keys():
        dict[cand] += 1
    else:
        dict[cand] = 1

for key in dict.keys():
    ans += dict[key] * (dict[key] - 1) // 2
print(ans)
s = input()
if s[3]==s[4] and s[5]==s[6]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s = input()
if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')
H, W = map(int, input().split())
h, w = map(int, input().split())

List = []
for i in range(H):
    l = []
    for j in range(W):
        l.append(1)
    List.append(l)

for i in range(h):
    del List[0]

for j in range(w):
    for i in range(len(List)):
        del List[i][j]

count = 0
for i in range(len(List)):
    count = count + len(List[i])

print(count)


### FIXED CODE ###

H, W = map(int, input().split())
h, w = map(int, input().split())

List = []
for i in range(H):
    l = []
    for j in range(W):
        l.append(0)
    List.append(l)

for i in range(h):
    for j in range(W):
        List[i][j] = 1
for i in range(H):
    for j in range(w):
        List[i][j] = 1

count = 0
for i in range(H):
    count += List[i].count(0)

print(count)
a, b = map(int, input().split())
if （a * b） % 2 == 0:
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

a, b = map(int, input().split())
if  (a * b) % 2 == 0:
  print('Even')
else:
  print('Odd')
n,k = map(int,input().split())
if n > 0:
  n = n-k
elif n <= 0:
  break
m = abs(n)
l = abs(m-k)
print(min(m,l))

### FIXED CODE ###

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

print(min(N%K,abs(N%K-K)))
import numpy as np

inf = 10**15
mod = 10**9+7
n = int(input())
v = list(map(int, input().split()))
left = [0 for i in range(100001)]
right = [0 for i in range(100001)]
for i in range(0,n-1,2):
    left[v[i]]+=1
    right[v[i+1]]+=1
leftnp = np.array(left)
rightnp = np.array(right)
leftnpind = np.argsort(leftnp, axis=0)[::-1]
rightnpind = np.argsort(rightnp, axis=0)[::-1]
if leftnpind[0] != rightnpind[0]:
    lmax = leftnp[leftnpind[0]]
    rmax = rightnp[rightnpind[0]]
else:
    if leftnp[leftnpind[1]] > rightnp[rightnpind[1]]:
        lmax = leftnp[leftnpind[1]]
        rmax = rightnp[rightnpind[0]]
    else:
        lmax = leftnp[leftnpind[0]]
        rmax = rightnp[rightnpind[1]]
print(n - lmax - rmax)

### FIXED CODE ###

# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
import itertools
import math
import fractions
import functools
l = [0]*(10**5+1)
r = [0]*(10**5+1)
 
n = int(input())
v = list(map(int, input().split()))
 
for i in range(n):
    if i % 2 == 0:
        l[v[i]] += 1
    else:
        r[v[i]] += 1
 
max_l = l.index(max(l))
max_r = r.index(max(r))
count = 0
 
if max_l == max_r:
    for i in range(len(r)):
        if r[i] == r[max_r]:
            r[i] = 0
        if l[i] == l[max_l]:
            l[i] = 0
if max(l) > max(r):
    max_l = l.index(max(l))
else:
    max_r = r.index(max(r))
 
for i in range(n):
    if i % 2 == 0 and v[i] != max_l:
        count += 1
    if i % 2 != 0 and v[i] != max_r:
        count += 1
print(count)
# 190928 D
from math import gcd as bltin_gcd

if __name__ == "__main__":
    def coprime2(a, b):
        return bltin_gcd(a, b) == 1

    def gcd(a, b):
        while b:
            a, b = b, a % b
        return a

    def divisor(n): #nの約数を全て求める
        i = 1
        table = []
        while i * i <= n:
            if n%i == 0:
                table.append(i)
                table.append(n//i)
            i += 1
        table = list(set(table))
        return table
    def sieve(n):
        is_prime = [True for _ in range(n+1)]
        is_prime[0] = False

        for i in range(2, n+1):
            if is_prime[i-1]:
                j = 2 * i
                while j <= n:
                    is_prime[j-1] = False
                    j += i
        table = [ i for i in range(1, n+1) if is_prime[i-1]]
        return is_prime, table

    A,B = list(map(int,input().split()))
    koyaku = gcd(A,B)
    kotable = sorted(divisor(koyaku))
    isprim, solist = sieve(koyaku)
    output = []
    for i in range(len(kotable)):
        if kotable[i] in solist:
            output.append(kotable[i])

    print(len(output)+1)
    

### FIXED CODE ###

# 190928 D

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

A,B = list(map(int,input().split()))
soA = prime_factorize(A)
soB = prime_factorize(B)
output = []
for i in range(len(soA)):
    if soA[i] in soB:
        output.append(soA[i])

print(len(list(set(output))) + 1)
N,T = map(int,input().split())

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

nmin = float("inf")
nsub = 0
ans = 0

Acopy = A.copy()
Acopy.sort()

for i in Acopy:

    if A[-1] == i:
        del A[-1]
    else:
        break


for i in range(len(A)):

    nmin = min(nmin , A[i])

    if nsub < A[i] - nmin:
        nsub = A[i] - nmin
        ans = 1

    elif nsub == A[i] - nmin:
        ans += 1

print (ans)


### FIXED CODE ###


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

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

nmin = float("inf")
nsub = 0
ans = 0

Acopy = A.copy()
Acopy.sort()

for i in Acopy:

    if A[-1] == i:
        del A[-1]
    else:
        break


for i in range(len(A)):

    nmin = min(nmin , A[i])

    if nsub < A[i] - nmin:
        nsub = A[i] - nmin
        ans = 1

    elif nsub == A[i] - nmin:
        ans += 1

print (ans)
import numpy as np
def main():



    print(13)

main()

### FIXED CODE ###

def main():
    [N,W]=input().split(" ")
    N=int(N)
    W=int(W)
    inputset=[]
    for i in range(N):
        [vi,wi]=input().split(" ")
        inputset.append([int(vi),int(wi)])

    graph=[]
    for i in range(N+1):
        graph.append([])
        for j in range(W+1):
            graph[i].append(0)

    for i in range(N):
        for j in range(W+1):
            if(inputset[i][1]>j):
                graph[i+1][j]=graph[i][j]
            else:
                rest=j-inputset[i][1]
                choosevalue=graph[i][rest]+inputset[i][0]
                nonchoosevalue=graph[i][j]
                if(choosevalue>nonchoosevalue):
                    graph[i+1][j]=choosevalue
                else:
                    graph[i+1][j]=nonchoosevalue

    print(graph[N][W])

main()
W,a,b=map(int,input().split())
if b>a:
  	if b-(a+W)==0:
  	print(0)
  	exit()
	print(b-(a+W))
else:
  if a-(b+W)==0:
  	print(0)
  	exit()
	print(a-(b+W))

### FIXED CODE ###

W,a,b=map(int,input().split())
if b>a:
  if b-(a+W)<=0:
  	print(0)
  	exit()
  print(b-(a+W))
else:
  if a-(b+W)<=0:
  	print(0)
  	exit()
  print(a-(b+W))
MOD=10**9+7
N=int(input())
A=list(map(int, input().split()))
huts=[0]*3
out=1
for i in range(N):
  out*=huts.count(A[i])
  huts[huts.index(A[i])]+=1
print(out%MOD)

### FIXED CODE ###

MOD=10**9+7
N=int(input())
A=list(map(int, input().split()))

huts=[0, 0, 0]
out=1
for i in range(N):
  out*=huts.count(A[i])
  if out==0:
    print(0)
    exit()
  huts[huts.index(A[i])]+=1
print(out%MOD)
N,M = map(int,input().split())
di = {}
pe = 0
ac = 0
for i in range(M):
    inp = input().split(" ")
    if inp[1] == "WA":
        if inp[0] in di:
            if di[inp[0]] >= 1:
                di[inp[0]] += 1
        else:
            di[inp[0]] = 1
            
            
    else:
        pe += di[inp[0]]
        di[inp[0]] = 0
for v in di.values():
    if v == 0:
        ac += 1
print(str(pe)+" "+str(ac))

### FIXED CODE ###

N,M = map(int,input().split())
di = {}
pe = 0
ac = 0
for i in range(M):
    inp = input().split(" ")
    if inp[1] == "WA":
        if inp[0] in di:
            if di[inp[0]] >= 1:
                di[inp[0]] += 1
        else:
            di[inp[0]] = 1
            
            
    else:
        if inp[0] in di:
            pe += di[inp[0]]
            di[inp[0]] = 0
        di[inp[0]] = 0
        
for v in di.values():
    if v == 0:
        ac += 1
print(str(ac)+" "+str(pe))
h,m,s=map(int,raw_input().split() )
print 3600*h+60*m+s

### FIXED CODE ###

s=int(raw_input())
h=s/3600
m=(s-3600*h)/60
print "%d:%d:%d"%(h,m,s-3600*h-60*m)
from itertools import permutations

n=int(input())
a=[list(map(int,input().split()))for _ in range(n)]
d = lambda x1,x2,x3,x4: ((x1-x2)**2 + (x3-x4)**4)**0.5

x = 0
for i in permutations(a):
	for j in range(n-1):
		x += d(i[j][0],i[j][1], i[j+1][0],i[j+1][1])

#for i in range(n): f*=i+1
print(x / factorial(N))

### FIXED CODE ###

from itertools import permutations
from math import hypot, factorial

n=int(input())
a=[list(map(int,input().split()))for _ in range(n)]
d = lambda x1,y1,x2,y2: ((x1-x2)**2 + (y1-y2)**2)**0.5

x = 0
for i in permutations(a):
	for j in range(n-1):
		x += d(i[j][0],i[j][1], i[j+1][0],i[j+1][1])

#for i in range(n): f*=i+1
print(x / factorial(n))
def mbisect(ok, ng):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if check(mid):
            ok = mid
        else:
            ng = mid
    return ok


def check(mid):
    cnt = 0
    for i in a:
        cnt += (i + mid - 1) // mid - 1
    return cnt <= k


n, k = map(int, input().split())
a = tuple(map(int, input().split()))
print(mbisect(10 ** 9, -1))

### FIXED CODE ###

def mbisect(ok, ng):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if check(mid):
            ok = mid
        else:
            ng = mid
    return ok


def check(mid):
    if mid == 0:
        return False
    cnt = 0
    for i in a:
        cnt += (i + mid - 1) // mid - 1
    return cnt <= k


n, k = map(int, input().split())
a = tuple(map(int, input().split()))
print(mbisect(10 ** 9, -1))
import math
N = int(input())
rootN = math.sqrt(N)
rootN = math.floor(rootN)
maxN = 1001
fn_array = [0] * 1000
for x in range(1, rootN):
    for y in range(1, x + 1):
        for z in range(1, y + 1):
            n = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if x == y and y == z:
                fn_array[n] += 1
            elif (x == y) and (y != z):
                fn_array[n] += 3
            elif (x != y) and (y == z):
                fn_array[n] += 3
            else:
                fn_array[n] += 6
for n in range(1, N+1):
    print(fn_array[n])

### FIXED CODE ###

import math
N = int(input())
fn_array = [0] * 60000
for x in range(1, 100):
    for y in range(1, x + 1):
        for z in range(1, y + 1):
            n = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if x == y and y == z:
                fn_array[n] += 1
            elif (x == y) and (y != z):
                fn_array[n] += 3
            elif (x != y) and (y == z):
                fn_array[n] += 3
            else:
                fn_array[n] += 6
for n in range(1, N+1):
    print(fn_array[n])
A, B, C, D, E, F = [int(_) for _ in input().split()]


def main(A, B, C, D, E, F):
    conc = -1
    ans = (1, 2)
    for na in range(F // (100 * A) + 1):
        for nb in range(F // (100 * B) + 1):
            if na == nb == 0:
                continue
            G = F - na * 100 * A - nb * 100 * B
            for nc in range(G // C + 1):
                for nd in range(G // D + 1):
                    W = na * 100 * A + nb * 100 * B + nc * C + nd * D
                    if 0 < W <= F and nc * C + nd * D <= E * (na * A + nb * B):
                        conc2 = 100 * (nc * C + nd * D) / W
                        if conc < conc2 <= 100 * E / (100 + E):
                            ans = (W, nc * C + nd * D)
                            conc = conc2
    return ans


print(*main(A, B, C, D, E, F))


### FIXED CODE ###

N = int(input())
A = int(input())
print(N * N - A)
from collections import deque

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

score = [0]*n
for i in range(q):
    a,b = map(int,input().split())
    score[a-1] += b

def bfs(i):
    s = -1
    q = deque([])
    q.append((i-1,s))
    while q:
        
        num,bef = q.pop()
        for j in E[num]:
            if j == bef:
                continue
            else:
                score[j] += score[num]
                q.append((j,num))
            
    return score
print(*bfs(1))


    




### FIXED CODE ###

if int(input()) >= 3200:
  print(input())
else:
  print("red")
from collections import deque

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

# 最後に挿入した数字は
# k番目のkとなる

# 1 2 2 1 2 3 2
# 複数通り該当するときは
# 最後の数が該当する
# 0 0 3 0 0 6
# 3を取り除くと
# 0 0 0 0 6 -> 矛盾

ans = deque()

q = deque(enumerate(b, 1))
r = deque()

flg = False
while q:
    idx, bb = q.pop()
    # print(idx, bb, r)
    if idx == bb:
        ans.appendleft(bb)
        if len(ans) == N:
            flg = True
            break
        q = q + r
        r = deque()
    else:
        r.appendleft((idx - 1, bb))

if flg:
    for aa in ans:
        print(aa)
else:
    print(-1)

### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 9)


def rec(arr, l, lst):
    # lstは操作の逆順
    # print(arr, l, lst[::-1])
    if l == 0:
        for p in lst[::-1]:
            print(p)
        exit()
        return

    for i in sorted(range(1, l + 1), reverse=True):
        # 1-indexed
        if arr[i-1] == i:
            # print(aa, '除去')
            # 最後に入れた数は、何番目と数の大きさが一致する
            rec(arr[:i - 1] + arr[i:], l - 1, lst + [i])
        elif arr[i-1] > i:
            # 何番目よりも数が大きい
            return
    return


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

rec(b, N, [])

print(-1)
O=list(input())
E=list(input())
F=[]
j=0
k=0
for i in range(0,len(O)+len(E)):
    F.append('0')
while j<(len(O)+len(E)):
    F[j]=E[k]
    j=j+2
    k=k+1
j=1 
k=0
while j<(len(O)+len(E)):
    F[j]=O[k]
    j=j+2
    k=k+1 
F= ''.join([str(elem) for elem in F])
print(F)

### FIXED CODE ###

O=input()
E=input()

o=list(O)
e=list(E)

str=[0 for i in range(len(o)+len(e))]
j=0
for i in range(0,len(o)):
    str[j]=o[i]
    j+=2
j=1
for i in range(0,len(e)):
    str[j]=e[i]
    j+=2
s=""
for i in range(len(str)):
    s=s+str[i]
print(s)
def cnt(s, b):
	ans = []
	for i in s:
		if i in b:
			ans.append(i)
	return ans

def intersection(lst1, lst2):
	lst3 = [value for value in lst1 if value in lst2]
	cnt1 = cnt(lst1, lst3)
	cnt2 = cnt(lst2, lst3)

	if len(cnt1) > len(cnt2):
		return cnt2
	else:
		return cnt1
resolve()

### FIXED CODE ###

def cnt(s, b):
	ans = []
	for i in s:
		if i in b:
			ans.append(i)
	return ans

def resolve():
	n = int(input())
	h = []
	for i in range(n):
		h.append(input())
	ans = h[0]
	for i in range(1, n):
		sec = list(set(ans) & set(h[i]))
		tmp = ""
		for j in sec:
			tmp += j*min(ans.count(j), h[i].count(j))
		ans = tmp

	print("".join(sorted(ans)))
resolve()
N,K = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
H = sorted(H,reverse = True)
for i in range(K):
    H.remove(H[i])
sum_ = sum(H)
pint(sum)

### FIXED CODE ###

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

A.sort(reverse=True)
print(sum(A[K:]))