ZhenlongDai/ACPR huggingface dataset:
Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
import itertools
import functools
import math

if __name__ == "__main__":
    x = int(input())
    print(1) if x < 7 else print(math.ceil((x) / 5.5))


Failing test case input:
-141

Expected output:
-25


Actual output:
1


Fixed submission (verdict: Accepted):
import collections
import itertools
import functools
import math

if __name__ == "__main__":
    x = int(input())
    print((x

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input());m=n

Failing test case input:
325811

Expected output:
59239


Actual output:

Fixed submission (verdict: Accepted):
n=int(input());print(n

Problem: p03815
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x = int(input())

if x > 11:
    if x % 11 == 0:
        print(int(x*2/11))
    else:
        print(int(x*2/11)+1)

elif x < 7:
    print(1)
    
else:
    print(2)

Failing test case input:
-172

Expected output:
-31


Actual output:
1


Fixed submission (verdict: Accepted):
x = int(input())
if x > 11:
    if x % 11 == 0:
        print((x
    elif x % 11 < 7:
        print((x
    else:
        print((x

elif x < 7:
    print(1)
    
else:
    print(2)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())

div, mod = divmod(x, 11)

div = div*2
if mod <= 6:
    div = div + 1
else:
    div = div + 2

print(div)

Failing test case input:
983994

Expected output:
178908


Actual output:
178909


Fixed submission (verdict: Accepted):
x = int(input())

div, mod = divmod(x, 11)

div = div*2
if mod == 0:
    pass
elif mod <= 6:
    div = div + 1
else:
    div = div + 2

print(div)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
x = int(input())
N = 2*math.floor(x/11)
x = x % 11
if x != 0:
    if x <= 5:
        N += 1
    else:
        N += 2
print(N)

Failing test case input:
3247730789

Expected output:
590496507


Actual output:
590496508


Fixed submission (verdict: Accepted):
x = int(input())
N = 2*(x
x = x % 11
if x != 0:
    if x <= 6:
        N += 1
    else:
        N += 2
print(N)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
X = int(input())
b = math.floor((X / 11))*2
if((X % 11) < 7):
    print(b + 1)
elif(X % 11 < 11):
    print(b + 2)
else:
    print(b)

Failing test case input:
2749863688

Expected output:
499975216


Actual output:
499975217


Fixed submission (verdict: Accepted):
import math
X = int(input())
b = math.floor((X / 11))*2
if((X % 11) > 0 and (X % 11) < 7):
    print(b + 1)
elif((X % 11) > 0 and X % 11 < 11):
    print(b + 2)
else:
    print(b)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())

i, j = divmod(x, 11)
ans = i * 2
if 0 < j <= 5:
    ans += 1
else:
    ans += 2
print(ans)


Failing test case input:
48714

Expected output:
8857


Actual output:
8858


Fixed submission (verdict: Accepted):
x = int(input())

i, j = divmod(x, 11)
ans = i * 2
if 0 < j <= 6:
    ans += 1
elif 6 < j:
    ans += 2
print(ans)
Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())
ans = x 
tmp = x % 11
if tmp > 6:
  ans += 2
elif tmp > 0:
  ans += 1

print(ans)

Failing test case input:
1160

Expected output:
211


Actual output:
1161


Fixed submission (verdict: Accepted):
x = int(input())
ans = (x 
tmp = x % 11
if tmp > 6:
  ans += 2
elif tmp > 0:
  ans += 1

print(ans)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
a=int(input())
j=math.floor(a/11)
if a==j:
  j=j*2
elif a - j * 11<=6:
  j=j*2+1
else:
  j=j*2+2
print(j)

Failing test case input:
544563173

Expected output:
99011486


Actual output:
99011487


Fixed submission (verdict: Accepted):
import math
a=int(input())
j=math.floor(a/11)
if a==j*11:
  j=j*2
elif a - j * 11<=6:
  j=j*2+1
else:
  j=j*2+2
print(j)

Problem: p03815
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import math
def main():
    x = int(input())
    if(x>6):
        res = 1
    if(x%11<=6):
        a = math.ceil((x+5)/11)
        b = a-1
        print(a+b)
    else:
        a=math.ceil((x)/11)
        b=a
        print(a+a)
if __name__ == '__main__':
    main()


Failing test case input:
983994

Expected output:
178908


Actual output:
178909


Fixed submission (verdict: Accepted):
import math
def main():
    x = int(input())
    if(x>6):
        res = 1
    if(x%11<=6 and x%11!=0):
        a = math.ceil((x+5)/11)
        b = a-1
        print(a+b)
    else:
        a=math.ceil((x)/11)
        b=a
        print(a+a)
if __name__ == '__main__':
    main()

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x=int(input())
ans=x
if x%11<=6:
  ans+=1
else:
  ans+=2
print(ans)

Failing test case input:
-255

Expected output:
-46


Actual output:
-253


Fixed submission (verdict: Accepted):
x=int(input())
ans=(x
if x%11==0:
  pass
elif x%11<=6:
  ans+=1
else:
  ans+=2
print(ans)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import math
n = int(input().split()[0])



c = math.floor(n / 11) * 2

if n % 11 == 0:
    pass
elif n % 11 <= 5:
    c += 1
elif n % 11 >= 6:
    c += 2

print(int(c))


Failing test case input:
2111835413

Expected output:
383970075


Actual output:
383970076


Fixed submission (verdict: Accepted):


import math
n = int(input().split()[0])

c = math.floor(n / 11) * 2

if n % 11 == 0:
    pass
elif n % 11 <= 6:
    c += 1
elif n % 11 > 6:
    c += 2

print(int(c))

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
d,m=divmod(int(input()),11);print(d*2+(m>0)+(m>5))

Failing test case input:
7222

Expected output:
1313


Actual output:
1314


Fixed submission (verdict: Accepted):
d,m=divmod(int(input()),11);print(d*2+(m>0)+(m>6))
Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin

x = int(stdin.readline())

integral, mod = divmod(x, 11)
integral *= 2

if mod <= 6:
    integral += 1
else:
    integral += 2

print(integral)


Failing test case input:
983994

Expected output:
178908


Actual output:
178909


Fixed submission (verdict: Accepted):
from sys import stdin

x = int(stdin.readline())

integral, mod = divmod(x, 11)
integral *= 2

if mod == 0:
    pass
elif mod <= 6:
    integral += 1
else:
    integral += 2

print(integral)

Problem: p03815
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x=int(input())

q,r = divmod(x,11)
if r <= 6:a = 1
else:a = 2
  
print(2*q+a)

Failing test case input:
983994

Expected output:
178908


Actual output:
178909


Fixed submission (verdict: Accepted):
x=int(input())

q,r = divmod(x,11)

if r==0:a=0
elif r <= 6:a = 1
else:a = 2
  
print(2*q+a)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())

s , a = divmod(x , 11)

if a > 6:
    print((s*2) + 2)
else:
    print((s*2) + 1)

Failing test case input:
19238477126

Expected output:
3497904932


Actual output:
3497904933


Fixed submission (verdict: Accepted):
x = int(input())

s , a = divmod(x , 11)

if a > 6:
    print((s*2) + 2)
elif a == 0:
    print((s*2))
else:
    print((s*2) + 1)

Problem: p03815
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
x = int(input())
if x == 6:
  x -= 1  
print(math.ceil(x/5.5))

Failing test case input:
2525

Expected output:
459


Actual output:
460


Fixed submission (verdict: Accepted):
import math
x = int(input())
if x == 6 or (x-6)%11 == 0:
  x -= 1  
print(math.ceil(x/5.5))

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n = int(input())

if n <= 6:
  print(1)
  exit(0)
  
a = math.floor((n / 11)*2)
amari = n % 11
if amari <= 6:
  print(a + 1)
  exit(0)

if amari > 6:
  print(a + 2)
  exit(0)

print(a)


Failing test case input:
3630156079

Expected output:
660028378


Actual output:
660028379


Fixed submission (verdict: Accepted):
import math
n = int(input())
  
a = math.floor((n / 11))*2
amari = n % 11
if amari == 0:
  print(a)
  exit(0)
  
if amari <= 6:
  print(a + 1)
  exit(0)

if amari > 6:
  print(a + 2)
  exit(0)

print(a)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())

div, mod = divmod(x, 11)

div = div*2
if mod <= 6:
    div = div + 1
elif mod == 7:
    div = div + 3
else:
    div = div + 2

print(div)

Failing test case input:
2749863688

Expected output:
499975216


Actual output:
499975217


Fixed submission (verdict: Accepted):
x = int(input())

div, mod = divmod(x, 11)

div = div*2
if mod == 0:
    pass
elif mod <= 6:
    div = div + 1
else:
    div = div + 2

print(div)
Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())

d, m = divmod(x, 11)
d *= 2

if m >= 7:
    d += 2
else:
    d += 1
print(d)

Failing test case input:
79402108049

Expected output:
14436746918


Actual output:
14436746919


Fixed submission (verdict: Accepted):
x = int(input())

d, m = divmod(x, 11)
d *= 2

if m >= 7:
    d += 2
elif m >= 1:
    d += 1
print(d)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import *
x = int(input())
m = 11
if x < 6:
  ans = 1
elif x < 11:
  ans = 2
elif x%m == 0:
  ans = x*2
elif 0 < x%m <= 5:
  ans = x*2
elif 6 <= x%m:
  ans = x*2
print(ans)

Failing test case input:
-409

Expected output:
-74


Actual output:
1


Fixed submission (verdict: Accepted):
x = int(input())
m = 11
if x < 7:
  ans = 1
elif x <= 11:
  ans = 2
elif x%m == 0:
  ans = x*2
elif 0 < x%m <= 6:
  ans = (x
elif 7 <= x%m:
  ans = (x
print(ans)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())
ans = int(x / 11 * 2)


if  x % 11 <= 6 and x % 11 != 0:
    ans += 1
else:
    ans += 2

print(ans)

Failing test case input:
1835108767

Expected output:
333656140


Actual output:
333656141


Fixed submission (verdict: Accepted):
x = int(input())
ans = (x 


if  x % 11 <= 6 and x % 11 != 0:
    ans += 1
elif x % 11 >= 7:
    ans += 2

print(ans)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

a = n 
b = n % 11
c = 1
if b >= 6:
	c = 2
print(a+c)



Failing test case input:
3385657208

Expected output:
615574038


Actual output:
3385657210


Fixed submission (verdict: Accepted):
n = int(input())

a = (n 

b = n % 11

c = 0
if 7 > b > 0:
	c = 1
elif b >= 7:
	c = 2
print(a+c)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
ans=2*n
n=n%11
if n==0:
  ans+=0
elif n<=6:
  ans+=1
else:
  ans+=2
print(ans)


Failing test case input:
-191

Expected output:
-34


Actual output:
-380


Fixed submission (verdict: Accepted):
n=int(input())
ans=2*(n
n=n%11
if n==0:
  ans+=0
elif n<=6:
  ans+=1
else:
  ans+=2
print(ans)

Problem: p03815
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a=int(input())
n=2*int(a/11)+int(a%11/6)+1
if a%11==0:
  n-=1
print(n)

Failing test case input:
-150

Expected output:
-27


Actual output:
-25


Fixed submission (verdict: Accepted):
a=int(input())
n=2*(a
if a%11==0:
  n-=1
print(n)

Problem: p03815
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
x=int(input())
y=19
z=[5,11,15]

ans=0
ans+=x
cnt=x%11
if cnt>=6:
  ans+=2
elif cnt>=1:
  ans+=1
  
print(ans)

Failing test case input:
-191

Expected output:
-34


Actual output:
-189


Fixed submission (verdict: Accepted):
x=int(input())
y=19

ans=0
ans+=(x
cnt=x%11
if cnt>=7:
  ans+=2
elif cnt>=1:
  ans+=1
  
print(ans)
Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
x = int(input())
N = 2*math.floor(x/11)
x = x % 11
if x <= 5:
    N += 1
else:
    N += 2
print(N)

Failing test case input:
1601465597

Expected output:
291175563


Actual output:
291175564


Fixed submission (verdict: Accepted):
x = int(input())
N = 2*(x
x = x % 11
if x != 0:
    if x <= 6:
        N += 1
    else:
        N += 2
print(N)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n = int(input())
  
a = math.floor((n / 11)*2)
amari = n % 11
if amari == 0:
  print(a)
  exit(0)
  
if amari <= 6:
  print(a + 1)
  exit(0)

if amari > 6:
  print(a + 2)
  exit(0)

print(a)


Failing test case input:
43523

Expected output:
7914


Actual output:
7915


Fixed submission (verdict: Accepted):
import math
n = int(input())
  
a = math.floor((n / 11))*2
amari = n % 11
if amari == 0:
  print(a)
  exit(0)
  
if amari <= 6:
  print(a + 1)
  exit(0)

if amari > 6:
  print(a + 2)
  exit(0)

print(a)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())
double, rest = divmod(x, 11)
if rest <= 6:
    add = 1
elif rest > 6:
    add = 2
else:
    add = 0
ans = double * 2 + add
print(ans)

Failing test case input:
544563173

Expected output:
99011486


Actual output:
99011487


Fixed submission (verdict: Accepted):
x = int(input())
double, rest = divmod(x, 11)
if rest == 0:
    add = 0
elif 1<= rest <= 6:
    add = 1
else:
    add = 2
ans = double * 2 + add
print(ans)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())
s = x
x = x%11
if x>5:
  s += 2
elif x>0:
  s += 1
print(s)


Failing test case input:
11375

Expected output:
2069


Actual output:
11376


Fixed submission (verdict: Accepted):
x = int(input())
s = (x
x = x%11
if x>6:
  s += 1
if x>0:
  s += 1
print(s)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
result, r = divmod(n, 11)
print(result*2 + 1 + (r>6))

Failing test case input:
544563173

Expected output:
99011486


Actual output:
99011487


Fixed submission (verdict: Accepted):
n = int(input())
result, r = divmod(n-1, 11)
r += 1
print(result*2 + 1 + (r>6))

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
x=int(input())
if x<=6:
  print(1)
else:
  print(math.ceil(x/11*2))

Failing test case input:
-255

Expected output:
-46


Actual output:
1


Fixed submission (verdict: Accepted):
import math
x=int(input())
if x%11==0:
  print(x
elif x%11<=6:
  print(x
else:
  print(x

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

a = n
b = n%11
if n <= 5:
    print(a+1)
else:
    print(a+2)

Failing test case input:
5610499960

Expected output:
1020090902


Actual output:
5610499962


Fixed submission (verdict: Accepted):
n = int(input())

a = (n
b = n % 11
if b == 0:
    print(a)
elif b <= 6:
    print(a+1)
else:
    print(a+2)
Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())
q, mod = divmod(x, 11)
if (mod <= 6):
    print(q * 2 + 1)
else:
    print(q * 2 + 2)

Failing test case input:
196870267

Expected output:
35794594


Actual output:
35794595


Fixed submission (verdict: Accepted):
x = int(input())
q, mod = divmod(x, 11)
if (mod == 0):
    print(q * 2)
elif (mod <= 6):
    print(q * 2 + 1)
else:
    print(q * 2 + 2)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n = int(input())

a = n 
b = n % 11
c = 1
if b >= 7:
	c = 2
print(a+c)

Failing test case input:
77338

Expected output:
14062


Actual output:
77340


Fixed submission (verdict: Accepted):
n = int(input())

a = (n 

b = n % 11

c = 0
if 7 > b > 0:
	c = 1
elif b >= 7:
	c = 2
print(a+c)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = int(input())
k = X
l = X%11
if l == 0:print(k)
elif l <= 5:print(k+1)
else:print(k+2)

Failing test case input:
207449

Expected output:
37718


Actual output:
207449


Fixed submission (verdict: Accepted):
X = int(input())
k = (X
l = X%11
if l == 0:print(k)
elif l <= 6:print(k+1)
else:print(k+2)

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


def main():
    a = int(input())
    ans = a % 11

    if ans == 0:
        print(int(a / 11) * 2)
    elif ans > 6:
        print(int(a / 11 * 2) + 2)
    else:
        print(int(a / 11 * 2) + 1)
if __name__ == '__main__':
    main()


Failing test case input:
2525

Expected output:
459


Actual output:
460


Fixed submission (verdict: Accepted):


def main():
    x = int(input())
    ans = (x 
    x %= 11

    if x > 0:
        if x > 6:
            ans += 2
        else:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Problem: p03815
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())
count = 0
q, x = divmod(x, 11)
count += q*2
if(x < 7):
    count += 1
else:
    count += 2
print(count)


Failing test case input:
207449

Expected output:
37718


Actual output:
37719


Fixed submission (verdict: Accepted):
x = int(input())
count = 0
q, mod = divmod(x, 11)
count += q*2
if(mod == 0):
    pass
elif(mod <= 6):
    count += 1
else:
    count += 2
print(count)
Problem: p02268
Buggy submission (Python3, verdict: Wrong Answer):
s = input()
snum = set(map(int, input().split()))
q = input()
qnum = set(map(int, input().split()))
print(len(snum and qnum))

Failing test case input:
3
3 8 1
6
9

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
s = input()
snum = set(map(int, input().split()))
q = input()
qnum = set(map(int, input().split()))
print(len(snum & qnum))

Problem: p02268
Buggy submission (Python3, verdict: Wrong Answer):
def binarySearch(S, T):
    print(len(set(S) and set(T)))
    
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

binarySearch(S, T)

Failing test case input:
5
1 0 14 1 7
3
2 1

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
def binarySearch(S, T):
    print(len(S.intersection(T)))
    
n = int(input())
S = set(map(int, input().split()))
q = int(input())
T = set(map(int, input().split()))

binarySearch(S, T)

Problem: p02268
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
S = set(input().split())
q = int(input())
T = set(input().split())

print(S & T)

Failing test case input:
5
1 0 4 2 3
2
1 1

Expected output:
1


Actual output:
{'1'}


Fixed submission (verdict: Accepted):
n = int(input())
S = set(input().split())
q = int(input())
T = set(input().split())

print(len(S & T))
Problem: p00612
Buggy submission (Python3, verdict: Wrong Answer):
while 1:
    n=int(input())
    if n==0:break
    a=0;i=1;b=n
    while i*i<b:a+=((b-1)/i+1)-i-1;i+=1
    a=int((a+b-1)*2+i)
    print(8*(a+n))

Failing test case input:
2
0
8

Expected output:
24


Actual output:
48


Fixed submission (verdict: Accepted):
while 1:
    n=int(input())
    if n==0:break
    a=0;i=1;b=n
    while i*i<b:a+=((b-1)
    a=(a+b-1)*2+i
    print(8*(a+n))
Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
b=list(map(int,input().split()))
ans=0
nMax=1
for i in range(n):
    if b[i]==nMax:
        nMax+=1
    elif b[i]>nMax:
        ans+=-1
        break
if ans==-1:
    print(ans)
else:
    a=[]
    for i in range(n):
        if b[n-i-1]!=1:
            a.append(b[n-i-1])
        else:
            print(b[n-i-1])
            a.sort()
            for j in range(len(a)):
                print(a[j])
            a=[]

Failing test case input:
9
1 1 1 1 2 1 4 1 2

Expected output:
1
2
1
1
2
4
1
1
1


Actual output:
-1


Fixed submission (verdict: Accepted):
n=int(input())
b=list(map(int,input().split()))
a=[]
flg=1
for i in range(n):
    if flg==0:
        break
    else:
        flg=0
    for j in range(len(b)):
        
        if b[len(b)-1-j]==len(b)-j:
            a.append(b[len(b)-1-j])
            b=b[:len(b)-1-j]+b[len(b)-j:]
            
            flg=1
            break
if flg==0:
    print(-1)
else:
    for i in range(n):
        print(a[n-1-i])

Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

N = int(input())
max = 0
b = [int(x) for x in input().split()]
flag = [0 for x in range(N)]
for i in b:
    if i > max:
        max = i
submax = max
ans = []
while b != []:
    if ((submax) == my_index(b,submax-1)):
        ans.append(b.pop(submax-1))
        submax = max
    else :
        submax = submax-1
        if b[0] != 1:
            print(-1)
            exit()

for x in range(len(ans)):
    print(ans.pop(len(ans)-1))

Failing test case input:
9
1 1 1 2 2 1 2 3 2

Expected output:
1
2
2
3
1
2
2
1
1

Actual output:
1
1
2
2
1
2
3
2
1


Fixed submission (verdict: Accepted):
def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

N = int(input())
max = 0
b = [int(x) for x in input().split()]
flag = [0 for x in range(N)]
for i in b:
    if i > max:
        max = i
submax = max
ans = []
while b != []:
    if ((submax-1) == my_index(b,submax)):
        ans.append(b.pop(submax-1))
        submax = max
    else :
        submax = submax-1
        if b[0] != 1:
            print(-1)
            exit()

for x in range(len(ans)):
    print(ans.pop(len(ans)-1))
Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
b = list(map(int, input().split()))



ans = []

k = 0

while True:

    if b[k] == k+1:

        k += 1
        if len(b) <= k:
            b.pop(k-1)
            ans.append(k)
            k = 0

    else:

        if k == 0:
            ans = [-1]
            break
        b.pop(k-1)
        ans.append(k)
        k = 0
    if len(b) == 0:
        break


for a in ans[::-1]:
    print(a)

Failing test case input:
9
1 1 1 2 2 1 4 3 2

Expected output:
1
2
1
3
2
4
2
1
1


Actual output:
-1


Fixed submission (verdict: Accepted):
n = int(input())
b = list(map(int, input().split()))

ans = []

k = 0

while True:
    a = -1
    for k in range(len(b)):
        if b[k] == k+1:
            a = k

    if a == -1:
        ans = [-1]
        break
    else:
        b.pop(a)
        ans.append(a+1)
        if len(b) == 0:
            break
            
for a in ans[::-1]:
    print(a)

Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
b = list(map(int, input().split()))

a = []
for i in range(N-1, -1, -1):
	if b[i] == 1:
		a += sorted([b.pop() for j in range(len(b)-i)])

if len(a) != N:
	print(-1)
else:
	for ai in a:
		print(ai)

Failing test case input:
9
1 1 1 1 2 1 4 3 2

Expected output:
1
2
1
3
2
4
1
1
1


Actual output:
1
2
3
4
1
2
1
1
1


Fixed submission (verdict: Accepted):
N = int(input())
b = list(map(int, input().split()))

for i in range(N):
	if b[i] > i+1:
		print(-1)
		exit()

a = []
for i in range(N):
	for j in range(len(b)-1, -1, -1):
		if b[j] == j+1:
			a += [b.pop(j)]
			break
a.reverse()
			
if len(b) != 0:
	print(-1)
else:
	for ai in a:
		print(ai)

Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n =  int(input())
l =  list(map(int,input().split()))
l1 = []
for i in range(n):
  for j in range(n-1-i,-1,-1):
    if l[j]==j+1:
      l1.append(l[j])
      del l[j]
      break
    else:
      continue
if len(l)==0:
  for j in l1:
    print(j)
else:
  print(-1)

Failing test case input:
9
1 1 1 2 2 1 4 1 2

Expected output:
1
2
1
1
2
4
2
1
1


Actual output:
1
1
2
4
2
1
1
2
1


Fixed submission (verdict: Accepted):
n =  int(input())
l =  list(map(int,input().split()))
l1 = []
for i in range(n):
  for j in range(n-1-i,-1,-1):
    if l[j]==j+1:
      l1.append(l[j])
      del l[j]
      break
    else:
      continue
if len(l)==0:
  for j in l1[::-1]:
    print(j)
else:
  print(-1)
Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
def f(a):
  print(a)
  if len(a) == 0:
    return []
  for i in range(len(a)):
    if a[i] == i+1:
      b = a.copy()
      b.pop(i)
      ret = f(b)
      if ret == [-1]:
        continue
      ret.append(i+1)
      return ret
    else:
      continue
  else:
    return [-1]
ret = f(a)
print('\n'.join(map(str,ret)))

Failing test case input:
3
4 7 1

Expected output:
-1


Actual output:
[4, 7, 1]
-1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
acts = []
while True:
    for i in range(len(a)):
        idx = len(a)-i-1
        if a[idx] == idx+1:
            a.pop(idx)
            acts.append(idx+1)
            break
    else:
        print('-1')
        break
    if len(a) == 0:
        acts.reverse()
        print('\n'.join(map(str,acts)))
        break

Problem: p03089
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

n=int(input())
b=[int(i) for i in input().split()]





ans=[]

for j in range(n-1):
    val=110
    
    lenb=len(b)
    for i in range(lenb-1,-1,-1):
        if i+1==b[i]:
            val=b[i]
            break
    b.pop(i)
    ans.append(val)        
                
ans.append(b[0])

if ans.count(110) > 0:
    print(-1)
else:
    for i in ans:
        print(i)




Failing test case input:
9
1 1 1 1 2 1 2 3 2

Expected output:
1
2
2
3
1
2
1
1
1


Actual output:
1
1
1
2
1
3
2
2
1


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline

n=int(input())
b=[int(i) for i in input().split()]

anslist=[]
while len(b) > 0:
    val=110
    for i in range(len(b)-1,-1,-1):
        if i+1==b[i]:
            val=i+1
            break
    anslist.append(val)
    b.pop(i)

if anslist.count(110)>0:
    print(-1)
else:
    for i in (reversed(anslist)):
        print(i)

Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
b = list(map(int, input().split()))
ok = True
for i in range(n):
    if b[i] > i+1:
        ok = False
        break
if ok:
    x = ""
    for i in range(1, n+1):
        if b[-i] == 1:
            if x=="": a = b[-i:]
            else: a = b[-i:x]
            a.sort()
            for v in a: print(v)
            x = -i
else: print(-1)

Failing test case input:
9
1 1 1 1 2 1 4 3 2

Expected output:
1
2
1
3
2
4
1
1
1


Actual output:
1
2
3
4
1
2
1
1
1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))

result =[]
while len(a) > 0:
    ok = False
    for i in range(len(a)-1, -1, -1):
        if i+1 == a[i]:
            result.append(a[i])
            a.pop(i)
            ok = True
            break
    if not ok:
        result = [-1]
        break
for i in result[::-1]: print(i)
Problem: p03089
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))



N = I()
b = LI()

ans = sorted(b)
for i in range(N):
    if ans[i] > i+1:
        print(-1)
        exit()

for a in ans:
    print(a)

Failing test case input:
9
1 1 1 2 1 1 2 3 2

Expected output:
1
2
2
3
1
1
2
1
1


Actual output:
1
1
1
1
1
2
2
2
3


Fixed submission (verdict: Accepted):
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))



N = I()
b = LI()

ans = []
while b:
    n = len(b)
    flag = False
    for i in range(n)[::-1]:
        if b[i] == i+1:
            ans.append(i+1)
            flag = True
            break
    if not flag:
        print(-1)
        exit()
    b.pop(i)

for a in ans[::-1]:
    print(a)

Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
















a = []

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



N = 100




for i in range(num_len):
    
    
    
    
    
    

    if b[i]-1 <= len(a):
        
        a.insert(b[i]-1, b[i])
        print(a)
        flag = True
    else:
        flag = False
        break


if flag:
    for i in a:
        print(i)
else:
    print(-1)




Failing test case input:
3
-1 9 1

Expected output:
-1


Actual output:
[-1]
-1


Fixed submission (verdict: Accepted):
















a = []

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



N = 100




for i in range(num_len):
    
    
    
    
    
    

    if b[i]-1 <= len(a):
        
        a.insert(b[i]-1, b[i])
        
        flag = True
    else:
        flag = False
        break


if flag:
    for i in a:
        print(i)
else:
    print(-1)
Problem: p03089
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
B = list(map(int,input().split()))

ans = []
while N > 0:
  ok = False
  for i in range(N)[::-1]:
    b = B[i]
    if b == (i+1):
      ans.append(b)
      ok = True
      break
  
  if ok:
    N -= 1
  else:
    break
    
if N != 0:
  print(-1)
else:
  print("\n".join(map(str,ans[::-1])))

Failing test case input:
9
1 1 1 2 2 1 2 3 2

Expected output:
1
2
2
3
1
2
2
1
1

Actual output:
1
1
1
1
1
1
1
1
1


Fixed submission (verdict: Accepted):
N = int(input())
B = list(map(int,input().split()))

ans = []
while N > 0:
  ok = False
  for i in range(N)[::-1]:
    b = B[i]
    if b == (i+1):
      ans.append(b)
      ok = True
      k = i
      break
  
  if not ok:
    break
  else:
    newB = []
    for i in range(N):
      if i != k:
        newB.append(B[i])
    
    B = newB
    N -= 1

if N != 0:
  print(-1)
else:
  print("\n".join(map(str,ans[::-1])))

Problem: p03089
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
b = list(map(int, input().split()))
import collections
c = collections.Counter(b)
for i in range(n):
  if b[i] > i+1:
    print(-1)
    break
else:
  ans = []
  while len(b) > 1:
    c = len(ans)
    f = b[0]
    for i in range(1, len(b)):
      if f >= b[i]:
        ans.append(b.pop(i-1))
        break
      elif n - c == b[i]:
        ans.append(b.pop(i))
        break
      else:
        f = b[i]
  ans.append(1)
  for i in range(n)[::-1]:
    print(ans[i])

Failing test case input:
9
1 1 1 1 2 1 4 3 2

Expected output:
1
2
1
3
2
4
1
1
1


Actual output:
1
2
3
4
1
2
1
1
1


Fixed submission (verdict: Accepted):
n = int(input())
b = list(map(int, input().split()))
for i in range(n):
  if b[i] > i+1:
    print(-1)
    break
else:
  ans = []
  while len(b) > 1:

    c = len(ans)
    f = b[0]
    for i in range(1, len(b))[::-1]:
      if b[i] == i + 1:

        ans.append(b.pop(i))
        break
    else:
      for i in range(1, len(b)):

        if f >= b[i]:
          ans.append(b.pop(i-1))
          break
        elif n - c == b[i]:
          ans.append(b.pop(i))
          break
        elif i == len(b) - 1:
          ans.append(b.pop(-1))
          break
        else:
          f = b[i]
  ans.append(1)
  for i in range(n)[::-1]:
    print(ans[i])
Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
ls = list(map(int, input().split()))

used = [False] * n
res = []


def f(left, index):
    for i in reversed(range(index, n)):
        if not used[i] and ls[i] == left + 1:
            used[i] = True
            res.append(ls[i])
            f(left + 1, i)


f(0, 0)
if len(res) == n:
    print(*res, sep='\n')
else:
    print(-1)

Failing test case input:
9
1 1 1 2 2 1 4 1 2

Expected output:
1
2
1
1
2
4
2
1
1


Actual output:
-1


Fixed submission (verdict: Accepted):
import sys

sys.setrecursionlimit(10**7)

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

used = [False] * n
res = []


def f(index):
    for j in range(n):
        for i in reversed(range(index, n)):
            if not used[i] and ls[i] == sum(used[:i]) + 1:
                used[i] = True
                res.append(ls[i])
                f(i)
        if sum(used[index:]) == n - index:
            break


f(0)
if len(res) == n:
    print(*res, sep='\n')
else:
    print(-1)

Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
b = list(map(int, input().split()))

a = []
for i in range(N-1, -1, -1):
	if b[i] == 1:
		a += sorted([b.pop() for j in range(len(b)-i)])

if len(a) != len(b):
	print(-1)
else:
	for ai in a:
		print(ai)

Failing test case input:
9
1 1 1 1 2 1 4 3 2

Expected output:
1
2
1
3
2
4
1
1
1


Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
b = list(map(int, input().split()))

for i in range(N):
	if b[i] > i+1:
		print(-1)
		exit()

a = []
for i in range(N):
	for j in range(len(b)-1, -1, -1):
		if b[j] == j+1:
			a += [b.pop(j)]
			break
a.reverse()
			
if len(b) != 0:
	print(-1)
else:
	for ai in a:
		print(ai)

Problem: p03089
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N=int(input())
B=list(map(int,input().split()))
ans=[]
while len(B)>0:
    tmp = -1
    for i in range(len(B)):
        if i+1 < B[i]:
            print(-1)
            exit()
        elif i+1 == B[i]:
            tmp = i
        else:
            break
    ans.append(B[tmp])
    del B[tmp]
for a in reversed(ans):
    print(a)


Failing test case input:
3
-2 11 4

Expected output:
-1


Actual output:
-2
11
4


Fixed submission (verdict: Accepted):
N=int(input())
B=list(map(int,input().split()))
ans=[]
while B:
    tmp = -1
    for i,b in enumerate(B):
        if i+1 < b:
            print(-1)
            exit()
        elif i+1 == b:
            tmp = i
    ans.append(B[tmp])
    del B[tmp]
for a in reversed(ans):
    print(a)
Problem: p03089
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from sys import exit
N = int(input())
B = list(map(int, input().split()))
ctr = 0
ans = []
for _ in range(N):
    for i, b in enumerate(B, 1):
        if i == b:
            ctr = i
    ans.append(ctr)
    if ctr == 0:
        print(-1)
        exit()
    B = B[:ctr-1] + B[ctr:]
print('\n'.join([str(s) for s in ans][::-1]))

Failing test case input:
3
1 7 0

Expected output:
-1


Actual output:
1
1
1


Fixed submission (verdict: Accepted):
from sys import exit
N = int(input())
B = list(map(int, input().split()))
ctr = 0
ans = []
for _ in range(N):
    ctr = 0
    for i, b in enumerate(B, 1):
        if i == b:
            ctr = i
    ans.append(ctr)
    if ctr == 0:
        print(-1)
        exit()
    B = B[:ctr-1] + B[ctr:]
print('\n'.join([str(s) for s in ans][::-1]))

Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
bs = list(map(int, input().split()))
out = []
i = 0
while len(bs) > 0:
    if bs[i] > i + 1:
        break
    elif bs[i] < i + 1:
        i = bs[i] - 1
    else:
        if i == len(bs) - 1:
            out.append(bs[i])
            del bs[i]
            i -= 1
        elif bs[i+1] < i + 2:
            out.append(bs[i])
            del bs[i]
        else:
            i += 1
if len(bs) == 0:
    for o in reversed(out):
        print(o)
else:
    print(-1)


Failing test case input:
9
1 1 1 2 2 1 4 3 2

Expected output:
1
2
1
3
2
4
2
1
1


Actual output:
-1


Fixed submission (verdict: Accepted):
n = int(input())
bs = list(map(int, input().split()))
out = []
i = 0
while len(bs) > 0:
    change_i = 0
    ok = True
    for i, b in enumerate(bs):
        if b > i + 1:
            ok = False
            break
        elif b == i + 1:
            change_i = i
    if not ok:
        break
    out.append(bs[change_i])
    del bs[change_i]

if ok:
    for o in reversed(out):
        print(o)
else:
    print(-1)

Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = [int(i) for i in input().split()]

a = [0]*n

o = 0
l.sort()
for i in l:
    o+=1
    if(i<=o):
        if(i<=len(a)):
            if(a[i-1]!=0):
                a[a.index(0)] = i
            else:
                a[i-1] = i
if(a == l):
    print("\n".join([str(i) for i in a]))
else:
    print(-1)


Failing test case input:
9
1 1 1 1 2 1 4 1 2

Expected output:
1
2
1
1
2
4
1
1
1


Actual output:
1
1
1
1
1
1
2
2
4


Fixed submission (verdict: Accepted):
n = int(input())

l = input().split()

res = []

for i in range(n):
    
    
    for j in range(len(l)-1,-1,-1):
        if(l[j] == str(j+1)):
            res.append(l[j])
            del(l[j])
            break
    


            

if(l != []):
    print(-1)
else:
    print("\n".join(res[::-1]))
Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin

def main():
    N = int(input())
    B = list(map(int, input().split()))

    ans = []
    for n in range(N, 0, -1):
        for i in range(N-1, -1, -1):
            if not B[i]:
                continue
            if B[i] == n:
                ans.append(n)
                B[i] = 0
                break
            n -= 1
    print(*ans[::-1], sep='\n')

input = lambda: stdin.readline()
main()


Failing test case input:
3
-2 4 4

Expected output:
-1


Actual output:

Fixed submission (verdict: Accepted):
from sys import stdin

def main():
    N = int(input())
    B = list(map(int, input().split()))

    ans = []
    for n in range(N, 0, -1):
        for i in range(N-1, -1, -1):
            if not B[i]:
                continue
            if B[i] == n:
                ans.append(n)
                B[i] = 0
                break
            n -= 1
        else:
            print(-1)
            return
    print(*ans[::-1], sep='\n')

input = lambda: stdin.readline()
main()

Problem: p03089
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import copy

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


root=[]
string = copy.deepcopy(a)
while len(string)!=0:
    temp=[]
    for i,s in enumerate(string):
        if i+1 == s:
            temp.append(i+1)
    if len(temp)==0:
        break
    
    if temp[0]==1 and len(temp)==1:
        string.pop(0)
        root.append(1)
    else:
        if 1 in temp:
            temp.remove(1)
        for i in temp[::-1]:
            root.append(i)
            string.pop(i-1)
        
if len(string)!=0:
    print(-1)
else:
    for i in root:
        print(i)

Failing test case input:
9
1 1 1 2 1 1 2 3 2

Expected output:
1
2
2
3
1
1
2
1
1


Actual output:
1
1
2
1
1
3
2
2
1


Fixed submission (verdict: Accepted):
import copy

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


root=[]
string = copy.deepcopy(a)
while len(string)!=0:
    temp=[]
    for i,s in enumerate(string):
        if i+1 == s:
            temp.append(i+1)
    if len(temp)==0:
        break
    
    if temp[0]==1 and len(temp)==1:
        string.pop(0)
        root.append(1)
    else:
        if 1 in temp:
            temp.remove(1)
        root.append(temp[-1])
        string.pop(temp[-1]-1)
        
if len(string)!=0:
    print(-1)
else:
    for i in root[::-1]:
        print(i)
Problem: p03089
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
b=list(map(int,input().split()))
ans=[]
while True:
    l=len(b)
    temp=[]
    for i in range(l-1,-1,-1):
        if b[i]==i+1: ans.append(i+1)
        else: temp.append(b[i])
    b=temp[:]
    if len(b)==l:
        print(-1)
        exit()
    elif len(b)==0: break
for val in ans[::-1]: print(val)

Failing test case input:
9
1 1 1 1 2 1 2 3 2

Expected output:
1
2
2
3
1
2
1
1
1


Actual output:
-1


Fixed submission (verdict: Accepted):
n=int(input())
b=list(map(int,input().split()))
ans=[]
while True:
    l=len(b)
    temp=[]
    flag=0
    for i in range(l-1,-1,-1):
        if flag==1 or b[i]!=i+1: temp.append(b[i])
        else:
            ans.append(i+1)
            flag=1
    b=temp[::-1]
    if len(b)==l:
        print(-1)
        exit()
    elif len(b)==0: break
for val in ans[::-1]: print(val)

Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
B = [int(b) for b in input().split()]

L = []

while B:
    idx = N+1
    for i in range(len(B)):
        if B[i] == i+1:
            continue
        else:
            idx = i-1
            break
    if idx < 0:
        break
    elif idx == N+1:
        idx = len(B)-1
    L.append(B[idx])
    B.pop(idx)

if B:
    print(-1)
else:
    L.reverse()
    for l in L:
        print(l)

Failing test case input:
9
1 1 1 2 2 1 4 1 2

Expected output:
1
2
1
1
2
4
2
1
1


Actual output:
-1


Fixed submission (verdict: Accepted):
N = int(input())
B = [int(b) for b in input().split()]

L = []

while B:
    temp = []
    for i in range(len(B)):
        if B[i] == i+1:
            temp.append(i+1)
    if temp:
        L.append(max(temp))
        B.remove(max(temp))
    else:
        break

if B:
    print(-1)
else:
    L.reverse()
    for l in L:
        print(l)

Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
B = list(map(int,input().split()))

for i in range(N) :
    if B[i] > i+1 :
        print(-1)
        break
else :
    while len(B) :
        b = min(B)
        for j in range(len(B)-1,-1,-1) :
            if b == B[j] :
                L = sorted(B[j:])
                print(*L,sep="\n")
                B = B[:j]
                break

Failing test case input:
9
1 1 1 1 2 1 4 1 2

Expected output:
1
2
1
1
2
4
1
1
1


Actual output:
1
2
1
4
1
2
1
1
1


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
ans = []
flg = 0
for i in range(N) :
    for j in range(len(A)-1,-1,-1) :
        k = j+1
        if k == A[j] :
            ans.append(k)
            A = A[:j]+A[j+1:]
            break
    else :
        print(-1)
        flg = 1
        break
if not flg :
    print(*ans[::-1],sep="\n")
Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
b = list(map(int, input().split()))

for i in range(N):
	if b[i] > i+1:
		print(-1)
		exit()

a = []
for i in range(N-1, -1, -1):
	if b[i] == 1:
		a += sorted([b.pop() for j in range(len(b)-i)])

if len(a) != N:
	print(-1)
else:
	for ai in a:
		print(ai)

Failing test case input:
9
1 1 1 1 2 1 4 1 2

Expected output:
1
2
1
1
2
4
1
1
1


Actual output:
1
2
1
4
1
2
1
1
1


Fixed submission (verdict: Accepted):
N = int(input())
b = list(map(int, input().split()))

for i in range(N):
	if b[i] > i+1:
		print(-1)
		exit()

a = []
for i in range(N):
	for j in range(len(b)-1, -1, -1):
		if b[j] == j+1:
			a += [b.pop(j)]
			break
a.reverse()
			
if len(b) != 0:
	print(-1)
else:
	for ai in a:
		print(ai)

Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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

for i in range(N):
    tmp = -1
    for j in range(N - i):
        if b[j] == j + 1:
            tmp = j
            continue
        else:
            break
    if tmp != -1:
        a.append(b.pop(tmp))

if len(a) == N:
    for i in range(N - 1, -1, -1):
        print(a[i])
else:
    print(-1)

Failing test case input:
9
1 1 1 1 2 1 4 3 2

Expected output:
1
2
1
3
2
4
1
1
1


Actual output:
-1


Fixed submission (verdict: Accepted):

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

for i in range(N):
    tmp = -1
    for j in range(N - i):
        if b[j] == j + 1:
            tmp = j
            
    if tmp != -1:
        a.append(b.pop(tmp))

if len(a) == N:
    for i in range(N - 1, -1, -1):
        print(a[i])
else:
    print(-1)

Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
b = list(map(int, input().split()))

a = []
while b:
    for i in range(len(b)):
        if i + 1 != b[i]:
            a.append(b[i-1])
            b.remove(b[i-1])
            break
    if b == list(range(1, len(b)+1)):
        for j in reversed(b):
            a.append(j)
            b.remove(j)


a.reverse()
if a[0] != 1:
    print(-1)
else:
    print('\n'.join(map(str, a)))


Failing test case input:
9
1 1 1 1 2 1 4 1 2

Expected output:
1
2
1
1
2
4
1
1
1


Actual output:
-1


Fixed submission (verdict: Accepted):
n = int(input())
b = list(map(int, input().split()))

a = []
for i in range(n):
    p = -1
    for j in range(len(b)-1, -1, -1):
        if b[j] == j + 1:
            p = j + 1
            break
    if p == -1:
        print(-1)
        exit()
    a.append(p)
    b.remove(p)

a.reverse()
print('\n'.join(map(str, a)))
Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
B=list(map(int,input().split(' ')))
ans = []
for i in range(N):
    for n,j in enumerate(B[::-1]):
        if N-i-n==j:
            ans.append(B.pop(N-i-n-1))
            break
for i in ans[::-1]:
    print(i)

Failing test case input:
3
-1 11 2

Expected output:
-1


Actual output:
11


Fixed submission (verdict: Accepted):
N=int(input())
B=list(map(int,input().split(' ')))
ans = []
for i in range(N):
    for n,j in enumerate(B[::-1]):
        if N-i-n==j:
            ans.append(B.pop(N-i-n-1))
            break
if len(ans)==N:
    for i in ans[::-1]:
        print(i)
else:
    print(-1)

Problem: p03089
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
b=[int(i) for i in input().split()]
A=False
a=[]
for _ in range(N):
  ans=0
  for j in range(len(b)):
    if j+1==b[j]:
      ans=max(ans,j+1)
      A=True
    else:
      A=False
      break
  a.append(ans)
  del b[ans-1]
    
a=a[::-1]
if A:
  for i in a:
    print(i)
else:
  print(-1)
  

Failing test case input:
9
1 1 1 2 2 1 4 3 2

Expected output:
1
2
1
3
2
4
2
1
1


Actual output:
-1


Fixed submission (verdict: Accepted):
N=int(input())
b=[int(i) for i in input().split()]
A=True
a=[]
for _ in range(N):
  ans=0
  for j in range(len(b)):
    if j+1==b[j]:
      ans=max(ans,j+1)
  if ans==0:
    A=False
    break
  a.append(ans)
  del b[ans-1]
    
a=a[::-1]
if A:
  for i in a:
    print(i)
else:
  print(-1)

Problem: p03089
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
N=int(input())
L=[int(i)-1 for i in input().split()]
M=[]
while True:
    flag=0
    if len(L)==0:
        for m in M[::-1]:
            print(m+1)
        sys.exit()
    if L[0]!=0:
        print(-1)
        sys.exit()
    for i in range(len(L)):
        if L[i]!=i:
            s = L.pop(i - 1)
            M.append(s)
            flag=1
            break
    if flag==0:
        s=L.pop(len(L)-1)
        M.append(s)



Failing test case input:
9
1 1 1 1 2 1 4 3 2

Expected output:
1
2
1
3
2
4
1
1
1


Actual output:
-1


Fixed submission (verdict: Accepted):
import sys
N=int(input())
L=[int(i)-1 for i in input().split()]
M=[]
while True:
    flag=0
    if len(L)==0:
        for m in M[::-1]:
            print(m+1)
        sys.exit()
    for i in range(len(L)-1,-1,-1):
        if L[i]==i:
            s = L.pop(i)
            M.append(s)
            flag=1
            break
    if flag==0 and len(L)!=0:
        print(-1)
        sys.exit()