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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s575468813 | p02250 | u215151081 | 1494226453 | Python | Python3 | py | Runtime Error | 0 | 0 | 223 | T = input()
n = int(input())
P = input()
for a in range(n):
for i in range(len(T)-len(P)+1):
if T[i:i+len(P)] == P:
print(1)
return
else:
print(0)
return: |
s863908366 | p02250 | u215151081 | 1494226522 | Python | Python3 | py | Runtime Error | 0 | 0 | 235 | T = input()
n = int(input())
P = input()
for a in range(n):
for i in range(len(T)-len(P)+1):
if T[i:i+len(P)] == P:
print(1)
return
else:
print(0)
return
|
s868436407 | p02250 | u859725751 | 1516590377 | Python | Python3 | py | Runtime Error | 20 | 5592 | 538 | x = input()
n = int(input())
def check(string,word):
search_state = 0
l = len(string)
i = 0
while (i < l):
# print(string[i])
if string[i+search_state] == word[search_state]:
search_state += 1
if search_state == len(word):
return 1
else:
i += max(search_state,1)
search_state = 0
return 0
# print(check(x,'baa'))
for i in range(n):
y = input()
print(check(x,y))
|
s542086509 | p02250 | u138546245 | 1527299120 | Python | Python3 | py | Runtime Error | 30 | 6004 | 1602 | from collections import defaultdict
class IndexMatch:
shift = 40
size = 33554393
def __init__(self, text):
self.text = text
self.index = self._create_index()
def _create_index(self):
index = defaultdict(list)
index[self.text[0]].append(0)
for i in range(1, len(self.text)):
index[self.text[i-1:i+1]].append(i-1)
index[self.text[i]].append(i)
return index
def match(self, search_text):
def _match(text):
ls = len(text)
if ls <= 2:
return [(i, i+ls-1) for i in self.index[text]]
mid = ls // 2
pre = _match(text[:mid])
post = _match(text[mid:])
if len(pre) == 0 or len(post) == 0:
return []
indices = []
for (s1, e1) in pre:
(s2, e2) = self._find(post, e1+1)
if s2 > 0:
indices.append(s1, e2)
return indices
return len(_match(search_text)) > 0
def _find(self, ts, i):
if len(ts) == 0:
return (-1, -1)
mid = len(ts) // 2
s, e = ts[mid]
if s > i:
return self._find(ts[mid+1:], i)
elif s < i:
return self._find(ts[:mid], i)
else:
return (s, e)
def run():
s1 = input()
n = int(input())
matcher = IndexMatch(s1)
for _ in range(n):
s2 = input()
if matcher.match(s2):
print(1)
else:
print(0)
if __name__ == '__main__':
run()
|
s948761143 | p02250 | u138546245 | 1527377299 | Python | Python3 | py | Runtime Error | 1610 | 130896 | 2059 | from collections import defaultdict, Counter
from math import floor, log
class NoMatch(Exception):
pass
class IndexMatch:
MAX_KEYLEN = 20
def __init__(self, text):
self.text = text
self.keylen = self._select_keylen()
self._create_index()
def _select_keylen(self):
chars = Counter(list(self.text))
return min(floor(log(len(self.text), len(chars))), self.MAX_KEYLEN)
def _create_index(self):
index = defaultdict(set)
particles = set()
for i in range(len(self.text)+1):
for j in range(max(i-self.keylen, 0), i):
if i - j < self.keylen // 2:
particles.add(self.text[j:i])
else:
index[self.text[j:i]].add(j)
self.index = index
self.particles = particles
def match(self, search_text):
def _match(lo, hi):
text = search_text[lo:hi]
if hi-lo <= self.keylen:
return self.index[text]
mid = (lo + hi) // 2
pre = _match(lo, mid)
post = _match(mid, hi)
if len(pre) == 0 or len(post) == 0:
raise NoMatch()
indices = set(i for i in pre if i+mid-lo in post)
return indices
if len(search_text) < self.keylen // 2:
return search_text in self.particles
try:
match = _match(0, len(search_text))
return len(match) > 0
except NoMatch:
return False
def run():
s1 = input()
n = int(input())
ss = []
for _ in range(n):
ss.append(input())
i = 0
maxsize = 100000
results = [False] * n
while i < n:
matcher = IndexMatch(s1[i:i+maxsize])
for j, s2 in enumerate(ss):
if not results[j]:
results[j] = matcher.match(s2)
i = i + maxsize - 1000
for result in results:
if result:
print(1)
else:
print(0)
if __name__ == '__main__':
run()
|
s379695372 | p02255 | u302561071 | 1531822013 | Python | Python | py | Runtime Error | 0 | 0 | 572 | def main()
n = int(input(),10)
sort_list = list()
for i in range(0,n):
sort_list.append(int(input(),10))
for i in range(1,n):
for j in range(0,n):
print(sort_list[j])
if j is not n - 1:
print(" ")
else:
print("\n")
tmp = sort_list[i]
int j = i - 1
while j >= 0 and sort_list[i] > v:
sort_list[j+1] = sort_list[j]
j--
sort_list[j+1] = v
if __name__ == '__main__':
main()
|
s682675913 | p02255 | u302561071 | 1531822087 | Python | Python | py | Runtime Error | 0 | 0 | 428 |
n = int(input(),10)
sort_list = list()
for i in range(0,n):
sort_list.append(int(input(),10))
for i in range(1,n):
for j in range(0,n):
print(sort_list[j])
if j is not n - 1:
print(" ")
else:
print("\n")
tmp = sort_list[i]
int j = i - 1
while j >= 0 and sort_list[i] > v:
sort_list[j+1] = sort_list[j]
j--
sort_list[j+1] = v
|
s807313626 | p02255 | u302561071 | 1531822104 | Python | Python | py | Runtime Error | 0 | 0 | 424 |
n = int(input(),10)
sort_list = list()
for i in range(0,n):
sort_list.append(int(input(),10))
for i in range(1,n):
for j in range(0,n):
print(sort_list[j])
if j is not n - 1:
print(" ")
else:
print("\n")
tmp = sort_list[i]
j = i - 1
while j >= 0 and sort_list[i] > v:
sort_list[j+1] = sort_list[j]
j--
sort_list[j+1] = v
|
s573171737 | p02255 | u302561071 | 1531822112 | Python | Python | py | Runtime Error | 0 | 0 | 430 |
n = int(input(),10)
sort_list = list()
for i in range(0,n):
sort_list.append(int(input(),10))
for i in range(1,n):
for j in range(0,n):
print(sort_list[j])
if j is not n - 1:
print(" ")
else:
print("\n")
tmp = sort_list[i]
j = i - 1
while j >= 0 and sort_list[i] > v:
sort_list[j+1] = sort_list[j]
j = j - 1
sort_list[j+1] = v
|
s314220832 | p02255 | u302561071 | 1531822135 | Python | Python | py | Runtime Error | 0 | 0 | 422 |
n = input()
sort_list = list()
for i in range(0,n):
sort_list.append(int(input(),10))
for i in range(1,n):
for j in range(0,n):
print(sort_list[j])
if j is not n - 1:
print(" ")
else:
print("\n")
tmp = sort_list[i]
j = i - 1
while j >= 0 and sort_list[i] > v:
sort_list[j+1] = sort_list[j]
j = j - 1
sort_list[j+1] = v
|
s896860089 | p02255 | u302561071 | 1531822154 | Python | Python | py | Runtime Error | 0 | 0 | 414 |
n = input()
sort_list = list()
for i in range(0,n):
sort_list.append(input())
for i in range(1,n):
for j in range(0,n):
print(sort_list[j])
if j is not n - 1:
print(" ")
else:
print("\n")
tmp = sort_list[i]
j = i - 1
while j >= 0 and sort_list[i] > v:
sort_list[j+1] = sort_list[j]
j = j - 1
sort_list[j+1] = v
|
s354536579 | p02255 | u302561071 | 1531822261 | Python | Python | py | Runtime Error | 0 | 0 | 393 |
n = input()
sort_list = list()
map(int, raw_input().split())
for i in range(1,n):
for j in range(0,n):
print(sort_list[j])
if j is not n - 1:
print(" ")
else:
print("\n")
tmp = sort_list[i]
j = i - 1
while j >= 0 and sort_list[i] > v:
sort_list[j+1] = sort_list[j]
j = j - 1
sort_list[j+1] = v
|
s229291565 | p02255 | u302561071 | 1531822288 | Python | Python | py | Runtime Error | 0 | 0 | 405 |
n = input()
sort_list = list()
sort_list = map(int, raw_input().split())
for i in range(1,n):
for j in range(0,n):
print(sort_list[j])
if j is not n - 1:
print(" ")
else:
print("\n")
tmp = sort_list[i]
j = i - 1
while j >= 0 and sort_list[i] > v:
sort_list[j+1] = sort_list[j]
j = j - 1
sort_list[j+1] = v
|
s317371367 | p02255 | u302561071 | 1531822320 | Python | Python | py | Runtime Error | 0 | 0 | 405 |
n = input()
sort_list = list()
sort_list = map(int, raw_input().split())
for i in range(1,n):
for j in range(0,n):
print(sort_list[j])
if j is not n - 1:
print(" ")
else:
print("\n")
tmp = sort_list[i]
j = i - 1
while j >= 0 and sort_list[j] > v:
sort_list[j+1] = sort_list[j]
j = j - 1
sort_list[j+1] = v
|
s630877028 | p02255 | u726631692 | 1532041678 | Python | Python3 | py | Runtime Error | 0 | 0 | 221 | dum = input()
data = [ int(i) for i in input().split(" ")]
for i in range(1,len(data)):
v = data[i]
j = i-1
while j>=0 and data[j] > v:
data[j+1]=data[j]
j-=1
else:
data[j+1]=v
print(' '.join(data))
|
s815024946 | p02255 | u525366883 | 1535086548 | Python | Python | py | Runtime Error | 0 | 0 | 197 | n = int(raw_input())
a = map(int, raw_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--
a[j+1] = v
print a
|
s361558174 | p02255 | u525366883 | 1535087270 | Python | Python | py | Runtime Error | 0 | 0 | 243 | n = int(raw_input())
a = map(int, raw_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--
a[j+1] = v
print " ".join(map(str, a))
|
s493321042 | p02255 | u260169299 | 1535147824 | Python | Python3 | py | Runtime Error | 0 | 0 | 1025 | *
* Created by heads on 8/24/2018.
*/
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
// Get numbers
int n = input.nextInt();
int[] nums = new int[n];
// fill array
for(int i = 0; i < n; i++){
nums[i] = input.nextInt();
}
insertSort(n, nums);
}
public static void insertSort(int n, int[] nums){
for(int i = 1; i<= nums.length-1; i++){
printHelp(nums);
int key = nums[i];
// insert A[i] into the sorted sequence A[0,...,j-1]
int j = i - 1;
while(j >= 0 && nums[j] > key){
nums[j+1] = nums[j];
j--;
}
nums[j+1] = key;
}
printHelp(nums);
}
private static void printHelp(int[] nums){
for(int i : nums){
System.out.print(i + " ");
}
System.out.print("\n");
}
}
|
s008604035 | p02255 | u260169299 | 1535147857 | Python | Python3 | py | Runtime Error | 0 | 0 | 985 | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
// Get numbers
int n = input.nextInt();
int[] nums = new int[n];
// fill array
for(int i = 0; i < n; i++){
nums[i] = input.nextInt();
}
insertSort(n, nums);
}
public static void insertSort(int n, int[] nums){
for(int i = 1; i<= nums.length-1; i++){
printHelp(nums);
int key = nums[i];
// insert A[i] into the sorted sequence A[0,...,j-1]
int j = i - 1;
while(j >= 0 && nums[j] > key){
nums[j+1] = nums[j];
j--;
}
nums[j+1] = key;
}
printHelp(nums);
}
private static void printHelp(int[] nums){
for(int i : nums){
System.out.print(i + " ");
}
System.out.print("\n");
}
}
|
s941051714 | p02255 | u427752990 | 1535343171 | Python | Python3 | py | Runtime Error | 0 | 0 | 380 | # inputList = list(map(int, '''6
# 5 2 4 6 1 3'''.split()))
inputList = list(map(int, input.split()))
def insertionSort(A, N):
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j-=1
A[j+1] = v
print(A)
N = int(inputList.pop(0))
print(inputList)
insertionSort(inputList, N)
|
s169721031 | p02255 | u427752990 | 1535343205 | Python | Python3 | py | Runtime Error | 0 | 0 | 380 | # inputList = list(map(int, '''6
# 5 2 4 6 1 3'''.split()))
inputList = list(map(int, input.split()))
def insertionSort(A, N):
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j-=1
A[j+1] = v
print(A)
N = int(inputList.pop(0))
print(inputList)
insertionSort(inputList, N)
|
s393843058 | p02255 | u427752990 | 1535344002 | Python | Python3 | py | Runtime Error | 0 | 0 | 560 | # inputList = list(map(int, '''6
# 5 2 4 6 1 3'''.split()))
# N = inputList.pop(0)
N = input()
inputList = list(map(int, input.split()))
def formatting(nums):
for i in range(len(nums)):
if i != len(nums) - 1:
print(nums[i],end=' ')
else:
print(nums[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
formatting(A)
formatting(inputList)
insertionSort(inputList, N)
|
s602559565 | p02255 | u418996726 | 1535418747 | Python | Python3 | py | Runtime Error | 0 | 0 | 310 | input()
myarr = list(map(int, split(input())))
for i in range(1, len(myarr)):
for j in range(i, 0,-1):
if myarr[j] < myarr[j-1]:
t = myarr[j]
myarr[j] = myarr[j-1]
myarr[j-1] = t
else:
break
print(" ".join(map(str, myarr)))
|
s335246537 | p02255 | u418996726 | 1535418945 | Python | Python3 | py | Runtime Error | 0 | 0 | 310 | input()
myarr = list(map(int, input().split())
for i in range(1, len(myarr)):
for j in range(i, 0,-1):
if myarr[j] < myarr[j-1]:
t = myarr[j]
myarr[j] = myarr[j-1]
myarr[j-1] = t
else:
break
print(" ".join(map(str, myarr)))
|
s027514916 | p02255 | u418996726 | 1540715929 | Python | Python3 | py | Runtime Error | 0 | 0 | 279 | def insertion_sort(arr):
for i in range(1,len(arr)):
j = i
while arr[j] < arr[j-1] and j > 0:
arr[j-1], arr[j] = arr[j], arr[j-1]
j -= 1
print(" ".join(arr))
input()
arr = list(map(int, input().split()))
insertion_sort(arr)
|
s572626713 | p02255 | u698762975 | 1555656818 | Python | Python3 | py | Runtime Error | 0 | 0 | 230 | 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))
print("".join(l))
n=list(input())
m=int(input())
inserrtionsort(m,n)
|
s314032586 | p02255 | u698762975 | 1555657151 | Python | Python3 | py | Runtime Error | 0 | 0 | 250 | def inserrtionsort(l,n):
for i in range(1,n):
print(" ".join(l))
v=l[i]
j=i-1
while v<l[j] and j>=0:
l[j+1]=l[j]
j-=1
l[j+1]=v
print(" ".join(l))
m=int(input())
n=list(map(int,input().split()))
inserrtionsort(n,m)
|
s297640242 | p02255 | u088264506 | 1556617914 | Python | Python3 | py | Runtime Error | 0 | 0 | 395 | n = int(input())
l = list(map(int, input()))
def insertionSort(a, n):#配列aを挿入ソートで並び替える(昇順)
for i in range(1,n-1):
v = a[i]
j = i - 1
while >= 0 and a[j] > v:
a[j+1] = a[j]#a[i]の位置に詰めていく処理
j -= 1
print(" ".join(a))#1行ごとに出力
a[j+1] = v
insertionSort(l,n)
|
s671572640 | p02255 | u852112234 | 1558937382 | Python | Python3 | py | Runtime Error | 0 | 0 | 183 | 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
A[j+1] = v
|
s310251254 | p02255 | u662822413 | 1559052739 | Python | Python3 | py | Runtime Error | 0 | 0 | 362 | def show(nums):
for i in range(len(nums)):
if i !=len(nums)-1:
print(nums[i],end='')
else:
print(nums[i])
n=int(input())
nums=list(map(int,input().split()))
show(nums)
for i in range(1,n):
v=nums[i]
j=i-1
while (j>=0 and nus[j]>v):
nums[j+1]=nums[j]
j--
nums[j+1] = v
shows(nums)
|
s421864092 | p02255 | u662822413 | 1559052793 | Python | Python3 | py | Runtime Error | 0 | 0 | 365 | def show(nums):
for i in range(len(nums)):
if i !=len(nums)-1:
print(nums[i],end='')
else:
print(nums[i])
n=int(input())
nums=list(map(int,input().split()))
show(nums)
for i in range(1,n):
v=nums[i]
j=i-1
while (j>=0 and nus[j]>v):
nums[j+1]=nums[j]
j -= 1
nums[j+1] = v
shows(nums)
|
s539141601 | p02255 | u662822413 | 1559052813 | Python | Python3 | py | Runtime Error | 0 | 0 | 366 | def show(nums):
for i in range(len(nums)):
if i !=len(nums)-1:
print(nums[i],end=' ')
else:
print(nums[i])
n=int(input())
nums=list(map(int,input().split()))
show(nums)
for i in range(1,n):
v=nums[i]
j=i-1
while (j>=0 and nus[j]>v):
nums[j+1]=nums[j]
j -= 1
nums[j+1] = v
shows(nums)
|
s762667944 | p02255 | u662822413 | 1559052896 | Python | Python3 | py | Runtime Error | 0 | 0 | 367 | def show(nums):
for i in range(len(nums)):
if i !=len(nums)-1:
print(nums[i],end=' ')
else:
print(nums[i])
n=int(input())
nums=list(map(int,input().split()))
show(nums)
for i in range(1,n):
v=nums[i]
j=i-1
while (j>=0 and nums[j]>v):
nums[j+1]=nums[j]
j -= 1
nums[j+1] = v
shows(nums)
|
s553639926 | p02255 | u193025715 | 1408608117 | Python | Python3 | py | Runtime Error | 40 | 6724 | 253 | n = int(input())
nums = list(map(int, input().split(' ')))
for i in range(len(nums)):
key = nums[i]
j = i - 1
while j >= 0 and nums[j] > key:
nums[j+1] = nums[j]
j -= 1
nums[j+1] = key
print(' '.join(map(str, nums))) |
s804771828 | p02255 | u802705119 | 1436760677 | Python | Python3 | py | Runtime Error | 0 | 0 | 374 | # coding: utf-8
def insertSort(array):
for i in array[1:]:
[print(array[i]) for i in array]
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 __name__ == '__main__':
n = input()
index = [int for i in input().split()]
insertSort(index) |
s685464623 | p02255 | u881590806 | 1439571120 | Python | Python | py | Runtime Error | 10 | 4224 | 284 | n = int(raw_input())
arr = map(int, raw_input().split(' '))
p = 1
print ' '.join(map(str, arr))
while True:
for j in range(0,p):
if arr[p] < arr[j]:
arr[p],arr[j] = arr[j],arr[p]
p += 1
print ' '.join(map(str, arr))
if p >= len(arr):
break |
s288885247 | p02255 | u722558010 | 1440668642 | Python | Python3 | py | Runtime Error | 0 | 0 | 206 | n=int(input())
A=list(map(int,input().split()))
for i in range(1,n):
print(" ".join(map(int,A)))
j=i-1
while A[j]<A[j-1] and j>0:
(A[j],A[j-1])=(A[j-1],A[j])
j=j-1
else:
print(" ".join(map(int,A))) |
s848788152 | p02255 | u632424921 | 1442209873 | Python | Python | py | Runtime Error | 0 | 0 | 354 | num = raw_input()
num_list = raw_input()
num_list = num_list.split()
print "???".join(num_list)
for i in range(1, len(num_list)):
temp = num_list[i]
j = i - 1
while (j >= 0 and num_list[j] > temp):
num_list[j+1] = num_list[j]
j -= 1
num_list[j+1] = temp
print "???".join(num_list) |
s477543828 | p02255 | u197445199 | 1442211109 | Python | Python | py | Runtime Error | 0 | 0 | 365 | num = int(raw_input())
line = raw_input()
A_str = line.strip().split(" ")
print " ".join(A_str)
A = map(int, item_str)
for i in range(1, num):
v = A[i]
j = i - 1
for j in range(j, -1, -1):
if A[j] > v:
A[j+1] = A[j]
j -= 1
else:
break
A[j+1] = v
A_str = map(str, A)
print " ".join(A_str) |
s307222969 | p02255 | u197445199 | 1442211128 | Python | Python | py | Runtime Error | 0 | 0 | 365 | num = int(raw_input())
line = raw_input()
A_str = line.strip().split(" ")
print " ".join(A_str)
A = map(int, item_str)
for i in range(1, num):
v = A[i]
j = i - 1
for j in range(j, -1, -1):
if A[j] > v:
A[j+1] = A[j]
j -= 1
else:
break
A[j+1] = v
A_str = map(str, A)
print " ".join(A_str) |
s266580006 | p02255 | u885889402 | 1442217064 | Python | Python3 | py | Runtime Error | 0 | 0 | 500 | a=[]
n=int(input())
s=input()
a=list(map(int,s.split()))
insertionSort(a,n)
def insertionSort(a,n):
for i in range(n):
print(a[i],end="")
if(i!=n-1):
print(" ",end="")
print("")
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):
print(a[i],end="")
if(i!=n-1):
print(" ",end="")
print("") |
s524338349 | p02255 | u894381890 | 1442283935 | Python | Python | py | Runtime Error | 0 | 0 | 235 | import sys
y = sys.stdin.readline()
y = int(y)
x = sys.stdin.readline()
x_list = int(x.split(" "))
for i in range(1, y):
if i > 0:
j = i - 1
if list(i) < list(j):
list(i), list(j) = list(j), list(i)
i = i - 2 |
s737324659 | p02255 | u894381890 | 1442284518 | Python | Python | py | Runtime Error | 0 | 0 | 316 | import sys
y = sys.stdin.readline()
y = int(y)
x = sys.stdin.readline()
x_list = int(x.split(" "))
for i in range(1, y + 1):
if list(i) < list(i - 1):
for j range(i - 1, 0):
if list(j) < list(i):
list(i), list(j+1) = list(j+1), list(i)
break
for k in range(0, y):
print list(j) |
s419665918 | p02255 | u894381890 | 1442284558 | Python | Python | py | Runtime Error | 0 | 0 | 316 | import sys
y = sys.stdin.readline()
y = int(y)
x = sys.stdin.readline()
x_list = int(x.split(" "))
for i in range(1, y + 1):
if list(i) < list(i - 1):
for j range(i - 1, 0):
if list(j) < list(i):
list(i), list(j+1) = list(j+1), list(i)
break
for k in range(0, y):
print list(k) |
s362377404 | p02255 | u894381890 | 1442284606 | Python | Python | py | Runtime Error | 0 | 0 | 316 | import sys
y = sys.stdin.readline()
y = int(y)
x = sys.stdin.readline()
x_list = int(x.split(" "))
for i in range(1, y + 1):
if list(i) < list(i - 1):
for j range(i - 1, 0):
if list(j) < list(i):
list(i), list(j+1) = list(j+1), list(i)
break
for k in range(0, y):
print list(k) |
s341573905 | p02255 | u894381890 | 1442284682 | Python | Python | py | Runtime Error | 0 | 0 | 313 | import sys
y = sys.stdin.readline()
y = int(y)
x = sys.stdin.readline()
x_list = int(x.split(" "))
for i in range(1, y):
if list(i) < list(i - 1):
for j range(i - 1, -1):
if list(j) < list(i):
list(i), list(j+1) = list(j+1), list(i)
break
for k in range(0, y):
print list(k) |
s317799003 | p02255 | u894381890 | 1442284913 | Python | Python | py | Runtime Error | 0 | 0 | 331 | import sys
y = sys.stdin.readline()
y = int(y)
x = sys.stdin.readline()
x_list = int(x.split(" "))
for i in range(1, y):
if x_list[i] < x_list[i - 1]:
for j range(i - 1, -1):
if x_list[j] < x_list[i]:
x_list[i], x_list[j+1] = x_list[j+1], x_list[i]
break
for k in range(0, y):
print x_list[k] |
s553409458 | p02255 | u894381890 | 1442290991 | Python | Python | py | Runtime Error | 0 | 0 | 628 | import sys
y = sys.stdin.readline()
y = int(y)
x = sys.stdin.readline()
x_list = x.split(" ")
for i in range(y):
x_list[i] = int(x_list[i])
for i in range(1, y):
if x_list[i] < x_list[i - 1]:
for j in range(0, i - 1):
if x_list[j] > x_list[i]:
temp = x_list[i]
for p in range(0, i):
q = i - p
x_list[q] = x_list[q - 1]
x_list[j+1] = temp
elif x_list[0] > x_list[i]
for p in range(0, i):
q = i - p
temp = x_list[i]
x_list[q] = x_list[q - 1]
x_list[0] = temp
for k in range(0, y):
print x_list[k],
print " " |
s677880311 | p02255 | u894381890 | 1442291003 | Python | Python | py | Runtime Error | 0 | 0 | 628 | import sys
y = sys.stdin.readline()
y = int(y)
x = sys.stdin.readline()
x_list = x.split(" ")
for i in range(y):
x_list[i] = int(x_list[i])
for i in range(1, y):
if x_list[i] < x_list[i - 1]:
for j in range(0, i - 1):
if x_list[j] > x_list[i]:
temp = x_list[i]
for p in range(0, i):
q = i - p
x_list[q] = x_list[q - 1]
x_list[j+1] = temp
elif x_list[0] > x_list[i]
for p in range(0, i):
q = i - p
temp = x_list[i]
x_list[q] = x_list[q - 1]
x_list[0] = temp
for k in range(0, y):
print x_list[k],
print " " |
s285012434 | p02255 | u894381890 | 1442291061 | Python | Python | py | Runtime Error | 0 | 0 | 635 | import sys
y = sys.stdin.readline()
y = int(y)
x = sys.stdin.readline()
x_list = x.split(" ")
for i in range(y):
x_list[i] = int(x_list[i])
for i in range(1, y):
if x_list[i] < x_list[i - 1]:
for j in range(0, i - 1):
if x_list[0] > x_list[i]
for p in range(0, i):
q = i - p
temp = x_list[i]
x_list[q] = x_list[q - 1]
x_list[0] = temp
elif x_list[j] > x_list[i]:
temp = x_list[i]
for p in range(0, i):
q = i - p
x_list[q] = x_list[q - 1]
x_list[j+1] = temp
for k in range(0, y):
print x_list[k],
print " " |
s376143582 | p02255 | u894381890 | 1442291927 | Python | Python | py | Runtime Error | 0 | 0 | 412 | import sys
def inserttionSort(x_list,y):
for i in range(1, y):
v = x_list[i]
j = i - 1
while j >= 0 and x_list[j] > v:
x_list[j + 1] = x_list[j]
j--
x_list[j+1] = v
for k in range(0, y):
print x_list[k],
print " "
y = sys.stdin.readline()
y = int(y)
x = sys.stdin.readline()
x_list = x.split(" ")
for i in range(y):
x_list[i] = int(x_list[i])
for i in range(1, y): |
s484090213 | p02255 | u894381890 | 1442291981 | Python | Python | py | Runtime Error | 0 | 0 | 414 | import sys
def insertionSort(x_list,y):
for i in range(1, y):
v = x_list[i]
j = i - 1
while j >= 0 and x_list[j] > v:
x_list[j + 1] = x_list[j]
j--
x_list[j+1] = v
for k in range(0, y):
print x_list[k],
print " "
y = sys.stdin.readline()
y = int(y)
x = sys.stdin.readline()
x_list = x.split(" ")
for i in range(y):
x_list[i] = int(x_list[i])
insertionSort(x_list, y) |
s791209817 | p02255 | u854228079 | 1442314985 | Python | Python | py | Runtime Error | 0 | 0 | 284 | n = raw_input()
num = raw_input()
array = []
array = num.strip().split(" ")
for i in range(1, int(n)):
print " ".join(array)
v = array[i]
j = i - 1
while j >= 0 and array[j] > v:
array[j + 1] = array[j]
j -= 1
array[j + 1] = v
print " ".join(array |
s618984167 | p02255 | u630746844 | 1446700195 | Python | Python3 | py | Runtime Error | 0 | 0 | 508 | import sys
def insertionSort(A, N):
for n in range(N-1):
print (A[n], end=" ")
print(A[N-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 = j - 1
A[j + 1] = v
for n in range(N-1):
print (A[n], end=" ")
print(A[N-1])
return A
N = int(input())
A = input()
A = A.split(" ")
for i in range(N):
A[i] = int(A[i])
val = insertionSort(stdin_A, stdin_N) |
s345897267 | p02255 | u341533698 | 1454339205 | Python | Python | py | Runtime Error | 0 | 0 | 318 | def main():
N = input()
a = map(int, raw_input().split())
print ' '.join(map(str,a))
for i in xrange(1,len(a)-1):
v = a[i]
j = i - 1
while j >= 0 && a[j] > v:
a[j+1] = a[j]
j -= 1
a[j+1] = v
print ' '.join(map(str,a))
return 0
main() |
s200353822 | p02255 | u994049982 | 1458607280 | Python | Python | py | Runtime Error | 0 | 0 | 143 | q=input()
a=map(int,rar_input().split())
for i in range(q):
k=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) |
s248633635 | p02255 | u994049982 | 1458607288 | Python | Python | py | Runtime Error | 0 | 0 | 143 | q=input()
a=map(int,raw_input().split())
for i in range(q):
k=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) |
s085638144 | p02255 | u994049982 | 1458607591 | Python | Python | py | Runtime Error | 0 | 0 | 182 | q=input()
a=map(int,raw_input().split())
for i in range(q):
k=a[i]
j=i-1
while j>=0 and a[j]>k:
a[j+1]=a[j]
j-=1
a[j+1]=k
text=""
for I in a:
text=text+' '+I
print(text) |
s519501159 | p02255 | u994049982 | 1458608226 | Python | Python3 | py | Runtime Error | 0 | 0 | 190 | q=input()
a=map(int,raw_input().split())
for i in range(q):
k=a[i]
j=i-1
while j>=0 and a[j]>k:
a[j+1]=a[j]
j-=1
a[j+1]=k
text=str()
for I in a:
text=text+' '+str(I)
print(text) |
s794208282 | p02255 | u670498238 | 1463702007 | Python | Python3 | py | Runtime Error | 0 | 0 | 205 | 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(*1) |
s835004271 | p02255 | u603356762 | 1464697403 | Python | Python3 | py | Runtime Error | 0 | 0 | 189 | N = input()
a=map(int,raw_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) |
s318079442 | p02255 | u603356762 | 1464697455 | Python | Python3 | py | Runtime Error | 0 | 0 | 189 | N = input()
a=map(int,raw_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) |
s681422752 | p02255 | u603356762 | 1464697791 | Python | Python3 | py | Runtime Error | 0 | 0 | 196 | N = input()
a=map(int,raw_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)
return |
s096083785 | p02255 | u603356762 | 1464698046 | Python | Python3 | py | Runtime Error | 0 | 0 | 195 | N = input()
a=list(map(int,raw_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) |
s532161268 | p02255 | u603356762 | 1464698172 | Python | Python3 | py | Runtime Error | 0 | 0 | 191 | N = 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) |
s893782985 | p02255 | u603356762 | 1464698556 | Python | Python3 | py | Runtime Error | 0 | 0 | 187 | N = input()
a=list(map(int,raw_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) |
s109475638 | p02255 | u600065151 | 1466596131 | Python | Python | py | Runtime Error | 0 | 0 | 224 | #?????????
N = input()
A = map(int, raw_input().split())
for i in range(len(A)):
v = A[i]
j = i - 1
while (j >= 0) & (A[j] > v):
A[j+1] = A[j]
j -= 1
A[j+1] = v
print ' '.join(map(str, A)) |
s136391075 | p02255 | u496045719 | 1469352272 | Python | Python3 | py | Runtime Error | 0 | 0 | 655 | #!/usr/bin/python
import sys
def main():
length, elements = sys.argv[1].split('\n')
length = int(length)
elements = elements.split()
print(" ".join(elements))
elements = [str(i) for i in elements]
sorted_list = [elements[0]]
for i in range(1, length):
element = elements[i]
for j in range(0, len(sorted_list) + 1):
if j == len(sorted_list):
sorted_list.append(element)
break
elif element < sorted_list[j]:
sorted_list.insert(j, element)
break
output_list = sorted_list[0:i+1] + elements[i+1:]
print(" ".join([str(i) for i in output_list]))
if __name__ == '__main__':
main() |
s968625746 | p02255 | u496045719 | 1469352350 | Python | Python3 | py | Runtime Error | 0 | 0 | 668 | #!/usr/bin/python
import sys
def main():
length, elements = sys.argv[1].split('\n')
length = int(length)
elements = elements.split()
print(" ".join(elements))
elements = [str(i) for i in elements]
sorted_list = [elements[0]]
for i in range(1, length):
element = elements[i]
for j in range(0, len(sorted_list) + 1):
if j == len(sorted_list):
sorted_list.append(element)
break
elif element < sorted_list[j]:
sorted_list.insert(j, element)
break
output_list = sorted_list[0:i+1] + elements[i+1:]
print(" ".join([str(i) for i in output_list]))
return 0
if __name__ == '__main__':
main() |
s024940080 | p02255 | u496045719 | 1469352715 | Python | Python3 | py | Runtime Error | 0 | 0 | 635 | #!/usr/bin/python
import sys
def main():
args = input()
length = args[0]
elements = args[1].split()
print(" ".join(elements))
elements = [str(i) for i in elements]
sorted_list = [elements[0]]
for i in range(1, length):
element = elements[i]
for j in range(0, len(sorted_list) + 1):
if j == len(sorted_list):
sorted_list.append(element)
break
elif element < sorted_list[j]:
sorted_list.insert(j, element)
break
output_list = sorted_list[0:i+1] + elements[i+1:]
print(" ".join([str(i) for i in output_list]))
return 0
if __name__ == '__main__':
main() |
s579841184 | p02255 | u496045719 | 1469352982 | Python | Python3 | py | Runtime Error | 0 | 0 | 646 | #!/usr/bin/python
import sys
def main():
args = input()
print(args)
length = 6
elements = [5, 2, 4, 6, 1, 3]
print(" ".join(elements))
elements = [str(i) for i in elements]
sorted_list = [elements[0]]
for i in range(1, length):
element = elements[i]
for j in range(0, len(sorted_list) + 1):
if j == len(sorted_list):
sorted_list.append(element)
break
elif element < sorted_list[j]:
sorted_list.insert(j, element)
break
output_list = sorted_list[0:i+1] + elements[i+1:]
print(" ".join([str(i) for i in output_list]))
return 0
if __name__ == '__main__':
main() |
s639618838 | p02255 | u496045719 | 1469353153 | Python | Python3 | py | Runtime Error | 0 | 0 | 667 | #!/usr/bin/python
import sys
def main():
args = input()
a = []
for arg in args:
a.append(arg)
length = a[0]
elements = a[1]
print(" ".join(elements))
elements = [str(i) for i in elements]
sorted_list = [elements[0]]
for i in range(1, length):
element = elements[i]
for j in range(0, len(sorted_list) + 1):
if j == len(sorted_list):
sorted_list.append(element)
break
elif element < sorted_list[j]:
sorted_list.insert(j, element)
break
output_list = sorted_list[0:i+1] + elements[i+1:]
print(" ".join([str(i) for i in output_list]))
return 0
if __name__ == '__main__':
main() |
s360580123 | p02255 | u496045719 | 1469353759 | Python | Python3 | py | Runtime Error | 0 | 0 | 617 | #!/usr/bin/python
import sys
def main():
length = int(raw_input())
elements = map(int, raw_input().split())
print(" ".join(str(i) for i in elements))
sorted_list = [elements[0]]
for i in range(1, length):
element = elements[i]
for j in range(0, len(sorted_list) + 1):
if j == len(sorted_list):
sorted_list.append(element)
break
elif element < sorted_list[j]:
sorted_list.insert(j, element)
break
output_list = sorted_list[0:i+1] + elements[i+1:]
print(" ".join([str(i) for i in output_list]))
return 0
if __name__ == '__main__':
main() |
s481205888 | p02255 | u496045719 | 1469353870 | Python | Python3 | py | Runtime Error | 0 | 0 | 623 | #!/usr/bin/python
import sys
def main():
length = int(raw_input())
elements = list(map(int, raw_input().split()))
print(" ".join(str(i) for i in elements))
sorted_list = [elements[0]]
for i in range(1, length):
element = elements[i]
for j in range(0, len(sorted_list) + 1):
if j == len(sorted_list):
sorted_list.append(element)
break
elif element < sorted_list[j]:
sorted_list.insert(j, element)
break
output_list = sorted_list[0:i+1] + elements[i+1:]
print(" ".join([str(i) for i in output_list]))
return 0
if __name__ == '__main__':
main() |
s849955425 | p02255 | u612243550 | 1469357431 | Python | Python3 | py | Runtime Error | 0 | 0 | 197 | n = int(input())
A = input().split(' ')
for i in range(1, n-1):
v = A[i]
j = i - 1
while j >= 0 && A[j] > v:
A[j+1] = A[j]
j--
A[j+1] = v
print(" ".join(A)) |
s691930346 | p02255 | u754727064 | 1471270896 | Python | Python | py | Runtime Error | 0 | 0 | 386 | # -*- coding: utf-8 -*-
def insertion_sort(n, A):
for i in xrange(1, len(A)):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j + 1] = A[j]
j -= 1
A[j + 1] = key
if __name__ == "__main__":
n = int(raw_input())
A = raw_input().split(" ")
A = map(int, A)
insertion_sort(n, A)
print " ".join(A).strip() |
s947536176 | p02255 | u231136358 | 1471767359 | Python | Python | py | Runtime Error | 0 | 0 | 288 | A = input().split()
N = A.pop()
# print(N)
# print(A)
# A = [5, 2, 4, 6, 1, 3]
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))) |
s345275620 | p02255 | u231136358 | 1471768701 | Python | Python3 | py | Runtime Error | 0 | 0 | 221 | print(' '.join([str(item) for item in A])
for i in range(1, len(A)):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j+1] = A[j]
j = j - 1
A[j+1] = key
print(' '.join(map(str, A))) |
s388984300 | p02255 | u231136358 | 1471770512 | Python | Python3 | py | Runtime Error | 0 | 0 | 287 | A = [int(item) for item in input().split()]
N = A.pop()
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])) |
s270990757 | p02255 | u231136358 | 1471770607 | Python | Python3 | py | Runtime Error | 0 | 0 | 288 | A = [int(item) for item in input().split()]
N = A.pop(0)
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])) |
s519544227 | p02255 | u231136358 | 1471770666 | Python | Python3 | py | Runtime Error | 0 | 0 | 288 | A = [int(item) for item in input().split()]
N = A.pop(0)
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])) |
s932765805 | p02255 | u231136358 | 1471770856 | Python | Python3 | py | Runtime Error | 0 | 0 | 302 | input = input().split()
A = [int(item) for item in input]
N = A.pop(0)
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])) |
s515428144 | p02255 | u231136358 | 1471770883 | Python | Python3 | py | Runtime Error | 0 | 0 | 294 | x = input().split()
A = [int(item) for item in x]
N = A.pop(0)
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])) |
s536587079 | p02255 | u231136358 | 1471772323 | Python | Python3 | py | Runtime Error | 0 | 0 | 254 | A = [5, 2, 4, 6, 1, 3]
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])) |
s672237250 | p02255 | u390995924 | 1472557257 | Python | Python3 | py | Runtime Error | 0 | 0 | 200 | _ = input()
A = [int(i) for i in input().split(" ")]
for i in range(1, len(A)):
print(" ".join(A))
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j + 1] = A[j]
j -= 1
A[j] = key |
s289406158 | p02255 | u390995924 | 1472557627 | Python | Python3 | py | Runtime Error | 0 | 0 | 204 | _ = input()
A = [int(i) for i in input().split(" ")]
for i in range(1, len(A)):
print(" ".join(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 |
s072262288 | p02255 | u756595712 | 1474770170 | Python | Python3 | py | Runtime Error | 0 | 0 | 452 | def insertionSort(_list, _length):
for i in range(1, _length):
ll = [str(_l) for _l in _list]
print(' '.join(ll))
val = _list[i]
j = i - 1
while j >= 0 and _list[j] > val:
_list[j+1] = _list[j]
j -= 1
_list[j+1] = val
ll = [str(_l) for _l in _list]
print(' '.join(ll))
import sys
length = input()
eles = map(int, sys.stdin.readlines())
insertionSort(eles, length) |
s078974950 | p02255 | u756595712 | 1474770282 | Python | Python3 | py | Runtime Error | 0 | 0 | 472 | def insertionSort(_list, _length):
for i in range(1, _length):
ll = [str(_l) for _l in _list]
print(' '.join(ll))
val = _list[i]
j = i - 1
while j >= 0 and _list[j] > val:
_list[j+1] = _list[j]
j -= 1
_list[j+1] = val
ll = [str(_l) for _l in _list]
print(' '.join(ll))
import sys
length = input()
eles = map(int, sys.stdin.readlines().rstrip().split(' '))
insertionSort(eles, length) |
s311156647 | p02255 | u756595712 | 1474770322 | Python | Python3 | py | Runtime Error | 0 | 0 | 101 | import sys
length = input()
eles = map(int, sys.stdin.readlines().rstrip().split(' '))
print(eles) |
s073517895 | p02255 | u756595712 | 1474770455 | Python | Python3 | py | Runtime Error | 0 | 0 | 451 | def insertionSort(_list, _length):
for i in range(1, _length):
ll = [str(_l) for _l in _list]
print(' '.join(ll))
val = _list[i]
j = i - 1
while j >= 0 and _list[j] > val:
_list[j+1] = _list[j]
j -= 1
_list[j+1] = val
ll = [str(_l) for _l in _list]
print(' '.join(ll))
length = input()
eles = [ele for ele in input().rstrip().split(' ')]
insertionSort(eles, length) |
s122585702 | p02255 | u756595712 | 1474771048 | Python | Python3 | py | Runtime Error | 0 | 0 | 240 | length = int(input())
eles = list(map(int, input().split()))
for i in range(_length):
val = _list[i]
j = i - 1
while j >= 0 and _list[j] > val:
_list[j+1] = _list[j]
j -= 1
_list[j+1] = val
print(*_list) |
s108964903 | p02255 | u743390845 | 1477582192 | Python | Python3 | py | Runtime Error | 0 | 0 | 296 | n= int(input())
l= list(map(int,input().split()))
s= ''
for k in l:
s+=' '+str(k)
print(s)
for m in range(n-1):
j=m+1
if(l[j-1]>l[j]):
i=j
while(not i==0):
if(not(l[i-1]<l[i])):
l[i-1],l[i]= l[i],l[i-1]
i-=1
else:
break
s= ''
for k in l:
s+=' '+str(k)
print(s) |
s422961992 | p02255 | u831244171 | 1477667526 | Python | Python | py | Runtime Error | 0 | 0 | 198 | N = input()
n = list(map(int,input().split()))
for i in range(1,int(N)):
v = n[i]
j = i - 1
while j >= 0 and v < n[j]:
n[j+1] = n[j]
j = j - 1
n[j+1] = v
print(n) |
s251123174 | p02255 | u831244171 | 1477667644 | Python | Python | py | Runtime Error | 0 | 0 | 252 | N = input()
n = list(map(int,raw_input().split()))
for i in range(1,int(N)):
v = n[i]
j = i - 1
while j >= 0 and v < n[j]:
n[j+1] = n[j]
j = j - 1
n[j+1] = v
print(n.replace("[","").replace(",","").replace("]",""))) |
s811841124 | p02255 | u831244171 | 1477667678 | Python | Python | py | Runtime Error | 0 | 0 | 251 | N = input()
n = list(map(int,raw_input().split()))
for i in range(1,int(N)):
v = n[i]
j = i - 1
while j >= 0 and v < n[j]:
n[j+1] = n[j]
j = j - 1
n[j+1] = v
print(n.replace("[","").replace(",","").replace("]","")) |
s724771706 | p02255 | u022407960 | 1477842139 | Python | Python | py | Runtime Error | 0 | 0 | 768 | #!/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 = 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() |
s540388617 | p02255 | u022407960 | 1477842233 | Python | Python3 | py | Runtime Error | 0 | 0 | 768 | #!/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 = 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() |
s868336867 | p02255 | u022407960 | 1477842427 | Python | Python | py | Runtime Error | 0 | 0 | 344 | 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)) |
s325355342 | p02255 | u022407960 | 1477842549 | Python | Python | py | Runtime Error | 0 | 0 | 341 | array_length = raw_input()
unsorted_array = list(map(int, raw_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(str(i) for i in unsorted_array)) |
s988306976 | p02255 | u022407960 | 1477842599 | Python | Python | py | Runtime Error | 0 | 0 | 344 | 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)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.