Buggy python submission (verdict: Runtime Error):
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
while(i<n):
	if(i==q):
		print("[",end="")
		print(str(list[i]),end="")
		print("]",end="")
	else:
		print(str(list[i])+" ",end="")
	i+=1

print()



Fixed submission:
def partition(a, left, right):
    pivot = a[right-1]
    i = left - 1
    for j in range(left, right-1):
        if a[j] <= pivot:
            i += 1
            a[i], a[j] = a[j], a[i]
    a[i+1], a[right-1] = a[right-1], a[i+1]
    return i + 1
 
def main():
    n = int(input())
    a = list(map(int, input().split()))
    p = partition(a, 0, len(a))
    a[p] = '[' + str(a[p]) + ']'
    print(' '.join(map(str, a)))
 
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
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-1)
	i=0
	while(i<n):
		if(i==q):
			print("[",end="")
			print(str(list[i]),end="")
			print("] ",end="")
		else:
			print(str(list[i])+" ",end="")
		i+=1
	print()
	return 0

if __name__ == "__main__":
	main()



Fixed submission:
def partition(a, left, right):
    pivot = a[right-1]
    i = left - 1
    for j in range(left, right-1):
        if a[j] <= pivot:
            i += 1
            a[i], a[j] = a[j], a[i]
    a[i+1], a[right-1] = a[right-1], a[i+1]
    return i + 1
 
def main():
    n = int(input())
    a = list(map(int, input().split()))
    p = partition(a, 0, len(a))
    a[p] = '[' + str(a[p]) + ']'
    print(' '.join(map(str, a)))
 
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
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-1)
	i=0
	while(i<n):
		if(i==q):
			print("[",end="")
			print(str(list[i]),end="")
			print("] ",end="")
		else:
			print(str(list[i])+" ",end="")
		i+=1
	print()
	return 0

if __name__ == "__main__":
	main()



Fixed submission:
def partition(a, left, right):
    pivot = a[right-1]
    i = left - 1
    for j in range(left, right-1):
        if a[j] <= pivot:
            i += 1
            a[i], a[j] = a[j], a[i]
    a[i+1], a[right-1] = a[right-1], a[i+1]
    return i + 1
 
def main():
    n = int(input())
    a = list(map(int, input().split()))
    p = partition(a, 0, len(a))
    a[p] = '[' + str(a[p]) + ']'
    print(' '.join(map(str, a)))
 
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
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=partition(0,n-1)
	i=0
	while(i<n):
		if(i==q):
			print("[",end="")
			print(str(list[i]),end="")
			print("] ",end="")
		else:
			print(str(list[i])+" ",end="")
		i+=1
	print()
	return 0

if __name__ == "__main__":
	main()



Fixed submission:
def partition(a, left, right):
    pivot = a[right-1]
    i = left - 1
    for j in range(left, right-1):
        if a[j] <= pivot:
            i += 1
            a[i], a[j] = a[j], a[i]
    a[i+1], a[right-1] = a[right-1], a[i+1]
    return i + 1
 
def main():
    n = int(input())
    a = list(map(int, input().split()))
    p = partition(a, 0, len(a))
    a[p] = '[' + str(a[p]) + ']'
    print(' '.join(map(str, a)))
 
if __name__ == '__main__':
    main()