s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s118980036 | p02255 | u022407960 | 1477842668 | Python | Python | py | Runtime Error | 0 | 0 | 227 | n = int(input())
a = list(map(int, raw_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(str(s) for s in a) |
s697761117 | p02255 | u022407960 | 1477842820 | Python | Python | py | Runtime Error | 0 | 0 | 227 | n = int(input())
a = list(map(int, raw_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(str(s) for s in a) |
s036997999 | p02255 | u022407960 | 1477842866 | Python | Python | py | Runtime Error | 0 | 0 | 227 | n = int(input())
a = list(map(int, raw_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(str(s) for s in a) |
s385477981 | p02255 | u022407960 | 1477842938 | Python | Python3 | py | Runtime Error | 0 | 0 | 728 |
from __future__ import print_function
class Solution:
"""
@param prices: Given an integer array
@return: Maximum profit
"""
@staticmethod
def insertion_sort():
# write your code here
array_length = raw_input()
unsorted_array = list(map(int, raw_input().split()))
for i in range(1, array_length):
v = unsorted_array[i]
j = i - 1
while j >= 0 and unsorted_array[j] > v:
unsorted_array[j + 1] = unsorted_array[j]
j -= 1
unsorted_array[j + 1] = v
print(" ".join(str(i) for i in unsorted_array))
if __name__ == '__main__':
solution = Solution()
solution.insertion_sort() |
s522038984 | p02255 | u022407960 | 1477843727 | Python | Python | py | Runtime Error | 0 | 0 | 743 |
from __future__ import print_function
class Solution:
"""
@param prices: Given an integer array
@return: Maximum profit
"""
@staticmethod
def insertion_sort():
# write your code here
array_length = int(raw_input())
unsorted_array = map(int, raw_input().line.strip().split(" "))
for i in range(1, array_length):
v = unsorted_array[i]
j = i - 1
while j >= 0 and unsorted_array[j] > v:
unsorted_array[j + 1] = unsorted_array[j]
j -= 1
unsorted_array[j + 1] = v
print(" ".join(str(i) for i in unsorted_array))
if __name__ == '__main__':
solution = Solution()
solution.insertion_sort() |
s517773632 | p02255 | u022407960 | 1477844607 | Python | Python | py | Runtime Error | 0 | 0 | 758 | #!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
class Solution:
"""
@param prices: Given an integer array
@return: Maximum profit
"""
@staticmethod
def insertion_sort():
# write your code here
array_length = int(input())
unsorted_array = [int(x) for x in input().split()]
for i in range(array_length):
v = unsorted_array[i]
j = i - 1
while j >= 0 and unsorted_array[j] > v:
unsorted_array[j + 1] = unsorted_array[j]
j -= 1
unsorted_array[j + 1] = v
print(" ".join(map(str, unsorted_array)))
if __name__ == '__main__':
solution = Solution()
solution.insertion_sort() |
s823613085 | p02255 | u534156032 | 1478581254 | Python | Python3 | py | Runtime Error | 0 | 0 | 214 | n = int(input())
a = [int(i) for i 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(map(int, a))) |
s660691204 | p02255 | u209358977 | 1480951931 | Python | Python3 | py | Runtime Error | 0 | 0 | 272 | def insertion_sort(A, N):
for i in range(len(N):
v = A[i]
j = i - 1
while j >= 0 and a[j] > v:
A[j + 1] = A[j]
j--
A[j + 1] = v
if __name__=='__main__':
n=int(input())
A=list(map(int,input().split()))
insertion_sort(A)
print(*A) |
s597649917 | p02255 | u929986002 | 1482078829 | Python | Python3 | py | Runtime Error | 20 | 7616 | 398 | N = int(input())
#print(N)
card = list(map(int, input().split()))
#print(card)
for i in range(N):
v = card[i]
j = i - 1
while j >= 0 and card[j] > v:
card[j+1] = card[j]
j = j -1
card[j+1] = v
#print(card)
card_str = ""
for k in range(N-1):
card_str += str(card[k])
card_str += " "
card_str += str(card[k+1])
print(card_str) |
s695273732 | p02255 | u475480520 | 1483534264 | Python | Python | py | Runtime Error | 0 | 0 | 389 | #input number
n = raw_input()
if n < 1 and n > 100:
exit()
# input elements
l = raw_input()
elements = l.split()
for e in elements:
o += str(e) + ' '
print o
for i in range(1, int(n)):
key = elements[i]
j = i - 1
while j >= 0 and elements[j] > key:
elements[j + 1] = elements[j]
j -= 1
elements[j + 1] = key
# output
o = ''
for e in elements:
o += str(e) + ' '
print o |
s577818310 | p02255 | u852745524 | 1483807897 | Python | Python3 | py | Runtime Error | 0 | 0 | 341 | # coding:utf-8
def insert_sort(list):
for i in range(1, n):
temp = list[i] # ?§??????????????´?
while i>=1 and temp<list[i-1]: list[i]=list[i-1] ; i-=1
list[i] = temp
s = " ".join(list) ; print(s)
s = " ".join(list) ; print(s)
n=int(input())
buff = list(map(int,input().split()))
insert_sort(buff) |
s224622646 | p02255 | u867503285 | 1484317563 | Python | Python3 | py | Runtime Error | 0 | 0 | 755 | def insertion_sort(target_list, leng):
'????????????????????????????????\???????????§??????????????????????????¨?????????'
sorted_list = [target_list.pop(0)]
for target in target_list[:]:
print(('{} ' * (leng - 1)).format(*sorted_list,
*target_list[0:-1]), end='')
print(target_list[-1])
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(('{} ' * (N - 1)).format(*sorted_list[0:-1]), end='')
print(sorted_list[-1], end='')
N = int(input())
A = [int(s) for s in input().split()]
insertion_sort(A, N) |
s906592808 | p02255 | u867503285 | 1484317821 | Python | Python3 | py | Runtime Error | 0 | 0 | 666 | def insertion_sort(target_list, leng):
sorted_list = [target_list.pop(0)]
for target in target_list[:]:
print(('{} ' * (leng - 1)).format(*sorted_list,
*target_list[0:-1]), end='')
print(target_list[-1])
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(('{} ' * (N - 1)).format(*sorted_list[0:-1]), end='')
print(sorted_list[-1], end='')
N = int(input())
A = [int(s) for s in input().split()]
insertion_sort(A, N) |
s044624504 | p02255 | u867503285 | 1484318726 | Python | Python3 | py | Runtime Error | 0 | 0 | 714 | def insertion_sort(target_list, leng):
'????????????????????????????????\???????????§??????????????????????????¨?????????'
sorted_list = [target_list.pop(0)]
for target in target_list[:]:
print(('{} ' * (leng - 1)).format(*sorted_list, *target_list[0:-1]), end='')
print(target_list[-1])
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(('{} ' * (N - 1)).format(*sorted_list[0:-1]), end='')
print(sorted_list[-1], end='')
N = int(input())
A = [int(s) for s in input().split()]
insertion_sort(A, N) |
s407086429 | p02255 | u918276501 | 1484592833 | Python | Python3 | py | Runtime Error | 0 | 0 | 372 | class sort:
def __init__(self, num):
self.num = num
def insert(self, lst):
print(*lst)
for i in range(1,self.num):
j = i - 1
while (j >= 0) * (lst[j] > lst[i]):
j -= 1
lst[j+1:i+1] = lst[i] , *lst[j+1:i]
print(*lst)
sort(int(input())).insert(list(map(int,input().split()))) |
s009318440 | p02255 | u918276501 | 1484592916 | Python | Python3 | py | Runtime Error | 0 | 0 | 391 | class sort:
def __init__(self, num):
self.num = num
def insert(self, lst):
print(*lst)
for i in range(1,self.num):
j = i - 1
while (j >= 0) * (lst[j] > lst[i]):
j -= 1
lst[j+1:i+1] = lst[i] , *lst[j+1:i]
print(*lst)
n = int(input())
l = list(map(int,input().split()))
s = sort(n)
s.insert(l) |
s388066642 | p02255 | u918276501 | 1484593098 | Python | Python3 | py | Runtime Error | 0 | 0 | 397 | class sort1:
def __init__(self, num):
self.num = num
def p_insert(self, lst):
print(*lst)
for i in range(1,self.num):
j = i - 1
while (j >= 0) * (lst[j] > lst[i]):
j -= 1
lst[j+1:i+1] = lst[i] , *lst[j+1:i]
print(*lst)
n = int(input())
l = list(map(int,input().split()))
s = sort1(n)
s.p_insert(l) |
s775306741 | p02255 | u918276501 | 1484593360 | Python | Python3 | py | Runtime Error | 0 | 0 | 180 | input()
lst = input().split()
for i in range(len(lst)):
j = i - 1
while (j >= 0) * (lst[j] > lst[i]):
j -= 1
lst[j+1:i+1] = lst[i] , *lst[j+1:i]
print(*lst) |
s702368443 | p02255 | u918276501 | 1484593390 | Python | Python3 | py | Runtime Error | 0 | 0 | 195 | input()
lst = list(map(int,input().split()))
for i in range(len(lst)):
j = i - 1
while (j >= 0) * (lst[j] > lst[i]):
j -= 1
lst[j+1:i+1] = lst[i] , *lst[j+1:i]
print(*lst) |
s649925264 | p02255 | u918276501 | 1484593693 | Python | Python3 | py | Runtime Error | 0 | 0 | 201 | input()
lst = list(map(int,input().split()))
for i in range(len(lst)):
j = min(0, i-1)
while (j >= 0) * (lst[j] > lst[i]):
j -= 1
lst[j+1:i+1] = lst[i] , *lst[j+1:i]
print(*lst) |
s598464613 | p02255 | u918276501 | 1484594082 | Python | Python3 | py | Runtime Error | 0 | 0 | 208 | n = int(input())
lst = list(map(int, input().split()))
print(*lst)
for i in range(1,n):
j = i-1
while j >= 0 and lst[j] > lst[i]:
j -= 1
lst[j+1:i+1] = lst[i] , *lst[j+1:i]
print(*lst) |
s753138896 | p02255 | u162598098 | 1485093432 | Python | Python3 | py | Runtime Error | 0 | 0 | 345 | def insertionSort(lis,leng):
for i in range(leng):
v = lis[i]
j = i - 1
while j >= 0 and lis[j] > v:
lis[j+1] = lis[j]
j = j-1
lis[j+1]=v
print("".join(lis))
if __name__ == "__main__":
leng=int(input())
lis=map(int,input().split())
insertionSort(lis,leng) |
s768578811 | p02255 | u162598098 | 1485093456 | Python | Python3 | py | Runtime Error | 0 | 0 | 345 | def insertionSort(lis,leng):
for i in range(leng):
v = lis[i]
j = i - 1
while j >= 0 and lis[j] > v:
lis[j+1] = lis[j]
j = j-1
lis[j+1]=v
print("".join(lis))
if __name__ == "__main__":
leng=int(input())
lis=map(int,input().split())
insertionSort(lis,leng) |
s668399408 | p02255 | u162598098 | 1485093506 | Python | Python3 | py | Runtime Error | 0 | 0 | 349 | def insertionSort(lis,leng):
for i in range(leng):
v = lis[i]
j = i - 1
while j >= 0 and lis[j] > v:
lis[j+1] = lis[j]
j = j-1
lis[j+1]=v
print("".join(lis))
if __name__ == "__main__":
lengg=int(input())
liss=map(int,input().split())
insertionSort(liss,lengg) |
s000868113 | p02255 | u162598098 | 1485093527 | Python | Python3 | py | Runtime Error | 0 | 0 | 355 | def insertionSort(lis,leng):
for i in range(leng):
v = lis[i]
j = i - 1
while j >= 0 and lis[j] > v:
lis[j+1] = lis[j]
j = j-1
lis[j+1]=v
print("".join(lis))
if __name__ == "__main__":
lengg=int(input())
liss=list(map(int,input().split()))
insertionSort(liss,lengg) |
s736448918 | p02255 | u548155360 | 1487383330 | Python | Python3 | py | Runtime Error | 0 | 0 | 208 | 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({A[k]})) for k in range(N)] |
s146425362 | p02255 | u548155360 | 1487383366 | Python | Python3 | py | Runtime Error | 0 | 0 | 206 | 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(A[k])) for k in range(N)] |
s193901994 | p02255 | u395334793 | 1491823796 | Python | Python3 | py | Runtime Error | 0 | 0 | 210 | n = int(input())
A = list(map(int,input().split()))
for i in range(1,len(A)+1):
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 |
s948724850 | p02255 | u796784914 | 1492842907 | Python | Python | py | Runtime Error | 0 | 0 | 295 | N = input()
A = map(int,raw_input().split())
for i in range(N-1):
print A[i],
print A[-1]
for i in range(1,N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
for i in range(N-1):
print A[i],
print A[-1] |
s448837450 | p02255 | u905808447 | 1495547964 | Python | Python | py | Runtime Error | 0 | 0 | 474 | import sys
def echo(A):
for i, a in enumerate(A):
if i < len(A) - 1:
sys.stdout('%d ' % a)
else:
sys.stdout('%d\n' % a)
def insertionSort(A, N):
echo(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
echo(A)
if __name__ == '__main__':
n = raw_input()
a = raw_input()
insertionSort(a, n) |
s046599760 | p02255 | u905808447 | 1495548006 | Python | Python | py | Runtime Error | 0 | 0 | 436 | import sys
def echo(A):
for i, a in enumerate(A):
if i < len(A) - 1:
sys.stdout('%d ' % a)
else:
sys.stdout('%d\n' % a)
def insertionSort(A, N):
echo(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
echo(A)
n = raw_input()
a = raw_input()
insertionSort(a, n) |
s510265433 | p02255 | u905808447 | 1495548254 | Python | Python | py | Runtime Error | 0 | 0 | 551 | import sys, re
def echo(A):
for i, a in enumerate(A):
if i < len(A) - 1:
sys.stdout('%d ' % a)
else:
sys.stdout('%d\n' % a)
def insertionSort(A, N):
echo(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
echo(A)
n = int(raw_input())
a_text = raw_input()
splits = re.split(a_text)
a = []
for i, s in enumerate(splits):
if s:
a.append(int(s))
insertionSort(a, n) |
s182421372 | p02255 | u905808447 | 1495548332 | Python | Python | py | Runtime Error | 0 | 0 | 556 | import sys, re
def echo(A):
for i, a in enumerate(A):
if i < len(A) - 1:
sys.stdout('%d ' % a)
else:
sys.stdout('%d\n' % a)
def insertionSort(A, N):
echo(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
echo(A)
n = int(raw_input())
a_text = raw_input()
splits = re.split(' ', a_text)
a = []
for i, s in enumerate(splits):
if s:
a.append(int(s))
insertionSort(a, n) |
s183236812 | p02255 | u650790815 | 1495689687 | Python | Python3 | py | Runtime Error | 0 | 0 | 224 | n = input()
lst = list(map(int,input().split())
for i in range(n):
key = lst[i]
j = i-1
while j >= 0 and lst[j] > key:
lst[j+1] = lst[j]
j -= 1
lst[j+1] = key
print(' '.join(map(str,lst))) |
s126378891 | p02255 | u650790815 | 1496026497 | Python | Python3 | py | Runtime Error | 0 | 0 | 211 | n = int(input())
a = map(int,input().split())
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 -= 1
a[j+1] = key
print(' '.join(map(str,a))) |
s632015083 | p02255 | u650790815 | 1496026717 | Python | Python3 | py | Runtime Error | 0 | 0 | 225 | n = int(input())
a = list(map(int,input().split().strip())
for i in range(n):
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(' '.join(map(str,a))) |
s662326363 | p02255 | u650790815 | 1496026927 | Python | Python3 | py | Runtime Error | 0 | 0 | 223 | n = int(input())
a = list(map(int,input().strip().split())
for i in range(n):
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(' '.join(map(str,a))) |
s251026644 | p02255 | u591467586 | 1498035003 | Python | Python3 | py | Runtime Error | 0 | 0 | 341 | def insertionSort(N,A):
for i in range(0,N):
innum = A[i]
j = j -1
while j>0 and A[i] > innum:
A[j+1] = A[j]
j = j -1
A[j+1] = innum
B[k] = A
return B
if __name__ == "__main__":
N = input()
A = input()
for i in range(0,B.length()):
print(B[i])
|
s383108543 | p02255 | u293826729 | 1498124920 | Python | Python3 | py | Runtime Error | 0 | 0 | 249 |
l = input
A = input().strip()
for i in range(1,l):
j = i-1
v = A[i]
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
s = [str(a) for a in A]
print(' '.join(s))
|
s062323332 | p02255 | u293826729 | 1498124931 | Python | Python3 | py | Runtime Error | 0 | 0 | 249 |
l = input
A = input().strip()
for i in range(1,l):
j = i-1
v = A[i]
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
s = [str(a) for a in A]
print(' '.join(s))
|
s159468557 | p02255 | u293826729 | 1498124983 | Python | Python3 | py | Runtime Error | 0 | 0 | 250 |
l = input
A = input().strip()
for i in xrange(1,l):
j = i-1
v = A[i]
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
s = [str(a) for a in A]
print(' '.join(s))
|
s428582794 | p02255 | u293826729 | 1498125199 | Python | Python3 | py | Runtime Error | 0 | 0 | 275 |
l = int(input)
A = [ int(x) for x in input().strip()]
for i in xrange(1,l):
j = i-1
v = A[i]
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
s = [str(a) for a in A]
print(' '.join(s))
|
s670026922 | p02255 | u278938795 | 1498724511 | Python | Python3 | py | Runtime Error | 0 | 0 | 296 | import sys
def printlist(lst):
for l in lst:
print(l),
print
N = int(sys.stdin.readline().strip())
A = sys.stdin.readline().strip().split(" ")
A = map(lambda x:int(x),A)
for i in range(0,N):
temp = A[i]
j = i-1
while j>=0 and A[j]>temp:
A[j+1] = A[j]
j-=1
A[j+1]=temp
printlist(A) |
s798549048 | p02255 | u490583481 | 1499690772 | Python | Python | py | Runtime Error | 0 | 0 | 315 | def insertionSort(*args):
l = list(args)
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))
n = input()
l = [input() for i in range(n)]
insertionSort(*l) |
s741636758 | p02255 | u988834390 | 1502770679 | Python | Python | py | Runtime Error | 0 | 0 | 479 | """
1 insertionSort(A, N) // N??????????´??????????0-?????????????????????A
2 for i ??? 1 ?????? N-1 ?????§
3 v = A[i]
4 j = i - 1
5 while j >= 0 ?????? A[j] > v
6 A[j+1] = A[j]
7 j--
8 A[j+1] = v
"""
N=int(input())
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 j in range(N):
print(str(A[j]),end=' ')
if j==N-1:
print('\b') |
s412318838 | p02255 | u853619096 | 1502861187 | Python | Python3 | py | Runtime Error | 0 | 0 | 193 | n=int(input())
z=list(map(int,input().split()))
for i in range(1,n):
v=z[i]
j=i-1
while j>=0 and z[j]>v:
z[j+1]=z[j]
j-=1
z[j+1]=v
print(''.join(z)) |
s126733764 | p02255 | u733159526 | 1503289027 | Python | Python3 | py | Runtime Error | 0 | 0 | 717 | def output(list):
for i,row in enumerate(list):
if i == 0:
print(row,end='')
else:
print('',row,end='')
s = input()
list = list(map(int,input().split()))
output(list)
print()
#print(list)
start = time.time()
i = 0
for count in range(len(list)-1):
# Judge: now > next
if list[i] > list[i+1]:
# Change: now > next
ins_num = list[i+1]
list[i+1] = list[i]
list[i] = ins_num
j = i - 1
while j >= 0:
if list[j] > ins_num:
list[j+1] = list[j]
list[j] = ins_num
j -= 1
output(list)
else:
output(list)
print()
i += 1 |
s507572442 | p02255 | u733159526 | 1503289253 | Python | Python3 | py | Runtime Error | 0 | 0 | 962 | def output(list):
for i,row in enumerate(list):
if i == 0:
print(row,end='')
else:
print('',row,end='')
def main():
s = input()
s_list = []
s_list = list(map(int,input().split()))
output(s_list)
print()
#print(list)
start = time.time()
i = 0
for count in range(len(s_list)-1):
# Judge: now > next
if s_list[i] > s_list[i+1]:
# Change: now > next
ins_num = s_list[i+1]
s_list[i+1] = s_list[i]
s_list[i] = ins_num
j = i - 1
while j >= 0:
if s_list[j] > ins_num:
s_list[j+1] = s_list[j]
s_list[j] = ins_num
j -= 1
output(s_list)
else:
output(s_list)
print()
i += 1
result = time.time() - start
#print(result)
#print(list)
if __name__ == '__main__':
main() |
s030585234 | p02255 | u821624310 | 1503306571 | Python | Python3 | py | Runtime Error | 0 | 0 | 222 | import output
N = int(input())
A = [int(n) for n in input().split()]
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
output.print_1(A) |
s587549472 | p02255 | u821624310 | 1503306955 | Python | Python3 | py | Runtime Error | 0 | 0 | 240 | import output
N = int(input())
A = [int(n) for n in input().split()]
output.print_1(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
output.print_1(A) |
s201415145 | p02255 | u153665391 | 1504616966 | Python | Python3 | py | Runtime Error | 0 | 0 | 244 | nums = int(input())
array = [int(n) for n in input().split()]
for i in range( 1, nums ):
v = array[i]
j = i - 1
while j >= 0 and array[j] > v:
array[j+1] = array[j]
j -= 1
array[j+1] = v
print array |
s541214569 | p02255 | u153665391 | 1504618230 | Python | Python3 | py | Runtime Error | 0 | 0 | 234 | nums = int(input())
array = list(map(int, input().split()))
for i in range( 1, nums ):
v = array[i]
j = i - 1
while j >= 0 and array[j] > v:
array[j+1] = array[j]
j -= 1
array[j+1] = v
print array |
s724469568 | p02255 | u043968625 | 1509277717 | Python | Python3 | py | Runtime Error | 0 | 0 | 349 | kazu=input()
A=[int(i) for i in range(kazu)]
# kazu=6
# A=[5,2,4,6,1,3]
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]) |
s386141160 | p02255 | u043968625 | 1509278620 | Python | Python3 | py | Runtime Error | 0 | 0 | 359 | kazu=int(input())
A=[int(i) for i in input().spllit()]
# kazu=6
# A=[5,2,4,6,1,3]
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]) |
s490684059 | p02255 | u335508235 | 1509330708 | Python | Python | py | Runtime Error | 0 | 0 | 229 | #coding: UTF-8
x=[4,50,3,10,89,37,1,15]
for i in range(1,len(x)):
j=i
while (j>0) and (x[j-1] > x[j])
:
tmp=x[j-1]
x[j-1]=x[j]
x[j]=tmp
j -= 1
print x
print "-"*30
print x |
s299016287 | p02255 | u335508235 | 1509330809 | Python | Python | py | Runtime Error | 0 | 0 | 218 | #coding: UTF-8
x=[5,2,6,1,3]
for i in range(1,len(x)):
j=i
while (j>0) and (x[j-1] > x[j])
:
tmp=x[j-1]
x[j-1]=x[j]
x[j]=tmp
j -= 1
print x
print "-"*30
print x |
s703333403 | p02255 | u335508235 | 1509331208 | Python | Python | py | Runtime Error | 0 | 0 | 206 | #coding: UTF-8
x=[4,50,3,10,89,37,1,15]
for i in range(1,len(x)):
j=i
while (j>1) and (x[j-1] > x[j])
:
tmp=x[j-1]
x[j-1]=x[j]
x[j]=tmp
j -= 1
print x |
s760561483 | p02255 | u102664642 | 1509777254 | Python | Python3 | py | Runtime Error | 0 | 0 | 171 | n = map(int, input())
l = map(int, input().split())
for i in range(n):
key = l[i + 1]
j = i
while j >= 0 and l[j] > key:
l[j+1] = l[j]
j -= 1
l[j+1] = key |
s727582024 | p02255 | u102664642 | 1509777751 | Python | Python3 | py | Runtime Error | 0 | 0 | 183 | n = list(map(int, input()))
l = list(map(int, input().split()))
for i in range(n):
key = l[i + 1]
j = i
while j >= 0 and l[j] > key:
l[j+1] = l[j]
j -= 1
l[j+1] = key |
s104646924 | p02255 | u102664642 | 1509798398 | Python | Python3 | py | Runtime Error | 0 | 0 | 225 | n = int(input())
l = [int(m) for m in input().split() ]
print(n)
for i in range(1,n):
key = l[i]
j = i 0 1
while j >= 0 and l[j] > key:
l[j+1] = l[j]
j -= 1
l[j+1] = key
print(" ".join(str(x) for x in l)) |
s642019385 | p02255 | u626266743 | 1510019960 | Python | Python3 | py | Runtime Error | 0 | 0 | 197 | 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) |
s202157377 | p02255 | u626266743 | 1510020041 | Python | Python3 | py | Runtime Error | 0 | 0 | 197 | 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) |
s699758636 | p02255 | u845643816 | 1510106901 | Python | Python3 | py | Runtime Error | 0 | 0 | 263 | N = int(input())
array = map(int, input().split())
print( array, split = ' ')
for i in range(N):
for j in reversed(range(i-1)):
if array[i] < array[j]:
array[j + 1] = array[j]
else:
break
print( array, split = ' ') |
s479939789 | p02255 | u845643816 | 1510107233 | Python | Python3 | py | Runtime Error | 0 | 0 | 245 | N = int(input())
array = map(int, input().split())
print( array, split = ' ')
for i in range(N):
for j in reversed(range(i-1)):
if array[i] > array[j]:
break
array[j + 1] = array[j]
print( array, split = ' ') |
s451221397 | p02255 | u845643816 | 1510107247 | Python | Python3 | py | Runtime Error | 0 | 0 | 219 | N = int(input())
array = map(int, input().split())
print( array)
for i in range(N):
for j in reversed(range(i-1)):
if array[i] > array[j]:
break
array[j + 1] = array[j]
print( array) |
s666422789 | p02255 | u845643816 | 1510107953 | Python | Python3 | py | Runtime Error | 0 | 0 | 219 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(N):
for j in reversed(range(i-1)):
if array[i] > array[j]:
break
array[j + 1] = array[j]
print(*array) |
s199540746 | p02255 | u845643816 | 1510107984 | Python | Python3 | py | Runtime Error | 0 | 0 | 222 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N):
for j in reversed(range(i-1)):
if array[i] > array[j]:
break
array[j + 1] = array[j]
print(*array) |
s342375121 | p02255 | u845643816 | 1510107992 | Python | Python3 | py | Runtime Error | 0 | 0 | 225 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N):
for j in reversed(range(1, i-1)):
if array[i] > array[j]:
break
array[j + 1] = array[j]
print(*array) |
s834083830 | p02255 | u845643816 | 1510108029 | Python | Python3 | py | Runtime Error | 0 | 0 | 231 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N):
for j in list(reversed(range(1, i-1))):
if array[i] > array[j]:
break
array[j + 1] = array[j]
print(*array) |
s786880479 | p02255 | u845643816 | 1510108141 | Python | Python3 | py | Runtime Error | 0 | 0 | 264 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N):
for j in list(reversed(range(i-1))):
if array[i] > array[j]:
array[j + 1] = array[i]
break
array[j + 1] = array[j]
print(*array) |
s946688382 | p02255 | u845643816 | 1510108176 | Python | Python3 | py | Runtime Error | 0 | 0 | 264 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N):
for j in list(reversed(range(i-1))):
if array[i] > array[j]:
array[j + 1] = array[i]
break
array[j + 1] = array[j]
print(*array) |
s481332886 | p02255 | u845643816 | 1510108341 | Python | Python3 | py | Runtime Error | 0 | 0 | 269 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N-1):
for j in list(reversed(1, range(i-1))):
if array[i] > array[j]:
array[j + 1] = array[i]
break
array[j + 1] = array[j]
print(*array) |
s368456293 | p02255 | u845643816 | 1510108354 | Python | Python3 | py | Runtime Error | 0 | 0 | 269 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N-1):
for j in list(reversed(range(1, i-1))):
if array[i] > array[j]:
array[j + 1] = array[i]
break
array[j + 1] = array[j]
print(*array) |
s373060062 | p02255 | u845643816 | 1510108835 | Python | Python3 | py | Runtime Error | 0 | 0 | 240 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N-1):
for j in list(reversed(range(1, i-1))):
if array[i] > array[j]:
print(*rray)
array[j + 1] = array[j]
print(*array) |
s025316858 | p02255 | u845643816 | 1510108843 | Python | Python3 | py | Runtime Error | 0 | 0 | 230 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N-1):
for j in list(range(1, i-1)):
if array[i] > array[j]:
print(*rray)
array[j + 1] = array[j]
print(*array) |
s166855676 | p02255 | u845643816 | 1510108855 | Python | Python3 | py | Runtime Error | 0 | 0 | 187 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N-1):
for j in list(range(1, i-1)):
if array[i] > array[j]:
array[j + 1] = array[j] |
s967080596 | p02255 | u845643816 | 1510108864 | Python | Python3 | py | Runtime Error | 0 | 0 | 181 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N-1):
for j in range(1, i-1):
if array[i] > array[j]:
array[j + 1] = array[j] |
s448166226 | p02255 | u845643816 | 1510108942 | Python | Python3 | py | Runtime Error | 0 | 0 | 184 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N-1):
for j in list(reversed(range(1, i-1))):
array[j + 1] = array[j]
print(*array) |
s223855472 | p02255 | u845643816 | 1510108964 | Python | Python3 | py | Runtime Error | 0 | 0 | 251 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N-1):
for j in range(1, i):
if array[i] > array[j]:
array[j + 1] = array[i]
break
array[j + 1] = array[j]
print(*array) |
s503506716 | p02255 | u845643816 | 1510108988 | Python | Python3 | py | Runtime Error | 0 | 0 | 269 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N-1):
for j in list(reversed(range(1, i-1))):
if array[i] > array[j]:
array[j + 1] = array[i]
else:
array[j + 1] = array[j]
print(*array) |
s827654682 | p02255 | u845643816 | 1510109141 | Python | Python3 | py | Runtime Error | 0 | 0 | 269 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N):
for j in array(reversed(range(1, i-1))):
if array[i] > array[j]:
array[j + 1] = array[i]
break
array[j + 1] = array[j]
print(*array) |
s221038469 | p02255 | u845643816 | 1510109151 | Python | Python3 | py | Runtime Error | 0 | 0 | 252 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N):
for j in range(1, i-1):
if array[i] > array[j]:
array[j + 1] = array[i]
break
array[j + 1] = array[j]
print(*array) |
s476425403 | p02255 | u845643816 | 1510109311 | Python | Python3 | py | Runtime Error | 0 | 0 | 268 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N):
for j in list(reversed(range(1, i-1))):
if array[i] > array[j]:
array[j + 1] = array[i]
break
array[j + 1] = array[j]
print(*array) |
s856624655 | p02255 | u845643816 | 1510109701 | Python | Python3 | py | Runtime Error | 0 | 0 | 268 | N = int(input())
array = map(int, input().split())
print(*array)
for i in range(1, N):
for j in list(reversed(range(0, i-1))):
if array[i] > array[j]:
array[j + 1] = array[i]
break
array[j + 1] = array[j]
print(*array) |
s536794210 | p02255 | u426534722 | 1510153745 | Python | Python3 | py | Runtime Error | 0 | 0 | 304 | def insertionSort(n, A):
print(*A)
for i in range(1, n):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
print(*A)
n = int(readline())
A = [int(j) for j in readline().split(" ")]
insertionSort(n, A) |
s673222136 | p02255 | u933096856 | 1510304975 | Python | Python | py | Runtime Error | 0 | 0 | 118 | n=int(raw_input())
l=list(map(int, raw_input().split()))
for i in range(1,n+1):
l[0:i]=sorted(l[0:i])
print *l |
s322153026 | p02255 | u933096856 | 1510304991 | Python | Python | py | Runtime Error | 0 | 0 | 118 | n=int(raw_input())
l=list(map(int, raw_input().split()))
for i in range(1,n+1):
l[0:i]=sorted(l[0:i])
print *l |
s028801968 | p02255 | u335508235 | 1510558602 | Python | Python | py | Runtime Error | 0 | 0 | 99 | for i in range(1,len(A)-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 |
s179347713 | p02255 | u335508235 | 1510558679 | Python | Python | py | Runtime Error | 0 | 0 | 99 | for i in range(1,len(A)-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 |
s476746320 | p02255 | u335508235 | 1510558853 | Python | Python | py | Runtime Error | 0 | 0 | 115 | A=[1,22,3,1,11]
for i in range(1,len(A)-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 |
s857708736 | p02255 | u335508235 | 1510559030 | Python | Python | py | Runtime Error | 0 | 0 | 113 | A=[1,22,3,1,11]
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 |
s276840728 | p02255 | u335508235 | 1510559692 | Python | Python | py | Runtime Error | 0 | 0 | 109 | A=input()
for i in range(1,len(A)-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 |
s248622757 | p02255 | u335508235 | 1510559923 | Python | Python | py | Runtime Error | 0 | 0 | 114 | A=[5,6,4,1,11]
for i in range(1,len(A)-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 |
s894240497 | p02255 | u335508235 | 1510560033 | Python | Python | py | Runtime Error | 0 | 0 | 116 | A=[5,6,4,1,11]
for i in range(1,len(A)-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 |
s202942185 | p02255 | u335508235 | 1510560164 | Python | Python | py | Runtime Error | 0 | 0 | 134 | A=[5,6,4,1,11]
for i in range(1,len(A)-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 A |
s930164096 | p02255 | u335508235 | 1510560219 | Python | Python | py | Runtime Error | 0 | 0 | 135 | A=[5,6,4,1,11]
for i in range(1,len(A)-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 A |
s045519640 | p02255 | u335508235 | 1510560299 | Python | Python | py | Runtime Error | 0 | 0 | 136 | A=[5,2,4,6,1,3]
for i in range(1,len(A)-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 A |
s438658788 | p02255 | u335508235 | 1510560429 | Python | Python | py | Runtime Error | 0 | 0 | 158 | A = [5,2,4,6,1,3]
for i in range(1, len(A) - 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 A |
s938665220 | p02255 | u335508235 | 1510560621 | Python | Python | py | Runtime Error | 0 | 0 | 174 | #coding: UTF-8
A = [5,2,4,6,1,3]
for i in range(1, len(A) - 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 A |
s660892116 | p02255 | u433154529 | 1510973383 | Python | Python3 | py | Runtime Error | 0 | 0 | 201 | n = int(input())
a = [int(i) for i in input().split()]
for i in range(len(a)):
v = a[i]
j = i
while j >= 0 and a[j]>v:
a[j+1] = a[j]
j-=1
a[j+1]=v
print(" ".join(a)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.