ZhenlongDai/ACPR huggingface dataset:
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionSort(A,N):
    for i in range(1,N):
        v=A[i]
        j=i-1
        while j>=0 and A[j]>v:
            A[j+1]=A[j]
            j-=1
            A[j+1]=v
        print(A)
    return A

N=int(input())
A=input().split()
insertionSort(A,N)



Failing test case input:
6
0 3 3 0 1 -2

Expected output:
0 3 3 0 1 -2
0 3 3 0 1 -2
0 3 3 0 1 -2
0 0 3 3 1 -2
0 0 1 3 3 -2
-2 0 0 1 3 3


Actual output:
['0', '3', '3', '0', '1', '-2']
['0', '3', '3', '0', '1', '-2']
['0', '0', '3', '3', '1', '-2']
['0', '0', '1', '3', '3', '-2']
['-2', '0', '0', '1', '3', '3']


Fixed submission (verdict: Accepted):
N=int(input())
A=[0 for i in range(N)]
A=input().split()
for i in range(N):
    A[i]=(int)(A[i])
for i in range(N):
    v=A[i]
    j=i-1
    while j>=0 and A[j]>v:
        A[j+1]=A[j]
        j=j-1
        A[j+1]=v
    for i in range(N):
        if i!=N-1:
            print(A[i],end=" ")
        if i==N-1:
            print(A[i])

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def trace(A,input_num):
    i = 0
    for i in range(input_num):
        if i != input_num - 1:
            print(A[i-1],end = " ")
        else:
            print(A[i])

def insertionSort(A,input_num):
    for i in range(input_num):
        v = A[i]
        j = i - 1
        while(j >= 0 and A[j] > v):
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        trace(A,input_num)
        if i != input_num-1:
            print("\n")
        
        
input_num = int(input())
A = list(map(int, input().split()))

insertionSort(A,input_num)


Failing test case input:
6
0 2 0 0 1 0

Expected output:
0 2 0 0 1 0
0 2 0 0 1 0
0 0 2 0 1 0
0 0 0 2 1 0
0 0 0 1 2 0
0 0 0 0 1 2


Actual output:
0 0 2 0 0 0


0 0 2 0 0 0


0 0 0 2 0 0


0 0 0 0 2 0


0 0 0 0 1 0


2 0 0 0 0 2


Fixed submission (verdict: Accepted):
def trace(A,input_num):
    for i in range(input_num):
        if i != input_num - 1:
            print(A[i],end = " ")
        else:
            print(A[i])

def insertionSort(A,input_num):
    for i in range(input_num):
        v = A[i]
        j = i - 1
        while(j >= 0 and A[j] > v):
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        trace(A,input_num)
        
input_num = int(input())
A = list(map(int, input().split()))

insertionSort(A,input_num)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionSort(A, N):
    for i in range(N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        print(A)

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

insertionSort(a,n)

Failing test case input:
6
0 2 1 0 0 -1

Expected output:
0 2 1 0 0 -1
0 2 1 0 0 -1
0 1 2 0 0 -1
0 0 1 2 0 -1
0 0 0 1 2 -1
-1 0 0 0 1 2


Actual output:
[0, 2, 1, 0, 0, -1]
[0, 2, 1, 0, 0, -1]
[0, 1, 2, 0, 0, -1]
[0, 0, 1, 2, 0, -1]
[0, 0, 0, 1, 2, -1]
[-1, 0, 0, 0, 1, 2]


Fixed submission (verdict: Accepted):
def insertionSort(A, N):
    for i in range(N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        t = str(A[0])
        for i in range(1,N):
            t = t + " " + str(A[i])
        print(t)


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

insertionSort(a,n)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
input()
xs = list(map(int, input().split()))

def insertion_sort(xs):
  for i in range(1, len(xs)):
    v = xs[i]
    j = i - 1
    while j >= 0 and xs[j] > v:
      xs[j + 1] = xs[j]
      j -= 1
    xs[j + 1] = v
    print(*xs)

insertion_sort(xs)

Failing test case input:
6
5 2 5 8 1 3

Expected output:
5 2 5 8 1 3
2 5 5 8 1 3
2 5 5 8 1 3
2 5 5 8 1 3
1 2 5 5 8 3
1 2 3 5 5 8


Actual output:
2 5 5 8 1 3
2 5 5 8 1 3
2 5 5 8 1 3
1 2 5 5 8 3
1 2 3 5 5 8


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

def insertion_sort(xs):
  for i in range(1, len(xs)):
    v = xs[i]
    j = i - 1
    while j >= 0 and xs[j] > v:
      xs[j + 1] = xs[j]
      j -= 1
    xs[j + 1] = v
    print(*xs)

print(*xs)
insertion_sort(xs)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):

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


for i in range(1,len(A)):
    v = A[i]
    j = i - 1
    while j >=0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print(*A)

Failing test case input:
6
0 2 6 0 0 -2

Expected output:
0 2 6 0 0 -2
0 2 6 0 0 -2
0 2 6 0 0 -2
0 0 2 6 0 -2
0 0 0 2 6 -2
-2 0 0 0 2 6


Actual output:
0 2 6 0 0 -2
0 2 6 0 0 -2
0 0 2 6 0 -2
0 0 0 2 6 -2
-2 0 0 0 2 6


Fixed submission (verdict: Accepted):

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



def insertion_sort(A, N):

    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        print(*A)

print(*A)
insertion_sort(A, N)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertion_sort(array, element_number):
    for i in range(1, element_number):
        v = array[i]
        j = i - 1

        while(j>=0 and array[j] > v):
            array[j+1] = array[j]
            j = j - 1

        array[j+1] = v

        for k in range(0, element_number):
            if k < element_number:
                print(array[k] + ' ', end='')
            else:
                print(array[k], end='')

        if i < element_number-1:
            print('\n', end='')

def test():
    element_number = int(input())
    input_array = input().split()

    insertion_sort(input_array, element_number)

if __name__ == '__main__':
    test()

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

Expected output:
5 4 5 2 1 0
4 5 5 2 1 0
4 5 5 2 1 0
2 4 5 5 1 0
1 2 4 5 5 0
0 1 2 4 5 5


Actual output:
4 5 5 2 1 0 
4 5 5 2 1 0 
2 4 5 5 1 0 
1 2 4 5 5 0 
0 1 2 4 5 5 

Fixed submission (verdict: Accepted):
def insertion_sort(array, element_number):
    for i in range(element_number):
        v = array[i]
        j = i - 1

        while(j>=0 and array[j] > v):
            array[j+1] = array[j]
            j = j - 1

        array[j+1] = v

        for k in range(element_number):
            if k < element_number-1:
                print(str(array[k]) + ' ', end='')
            else:
                print(str(array[k]), end='')

        print('\n', end='')

def test():
    element_number = int(input())
    input_array = list(map(int, input().split()))

    insertion_sort(input_array, element_number)

if __name__ == '__main__':
    test()

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):

