ZhenlongDai/ACPR huggingface dataset:
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
A = list(input().split())

for i in range(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(" ".join(A))

Failing test case input:
3
-1 3 -14

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


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


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

for i in range(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(" ".join(map(str,A)))

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

for i in range(n):

    if i == 0:
        continue

    a = l[i]
    j = i - 1

    while j >= 0 and l[j] > a:
        l[j+1] = l[j]
        j = j - 1

    l[j+1] = a
    print(' '.join([str(x) for x in l]))

Failing test case input:
3
0 2 -28

Expected output:
0 2 -28
0 2 -28
-28 0 2


Actual output:
0 2 -28
-28 0 2


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

for i in range(n):
    a = l[i]
    j = i - 1

    while j >= 0 and l[j] > a:
        l[j+1] = l[j]
        j = j - 1

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

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
A = list(map(int,input().split()))
for i in range(1,len(A)):
    print(*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:
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 -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]


Fixed submission (verdict: Accepted):
n = int(input())
A = list(map(int,input().split()))
for i in range(1,len(A)):
    print(*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(*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 = 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):

def InsertionSort(l):
    for idx in range(1, len(l)):
        jdx = idx - 1
        while jdx >= 0 and l[idx] < l[jdx]:
            l[jdx], l[idx] = l[idx], l[jdx]
            idx -= 1
            jdx -= 1

        print(" ".join(map(str, l)))

def main():
    _ = input()
    in_list = list(map(int, input().split(' ')))

    InsertionSort(in_list)


main()


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 0 1 2 7 -2
0 0 1 2 7 -2
-2 0 0 1 2 7


Fixed submission (verdict: Accepted):

def InsertionSort(l):
    print(" ".join(map(str, l)))
    
    for idx in range(1, len(l)):
        jdx = idx - 1
        while jdx >= 0 and l[idx] < l[jdx]:
            l[jdx], l[idx] = l[idx], l[jdx]
            idx -= 1
            jdx -= 1

        print(" ".join(map(str, l)))

def main():
    _ = input()
    in_list = list(map(int, input().split(' ')))
    
    InsertionSort(in_list)


main()

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

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

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):
n = int(input())
num = list(map(int, input().split()))

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



def insertion_sort(seq, l):
    for i, v in enumerate(seq[1:], start=1):
        left = i - 1
        while left >= 0 and seq[left] > v:
            seq[left], seq[left+1] = seq[left+1], seq[left]
            left -= 1
        print(' '.join([str(n) for n in seq]))


def to_int(v):
    return int(v)


def to_seq(v):
    return [int(c) for c in v.split()]


if __name__ == '__main__':
    l = to_int(input())
    seq = to_seq(input())

    insertion_sort(seq, l)

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 0 1 2 7 -2
0 0 1 2 7 -2
-2 0 0 1 2 7


Fixed submission (verdict: Accepted):



def insertion_sort(seq, l):
    print(' '.join([str(n) for n in seq]))
    for i, v in enumerate(seq[1:], start=1):
        left = i - 1
        while left >= 0 and seq[left] > v:
            seq[left], seq[left+1] = seq[left+1], seq[left]
            left -= 1
        print(' '.join([str(n) for n in seq]))


def to_int(v):
    return int(v)


def to_seq(v):
    return [int(c) for c in v.split()]


if __name__ == '__main__':
    l = to_int(input())
    seq = to_seq(input())

    insertion_sort(seq, l)

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

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 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 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):
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 insertSort(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(i) for i in input().split()]
    insertSort(A, N)

Failing test case input:
3
0 2 -15

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


Actual output:
0 2 -15
-15 0 2


Fixed submission (verdict: Accepted):
def insertSort(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(i) for i in input().split()]
    print(' '.join(map(str, a)))
    insertSort(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


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


insertionsort(n,A)

l=len(A)
for i in range(l):
	print(A[i],end=" ")


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 = [int(i) for i in input().split()]

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)

insertionSort(A, N)

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]
[-2, -1, 0, 0, 2, 2]


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

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(' '.join([str(i) for i in A]))

