Buggy python submission (verdict: Runtime Error):
def partition(A, p, r):
    i = p - 1
    for j in range(p, r + 1):
        if A[j][1] <= A[r][1]:
            i += 1
            A[i], A[j] = A[j], A[i]

    return i


def quick_sort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quick_sort(A, p, q - 1)
        quick_sort(A, q + 1, r)


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

quick_sort(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 partition(A, p, r):
    i = p - 1
    for j in range(p, r + 1):
        if A[j] <= A[r]:
            i += 1
            A[i], A[j] = A[j], A[i]

    return i


def quick_sort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quick_sort(A, p, q - 1)
        quick_sort(A, q + 1, r)


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

quick_sort(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 partition(A, p, r):
    i = p - 1
    for j in range(p, r + 1):
        if A[j] <= A[r]:
            i += 1
            A[i], A[j] = A[j], A[i]

    return i


def quick_sort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quick_sort(A, p, q - 1)
        quick_sort(A, q + 1, r)


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

quick_sort(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: Time Limit Exceeded):
import sys

sys.setrecursionlimit(10000)

def partition(A, p, r):
    i = p - 1
    for j in range(p, r + 1):
        if A[j] <= A[r]:
            i += 1
            A[i], A[j] = A[j], A[i]

    return i


def quick_sort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quick_sort(A, p, q - 1)
        quick_sort(A, q + 1, r)


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

quick_sort(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_sort2(a, i, s-1)
        quick_sort2(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: Time Limit Exceeded):
import sys

sys.setrecursionlimit(10000000)

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_sort2(a, i, s-1)
        quick_sort2(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: Time Limit Exceeded):
import sys

sys.setrecursionlimit(1000000)

def partition(A, p, r):
    i = p - 1
    for j in range(p, r + 1):
        if A[j] <= A[r]:
            i += 1
            A[i], A[j] = A[j], A[i]

    return i


def quick_sort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quick_sort(A, p, q - 1)
        quick_sort(A, q + 1, r)


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

quick_sort(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]]
        b.sort()
        t = b[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)


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: Time Limit Exceeded):
import sys
 
sys.setrecursionlimit(1000000)

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]]
        b.sort()
        t = b[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)


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],