N = int(input())
A = [int(a) for a in input().split()]

for i in range(1, N):
    v = A[i]
    j = i - 1
    while(j >=0 and A[j] > v):
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print((" ").join((str(a) for a in A)))

Failing test case input:
6
0 1 2 -2 7 -2

Expected output:
0 1 2 -2 7 -2
0 1 2 -2 7 -2
0 1 2 -2 7 -2
-2 0 1 2 7 -2
-2 0 1 2 7 -2
-2 -2 0 1 2 7


Actual output:
0 1 2 -2 7 -2
0 1 2 -2 7 -2
-2 0 1 2 7 -2
-2 0 1 2 7 -2
-2 -2 0 1 2 7


Fixed submission (verdict: Accepted):

N = int(input())
A = [int(a) for a in input().split()]

print((" ").join((str(a) for a in A)))
for i in range(1, N):
    v = A[i]
    j = i - 1
    while(j >=0 and A[j] > v):
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print((" ").join((str(a) for a in A)))
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionSort(A, N):
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v

        print(' '.join(map(str, A)))

if __name__ == "__main__":
    n = int(input())
    a = [int(e) for e in input().split()]
    insertionSort(a, n)

Failing test case input:
3
-1 3 -14

Expected output:
-1 3 -14
-1 3 -14
-14 -1 3


Actual output:
-1 3 -14
-14 -1 3


Fixed submission (verdict: Accepted):
def insertionSort(A, N):
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v

        print(' '.join(map(str, A)))

if __name__ == "__main__":
    n = int(input())
    a = [int(e) for e in input().split()]
    print(' '.join(map(str, a)))
    insertionSort(a, n)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())

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

for i in range(1,n):
    v = a[i]
    j = i-1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j = j-1
        a[j+1] = v
    for k in range(n):
        if k == n-1:
            print(a[k],end='')
        else:
            print(a[k],end=' ')
    print()

Failing test case input:
3
0 3 -8

Expected output:
0 3 -8
0 3 -8
-8 0 3


Actual output:
0 3 -8
-8 0 3


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

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

for i in range(n):
    v = a[i]
    j = i-1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j = j-1
        a[j+1] = v
    for k in range(n):
        if k == n-1:
            print(a[k],end='')
        else:
            print(a[k],end=' ')
    print()

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
a = [int(i) for i in input().split()]

for i in range(1, n):
    j = i
    while a[j - 1] > a[j] and j > 0:
        a[j], a[j - 1] = a[j - 1], a[j]
        j -= 1
    print(" ".join([str(i) for i in a]))



Failing test case input:
6
5 4 5 1 1 0

Expected output:
5 4 5 1 1 0
4 5 5 1 1 0
4 5 5 1 1 0
1 4 5 5 1 0
1 1 4 5 5 0
0 1 1 4 5 5


Actual output:
4 5 5 1 1 0
4 5 5 1 1 0
1 4 5 5 1 0
1 1 4 5 5 0
0 1 1 4 5 5


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(i) for i in input().split()]
print(" ".join([str(i) for i in a]))

for i in range(1, n):
    j = i
    while a[j - 1] > a[j] and j > 0:
        a[j], a[j - 1] = a[j - 1], a[j]
        j -= 1
    print(" ".join([str(i) for i in a]))
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
ary = [int(x) for x in input().split(' ')]

print(ary)
for i in range(1, n):
    v = ary[i]
    j = i - 1
    while j >= 0 and ary[j] > v:
        ary[j + 1] = ary[j]
        j -= 1
    ary[j + 1] = v
    print(ary)

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

Expected output:
5 4 5 2 1 0
4 5 5 2 1 0
4 5 5 2 1 0
2 4 5 5 1 0
1 2 4 5 5 0
0 1 2 4 5 5


Actual output:
[5, 4, 5, 2, 1, 0]
[4, 5, 5, 2, 1, 0]
[4, 5, 5, 2, 1, 0]
[2, 4, 5, 5, 1, 0]
[1, 2, 4, 5, 5, 0]
[0, 1, 2, 4, 5, 5]


Fixed submission (verdict: Accepted):
n = int(input())
a = input()
print(a)
a = [int(x) for x in a.split(' ')]

for i in range(1, n):
    v = a[i]
    j = i - 1
    while j >= 0 and a[j] > v:
        a[j + 1] = a[j]
        j -= 1
    a[j + 1] = v
    print(' '.join([str(x) for x in a]))

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionSort(A,N):
    for i in range(1, N):
        v = A[i]
        j = i - 1
        print(' '.join([str(a) for a in A]))
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(' '.join([str(a) for a in A]))

def run():
    N = int(input())
    A = [int(i) for i in input().split()]
    insertionSort(A,N)

if __name__ == '__main__':
    run()


Failing test case input:
6
1 2 2 2 2 -2

Expected output:
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
-2 1 2 2 2 2


Actual output:
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
-2 1 2 2 2 2


Fixed submission (verdict: Accepted):
def insertionSort(A,N):
    print(' '.join([str(a) for a in A]))
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(' '.join([str(a) for a in A]))

def run():
    N = int(input())
    A = [int(i) for i in input().split()]
    insertionSort(A,N)

if __name__ == '__main__':
    run()

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insersionSort(A, N):
  print(" ".join(map(str,A)))
  for i in range(1,N-1):
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
      A[j+1] = A[j]
      j -= 1
    A[j+1] =v
    print(" ".join(map(str,A)))

n = int(input())
a = [int(i) for i in input().split()]
insersionSort(a, n)

Failing test case input:
3
-1 3 -8

Expected output:
-1 3 -8
-1 3 -8
-8 -1 3


Actual output:
-1 3 -8
-1 3 -8


Fixed submission (verdict: Accepted):
def insertionSort(A, N):
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
 
        print(' '.join(map(str, A)))
 
if __name__ == "__main__":
    n = int(input())
    a = [int(e) for e in input().split()]
    print(' '.join(map(str, a)))
    insertionSort(a, n)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
