ZhenlongDai/ACPR huggingface dataset:
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n = input()
A = [int(i) for i in 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(i, end=' ') for i in A]
    print()

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

def trace(A):
    for index, v in enumerate(A):
        print(v, end='')
        if index != len(A) - 1:
            print(' ', end='')
    print()

trace(A)
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
    trace(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:
3
-1 1 -12

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


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

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 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 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):
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
        for i in range(N):
            if i!=N-1:
                print(A[i],end=" ")
            if i==N-1:
                print(A[i])
    return A

N=int(input())
A=[0]*N
A=input().split()
insertionSort(A,N)


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:
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=[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(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
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:
0 3 3 0 0 0
3 3 3 0 0 0
3 3 3 0 0 0
3 3 3 3 0 0
3 3 3 3 3 0
3 3 3 3 3 0


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

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

def trace(A, N):
    for i in range(int(N)-1):
        print(A[i], end=' ')
    print(A[int(N)-1])

def insertionSort(A, N):
    for i in range(1, int(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
        trace(A, N)

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

    insertionSort(A, N)



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 trace(A, N):
    for i in range(int(N)-1):
        print(A[i], end=' ')
    print(A[int(N)-1])

def insertionSort(A, N):
    for i in range(1, int(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
        trace(A, N)

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

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


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



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


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

y = list(map(str, array))
y = " ".join(y)
print(y)

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

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

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

insertionSort(a,n)

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

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


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


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

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

insertionSort(a,n)
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())
a = input().split()
print(*a)
Isort(a,n)


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


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 = 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)
print(*A)



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:
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
1 3 4 5 5 7


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):
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
-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):
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=[0]*N
A=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
    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
2 0 2 -1 5 -1

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


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


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 = input()
nums = input()
nums = nums.split()

for idx in range(1, int(n)):
    v = nums[idx]
    j = idx - 1
    while j >= 0 and nums[j] > v:
        nums[j+1] = nums[j]
        j -= 1
    nums[j+1] = v
    print(' '.join(nums))


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 = input()
nums = input()
nums = nums.split()
nums = list(map(int, nums))
print(' '.join(map(str, nums)))

for idx in range(1, int(n)):
    v = nums[idx]
    j = idx - 1
    while j >= 0 and nums[j] > v:
        nums[j+1] = nums[j]
        j -= 1
    nums[j+1] = v
    print(' '.join(map(str, nums)))

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 = j - 1
    l[j + 1] = key
    print(' '.join(l))

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


def Insertion_Sort():
    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
        
        print(A[0],end="")
        for i in range(1,N):
            print(" {}".format(A[i]),end="")
        print('\n',end="")
        


if __name__ == "__main__":
    Insertion_Sort()

    


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 Insertion_Sort():
    N=int(input())
    A=list(map(int,input().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=j-1
        A[j+1]=v
        
        print(A[0],end="")
        for i in range(1,N):
            print(" {}".format(A[i]),end="")
        print('\n',end="")
        


if __name__ == "__main__":
    Insertion_Sort()

Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
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)

    return A

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

A = insertion_sort(A, N)
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
0 1 1 4 5 5


Fixed submission (verdict: Accepted):
def insertion_sort(A, N):
    for i in range(1, N):
        v = A[i]
        j = i - 1
        print(*A)

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

    return A

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

A = insertion_sort(A, N)
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):
	print(a)
	j = i -1
	v = a[i]
	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
-1 2 -4

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


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


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

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

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

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

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

trace(A,input_num)



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 



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):
N=int(input())
a=list(map(int, input().split()))
k=list(str(a))
j='  '.join(k)
print(j)
for i in range(1,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
    b=a[:]
    c='  '.join(str(b))
    print(c)
  


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

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


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


Fixed submission (verdict: Accepted):
N=int(input())
a=list(map(int, input().split()))
k=list(map(str,a))
j=' '.join(k)
print(j)
for i in range(1,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
    b=list(map(str, a))
    c=' '.join(b)
    print(c)

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]>a[j+1] and j>0:
        a[j+1] = a[j]
        a[j] = v
        j -=1


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:

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

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 inserrtionsort(l,n):
  for i in range(1,n):
    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
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:
  2 0   2   - 1   2   - 2
  0 2   2   - 1   2   - 2
    0 2 2   - 1   2   - 2
    0 2 2   - 1   2   - 2
      0 2 2 - 1   2   - 2


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):
kazu=int(input())
A=[int(i) for i in range(kazu)]

j=0
for i in range(kazu - 1):
    print(A[i], end=" ")
print(A[kazu-1],end="")

for i in range(1,kazu):
    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(kazu-1):
        print(A[i],end=" ")
    print(A[kazu-1],end="")

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:
0 1 2 3 4 50 1 2 3 4 50 1 2 3 4 50 1 2 3 4 50 1 2 3 4 50 1 2 3 4 5

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



j=0
for i in range(kazu - 1):
    print(A[i], end=" ")
print(A[kazu-1])

for i in range(1,kazu):
    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(kazu-1):
        print(A[i],end=" ")
    print(A[kazu-1])

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


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


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 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(' ')]

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)




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

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


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

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

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:

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):
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
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, 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()))

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(list(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:
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
-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 = 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):
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:
3
0 4 -6

Expected output:
0 4 -6
0 4 -6
-6 0 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):

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

    InsertionSort(in_list)


