Buggy python submission (verdict: Runtime Error):
def quick_sort2(a, i, j):
    if j <= i:
        pass
    else:
        p = a[j]; s = i
        for k in range(i, j):
            if a[k] <= p:
                a[s], a[k] = a[k], a[s]
                s += 1

        a[j], a[s] = a[s], a[j]
        quick_sort(a, i, s-1)
        quick_sort(a, s+1, j)


n = int(raw_input())
A = [int(raw_input()) for _ in xrange(n)]

quick_sort2(A, 0, n - 1)

print " ".join(map(str, A))

Fixed submission:
n = int(raw_input())
x = map(int,raw_input().split())
x.sort()
for i in xrange(n):
	print x[i],

Buggy python submission (verdict: Runtime Error):
def quick_sort2(a, i, j):
    if j <= i:
        pass
    else:
        p = a[j]; s = i
        for k in range(i, j):
            if a[k] <= p:
                a[s], a[k] = a[k], a[s]
                s += 1

        a[j], a[s] = a[s], a[j]
        quick_sort(a, i, s-1)
        quick_sort(a, s+1, j)


n = int(raw_input())
A = map(int, raw_input().split())

quick_sort2(A, 0, n - 1)

print " ".join(map(str, A))

Fixed submission:
n = int(raw_input())
x = map(int,raw_input().split())
x.sort()
for i in xrange(n):
	print x[i],

Buggy python submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10000)

def quick_sort2(a, i, j):
    if j <= i:
        pass
    else:
        p = a[j]; s = i
        for k in range(i, j):
            if a[k] <= p:
                a[s], a[k] = a[k], a[s]
                s += 1

        a[j], a[s] = a[s], a[j]
        quick_sort(a, i, s-1)
        quick_sort(a, s+1, j)


n = int(raw_input())
A = map(int, raw_input().split())

quick_sort2(A, 0, n - 1)

print " ".join(map(str, A))

Fixed submission:
n = int(raw_input())
x = map(int,raw_input().split())
x.sort()
for i in xrange(n):
	print x[i],

Buggy python submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(1000000)

def quick_sort2(a, i, j):
    if j <= i:
        pass
    else:
        p = a[j]; s = i
        for k in range(i, j):
            if a[k] <= p:
                a[s], a[k] = a[k], a[s]
                s += 1

        a[j], a[s] = a[s], a[j]
        quick_sort(a, i, s-1)
        quick_sort(a, s+1, j)


n = int(raw_input())
A = map(int, raw_input().split())

quick_sort2(A, 0, n - 1)

print " ".join(map(str, A))

Fixed submission:
n = int(raw_input())
x = map(int,raw_input().split())
x.sort()
for i in xrange(n):
	print x[i],

Buggy python submission (verdict: Runtime Error):
def select_pivot(a, i, j):
    n = j - i + 1
    if n < 3:
        return i
    else:
        b = [a[i], a[(i+j)/2], a[j]]
        t = b.sort()[1]
        if a[i] == t:
            return i
        elif a[j] == t:
            return j
        else:
            return (i+j) / 2
 
def quick_sort2(a, i, j):
    if j <= i:
        pass
    else:
        pivot = select_pivot(a, i, j); s = i
        x = a[pivot]
        a[pivot], a[j] = a[j], a[pivot]
        for k in range(i, j):
            if a[k] <= x:
                a[s], a[k] = a[k], a[s]
                s += 1
        a[j], a[s] = a[s], a[j]
        quick_sort2(a, i, s-1)
        quick_sort2(a, s+1, j)


puts a.join(' ')
n = int(raw_input())
A = map(int, raw_input().split())

quick_sort2(A, 0, n - 1)

print " ".join(map(str, A))

Fixed submission:
n = int(raw_input())
x = map(int,raw_input().split())
x.sort()
for i in xrange(n):
	print x[i],