import sys
def print_list(A):
    for k in range(len(A)):
        sys.stdout.write(str(A[k]))
        if not k == len(A) -1: sys.stdout.write(" ")
    print()
def insert_sort(A,N):
    for i in range(1,N):
        v = A[i]
        j = i-1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j = j-1
        A[j+1]=v
        print_list(A)
    

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

Failing test case input:
6
2 0 2 -1 7 -2

Expected output:
2 0 2 -1 7 -2
0 2 2 -1 7 -2
0 2 2 -1 7 -2
-1 0 2 2 7 -2
-1 0 2 2 7 -2
-2 -1 0 2 2 7


Actual output:
0 2 2 -1 7 -2
0 2 2 -1 7 -2
-1 0 2 2 7 -2
-1 0 2 2 7 -2
-2 -1 0 2 2 7


Fixed submission (verdict: Accepted):
import sys
def print_list(A):
    for k in range(len(A)):
        sys.stdout.write(str(A[k]))
        if not k == len(A) -1: sys.stdout.write(" ")
    print()
def insert_sort(A,N):
    print_list(A)
    for i in range(1,N):
        v = A[i]
        j = i-1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j = j-1
        A[j+1]=v
        print_list(A)


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

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
for i in range(1, len(a)):

    v = a[i]
    j = i - 1
    while j >= 0 and a[j] > v:
        a[j + 1] = a[j]
        j -= 1
    a[j + 1] = v
    print(*a)

Failing test case input:
3
0 4 -15

Expected output:
0 4 -15
0 4 -15
-15 0 4


Actual output:
0 4 -15
-15 0 4


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
for i in range(1, len(a)):
    print(*a)
    v = a[i]
    j = i - 1
    while j >= 0 and a[j] > v:
        a[j + 1] = a[j]
        j -= 1
    a[j + 1] = v
print(*a)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionSort(A,N):
    for i in range(1,N):
        v=A[i]
        j=i-1
        while j>=0 and A[j]>v:
            A[j+1]=A[j]
            j-=1
        A[j+1]=v

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

insertionSort(A,n)
for i in range(n):
    print(A[i],end=" ")



Failing test case input:
6
5 2 5 6 1 3

Expected output:
5 2 5 6 1 3
2 5 5 6 1 3
2 5 5 6 1 3
2 5 5 6 1 3
1 2 5 5 6 3
1 2 3 5 5 6


Actual output:
1 2 3 5 5 6 

Fixed submission (verdict: Accepted):
def pr(A,n):
    for i in range(n):
        if i!=n-1:
            print(A[i],end=" ")
        else:
            print(A[i])

def insertionSort(A,N):
    for i in range(1,N):
        v=A[i]
        j=i-1
        while j>=0 and A[j]>v:
            A[j+1]=A[j]
            j-=1
        A[j+1]=v
        pr(A,n)

n=int(input())
A=input().split()
A=[int(i)for i in A]
pr(A,n)
insertionSort(A,n)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split(" ")))
print(A)
for i in range(1, N):
    v = A[i]
    j = i-1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print(A)


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

Expected output:
9 4 2 2 1 -1
4 9 2 2 1 -1
2 4 9 2 1 -1
2 2 4 9 1 -1
1 2 2 4 9 -1
-1 1 2 2 4 9


Actual output:
[9, 4, 2, 2, 1, -1]
[4, 9, 2, 2, 1, -1]
[2, 4, 9, 2, 1, -1]
[2, 2, 4, 9, 1, -1]
[1, 2, 2, 4, 9, -1]
[-1, 1, 2, 2, 4, 9]


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split(" ")))
for k in range(len(A)-1):
    print(A[k], end= " ")
print(A[-1])
for i in range(1, N):
    v = A[i]
    j = i-1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    
    for k in range(len(A)-1):
        print(A[k], end= " ")
    print(A[-1])

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):

def insertionsort(n,A):
	for i in range(n):
		t=A[i]
		j=i-1
		while j>=0 and A[j] > t:
			A[j+1]=A[j]
			j-=1
			A[j+1]=t
			
			
	
	for k in range(n):
		if k<n-1:
			print(A[k],end=" ")
		else:
			print(A[k])
			
n=int(input())
A=list(map(int, input().split()))

insertionsort(n,A)



Failing test case input:
6
0 2 1 0 0 -1

Expected output:
0 2 1 0 0 -1
0 2 1 0 0 -1
0 1 2 0 0 -1
0 0 1 2 0 -1
0 0 0 1 2 -1
-1 0 0 0 1 2


Actual output:
-1 0 0 0 1 2


Fixed submission (verdict: Accepted):

def insertionsort(n,A):
	for i in range(n):
		t=A[i]
		j=i-1
		while j>=0 and A[j] > t:
			A[j+1]=A[j]
			j-=1
			A[j+1]=t
			
			
	
		for k in range(n):
			if k<n-1:
				print(A[k],end=" ")
			else:
				print(A[k])
			
n=int(input())
A=list(map(int, input().split()))

insertionsort(n,A)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
N = int(input())
a = list(map(int, input().split()))
print(*a)
for i in range(1, N):
  v = a[i]
  j = i - 1
  while j >= 0 and a[j] > v:
    a[j + 1] = a[j]
    j -= 1
    a[j + 1] = v
    print(*a)

Failing test case input:
6
0 1 2 -1 7 -2

Expected output:
0 1 2 -1 7 -2
0 1 2 -1 7 -2
0 1 2 -1 7 -2
-1 0 1 2 7 -2
-1 0 1 2 7 -2
-2 -1 0 1 2 7


Actual output:
0 1 2 -1 7 -2
0 1 -1 2 7 -2
0 -1 1 2 7 -2
-1 0 1 2 7 -2
-1 0 1 2 -2 7
-1 0 1 -2 2 7
-1 0 -2 1 2 7
-1 -2 0 1 2 7
-2 -1 0 1 2 7


Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int, input().split()))
print(*a)
for i in range(1, N):
  v = a[i]
  j = i - 1
  while j >= 0 and a[j] > v:
    a[j + 1] = a[j]
    j -= 1
  a[j + 1] = v
  print(*a)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
for  i in range(n):
    v  = a[i]
    j = i-1
    while a[j]>v and j>=0:
        a[j+1] = a[j]
        j -=1
    a[j] = v
    print(*a)


Failing test case input:
6
5 4 5 2 1 -1