insertionSort(A, N)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
arr=list(map(int,input().split()))
for i in range(1,n):
  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(' '.join(map(str,arr)))


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):
n=int(input())
arr=list(map(int,input().split()))
print(' '.join(map(str,arr)))
for i in range(1,n):
  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(' '.join(map(str,arr)))

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



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


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

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


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


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


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

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

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 = [int(x) for x in input().split()]
print(*a)
for i in range(1, n):
    k, j = a[i], i-1
    while j >= 0 and a[j] > k:
        a[j+1], j = a[j], j-1
    a[j+1] = k
    print(*a)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionSort(length, array):
    for i in range(1, length):
        v = array[i]
        j = i - 1
        while j >= 0 and array[j] > v:
            array[j+1] = array[j]
            j -= 1
        array[j+1] = v
        if i < length - 1:
            print(' '.join(map(str, array)))
        else:
            print(' '.join(map(str, array)), end='')

length = int(input())
num_array = [int(x) for x in input().split()]
insertionSort(length, num_array)



Failing test case input:
3
-1 0 -12

Expected output:
-1 0 -12
-1 0 -12
-12 -1 0


Actual output:
-1 0 -12
-12 -1 0

Fixed submission (verdict: Accepted):
def show(array):
    for i in range(len(array)):
        if i != len(array) - 1:
            print(array[i], end=' ')
        else:
            print(array[i])

length = int(input())
array = [int(x) for x in input().split()]

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

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 -= 1
    A[j+1] = v
    print(A)

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

Expected output:
5 4 5 8 1 3
4 5 5 8 1 3
4 5 5 8 1 3
4 5 5 8 1 3
1 4 5 5 8 3
1 3 4 5 5 8


Actual output:
[5, 4, 5, 8, 1, 3]
[4, 5, 5, 8, 1, 3]
[4, 5, 5, 8, 1, 3]
[4, 5, 5, 8, 1, 3]
[1, 4, 5, 5, 8, 3]
[1, 3, 4, 5, 5, 8]


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 -= 1
    A[j+1] = v
    print(*A)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def main():
    n = int(input())
    Mtx = list(map(int, input().split()))
    
    for i in range(1,n):
        for j in range(i,0,-1):
            if Mtx[j] < Mtx[j-1]:
                Mtx[j-1], Mtx[j] = Mtx[j], Mtx[j-1]
            
        showMtx(Mtx)
                

def showMtx(Mtx):    
    q = len(Mtx)
    for i in range(q):
        if i != q - 1:
            print(Mtx[i], sep=' ', end=' ')
        else:
            print(Mtx[i])



if __name__ == '__main__':
    main()



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 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


Fixed submission (verdict: Accepted):
def main():
    n = int(input())
    Mtx = list(map(int, input().split()))
    
    showMtx(Mtx)
    for i in range(1,n):
        for j in range(i,0,-1):
            if Mtx[j] < Mtx[j-1]:
                Mtx[j-1], Mtx[j] = Mtx[j], Mtx[j-1]
            
        showMtx(Mtx)
                

def showMtx(Mtx):    
    q = len(Mtx)
    for i in range(q):
        if i != q - 1:
            print(Mtx[i], sep=' ', end=' ')
        else:
            print(Mtx[i])



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(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



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:
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


Fixed submission (verdict: Accepted):
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(' '.join(map(str, A)))

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
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-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):
tim = int(input())
A   = input().split()
for i in range(tim) :
    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(A))

Failing test case input:
3
-1 2 -4

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


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


Fixed submission (verdict: Accepted):
tim = int(input())
A   = [int(A) for A in input().split()]
for i in range(tim) :
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v :
        A[j + 1] = A[j]
        j -= 1
        A[j + 1] = v
    A2 = list(map(str, A))
    print(' '.join(A2))
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionsort(x):
    for i in range(len(x)):
        for k in range(i, 0, -1):
            if x[k-1] > x[k]:
                x[k-1], x[k] = x[k], x[k-1]
        print(" ".join(map(str, x)))


if __name__ == "__main__":
    input()
    insertionsort(input().split(" "))

Failing test case input:
3
-1 0 -12

Expected output:
-1 0 -12
-1 0 -12
-12 -1 0


Actual output:
-1 0 -12
-1 0 -12
-1 -12 0


Fixed submission (verdict: Accepted):
def insertionsort(x):
    x = list(map(int, x))
    for i in range(len(x)):
        for k in range(i, 0, -1):
            if x[k-1] > x[k]:
                x[k-1], x[k] = x[k], x[k-1]
        print(" ".join(map(str, x)))


if __name__ == "__main__":
    input()
    insertionsort(input().split(" "))

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionSort(a):
    n = len(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(i) for i in a]))
        
n = input()
a = [int(s) for s in input().split(" ")]
insertionSort(a)

