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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s641747631 | p02274 | u567281053 | 1458134714 | Python | Python | py | Runtime Error | 0 | 0 | 299 | import numpy
def countInversions(A, cnt):
if len(A) == 1:
return cnt
maxi = numpy.argmax(A)
cnt += len(A) - maxi - 1
del A[maxi]
return countInversions(A, cnt)
if __name__ == "__main__":
input()
A = map(int, raw_input().split())
print countInversions(A, 0) | File "/tmp/tmpo0xncdfz/tmptt9pzmbk.py", line 15
print countInversions(A, 0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s807305061 | p02274 | u567281053 | 1458135048 | Python | Python | py | Runtime Error | 10 | 6432 | 425 | def countInversions(A, cnt):
if len(A) == 1:
return cnt
maxi = argmax(A)
cnt += len(A) - maxi - 1
del A[maxi]
return countInversions(A, cnt)
def argmax(A):
max = maxi = 0
for i in range(len(A)):
if A[i] > max:
max = A[i]
maxi = i
return maxi
if ... | File "/tmp/tmpkhnxqe77/tmpoec8iqym.py", line 21
print countInversions(A, 0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s278051251 | p02274 | u294007207 | 1458572051 | Python | Python | py | Runtime Error | 10 | 6544 | 1068 | import array
def merge_sort(A):
if len(A) <= 1:
return A, 0
mid = len(A) // 2
left, lcount = merge_sort(A[:mid])
right, rcount = merge_sort(A[mid:])
merged, count = merge(left, right)
return merged, lcount + rcount + count
def merge(left, right):
lpos = 0
rpos = 0
rcount = ... | File "/tmp/tmpi2diro_o/tmpj7z5r0z7.py", line 41
print count
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s071062685 | p02274 | u294007207 | 1458572320 | Python | Python | py | Runtime Error | 10 | 6540 | 1068 | import array
def merge_sort(A):
if len(A) <= 1:
return A, 0
mid = len(A) // 2
left, lcount = merge_sort(A[:mid])
right, rcount = merge_sort(A[mid:])
merged, count = merge(left, right)
return merged, lcount + rcount + count
def merge(left, right):
lpos = 0
rpos = 0
rcount = ... | File "/tmp/tmpv0_lztig/tmprpqe6iqg.py", line 41
print count
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s061946076 | p02274 | u963402991 | 1459479502 | Python | Python3 | py | Runtime Error | 0 | 0 | 231 | from collections import deque
n = int(input())
A = deque(map(int, input().split()))
num = list(sorted(A, reverse=True))
count = 0
for i in range(n - 1):
count += len(A) - 1 - A.index(num[i])
A.remove(num[i])
print(count) | Traceback (most recent call last):
File "/tmp/tmphulwu309/tmpow852dq9.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s854815774 | p02274 | u963402991 | 1459480359 | Python | Python3 | py | Runtime Error | 0 | 0 | 230 | from collections import deque
n = int(input())
A = deque(map(int, input().split()))
num = list(sorted(A, reverse=True))
count = 0
for i in range(n - 1):
count += len(A) - 1 - A.index(num[i])
A.remove(num[i])
print(count) | Traceback (most recent call last):
File "/tmp/tmp___4rqu0/tmptf26u74g.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s754508052 | p02274 | u130979865 | 1459839962 | Python | Python | py | Runtime Error | 0 | 0 | 195 | # -*- coding: utf-8 -*-
n = int(raw_input())
A = map(int, raw_input().split())
count = 0
for i in range(n):
for j = in range(i, n):
if A[i] > A[j]:
count += 1
print count | File "/tmp/tmpwn0fuh_5/tmpr22iu2vd.py", line 7
for j = in range(i, n):
^
SyntaxError: invalid syntax
| |
s562236116 | p02274 | u569960318 | 1465803862 | Python | Python3 | py | Runtime Error | 40 | 7724 | 246 | def invNum(A):
if len(A)==1: return 0
cnt = 0
for i in range(1,len(A)):
if A[0] > A[i]: cnt += 1
return cnt + invNum(A[1:])
if __name__=='__main__':
n = int(input())
print(invNum(list(map(int,input().split())))) | Traceback (most recent call last):
File "/tmp/tmpyet2t8we/tmpkevprh3j.py", line 10, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s176368175 | p02274 | u742013327 | 1477887665 | Python | Python3 | py | Runtime Error | 30 | 7700 | 839 | def bubble_sort_revision(target_list):
list_length = len(target_list)
flag = True
change_count = 0
for top_index in range(1,list_length):
for i in range(top_index, list_length)[::-1]:
if target_list[i] < target_list[i - 1] and target_list[top_index] >= target_list[i]:
... | Traceback (most recent call last):
File "/tmp/tmpuqdo4zro/tmp8soyb89s.py", line 26, in <module>
l = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s049440295 | p02274 | u130834228 | 1491372398 | Python | Python3 | py | Runtime Error | 0 | 0 | 162 | n = int(input())
A = list(map(int, input().split()))
cnt = 0
for i in range(n):
for j in range(i+1, n):
if A[i] > A[j]:
cnt++
print(cnt) | File "/tmp/tmpdvjt0mf_/tmpslqvvaar.py", line 8
cnt++
^
SyntaxError: invalid syntax
| |
s982427589 | p02274 | u130834228 | 1492065174 | Python | Python3 | py | Runtime Error | 0 | 0 | 887 | def merge(A, left, mid, right):
n1 = mid-left
n2 = right-mid
#L = [0 for i in range(n1+1)]
#R = [0 for i in range(n2+1)]
#for i in range(n1):
# L[i] = A[left+i]
#for i in range(n2):
# R[i] = A[mid+i]
L = A[left:mid]
R = A[mid:right]
L.append(float('inf'))
R.append(... | Traceback (most recent call last):
File "/tmp/tmpshkkmu94/tmpzz60mxhj.py", line 38, in <module>
n = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s205424197 | p02274 | u193453446 | 1501553789 | Python | Python3 | py | Runtime Error | 0 | 0 | 383 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def main():
""" ????????? """
num = int(input().strip())
A = list(map(int,input().split()))
cnt = 0
for i in range(num-1):
for j in range(i,num):
if i > j:
cnt++
if cnt % 2 == 0:
cnt += 1
else:
... | File "/tmp/tmpct3xog4k/tmpwxf430mi.py", line 12
cnt++
^
SyntaxError: invalid syntax
| |
s575713100 | p02274 | u426534722 | 1516976288 | Python | Python3 | py | Runtime Error | 0 | 0 | 130 | N = int(input())
A = tuple(map(int, input().split()))
print(len(1 for i in range(N - 1) for j in range(i + 1, N) if A[i] > A[j]))
| Traceback (most recent call last):
File "/tmp/tmpti4qw1fa/tmpipf_mpij.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s960564865 | p02274 | u464859367 | 1525321775 | Python | Python3 | py | Runtime Error | 0 | 0 | 1873 | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ALDS1_5_B
{
class Program
{
static long cnt = 0;
static void Main(string[] args)
{
int n = int.Parse(Console.ReadLine());
int[] S = Arra... | File "/tmp/tmp2_yhymj3/tmpeauzgaqz.py", line 1
using System;
^^^^^^
SyntaxError: invalid syntax
| |
s994874665 | p02274 | u011621222 | 1526041484 | Python | Python3 | py | Runtime Error | 0 | 0 | 953 | MAX = 500000;
maxnum = 1000000010;
cnt=0
def Merge_sort(A):
def merge(A,left,mid,right):
global cnt
t1=array.array('L',[])
t2=array.array('L',[])
for i in range(left,mid):
t1.append(A[i])
for i in range(mid,right):
t2.append(A[i])
... | Traceback (most recent call last):
File "/tmp/tmp4iqktw16/tmpbl_ehwj3.py", line 45, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s800669911 | p02274 | u564105430 | 1527154562 | Python | Python3 | py | Runtime Error | 0 | 0 | 368 | def shakerSort(A):
cnt=0
left=0
right=len(A)-1
while left<right:
for i in range(left,right):
if A[i]>A[i+1]:
A[i],A[i+1]=A[i+1],A[i]
sh=i
cnt+=1
right=sh
for j in range(right,left,-1):
if A[j]<A[j-1]:
A[j],A[j-1]=A[j-1],A[j]
sh=j
cnt+=1
left=sh
return cnt
n=int(input())
A=lis... | File "/tmp/tmp6nkxwlbj/tmp16zggm9e.py", line 22
print(shakerSort(A)
^
SyntaxError: '(' was never closed
| |
s776178404 | p02274 | u564105430 | 1527154576 | Python | Python3 | py | Runtime Error | 20 | 5600 | 369 | def shakerSort(A):
cnt=0
left=0
right=len(A)-1
while left<right:
for i in range(left,right):
if A[i]>A[i+1]:
A[i],A[i+1]=A[i+1],A[i]
sh=i
cnt+=1
right=sh
for j in range(right,left,-1):
if A[j]<A[j-1]:
A[j],A[j-1]=A[j-1],A[j]
sh=j
cnt+=1
left=sh
return cnt
n=int(input())
A=lis... | Traceback (most recent call last):
File "/tmp/tmpcafs5wk2/tmpeqcq9v2x.py", line 20, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s613079792 | p02274 | u782850499 | 1527826622 | Python | Python3 | py | Runtime Error | 0 | 0 | 716 | cnt = 0
def merge(A,left,mid,right):
global cnt
n1 = mid - left
n2 = right - mid
L = [A[i] for i in range(left, mid)]
R = [A[i] for i in range(mid, right)]
L.append(float("inf"))
R.append(float("inf"))
i = 0
j = 0
for k in range(left, right):
if L[i] <= R[j]:
... | File "/tmp/tmpdr029vr0/tmpbqy571tb.py", line 32
return cnt
^^^^^^^^^^
SyntaxError: 'return' outside function
| |
s040864485 | p02274 | u007270338 | 1528174586 | Python | Python3 | py | Runtime Error | 650 | 16476 | 631 | #coding:utf-8
n = int(input())
A = list(map(int, input().split()))
def Merge(A, left, mid, right):
L = A[left:mid]
R = A[mid:right]
L.append(510000)
R.append(510000)
i,j = 0,0
global cnt
for k in range(left,right):
if L[i] <= R[j]:
A[k] = L[i]
i += 1
... | Traceback (most recent call last):
File "/tmp/tmpgurwc372/tmp1btcbu1q.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s865466949 | p02275 | u657361950 | 1531377589 | Python | Python3 | py | Runtime Error | 0 | 0 | 960 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(reader.readLine());
String[] strA... | File "/tmp/tmpt2loz1ao/tmpvu0kbiv8.py", line 5
public class Main {
^^^^^
SyntaxError: invalid syntax
| |
s675647583 | p02275 | u153665391 | 1532162564 | Python | Python3 | py | Runtime Error | 0 | 0 | 416 | def counting_sort(MAX):
C = [0 for _ in range(MAX+1)]
for i in range(N):
C[A[i]] += 1
for i in range(1, MAX+1):
C[i] = C[i] + C[i-1]
for i in range(N-1, -1, -1):
C[A[i]] -= 1
B[C[A[i]]] = A[i]
N = int(input())
A = list(map(int, input().split()))
MAX = 0
for n in A:
... | Traceback (most recent call last):
File "/tmp/tmpaixkfawv/tmpd8__atrq.py", line 14, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s870515981 | p02275 | u487861672 | 1534940227 | Python | Python3 | py | Runtime Error | 20 | 5600 | 351 | def counting_sort(A, k):
B = [0] * len(A)
C = [0] * k
for a in A:
C[a] += 1
for i in range(1, k):
C[i] += C[i - 1]
for a in reversed(A):
B[C[a] - 1] = a
C[a] -= 1
return B
def main():
n = int(input())
A = [int(x) for x in input().split()]
print(*... | Traceback (most recent call last):
File "/tmp/tmponcwgcam/tmpb1i5mtcs.py", line 24, in <module>
main()
File "/tmp/tmponcwgcam/tmpb1i5mtcs.py", line 19, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s894993784 | p02275 | u803657704 | 1545368733 | Python | Python3 | py | Runtime Error | 20 | 5600 | 547 | def CountingSort(A, B, k):
C = [0] * (k+1)
#C[i] に i の出現数を記録する
for j in range(0,k):
C[A[j]]+=1
#print("C ",j,C[:k+1])
#C[i] に i 以下の数の出現数を記録する
for i in range(1,k+1):
C[i] = C[i] + C[i-1]
#print("C' ",j,C[:k+1])
for j in range(k-1,-1,-1):
B[C[A[j]]] = A[j]
... | Traceback (most recent call last):
File "/tmp/tmpdjzm73yt/tmp6qivipxl.py", line 16, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s328622135 | p02275 | u237270455 | 1545369825 | Python | Python3 | py | Runtime Error | 20 | 6500 | 451 | n = int(input())
temp = [int(i) for i in input().split()]
A = [None for i in range(10000)]
B = [0 for i in range(n)]
k = 0
for i in range(n):
A[i] = temp[i]
if(A[i]>k):
k=A[i]
def cntSort(A, B, k):
C = [0 for i in range(k)]
for j in range(0, n):
C[A[j]] += 1
for i in range(1, k):
... | Traceback (most recent call last):
File "/tmp/tmp54m9a72z/tmp8ytgga8f.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s504494930 | p02275 | u237270455 | 1545369980 | Python | Python3 | py | Runtime Error | 50 | 7976 | 483 | n = int(input())
temp = [int(i) for i in input().split()]
A = [None for i in range(200000)]
B = [0 for i in range(n)]
k = 0
for i in range(n):
A[i] = temp[i]
if(A[i]>k):
k=A[i]
if(k>10000):
break
def cntSort(A, B, k):
C = [0 for i in range(k)]
for j in range(0, n):
C[A[j]] +=... | Traceback (most recent call last):
File "/tmp/tmp77807odd/tmpqyzkic7l.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s151307829 | p02275 | u237270455 | 1545370052 | Python | Python3 | py | Runtime Error | 70 | 7976 | 483 | n = int(input())
temp = [int(i) for i in input().split()]
A = [None for i in range(200001)]
B = [0 for i in range(n)]
k = 0
for i in range(n):
A[i] = temp[i]
if(A[i]>k):
k=A[i]
if(k>10000):
break
def cntSort(A, B, k):
C = [0 for i in range(k)]
for j in range(0, n):
C[A[j]] +=... | Traceback (most recent call last):
File "/tmp/tmpp2rkusgj/tmpqpf06qtp.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s183824544 | p02275 | u237270455 | 1545370247 | Python | Python3 | py | Runtime Error | 40 | 8076 | 549 | n = int(input())
temp = [int(i) for i in input().split()]
A = [None for i in range(200001)]
B = [0 for i in range(n)]
k = 0
for i in range(n):
try:
A[i] = temp[i]
if(A[i]>k):
k=A[i]
if(k>10000):
break
except IndexError:
break
def cntSort(A, B, k):
C = ... | Traceback (most recent call last):
File "/tmp/tmpijyxs4qw/tmp6zkn_9pu.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s528510020 | p02275 | u237270455 | 1545370566 | Python | Python3 | py | Runtime Error | 40 | 8072 | 573 | n = int(input())
temp = [int(i) for i in input().split()]
A = [None for i in range(200001)]
B = [0 for i in range(n)]
k = 0
for i in range(n):
try:
A[i] = temp[i]
if(A[i]>k):
k=A[i]
if(k>10000):
break
except IndexError:
n = len(A[i])-1
break
def cn... | Traceback (most recent call last):
File "/tmp/tmp2tvjiin3/tmp_gvd_sp4.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s820381094 | p02275 | u237270455 | 1545371032 | Python | Python3 | py | Runtime Error | 40 | 8072 | 565 | n = int(input())
temp = [int(i) for i in input().split()]
A = [None for i in range(200000)]
B = [0 for i in range(n)]
k = 0
for i in range(n):
try:
A[i] = temp[i]
if(A[i]>k):
k=A[i]
if(k>10000):
break
except IndexError:
n = n-1
break
def cntSort(A,... | Traceback (most recent call last):
File "/tmp/tmpdk8tjz2o/tmp6jfovn21.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s687367983 | p02275 | u237270455 | 1545371202 | Python | Python3 | py | Runtime Error | 30 | 8076 | 627 | n = int(input())
temp = [int(i) for i in input().split()]
A = [None for i in range(200000)]
B = [0 for i in range(n)]
k = 0
for i in range(n):
try:
A[i] = temp[i]
if(A[i]>k):
k=A[i]
if(k>10000):
break
except IndexError:
n = n-1
break
def cntSort(A,... | Traceback (most recent call last):
File "/tmp/tmp5mxn790b/tmpli8skl99.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s046534502 | p02275 | u363774867 | 1556206867 | Python | Python3 | py | Runtime Error | 20 | 5604 | 417 | def countingsort(a,k):
c=[0]*(k+1)
n=len(a)
for i in a:
c[i]+=1
for i in range(1,k+1):
c[i]=c[i]+c[i-1]
b=[0]*n
for i in range(n-1,-1,-1):
b[c[a[i]]-1]=a[i]
c[a[i]]-=1
return b
q=int(input())
a=list(map(int,input().split()))
ret=countingsort(a,q)
for i in rang... | Traceback (most recent call last):
File "/tmp/tmp8a58cnx4/tmp5o5tk97e.py", line 13, in <module>
q=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s046257173 | p02275 | u363774867 | 1556206983 | Python | Python3 | py | Runtime Error | 0 | 0 | 412 | def countingsort(a,k):
c=[0]*(k+1)
n=len(a)
for i in a:
c[i]+=1
for i in range(1,k+1):
c[i]=c[i]+c[i-1]
b=[0]*n
for i in range(n-1,-1,-1):
b[c[a[i]]-1]=a[i]
c[a[i]]-=1
return b
o=int(input())
a=list(map(int,input().split()))
q=max(a)
ret=countingsort(a,q)
for ... | Traceback (most recent call last):
File "/tmp/tmpmz0ukvki/tmpivpa7d9r.py", line 13, in <module>
o=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s241325775 | p02275 | u805716376 | 1556765891 | Python | Python3 | py | Runtime Error | 0 | 0 | 321 | #計数ソート
n = int(input())
a = list(map(int, input().split()))
def countSort(a):
N = max(a)
c = [0]*(N+2)
b = [0]*len(a)
for i in a:
c[i] += 1
for i in range(1,len(c)):
c[i] += c[i-1]
for i in a:
b[c[i]-1] = i
c[i] -= 1
print(b)
countSort(*a)
| Traceback (most recent call last):
File "/tmp/tmp3nw38suc/tmpob0eqibk.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s830923495 | p02275 | u548252256 | 1559567106 | Python | Python3 | py | Runtime Error | 20 | 5604 | 488 | def CountingSort(A,B,num):
C = [0 for _ in range(num)]
#C[i]にiの出現回数を記録する
for i in A:
C[i] += 1
#C[i]にi以下の数の出現数を記録する =>累積度数分布を出力
k = max(A)
for j in range(k+1):
C[j] += C[j-1]
for h in range(k+1):
B[C[A[h]]-1] = A[h]
C[A[h]] -= 1
if __name__ == '__main__':
num = int(input())
A = [int(i) for i in i... | Traceback (most recent call last):
File "/tmp/tmp37pewwq0/tmpt8g7ivbz.py", line 20, in <module>
num = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s572567553 | p02275 | u548252256 | 1559569777 | Python | Python3 | py | Runtime Error | 20 | 5608 | 509 | def CountingSort(A,B,num):
C = [0 for _ in range(num+1)]
#C[i]にiの出現回数を記録する
for i in A:
C[i] += 1
#C[i]にi以下の数の出現数を記録する =>累積度数分布を出力
k = max(A)
for j in range(1,k+1):
C[j] += C[j-1]
for h in range(num-1,-1,-1):
B[C[A[h]]-1] = A[h]
C[A[h]] -= 1
if __name__ == '__main__':
num = int(input())
A = [int(i) ... | Traceback (most recent call last):
File "/tmp/tmpx8faj2_8/tmppan8jt3w.py", line 18, in <module>
num = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s021027269 | p02275 | u963402991 | 1459733596 | Python | Python3 | py | Runtime Error | 0 | 0 | 496 |
def counting_sort(A, k):
B = [0 for i in range(len(A))]
C = [0 for i in range(0, k + 1)]
# C[i]???i???????????°????¨??????????
for j in range(1, n):
C[A[j]] += 1
# C[i]???i??\????????°???????????°????¨??????????
for i in range(1, k + 1):
C[i] += C[i - 1]
for j in revers... | Traceback (most recent call last):
File "/tmp/tmp1kdw7_hn/tmpmczh3r6k.py", line 19, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s102288708 | p02275 | u130979865 | 1459916711 | Python | Python | py | Runtime Error | 10 | 6864 | 480 | # -*- coding: utf-8 -*-
def countSort(A, m):
count = [0]*(m+1)
n = len(A)
B = [0]*m
j = 0
for i in range(n):
count[A[i]] += 1
for i in range(1, m):
count[i] += count[i-1]
for i in range(n-1, -1, -1):
j = count[A[i]]
B[j] = A[i]
count[A[i]] = j-1
f... | File "/tmp/tmpmzcadedh/tmpzk_t51qy.py", line 23
print " ".join(map(str, B))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s270117966 | p02275 | u130979865 | 1459916833 | Python | Python | py | Runtime Error | 40 | 22500 | 486 | # -*- coding: utf-8 -*-
def countSort(A, m):
count = [0]*(m+1)
n = len(A)
B = [0]*2000000
j = 0
for i in range(n):
count[A[i]] += 1
for i in range(1, m):
count[i] += count[i-1]
for i in range(n-1, -1, -1):
j = count[A[i]]
B[j] = A[i]
count[A[i]] = j-1... | File "/tmp/tmpe2ey5370/tmpy1we963_.py", line 23
print " ".join(map(str, B))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s246946181 | p02275 | u742013327 | 1478597896 | Python | Python3 | py | Runtime Error | 0 | 0 | 566 |
def counting_sort(target_list):
counter = [0 for i in range(10000)]
for n in target_list:
counter[n] += 1
for i in range(1,10000):
counter[i] = counter[i] + counter[i-1]
result = [0 for i in range(len(target_list))]
for n in target_list[::-1]:
result[counter[n] - 1] = n
... | Traceback (most recent call last):
File "/tmp/tmpl6ze8kfc/tmpna8esnmp.py", line 18, in <module>
n_list = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s039396554 | p02275 | u022407960 | 1478861863 | Python | Python3 | py | Runtime Error | 30 | 8776 | 699 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def counting_sort(A, k):
B = [0] * k
C = [0] * k
for j in range(array_length):
C[A[j]] += 1
# print('1', C[:array_length])
for i in range(1, k):
C[i] += C[i - 1]
# print('2', C[:array_length])
for m in range(array... | Traceback (most recent call last):
File "/tmp/tmp2h1h0beq/tmpdll9ah99.py", line 28, in <module>
array_length = int(_input[0])
~~~~~~^^^
IndexError: list index out of range
| |
s901136393 | p02275 | u022407960 | 1478862060 | Python | Python3 | py | Runtime Error | 20 | 8716 | 699 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def counting_sort(A, k):
B = [0] * k
C = [0] * k
for j in range(array_length):
C[A[j]] += 1
# print('1', C[:array_length])
for i in range(1, k):
C[i] += C[i - 1]
# print('2', C[:array_length])
for m in range(array... | Traceback (most recent call last):
File "/tmp/tmpz7vjg6tl/tmpquab9buj.py", line 28, in <module>
array_length = int(_input[0])
~~~~~~^^^
IndexError: list index out of range
| |
s653995451 | p02275 | u564398841 | 1486275720 | Python | Python3 | py | Runtime Error | 60 | 12644 | 447 | def CountingSort(A, k):
C = [0] * k
B = C[:]
for a in A:
C[a] += 1
for i in range(1, len(C)):
C[i] += C[i - 1]
for i in range(len(A) - 1, -1, -1):
B[C[A[i]]] = A[i]
C[A[i]] -= 1
return B
if __name__ == '__main__':
N = int(input())
A = [int(i) for i in i... | Traceback (most recent call last):
File "/tmp/tmp3kn8fvgn/tmp6zlenne3.py", line 16, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s526485922 | p02275 | u564398841 | 1486275791 | Python | Python3 | py | Runtime Error | 80 | 17428 | 446 | def CountingSort(A, k):
C = [0] * k
B = C[:]
for a in A:
C[a] += 1
for i in range(1, len(C)):
C[i] += C[i - 1]
for i in range(len(A) - 1, -1, -1):
B[C[A[i]]] = A[i]
C[A[i]] -= 1
return B
if __name__ == '__main__':
N = int(input())
A = [int(i) for i in in... | Traceback (most recent call last):
File "/tmp/tmptjg0y9gh/tmpljoi6bac.py", line 15, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s354247541 | p02275 | u564398841 | 1486275857 | Python | Python3 | py | Runtime Error | 0 | 0 | 448 | def CountingSort(A, k):
C = [0] * k
B = C[:]
for a in A:
C[a] += 1
for i in range(1, len(C)):
C[i] += C[i - 1]
for i in range(len(A) - 1, -1, -1):
B[C[A[i]]] = A[i]
C[A[i]] -= 1
return B
if __name__ == '__main__':
N = int(input())
A = [int(i) for i in ... | Traceback (most recent call last):
File "/tmp/tmp2mb9milp/tmpo9fx9csp.py", line 17, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s063138590 | p02275 | u564398841 | 1486275876 | Python | Python3 | py | Runtime Error | 0 | 0 | 492 | def CountingSort(A, k):
C = [0] * k
B = C[:]
for a in A:
C[a] += 1
for i in range(1, len(C)):
C[i] += C[i - 1]
for i in range(len(A) - 1, -1, -1):
B[C[A[i]]] = A[i]
C[A[i]] -= 1
return B
fin = open('sample.txt')
input = fin.readline
if __name__ == '__main__':
... | Traceback (most recent call last):
File "/tmp/tmp57116_7c/tmpyjxr_14n.py", line 14, in <module>
fin = open('sample.txt')
^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'sample.txt'
| |
s949611255 | p02275 | u539803218 | 1496291586 | Python | Python3 | py | Runtime Error | 20 | 7548 | 463 | def counting_sort(array, maxval):
m = maxval + 1
count = [0] * (m)
for a in array:
count[a] += 1
i = 0
for a in range(m):
for c in range(count[a]):
array[i] = a
i += 1
return array
if __name__ == '__main__':
N = int(input())
l = list(map(int, inp... | Traceback (most recent call last):
File "/tmp/tmpr7tyjmmj/tmpyj2nzbiz.py", line 14, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s094813552 | p02275 | u091533407 | 1499064044 | Python | Python3 | py | Runtime Error | 0 | 0 | 430 | def CountingSort(A, B, k):
C = [0 for i in range(k+2)]
for j in range(n):
C[A[j]] += 1
for i in range(k+1):
C[i] += C[i-1]
for j in range(n-1, -1, -1):
B[C[A[j]]-1] = A[j]
C[A[j]] -= 1
if __name__=="__main__":
n = int(input())
D = list(map(... | File "/tmp/tmpadoktw4f/tmporsg7_8f.py", line 20
print(" ".join(map, str(E))))
^
SyntaxError: unmatched ')'
| |
s380206750 | p02275 | u548155360 | 1512315316 | Python | Python3 | py | Runtime Error | 20 | 6304 | 693 | # coding=utf-8
def counting_sort(input_list: list, upper: int) -> list:
number = len(input_list)
# noinspection PyUnusedLocal
b = [0 for i in range(number+1)]
# noinspection PyUnusedLocal
counter_list = [0 for i in range(upper+1)]
for j in input_list:
counter_list[j] += 1
for i in... | Traceback (most recent call last):
File "/tmp/tmpv9oc1gsz/tmpclx38p8b.py", line 24, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s033489758 | p02275 | u146816547 | 1512651854 | Python | Python | py | Runtime Error | 0 | 0 | 372 | def counting_sort(A, B, k):
C = [0 for _ in xrange(k+1)]
for a in A:
C[a] += 1
for i in xrange(k):
C[i] = C[i] + C[i-1]
for i in xrange(n-1, -1, -1):
B[C[A[i]]-1] = A[i]
C[A[i]] -= 1
n = int(raw_input())
A = map(int, raw_input().split())
B = [0 for _ in xrange(n)]
co... | File "/tmp/tmprqbmh7_y/tmpouju013x.py", line 20
print " ".join(map(str, B)
^
SyntaxError: '(' was never closed
| |
s418049986 | p02275 | u613534067 | 1521105051 | Python | Python3 | py | Runtime Error | 20 | 5604 | 427 | def counting_sort(A, k):
C = [0 for i in range(k)]
# C[i]にiの出現数を記録する
for l in A:
C[l] += 1
# C[i]にi以下の数の出現数を記録する
for i in range(1, k):
C[i] = C[i] + C[i-1]
B = [None for i in range(len(A))]
for l in A[::-1]:
B[C[l]-1] = l
C[l] -= 1
return B
input()
a = list(map... | Traceback (most recent call last):
File "/tmp/tmpqnxxh9x9/tmpacc9gb7w.py", line 17, in <module>
input()
EOFError: EOF when reading a line
| |
s612826947 | p02275 | u912143677 | 1521769986 | Python | Python3 | py | Runtime Error | 0 | 0 | 368 | n = int(input())
a = list(map(int, input().split()))
def countingsort(a, k):
c = [0 for i in range(k)]
b = [0 for i in range(n)]
for j in range(n):
c[a[j]] += 1
for i in range(k):
c[i+1] += c[i]
for j in reversed(range(n)):
b[c[a[j]]] = a[j]
c[a[j]] -= 1
... | Traceback (most recent call last):
File "/tmp/tmpp3h2ju7d/tmpleujm3w7.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s629230074 | p02275 | u126478680 | 1525368415 | Python | Python3 | py | Runtime Error | 20 | 5604 | 410 | def counting_sort(A, k):
n = len(A)
B = [0 for i in range(n)]
C = [0 for i in range(k+1)]
for j in range(n):
C[A[j]] += 1
for i in range(1, k):
C[i] = C[i] + C[i-1]
for j in range(n-1, -1, -1):
B[C[A[j]]-1] = A[j]
C[A[j]] -= 1
return B
n = int(input())
A ... | Traceback (most recent call last):
File "/tmp/tmptjwr9t0s/tmp0w1m8tua.py", line 18, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s312454040 | p02275 | u938045879 | 1527411402 | Python | Python3 | py | Runtime Error | 20 | 5600 | 414 | n = int(input())
s = list(map(int, input().split()))
k = len(set(s))
c = [0 for i in range(k+1)]
def counting_sort(a, k):
global c
b = [0 for i in range(len(a)+1)]
for i in range(n):
c[a[i]] += 1
for i in range(1,k+1):
c[i] = c[i] + c[i - 1]
for i in reversed(range(n)):
b[c... | Traceback (most recent call last):
File "/tmp/tmp78j9iezc/tmpwecul_gv.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s788126510 | p02275 | u007270338 | 1528125339 | Python | Python3 | py | Runtime Error | 20 | 6724 | 386 | #coding:utf-8
n = int(input())
A = list(map(int, input().split()))
k = 10000
C = [0 for i in range(k)]
B = [0 for i in range(n)]
def CountingSort(A,B,k):
for i in range(n):
C[A[i]] += 1
for i in range(k):
C[i] += C[i-1]
for i in range(n):
B[C[A[i]]-1] = A[i]
C[A[i]] -= 1
C... | Traceback (most recent call last):
File "/tmp/tmp3p5q_xws/tmpgourcl93.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s230090955 | p02275 | u007270338 | 1528170012 | Python | Python3 | py | Runtime Error | 30 | 6724 | 403 | #coding:utf-8
n = int(input())
A = list(map(int, input().split()))
k = 10000
C = [0 for i in range(k)]
B = [0 for i in range(n)]
def CountingSort(A,B,k):
for i in range(n):
C[A[i]] += 1
for i in range(k):
C[i] += C[i-1]
for i in range(n-1,-1,-1):
B[C[A[i]]-1] = A[i]
C[A[i]]... | Traceback (most recent call last):
File "/tmp/tmpczvcrcgi/tmpt0wfrzj2.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s704416795 | p02275 | u007270338 | 1528170054 | Python | Python3 | py | Runtime Error | 20 | 6724 | 395 | #coding:utf-8
n = int(input())
A = list(map(int, input().split()))
k = 10000
C = [0 for i in range(k)]
B = [0 for i in range(n)]
def CountingSort(A,B,k):
for i in range(n):
C[A[i]] += 1
for i in range(k):
C[i] += C[i-1]
for i in range(n):
B[C[A[i]]-1] = A[i]
C[A[i]] -= 1
C... | Traceback (most recent call last):
File "/tmp/tmpgvt3m75m/tmp9odgw5eb.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s050047795 | p02276 | u356729014 | 1551415826 | Python | Python3 | py | Runtime Error | 0 | 0 | 373 | def partition(A, p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
n = int(input())
A = [int(num) for num in input().split()]
p = 0
r = n
q = partition(A, p, r)
A_str = [str(a) for a in A]
A_s... | Traceback (most recent call last):
File "/tmp/tmp8pp7ah7r/tmpas46y63d.py", line 14, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s176338949 | p02276 | u356729014 | 1551416182 | Python | Python3 | py | Runtime Error | 0 | 0 | 367 | def partition(A, p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
n = int(input())
A = [int(num) for num in input().split()]
p = 0
r = n
q = partition(A, p, r)
A_str = [str(a) for a in A]
A_str[q]... | Traceback (most recent call last):
File "/tmp/tmpbqhgp0av/tmphfw_8l77.py", line 13, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s015066530 | p02276 | u356729014 | 1551416362 | Python | Python3 | py | Runtime Error | 0 | 0 | 361 | def partition(A, p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
A = [int(num) for num in input().split()][1:]
p = 0
r = len(A)-1
q = partition(A, p, r)
A_str = [str(a) for a in A]
A_str[q] = "["... | Traceback (most recent call last):
File "/tmp/tmpxesggdkv/tmp2bz0ukfk.py", line 13, in <module>
A = [int(num) for num in input().split()][1:]
^^^^^^^
EOFError: EOF when reading a line
| |
s941511366 | p02276 | u387603681 | 1556265547 | Python | Python3 | py | Runtime Error | 0 | 0 | 306 | def partition(A, p, r):
x = A[r]
i = p-1
for j in range(p, r-1):
if A[j] <= i:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
n = int(input())
*A, = map(int, input().split())
r = A[-1]
p = min(A)
A[partition(A, p, r)] = "["+r+"]"
print(' '.join(A))
| Traceback (most recent call last):
File "/tmp/tmpn8j8t35z/tmpxlaw98a5.py", line 11, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s736819025 | p02276 | u253463900 | 1442386041 | Python | Python3 | py | Runtime Error | 0 | 0 | 467 | def Partition(A,p,r):
x = A[r]
i = p-1
for j in range(p,r):
if (A[j] <= x):
i += 1
A[i],A[j] = A[j],A[i]
A[i+1],A[r] = A[r],A[i+1]
return i+1
n = int(input())
st = input()
data = list(map(int,st.split()))
mid = Partition(data,0,len(data)-1)
for i in range(0,mid):
... | File "/tmp/tmplrzkxrfp/tmplq8qdo2i.py", line 19
print("[{0}] ".format(data[mid])))
^
SyntaxError: unmatched ')'
| |
s951000642 | p02276 | u488601719 | 1448793521 | Python | Python3 | py | Runtime Error | 0 | 0 | 290 | def partition(a, p, r):
x = a[r]
i = p - 1
for j in range(p, r):
if a[j] <= x:
i = i + 1
a[i], a[j] = a[j], a[i]
a[i+1], a[r] = a[r], a[i+1]
print(*a)
return i+1
n = int(input())
a = list(map(int, input().split()))
partition(a, 0, n) | Traceback (most recent call last):
File "/tmp/tmpaciffugw/tmp61e35_2c.py", line 12, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s936228354 | p02276 | u488601719 | 1448793695 | Python | Python3 | py | Runtime Error | 0 | 0 | 322 | def partition(a, p, r):
x = a[r]
i = p - 1
for j in range(p, r):
if a[j] <= x:
i = i + 1
a[i], a[j] = a[j], a[i]
a[i+1], a[r] = a[r], a[i+1]
return i+1
n = int(input())
a = list(map(int, input().split()))
m = partition(a, 0, n-1)
a[m] = "[%s]"%(a[m])
print(" ".join(a... | Traceback (most recent call last):
File "/tmp/tmpzhznh6ui/tmp3s0ga3vz.py", line 11, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s583212725 | p02276 | u963402991 | 1459737470 | Python | Python3 | py | Runtime Error | 0 | 0 | 335 |
def partition(A, p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
n = int(input())
A = list(map(int, input().split()))
q =partition(A, 1, len(A) - 1)
print(*A[:q] + " [{0}] ... | File "/tmp/tmpro_nfhfu/tmpj34xu_fz.py", line 19
print(*A[:q] + " [{0}] " + *A[q + 1:])
^
SyntaxError: invalid syntax
| |
s392850139 | p02276 | u963402991 | 1459904099 | Python | Python3 | py | Runtime Error | 0 | 0 | 335 |
def partition(A, p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
n = int(input())
A = list(map(int, input().split()))
q =partition(A, 1, len(A) - 1)
print(*A[:q] + " [{0}] ... | File "/tmp/tmpqnvll4nq/tmp9vorae9w.py", line 19
print(*A[:q] + " [{0}] " + *A[q + 1:])
^
SyntaxError: invalid syntax
| |
s825753577 | p02276 | u918457647 | 1469261346 | Python | Python3 | py | Runtime Error | 0 | 0 | 386 | def partition(a, p, r):
x = a[r]
i = p-1
for j in range(p, r):
if a[j] <= x:
i += 1
tmp = a[i]
a[i] = a[j]
a[j] = tmp
tmp = a[i+1]
a[i+1] = a[r]
a[r] = tmp
return a, i+1
n = int(input())
A = list(map(int, input().split()))
ans, idx ... | Traceback (most recent call last):
File "/tmp/tmpspmqxoe1/tmphy56dkpr.py", line 18, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s656947416 | p02276 | u918457647 | 1469261421 | Python | Python3 | py | Runtime Error | 0 | 0 | 386 | def partition(a, p, r):
x = a[r]
i = p-1
for j in range(p, r):
if a[j] <= x:
i += 1
tmp = a[i]
a[i] = a[j]
a[j] = tmp
tmp = a[i+1]
a[i+1] = a[r]
a[r] = tmp
return a, i+1
n = int(input())
A = list(map(int, input().split()))
ans, idx ... | Traceback (most recent call last):
File "/tmp/tmphwlm6oo6/tmpy8nlhnr0.py", line 18, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s934012144 | p02276 | u918457647 | 1469261775 | Python | Python3 | py | Runtime Error | 0 | 0 | 314 | def partition(p, r):
x = a[r]
i = p-1
for j in range(p, r):
if a[j] <= x:
i += 1
a[i], a[j] = a[j], a[i]
a[i+1], a[r] = a[r], a[i+1]
return i+1
n = int(input())
a = list(map(int, input().split()))
idx = partition(0, n-1)
print(*a[:idx], [a[idx]], *a[idx+1:]) | Traceback (most recent call last):
File "/tmp/tmpzs1museh/tmpdtky3tgm.py", line 14, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s823548226 | p02276 | u811733736 | 1480892419 | Python | Python3 | py | Runtime Error | 0 | 0 | 920 | def partition(A, p, r):
"""
???????????????????????????????????????A[r]?????°?????????????????????????????????????????????A[r-1]??¨?´??????????????????§??¨???
"""
x = A[r]p
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
temp = A[i]
A[i] = A[j]
... | File "/tmp/tmpe0l5wtok/tmp1wew1hjy.py", line 5
x = A[r]p
^
SyntaxError: invalid syntax
| |
s365250637 | p02276 | u564398841 | 1486264075 | Python | Python3 | py | Runtime Error | 0 | 0 | 546 | def partition(A, p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] < x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
fin = open('sample.txt')
input = fin.readline
if __name__ == '__main__':
N = int(input().strip())
AA = ... | Traceback (most recent call last):
File "/tmp/tmpnu2ot5e7/tmpn14n4f1e.py", line 12, in <module>
fin = open('sample.txt')
^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'sample.txt'
| |
s330649724 | p02276 | u300946041 | 1490582153 | Python | Python3 | py | Runtime Error | 0 | 0 | 413 | # -*- coding: utf-8 -*-
def partition(A, p, r):
x = A[r]
i = p
for j in range(1, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i], A[r] = A[r], A[i]
return i
def main():
n = int(input())
A = [int(e) for e in input().split()]
p = 0
r = len(A)... | Traceback (most recent call last):
File "/tmp/tmppwglp9sl/tmp2l1g29ft.py", line 24, in <module>
main()
File "/tmp/tmppwglp9sl/tmp2l1g29ft.py", line 16, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s394720646 | p02276 | u546285759 | 1492338485 | Python | Python3 | py | Runtime Error | 0 | 0 | 310 | def partition(A, p, r):
x = A[r]
i = p-1
for j in range(p, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i+1], A[r] = A[r], A[i+1]
return i+1
n = int(input())
A = list(map(int, input().split()))
i = partition(A, 0, n)
A[i] = "["+str(A[i])+"]"
print(*A) | Traceback (most recent call last):
File "/tmp/tmp4qo0i9ig/tmprvmqmdz5.py", line 11, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s888926531 | p02276 | u426534722 | 1498489422 | Python | Python3 | py | Runtime Error | 0 | 0 | 397 | def partition(p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
n = int(input())
A = [int(i) for i in input().split()]
q = partition(0, n - 1);
print(*A[:q], "[" + str(A[q]) + "]",... | Traceback (most recent call last):
File "/tmp/tmp0dhzixe2/tmp8fvj6bay.py", line 10, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s728948316 | p02276 | u426534722 | 1498489502 | Python | Python3 | py | Runtime Error | 0 | 0 | 377 | def partition(p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
n = int(input())
A = [int(i) for i in input().split()]
q = partition(0, n - 1);
print(*A[:q], "[" + str(A[q]) + "]",... | Traceback (most recent call last):
File "/tmp/tmprppu92js/tmpv2k2kjdc.py", line 10, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s538195242 | p02276 | u426534722 | 1498489539 | Python | Python3 | py | Runtime Error | 0 | 0 | 378 | n = int(input())
A = [int(i) for i in input().split()]
def partition(p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
q = partition(0, n - 1);
print(*A[:q], "[" + str(A[q]) + "]"... | Traceback (most recent call last):
File "/tmp/tmpucfahxxj/tmpsjun97oj.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s014981213 | p02276 | u426534722 | 1498489752 | Python | Python3 | py | Runtime Error | 0 | 0 | 377 | n = int(input())
A = [int(i) for i in input().split()]
def partition(p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
q = partition(0, n - 1)
print(*A[:q], "[" + str(A[q]) + "]",... | Traceback (most recent call last):
File "/tmp/tmpt5sp3c8_/tmp57kndo5q.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s773487402 | p02276 | u193453446 | 1501834803 | Python | Python3 | py | Runtime Error | 0 | 0 | 1409 | import sys
def swap(A, i, j):
x = A[i]
A[i] = A[j]
A[j] = x
def partition(A, p, r, idx):
x = A[r][idx] # 1 x = A[r]
i = p - 1 # 2 i = p-1
for j in range(p, r): # 3 for j = p to r-1
if A[j][idx] <= x: # 4 if A[j] <= x
i += 1... | Traceback (most recent call last):
File "/tmp/tmpkyp506k0/tmpe4qedthy.py", line 54, in <module>
main()
File "/tmp/tmpkyp506k0/tmpe4qedthy.py", line 28, in main
num = int(input().strip())
^^^^^^^
EOFError: EOF when reading a line
| |
s574054424 | p02276 | u918276501 | 1507977754 | Python | Python3 | py | Runtime Error | 0 | 0 | 305 | def partition(A,p=0, r=None):
if r is None:
r = len(A)-1
x = A[r]
i = p-1
for j in range(p,r):
while A[j] <= x:
i += 1
swap(A,i,j)
swap(A,i+1,r)
return i+1
k = partition(A)
B = list(map(str, A))
B[k] = "[{}]".format(B[k])
print(" ".join(B)) | Traceback (most recent call last):
File "/tmp/tmpkaown_6u/tmpk60__cq_.py", line 13, in <module>
k = partition(A)
^
NameError: name 'A' is not defined
| |
s209213016 | p02276 | u918276501 | 1507977830 | Python | Python3 | py | Runtime Error | 0 | 0 | 407 | def partition(A,p=0, r=None):
if r is None:
r = len(A)-1
x = A[r]
i = p-1
for j in range(p,r):
while A[j] <= x:
i += 1
swap(A,i,j)
swap(A,i+1,r)
return i+1
if __name__ == "__main__:
input()
A = list(map(int, input().strip().split()))
k = parti... | File "/tmp/tmpy4dvjxag/tmp6sdh0eki.py", line 13
if __name__ == "__main__:
^
SyntaxError: unterminated string literal (detected at line 13)
| |
s992520929 | p02276 | u918276501 | 1507977918 | Python | Python3 | py | Runtime Error | 20 | 7732 | 465 | def swap(A,i,j):
A[i],A[j] = A[j],A[i]
return A
def partition(A,p=0, r=None):
if r is None:
r = len(A)-1
x = A[r]
i = p-1
for j in range(p,r):
while A[j] <= x:
i += 1
swap(A,i,j)
swap(A,i+1,r)
return i+1
if __name__ == "__main__":
input()
... | Traceback (most recent call last):
File "/tmp/tmpjs1lkl4h/tmptvg1rv8r.py", line 18, in <module>
input()
EOFError: EOF when reading a line
| |
s760473715 | p02276 | u918276501 | 1507978050 | Python | Python3 | py | Runtime Error | 20 | 7664 | 465 | def swap(A,i,j):
A[i],A[j] = A[j],A[i]
return A
def partition(A,p=0, r=None):
if r is None:
r = len(A)-1
x = A[r]
i = p-1
for j in range(p,r):
while A[j] <= x:
i += 1
swap(A,i,j)
swap(A,i+1,r)
return i+1
if __name__ == "__main__":
input()
... | Traceback (most recent call last):
File "/tmp/tmp95_4x1rq/tmpyzksu_0_.py", line 18, in <module>
input()
EOFError: EOF when reading a line
| |
s293091259 | p02276 | u024715419 | 1508301757 | Python | Python3 | py | Runtime Error | 0 | 0 | 222 | n = int(input())
a = list(map(int,input().split()))
x = a[-1]
i = -1
for j in range(len(a)-1):
if a[j] <= x:
i += 1
a[i], a[j] = a[j], a[i]
a[i + 1], a[n] = "[" + str(a[n]) + "]", a[i + 1]
print(*a) | Traceback (most recent call last):
File "/tmp/tmpbkxnx0__/tmp8fxczigx.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s234753546 | p02276 | u150984829 | 1518707515 | Python | Python3 | py | Runtime Error | 0 | 0 | 213 | n=int(input())-1
A=list(map(int,input().split()))
i=0
for j in range(n):
if A[j]<=A[-1]:A[i],A[j]=A[j],A[i];i+=1
A[i],A[n]=A[n],A[i]
print(" ".join(map(str,A[:k]))+" ["+str(A[i])+"] "+" ".join(map(str,A[k+1:])))
| Traceback (most recent call last):
File "/tmp/tmpsxl7cy7z/tmps916glmn.py", line 1, in <module>
n=int(input())-1
^^^^^^^
EOFError: EOF when reading a line
| |
s472070148 | p02276 | u150984829 | 1520050949 | Python | Python3 | py | Runtime Error | 0 | 0 | 253 | def s():
n=int(input())-1
A=list(map(int,input().split()))
i=0
for j in range(n):A[j]<=A[-1]and A[i],A[j]=A[j],A[i];i+=1
A[i],A[n]=A[n],A[i]
print(" ".join(map(str,A[:i]))+" ["+str(A[i])+"] "+" ".join(map(str,A[i+1:])))
if'__main__'==__name__:s()
| File "/tmp/tmp8oz7buo_/tmpznw82p7o.py", line 5
for j in range(n):A[j]<=A[-1]and A[i],A[j]=A[j],A[i];i+=1
^^^^
SyntaxError: cannot assign to subscript here. Maybe you meant '==' instead of '='?
| |
s937400055 | p02276 | u559106458 | 1529402274 | Python | Python3 | py | Runtime Error | 0 | 0 | 469 | MAX=100000
list=[]
def partition(p,r):
t=0
x=list[r]
i=p-1
j=p
while(j<r):
if(int(list[j])<=x):
i+=1
t=int(list[i])
list[i]=list[j]
list[j]=t
j+=1
t=int(list[i+1])
list[i+1]=list[r]
list[r]=t
return i+1
n=int(input())
i=0
while(i<n):
list.append(int(input()))
i+=1
q=partition(0,n-1)
i=0... | Traceback (most recent call last):
File "/tmp/tmpoasgxhj0/tmpp2sjeoko.py", line 23, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s268990490 | p02276 | u559106458 | 1529402634 | Python | Python3 | py | Runtime Error | 0 | 0 | 531 | list=[]
def partition(p,r):
t=0
x=list[r]
i=p-1
j=p
while(j<r):
if(int(list[j])<=x):
i+=1
t=int(list[i])
list[i]=list[j]
list[j]=t
j+=1
t=int(list[i+1])
list[i+1]=list[r]
list[r]=t
return i+1
def main():
n=int(input())
i=0
while(i<n):
list.append(int(input()))
i+=1
q=partition(0,n-... | Traceback (most recent call last):
File "/tmp/tmpm86w738o/tmpg_dpfqy9.py", line 43, in <module>
main()
File "/tmp/tmpm86w738o/tmpg_dpfqy9.py", line 23, in main
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s017832533 | p02276 | u559106458 | 1529402914 | Python | Python3 | py | Runtime Error | 0 | 0 | 531 | list=[]
def partition(p,r):
t=0
x=list[r]
i=p-1
j=p
while(j<r):
if(int(list[j])<=x):
i+=1
t=int(list[i])
list[i]=list[j]
list[j]=t
j+=1
t=int(list[i+1])
list[i+1]=list[r]
list[r]=t
return i+1
def main():
n=int(input())
i=0
while(i<n):
list.append(int(input()))
i+=1
q=partition(0,n-... | Traceback (most recent call last):
File "/tmp/tmpma2m3l2c/tmplamippxt.py", line 43, in <module>
main()
File "/tmp/tmpma2m3l2c/tmplamippxt.py", line 23, in main
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s259190785 | p02276 | u559106458 | 1529403676 | Python | Python3 | py | Runtime Error | 0 | 0 | 539 | list=[]
def partition(p,r):
t=0
x=list[r]
i=p-1
j=p
while(j<r):
if(int(list[j])<=x):
i+=1
t=int(list[i])
list[i]=list[j]
list[j]=t
j+=1
t=int(list[i+1])
list[i+1]=list[r]
list[r]=t
return i+1
def main():
n=int(input())
i=0
while(i<n):
list.append(int(input().split()))
i+=1
q=partit... | Traceback (most recent call last):
File "/tmp/tmpghlvuwcz/tmp4uy5fo3f.py", line 43, in <module>
main()
File "/tmp/tmpghlvuwcz/tmp4uy5fo3f.py", line 23, in main
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s828433104 | p02277 | u153665391 | 1532150242 | Python | Python3 | py | Runtime Error | 40 | 6344 | 1486 | import copy
def partition(p, r):
i = p
for j in range(p, r):
if A[r][1] >= A[j][1]:
A[i], A[j] = A[j], A[i]
i += 1
A[r], A[i] = A[i], A[r]
return i
def quick_sort(p, r):
if p < r:
q = partition(p, r)
quick_sort(p, q-1)
quick_sort(q+1, r)
def... | Traceback (most recent call last):
File "/tmp/tmpd28sf0qf/tmpoox1d04j.py", line 49, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s351724737 | p02277 | u363774867 | 1556201932 | Python | Python3 | py | Runtime Error | 0 | 0 | 1242 | import copy
INF = 10000000000
def merge(A, left, mid, right):
count = 0
L = A[left:mid] + [(INF,INF)]
R = A[mid:right] + [(INF,INF)]
i, j = 0, 0
for k in range(left, right):
count = count + 1
if L[i][1] <= R[j][1]:
A[k] = L[i]
i = i + 1
else:
... | Traceback (most recent call last):
File "/tmp/tmpa3sh9s3i/tmp1dv0oq3b.py", line 41, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s609627580 | p02277 | u363774867 | 1556202310 | Python | Python3 | py | Runtime Error | 0 | 0 | 1247 | import copy
INF = 10000000000
def merge(A, left, mid, right):
count = 0
L = A[left:mid] + [(INF,INF)]
R = A[mid:right] + [(INF,INF)]
i, j = 0, 0
for k in range(left, right):
count = count + 1
if L[i][1] <= R[j][1]:
A[k] = L[i]
i = i + 1
else:
... | Traceback (most recent call last):
File "/tmp/tmprbjbk_mm/tmpg6yefc6h.py", line 41, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s981716302 | p02277 | u363774867 | 1556202363 | Python | Python3 | py | Runtime Error | 0 | 0 | 1245 | import copy
INF = 10000000000
def merge(A, left, mid, right):
count = 0
L = A[left:mid] + [(INF,INF)]
R = A[mid:right] + [(INF,INF)]
i, j = 0, 0
for k in range(left, right):
count = count + 1
if L[i][1] <= R[j][1]:
A[k] = L[i]
i = i + 1
else:
... | Traceback (most recent call last):
File "/tmp/tmplfpt6fts/tmpyvc1tlfw.py", line 41, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s574950056 | p02277 | u805716376 | 1556771183 | Python | Python3 | py | Runtime Error | 0 | 0 | 777 | a = []
n = int(input())
for _ in range(n):
s, i = input().split()
a += [(s, int(i))]
b.setdefault(int(d), []).append(v)
b = {val: iter(s).__next__ for val, s in D.items()}
def partition(a, left, right):
standard = a[right][1]
cnt = left
for i in range(left, right):
if a[i][1] <= standar... | Traceback (most recent call last):
File "/tmp/tmp20bdaha8/tmpgybgs0ow.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s086753553 | p02277 | u805716376 | 1556771233 | Python | Python3 | py | Runtime Error | 0 | 0 | 784 | a = []
b = {}
n = int(input())
for _ in range(n):
s, i = input().split()
a += [(s, int(i))]
b.setdefault(int(d), []).append(v)
b = {val: iter(s).__next__ for val, s in D.items()}
def partition(a, left, right):
standard = a[right][1]
cnt = left
for i in range(left, right):
if a[i][1] <= ... | Traceback (most recent call last):
File "/tmp/tmpf79ogt1r/tmpxxdzwl7a.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s403333794 | p02277 | u805716376 | 1556771279 | Python | Python3 | py | Runtime Error | 0 | 0 | 784 | a = []
b = {}
n = int(input())
for _ in range(n):
s, i = input().split()
a += [(s, int(i))]
b.setdefault(int(i), []).append(s)
b = {val: iter(s).__next__ for val, s in D.items()}
def partition(a, left, right):
standard = a[right][1]
cnt = left
for i in range(left, right):
if a[i][1] <= ... | Traceback (most recent call last):
File "/tmp/tmpijc5gju3/tmp_e1wbrvj.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s067568932 | p02277 | u567380442 | 1421672814 | Python | Python3 | py | Runtime Error | 0 | 0 | 737 | def partition(a, p, r):
q = p
for i in range(p, r):
if a[i][1] <= a[r][1]:
a[q], a[i] = a[i], a[q]
q += 1
a[q], a[r] = a[r], a[q]
return q
def quicksort(a, p, r):
if p < r:
q = partition(a, p, r)
quicksort(a, p, q-1)
quicksort(a, q+1, r)
de... | Traceback (most recent call last):
File "/tmp/tmp5u48rlam/tmps2whu9oz.py", line 26, in <module>
for i in range(n):
^^^^^^^^
TypeError: 'str' object cannot be interpreted as an integer
| |
s359738590 | p02277 | u885889402 | 1442389202 | Python | Python3 | py | Runtime Error | 0 | 0 | 832 | def partition(a,p,r):
x=int(a[r][1:])
i=p-1
for j in range(p,r):
if(int(a[j][1:])<=x):
i+=1
a[i],a[j]=a[j],a[i]
a[i+1],a[r]=a[r],a[i+1]
return i+1
def quicksort(a,p,r):
if(p<r):
q=partition(a,p,r)
quicksort(a,p,q-1)
quicksort(a,q+1,r)
a=[... | Traceback (most recent call last):
File "/tmp/tmpn5w1j1v3/tmppz40qkkm.py", line 18, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s080917881 | p02277 | u894381890 | 1442389923 | Python | Python | py | Runtime Error | 10 | 6364 | 1446 | import sys
def partition(A, p, r):
x = int(A[r][1])
i = p - 1
for j in range(p, r):
if int(A[j][1]) <= x:
i = i + 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return i + 1
def quickSort(A, p, r):
if p < r:
q = partition(A, p, r)
quickSort(A, p, q - 1)
quickSort(A,... | File "/tmp/tmpt6z512qz/tmpmm1q2lwu.py", line 52
print 'Not stable'
^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s890525307 | p02277 | u253463900 | 1442476760 | Python | Python3 | py | Runtime Error | 0 | 0 | 1496 | def Partition(A,p,r):
x = A[r]
i = p-1
for j in range(p,r):
if (A[j] <= x):
i += 1
A[i],A[j] = A[j],A[i]
A[i+1],A[r] = A[r],A[i+1]
return i+1
def qsort(A,p,r):
if p < r:
q = Partition(A,p,r)
qsort(A,p,q-1)
qsort(A,q+1,r)
class card(object... | Traceback (most recent call last):
File "/tmp/tmpj_sp086f/tmpeckmyqy3.py", line 37, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s449351581 | p02277 | u313994256 | 1442583714 | Python | Python | py | Runtime Error | 0 | 0 | 1519 | def mergesort(A, left, right):
if left + 1 < right:
mid = (left + right)/2
mergesort(A, left, mid)
mergesort(A, mid, right)
merge(A, left, mid, right)
def merge(A, left, mid, right):
n1 = mid -left
n2 = right - mid
L = []
R = []
x = [" "," ", 10000... | File "/tmp/tmpsn_204bb/tmpqfxfgaoq.py", line 77
print " \n".join(num_list)
^
IndentationError: unindent does not match any outer indentation level
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.