Expected output:
5 4 5 2 1 -1
4 5 5 2 1 -1
4 5 5 2 1 -1
2 4 5 5 1 -1
1 2 4 5 5 -1
-1 1 2 4 5 5


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


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
for  i in range(n):
    v  = a[i]
    j = i-1
    while a[j]>v and j>=0:
        a[j+1] = a[j]
        j -=1

    a[j+1] = v
    print(*a)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
z=list(map(int,input().split()))
for i in range(1,n):
    v=z[i]
    j=i-1
    while j>=0 and z[j]>v:
        z[j+1]=z[j]
        j-=1
        
    z[j+1]=v
    print(' '.join(str(z)))

Failing test case input:
6
16 4 2 2 1 -1

Expected output:
16 4 2 2 1 -1
4 16 2 2 1 -1
2 4 16 2 1 -1
2 2 4 16 1 -1
1 2 2 4 16 -1
-1 1 2 2 4 16


Actual output:
[ 4 ,   1 6 ,   2 ,   2 ,   1 ,   - 1 ]
[ 2 ,   4 ,   1 6 ,   2 ,   1 ,   - 1 ]
[ 2 ,   2 ,   4 ,   1 6 ,   1 ,   - 1 ]
[ 1 ,   2 ,   2 ,   4 ,   1 6 ,   - 1 ]
[ - 1 ,   1 ,   2 ,   2 ,   4 ,   1 6 ]


Fixed submission (verdict: Accepted):
n=int(input())
z=list(map(int,input().split()))
print(' '.join(list(map(str,z))))
for i in range(1,n):
    v=z[i]
    j=i-1
    while j>=0 and z[j]>v:
        z[j+1]=z[j]

        j-=1
        z[j+1]=v
    print(' '.join(list(map(str, z))))
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):



def insertion_sort(target_list, n_list):
    
    for focus_index in range(1, n_list):
        print(*target_list)
        target = target_list[focus_index]
        if target < target_list[focus_index - 1]:
            compare_index = focus_index

            while compare_index > 0 and target_list[compare_index - 1] > target:
                target_list[compare_index] = target_list[compare_index - 1]
                compare_index -= 1;

            target_list[compare_index] = target
        
    return target_list

def main():
    n_list = int(input())
    target_list = [int(a) for a in input().split()]
    insertion_sort(target_list, n_list)
if __name__ == "__main__":
    main()

Failing test case input:
6
0 0 2 -1 7 -2

Expected output:
0 0 2 -1 7 -2
0 0 2 -1 7 -2
0 0 2 -1 7 -2
-1 0 0 2 7 -2
-1 0 0 2 7 -2
-2 -1 0 0 2 7


Actual output:
0 0 2 -1 7 -2
0 0 2 -1 7 -2
0 0 2 -1 7 -2
-1 0 0 2 7 -2
-1 0 0 2 7 -2


Fixed submission (verdict: Accepted):



def insertion_sort(target_list, n_list):
    
    for focus_index in range(1, n_list):
        print(*target_list)
        target = target_list[focus_index]
        if target < target_list[focus_index - 1]:
            compare_index = focus_index

            while compare_index > 0 and target_list[compare_index - 1] > target:
                target_list[compare_index] = target_list[compare_index - 1]
                compare_index -= 1;

            target_list[compare_index] = target
    
    return target_list

def main():
    n_list = int(input())
    target_list = [int(a) for a in input().split()]
    print(*insertion_sort(target_list, n_list))
if __name__ == "__main__":
    main()

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split(' ')))
for i in range(n):
    v=a[i]
    j=i-1
    while j>=0 and a[j]>v:
        a[j+1]=a[j]
        j=j-1
    a[j+1]=v
print(" ".join(map(str,a)))

Failing test case input:
3
0 2 -15

Expected output:
0 2 -15
0 2 -15
-15 0 2


Actual output:
-15 0 2


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split(' ')))
for i in range(n):
    v=a[i]
    j=i-1
    while j>=0 and a[j]>v:
        a[j+1]=a[j]
        j=j-1
    a[j+1]=v
    print(" ".join(map(str,a)))

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
for i in range(1,n):
    v=a[i]
    j=i-1
    while j>=0 and a[j]>v:
        a[j+1]=a[j]
        j-=1
    a[j+1]=v
    print(' '.join(map(str,a)))


Failing test case input:
3
0 2 -5

Expected output:
0 2 -5
0 2 -5
-5 0 2


Actual output:
0 2 -5
-5 0 2


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
print(' '.join(map(str,a)))
for i in range(1,n):
    v=a[i]
    j=i-1
    while j>=0 and a[j]>v:
        a[j+1]=a[j]
        j-=1
    a[j+1]=v
    print(' '.join(map(str,a)))
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
import sys


def print_arr(arr):
    for v in arr:
        print(v, end=' ')
    print('')

def insertion_sort(arr):
    for i in range(1, len(arr)):
        print_arr(arr)
        v = arr[i]
        j = i-1
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
        arr[j+1] = v

input0 = sys.stdin.readline()
input_sample = sys.stdin.readline()

input = input_sample.split(" ")
input = [int(i) for i in input]
insertion_sort(input)

Failing test case input:
6
9 4 2 2 2 -2

Expected output:
9 4 2 2 2 -2
4 9 2 2 2 -2
2 4 9 2 2 -2
2 2 4 9 2 -2
2 2 2 4 9 -2
-2 2 2 2 4 9


Actual output:
9 4 2 2 2 -2 
4 9 2 2 2 -2 
2 4 9 2 2 -2 
2 2 4 9 2 -2 
2 2 2 4 9 -2 


Fixed submission (verdict: Accepted):
import sys


def print_arr(arr):
    ln = ''
    for v in arr:
        ln += str(v) + ' '

    ln = ln.strip()
    print(ln)

def insertion_sort(arr):
    for i in range(1, len(arr)):
        print_arr(arr)
        v = arr[i]
        j = i-1
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
        arr[j+1] = v

    print_arr(arr)

input0 = sys.stdin.readline()
input_sample = sys.stdin.readline()

input = input_sample.split(" ")
input = [int(i) for i in input]
insertion_sort(input)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
N = int(input())
a = list(map(int,input().split()))

for i in range(1,N):
    print(' '.join(map(str,a)))
    v = a[i]
    j = i - 1
    while j >= 0 and a[j] > v:
        a[j + 1] = a[j]
        j-=1
        a[j + 1] = v

print()





Failing test case input:
3
0 3 -14

Expected output:
0 3 -14
0 3 -14
-14 0 3