Failing test case input:
3
4 2 8

Expected output:
4 2 8
2 4 8
2 4 8


Actual output:
2 4 8
2 4 8


Fixed submission (verdict: Accepted):
def insertionSort(a):
    print(" ".join([str(i) for i in a]))
    n = len(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(i) for i in a]))
        
n = input()
a = [int(s) for s in input().split(" ")]
insertionSort(a)

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



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


Failing test case input:
3
-1 3 -14

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


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


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


for i in range(N):
    v = b[i]
    j = i-1
    while j>=0 and b[j]>v:
        b[j+1] = b[j]
        j = j-1
        b[j+1] = v
    print(" ".join([str(n) for n in b]))
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
a=[]
n=int(input())
a=input().strip().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=j-1
	a[j+1]=v
	print(a)



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', '3', '6', '0', '0', '-2']
['0', '0', '3', '6', '0', '-2']
['0', '0', '0', '3', '6', '-2']
['-2', '0', '0', '0', '3', '6']


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=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()))
print(n,a)

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(" ".join(map(str, a)))
        
insertionSort(a,n)
        

Failing test case input:
3
4 2 8

Expected output:
4 2 8
2 4 8
2 4 8


Actual output:
3 [4, 2, 8]
4 2 8
2 4 8
2 4 8


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

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(" ".join(map(str, a)))
        
insertionSort(a,n)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
N = int(input())
L = [int(x) for x in input().split()]


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


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:
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


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

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

for i in range(1, N):
    v = L[i]
    j = i - 1
    while j >= 0 and L[j] > v:
        L[j + 1] = L[j]
        j -= 1
    L[j + 1] = v
    print(' '.join(map(str, L)))
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def Isort(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)
    
n = int(input("n:"))
a = input().split()
Isort(a,n)


Failing test case input:
3
0 3 -8

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


Actual output:
n:0 3 -8
-8 0 3


Fixed submission (verdict: Accepted):
def Isort(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)
        
    
n = int(input())
a = list(map(int, input().split()))
print(*a)
Isort(a,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):
    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
    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, 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=[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 k in range(N):
        if k<N-1:
            print(A[k],end=" ")
        if k==N-1:
            print(A[k])

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(x) for x in A]))

if __name__ == '__main__':
    length = int(input())
    hoge = [int(x) for x in input().split()]
    insertionSort(hoge, length)


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):
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(x) for x in A]))

if __name__ == '__main__':
    length = int(input())
    hoge = [int(x) for x in input().split()]
    print (' '.join([str(x) for x in hoge]))
    insertionSort(hoge, length)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
import string
n = int(input())
l = []
l = input().split()
for i in range(n):
    key = l[i]
    j = i -1
    while j >= 0 and l[j] > key:
        l[j + 1] = l[j]
        j -= 1
    l[j + 1] = key
    print(' '.join(l))

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):
import string
n = int(input())
l = []
l = list(map(int, input().split()))
for i in range(n):
    key = l[i]
    j = i -1
    while j >= 0 and l[j] > key:
        l[j + 1] = l[j]
        j -= 1
    l[j + 1] = key
    print(' '.join(map(str, l)))

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
	B = [print(" ".join(map(str, A))) for k in range(N)]

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 2 6 0 0 -2
0 2 6 0 0 -2
0 2 6 0 0 -2
0 2 6 0 0 -2
0 2 6 0 0 -2
0 2 6 0 0 -2
0 2 6 0 0 -2
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 2 6 0 -2
0 0 2 6 0 -2
0 0 2 6 0 -2
0 0 2 6 0 -2
0 0 2 6 0 -2
0 0 0 2 6 -2
0 0 0 2 6 -2
0 0 0 2 6 -2
0 0 0 2 6 -2
0 0 0 2 6 -2
0 0 0 2 6 -2
-2 0 0 0 2 6
-2 0 0 0 2 6
-2 0 0 0 2 6
-2 0 0 0 2 6
-2 0 0 0 2 6
-2 0 0 0 2 6


Fixed submission (verdict: Accepted):
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(" ".join(map(str, A)))

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



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


Failing test case input:
3
0 2 -15

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


Actual output:
['0', '2', '-15']
['0', '2', '-15']
['0', '2', '-15']


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


for i in range(N):
    v = b[i]
    j = i-1
    while j>=0 and b[j]>v:
        b[j+1] = b[j]
        j = j-1
        b[j+1] = v
    print(" ".join([str(n) for n in b]))
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(list(map(str, a))))

