s_id string | p_id string | u_id string | date string | language string | original_language string | filename_ext string | status string | cpu_time string | memory string | code_size string | code string | error string | stdout string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s894348775 | p02259 | u630546605 | 1497163778 | Python | Python | py | Runtime Error | 0 | 0 | 464 | #
# coding: utf-8
def bubbleSort(arr, n):
flag = True
swap_num = 0
while flag:
flag = False
for j in xrange(n-1, 0, -1):
if arr[j] < arr[j-1]:
arr[j], arr[j-1] = arr[j-1], arr[j]
swap_num += 1
flag = True
pass
return swap_num
n = int(raw_input())
arr = map(int, raw_input().split())
num = bubbleSort(arr, n)
print " ".join(map(str, test_arr))
print num | File "/tmp/tmp854b20hv/tmpgj9_a2f4.py", line 24
print " ".join(map(str, test_arr))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s006706587 | p02259 | u609303956 | 1497857442 | Python | Python | py | Runtime Error | 0 | 0 | 303 | N = int(input())
text = input()
A = text.split()
A = list(map(int, A))
trials = 0
for i in range(0, N-1):
for j in range(N-1, i, -1):
if A[j] < A[j-1]:
A[j], A[j-1] = A[j-1], A[j]
trials += 1
print(trials)
for i in range(len(A)):
print(A[i], end=" ")
print("") | Traceback (most recent call last):
File "/tmp/tmptr2zbmbh/tmpdspejhvf.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s659044496 | p02259 | u609303956 | 1497857628 | Python | Python | py | Runtime Error | 0 | 0 | 635 | N = int(input("Enter the length of the array: "))
text = input("Enter the array: ")
A = text.split()
A = list(map(int, A))
#if N != len(A):
# print("The length of the array is incorrect!! ")
# print("N=" + str(N) + ", the actual length of A = " + str(len(A)))
#else:
# print("The length of the array is: " + str(len(A)))
# Bubble Sort
trials = 0
for i in range(0, N-1):
for j in range(N-1, i, -1):
if A[j] < A[j-1]:
A[j], A[j-1] = A[j-1], A[j]
trials += 1
# print the number of trials
print(trials)
# print bubble-sorted array
for i in range(len(A)):
print(A[i], end=" ")
print("") | Traceback (most recent call last):
File "/tmp/tmphotew1u8/tmpfukyk7qg.py", line 1, in <module>
N = int(input("Enter the length of the array: "))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
EOFError: EOF when reading a line
| Enter the length of the array: |
s617708065 | p02259 | u747635679 | 1498195657 | Python | Python3 | py | Runtime Error | 0 | 0 | 282 | n = int(input())
a = [int(x) for x in input().split()]
c = 0
for i in range(n):
for j in range(i + 1, n):
if a[j - 1] > a[j]:
tmp = a[j - 1]
a[j - 1] = a[j]
a[j] = tmp
c += 1
print(" ".join([str(x) for x in a])
print(c) | File "/tmp/tmpi25pmy46/tmp49ehtlpl.py", line 14
print(" ".join([str(x) for x in a])
^
SyntaxError: '(' was never closed
| |
s114838873 | p02259 | u735204496 | 1498977714 | Python | Python | py | Runtime Error | 0 | 0 | 576 | import sys
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
return a
def list_to_string(a):
s = ""
for n in a:
s += str(n) + " "
return s.strip()
num = int(sys.stdin.readline().strip())
array = map(lambda x: int(x), sys.stdin.readline().strip().split(" "))
flag = True
swap_num = 0
while flag:
flag = False
for i in range(1, len(array)).reverse():
if array[i] < array[i - 1]:
swap(a, i, i-1)
flag = True
swap_num += 1
print list_to_string(array)
print str(swap_num) | File "/tmp/tmpipvrrugs/tmponp45edi.py", line 30
print list_to_string(array)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s117924293 | p02259 | u735204496 | 1498977762 | Python | Python | py | Runtime Error | 0 | 0 | 576 | import sys
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
return a
def list_to_string(a):
s = ""
for n in a:
s += str(n) + " "
return s.strip()
num = int(sys.stdin.readline().strip())
array = map(lambda x: int(x), sys.stdin.readline().strip().split(" "))
flag = True
swap_num = 0
while flag:
flag = False
for i in range(1, len(array)).reverse():
if array[i] < array[i - 1]:
swap(a, i, i-1)
flag = True
swap_num += 1
print list_to_string(array)
print str(swap_num) | File "/tmp/tmpgj9_otvq/tmpaqc5166i.py", line 30
print list_to_string(array)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s095663599 | p02259 | u735204496 | 1498977969 | Python | Python | py | Runtime Error | 10 | 6456 | 576 | import sys
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
return a
def list_to_string(a):
s = ""
for n in a:
s += str(n) + " "
return s.strip()
num = int(sys.stdin.readline().strip())
array = map(lambda x: int(x), sys.stdin.readline().strip().split(" "))
flag = True
swap_num = 0
while flag:
flag = False
for i in reversed(range(1, len(array))):
if array[i] < array[i - 1]:
swap(a, i, i-1)
flag = True
swap_num += 1
print list_to_string(array)
print str(swap_num) | File "/tmp/tmpglxrokks/tmph4mhlgt5.py", line 30
print list_to_string(array)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s485532806 | p02259 | u821624310 | 1503610242 | Python | Python3 | py | Runtime Error | 0 | 0 | 305 | import output
N = int(input())
A = [int(n) for n in input().split()]
flg = 1
cnt = 0
while flg:
flg = 0
for i in range(N-1, 0, -1):
if A[i] < A[i-1]:
t = A[i]
A[i] = A[i-1]
A[i-1] = t
flg = 1
cnt += 1
output.print_1(A)
print(cnt) | Traceback (most recent call last):
File "/tmp/tmp5044wpj5/tmp5pakrtzf.py", line 1, in <module>
import output
ModuleNotFoundError: No module named 'output'
| |
s974917569 | p02259 | u146816547 | 1504524097 | Python | Python | py | Runtime Error | 0 | 0 | 395 | def bubbleSort(A, N):
c = 0
flag = 1 # ????????ยฃ??\????ยด?????????ยจ??????
while flag:
flag = 0
for j in range(N-1, 0, -1):
if A[j] < A[j-1]:
A[j], A[j-1] = A[j-1], A[j]
c += 1
flag = 1
print " ".join(map(str, A))
print c
N = int(raw_input())
L = map(int, raw_input().split())
bubbleSort(L, N) | File "/tmp/tmpmccz70hf/tmp7t69xl39.py", line 11
print " ".join(map(str, A))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s801991488 | p02259 | u480053997 | 1508374895 | Python | Python | py | Runtime Error | 0 | 0 | 341 | def bubblesort(N, A):
c, flag = 0, 1
while flag:
flag = False
for j in range(N-1, 0, -1):
if A[j] < A[j-1]:
A[j], A[j-1] = A[j- 1], A[j]
c += 1
flag = True
return (A, c)
A, c = bubblesort(int(input()), list(map(int, input().split())))
print(A)
print(c) | Traceback (most recent call last):
File "/tmp/tmpdi993diz/tmpt6bez8to.py", line 12, in <module>
A, c = bubblesort(int(input()), list(map(int, input().split())))
^^^^^^^
EOFError: EOF when reading a line
| |
s368791562 | p02259 | u514487486 | 1509157578 | Python | Python3 | py | Runtime Error | 30 | 7612 | 419 | def bubbleSort(A, N):
flag = 1
count = 0
while flag == 1:
flag = 0
for i in range(1, N)[::-1]:
if A[j] < A[j - 1]:
tmp = A[j]
A[j] = A[j - 1]
A[j - 1] = tmp
flag = 1
count += 1
print(" ".join(map(str, A)))
print(count)
n = int(input())
A = list(map(int, input().split()))
bubbleSort(A, n) | Traceback (most recent call last):
File "/tmp/tmpfj_dn9w0/tmpwakjfqwo.py", line 17, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s955917687 | p02259 | u626266743 | 1510021084 | Python | Python3 | py | Runtime Error | 0 | 0 | 316 | N = int(input())
A = list(map(int, input().split()))
count = 0
Flag = True
while Flag:
Fag = Flase
for i in range(N-1, 1):
if(A[i] < A[i-1]):
temp = A[i-1]
A[i-1] = A[i]
A[i] = temp
Flag = True
count += 1
print(*A)
print(count)
| Traceback (most recent call last):
File "/tmp/tmp83yuqqhq/tmp3dy20yeg.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s376552892 | p02259 | u626266743 | 1510021100 | Python | Python3 | py | Runtime Error | 0 | 0 | 317 | N = int(input())
A = list(map(int, input().split()))
count = 0
Flag = True
while Flag:
Flag = Flase
for i in range(N-1, 1):
if(A[i] < A[i-1]):
temp = A[i-1]
A[i-1] = A[i]
A[i] = temp
Flag = True
count += 1
print(*A)
print(count)
| Traceback (most recent call last):
File "/tmp/tmpz8i_qet4/tmp28em8zq2.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s883418352 | p02259 | u626266743 | 1510021256 | Python | Python3 | py | Runtime Error | 0 | 0 | 281 | N = int(input())
A = list(map(int, input().split()))
count = 0
flag = True
while Flag:
flag = False
for i in range(N-1, 1):
if(A[i] < A[i-1]):
A[i], A[i-1] = A[i-1], A[i]
flag = True
count += 1
print(*A)
print(count)
| Traceback (most recent call last):
File "/tmp/tmpve_r6xe0/tmprctqlfp7.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s493593656 | p02259 | u424041287 | 1512119774 | Python | Python3 | py | Runtime Error | 30 | 5604 | 423 | def bubbleSort(A, N):
s = 0
flag = 0
while flag == 0:
flag = 1
for j in range(N - 1, 0, -1):
if A[j] < A[j - 1]:
A[j], A[j - 1] = A[j - 1], A[j]
flag = 0
t += 1
t = str(A[0])
for i in range(1,N):
t = t + " " + str(A[i])
print(t)
print(s)
n = int(input())
a = [int(i) for i in input().split()]
bubbleSort(a, n) | Traceback (most recent call last):
File "/tmp/tmplzruquox/tmpi8m98r1e.py", line 17, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s081075244 | p02259 | u203261375 | 1515109495 | Python | Python3 | py | Runtime Error | 0 | 0 | 361 | def bubble_sort(A):
swap_cnt = 0
for i in range(len(A)):
for j in range(len(A), i + 1, -1):
if A[j] < A[j - 1]:
A[j], A[j - 1] = A[j - 1], A[j]
swap_cnt += 1
return A, swap_cnt
n = int(input())
A = list(map(int, input().split()))
A, swap_cnt = bubble_sort(A)
print(' '.join(A))
print(swap_cnt)
| Traceback (most recent call last):
File "/tmp/tmp_dt9qs7k/tmpxjcr656g.py", line 11, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s629505989 | p02259 | u203261375 | 1515109701 | Python | Python3 | py | Runtime Error | 20 | 5592 | 371 | def bubble_sort(A):
swap_cnt = 0
for i in range(len(A)):
for j in range(len(A), i + 1, -1):
if A[j] < A[j - 1]:
A[j], A[j - 1] = A[j - 1], A[j]
swap_cnt += 1
return A, swap_cnt
n = int(input())
A = list(map(int, input().split()))
A, swap_cnt = bubble_sort(A)
print(' '.join(map(str, A)))
print(swap_cnt)
| Traceback (most recent call last):
File "/tmp/tmplu2g9y3p/tmp_xxp2agp.py", line 11, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s710115470 | p02259 | u152639966 | 1516020091 | Python | Python3 | py | Runtime Error | 0 | 0 | 216 | n=int(input())
s=input().split(' ')
flag=1
m=0
while flag:
flag=0
for j in range(1,n):
j=n-j
if s[j]<s[j-1]:
a=s[j]
s[j]=s[j-1]
s[j-1]=a
m+=1
flag=1
print(' '.join(s))
print(m)
| File "/tmp/tmpn_p20b2_/tmpd705km8c.py", line 11
if s[j]<s[j-1]:
TabError: inconsistent use of tabs and spaces in indentation
| |
s736611088 | p02259 | u152639966 | 1516020136 | Python | Python3 | py | Runtime Error | 0 | 0 | 216 | n=int(input())
s=input().split(' ')
flag=1
m=0
while flag:
flag=0
for j in range(1,n):
j=n-j
if s[j]<s[j-1]:
a=s[j]
s[j]=s[j-1]
s[j-1]=a
m+=1
flag=1
print(' '.join(s))
print(m)
| File "/tmp/tmpk9vy2x_s/tmp3ad_88jq.py", line 11
if s[j]<s[j-1]:
TabError: inconsistent use of tabs and spaces in indentation
| |
s960924100 | p02259 | u152639966 | 1516116039 | Python | Python3 | py | Runtime Error | 0 | 0 | 477 | n=int(input())
s=input().split(' ')
flag=1
m=0
while flag:
ใใใใflag=0
ใใใใfor j in range(1,n):
ใใใใใใใใj=n-j
ใใใใใใใใif s[j]<s[j-1]:
ใใใใใใใใใใใใa=s[j]
ใใใใใใใใใใใใs[j]=s[j-1]
ใใใใใใใใใใใใs[j-1]=a
ใใใใใใใใใใใใm+=1
ใใใใใใใใใใใใflag=1
ใใใใใใใใใใใใprint(j)
print(' '.join(s))
print(m)
| File "/tmp/tmp56n4l33p/tmp9v17d9_1.py", line 8
ใใใใflag=0
^
SyntaxError: invalid non-printable character U+3000
| |
s946866909 | p02259 | u152639966 | 1516116195 | Python | Python3 | py | Runtime Error | 0 | 0 | 477 | n=int(input())
s=input().split(' ')
flag=1
m=0
while flag:
ใใใใflag=0
ใใใใfor j in range(1,n):
ใใใใใใใใj=n-j
ใใใใใใใใif s[j]<s[j-1]:
ใใใใใใใใใใใใa=s[j]
ใใใใใใใใใใใใs[j]=s[j-1]
ใใใใใใใใใใใใs[j-1]=a
ใใใใใใใใใใใใm+=1
ใใใใใใใใใใใใflag=1
ใใใใใใใใใใใใprint(j)
print(' '.join(s))
print(m)
| File "/tmp/tmp9l90771e/tmppkyoldh5.py", line 8
ใใใใflag=0
^
SyntaxError: invalid non-printable character U+3000
| |
s717873829 | p02259 | u152639966 | 1516116313 | Python | Python3 | py | Runtime Error | 0 | 0 | 432 | n=int(input())
s=input().split(' ')
flag=1
m=0
while flag:
ใใใใflag=0
ใใใใfor j in range(1,n):
ใใใใใใใใj=n-j
ใใใใใใใใif s[j]<s[j-1]:
ใใใใใใใใใใใใa=s[j]
ใใใใใใใใใใใใs[j]=s[j-1]
ใใใใใใใใใใใใs[j-1]=a
ใใใใใใใใใใใใm+=1
ใใใใใใใใใใใใflag=1
print(' '.join(s))
print(m)
| File "/tmp/tmpui2k7vlr/tmpl71wg3kz.py", line 8
ใใใใflag=0
^
SyntaxError: invalid non-printable character U+3000
| |
s356316971 | p02259 | u464859367 | 1522131999 | Python | Python3 | py | Runtime Error | 20 | 5600 | 377 | n = int(input())
*array, = [int(input()) for i in range(n)]
def bubble_sort(a):
c = 0
flag = 1
i = 0
while flag:
flag = 0
for j in range(n-1, i, -1):
if a[j] < a[j-1]:
a[j], a[j-1] = a[j-1], a[j]
c += 1
flag = 1
i += 1
print(*a)
print(c)
bubble_sort(array)
| Traceback (most recent call last):
File "/tmp/tmps5utgg77/tmp0ou3krb8.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s957391544 | p02259 | u405478089 | 1524796921 | Python | Python | py | Runtime Error | 0 | 0 | 408 | def BS(A, N):
A = list(map(int, A.split()))
flag = 1
count = 0
while flag:
flag = 0
for j in range(N-1, 0, -1):
if A[j] < A[j-1]:
unk = A[j]
A[j] = A[j-1]
A[j-1] = unk
flag = 1
count = count +1
print(" ".join(map(str,A)))
print(count)
N = int(input())
A = input()
BS(A, N)
| Traceback (most recent call last):
File "/tmp/tmpnykv90oa/tmppqsedjd0.py", line 17, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s322188306 | p02259 | u226008611 | 1525952840 | Python | Python3 | py | Runtime Error | 0 | 0 | 1420 | use std::io;
use std::str::FromStr;
fn read_line() -> String {
let mut s = String::new();
io::stdin().read_line(&mut s).unwrap();
s
}
macro_rules! from_line {
($($a:ident : $t:ty),+) => {
$(let $a: $t;)+
{
let _line = read_line();
let mut _it = _line.trim().split_whitespace();
$($a = _it.next().unwrap().parse().unwrap();)+
assert!(_it.next().is_none());
}
};
}
fn main() {
from_line!(n: u64);
let stdin = io::stdin();
let mut buf = String::new();
stdin.read_line(&mut buf).ok();
let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());
let mut v: Vec<i64> = buf.split_whitespace()
.map(|n| i64::from_str(n).unwrap())
.collect();
let mut flag = true;
let mut count = 0;
while flag {
flag = false;
for j in 1..n {
if v[j as usize] < v[(j - 1) as usize] {
let tmp = v[(j - 1) as usize];
v[(j - 1) as usize] = v[j as usize];
v[j as usize] = tmp;
count += 1;
flag = true;
}
}
}
while !v.is_empty() {
if v.len() == 1 {
print!("{}", v.pop().unwrap());
}
else {
print!("{} ", v.pop().unwrap());
}
}
println!("");
println!("{:?}", count);
}
| File "/tmp/tmpoc3e5c13/tmpyyylmqgv.py", line 1
use std::io;
^^^
SyntaxError: invalid syntax
| |
s568826616 | p02259 | u865220118 | 1526620783 | Python | Python | py | Runtime Error | 0 | 0 | 685 | # ใชในใใฎๅฎฃ่จ
A = []
# ๅ
ฅๅใฎๆๅใฎ่กใซใๆฐๅใฎ้ทใใ่กจใๆดๆฐ N ใไธใใใใพใใ
# 2 ่ก็ฎใซใN ๅใฎๆดๆฐใ็ฉบ็ฝๅบๅใใงไธใใใใพใใ
LENGTH =int(input())
A = input().split()
# ๅคๆฐ
N = 0
M = LENGTH - 1
CHANGE = 0
# BubbleSort(A)
# for i = 0 to A.length-1
while N <= LENGTH -1 :
M = LENGTH - 1
print ('N=',N)
# for j = A.length-1 downto i+1
while M >= N + 1:
print ('-M=',M)
# if A[j] < A[j-1]
if A[M] < A[M-1] :
tmp = A[M-1]
A[M-1] = A[M]
A[M] = tmp
CHANGE += 1
M -= 1
N += 1
print(" ".join(map(str,A)))
print (CHANGE)
| Traceback (most recent call last):
File "/tmp/tmp_eacrhvs/tmp4x8dyo50.py", line 6, in <module>
LENGTH =int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s786554286 | p02259 | u865220118 | 1526620840 | Python | Python | py | Runtime Error | 0 | 0 | 686 | # ใชในใใฎๅฎฃ่จ
A = []
# ๅ
ฅๅใฎๆๅใฎ่กใซใๆฐๅใฎ้ทใใ่กจใๆดๆฐ N ใไธใใใใพใใ
# 2 ่ก็ฎใซใN ๅใฎๆดๆฐใ็ฉบ็ฝๅบๅใใงไธใใใใพใใ
LENGTH =int(input())
A = input().split()
# ๅคๆฐ
N = 0
M = LENGTH - 1
CHANGE = 0
# BubbleSort(A)
# for i = 0 to A.length-1
while N <= LENGTH -1 :
M = LENGTH - 1
# print ('N=',N)
# for j = A.length-1 downto i+1
while M >= N + 1:
# print ('-M=',M)
# if A[j] < A[j-1]
if A[M] < A[M-1] :
tmp = A[M-1]
A[M-1] = A[M]
A[M] = tmp
CHANGE += 1
M -= 1
N += 1
print(" ".join(map(str,A)))
print (CHANGE)
| Traceback (most recent call last):
File "/tmp/tmpr267lwt_/tmpxeh3hcm_.py", line 6, in <module>
LENGTH =int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s278183319 | p02259 | u865220118 | 1526620894 | Python | Python | py | Runtime Error | 0 | 0 | 686 | # ใชในใใฎๅฎฃ่จ
A = []
# ๅ
ฅๅใฎๆๅใฎ่กใซใๆฐๅใฎ้ทใใ่กจใๆดๆฐ N ใไธใใใใพใใ
# 2 ่ก็ฎใซใN ๅใฎๆดๆฐใ็ฉบ็ฝๅบๅใใงไธใใใใพใใ
LENGTH =int(input())
A = input().split()
# ๅคๆฐ
N = 0
M = LENGTH - 1
CHANGE = 0
# BubbleSort(A)
# for i = 0 to A.length-1
while N <= LENGTH -1 :
M = LENGTH - 1
# print ('N=',N)
# for j = A.length-1 downto i+1
while M >= N + 1:
# print ('-M=',M)
# if A[j] < A[j-1]
if A[M] < A[M-1] :
tmp = A[M-1]
A[M-1] = A[M]
A[M] = tmp
CHANGE += 1
M -= 1
N += 1
print(" ".join(map(str,A)))
print (CHANGE)
| Traceback (most recent call last):
File "/tmp/tmpic471eob/tmpega_dsp7.py", line 6, in <module>
LENGTH =int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s750543507 | p02259 | u865220118 | 1526621066 | Python | Python | py | Runtime Error | 0 | 0 | 687 | # ใชในใใฎๅฎฃ่จ
A = []
# ๅ
ฅๅใฎๆๅใฎ่กใซใๆฐๅใฎ้ทใใ่กจใๆดๆฐ N ใไธใใใใพใใ
# 2 ่ก็ฎใซใN ๅใฎๆดๆฐใ็ฉบ็ฝๅบๅใใงไธใใใใพใใ
LENGTH =int(input())
A = input().split()
# ๅคๆฐ
N = 0
M = LENGTH - 1
CHANGE = 0
# BubbleSort(A)
# for i = 0 to A.length-1
while N <= LENGTH -1 :
M = LENGTH - 1
# print ('N=',N)
# for j = A.length-1 downto i+1
while M >= N + 1:
# print ('-M=',M)
# if A[j] < A[j-1]
if A[M] < A[M-1] :
tmp = A[M-1]
A[M-1] = A[M]
A[M] = tmp
CHANGE += 1
M -= 1
N += 1
print(" ".join(map(str,A)))
print (CHANGE)
| Traceback (most recent call last):
File "/tmp/tmp6t3yvtdw/tmp_gdqtt04.py", line 6, in <module>
LENGTH =int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s534664733 | p02259 | u405478089 | 1527214046 | Python | Python | py | Runtime Error | 0 | 0 | 408 | def BS(A, N):
A = list(map(int, A.split()))
flag = 1
count = 0
while flag:
flag = 0
for j in range(N-1, 0, -1):
if A[j] < A[j-1]:
unk = A[j]
A[j] = A[j-1]
A[j-1] = unk
flag = 1
count = count +1
print(" ".join(map(str,A)))
print(count)
N = int(input())
A = input()
BS(A, N)
| Traceback (most recent call last):
File "/tmp/tmp59fexrmc/tmpwu4z4hms.py", line 17, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s839635276 | p02259 | u405478089 | 1527214166 | Python | Python | py | Runtime Error | 0 | 0 | 564 | def bubbleSort(A, N): # N ๅใฎ่ฆ็ด ใๅซใ 0-ใชใชใธใณใฎ้
ๅ A
A = list(map(int, A.split()))
flag = 1 # ้ใฎ้ฃๆฅ่ฆ็ด ใๅญๅจใใ
count = 0 # ไบคๆๅๆฐ
while flag:
flag = 0
for j in range(N-1, 0, -1):
if A[j] < A[j-1]:
# A[j] ใจ A[j-1] ใไบคๆ
tmp = A[j]
A[j] = A[j-1]
A[j-1] = tmp
flag = 1
count += 1
print(" ".join(map(str,A)))
print(count)
N = int(input())
A = input()
bubbleSort(A, N)
| Traceback (most recent call last):
File "/tmp/tmp2tme5ur5/tmpex4_pwg1.py", line 18, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s829855158 | p02259 | u405478089 | 1527214454 | Python | Python | py | Runtime Error | 0 | 0 | 564 | def bubbleSort(A, N): # N ๅใฎ่ฆ็ด ใๅซใ 0-ใชใชใธใณใฎ้
ๅ A
A = list(map(int, A.split()))
flag = 1 # ้ใฎ้ฃๆฅ่ฆ็ด ใๅญๅจใใ
count = 0 # ไบคๆๅๆฐ
while flag:
flag = 0
for j in range(N-1, 0, -1):
if A[j] < A[j-1]:
# A[j] ใจ A[j-1] ใไบคๆ
tmp = A[j]
A[j] = A[j-1]
A[j-1] = tmp
flag = 1
count += 1
print(" ".join(map(str,A)))
print(count)
N = int(input())
A = input()
bubbleSort(A, N)
| Traceback (most recent call last):
File "/tmp/tmpy42ucr2h/tmp_um_8q3s.py", line 18, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s960489017 | p02259 | u405478089 | 1527214666 | Python | Python | py | Runtime Error | 0 | 0 | 485 | N = int(input()) #่ฆ็ด ๆฐ
A = list(map(int,input().split())) #ใฝใผใๅฏพ่ฑก๏ผในใใผในๅบๅใโ้
ๅใซๅฑ้๏ผ
flag = 1
i = 0
cnt = 0
#Sortๅฆ็๏ผ่ชๅใกใข๏ผflagใ0ใซใชใฃใใใซใผใใๆใใ๏ผ
while flag:
flag = 0
for j in reversed(range(i+1,N)):
if A[j] < A[j-1]:
tmp = A[j-1]
A[j-1] = A[j]
A[j] = tmp
flag = 1
cnt += 1
i += 1
print(' '.join(map(str,A)))
print(cnt)
| Traceback (most recent call last):
File "/tmp/tmpdcna66k3/tmp6gije0k1.py", line 1, in <module>
N = int(input()) #่ฆ็ด ๆฐ
^^^^^^^
EOFError: EOF when reading a line
| |
s643830227 | p02259 | u405478089 | 1527214769 | Python | Python | py | Runtime Error | 0 | 0 | 565 | def bubbleSort(A, N): # N ๅใฎ่ฆ็ด ใๅซใ 0-ใชใชใธใณใฎ้
ๅ A
A = list(map(int, A.split()))
flag = 1 # ้ใฎ้ฃๆฅ่ฆ็ด ใๅญๅจใใ
count = 0 # ไบคๆๅๆฐ
while flag:
flag = 0
for j in range(N-1, 0, -1):
if A[j] < A[j-1]:
# A[j] ใจ A[j-1] ใไบคๆ
tmp = A[j]
A[j] = A[j-1]
A[j-1] = tmp
flag = 1
count += 1
print(" ".join(map(str,A)))
print(count)
N = int(input())
A = input()
bubbleSort(A, N)
| Traceback (most recent call last):
File "/tmp/tmptsnkofj3/tmpk4l8o9l7.py", line 18, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s139047722 | p02259 | u298224238 | 1529381106 | Python | Python3 | py | Runtime Error | 0 | 0 | 322 | N = int(input())
arr = [int(input()) for i in range(N)]
swap_cnt = 0
i = 0
while True:
swap_flg = False
for j in range(N - 1, i + 1, -1):
if (arr[j] < arr[j - 1]):
arr[j], arr[j - 1] = arr[j - 1], arr[j]
swap_cnt += 1
swap_flg = True
if (!swap_flg):
break
| File "/tmp/tmpo1vdcuum/tmpsooh_tjf.py", line 13
if (!swap_flg):
^
SyntaxError: invalid syntax
| |
s577708885 | p02259 | u153665391 | 1529711164 | Python | Python3 | py | Runtime Error | 0 | 0 | 309 | N = int(input())
A = list(map(int, input().split()))
if __name__ == '__main__':
cnt = 0
for i in range(N):
for j in range(N-1, i, -1):
if j > 0 and A[j-1] > A[j]:
A[j-1], A[j] = A[j], A[j-1]
cnt += 1
print(" ".join(map(str, A)))
pritn(cnt)
| Traceback (most recent call last):
File "/tmp/tmpbs6nummv/tmpzy32ocvy.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s175142122 | p02259 | u148477094 | 1530107339 | Python | Python3 | py | Runtime Error | 0 | 0 | 163 | n=int(input())
a=map(int,input().split())
b=0
for_in range(a):
for i in range(n-1,0,-1):
if a[i]<a[i-1]:
a[i],a[i-1]=a[i-1],a[i]
b=b+1
print(*a)
print(b)
| File "/tmp/tmpz2hfeghc/tmp26qhfpua.py", line 4
for_in range(a):
^^^^^
SyntaxError: invalid syntax
| |
s496168587 | p02259 | u148477094 | 1530107647 | Python | Python3 | py | Runtime Error | 0 | 0 | 189 | n=int(input())
a=list(map(int,input().split())
b=0
for _ in a:
for i in range(n-1,0,-1):
if a[i]<a[i-1]:
a[i],a[i-1]=a[i-1],a[i]
b+=1
print(*a)
print(b)
| File "/tmp/tmp7xpg9en9/tmps3mfru_4.py", line 2
a=list(map(int,input().split())
^
SyntaxError: '(' was never closed
| |
s916729061 | p02259 | u148477094 | 1530107807 | Python | Python3 | py | Runtime Error | 0 | 0 | 189 | n=int(input())
a=list(map(int,input().split())
b=0
for _ in a:
for i in range(n-1,0,-1):
if a[i]<a[i-1]:
a[i],a[i-1]=a[i-1],a[i]
b+=1
print(*a)
print(b)
| File "/tmp/tmpbzjig8lh/tmpfeq6bis6.py", line 2
a=list(map(int,input().split())
^
SyntaxError: '(' was never closed
| |
s031225496 | p02259 | u316584871 | 1530171367 | Python | Python3 | py | Runtime Error | 0 | 0 | 488 | n = int(input())
nlist = list(map(int, input().split()))
def BubbleSort(C, n):
c = 0
for i in range(n-1):
for w in range(i+1, n):
j = n-k+i
if (C[j] < C[j-1]):
a = C[j]
C[j] = C[j-1]
C[j-1] = a
c += 1
BubbleSort(nlist, n)
for i in range(n):
if (i == n-1):
print('{}'.format(nlist[i]), end = '')
else :
print('{}'.format(nlist[i]), end = ' ')
print()
print(c)
| Traceback (most recent call last):
File "/tmp/tmp99face6q/tmp9j82zr9_.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s346341763 | p02259 | u266872031 | 1384601984 | Python | Python | py | Runtime Error | 0 | 0 | 369 | import sys
#A=[[5],[4,5,2,3,1]]
for line in sys.stdin:
line=line.split()
line=map(int,line)
A.append(line)
N=A[0][0]
B=A[1]
n=0
for i in range (N):
for k in range(N-i-1):
print k
j=(N-2)-k
if B[j]>B[j+1]:
C=B[j]
B[j]=B[j+1]
B[j+1]=C
n=n+1
E=map(str,B)
D=" ".join(E)
print n
print D | File "/tmp/tmpksetfuq6/tmpl22gzbs3.py", line 12
print k
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s274122517 | p02260 | u462873421 | 1535539691 | Python | Python | py | Runtime Error | 0 | 0 | 455 | def insection_sort(lst):
lens=len(lst)
ans=0
for i in xrange(lens):
mn=i
for j in xrange(i+1,lens):
if(lst[j]<lst[mn]):
mn=j
if(mn!=i):lens
tmp=lst[i]
lst[i]=lst[mn]
lst[mn]=tmp
ans+=1
return ans
num=int(raw_input().strip())
arr=map(int,raw_input().strip().split())
ans=insection_sort(arr)
print " ".join(str(pp) for pp in arr)
print ans
| File "/tmp/tmpvhwgekaj/tmp0gl3aqsg.py", line 10
tmp=lst[i]
IndentationError: unexpected indent
| |
s414570943 | p02260 | u462873421 | 1535539752 | Python | Python | py | Runtime Error | 0 | 0 | 455 | def insection_sort(lst):
lens=len(lst)
ans=0
for i in xrange(lens):
mn=i
for j in xrange(i+1,lens):
if(lst[j]<lst[mn]):
mn=j
if(mn!=i):lens
tmp=lst[i]
lst[i]=lst[mn]
lst[mn]=tmp
ans+=1
return ans
num=int(raw_input().strip())
arr=map(int,raw_input().strip().split())
ans=insection_sort(arr)
print " ".join(str(pp) for pp in arr)
print ans
| File "/tmp/tmpromwqhwo/tmpbsg80jip.py", line 10
tmp=lst[i]
IndentationError: unexpected indent
| |
s637063261 | p02260 | u817568302 | 1546258579 | Python | Python | py | Runtime Error | 0 | 0 | 383 |
def selectionSort(A, N):
global cnt
for i in range(N):
minj = i
for j in range(i, N):
if A[j] < A[minj]:
minj = j
if i != minj:
tmp = A[i]
A[i] = A[minj]
A[minj] = tmp
cnt = cnt + 1 #
return A
if __name__ == '__main__':
n = int(input())
R = list(map(int, input().split()))
cnt = 0
R = selectionSort(R, n)
print(" ".join(map(str, R)))
print(cnt)
| Traceback (most recent call last):
File "/tmp/tmp4omv083i/tmpta8icizz.py", line 19, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s046268290 | p02260 | u908238078 | 1546422114 | Python | Python3 | py | Runtime Error | 0 | 0 | 606 | #include<iostream>
int selection_sort(int A[], int N) {
int i, j, tmp, sw = 0, min_i;
for (i = 0; i < N-1; i++) {
min_i = i;
for (j = i+1; j < N; j++) {
if (A[j] < A[min_i]) min_i = j;
}
tmp = A[i];
A[i] = A[min_i];
A[min_i] = tmp;
if (i != min_i) sw++;
}
return sw;
}
int main() {
int A[100], i, N, sw;
std::cin >> N;
for (i = 0; i < N; i++) std::cin >> A[i];
sw = selection_sort(A, N);
for (i = 0; i < N; i++) {
if (i > 0) std::cout << ' ';
std::cout << A[i];
}
std::cout << std::endl;
std::cout << sw << std::endl;
return 0;
}
| File "/tmp/tmpdzsmxq_4/tmppdzqz0lu.py", line 3
int selection_sort(int A[], int N) {
^^^^^^^^^^^^^^
SyntaxError: invalid syntax
| |
s720163109 | p02260 | u698762975 | 1555786082 | Python | Python3 | py | Runtime Error | 20 | 5592 | 314 | def selectionsort(l,n):
c=0
for i in range(n):
minj=i
for j in range(i,n):
if int(l[i])<int(l[minj]):
minj=j
l[j],l[minj]=l[minj],l[j]
if j!=minj:
c+=1
print("".join(l))
print(c)
n=int(input())
l=list(input())
selectionsort(l,n)
| Traceback (most recent call last):
File "/tmp/tmpf4n5g1jt/tmpn9j74f70.py", line 13, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s301599673 | p02260 | u482227082 | 1559133863 | Python | Python3 | py | Runtime Error | 0 | 0 | 360 | ef main():
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
tmp = i
for j in range(i, n):
if a[j] < a[tmp]:
tmp = j
if i != tmp:
a[i], a[tmp] = a[tmp], a[i]
ans += 1
print(*a)
print(ans)
if __name__ == '__main__':
main()
| File "/tmp/tmpkh8jufws/tmp32lphi1v.py", line 1
ef main():
^^^^
SyntaxError: invalid syntax
| |
s007471950 | p02260 | u535719732 | 1559404373 | Python | Python3 | py | Runtime Error | 0 | 0 | 229 | n = int(input())
a = list(map(int,input()))
c = 0
min = 9
for i in range(0,n):
minj = i
for j in range(i+1,n):
if a[j] < a[minj]:
minj = j
a[i],a[minj] = a[minj],a[j]
c += 1
print(*a)
print(c)
| Traceback (most recent call last):
File "/tmp/tmp77sowb4z/tmp3cwwixsx.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s008471617 | p02260 | u535719732 | 1559404463 | Python | Python3 | py | Runtime Error | 0 | 0 | 234 | n = int(input())
a = list(map(int,input()))
c = 0
min = 9
for i in range(0,n):
minj = i
for j in range(i+1,n):
if a[j] < a[minj]:
minj = j
a[i],a[minj] = a[minj],a[j]
c += 1
print(*a)
print(c)
| Traceback (most recent call last):
File "/tmp/tmpxg3wfg7d/tmphj075gg3.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s933394991 | p02260 | u481221703 | 1419606968 | Python | Python | py | Runtime Error | 0 | 0 | 264 | n = raw_input()
A = map(int, raw_input().split())
cnt = 0
for i in xrange(len(A)-1):
mini = i
for j = i in xrange(len(A)-1):
if A[j] < A[mini]
mini = j
A[i], A[mini] = A[mini], A[j]
cnt += 1
for x in A:
print x,
print
print cnt | File "/tmp/tmpmfkz7oe8/tmpceo8teeq.py", line 6
for j = i in xrange(len(A)-1):
^
SyntaxError: invalid syntax
| |
s371744264 | p02260 | u481221703 | 1419607073 | Python | Python | py | Runtime Error | 0 | 0 | 263 | n = raw_input()
A = map(int, raw_input().split())
cnt = 0
for i in xrange(len(A)-1):
mini = i
for j in xrange(i, len(A)-1):
if A[j] < A[mini]
mini = j
A[i], A[mini] = A[mini], A[j]
cnt += 1
for x in A:
print x,
print
print cnt | File "/tmp/tmp1d_x8gua/tmpq2voeg_2.py", line 7
if A[j] < A[mini]
^
SyntaxError: expected ':'
| |
s793264474 | p02260 | u571345655 | 1436259678 | Python | Python | py | Runtime Error | 0 | 0 | 367 | coding: utf-8
def selectionSort(A, N):
count = 0
for i in xrange(N):
minj = i
for j in xrange(i, N):
if A[j] < A[minj]:
minj = j
if minj != i:
A[i], A[minj] = A[minj], A[i]
count += 1
return count
def main():
N = input()
A = map(int, raw_input().split())
print selectionSort(A, 6)
print ' '.join(map(str, A))
if __name__ == '__main__':
| File "/tmp/tmp_jyjvzl9/tmp3cravvaa.py", line 1
coding: utf-8
IndentationError: unexpected indent
| |
s087990458 | p02260 | u571345655 | 1436259752 | Python | Python | py | Runtime Error | 0 | 0 | 368 | # coding: utf-8
def selectionSort(A, N):
count = 0
for i in xrange(N):
minj = i
for j in xrange(i, N):
if A[j] < A[minj]:
minj = j
if minj != i:
A[i], A[minj] = A[minj], A[i]
count += 1
return count
def main():
N = input()
A = map(int, raw_input().split())
print selectionSort(A, 6)
print ' '.join(map(str, A))
if __name__ == '__main__':
| File "/tmp/tmpwtxip52h/tmpsr3g2d_w.py", line 18
print selectionSort(A, 6)
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s417267999 | p02260 | u571345655 | 1436259786 | Python | Python | py | Runtime Error | 0 | 0 | 374 | # coding: utf-8
def selectionSort(A, N):
count = 0
for i in xrange(N):
minj = i
for j in xrange(i, N):
if A[j] < A[minj]:
minj = j
if minj != i:
A[i], A[minj] = A[minj], A[i]
count += 1
return count
def main():
N = input()
A = map(int, raw_input().split())
print selectionSort(A, 6)
print ' '.join(map(str, A))
if __name__ == '__main__':
main() | File "/tmp/tmpm7_pvvfm/tmpp0ejfmtz.py", line 18
print selectionSort(A, 6)
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s881166417 | p02260 | u571345655 | 1436259870 | Python | Python | py | Runtime Error | 0 | 0 | 374 | # coding: utf-8
def selectionSort(A, N):
count = 0
for i in xrange(N):
minj = i
for j in xrange(i, N):
if A[j] < A[minj]:
minj = j
if minj != i:
A[i], A[minj] = A[minj], A[i]
count += 1
return count
def main():
N = input()
A = map(int, raw_input().split())
print selectionSort(A, 6)
print ' '.join(map(str, A))
if __name__ == '__main__':
main() | File "/tmp/tmp97ri7yt3/tmp9juhjfye.py", line 18
print selectionSort(A, 6)
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s164131706 | p02260 | u313994256 | 1442290445 | Python | Python | py | Runtime Error | 0 | 0 | 315 | N = int(raw_input())
num_list = map(int, raw_input().split())
c = 0
for i in range(0,N,1):
minj =i
for j in range(i,N,1)
if num_list[j] < num_list[minj]
minj = j
a = num_list[i]
num_list[i] = num_list[minj]
num_list[minj] = a
c += 1
print " ".join(map(str,num_list))
print c | File "/tmp/tmpvld4umjt/tmp8timlb7e.py", line 7
for j in range(i,N,1)
^
SyntaxError: expected ':'
| |
s489719566 | p02260 | u313994256 | 1442290485 | Python | Python | py | Runtime Error | 0 | 0 | 317 | N = int(raw_input())
num_list = map(int, raw_input().split())
c = 0
for i in range(0,N,1):
minj =i
for j in range(i,N,1):
if num_list[j] < num_list[minj]:
minj = j
a = num_list[i]
num_list[i] = num_list[minj]
num_list[minj] = a
c += 1
print " ".join(map(str,num_list))
print c | File "/tmp/tmptw1nvfta/tmp10i8c9j_.py", line 9
minj = j
^
IndentationError: expected an indented block after 'if' statement on line 8
| |
s371019687 | p02260 | u019737947 | 1442292611 | Python | Python | py | Runtime Error | 0 | 0 | 312 | N = int(raw_input())
A = raw_input().split(" ")
count = 0
for i in range(0, N):
minj = i
for j in range(i, N):
if int(A[j]) < int(A[minj)]:
minj = j
if i != minj:
temp = A[i]
A[i] = A[minj]
A[minj] = temp
count += 1
print " ".join(A)
print count | File "/tmp/tmpjbeq4pp7/tmpb05h5n6m.py", line 8
if int(A[j]) < int(A[minj)]:
^
SyntaxError: closing parenthesis ')' does not match opening parenthesis '['
| |
s272835099 | p02260 | u512342660 | 1464097460 | Python | Python | py | Runtime Error | 0 | 0 | 467 | def show_list(a):
for x in a:
print x,
print
def selection_sort(a,n):
count=0
for i in xrange(1,10):
minj = i
for j in xrange(i,n):
if a[j]<a[minj]:
minj = j
tmp = a[i]
a[i]=a[minj]
a[minj]=tmp
count+=1
show_list(a)
print count
def main():
n = input()
a = map(int,raw_input().split())
selection_sort(a,n)
if __name__ == '__main__':
main() | File "/tmp/tmp8_1stcg9/tmpak0tcsf_.py", line 3
print x,
^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s793039077 | p02260 | u611490888 | 1468180608 | Python | Python | py | Runtime Error | 0 | 0 | 495 | # -*- coding: utf-8 -*-
def selection_sort(A, N):
for i in xrange(N):
minj = i
change = 0
for j in xrange(i, N):
if A[j] < A[minj]:
minj = j
temp = A[minj]
A[minj] = A[j]
A[j] = temp
change += 1
if __name__ == "__main__":
N = input()
A = map(int, raw_input().split())
result, change = selection_sort(A, N)
print ' '.join(map(str, result))
print change | File "/tmp/tmpncfpv55z/tmp53n7adu7.py", line 21
print ' '.join(map(str, result))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s361088637 | p02260 | u798803522 | 1472006320 | Python | Python3 | py | Runtime Error | 0 | 0 | 379 | length = int(input())
targ = [int(n) for n in input().split(' ')]
ans = 0
for l in range(length):
value = l
for init in range(l + 1,length):
if targ[value] > targ[init]:
value = init
if value != l:
disp = targ[l]
targ[l] = targ[value]
targ[value] = disp
ans += 1
print(' '.join([str(n) for n in targ]))
print(ans)'' | File "/tmp/tmptk7k0leu/tmpohxry2_8.py", line 15
print(ans)''
^^
SyntaxError: invalid syntax
| |
s611454266 | p02260 | u895660619 | 1487481412 | Python | Python3 | py | Runtime Error | 0 | 0 | 264 | N = int(input())
A = [int(x) for x in input().split()]
num_c = 0
for i in (0, N):
minj = i
for j in (i, N):
if A[j] < A[minj]:
minj = j
A[i], A[minj] = A[minj], A[j]
num_c += 1
print((" ").join(str(x) for x in A))
print(num_c) | Traceback (most recent call last):
File "/tmp/tmp5na6frdg/tmpn6gx7k7z.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s541396407 | p02260 | u895660619 | 1487481451 | Python | Python3 | py | Runtime Error | 0 | 0 | 264 | N = int(input())
A = [int(x) for x in input().split()]
num_c = 0
for i in (0, N):
minj = i
for j in (i, N):
if A[j] < A[minj]:
minj = j
A[i], A[minj] = A[minj], A[j]
num_c += 1
print((" ").join(str(x) for x in A))
print(num_c) | Traceback (most recent call last):
File "/tmp/tmpxayfrqmv/tmpsfbldm8_.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s705103663 | p02260 | u895660619 | 1487481502 | Python | Python3 | py | Runtime Error | 0 | 0 | 264 | N = int(input())
A = [int(x) for x in input().split()]
num_c = 0
for i in (0, N):
minj = i
for j in (i, N):
if A[j] < A[minj]:
minj = j
A[i], A[minj] = A[minj], A[i]
num_c += 1
print((" ").join(str(x) for x in A))
print(num_c) | Traceback (most recent call last):
File "/tmp/tmpthxgr7_k/tmpgknit1md.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s220130716 | p02260 | u854976463 | 1488007223 | Python | Python | py | Runtime Error | 0 | 0 | 1938 | # insertionSort
# divide list into ordered part and part wait to sort
# select one from part wait to sort and insert into ordered par
t
global r, signals
r, signals = 0, False
def insertionSort(A):
global r, signals
# Get length of A
l = len(A)
for i in range(l):
# Selected i-th element to swap from 0 to n
v = A[i]
# j is point to tail of order
j = i - 1
# Move forward, Control order of sorted
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
signals = True
A[j+1] = v
r += 1 if signals else 0
signals = False
return A
raw_input()
res, l = "", 0
for i in insertionSort(map(int, raw_input().split())):
res += (" " if l != 0 else "") + str(i)
l += 1
print res, "\n", r | File "/tmp/tmpdrj8a0v0/tmpygwjbq_t.py", line 31
print res, "\n", r
^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s837582628 | p02260 | u854976463 | 1488011518 | Python | Python | py | Runtime Error | 0 | 0 | 1522 | # insertionSort
# divide list into ordered part and part wait to sort
# select one from part wait to sort and insert into ordered part
def insertionSort(A):
# Get length of A
l, r = len(A), 0
for i in range(l):
# Selected i-th element to swap from 0 to n
v = A[i]
# j is point to tail of order
j = i - 1
# Move forward, Control order of sorted
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
r += (0 if i != j else 1)
return A
raw_input()
res, l = "", 0
for i in insertionSort(map(int, raw_input().split())):
res += (" " if l != 0 else "") + str(i)
l += 1
print res
print r | File "/tmp/tmpbykme8j7/tmpx63mgzh5.py", line 25
print res
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s425337711 | p02260 | u297744593 | 1493446952 | Python | Python3 | py | Runtime Error | 0 | 0 | 376 | #3.4
N = int(input())
a = list(map(int, input().split()))
swapCount = 0
for i in range(0, N):
minIndex = 1
for j in range(i + 1, N):
if a[j] < a[minIndex]:
minIndex = j
if i != minIndex:
tmp = a[i]
a[i] = a[minIdex]
a[minIndex] = tmp
swapCount += 1
print(' '.join(map(str, a)))
print(swapCount)
| Traceback (most recent call last):
File "/tmp/tmpq7u_rr0a/tmpk9jsn36j.py", line 3, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s712881242 | p02260 | u297744593 | 1493447008 | Python | Python3 | py | Runtime Error | 0 | 0 | 372 | #3.4
N = int(input())
a = list(map(int, input().split()))
swapCount = 0
for i in range(0, N):
minIndex = 1
for j in range(0, N):
if a[j] < a[minIndex]:
minIndex = j
if i != minIndex:
tmp = a[i]
a[i] = a[minIdex]
a[minIndex] = tmp
swapCount += 1
print(' '.join(map(str, a)))
print(swapCount)
| Traceback (most recent call last):
File "/tmp/tmpmth0e1af/tmp2nwr90ea.py", line 3, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s089435306 | p02260 | u650790815 | 1496031451 | Python | Python3 | py | Runtime Error | 0 | 0 | 237 | n = int(input())
a = list(map(int,input().strip().split()))
for i in range(n):
minj = i
for j in range(i,n):
if a[j] < a[minj]:
minj = j
a[i],a[minj] = a[minj],a[i]
print(' '.join(map(str,a)))
print(count) | Traceback (most recent call last):
File "/tmp/tmpiww8ij7l/tmp3mcbax2l.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s161259447 | p02260 | u650790815 | 1496032051 | Python | Python3 | py | Runtime Error | 0 | 0 | 272 | n = int(input())
a = list(map(int,input().split()))
cnt = 0
for i in range(n):
minj = i
for j in range(i,n):
if a[j] < a[minj]:
minj = j
a[i],a[minj] = a[minj],a[i]
if i != minj:
cnt += 1
print(' '.join(map(str,a)))
print(count) | Traceback (most recent call last):
File "/tmp/tmp_wgc4c6q/tmpn3hmes9q.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s921234608 | p02260 | u813534019 | 1497087386 | Python | Python | py | Runtime Error | 0 | 0 | 269 | n=input()
lst=input().split()
cnt = 0
for i in range(0, len(lst)):
m = i
for j in range(i, len(lst)):
if lst[m] > lst[j]:
m = j
if m != i:
lst[i], lst[m] = lst[m], lst[i]
cnt+=1
print (" ".join(map(str,lst)))
print (cnt) | Traceback (most recent call last):
File "/tmp/tmpekhp42b2/tmpvfwy1j8l.py", line 1, in <module>
n=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s665073464 | p02260 | u813534019 | 1497087745 | Python | Python | py | Runtime Error | 0 | 0 | 268 | n=input()
lst=input().split()
cnt = 0
for i in range(0, len(lst)):
m = i
for j in range(i, len(lst)):
if lst[m] > lst[j]:
m = j
if m != i:
lst[i], lst[m] = lst[m], lst[i]
cnt+=1
print " ".join(map(str,lst))
print (cnt) | File "/tmp/tmpwigxc674/tmpmwt10p7e.py", line 14
print " ".join(map(str,lst))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s655929593 | p02260 | u747635679 | 1498212898 | Python | Python3 | py | Runtime Error | 20 | 7628 | 315 | n = int(input())
a = [int(x) for x in input().split()]
c = 0
for i in range(n - 1):
minj = i
for j in (i + 1, n):
if a[j] < a[minj]:
minj = j
if minj != i:
tmp = a[i]
a[i] = a[minj]
a[minj] = tmp
c += 1
print(" ".join([str(x) for x in a]))
print(c) | Traceback (most recent call last):
File "/tmp/tmplj292dfg/tmpr46_7ef6.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s469056410 | p02260 | u844704750 | 1498962737 | Python | Python3 | py | Runtime Error | 0 | 0 | 519 | N = int(input())
A = list(map(int, input().split(" ")))
def print_list(A):
for a in A[:-1]:
print ("%d "%a, end="")
print(A[-1])
def SelectionSort(A, N):
count = 0
for i in range(N):
minj = i
for j in range(i, N):
if A[j] < A[minj]:
minj = j
if minj != i:
v = A[i]
A[i] = A[minj]
A[minj] = v
count += 1
return A, count
A_sorted, c = BubbleSort(A, N)
print_list(A_sorted)
print(c) | Traceback (most recent call last):
File "/tmp/tmptup2m1ns/tmpv74j7avq.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s266189847 | p02260 | u343251190 | 1507468414 | Python | Python3 | py | Runtime Error | 0 | 0 | 355 | def selectionsort(A, N):
count = 0
for i in range(N):
min_a = min(A[i:])
min_index = A.index(min_a)
A[i], A[min_index] = min_a, A[i]
if (A[i] != A[min_index]): count += 1
return count
def main():
n = int(input())
data = list(map(int, input().split()))
c = selectionsort2(data, n)
print(*data)
print(c)
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmpqm63lrxx/tmpcpysj7np.py", line 19, in <module>
main()
File "/tmp/tmpqm63lrxx/tmpcpysj7np.py", line 11, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s871353995 | p02260 | u514487486 | 1509157980 | Python | Python3 | py | Runtime Error | 0 | 0 | 270 | def SelectionSort(A):
for i in range(len(A)):
minj = i
for j in range(i, range(A)):
if A[j] < A[minj]:
minj = j
A[i], A[minj] = A[minj], A[i]
n = int(input())
A = list(map(int, input().split()))
SelectionSort(A) | Traceback (most recent call last):
File "/tmp/tmpc8s850pu/tmp1n8irhtp.py", line 10, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s328211661 | p02260 | u514487486 | 1509158166 | Python | Python3 | py | Runtime Error | 0 | 0 | 353 | def SelectionSort(A):
count = 0
for i in range(len(A)):
minj = i
for j in range(i, range(A)):
if A[j] < A[minj]:
minj = j
A[i], A[minj] = A[minj], A[i]
count += 1
print(" ".join(map(str, A)))
print(count)
n = int(input())
A = list(map(int, input().split()))
SelectionSort(A) | Traceback (most recent call last):
File "/tmp/tmpk8v5nlny/tmph0urdt7_.py", line 14, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s582272849 | p02260 | u626266743 | 1510021759 | Python | Python3 | py | Runtime Error | 0 | 0 | 250 | N = innt(input())
A = list(map(int, input().split()))
count = 0
for i in range(0, N-1):
minj = i
for j in range(i, N-1):
if (A[j] < A[minj]):
minj = j
A[i], A[minj] = A[minj], A[i]
count += 1
print(*A)
print(count) | Traceback (most recent call last):
File "/tmp/tmpvnlaeqj_/tmpkdjbf_9i.py", line 1, in <module>
N = innt(input())
^^^^
NameError: name 'innt' is not defined. Did you mean: 'int'?
| |
s873015807 | p02260 | u424457654 | 1510031458 | Python | Python3 | py | Runtime Error | 0 | 0 | 263 | N = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(N)
minj = i
for j in range(i, N)
if a[j] < a[minj]
minj = j
if a[i] != a[minj]
a[minj], a[i] = a[i], a[minj]
count += 1
print(" ".join(map(str, a)))
print(count) | File "/tmp/tmper9rpm64/tmplkb3h973.py", line 4
for i in range(N)
^
SyntaxError: expected ':'
| |
s277897054 | p02260 | u424457654 | 1510031540 | Python | Python3 | py | Runtime Error | 0 | 0 | 244 | N = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(N)
minj = i
for j in range(i, N)
if a[j] < a[minj]
minj = j
if a[i] != a[minj]
a[minj], a[i] = a[i], a[minj]
count += 1
print(*a)
print(count) | File "/tmp/tmp2vc46ta2/tmp87xtlrtc.py", line 4
for i in range(N)
^
SyntaxError: expected ':'
| |
s471283481 | p02260 | u433154529 | 1510992826 | Python | Python3 | py | Runtime Error | 20 | 7720 | 259 | n=int(input())
a=[int(i) for i in input().split(" ")]
x=0
for i in range(n):
mi=i
for j in range(i,n):
if a[j] < a[mi]:
mi = j
if i != mi:
x+=1
a[i],a[mi]=a[mi],[i]
print(" ".join([str(i) for i in a]))
print(x) | Traceback (most recent call last):
File "/tmp/tmpgrq8rwrc/tmpejer306q.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s053924637 | p02260 | u865281338 | 1511749332 | Python | Python3 | py | Runtime Error | 0 | 0 | 459 | def main() :
n = int(input())
nums = [int(i) for i in input().split()]
exchange_count = 0
for i in range(n) :
minj = i
for j in range(i,n) :
if nums[j] < nums[minj] :
minj = j
if minj != i :
exchange_count += 1
nums[i], nums[minj] = nums[minj], nums[i]
print(" ".join(map(str, nums)))
print(excnage_count)
if __name__ == '__main__' :
main() | Traceback (most recent call last):
File "/tmp/tmpurrml_e3/tmp77ie_vew.py", line 19, in <module>
main()
File "/tmp/tmpurrml_e3/tmp77ie_vew.py", line 2, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s207034444 | p02260 | u865281338 | 1511749441 | Python | Python3 | py | Runtime Error | 0 | 0 | 447 | def main() :
n = int(input())
nums = [int(i) for i in input().split()]
exchange_count = 0
for i in range(n) :
minj = i
for j in range(i,n) :
if nums[j] < nums[minj] :
minj = j
if minj != i :
exchange_count += 1
nums[i], nums[minj] = nums[minj], nums[i]
print(" ".join(map(str, nums)))
print(excnage_count)
if __name__ == '__main__' :
main() | Traceback (most recent call last):
File "/tmp/tmpny_9rkg7/tmp7_1zmgpj.py", line 19, in <module>
main()
File "/tmp/tmpny_9rkg7/tmp7_1zmgpj.py", line 2, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s398431720 | p02260 | u865281338 | 1511749547 | Python | Python3 | py | Runtime Error | 0 | 0 | 447 | def main() :
n = int(input())
nums = [int(i) for i in input().split()]
exchange_count = 0
for i in range(n) :
minj = i
for j in range(i,n) :
if nums[j] < nums[minj] :
minj = j
if minj != i :
exchange_count += 1
nums[i], nums[minj] = nums[minj], nums[i]
print(" ".join(map(str, nums)))
print(excnage_count)
if __name__ == '__main__' :
main() | Traceback (most recent call last):
File "/tmp/tmp_o0tshfu/tmpu_2f1yc0.py", line 19, in <module>
main()
File "/tmp/tmp_o0tshfu/tmpu_2f1yc0.py", line 2, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s172629701 | p02260 | u865281338 | 1511749637 | Python | Python3 | py | Runtime Error | 0 | 0 | 448 | def main() :
n = int(input())
nums = [int(i) for i in input().split()]
exchange_count = 0
for i in range(n) :
minj = i
for j in range(i, n) :
if nums[j] < nums[minj] :
minj = j
if minj != i :
exchange_count += 1
nums[i], nums[minj] = nums[minj], nums[i]
print(" ".join(map(str, nums)))
print(excnage_count)
if __name__ == '__main__' :
main() | Traceback (most recent call last):
File "/tmp/tmpphudn3mc/tmptv1upmmk.py", line 19, in <module>
main()
File "/tmp/tmpphudn3mc/tmptv1upmmk.py", line 2, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s491967658 | p02260 | u865281338 | 1511749724 | Python | Python3 | py | Runtime Error | 0 | 0 | 448 | def main() :
n = int(input())
nums = [int(i) for i in input().split()]
exchange_count = 0
for i in range(n) :
minj = i
for j in range(i, n) :
if nums[j] < nums[minj] :
minj = j
if minj != i :
exchange_count += 1
nums[i], nums[minj] = nums[minj], nums[i]
print(" ".join(map(str, nums)))
print(exchage_count)
if __name__ == '__main__' :
main() | Traceback (most recent call last):
File "/tmp/tmpebdy3_l_/tmp34pfjp0b.py", line 19, in <module>
main()
File "/tmp/tmpebdy3_l_/tmp34pfjp0b.py", line 2, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s157223496 | p02260 | u424041287 | 1512122286 | Python | Python3 | py | Runtime Error | 0 | 0 | 389 | def selectionSort(A, N):
s = 0
for i in range(N):
minj = i
for j in range(i,N):
if A[j] < A[minj]:
minj = j
A[i], A[minj] = A[minj], A[i]
s += 1
t = str(A[0])
for i in range(1,N):
t = t + " " + str(A[i])
print(t)
print(s)
n = int(input())
a = [int(i) for i in input().split()]
slectionSort(a, n) | Traceback (most recent call last):
File "/tmp/tmpspcf9l7y/tmpe0qd918o.py", line 16, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s137793775 | p02260 | u424041287 | 1512122300 | Python | Python3 | py | Runtime Error | 0 | 0 | 389 | def selectionSort(A, N):
s = 0
for i in range(N):
minj = i
for j in range(i,N):
if A[j] < A[minj]:
minj = j
A[i], A[minj] = A[minj], A[i]
s += 1
t = str(A[0])
for i in range(1,N):
t = t + " " + str(A[i])
print(t)
print(s)
n = int(input())
a = [int(i) for i in input().split()]
slectionSort(a, n) | Traceback (most recent call last):
File "/tmp/tmpo4r4e9hp/tmpts1j5lzp.py", line 16, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s618442050 | p02260 | u608789460 | 1518848666 | Python | Python3 | py | Runtime Error | 0 | 0 | 251 | n=int(input())
nums=list(map(int,input()))
count=0
for i in range(n):
minj=i
for j in range(i,n):
if nums[j] < nums[minj]:
minj=j
nums[i]=v
nums[i]=nums[minj]
nums[minj]=v
count+=1
print(*nums)
print(count)
| Traceback (most recent call last):
File "/tmp/tmpwqot4bgb/tmpoqvvcb0k.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s442189814 | p02260 | u608789460 | 1518849019 | Python | Python | py | Runtime Error | 0 | 0 | 287 | n=int(input())
nums=list(map(int,input()))
count=0
for i in range(n):
minj=i
for j in range(i,n):
if nums[j] < nums[minj]:
minj=j
if not i==minj:
v=nums[i]
nums[i]=nums[minj]
nums[minj]=v
count+=1
print(*nums)
print(count)
| Traceback (most recent call last):
File "/tmp/tmpeqdwzcme/tmpa26vqrq_.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s287448068 | p02260 | u691071335 | 1522755611 | Python | Python | py | Runtime Error | 0 | 0 | 563 | # include <stdio.h>
int main(){
int N = 0;
scanf("%d", &N);
int a[N];
for(int i=0; i<N; ++i){
scanf("%d", &a[i]);
}
// selection sort
int swap = 0;
for(int i=0; i<N-1; ++i){
int min = i;
for(int j=i+1; j<N; ++j){
if(a[j] > a[min]){
min = j;
}
}
int tmp = a[i];
a[i] = a[min];
a[min] = tmp;
swap++;
}
for(int i=0; i<N-1; ++i){
printf("%d ", a[i]);
}
printf("%d\n", a[N-1]);
printf("%d\n", swap);
}
| File "/tmp/tmptljl6_9r/tmpgxyzzau1.py", line 3
int main(){
^^^^
SyntaxError: invalid syntax
| |
s792364131 | p02260 | u724548524 | 1524969141 | Python | Python3 | py | Runtime Error | 0 | 0 | 246 | import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
c = 0
for i in range(n - 1):
j = np.argmin(a[i:]) + i
if i != j:
a[i], a[j] = a[j], a[i]
c += 1
print(" ".join(map(str, list(a))))
print(c)
| Traceback (most recent call last):
File "/tmp/tmphl4ddbvk/tmp6tulve5c.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s989797224 | p02260 | u724548524 | 1524969211 | Python | Python3 | py | Runtime Error | 0 | 0 | 246 | import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
c = 0
for i in range(n - 1):
j = np.argmin(a[i:]) + i
if i != j:
a[i], a[j] = a[j], a[i]
c += 1
print(" ".join(map(str, list(a))))
print(c)
| Traceback (most recent call last):
File "/tmp/tmpd0r7i8jt/tmp1j4aofyz.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s355752085 | p02260 | u298224238 | 1529382535 | Python | Python3 | py | Runtime Error | 0 | 0 | 324 | N = int(input())
arr = [int(n) for n in input().split()]
swap_cnt = 0
for i in range(0, N):
minj = i
for j in range(i + 1, N - 1):
if A[j] < A[minj]
minj = j
arr[i], arr[minj] = arr[minj], arr[i]
swap_cnt += 1 if i != minj else 0
print(' '.join(map(str, arr)))
print(swap_cnt)
| File "/tmp/tmp_23o9gmi/tmpx2ixf9r8.py", line 8
if A[j] < A[minj]
^
SyntaxError: expected ':'
| |
s821653988 | p02260 | u298224238 | 1529382573 | Python | Python3 | py | Runtime Error | 0 | 0 | 333 | N = int(input())
arr = [int(n) for n in input().split()]
swap_cnt = 0
minj = 0
for i in range(0, N):
minj = i
for j in range(i + 1, N - 1):
if A[j] < A[minj]
minj = j
arr[i], arr[minj] = arr[minj], arr[i]
swap_cnt += 1 if i != minj else 0
print(' '.join(map(str, arr)))
print(swap_cnt)
| File "/tmp/tmp30vw7gxc/tmp1cy343jj.py", line 9
if A[j] < A[minj]
^
SyntaxError: expected ':'
| |
s844223642 | p02260 | u298224238 | 1529382595 | Python | Python3 | py | Runtime Error | 0 | 0 | 328 | N = int(input())
arr = [int(n) for n in input().split()]
swap_cnt = 0
for i in range(0, N):
minj = i
for j in range(i + 1, N - 1):
if arr[j] < arr[minj]
minj = j
arr[i], arr[minj] = arr[minj], arr[i]
swap_cnt += 1 if i != minj else 0
print(' '.join(map(str, arr)))
print(swap_cnt)
| File "/tmp/tmpzr9357zz/tmpd73fpn__.py", line 8
if arr[j] < arr[minj]
^
SyntaxError: expected ':'
| |
s295461605 | p02260 | u148477094 | 1530109189 | Python | Python3 | py | Runtime Error | 0 | 0 | 241 | n=int(input())
a=list(map(int,input().split()))
b=0
for i in range(n):
minj=i
for j in range(i+1,n-1):
if a[minj]>a[j]:
minj=j
if i!=minj:
a[i],a[minj]=a[minj],a[i]
b+=1
print(*a)
print(b)
| File "/tmp/tmpv_o74zil/tmp5zmyxcjl.py", line 11
b+=1
IndentationError: unexpected indent
| |
s210231717 | p02260 | u148477094 | 1530109228 | Python | Python3 | py | Runtime Error | 0 | 0 | 243 | n=int(input())
a=list(map(int,input().split()))
b=0
for i in range(n-1):
minj=i
for j in range(i+1,n-1):
if a[minj]>a[j]:
minj=j
if i!=minj:
a[i],a[minj]=a[minj],a[i]
b+=1
print(*a)
print(b)
| File "/tmp/tmp1ypzsdv0/tmpct7yiffb.py", line 11
b+=1
IndentationError: unexpected indent
| |
s918103083 | p02260 | u148477094 | 1530109267 | Python | Python3 | py | Runtime Error | 0 | 0 | 243 | n=int(input())
a=list(map(int,input().split()))
b=0
for i in range(n-1):
minj=i
for j in range(i+1,n-1):
if a[minj]>a[j]:
minj=j
if i!=minj:
a[i],a[minj]=a[minj],a[i]
b+=1
print(*a)
print(b)
| File "/tmp/tmpw8aowhrc/tmpuquogtho.py", line 11
b+=1
IndentationError: unexpected indent
| |
s952185602 | p02260 | u633068244 | 1393745902 | Python | Python | py | Runtime Error | 0 | 0 | 343 | def ss(n, a):
count = 0
for i in range(n):
mini = i
for j in range(i,n):
if a[j] < a[mini]:
mini = j
if i != mini:
a[i], a[mini] = a[mini], a[i]
count += 1
print " ".join(map(str, a))
print count
ss(int(raw_input()), map(int, raw_inpu().split())) | File "/tmp/tmpzk8svld1/tmpagtzw0si.py", line 11
print " ".join(map(str, a))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.