Actual output:
0 3 -14
0 3 -14



Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int,input().split()))
print(' '.join(map(str,a)))
for i in range(1,N):
    v = a[i]
    j = i - 1
    while j >= 0 and a[j] > v:
        a[j + 1] = a[j]
        j-=1
        a[j + 1] = v
    print(' '.join(map(str,a)))
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def print_list(ele_list):
    print(" ".join(map(str, ele_list)))

def insertion_sort(ele_list):
    len_ele_list = len(ele_list)
    for i in range(1, len_ele_list):
        key = ele_list[i]
        j = i - 1
        while j >= 0 and ele_list[j] > key:
            ele_list[j+1] = ele_list[j]
            j -= 1
        ele_list[j+1] = key
        print_list(ele_list)

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

insertion_sort(ele_list)

Failing test case input:
6
5 4 5 0 1 0

Expected output:
5 4 5 0 1 0
4 5 5 0 1 0
4 5 5 0 1 0
0 4 5 5 1 0
0 1 4 5 5 0
0 0 1 4 5 5


Actual output:
4 5 5 0 1 0
4 5 5 0 1 0
0 4 5 5 1 0
0 1 4 5 5 0
0 0 1 4 5 5


Fixed submission (verdict: Accepted):
def print_list(ele_list):
    print(" ".join(map(str, ele_list)))

def insertion_sort(ele_list):
    len_ele_list = len(ele_list)
    print_list(ele_list)
    for i in range(1, len_ele_list):
        key = ele_list[i]
        j = i - 1
        while j >= 0 and ele_list[j] > key:
            ele_list[j+1] = ele_list[j]
            j -= 1
        ele_list[j+1] = key
        print_list(ele_list)

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

insertion_sort(ele_list)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
A = [5, 2, 4, 6, 1, 3]
 
print(' '.join([str(item) for item in A]))

for i in range(1, len(A)):
    key = A[i]
    j = i - 1
    while j >= 0 and A[j] > key:
        A[j+1] = A[j]
        j = j - 1
    A[j+1] = key
    print(' '.join([str(item) for item in A]))

Failing test case input:
6
2 0 2 -1 7 -2

Expected output:
2 0 2 -1 7 -2
0 2 2 -1 7 -2
0 2 2 -1 7 -2
-1 0 2 2 7 -2
-1 0 2 2 7 -2
-2 -1 0 2 2 7


Actual output:
5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6


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

print(' '.join([str(item) for item in A]))
for i in range(1, N):
    key = A[i]
    j = i - 1
    while j >= 0 and A[j] > key:
        A[j+1] = A[j]
        j = j - 1
    A[j+1] = key
    print(' '.join([str(item) for item in A]))

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionSort(A,N):
    for i in range(1,len(A)):
        v = A[i]
        j=i-1
        while(j>=0 and A[j] > v):
            A[j+1] = A[j]
            j-=1
        A[j+1]=v
        print(*A)

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

if __name__ == '__main__':
    main()

Failing test case input:
6
1 2 2 2 2 -2

Expected output:
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
-2 1 2 2 2 2


Actual output:
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
-2 1 2 2 2 2


Fixed submission (verdict: Accepted):
def insertionSort(A,N):
    for i in range(1,N):
        v = A[i]
        j=i-1
        while(j>=0 and A[j] > v):
            A[j+1] = A[j]
            j-=1
        A[j+1]=v
        print(*A)

if __name__ == '__main__':
    N = int(input())
    A = [int(i) for i in input().split()]
    print(*A)
    insertionSort(A,N)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionSort(At, Nt):
	for i in range(Nt):
		v = At[i]
		j = i - 1
		while j >= 0 and At[j] > v:
			A[j + 1] = A[j]
			j = j - 1
		A[j + 1] = v
		print(At)
	return At

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

Failing test case input:
6
0 1 2 0 7 -2

Expected output:
0 1 2 0 7 -2
0 1 2 0 7 -2
0 1 2 0 7 -2
0 0 1 2 7 -2
0 0 1 2 7 -2
-2 0 0 1 2 7


Actual output:
[0, 1, 2, 0, 7, -2]
[0, 1, 2, 0, 7, -2]
[0, 1, 2, 0, 7, -2]
[0, 0, 1, 2, 7, -2]
[0, 0, 1, 2, 7, -2]
[-2, 0, 0, 1, 2, 7]


Fixed submission (verdict: Accepted):
def insertionSort(At, Nt):
	for i in range(Nt):
		v = At[i]
		j = i - 1
		while j >= 0 and At[j] > v:
			A[j + 1] = A[j]
			j = j - 1
		A[j + 1] = v
		print(" ".join(map(str,At)))
	return At

if __name__ == '__main__':
	N = int(input())
	A = list(map(int, input().split()))
	A = insertionSort(A, N)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):

def insertionsort(n,A):
	for i in range(n):
		t=A[i]
		j=i-1
		while j>=0 and A[j] > t:
			A[j+1]=A[j]
			j-=1
			A[j+1]=t
			for k in range(n):
				print(A[k],end=" ")


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


insertionsort(n,A)




Failing test case input:
3
0 1 -9

Expected output:
0 1 -9
0 1 -9
-9 0 1


Actual output:
0 -9 1 -9 0 1 

Fixed submission (verdict: Accepted):

def insertionsort(n,A):
	for i in range(n):
		t=A[i]
		j=i-1
		while j>=0 and A[j] > t:
			A[j+1]=A[j]
			j-=1
			A[j+1]=t
			
			
	
		for k in range(n):
			if k<n-1:
				print(A[k],end=" ")
			else:
				print(A[k])
			
n=int(input())
A=list(map(int, input().split()))

insertionsort(n,A)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def inserrtionsort(l,n):
  for i in range(1,n):
    print(" ".join(l))
    v=l[i]
    j=i-1
    while v<l[j] and j>=0:
      l[j+1]=l[j]
      j-=1
    l[j+1]=v
  print(" ".join(l))
m=int(input())
n=list(input())
inserrtionsort(n,m)


Failing test case input:
6
5 4 5 2 0 -1

Expected output:
5 4 5 2 0 -1
4 5 5 2 0 -1
4 5 5 2 0 -1
2 4 5 5 0 -1
0 2 4 5 5 -1
-1 0 2 4 5 5


Actual output:
5   4   5   2   0   - 1
  5 4   5   2   0   - 1
  4 5   5   2   0   - 1
    4 5 5   2   0   - 1
    4 5 5   2   0   - 1
      4 5 5 2   0   - 1