Failing test case input:
3
0 3 -14

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


Actual output:
0 3 -14
-14 0 3


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

for i in range(1, n):
    print(' '.join(list(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(' '.join(list(map(str, 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)))

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


Failing test case input:
3
6 2 8

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


Actual output:
2 6 8
2 6 8


Fixed submission (verdict: Accepted):
def insertionSort(A, N):
  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)))

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

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



if __name__ == '__main__':
    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
        if i == N - 1:
            print(' '.join(map(str,A)),end = '')
        else:
            print(' '.join(map(str,A)))

Failing test case input:
3
0 4 -12

Expected output:
0 4 -12
0 4 -12
-12 0 4


Actual output:
0 4 -12
-12 0 4

Fixed submission (verdict: Accepted):
if __name__ == '__main__':
    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 = j -1
        A[j+1] = v
        print(' '.join(map(str,A)))
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def insertionSort(A, N):
    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)


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

A = insertionSort(A, N)


Failing test case input:
3
0 4 -15

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


Actual output:
[0, 4, -15]
[0, 4, -15]
[-15, 0, 4]


Fixed submission (verdict: Accepted):
def showList(A, N):
    for i in range(N-1):
        print(A[i],end=' ')
    print(A[N-1])

def insertionSort(A, N):
    showList(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
        showList(A,N)


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

A = insertionSort(A, N)

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

print(" ".join(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(A))

Failing test case input:
3
-1 0 -12

Expected output:
-1 0 -12
-1 0 -12
-12 -1 0


Actual output:
-1 0 -12
-1 0 -12
-1 -12 0


Fixed submission (verdict: Accepted):
n = int(input())
A = input().split(' ')



print(" ".join(A))

for i in range(1, n):
    v = A[i]
    j = i - 1

    while j >= 0 and int(A[j]) > int(v):
        A[j+1] = A[j]
        j -= 1
        A[j+1] = v
    print(" ".join(A))

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

def insertationSort(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(' '.join(A))

insertationSort(nums,n)


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

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


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


Fixed submission (verdict: Accepted):
n = int(input())
nums = []
nums = input().split()
intNums = list(map(int,nums))

def insertationSort(nums,intNums):
    print(' '.join(nums))
    for i in range(1,len(nums)):
        v = intNums[i]
        j = i - 1
        while j>=0 and intNums[j]>v:
            intNums[j+1] = intNums[j]
            j = j - 1
        intNums[j+1] = v
        nums = list(map(str,intNums))
        print(' '.join(nums))

insertationSort(nums,intNums)
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
    return A


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

A = insertionSort(A, N)
print(A)


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

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


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


Fixed submission (verdict: Accepted):
def showList(A, N):
    for i in range(N-1):
        print(A[i],end=' ')
    print(A[N-1])

def insertionSort(A, N):
    showList(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
        showList(A,N)


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

A = insertionSort(A, N)

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


import sys


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
    
    sys.stdout.write(' '.join(map(str, a)))
    if i != N - 1:
        sys.stdout.write('\n')

Failing test case input:
3
-1 1 -12

Expected output:
-1 1 -12
-1 1 -12
-12 -1 1


Actual output:
-1 1 -12
-12 -1 1

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):
from sys import stdin
def stdinput():
    return stdin.readline().strip()

def main():
    n = int(stdinput())
    a = list(map(int, stdinput().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)))

if __name__ == '__main__':
    main()


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

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


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


Fixed submission (verdict: Accepted):
from sys import stdin
def stdinput():
    return stdin.readline().strip()

def main():
    n = int(stdinput())
    a = list(map(int, stdinput().split()))

    for i in range(0, 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__':
    main()
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 = j -1
        A[j+1] = v
        print(A)

A = [5,2,4,6,1,3]
insertionSort(A,6)


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, 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):
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 = j -1
        A[j+1] = v
        print(' '.join(map(str, A)))

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

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

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

Failing test case input:
3
0 2 -15

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


Actual output:
0 2 -15
-15 0 2


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

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

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
l=list(map(int, input().split()))
for i in range(n):
    l[0:i]=sorted(l[0:i])
    print(l)

Failing test case input:
3
-1 3 -14

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


Actual output:
[-1, 3, -14]
[-1, 3, -14]
[-1, 3, -14]


Fixed submission (verdict: Accepted):
n=int(input())
l=list(map(int, input().split()))
for i in range(1,n+1):
    l[0:i]=sorted(l[0:i])
    print(*l)

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)))

    return A

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

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

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


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