main()


Failing test case input:
3
-1 3 -8

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


Actual output:

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


input()
seq = input().split()
for i in range(len(seq)):
    j = i - 1
    key = seq[i]
    assert isinstance(i, int)
    while j >= 0 and seq[j] > key:
        seq[j + 1] = seq[j]
        j -= 1
    seq[j + 1] = key
    print(seq)

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']
['-1', '-4', '1']


Fixed submission (verdict: Accepted):


input()
seq = [int(x) for x in input().split()]
for i in range(0, len(seq)):
    key = seq[i]
    j = i - 1
    assert isinstance(i, int)
    while j >= 0 and seq[j] > key:
        seq[j + 1] = seq[j]
        j -= 1
    seq[j + 1] = key
    print(' '.join(map(str,seq)))
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
def listprint(lists):
	for i in lists:
		print(i,end = '')
	print()

if __name__ == '__main__':
	N = int(input())
	l = input().split()

	for i in range(N):
		l[i] = int(l[i])

	for i in range(1, N):
		v = l[i]
		j = i - 1
		listprint(l)

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

		l[j + 1] = v
		listprint(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:
012-10-2
012-10-2
012-10-2
012-10-2
012-10-2
-10120-2
-10120-2
-10012-2
-10012-2
-2-10012


Fixed submission (verdict: Accepted):
def listprint(lists):
	global N
	count = 0
	for i in lists:
		count += 1
		if count < N:
			print(i, end = ' ')
		if count == N:
			print(i)

if __name__ == '__main__':
	N = int(input())
	l = input().split()

	for i in range(N):
		l[i] = int(l[i])

	listprint(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
		listprint(l)

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

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

	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 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 Insertion_Sort(A, N):
    A = list(map(int, 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(map(str,A)))

N = int(input())
A = input()
Insertion_Sort(A, N)


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):
def Insertion_Sort(A, N):
    print(A)
    A = list(map(int, 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(map(str,A)))

N = int(input())
A = input()
Insertion_Sort(A, N)
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)

N = input()
N = int(N)
A = input()
A = list(map(int, A.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 = 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):
def insertion_sort(target_list):
    '????????????????????????????????\???????????§??????????????????????????¨?????????'
    sorted_list = list()
    for target in target_list[:]:
        for i, num in enumerate(sorted_list):
            if num > target:
                sorted_list[i:i] = [target]
                break
        else:
            sorted_list.append(target)
        target_list.pop(0)
        print(sorted_list + target_list)

N = int(input())
A = [int(s) for s in input().split()]
insertion_sort(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]
[-12, -1, 0]


Fixed submission (verdict: Accepted):
def insertion_sort(target_list):
    sorted_list = list()
    for target in target_list[:]:
        for i, num in enumerate(sorted_list):
            if num > target:
                sorted_list[i:i] = [target]
                break
        else:
            sorted_list.append(target)
        target_list.pop(0)
        print(' '.join(str(s) for s in sorted_list + target_list))

N = int(input())
A = [int(s) for s in input().split()]
insertion_sort(A)
Problem: p02255
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
input_list = [int(x) for x in input().split()]

def sort_print(n, input_list):
    
    
    for i in range(n):
        index = i

        num = input_list[index]
        while index-1 >=0 and input_list[index-1] > num:
            input_list[index] = input_list[index-1]
            index -= 1
        input_list[index] = num

        print(input_list)

sort_print(n, input_list)

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


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

def sort_print(n, input_list):
    
    
    for i in range(n):
        index = i

        num = input_list[index]
        while index-1 >=0 and input_list[index-1] > num:
            input_list[index] = input_list[index-1]
            index -= 1
        input_list[index] = num

        result = [str(x) for x in input_list]
        print(' '.join(result))

sort_print(n, input_list)
Problem: p02792
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
ans_lis = [[0] * 9 for  i in range(9)]
for i in range(1,N+1):
  t = str(i)
  mae = int(t[0])
  ushiro = int(t[-1])
  ans_lis[mae-1][ushiro-1] += 1
ans = 0
for i in range(9):
  for j in range(9):
    ans += ans_lis[i][j] * ans_lis[j][i]
print(ans)


Failing test case input:
2158

Expected output:
46642


Actual output:
51515


Fixed submission (verdict: Accepted):
N = int(input())
ans_lis = [[0] * 9 for i in range(9)]
for i in range(1,N+1):
  t = str(i)
  mae = int(t[0])
  ushiro = int(t[-1])
  if ushiro == 0:
    continue
  ans_lis[mae-1][ushiro-1] += 1
ans = 0
for i in range(9):
  for j in range(9):
    ans += ans_lis[i][j] * ans_lis[j][i]
print(ans)

Problem: p02792
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

table = [[0]*10 for i in range(10)]

for i in range(1, N):
  s = str(i)
  id1 = int(s[0])
  id2 = int(s[-1])
  table[id1][id2] += 1

ans = 0
for i in range(10):
  for j in range(10):
    ans += table[i][j]*table[j][i]

print(ans)

Failing test case input:
897

Expected output:
8083


Actual output:
8061


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

table = [[0]*10 for i in range(10)]

for i in range(1, N+1):
  s = str(i)
  id1 = int(s[0])
  id2 = int(s[-1])
  table[id1][id2] += 1

ans = 0
for i in range(10):
  for j in range(10):
    ans += table[i][j]*table[j][i]

print(ans)

Problem: p02792
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin

n = int(stdin.readline().rstrip())

li = [[0 for i in range(10)]for j in range(10)]

for k in range(1,n+1):
    atama = int(str(k)[0])
    ushiro = int(str(k)[-1])
    li[atama][ushiro] += 1
point = 0
for l in range(1,10):
    for m in range(1,10):
        point += li[l][m]**2

print(point)

Failing test case input:
141750

Expected output:
200930633


Actual output:
340375633


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

n = int(stdin.readline().rstrip())

li = [[0 for i in range(10)]for j in range(10)]

for k in range(1,n+1):
    atama = int(str(k)[0])
    ushiro = int(str(k)[-1])
    li[atama][ushiro] += 1

point = 0

for l in range(1,10):
    for m in range(1,10):
        point += li[l][m]*li[m][l]
print(point)

Problem: p02792
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=[[0]*9 for i in range(9)]
for i in range(n):
    x,y =int(str(i)[0]), int(str(i)[-1])
    if y>0:
        a[x-1][y-1]+=1
count=0
for i in range(9):
    for j in range(9):
        if i>j:
            continue
        if i==j:
            count+=a[i][j]**2
        else:
            count+=a[i][j]*a[j][i]*2
print(count)

Failing test case input:
816

Expected output:
6701


Actual output:
6679


Fixed submission (verdict: Accepted):
n=int(input())
a=[[0]*9 for i in range(9)]
for i in range(1,n+1):
    x,y =int(str(i)[0]), int(str(i)[-1])
    if y>0:
        a[x-1][y-1]+=1
count=0
for i in range(9):
    for j in range(9):
        if i>j:
            continue
        if i==j:
            count+=a[i][j]**2
        else:
            count+=a[i][j]*a[j][i]*2
print(count)
Problem: p02792
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N=int(input())
c=[[0]*10]*10
for n in range(1,N+1):
    c[int(str(n)[0])][int(str(n)[-1])]+=1
sum=0
for i in range(10):
    for j in range(10):
        sum+=c[i][j]*c[j][i]
print(sum)


Failing test case input:
2424

Expected output:
58947


Actual output:
5875776


Fixed submission (verdict: Accepted):
N=int(input())
c=[[0]*10 for i in range(10)]
for n in range(1,N+1):
    c[int(str(n)[0])][int(str(n)[-1])]+=1
sum=0
for i in range(10):
    for j in range(10):
        sum+=c[i][j]*c[j][i]
print(sum)

Problem: p02792
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):


n = int(input())

a = [[0 for i in range(10)] for j in range(10)]

for i in range(n):
    b = int(str(i)[0])
    c = int(str(i)[-1])
    a[b][c] += 1

ans = 0
for i in range(1,10):
    for j in range(1,10):
        ans += a[i][j]*a[j][i]
print(ans)





Failing test case input:
3093

Expected output:
95976


Actual output:
95933


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

a = [[0 for i in range(10)] for j in range(10)]

for i in range(1,n+1):
    b = int(str(i)[0])
    c = int(str(i)[-1])
    a[b][c] += 1

ans = 0
for i in range(1,10):
    for j in range(1,10):
        ans += a[i][j]*a[j][i]
print(ans)

Problem: p02792
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict
def getLeft(num):
    while num > 10:
        num = int(num / 10)
    return num

def getRight(num):
    return num % 10

n = int(input())
a = defaultdict(int)
for number in range(1,n+1):
    left = getLeft(number)
    right = getRight(number)
    a[(left,right)] += 1


res = 0
for i in range(0,10):
    for j in range(0,10):
        res += a[(i,j)] * a[(j,i)]
print(res)




Failing test case input:
2158

Expected output:
46642


Actual output:
42011


Fixed submission (verdict: Accepted):
from collections import defaultdict
def getLeft(num):
    while num >= 10:
        num = int(num / 10)
    return num

def getRight(num):
    return num % 10

n = int(input())
a = defaultdict(int)
for number in range(1,n+1):
    left = getLeft(number)
    right = getRight(number)
    a[(left,right)] += 1


res = 0
for i in range(0,10):
    for j in range(0,10):
        res += a[(i,j)] * a[(j,i)]
print(res)

Problem: p02792
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

A = [[0]*10 for i in range(10)]

for i in range(1, N+1):
    A[int(str(i)[0])][int(str(i)[-1])] = 1

ans = 0
for i in range(10):
    for j in range(10):
        ans += A[i][j] * A[j][i] 

print(ans)

Failing test case input:
453

Expected output:
2099


Actual output:
81


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

A = [[0]*10 for i in range(10)]

for i in range(1, N+1):
    A[int(str(i)[0])][int(str(i)[-1])] += 1

ans = 0
for i in range(10):
    for j in range(10):
        ans += A[i][j] * A[j][i] 

print(ans)
Problem: p02792
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N = int(input())
    cnt = 0
    
    cnt = [[0] * 10 for _ in range(10)]
    for i in range(1,N):
        tmp = str(i)
        first = int(tmp[0])
        last = int(tmp[-1])
        cnt[first][last] += 1
    ans = 0
    for i in range(1,10):
        for j in range(1,10):
            ans += cnt[i][j] * cnt[j][i]

    print(ans)

        







if __name__ == "__main__":
    main()

Failing test case input:
1257

Expected output:
15840


Actual output:
15818


Fixed submission (verdict: Accepted):
def main():
    N = int(input())
    cnt = 0
    
    cnt = [[0] * 10 for _ in range(10)]
    for i in range(N+1):
        tmp = str(i)
        first = int(tmp[0])
        last = int(tmp[-1])
        cnt[first][last] += 1
    ans = 0
    for i in range(1,10):
        for j in range(1,10):
            ans += cnt[i][j] * cnt[j][i]

    print(ans)

        







if __name__ == "__main__":
    main()

Problem: p02792
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = [[0 for _ in range(10)] for _2 in range(10)]
ans = 0
for i in range(1, n+1):
  l = int(str(i)[0])
  r = int(str(i)[-1])
  p[l][r] += 1
  ans += p[r][l]
print(ans)

Failing test case input:
2020

Expected output:
40812

Actual output:
20511


Fixed submission (verdict: Accepted):
n = int(input())
p = [[0 for _ in range(10)] for _2 in range(10)]
ans = 0
for i in range(1, n+1):
  l = int(str(i)[0])
  r = int(str(i)[-1])
  ans += 2 * p[r][l]
  p[l][r] += 1
  if l == r:
    ans += 1
print(ans)

Problem: p02792
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
arr = [0]*100
for num in range(1,N):
  arr[int(str(num)[0]+str(num)[-1])] += 1
print(sum([arr[i*10+j]*arr[j*10+i]  for i in range(10) for j in range(10)]))

Failing test case input:
2011

Expected output:
40631


Actual output:
40409


Fixed submission (verdict: Accepted):
N = int(input())
arr = [0]*100
for num in range(1,N+1):
  arr[int(str(num)[0]+str(num)[-1])] += 1
print(sum([arr[i*10+j]*arr[j*10+i]  for i in range(10) for j in range(10)]))
Problem: p02792
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    import sys
    from collections import defaultdict

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    nd = defaultdict(int)
    for i in range(1, n):
        tmp = str(i)
        h, t  = int(tmp[0]), int(tmp[-1])
        nd[(h, t)] += 1
    
    ans = 0
    for i in range(1, 10):
        for j in range(1, 10):
            ans += nd[(i, j)]*nd[(j, i)]
    print(ans)



    
if __name__ == '__main__':
    main()

Failing test case input:
3093

Expected output:
95976


Actual output:
95933


Fixed submission (verdict: Accepted):
def main():
    import sys
    from collections import defaultdict

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    nd = defaultdict(int)
    for i in range(1, n+1):
        tmp = str(i)
        h, t  = int(tmp[0]), int(tmp[-1])
        nd[(h, t)] += 1
    
    ans = 0
    for i in range(1, 10):
        for j in range(1, 10):
            ans += nd[(i, j)]*nd[(j, i)]
    print(ans)



    
if __name__ == '__main__':
    main()

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

import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

n = int(input())
cnt = [[0] * 10 for _ in range(10)]

for i in range(n):
    s = str(i)
    front = int(s[0])
    end = int(s[-1])
    cnt[front][end] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += cnt[i][j] * cnt[j][i]
print(ans)

Failing test case input:
2424

Expected output:
58947


Actual output:
58925


Fixed submission (verdict: Accepted):

import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

n = int(input())
cnt = [[0] * 10 for _ in range(10)]

for i in range(1, n+1):
    s = str(i)
    front = int(s[0])
    end = int(s[-1])
    cnt[front][end] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += cnt[i][j] * cnt[j][i]
print(ans)

Problem: p02792
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

ans = 0
C = [ [0 for i in range(10)] for i in range(10)]

for i in range(1,N):
  first_num = int(str(i)[0])
  last_num = int(str(i)[-1])
  C[first_num][last_num] += 1

for first_num in range(10):
  for last_num in range(10):
    ans += C[first_num][last_num] * C[last_num][first_num]

print(ans)


Failing test case input:
816

Expected output:
6701


Actual output:
6679


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

ans = 0
C = [ [0 for i in range(10)] for i in range(10)]

for i in range(1,N+1):
  first_num = int(str(i)[0])
  last_num = int(str(i)[-1])
  C[first_num][last_num] += 1

for first_num in range(1,10):
  for last_num in range(1,10):
    ans += C[first_num][last_num] * C[last_num][first_num]

print(ans)