Fixed submission (verdict: Accepted):
def inserrtionsort(l,n):
  for i in range(1,n):
    print(" ".join(l))
    v=l[i]
    j=i-1
    while int(v)<int(l[j]) and j>=0:
      l[j+1]=l[j]
      j-=1
    l[j+1]=v
  print(" ".join(l))
m=int(input())
n=list(input().split())
inserrtionsort(n,m)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):


N = int(input())
A = [int(N) for N in input().split()]

for i in range(1, N):
    v = A[i]
    j = i - 1
    while(j >=0 and A[j] > v):
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print(A)

Failing test case input:
6
0 2 1 0 0 -1

Expected output:
0 2 1 0 0 -1
0 2 1 0 0 -1
0 1 2 0 0 -1
0 0 1 2 0 -1
0 0 0 1 2 -1
-1 0 0 0 1 2


Actual output:
[0, 2, 1, 0, 0, -1]
[0, 1, 2, 0, 0, -1]
[0, 0, 1, 2, 0, -1]
[0, 0, 0, 1, 2, -1]
[-1, 0, 0, 0, 1, 2]


Fixed submission (verdict: Accepted):

N = int(input())
A = [int(a) for a in input().split()]

print((" ").join((str(a) for a in A)))
for i in range(1, N):
    v = A[i]
    j = i - 1
    while(j >=0 and A[j] > v):
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print((" ").join((str(a) for a in A)))

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
A = input().split()[1:]
 
print(' '.join(map(str, A)))
for i in range(1, len(A)):
    key = A[i]
    j = i - 1
    while j >= 0 and A[j] > key:
        A[j+1] = A[j]
        j = j - 1
    A[j+1] = key
    print(' '.join(map(str, A)))

Failing test case input:
6
0 2 4 0 0 -2

Expected output:
0 2 4 0 0 -2
0 2 4 0 0 -2
0 2 4 0 0 -2
0 0 2 4 0 -2
0 0 0 2 4 -2
-2 0 0 0 2 4


Actual output:

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

print(' '.join([str(item) for item in A]))
for i in range(1, N):
    key = A[i]
    j = i - 1
    while j >= 0 and A[j] > key:
        A[j+1] = A[j]
        j = j - 1
    A[j+1] = key
    print(' '.join([str(item) for item in A]))

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):

num = int(input())


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

def print_array():
    for i in range(num):
        print(array[i], end=' ')


for i in range(num):
    insert = array[i]
    j = 0
    while array[j] < insert:
        j+=1
    for k in range(i, j, -1):
        array[k] = array[k - 1]
    array[j] = insert
    print_array()



Failing test case input:
6
5 2 5 8 1 3

Expected output:
5 2 5 8 1 3
2 5 5 8 1 3
2 5 5 8 1 3
2 5 5 8 1 3
1 2 5 5 8 3
1 2 3 5 5 8


Actual output:
5 2 5 8 1 3 2 5 5 8 1 3 2 5 5 8 1 3 2 5 5 8 1 3 1 2 5 5 8 3 1 2 3 5 5 8 

Fixed submission (verdict: Accepted):

num = int(input())


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

def print_array():
    for i in range(num):
        if i != num-1:
            print(array[i], end=' ')
        else:
            print(array[i])



for i in range(num):
    insert = array[i]
    j = 0
    while array[j] < insert:
        j+=1
    for k in range(i, j, -1):
        array[k] = array[k - 1]
    array[j] = insert
    print_array()
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n = input()
A = list(map(int, input().split()))

for i in range(1, len(A)):
    key = A[i]
    j = i - 1
    while j >= 0 and A[j] > key:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = key
    print(*A)

Failing test case input:
3
-1 3 -8

Expected output:
-1 3 -8
-1 3 -8
-8 -1 3


Actual output:
-1 3 -8
-8 -1 3


Fixed submission (verdict: Accepted):
n = input()
A = list(map(int, input().split()))
print(*A)
for i in range(1, len(A)):
    key = A[i]
    j = i - 1
    while j >= 0 and A[j] > key:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = key
    print(*A)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
N = int(input())
a = list(map(int,input().split()))

for i in range(1,N):
    v = a[i]
    j = i - 1
    while j >= 0 and a[j] > v:
        a[j + 1] = a[j]
        j-=1
        a[j + 1] = v
    print(' '.join(map(str,a)))
print()



Failing test case input:
6
1 2 2 2 2 -2

Expected output:
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
-2 1 2 2 2 2


Actual output:
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
1 2 2 2 2 -2
-2 1 2 2 2 2



Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int,input().split()))
print(' '.join(map(str,a)))
for i in range(1,N):
    v = a[i]
    j = i - 1
    while j >= 0 and a[j] > v:
        a[j + 1] = a[j]
        j-=1
        a[j + 1] = v
    print(' '.join(map(str,a)))

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionSort(A,N):
    for i in range(1,len(A)):
        v = A[i]
        j=i-1
        while(j>=0 and A[j] > v):
            A[j+1] = A[j]
            j-=1
        A[j+1]=v
        print(*A)

def main():
    print("??°????????\???")
    A = list(map(int,input().split()))
    N = len(A)
    insertionSort(A,N)

if __name__ == '__main__':
    main()

Failing test case input:
3
6 2 8

Expected output:
6 2 8
2 6 8
2 6 8


Actual output:
??°????????\???


Fixed submission (verdict: Accepted):
def insertionSort(A,N):
    for i in range(1,N):
        v = A[i]
        j=i-1
        while(j>=0 and A[j] > v):
            A[j+1] = A[j]
            j-=1
        A[j+1]=v
        print(*A)

if __name__ == '__main__':
    N = int(input())
    A = [int(i) for i in input().split()]
    print(*A)
    insertionSort(A,N)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionSort(A,N):
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(' '.join([str(a) for a in A]))

def run():
    N = int(input())
    A = [int(i) for i in input().split()]
    insertionSort(A,N)

if __name__ == '__main__':
    run()


Failing test case input:
6
0 2 0 0 0 -1

Expected output:
0 2 0 0 0 -1
0 2 0 0 0 -1
0 0 2 0 0 -1
0 0 0 2 0 -1
0 0 0 0 2 -1
-1 0 0 0 0 2


Actual output:
0 2 0 0 0 -1
0 0 2 0 0 -1
0 0 0 2 0 -1
0 0 0 0 2 -1
-1 0 0 0 0 2


Fixed submission (verdict: Accepted):
def insertionSort(A,N):
    print(' '.join([str(a) for a in A]))
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(' '.join([str(a) for a in A]))