Fixed submission (verdict: Accepted):
def pd(A):
    print(" ".join(map(str,A)))

def insertionSort(A, N):
    pd(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
        pd(A)

    return A

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

import sys

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
    sys.stdout.write(" ".join(A))
    if i < n - 1:
        sys.stdout.write("\n")

Failing test case input:
3
-1 2 -4

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


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

Fixed submission (verdict: Accepted):
n = int(input())
A = input().split(' ')



print(" ".join(A))

for i in range(1, n):
    v = A[i]
    j = i - 1

    while j >= 0 and int(A[j]) > int(v):
        A[j+1] = A[j]
        j -= 1
        A[j+1] = v
    print(" ".join(A))

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


import sys


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 3 0 1 1 0

Expected output:
0 3 0 1 1 0
0 3 0 1 1 0
0 0 3 1 1 0
0 0 1 3 1 0
0 0 1 1 3 0
0 0 0 1 1 3


Actual output:
0 3 0 1 1 0
0 0 3 1 1 0
0 0 1 3 1 0
0 0 1 1 3 0
0 0 0 1 1 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):
N = int(input())
a = input().split()
b = [int(n) for n in a]



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


Failing test case input:
3
0 1 -9

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


Actual output:
0 1 -9
0 1 -9
0 1 -9


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


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

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(*a)



Failing test case input:
3
0 3 -14

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


Actual output:
0 3 -14
-14 0 3


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):
n = int(input())
l = list(map(int,input().split()))



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

    


Failing test case input:
3
0 2 -15

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


Actual output:
0 2 -15
-15 0 2


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


mm = ''
for i in range(n):
    mm = mm + ' ' + str(l[i])
print(mm.strip())

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

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
-1 3 0 1 1 0

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


Actual output:
-1 3 0 1 1 0 -1 3 0 1 1 0 -1 0 3 1 1 0 -1 0 1 3 1 0 -1 0 1 1 3 0 -1 0 0 1 1 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):
def rren(): return list(map(int, input().split()))
N = int(input())
R = rren()

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

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

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


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


Fixed submission (verdict: Accepted):
def rren(): return list(map(int, input().split()))
N = int(input())
R = rren()

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


input_num = int(input())
num_list = [int(i) for i in input().split()]

for i in range(1, len(num_list)):
    v = num_list[i]
    j = i - 1
    while j >= 0 and num_list[j] > v:
        num_list[j+1] = num_list[j]
        j -= 1
    num_list[j+1] = v
    for i in range(len(num_list)):
        print(str(num_list[i]), end="")
        if i < len(num_list)-1:
            print(" ", end="")
        else:
            print()

Failing test case input:
3
0 2 -15

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


Actual output:
0 2 -15
-15 0 2


Fixed submission (verdict: Accepted):
def show_list(num_list):
    for i in range(len(num_list)):
        print(str(num_list[i]), end="")
        if i < len(num_list)-1:
            print(" ", end="")
        else:
            print()

input_num = int(input())
num_list = [int(i) for i in input().split()]
show_list(num_list)
for i in range(1, len(num_list)):
    v = num_list[i]
    j = i - 1
    while j >= 0 and num_list[j] > v:
        num_list[j+1] = num_list[j]
        j -= 1
    num_list[j+1] = v
    show_list(num_list)

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

def sort(N,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
        pr(A)

def pr(list):
    n = len(list)
    for i in range(n):
        if i < n-1:
            print(list[i],end=" ")
        else:
            print(list[i],end="\n")

sort(N,A)


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
-1 0 1 2 0 -2
-1 0 0 1 2 -2
-2 -1 0 0 1 2


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

def sort(N,A):
    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
        pr(A)

def pr(list):
    n = len(list)
    for i in range(n):
        if i < n-1:
            print(list[i],end=" ")
        else:
            print(list[i],end="\n")

sort(N,A)

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
a=[]
n=int(input())
a=input().strip().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(a)


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

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


Actual output:
['2', '2', '2', '-1', '2', '-2']
['2', '2', '2', '-1', '2', '-2']
['2', '2', '2', '-1', '2', '-2']
['-1', '2', '2', '2', '2', '-2']
['-1', '2', '2', '2', '2', '-2']
['-1', '-2', '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=j-1
	a[j+1]=v
	print(' '.join(map(str,a)))