Harryxun/stf_run huggingface dataset:
import heapq
n,m=map(int,input().split())
l=list(map(lambda x:-int(x),input().split()))
heapq.heapify(l)
for _ in range(m):
  heapq.haeppush(l,-(-heapq.heappop(l)//2))
print(-sum(l))

### FIXED CODE ###

import heapq
n,m=map(int,input().split())
l=list(map(lambda x:-int(x),input().split()))
heapq.heapify(l)
for _ in range(m):
  heapq.heappush(l,-(-heapq.heappop(l)//2))
print(-sum(l))
T = int(input())
for i in range(T):
    num = list(map(int, input().split()))
    coler = input().split()
    groups = [[], [], []]
    for i, c in enumerate(coler):
        if c == "R":
            groups[0].append(num[i])
        elif c == "G":
            groups[1].append(num[i])
        else:
            groups[2].append(num[i])
    for group in groups:
        while len(group) != 0 and len(group) % 3 == 0:
            tmp = group[:]
            group.sort()
            i = group[0]
            if group.count(i) >= 3:
                for _ in range(3):
                    group.remove(i)
            if i + 1 in group and i + 2 in group:
                for j in range(3):
                    group.remove(i + j)
            if tmp == group:
                break
    if len(groups[0]) == len(groups[1]) == len(groups[2]) == 0:
        print(1)
    else:
        print(0)


### FIXED CODE ###

T = int(input())
for i in range(T):
    num = list(map(int, input().split()))
    coler = input().split()
    groups = [[], [], []]
    for i, c in enumerate(coler):
        if c == "R":
            groups[0].append(num[i])
        elif c == "G":
            groups[1].append(num[i])
        else:
            groups[2].append(num[i])
    for group in groups:
        while len(group) != 0 and len(group) % 3 == 0:
            tmp = group[:]
            group.sort()
            i = group[0]
            if group.count(i) >= 3:
                for _ in range(3):
                    group.remove(i)
            if i + 1 in group and i + 2 in group:
                for j in range(3):
                    group.remove(i + j)
            if tmp == group:
                break
    if len(groups[0]) == len(groups[1]) == len(groups[2]) == 0:
        print(1)
    else:
        print(0)
import bisect

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

ind = [[] for _ in range(2*10**5 + 1)]
for i,num in enumerate(a):
    ind[num].append(i)

for i in range(1,2*10**5 + 1):
    if(ind[i]):
        ind[i].append(ind[i][0] + n)

before = []
cnt = 0
now = a[0]
while(True):
    right = bisect.bisect_right(ind[now], cnt%n)
    cnt += ind[now][right] - ind[now][right-1] + 1
    if(ind[now][right] >= n):
        before.append(ind[now][right-1])
    now = a[cnt%n]
    if(cnt%n == 0):
        break

cyc = k%(cnt//n)

cnt = before[cyc-1]
ans = []
while(cnt < n):
    now = a[cnt]
    right = bisect.bisect_right(ind[now],cnt)
    if(ind[now][right] >= n):
        ans.append(now)
        cnt += 1
    else:
        cnt = ind[now][right] + 1

print(' '.join(map(str,ans)))
print(before)

### FIXED CODE ###

import bisect

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

ind = [[] for _ in range(2*10**5 + 1)]
for i,num in enumerate(a):
    ind[num].append(i)

for i in range(1,2*10**5 + 1):
    if(ind[i]):
        ind[i].append(ind[i][0] + n)

before = []
cnt = 0
now = a[0]
while(True):
    right = bisect.bisect_right(ind[now], cnt%n)
    cnt += ind[now][right] - ind[now][right-1] + 1
    if(ind[now][right] >= n):
        before.append(ind[now][right-1])
    now = a[cnt%n]
    if(cnt%n == 0):
        break

if(cnt//n==1):
    print('')
    exit()

cyc = k%(cnt//n)

cnt = before[cyc-1]
ans = []
while(cnt < n):
    now = a[cnt]
    right = bisect.bisect_right(ind[now],cnt)
    if(ind[now][right] >= n):
        ans.append(now)
        cnt += 1
    else:
        cnt = ind[now][right] + 1

print(' '.join(map(str,ans)))
a , b =input().split()
c = ( a * b ) % 2
if c == 1 :
  print('Odd')
else :
  print('Even')

### FIXED CODE ###

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

if c == 1 :
  print('Odd')
else :
  print('Even')
a = input("Enter word:")

b = a[::-1]
print(b)

### FIXED CODE ###

s = input()
count = 0
first_half, second_half = s[:len(s)//2], s[(len(s)+1)//2:]
if first_half == reversed(second_half):
    print(count)
else:
    for x in range(len(first_half)):
        if first_half[x] != second_half[len(second_half)-x-1]:
            count += 1
    print(count)
import math

A,B,C,D = (int(i) for i in input().split())
C_div = int(0)
D_div = int(0)
CandD_div = int(0)
E =int(C*D/math.gcd(C,D))

if A%C == 0:
    C_div = int(B/C) - int(A/C) + 1
else:
    C_div = int(B/C) - int(A/C)

if A%D == 0:
    D_div = int(B/D) - int(A/D) + 1
else:
    D_div = int(B/D)- int(A/D)


if A%E == 0:
    CandD_div  = int(B/E) - int(A/E) + 1
else:
    CandD_div  = int(B/E)- int(A/E)


ans = B - A + 1 - (C_div + D_div - CandD_div)
print(ans)


### FIXED CODE ###

import fractions

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

E =C*D//fractions.gcd(C,D)

if A%C == 0:
    C_div = B//C - A//C + 1
else:
    C_div = B//C - A//C

if A%D == 0:
    D_div = B//D - A//D + 1
else:
    D_div = B//D- A//D


if A%E == 0:
    CandD_div  = B//E - A//E + 1
else:
    CandD_div  = B//E- A//E


ans = B - A + 1 - (C_div + D_div - CandD_div)
print(ans)
n=int(input())
a=[int(input()) + i for i in range(n)]
a.sort()
b=a[n//2]
ans=0
for i in range(n):
  ans+=abs(a[i]-b)
print(ans)

### FIXED CODE ###

# coding: utf-8
# Your code here!
n=int(input())
b=input().split()
a=[0]*n
for i in range(n):
    a[i]=int(b[i])-i
a.sort()
c=a[n//2]
ans=0
for i in range(n):
  ans+=abs(a[i]-c)
print(ans)
import numpy as np
from numpy.linalg import solve

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

right = np.asarray(a)*2
left = np.zeros([n,n])
for i,_ in enumerate(a):
    if i != n-1:
        left[i,i:i+2] = 1
    else:
        left[i,0] = 1
        left[i,i] = 1
        
out = list(map(int, solve(left, right)))
print(" ".join(map(str, out)))

### FIXED CODE ###

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

s = sum(a)
b = [a[i] for i in range(n) if i % 2 == 1]
x1 = s - 2 * sum(b)
x = []
x.append(x1)
xi = x1
for i in range(0, n-1, 1):
    #print(a[i])
    xi_1 = 2 * a[i] - xi
    x.append(xi_1)
    #print(xi_1)
    xi = xi_1
    
print(" ".join(map(str, x)))
n,k=map(int,input().split())
h=list(map(int,input().split()))

h.sort(reverse=True)

if len(h)<=k:
  print(0)
  
else:
  for i in range(k):
    h.remove(h[i])
  print(sum(h))

### FIXED CODE ###

n,k=map(int,input().split())
h=list(map(int,input().split()))

h.sort(reverse=True)

if len(h)<=k:
  print(0)
  
else:
  del h[0:k]
  print(sum(h))
N=int(input())
list=list[map(int,input().split())]

x='Yes'
if N>=2:
  for i in range(N):
    if list[i]<=list[i+1]:
      continue
    elif list[i]==list[i+1]+1:
      list[i+1]=list[i+1]+1
    else:
        x='No'
    
print(x)

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
 
before = 0
result = 'Yes'
for i in range(len(h)):
    if i == 0:
        before = h[i] - 1
    else:
        if before < h[i]:
            before = h[i] - 1
        elif before == h[i]:
            before = h[i]
        else:
            result = 'No'
print(result)
n = int(input())
s = [input() for i in range(n)]
# print(n)
# print(s)
s = list(map(list, s))
# print(s)
for i in range(n):
    s[i].sort()
    s[i] = "".join(s[i])
# print(s)
dic = {}
for i in range(n):
    if s[i] in dic:
        dic[s[i]] += 1
    else:
        dic.setdefault(s[i],1)
a = list(dic.values())
# print(a)
import math
count = 0
for i in range(len(a)):
    if a[i] >= 2:
        count += math.factorial(a[i])//(math.factorial(a[i]-2)*2)
print(count)

### FIXED CODE ###

n,m = map(int,input().split())
ab = [ list(map(int,input().split())) for i in range(n) ]
# print(ab)
ab.sort()
# print(ab)
import heapq
heap = []
ans = 0
i = 0
for day in reversed(range(m)):
    while i<n and ab[i][0]==(m-day):
        heapq.heappush(heap,-ab[i][1])
        i += 1
    if len(heap) > 0:
        ans += -heapq.heappop(heap)
    # print(day,i,ans,heap)
print(ans)
n, k = map(int, input().split())
pos = [int(i) for i in input().split()]
score = [int(i) for i in input().split()]
if max(score) <= 0:
  print(max(score))
else:
  pos = [0] + pos
  score = [0] + score
  max_point = -10 ** 10
  s_l = [[0]]
  nei = {}
  dic = {}
  loop = 0
  for i in range(1, n + 1):
    f_pos = i
    #print('f_pos',f_pos)
    points = [0]
    count = 0
    if f_pos not in nei:
      loop += 1
      while True:
        n_pos = pos[f_pos]
        points.append(points[-1] + score[n_pos])
        count += 1
        nei[f_pos] = [count, loop]
        if n_pos in nei:
          dic[loop] = count
          break
        f_pos = n_pos
      #print(points)
      #print(nei)
      s_l.append(points)
      loop_num = count
    else:
      loop = nei[f_pos][1]
      count = nei[f_pos][0]
      loop_num = dic[loop]
      s = s_l[loop][count - 1]
      for j in range(count, loop_num + 1):
        points.append(s_l[loop][j] - s)
      s = s_l[loop][loop_num] - s
      for j in range(1, count):
        points.append(s_l[loop][j] + s)
      #print(points)
    a = k // loop_num
    b = k % loop_num
    if points[loop_num] > 0:
      point = points[loop_num] * a
      if b > 0:
        point += max(points[1:b + 1])
    else:
      point = max(points)
    #print(point)
    if point > max_point:
      max_point = point
  print(max_point)

### FIXED CODE ###

n, k = map(int, input().split())
positions = [int(i) for i in input().split()]
scores = [int(i) for i in input().split()]
if max(scores) <= 0:
  print(max(scores))
else:
  positions = [0] + positions
  scores = [0] + scores
  max_point = -pow(10, 9)
  #print(max_point)
  for i in range(1, n + 1):
    s = []
    f_pos = positions[i]
    score = scores[f_pos]
    s.append(score)
    while f_pos != i:
      f_pos = positions[f_pos]
      score += scores[f_pos]
      s.append(score)
    loop = len(s)
    if loop >= k:
      point = max(s[:k])
    elif s[-1] <= 0:
      point = max(s)
    else:
      loop_c = k // loop
      r = k % loop
      point1 = s[-1] * loop_c
      if r != 0:
        point1 += max(s[:r])
      point2 = s[-1] * (loop_c - 1)
      point2 += max(0, max(s))
      point = max(point1, point2)
    max_point = max(max_point, point)
  print(max_point)
h,a=divmod(int(input()))
m,s=divmod(a)
print("{}:{}:{}").format(h,m,s)

### FIXED CODE ###

h,a=divmod(int(input()), 3600)
m,s=divmod(a,60)
print("{}:{}:{}".format(h,m,s))
N=raw_input()
up=raw_input().split()

up=map(int,up)
up.sort()
count=0
for i in range(N):
    count+=up[i*2]
print count

### FIXED CODE ###

N=raw_input()
up=raw_input()
up=up.split()

up=map(int,up)
up.sort()
count=0
for i in range(int(N)):
    count+=up[i*2]
print count
print(x ** 3)

### FIXED CODE ###

x = int(input())
print(x ** 3)
import functools, sys


@functools.lru_cache(maxsize=None)
def rec(c):
    if c == 0:
        return 0
    ret = INF
    for coin in coins:
        if c - coin >= 0:
            ret = min(ret, rec(c-coin) + 1)
    return ret

INF = 10**6
N, M = map(int, input().split())
sys.setrecursionlimit(N+1)
coins = [int(x) for x in input().split()]
print(rec(N))

### FIXED CODE ###

n, m = map(int, input().split())
C = list(map(int, input().split()))
INF = 10**5
dp = [INF for _ in range(n+1)]
dp[0] = 0
for i in range(n):
    for c in C:
        if i + c <= n:
            dp[i+c] = min(dp[i+c], dp[i]+1)
print(dp[n])
H, W = map(int, input().split())
S = []
for i in range(H):
    S.append(input())

#white = ".", black = "#"
def search(x, y, color):
    global black
    global white
    if color == ".":
        for m in [1, -1]:
            if 0 <= x+m <= H-1:
                if S[x+m][y] == "#" and not dp[x+m][y]:
                    black += 1
                    dp[x+m][y] = True
                    color = "#"
                    search(x+m, y, color)
        for n in [1, -1]:
            if 0 <= y+n <= W-1:
                if S[x][y+n] == "#" and not dp[x][y+n]:
                    black += 1
                    dp[x][y+n] = True
                    color = "#"
                    search(x, y+n, color)

    else:
        for m in [1, -1]:
            if 0 <= x+m <= H-1:
                if S[x+m][y] == "." and not dp[x+m][y]:
                    white += 1
                    dp[x+m][y] = True
                    color = "."
                    search(x+m, y, color)

        for n in [1, -1]:
            if 0 <= y+n <= W-1:
                if S[x][y+n] == "." and not dp[x][y+n]:
                    white += 1
                    dp[x][y+n] = True
                    color = "."
                    search(x, y+n, color)


ans = 0
dp = [[False] * W for a in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j] == "#" and not dp[i][j]:
            black = 1
            white = 0
            dp[i][j] = True
            search(i, j, "#")
            ans += black * white

print(ans)


### FIXED CODE ###

H, W = map(int, input().split())
import sys
sys.setrecursionlimit(500000)
S = []
for i in range(H):
    S.append(input())

#white = ".", black = "#"
def search(x, y, color):
    global black
    global white
    if color == ".":
        for m in [1, -1]:
            if 0 <= x+m <= H-1:
                if S[x+m][y] == "#" and not dp[x+m][y]:
                    black += 1
                    dp[x+m][y] = True
                    color = "#"
                    search(x+m, y, color)
        for n in [1, -1]:
            if 0 <= y+n <= W-1:
                if S[x][y+n] == "#" and not dp[x][y+n]:
                    black += 1
                    dp[x][y+n] = True
                    color = "#"
                    search(x, y+n, color)

    else:
        for m in [1, -1]:
            if 0 <= x+m <= H-1:
                if S[x+m][y] == "." and not dp[x+m][y]:
                    white += 1
                    dp[x+m][y] = True
                    color = "."
                    search(x+m, y, color)

        for n in [1, -1]:
            if 0 <= y+n <= W-1:
                if S[x][y+n] == "." and not dp[x][y+n]:
                    white += 1
                    dp[x][y+n] = True
                    color = "."
                    search(x, y+n, color)


ans = 0
dp = [[False] * W for a in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j] == "#" and not dp[i][j]:
            black = 1
            white = 0
            dp[i][j] = True
            search(i, j, "#")
            ans += black * white

print(ans)
n=int(input())
s=input()
ans=[]
alle=list(s).count("E")
allw=n-alle
ecnt=wcnt=0
for i in range(n):
    ans.append(wcnt+alle-(i-wcnt+ecnt)
    if s[i] == "W":
        wcnt+=1
    else:
        ecnt+=1
print(min(ans))

### FIXED CODE ###

n=int(input())
s=input()
ans=[]
alle=list(s).count("E")
allw=n-alle
ecnt=wcnt=0
for i in range(n):
    if s[i] == "W":
        ans.append(wcnt+alle-ecnt)
        wcnt+=1
    else:
        ans.append(wcnt+alle-ecnt-1)
        ecnt+=1
print(min(ans))
input()
A = list(map(int, input().split()))
A.sort()
while len(A)>=1:
    A.append((A[0]+A[1])/2)
    del(A[0:2])
    A.sort()
print(A)

### FIXED CODE ###

input()
A = list(map(int, input().split()))
A.sort()
while len(A)>1:
  b = A[0:2]
  c = sum(i for i in b)
  A.append(c/2)
  del(A[0:2])
  A.sort()
z = [str(a) for a in A]
z = ''.join(z)
print(z)
s=list(input())
if s[2]==s[3] and s[4]==s[5]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

X=int(input())
happy=(X//500)*1000
left=X%500
happy+=(left//5)*5
print(happy)
N=int(input())

ans = 0
i = 1
while True:
  m = N//i-1
  q,r = divmod(N,m)
  if q == r:
    ans += m
  if m<N**.5:
    break
  i += 1
  
print(ans)

### FIXED CODE ###

N=int(input())

if N == 1:
  print(0)
  exit()

ans = 0
i = 1
while True:
  m = N//i-1
  q,r = divmod(N,m)
  if q == r:
    ans += m
  if m<N**.5:
    break
  i += 1
  
print(ans)
li = map(input())
c = 0
for i range 3:
  if li[i]=='1':
    c++
    
print(c)

### FIXED CODE ###

li = list(input())
c = 0
for i in [0,1,2]:
  if li[i]=='1':
    c = c +1
    
print(c)
#ABC129C-TypicalStairs.py

#import list
from sys import stdin, setrecursionlimit
from functools import lru_cache

input = stdin.readline
setrecursionlimit(100000)

#constant
#N = int(input())
N, M = list(map(int,input().split()))
A = [int(input()) for _ in range(M)]

#variable

#function
@lru_cache(maxsize=None)
def rootCount(position):
    if position < 0:
        return 0
    elif position == 0:
        return 1
    elif position in A:
        return 0
    else:
        return rootCount(position-1)+rootCount(position-2)
#class

#main function
def main():
    print(rootCount(N)%1000000007)




if __name__ == "__main__":
    main()


### FIXED CODE ###

#ABC129C-TypicalStairs.py

#import list
import numpy as np
from sys import stdin, setrecursionlimit
from functools import lru_cache

input = stdin.readline
setrecursionlimit(1000)

#constant
#N = int(input())
N, M = list(map(int,input().split()))
A = {int(input()) for _ in range(M)}

#variable
rootList = np.array([1]+[0]*(N))

#function

#class

#main function
def main():
    for i in range(N):
        rootList[i+1] = (rootList[i]+rootList[i-1])%1000000007
        if i+1 in A:
            rootList[i+1] = 0
    print(rootList[N])

if __name__ == "__main__":
    main()
n,d,a=map(int,input().split())
xh=[list(map(int,input().split())) for _ in range(n)]
xh.sort(key=itemgetter(0))

import collections
q=collections.deque()

ans = 0
totalDamage = 0


for i in range(n):
    x,h = xh[i]
    if len(q) and q[0][0] < x:
        totalDamage -= q[0][1]
        q.popleft()
    h -=totalDamage
    if h <= 0:
        continue
    num = (h + a -1) //a
    ans += num
    dam = num*a
    totalDamage += dam
    q.append((x+2*d,dam))

print(ans)

### FIXED CODE ###

n,d,a=map(int,input().split())
xh=[list(map(int,input().split())) for _ in range(n)]
xh.sort()

import collections
pq=collections.deque()

ans = 0
totalDamage = 0


for i in range(n):
    x,h = xh[i]
    while len(pq) > 0 and pq[0][0] < x:
        totalDamage -= pq[0][1]
        pq.popleft()
    h -=totalDamage
    if h <= 0:
        continue
    num = (h + a -1) //a
    ans += num
    dam = num*a
    totalDamage += dam
    pq.append((x+2*d,dam))

print(ans)
n = int(input())
l = tuple(map(int, input().split()))
count = 0
while all(i % 2 == 0 for i in l):
    count += 1
    l = tuple(map(lambda x: x / 2, l))
print(count)

### FIXED CODE ###

print(input().count('1'))
n = int(input())

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

f = [[0], []]
f[1] = [] + p[0]
if n - 1 in f[1]:
    f[1].remove(n - 1)
    if len(f[1]) == 0:
        print("Snuke")
    else:
        print("Fennec")
    exit()

s = [[n - 1], []]
s[1] = [] + p[n - 1]

d = 1
check = 0
check_f = 0
check_s = 0

while 1:
    if check_f == 0:
        temp_f = []
        for i in f[d]:
            temp_f = temp_f + p[i]
        temp_f = list(set(temp_f))
        if n - 1 in temp_f:
            temp_f.remove(n - 1)
        for i in f[d - 1]:
            if i in temp_f:
                temp_f.remove(i)
        if len(temp_f) > 0:
            f.append([])
            f[d + 1] = [] + temp_f
        else:
            check_f = 1
    else:
        if check_s != 0:
            break

    if check_s == 0:
        temp_s = []
        for i in s[d]:
            temp_s = temp_s + p[i]
        temp_s = list(set(temp_s))
        if 0 in temp_s:
            temp_s.remove(0)
        for i in s[d - 1]:
            if i in temp_s:
                temp_s.remove(i)
        if len(temp_s) > 0:
            s.append([])
            s[d + 1] = [] + temp_s
        else:
            check_s = 1

    if check == 0:
        for i in temp_f:
            if i in temp_s:
                temp_s.remove[i]
                check = 1

    d += 1

fe = sum(len(v) for v in f)

sn = sum(len(v) for v in s)

if fe > sn:
    print("Fennec")
else:
    print("Snuke")

### FIXED CODE ###

n = int(input())

p = [[] for _ in range(n)]
for i in range(n - 1):
    x, y = map(int, input().split())
    p[x - 1].append(y - 1)
    p[y - 1].append(x - 1)

f = [n for _ in range(n)]
s = [n for _ in range(n)]

f[0] = 0
after = [] + p[0]
before = set()
dist = 0
while 1:
    dist += 1
    check = 0
    temp = []
    for x in after:
        if f[x] == n:
            f[x] = dist
            temp += p[x]
            check = 1
    if check == 0:
        break
    t2 = set(temp) - before
    before = set(after)
    after = list(t2)

s[n - 1] = 0
after = [] + p[n - 1]
before = set()
dist = 0
while 1:
    dist += 1
    check = 0
    temp = []
    for x in after:
        if s[x] == n:
            s[x] = dist
            temp += p[x]
            check = 1
    if check == 0:
        break
    t2 = set(temp) - before
    before = set(after)
    after = list(t2)

score_f = 0
for i in range(n):
    if f[i] <= s[i]:
        score_f += 1

if score_f > n - score_f:
    print('Fennec')
else:
    print('Snuke')
N,M=map(int,input().split())
big=10**13
from collections import defaultdict
branch=defaultdict(set)
for i in range(M):
    a,b,c=map(int,input().split())
    branch[a]|={(b,c),}
def dps(now,score,visited,ans):
    if now==N:
        ans=max(score,ans)
    if len(branch[now])==0:
        return ans
    for b,c in branch[now]:
        if ans>big:return ans
        if  b in visited:
            return float('inf')
        ans=dps(b,score+c,visited|{now,},ans)
    return ans
ans=dps(1,0,set(),-1*float('inf'))
if ans>big:print('inf')
else:print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
big=10**13
data=[-1*float('inf')]*(N+1)
from collections import defaultdict
branch=defaultdict(set)
for i in range(M):
    a,b,c=map(int,input().split())
    branch[a]|={(b,c),}
from collections import deque
check=deque()
check.append((1,0,set()))
data[1]=0
while len(check)>0:
    now=check.popleft()
    for b,c in branch[now[0]]:
        if now[1]+c>data[b]:
            if data[b]>big:continue
            if b in now[2]:
                data[b]=float('inf')
                check.append((now[0],float('inf'),now[2]|{now[0],b}))
                check.append((b,float('inf'),now[2]|{now[0],b}))
            else:
                data[b]=now[1]+c
                check.append((b,now[1]+c,now[2]|{now[0],}))
if data[N]>big:print('inf')
else:print(data[N])
n, m = map(int,input().split())

for i in range(n):
    ans += "x"

pf = True
for i in range(m):
    s,c = map(int,input().split())
    if (not ans[s] == "x") and (not ans[s] == str(c)):
        print(-1)
        pf = False
        break
    else:
        ans[s] = str(c)

if pf:
    if ans[0] == "x":
        ans[0] = "1"
    for i in range(n):
        if ans[i] == "x":
            ans[i] = "0"
print(ans)


### FIXED CODE ###

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

ans = [-1 for i in range(n)]

pf = True
for i in range(m):
    s,c = map(int,input().split())
    if ((not ans[s-1] == -1) and (not ans[s-1] == c)) or ((not n == 1)and s == 1 and c == 0):
        print(-1)
        pf = False
        break
    else:
        ans[s-1] = c

if pf and n == 1:
    if ans[0] == -1:
        print(0)
    else:
        print(ans[0])
elif pf:
    if ans[0] == -1:
        ans[0] = 1
    for i in range(n):
        if ans[i] == -1:
            ans[i] = 0
    print(''.join(map(str,ans)))
a, b, c, d = [int(temp) for temp in input().split()]
from math import sqrt
print(sqrt((c - a) ** 2 + (d - b) ** 2))

### FIXED CODE ###

a, b, c, d = [float(temp) for temp in input().split()]
from math import sqrt
dis = sqrt((c - a) ** 2 + (d - b) ** 2)
print('%0.5f'%dis)
N=int(input())
b=[int(i) for i in input().split()]
a = [0]*N
def dfs(x,n,a): #n桁のx
  if x == []: #Goalで終了
    return True
    
  for xlen in range(min(len(x),9))[::-1]:
    if x[xlen] == xlen+1:
      a[n] = xlen+1
      xx = copy.copy(x)
      xx.pop(xlen)
      return dfs(xx, n-1, a)

  if a[n] == 0:
      return False
if dfs(b,N-1,a):
  for i in range(N):
    print(a[i])
else:
  print(-1)

### FIXED CODE ###

import copy
N=int(input())
b=[int(i) for i in input().split()]
 
c = copy.copy(b) #コピーを行う
a = [0]*N
a_n = N-1
 
for n in range(N)[::-1]:#N桁
  for i in range(len(c))[::-1]:#大きい数字からcheck
    if c[i]==i+1:#iが9を超えても成立する
      a[a_n] = c.pop(i)
      #print(c,len(c))
      a_n = a_n-1
      break#このbreakに気づかなかったので、2を取り除いたあとに1も取り除いてしまった
 
if n-1 != a_n:
  print(-1)
  exit()
else:
  for i in range(N):
    print(a[i])