def run():
    N = int(input())
    A = [int(i) for i in input().split()]
    insertionSort(A,N)

if __name__ == '__main__':
    run()

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
A = [int(item) for item in input().split()[1:]]

print(" ".join([str(item) for item in A]))
for i in range(1, len(A)):
    key = A[i]
    j = i - 1
    while j >= 0 and A[j] > key:
        A[j+1] = A[j]
        j = j - 1
    A[j+1] = key
    print(" ".join([str(item) for item in A]))

Failing test case input:
6
0 3 3 0 0 -2

Expected output:
0 3 3 0 0 -2
0 3 3 0 0 -2
0 3 3 0 0 -2
0 0 3 3 0 -2
0 0 0 3 3 -2
-2 0 0 0 3 3


Actual output:

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

print(' '.join([str(item) for item in A]))
for i in range(1, N):
    key = A[i]
    j = i - 1
    while j >= 0 and A[j] > key:
        A[j+1] = A[j]
        j = j - 1
    A[j+1] = key
    print(' '.join([str(item) for item in A]))

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionSort(lst, n):
    for i in range(1, n):
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j = j - 1
        lst[j+1] = v
        print(lst)


if __name__ == "__main__":
    n = int(input())
    lst = [int(n) for n in input().split()]
    print(lst)
    insertionSort(lst, n)

Failing test case input:
3
-1 1 -4

Expected output:
-1 1 -4
-1 1 -4
-4 -1 1


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


Fixed submission (verdict: Accepted):
def insertionSort(lst, n):
    for i in range(1, n):
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j = j - 1
        lst[j+1] = v
        print(" ".join([str(n) for n in lst]))


if __name__ == "__main__":
    n = int(input())
    lst = [int(n) for n in input().split()]
    print(" ".join([str(n) for n in lst]))
    insertionSort(lst, n)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
N=int(input())
A=[0 for i in range(N)]
A=input().split()
for i in range(N):
    v=A[i]
    j=i-1
    while j>=0 and A[j]>v:
        A[j+1]=A[j]
        j=j-1
        A[j+1]=v
    for i in range(N):
        if i!=N-1:
            print(A[i],end=" ")
        if i==N-1:
            print(A[i])


Failing test case input:
6
0 1 2 -1 0 -2

Expected output:
0 1 2 -1 0 -2
0 1 2 -1 0 -2
0 1 2 -1 0 -2
-1 0 1 2 0 -2
-1 0 0 1 2 -2
-2 -1 0 0 1 2


Actual output:
0 1 2 -1 0 -2
0 1 2 -1 0 -2
0 1 2 -1 0 -2
-1 0 1 2 0 -2
-1 0 0 1 2 -2
-1 -2 0 0 1 2


Fixed submission (verdict: Accepted):
N=int(input())
A=[0 for i in range(N)]
A=input().split()
for i in range(N):
    A[i]=(int)(A[i])
for i in range(N):
    v=A[i]
    j=i-1
    while j>=0 and A[j]>v:
        A[j+1]=A[j]
        j=j-1
        A[j+1]=v
    for i in range(N):
        if i!=N-1:
            print(A[i],end=" ")
        if i==N-1:
            print(A[i])

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):



N = int(input())

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

for i in range(1, N):
    tmp = a[i]
    j = i - 1
    while j >= 0 and a[j] > tmp:
        a[j + 1] = a[j]
        j -= 1
    
    a[j + 1] = tmp
    print(' '.join(map(str, a)))

Failing test case input:
6
0 2 3 0 0 -1

Expected output:
0 2 3 0 0 -1
0 2 3 0 0 -1
0 2 3 0 0 -1
0 0 2 3 0 -1
0 0 0 2 3 -1
-1 0 0 0 2 3


Actual output:
0 2 3 0 0 -1
0 2 3 0 0 -1
0 0 2 3 0 -1
0 0 0 2 3 -1
-1 0 0 0 2 3


Fixed submission (verdict: Accepted):


N = int(input())

a = list(map(int, input().split())) 
print(" ".join(map(str, a)))

for i in range(1, N):
    tmp = a[i]
    j = i - 1
    while j >= 0 and a[j] > tmp:
        a[j + 1] = a[j]
        j -= 1
    
    a[j + 1] = tmp
    print(" ".join(map(str, a)))

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
num = int(input())
array = list(map(int,input().split()))

for i in range(num):
    v = array[i]
    j = i-1
    while j >=0 and array[j]>v:
        array[j+1] = array[j]
        j -= 1
    array[j+1] = v
    print(array)

Failing test case input:
3
0 2 -8

Expected output:
0 2 -8
0 2 -8
-8 0 2


Actual output:
[0, 2, -8]
[0, 2, -8]
[-8, 0, 2]


Fixed submission (verdict: Accepted):
num = int(input())
array = list(map(int,input().split()))

for i in range(num):
    v = array[i]
    j = i-1
    while j >=0 and array[j]>v:
        array[j+1] = array[j]
        j -= 1
    array[j+1] = v
    print(" ".join(map(str,array)))
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
A = [int(item) for item in input().split()[1:]]

print(' '.join([str(item) for item in A]))
for i in range(1, len(A)):
    key = A[i]
    j = i - 1
    while j >= 0 and A[j] > key:
        A[j+1] = A[j]
        j = j - 1
    A[j+1] = key
    print(' '.join(map(str, A)))

Failing test case input:
3
-1 0 -14

Expected output:
-1 0 -14
-1 0 -14
-14 -1 0


Actual output:

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

print(' '.join([str(item) for item in A]))
for i in range(1, N):
    key = A[i]
    j = i - 1
    while j >= 0 and A[j] > key:
        A[j+1] = A[j]
        j = j - 1
    A[j+1] = key
    print(' '.join([str(item) for item in A]))

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def print_tmp(a_li):
    t = ''
    for i in a_li:
        t += str(i) + ' '
    print(t)


n = int(input())
a = input()
A = [int(i) for i in a.split(' ')]
print_tmp(A)
for i in range(1, n-1):
    v = A[i]
    j = i -1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print_tmp(A)
print_tmp(A)



Failing test case input:
6
9 4 2 2 2 -2

Expected output:
9 4 2 2 2 -2
4 9 2 2 2 -2
2 4 9 2 2 -2
2 2 4 9 2 -2
2 2 2 4 9 -2
-2 2 2 2 4 9


Actual output:
9 4 2 2 2 -2 
4 9 2 2 2 -2 
2 4 9 2 2 -2 
2 2 4 9 2 -2 
2 2 2 4 9 -2 
2 2 2 4 9 -2 


Fixed submission (verdict: Accepted):
def print_tmp(a_li):
    s = [str(a) for a in a_li]
    t = ' '.join(s)
    print(t)


n = int(input())
a = input()
A = [int(i) for i in a.split(' ')]
print_tmp(A)
for i in range(1, n):
    v = A[i]
    j = i -1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print_tmp(A)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
a=input().rstrip().split()
list(map(int,a))
print(*a)
for i in range(1,n):
   v=a[i]
   j=i-1
   while(j>=0 and a[j]>v):
      a[j+1]=a[j]
      j-=1
   a[j+1]=v
   print(*a)




Failing test case input:
6
0 2 2 -1 0 -2

Expected output:
0 2 2 -1 0 -2
0 2 2 -1 0 -2
0 2 2 -1 0 -2
-1 0 2 2 0 -2
-1 0 0 2 2 -2
-2 -1 0 0 2 2


Actual output:
0 2 2 -1 0 -2
0 2 2 -1 0 -2
0 2 2 -1 0 -2
-1 0 2 2 0 -2
-1 0 0 2 2 -2
-1 -2 0 0 2 2


Fixed submission (verdict: Accepted):
n = int(input())
*A, = map(int, input().split())
for i in range(n):
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print(*A)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionSort(A, N):
    for i in range(1, N):
        v = A[i]
        j = i - 1

        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1

        A[j + 1] = v

        print(" ".join(list(map(str, A))))

def main():
    N = int(input())
    A = [int(i) for i in input().split()]

    insertionSort(A, N)

main()



Failing test case input:
6
5 4 5 7 1 3

Expected output:
5 4 5 7 1 3
4 5 5 7 1 3
4 5 5 7 1 3
4 5 5 7 1 3
1 4 5 5 7 3
1 3 4 5 5 7


Actual output:
4 5 5 7 1 3
4 5 5 7 1 3
4 5 5 7 1 3
1 4 5 5 7 3
1 3 4 5 5 7


Fixed submission (verdict: Accepted):
def insertionSort(A, N):
    print(" ".join(list(map(str, A))))
    for i in range(1, N):
        v = A[i]
        j = i - 1

        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1

        A[j + 1] = v

        print(" ".join(list(map(str, A))))

def main():
    N = int(input())
    A = [int(i) for i in input().split()]

    insertionSort(A, N)

main()

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):


def printline(data):
    l=""
    for i,s in enumerate(data):
        l = l + s
        if i+1 != len(data):
            l = l+" "
    print(l)


length = int(input())
data = list(input().split())

for i in range(1,len(data)):
    tmp = data[i]
    i2 = i - 1
    while i2 >=0 and data[i2] > tmp:
        data[i2+1] = data[i2]
        i2 -= 1

    data[i2+1] = tmp
    printline(data)


Failing test case input:
6
16 4 2 2 1 -1

Expected output:
16 4 2 2 1 -1
4 16 2 2 1 -1
2 4 16 2 1 -1
2 2 4 16 1 -1
1 2 2 4 16 -1
-1 1 2 2 4 16


Actual output:
16 4 2 2 1 -1
16 2 4 2 1 -1
16 2 2 4 1 -1
1 16 2 2 4 -1
-1 1 16 2 2 4


Fixed submission (verdict: Accepted):


def printline(data):
    l=""
    for i,s in enumerate(data):
        l = l + str(s)
        if i+1 != len(data):
            l = l+" "
    print(l)


length = int(input())
data = list(map(int,input().split()))
printline(data)
for i in range(1,len(data)):
    tmp = data[i]
    i2 = i - 1
    while i2 >=0 and data[i2] > tmp:
        data[i2+1] = data[i2]
        i2 -= 1

    data[i2+1] = tmp
    printline(data)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def trace(A,input_num):
    i = 0
    if i != input_num - 1:
        for i in range(input_num):
            print(A[i],end = " ")
    
    else:
        print(A[i])    

def insertionSort(A,input_num):
    for i in range(input_num):
        v = A[i]
        j = i - 1
        while(j >= 0 and A[j] > v):
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        trace(A,input_num)
        
        
input_num = int(input())
A = list(map(int, input().split()))

insertionSort(A,input_num)


Failing test case input:
6
0 2 3 0 1 -1

Expected output:
0 2 3 0 1 -1
0 2 3 0 1 -1
0 2 3 0 1 -1
0 0 2 3 1 -1
0 0 1 2 3 -1
-1 0 0 1 2 3


Actual output:
0 2 3 0 1 -1 0 2 3 0 1 -1 0 2 3 0 1 -1 0 0 2 3 1 -1 0 0 1 2 3 -1 -1 0 0 1 2 3 

Fixed submission (verdict: Accepted):
def trace(A,input_num):
    for i in range(input_num):
        if i != input_num - 1:
            print(A[i],end = " ")
        else:
            print(A[i])

def insertionSort(A,input_num):
    for i in range(input_num):
        v = A[i]
        j = i - 1
        while(j >= 0 and A[j] > v):
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        trace(A,input_num)
        
input_num = int(input())
A = list(map(int, input().split()))

insertionSort(A,input_num)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
import sys
def print_list(A):
    for k in range(len(A)):
        sys.stdout.write(str(A[k]))
        if not k == len(A) -1: sys.stdout.write(" ")
    print()
def insert_sort(A,N):
    for i in range(1,N-1):
        v = A[i]
        j = i-1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j = j-1
        A[j+1]=v
        print_list(A)
    print_list(A)
    
N = int(input())
A = list(map(int,input().split()))
insert_sort(A,N)

Failing test case input:
6
0 3 6 0 0 -2

Expected output:
0 3 6 0 0 -2
0 3 6 0 0 -2
0 3 6 0 0 -2
0 0 3 6 0 -2
0 0 0 3 6 -2
-2 0 0 0 3 6


Actual output:
0 3 6 0 0 -2
0 3 6 0 0 -2
0 0 3 6 0 -2
0 0 0 3 6 -2
0 0 0 3 6 -2


Fixed submission (verdict: Accepted):
import sys
def print_list(A):
    for k in range(len(A)):
        sys.stdout.write(str(A[k]))
        if not k == len(A) -1: sys.stdout.write(" ")
    print()
def insert_sort(A,N):
    print_list(A)
    for i in range(1,N):
        v = A[i]
        j = i-1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j = j-1
        A[j+1]=v
        print_list(A)


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