def fibonacci(n):
    if n == 0 or n == 1:
        return 1
    else:
        return n - 1 + (n - 2)


def fibonacci(n):
    if n == 0 or n == 1:
        return 1
    else:
        return fibonacci(n - 1) + fibonacci(n - 2)

assert fibonacci(0)==1 and fibonacci(1)==1 and fibonacci(2)==2 and fibonacci(10)==89 and fibonacci(23)==46368

Return the value of the fibonacci series at position n.


def fibonacci(n):
    if n == 1 or n == 0:
        return 1
    return fibonacci(n - 1) + fibonacci(n - 2)


def reverse_list(a):
    if len(a) == 0:
        return []
    return [a[-1]] + reverse_list(a[:-1])

Reverse a list of elements.


Reverse a list of elements.


def selectionsort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j += 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i += 1

assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None

Repeatedly move minimimum of remaining sublist to front.


def count_letters(s):
    if not s:
        return 0
    else:
        return 1 + count_letters(s[1:])

assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13

Return the number of lettres in a string.


def partition(A, p, r):
    q = j = p
    while j < r:
        if A[j] <= A[r]:
            A[q], A[j] = A[j], A[q]
            q += 1
        j += 1
    A[q], A[r] = A[r], A[q]
    return q

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

Recursively partition list until sorted.


def maximum(a):
    if len(a) == 1:
        return a[0]
    if a[0] > a[1]:
        a.remove(a[1])
        return maximum(a)
    else:
        a.remove(a[0])
        return maximum(a)

Return the maximum element in a list of numbers.


def count_letters(s):
    n = 0
    if not s:
        return 0
    else:
        n += 1
        return n + count_letters(s[1:])


def minimum(a):
    if len(a) == 1:
        return a[0]
    if a[0] < a[1]:
        a.remove(a[1])
        return minimum(a)
    else:
        a.remove(a[0])
        return minimum(a)

Return the minimum element in a list of numbers.


def reverse_list(l):
    if len(l) == 0:
        return []
    return [l[-1]] + reverse_list(l[:-1])

Reverse a list of elements.


def fibonacci(n):
    if n == 1:
        return 1
    elif n == 2:
        return 1
    else:
        return fibonacci(n - 1) + fibonacci(n - 2)


def fibonacci(n):
    if n == 1:
        return 1
    elif n == 2:
        return 1
    elif n > 2:
        return fibonacci(n - 1) + fibonacci(n - 2)


def fibonacci(n):
    if n == 0:
        return 1
    elif n == 1:
        return 1
    elif n >= 2:
        return fibonacci(n - 1) + fibonacci(n - 2)


def fibonacci(n):
    if n == 0:
        return 1
    elif n == 1:
        return 1
    else:
        return fibonacci(n - 1) + fibonacci(n - 2)


def reverse_list(l):
    if len(l) == 0:
        return []
    else:
        return [l[-1]] + reverse_list(l[:-1])

Reverse a list of elements.


def minimum(a):
    if len(a) == 1:
        return a
    b = max(a)
    a.replace(b, '')
    return minimum(a)


def minimum(a):
    if len(a) == 1:
        return a
    b = max(a)
    a = [c for c in a if c != b]
    return minimum(a)


def minimum(a):
    if len(a) == 1:
        return a[0]
    b = max(a)
    a = [c for c in a if c != b]
    return minimum(a)


def maximum(a):
    if len(a) == 1:
        return a[0]
    b = min(a)
    a = [c for c in a if c != b]
    return maximum(a)


def count_letters(s):
    total = 0
    if s == '':
        return total
    total += 1
    s = s[:-2]
    return count_letters(s)


def count_letters(s):
    total = 0
    if s == '':
        return total
    total += 1
    s = s[:-2]
    print(s)
    return count_letters(s)


def count_letters(s):
    total = 0
    if s == '':
        return total
    total += 1
    s = s[:-1]
    print(s)
    return count_letters(s)


def count_letters(s):
    total = 0
    if s == '':
        return total
    total += 1
    print(total)
    s = s[:-1]
    print(s)
    return count_letters(s)


def count_letters(s):
    if s == '':
        return total
    total += 1
    print(total)
    s = s[:-1]
    print(s)
    return count_letters(s)


def count_letters(s):
    if s == '':
        return total
    total += 1
    s = s[:-1]
    return count_letters(s)


def count_letters(s):
    total = 0
    if s == '':
        return total
    for t in s:
        total += 1
    s = ''
    return count_letters(s)


def count_letters(s):
    total = 0
    if s == '':
        return total
    for t in s:
        total += 1
    print(total)
    s = ''
    return count_letters(s)


def count_letters(s):
    if s == '':
        return total
    for t in s:
        total = 0
        total += 1
    print(total)
    s = ''
    return count_letters(s)


def count_letters(s):
    for t in s:
        total = 0
        total += 1
    if s == '':
        return total
    s = ''
    return count_letters(s)


def count_letters(s):
    try:
        if s == '':
            return b
    except IndexError:
        return 0
    b = s.index(s[-1])
    s = ''
    return count_letters(s)


def count_letters(s):
    b = s.index(s[-1])
    s = ''
    try:
        if s == '':
            return b
    except IndexError:
        return 0
    return count_letters(s)


def count_letters(s):
    b = s.index(s[-1]) + 1
    s = ''
    try:
        if s == '':
            return b
    except IndexError:
        return 0
    return count_letters(s)


def count_letters(s):
    try:
        b = s.index(s[-1]) + 1
    except IndexError:
        return 0
    s = ''
    if s == '':
        return b
    return count_letters(s)


def count_letters(s):
    n = 0
    if not s:
        return 0
    else:
        n += 1
        return n + count_letters(s[1:])


def count_letters(s):
    n = 0
    print(s)
    if not s:
        return 0
    else:
        n += 1
        return n + count_letters(s[1:])


def minimum(l):
    biggest = l[0]
    for c in l:
        if c < biggest:
            biggest = c
    return biggest


def maximum(l):
    biggest = l[0]
    for c in l:
        if c > biggest:
            biggest = c
    return biggest


def count_letters(s):
    n = 0
    print(n)
    if not s:
        return 0
    else:
        n += 1
        return n + count_letters(s[1:])


def count_letters(s):
    n = 0
    print(n)
    if not s:
        return 0
    else:
        n += 1
        print(n)
        return n + count_letters(s[1:])


def count_letters(s):
    counter = 0
    if s == '':
        return 0
    else:
        for c in s:
            counter += 1
    return counter


def reverse_list(l):
    l2 = []
    i = 0
    while l:
        l2.append(l[len(l) - i - 1])
        tmp = l.pop()
    return l2

Reverse a list of elements.


Reverse a list of elements.


def count_letters(m):
    if m == '':
        return 0
    else:
        return 1 + count_letters(m[:-1])


def partition(A, p, r):
    q = j = p
    while j < r:
        if A[j] <= A[r]:
            A[q], A[j] = A[j], A[q]
            q += 1
        j += 1
    A[q], A[r] = A[r], A[q]
    return q

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


def selectionsort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j += j
        a[p], a[i] = a[i], a[p]
        i += 1


def selectionsort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j += j
        a[p], a[i] = a[i], a[p]
        i += 1
    return a


def minimum(l, m=None):
    if not len(l):
        return m
    if not m or l[0] < m:
        return minimum(l[1:], l[0])
    return minimum(l[1:], m)


def selectionsort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j += 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i += 1


def reverse_list(a):
    if len(a) == 0:
        return []
    return [a[-1]] + reverse_list(a[:-1])

Reverse a list of elements.


def minimum(a):
    if len(a) == 1:
        return a[-1]
    elif a[0] < a[-1]:
        return minimum(a[:-1])
    elif a[0] > a[-1]:
        return minimum(a[1:])


def count_letters(s, c=0):
    if not s:
        return c
    return count_letters(s[:-1], c + 1)


def reverse_list(l, r=None):
    if not r:
        r = []
    if not l:
        return r
    r.append(l.pop())
    return reverse_list(l, r)

Reverse a list of elements.


def maximum(a):
    if len(a) == 1:
        return a[-1]
    elif a[0] > a[-1]:
        return maximum(a[:-1])
    elif a[0] < a[-1]:
        return maximum(a[1:])


def fibonacci(n, l=0, c=1):
    if not n:
        return c
    return fibonacci(n - 1, c, l + c)


def fibonacci(n):
    if n == 1 or n == 0:
        return 1
    return fibonacci(n - 1) + fibonacci(n - 2)


def fibonacci(n):
    if n == (0 or 1):
        return 1
    return fibonacci(n - 1) + fibonacci(n - 2)


def fibonacci(n):
    if n == 0 or n == 1:
        return 1
    return fibonacci(n - 1) + fibonacci(n - 2)


def reverse_list(l, ding=None):
    if not ding:
        ding = []
    if not l:
        return ding
    ding.append(l.pop())
    return reverse_list(l, ding)

Reverse a list of elements.


def minimum(a):
    if len(a) == 1:
        return a[0]
    if a[0] < a[1]:
        a.remove(a[1])
        return minimum(a)
    else:
        a.remove(a[0])
        return minimum(a)


def maximum(a):
    if len(a) == 1:
        return a[0]
    if a[0] > a[1]:
        a.remove(a[1])
        return maximum(a)
    else:
        a.remove(a[0])
        return maximum(a)


def count_letters(s):
    n = 0
    if not s:
        return 0
    else:
        n += 1
        return n + count_letters(s[1:])


Reverse a list of elements.


def partition(A, p, r):
    q = j = p
    while j < r:
        if A[j] <= A[r]:
            A[q], A[j] = A[j], A[q]
            q += 1
        j += 1
    A[q], A[r] = A[r], A[q]
    return q

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


def quicksort(l):
    if len(l) < 2:
        return l
    pivot = l[0]
    left = []
    right = []
    for n in l[1:]:
        if n < pivot:
            left.append(n)
        else:
            right.append(n)
    return quicksort(left) + [pivot] + quicksort(right)


def fibonacci(aaliyah, supercalifragilisticespialidotious=0, koppaberg=1):
    if not aaliyah:
        return koppaberg
    return fibonacci(aaliyah - 1, koppaberg,
        supercalifragilisticespialidotious + koppaberg)


def quicksort(cabbages):
    if len(l) < 2:
        return l
    pivot = l[0]
    left_side = []
    right_side = []
    for n in cabbages[1:]:
        if n < pivot:
            left_side.append(n)
        else:
            right_side.append(n)
    return quicksort(left_side) + [pivot] + quicksort(right_side)


def quicksort(l, first, last):
    if first >= last:
        return
    i, j = first, last
    pivot = l[random.randint(first, last)]
    while i <= j:
        while l[i] < pivot:
            i += 1
        while l[j] > pivot:
            j -= 1
        if i <= j:
            l[i], l[j] = l[j], l[i]
            i, j = i + 1, j - 1
    quicksort(l, first, j)
    quicksort(l, i, last)
    return l


def quicksort(l, start=0, end=None):
    if len(l) < 2:
        return l
    pivot = l[0]
    left = []
    right = []
    for n in l[1:]:
        if n < pivot:
            left.append(n)
        else:
            right.append(n)
    return quicksort(left) + [pivot] + quicksort(right)


def quicksort(l, start=0, end=None):
    if len(l) < 2:
        return l
    pivot = l[1]
    left = []
    right = []
    for n in l[1:]:
        if n < pivot:
            left.append(n)
        else:
            right.append(n)
    return quicksort(left) + [pivot] + quicksort(right)


def quicksort(l, p, r):
    if r <= p:
        return
    q = j = p
    while j < r:
        if l[j] <= l[r]:
            l[q], l[j] = l[j], l[q]
            q += 1
        j += 1
    l[q], l[r] = l[r], l[q]
    quicksort(l, p, q - 1)
    quicksort(l, q + 1, r)


def selectionsort(l, o=None):
    if not o:
        o = []
        l = l[:]
    if not len(l):
        return o
    small = min(l)
    l.remove(small)
    o.append(small)
    return selectionsort(l, o)


def selectionsort(l):
    for i in range(len(l)):
        j = i + 1
        p = i
        while j < len(l):
            if l[j] < l[p]:
                p = j
            j += 1
        l[p], l[i] = l[i], l[p]


def selectionsort(a):
    for i in range(len(a)):
        j = i + 1
        p = i
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j += 1
        a[p], a[i] = a[i], a[p]


def fibonacci(n, last=0, curr=1):
    if not n:
        return curr
    return fibonacci(n - 1, curr, last + curr)


def reverse_list(a, reverse=None):
    if not reverse:
        reverse = []
    if len(a) < 1:
        return reverse
    reverse.append(a.pop())
    return reverse_list(a, reverse)

Reverse a list of elements.


def count_letters(s, count=0):
    if not s:
        return count
    return count_letters(s[:-1], count + 1)


def maximum(l, max_n=None):
    if not len(l):
        return max_n
    if not max_n or l[0] > max_n:
        return maximum(l[1:], l[0])
    return maximum(l[1:], max_n)


def fibonacci(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fib(n - 1) + fib(n - 2)


def fibonacci(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fibonacci(n - 1) + fibonacci(n - 2)


def fibonacci(n):
    if n == 0:
        return 1
    elif n == 1:
        return 1
    else:
        return fibonacci(n - 1) + fibonacci(n - 2)


def maximum(list):
    if len(list) == 1:
        return list[0]
    else:
        m = maximum(list[1:])
        return m if m > list[0] else list[0]


def minimum(list):
    if len(list) == 1:
        return list[0]
    else:
        return min(list[0], minimum(list[1:]))


def count_letters(str):
    return len(str)


def reverse_list(l):
    if len(l) == 0:
        return []
    return [l[-1]] + reverse_list(l[:-1])

Reverse a list of elements.


Reverse a list of elements.


def quicksort(A, p, r):
    q = j = p
    while j < r:
        if A[j] <= A[r]:
            A[q], A[j] = A[j], A[q]
            q += 1
        j += 1
    A[q], A[r] = A[r], A[q]
    return q


def selectionsort(alist):
    for fillslot in range(len(alist) - 1, 0, -1):
        positionOfMax = 0
        for location in range(1, fillslot + 1):
            if alist[location] > alist[positionOfMax]:
                positionOfMax = location
        temp = alist[fillslot]
        alist[fillslot] = alist[positionOfMax]
        alist[positionOfMax] = temp


def quicksort(l, p, r):
    if r <= p:
        return
    q = j = p
    while j < r:
        if l[j] <= l[r]:
            l[q], l[j] = l[j], l[q]
            q += 1
        j += 1
    l[q], l[r] = l[r], l[q]
    quicksort(l, p, q - 1)
    quicksort(l, q + 1, r)


def minimum(lst):
    if len(lst) == 1:
        return lst[-1]
    elif lst[0] < lst[-1]:
        return minimum(lst[:-1])
    elif lst[0] > lst[-1]:
        return minimum(lst[1:])


def fibonacci(n):
    a = 0
    b = 1
    for i in range(0, n):
        print(a)
        temp = a
        a = b
        b = temp + b
    return a


def index(word, letter):
    i = 0
    while i < len(word):
        if letter not in word:
            return -1
        elif word[i] == letter:
            return i
        else:
            i = i + 1

Returns the position of letter in str, -1 if it is not there.


def search(word, letter):
    if letter in word:
        return True
    else:
        return False

assert search('','0')==False and search('0','0')==True and search('ERFE0Rfsef','0')==True and search('ERFERfsef0','0')==True and search('','a')==False and search('cbzeycuzbvyzuvb','a')==False and search('cbsducsvdbcyts','c')==True and search('dbzeducvbzy','y')==True and search('xqvsgxcutvy','u')==True

Return whether a letter is part of a string


def fibonacci(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        a = 0
        b = 1
        i = 2
        while i <= n:
            fib = a + b
            a = b
            b = fib
            i += 1
        return fib


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def reverse(a):
    return swap(a)

Reverse a list of elements.


def selection_sort(a):
    for i in a:
        j = 0
        while j < len(a):
            if i < a[j]:
                a[j] = i
            j += 1
    return a


def selection_sort(a):
    for i in range(len(a)):
        j = 1
        if a[j] > a[i]:
            tmp = a[i]
            a[i] = a[j]
            a[j] = tmp
        j += 1
    return a


def selection_sort(a):
    return sorted(a)


def swap_unique_keys_values(d):
    return dict([(v, k) for k, v in list(d.items()) if list(d.values()).
        count(v) == 1])

Swap keys with unique values.


Swap keys with unique values.


def fibonacci(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fibonacci(n - 1) + fibonacci(n - 2)

assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657


def search(str, letter):
    if str == '':
        return False
    elif str[0] == letter:
        return True
    else:
        return search(str[1:], letter)


def index(str, letter, pos):
    if pos == len(str):
        return -1
    elif str[pos] == letter:
        return pos
    else:
        return index(str, letter, pos + 1)

Return the position of letter in str, -1 if it is not there.


def partition(A, p, r):
    q = j = p
    while j < r:
        if A[j] <= A[r]:
            A[q], A[j] = A[j], A[q]
            q += 1
        j += 1
    A[q], A[r] = A[r], A[q]
    return q

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


def minimum(list):
    if len(list) == 1:
        return list[0]
    else:
        if list[-1] < list[0]:
            list.remove[-1]
        else:
            list.remove[0]
        return minmum(list)


def minimum(list):
    if len(list) == 1:
        return list[0]
    else:
        if list[-1] < list[0]:
            list.pop(0)
        else:
            list.pop(-1)
        return minimum(list)


def maximum(list):
    if len(list) == 1:
        return list[0]
    else:
        if list[-1] < list[0]:
            list.pop(-1)
        else:
            list.pop(0)
        return maximum(list)


def count_letters(string):
    if not string:
        return 0
    else:
        return 1 + count_letters(string.replace(string[0], ''))


def count_letters(string):
    if not string:
        return 0
    else:
        return 1 + count(string.replace(string[0], ''))


def count_letters(string):
    if not string:
        return 0
    else:
        return 1 + count_letters(string.replace(string[0], '', 1))


def reverse_list(list):
    if not list:
        return list
    else:
        return list[-1] + reverse_list(list)

Reverse a list of elements.


def reverse_list(listt):
    if not listt:
        return listt
    else:
        return list(listt[-1]) + reverse_list(listt[:-1])

Reverse a list of elements.


def reverse_list(listt):
    if not listt:
        return listt
    else:
        return [listt[-1]] + reverse_list(listt[:-1])

Reverse a list of elements.


Reverse a list of elements.


def selection_sort(a):
    for i in range(len(a)):
        least = i
        for k in range(i + 1, len(a)):
            if a[k] < a[least]:
                least = k
        tmp = a[i]
        a[i] = a[k]
        a[k] = tmp


def selection_sort(a):
    for i in range(len(a)):
        mini = min(a[i:])
        min_index = a[i:].index(mini)
        a[i + min_index] = a[i]
        a[i] = mini
        return a


def selection_sort(a):
    for i in range(len(a)):
        mini = min(a[i:])
        min_index = a[i:].index(mini)
        a[i + min_index] = a[i]
        a[i] = mini
    return a


def fibonacci(n):
    if n == 0 or n == 1:
        return 1
    else:
        return fibonacci(n - 1) + fibonacci(n - 2)


def swap(a, i, j):
    y = a[j]
    a[j] = a[i]
    a[i] = y

def reverse(a):
    i = 0
    while i < len(a) / 2:
        swap(a, i, len(a) - i - 1)
        i = i + 1

Reverse a list of elements.


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
    return l2

Append l1 to l2. If l2 not supplied default to empty list.


def append2list(l1, l2=[]):
    l2 = l1
    return l2


def append2list(l1, l2=[]):
    for i in l1:
        if len(l2) <= 2:
            l2.append(i)
        else:
            l2 = l1
    return l2


def append2list(l1, l2=None):
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=None):
    for i in l1:
        try:
            l2.append(i)
        except AttributeError:
            continue
    return l2


def append2list(l1, l2):
    for i in l1:
        try:
            l2.append(i)
        except AttributeError:
            continue
    return l2


def append2list(l1, l2=''):
    for i in l1:
        try:
            l2.append(i)
        except AttributeError:
            continue
    return l2


def append2list(l1, l2=[]):
    for i in l1:
        try:
            l2.append(i)
        except AttributeError:
            continue
    return l2


def append2list(l1, l2=[]):
    for i in l1:
        try:
            l1 = []
            l2.append(i)
        except AttributeError:
            continue
    return l2


def append2list(l1, l2=[]):
    for i in l1:
        try:
            l1 = []
            l2 = []
            l2.append(i)
        except AttributeError:
            continue
    return l2


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def swap_keys_values(d):
    dictionary = {}
    for k, v in list(d.items()):
        dictionary[v] = k
    return dictionary

Swap keys with values.


Swap keys with values.


def swap_unique_keys_values(d):
    dictionary = {}
    unique = set(d.values())
    for k, v in list(d.items()):
        if v in unique:
            dictionary[v] = k
    return dictionary

Swap keys with unique values.


def swap_unique_keys_values(d):
    dictionary = {}
    unique = []
    for k, v in list(d.items()):
        unique.append((k, v))
    print(unique)

Swap keys with unique values.


def swap_unique_keys_values(d):
    dictionary = {}
    unique = []
    for k, v in list(d.items()):
        unique.append((k, v))
    for k, v in unique:
        if unique.count(v) > 1:
            del unique[k, v]
    print(unique)

Swap keys with unique values.


def swap_unique_keys_values(d):
    dictionary = {}
    unique = []
    for k, v in list(d.items()):
        unique.append((k, v))
    for k, v in unique:
        print(v)

Swap keys with unique values.


def swap_unique_keys_values(d):
    dictionary = {}
    unique = []
    for k, v in list(d.items()):
        unique.append((k, v))
    for k, v in unique:
        if unique.count(v) > 1:
            print(v)

Swap keys with unique values.


Swap keys with unique values.


def swap_unique_keys_values(d):
    dictionary = {}
    unique = []
    deli = []
    for k, v in list(d.items()):
        unique.append(v)
    for v in unique:
        if unique.count(v) > 1:
            deli.append(v)
    for v in unique:
        if v in deli:
            del unique[v]
    for k, v in list(d.items()):
        if v in unique:
            dictionary[v] = k
    return dictionary

Swap keys with unique values.


def swap_unique_keys_values(d):
    dictionary = {}
    unique = []
    deli = []
    for k, v in list(d.items()):
        unique.append(v)
    for v in unique:
        if unique.count(v) > 1:
            deli.append(v)
    for v in unique:
        try:
            if v in deli:
                del unique[v]
        except:
            continue
    for k, v in list(d.items()):
        if v in unique:
            dictionary[v] = k
    return dictionary

Swap keys with unique values.


def swap_unique_keys_values(d):
    dictionary = {}
    counter = []
    new = []
    for k, v in list(d.items()):
        counter.append(v)
    for c in counter:
        if counter.count(c) == 1:
            new.append(c)
    for k, v in list(d.items()):
        if v in new:
            dictionary[v] = k
    return dictionary

Swap keys with unique values.


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
    return low

Search for an element in an array using the binary search algorithm.


def selection_sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        tmp = a[i]
        a[i] = a[p]
        a[p] = tmp
        i = i + 1
    return a


Reverse a list of elements.


def swap(a, i, j):
    for k in a:
        a[i], a[j] = a[j], a[i]
    return a

def reverse(a):
    return swap(a)

Reverse a list of elements.


def reverse(a):
    return [i for i in range(len(a), 0, -1)]

Reverse a list of elements.


def reverse(a):
    new = []
    for i in a.__reversed__():
        new.append(i)
    return new

Reverse a list of elements.


def swap(a, i='', j=''):
    if i == '' and j == '':
        i = 0
        j = len(a) - 1
        k = 0
        while k < len(a) / 2:
            a[i], a[j] = a[j], a[i]
            i += 1
            j -= 1
            k += 1
    else:
        a[i], a[j] = a[j], a[i]
    return a

def reverse(a):
    return swap(a)

Reverse a list of elements.


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def reverse(a):
    i = 0
    while i < len(a) / 2:
        swap(a, i, len(a) - 1 - i)
        i = i + 1

Reverse a list of elements.


def selection_sort(a):
    i = 0
    while i < len(a):
        p = i
        j = j + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1
    return a


def reverse(a):
    a = a[::-1]
    return a

Reverse a list of elements.


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    i = i + 1
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i += 1

assert sort([0])==None and sort([0])==None and sort([])==None and sort([])==None and sort([' '])==None and sort([' '])==None and sort([70, 339305549])==None and sort([70, 339305549])==None


def sort(a):
    i = 0
    p = 0
    while i < len(a):
        if a[i] < a[p]:
            tmp = a[i]
            a[i] = a[p]
            a[p] = tmp
        i = i + 1


def sort(a):
    i = 0
    p = 0
    while i < len(a):
        if a[i] > a[p]:
            tmp = a[i]
            a[i] = a[p]
            a[p] = tmp
        i = i + 1


def sort(a):
    i = 0
    p = 0
    while i < len(a):
        if a[i] < a[p]:
            tmp = a[p]
            a[p] = a[i]
            a[i] = tmp
        i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
    i = i + 1
    i = i + 1


def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    find_position_of_smallest(a, i)
    a[0] = tmp


def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    find_position_of_smallest(a, i)
    tmp = i
    a[0] = tmp


def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    find_position_of_smallest(a, i)
    i = tmp
    a[0] = tmp


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    i = 0
    while i < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)


def sort(a):
    tmp = a[p]
    a[p] = a[i]
    a[i] = tmp
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    i = 0
    while i < len(a):
        find_position_of_smallest(a, i)
        swap(a, i)


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    i = 0
    while i < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, tmp)


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    i = 0
    j = 0
    while i < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)


def swap(a, i, j):
    temp = a[i]
    a[i] = a[j]
    a[j] = temp

def find_position_of_smallest(a, i):
    track = 0
    tempnum = a[i + track]
    while track != len(a) - i:
        if a[i + track] == tempnum:
            tempnum = a[i + track]
        track = track + 1
    return tempnum

def sort(a):
    i = 0
    j = 0
    while i != len(a):
        j = find_position_of_smallest(a, i)
        swap(a, i, j)
        i = i + 1


def sort(a):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp
    i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        p = i
        if a[i] < a[p]:
            tmp = a[p]
            a[p] = a[i]
            a[i] = tmp
    i = i + 1


def sort(a):
    i = 0
    j = i
    while i < len(a):
        if a[i] < a[j]:
            j = i
            tmp = a[i]
            a[i] = a[j]
            a[j] = tmp
    i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        p = i
        if a[i] < a[p]:
            tmp = a[i]
            a[i] = a[p]
            a[p] = tmp
        i = i + 1


def sort(a):
    i = 0
    j = i
    while i < len(a):
        if a[i] < a[j]:
            j = i
            tmp = a[i]
            a[i] = a[j]
            a[j] = tmp
        i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        p = i
        if a[i] < a[p]:
            tmp = a[p]
            a[p] = a[i]
            a[i] = tmp
        i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        j = i
        while i < len(a):
            if a[i] < a[j]:
                tmp = a[i]
                a[i] = a[j]
                a[j] = tmp
        i = i + 1


def sort(a):
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    i = 0
    j = 0
    while j < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)
        find_position_of_smallest


def sort(a):
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
    tmp = a[p]
    a[p] = a[i]
    a[i] = tmp
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    i = 0
    j = 0
    while j < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)


def sort(a):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    tmp = a[p]
    a[p] = a[i]
    a[i] = tmp
    i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def sort(a):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
            swap(a, i, j)
        j = j + 1
    return p


def sort(a):
    i = 0
    while i < len(a):
        j = i
        k = i + 1
        while k < len(a):
            if a[k] < a[j]:
                j = k
            k = k + 1
        tmp = a[j]
        a[j] = a[i]
        a[i] = tmp
        i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def sort(a):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    swap(a, i, j)
    return p


def sort(a):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp


def sort(a):
    while i < len(a):
        p = i
        j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
            j = j + 1
            tmp = a[p]
            a[p] = a[i]
            a[i] = tmp
            i = i + 1


def swap(a, i, j):
    temp = a[i]
    a[i] = a[j]
    a[j] = temp

def find_position_of_smallest(a, i):
    track = 0
    tempnum = a[i + track]
    while track != len(a) - i:
        if a[i + track] < tempnum:
            tempnum = a[i + track]
        track = track + 1
    return track + i - 1

def sort(a):
    i = 0
    j = 0
    while i != len(a):
        j = find_position_of_smallest(a, i)
        swap(a, i, j)
        i = i + 1


def sort(a):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    tmp = a[p]
    a[p] = a[i]
    a[i] = tmp
    i = i + 1
    return p


def sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    p = i
    j = i + 1
    i = 0
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    tmp = a[p]
    a[p] = a[i]
    a[i] = tmp
    i = i + 1
    return p


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    i = 0
    j = 0
    while j < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)
        i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        j = i
        k = i + 1
    while k < len(a):
        if a[k] < a[j]:
            j = k
            k = k + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1
    return k


def sort(a):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp
    i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        j = i
        k = i + 1
    while k < len(a):
        if a[k] < a[j]:
            j = k
            k = k + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
    i = i + 1
    return k


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    i = 0
    j = 0
    while j < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)
        j = j + 1


def sort(a):
    i = 0
    while i < len(a):
        j = i
        k = i + 1
    while k < len(a):
        if a[k] < a[j]:
            j = k
            k = k + 1
    tmp = a[p]
    a[p] = a[i]
    a[i] = tmp
    i = i + 1
    return k


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    j = 0
    while j < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, j, p)
        j = j + 1


def sort(a):
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    j = 0
    while j < len(a):
        p = find_position_of_smallest(a, j)
        swap(a, j, p)
        j = j + 1


def sort(a):
    i = 0
    while i < len(a):
        j = i
        k = i + 1
        while k < len(a):
            if a[k] < a[j]:
                j = k
            k = k + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
    i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        j = i
        k = i + 1
        while k < len(a):
            if a[k] < a[j]:
                j = k
            k = k + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        j = i
        k = i + 1
        while k < len(a):
            if a[k] < a[j]:
                j = k
            k = k + 1
        tmp = a[j]
        a[j] = a[k]
        a[k] = tmp
    i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        j = i
        k = i + 1
        while k < len(a):
            if a[k] < a[j]:
                j = k
            k = k + 1
        tmp = a[j]
        a[j] = a[i]
        a[i] = tmp
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    find_position_of_smallest(a, i)
    swap(a, i, j)


def sort(a):
    i = 0
    while i < len(a):
        j = i
        k = i + 1
        while k < len(a):
            if a[k] < a[j]:
                j = k
            k = k + 1
        tmp = a[j]
        a[j] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
    tmp = a[p]
    a[p] = a[i]
    a[i] = tmp
    i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, j)
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, j)
        i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, p, i)
        i = i + 1


def swap(a, i, j):
    temp = a[i]
    a[i] = a[j]
    a[j] = temp

def find_position_of_smallest(a, i):
    tempnum = i
    while i + 1 != len(a):
        if a[i] < a[tempnum]:
            tempnum = i
        i = i + 1
    return tempnum

def sort(a):
    i = 0
    j = 0
    while i != len(a):
        j = find_position_of_smallest(a, i)
        swap(a, i, j)
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, p, i)
        i = i + 1


def swap(a, i, j):
    temp = a[i]
    a[i] = a[j]
    a[j] = temp

def find_position_of_smallest(a, i):
    tempnum = i
    while i != len(a):
        if a[i] < a[tempnum]:
            tempnum = i
        i = i + 1
    return tempnum

def sort(a):
    i = 0
    j = 0
    while i != len(a):
        j = find_position_of_smallest(a, i)
        swap(a, i, j)
        i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def sort(a):
    i = 0
    while i < len(a):
        p = i
        i = i + 1
        while i < len(a):
            if a[i] < a[p]:
                p = i
            i = i + 1
        swap(a, i, j)
        i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        p = i
        i = i + 1
        while i < len(a):
            if a[i] < a[p]:
                p = i
            i = i + 1
        swap
        i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def sort(a):
    i = 0
    while i < len(a):
        p = i
        i = i + 1
        while i < len(a):
            if a[i] < a[p]:
                p = i
            i = i + 1
        swap(a, i, p)
        i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    j = 1
    while i < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)


def sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        temp = a[p]
        a[p] = a[i]
        a[i] = temp
        i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    j = 1
    while i < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)
        i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    j = 0
    while i < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)
        i = i + 1


def swap(a, i, j):
    temp = a[i]
    a[i] = a[j]
    a[j] = temp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    j = 0
    while j < len(a):
        p = find_position_of_smallest(a, j)
        swap(a, j, p)
        j = j + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    j = 0
    find_position_of_smallest(a, i)
    swap(a, i, j)
    i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    find_position_of_smallest(a, i)
    swap(a, i, j)
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, j, p)
        i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    j = 0
    while j < len(a):
        p = find_position_of_smallest(a, j)
        swap(a, j, p)
        j = j + 1


def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    j = 0
    while j < len(a):
        p = find_position_of_smallest(a, j)
        swap(a, j, p)
        j = j + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    find_position_of_smallest(a, i)
    swap(a, i, j)
    i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def sort(a):
    i = 0
    while i < len(a):
        j = i + 1
        find_position - of - smallest(a, i)
        swap(a, i, j)
        i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    find_position_of_smallest(a, i)
    swap(a, i, p)
    i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        j = i + 1
        find_position_of_smallest(a, i)
        swap(a, i, j)
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def sort(a):
    while i < len(a):
        p = find_first_position_of_smallest(a, i)
        swap(a, j, i)


def find_position_of_smallest(a, i):
    x = i
    while i < len(a):
        if a[i] < a[x]:
            x = i
        i = i + 1
    return x

def sort(a):
    j = 0
    while j < len(a):
        p = find_position_of_smallest(a, j)
        swap(a, j, p)
        j = j + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    p = i
    find_position_of_smallest(a, i)
    swap(a, i, p)
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, p, i)
        i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    tmp = a[p]
    a[p] = a[i]
    a[i] = tmp
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    smallest = i
    while i < len(a):
        if a[i] < a[smallest]:
            smallest = i
        i = i + 1
    return smallest

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1


def sort(p):
    tmp = a[p]
    a[p] = a[i]
    a[i] = tmp
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    j = i
    while i < len(a):
        if a[i] < a[j]:
            j = i
        i = i + 1
    return j

def sort(a):
    i = 0
    while i < len(a):
        k = find_position_of_smallest(a, i)
        swap(a, i, k)
        i = i + 1


def find_position_of_smallest(a, i):
    j = i
    while i < len(a):
        if a[i] < a[j]:
            j = i
        i = i + 1
    return j

def sort(a):
    i = 0
    while i < len(a):
        j = i
        k = i + 1
        while k < len(a):
            k = find_position_of_smallest(a, i)
            swap(a, i, k)
            i = i + 1


def swap(a, i, j):
    temp = a[i]
    a[i] = a[j]
    a[j] = temp

def find_position_of_smallest(a, i):
    p = i
    j = i
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, p, i)
        i = i + 1


def find_position_of_smallest(a, i):
    j = i
    while i < len(a):
        if a[i] < a[j]:
            j = i
        i = i + 1
    return j

def sort(a):
    i = 0
    while i < len(a):
        k = find_position_of_smallest(a, i)
        swap(a, i, k)
        i = i + 1


def swap(a, i, j):
    a[i], a[j] = a[j], a[i]

def find_position_of_smallest(a, i):
    l = a[i:]
    s = 0
    j = 0
    while j < len(l):
        if l[j] < l[s]:
            s = j
        j += 1
    return s + len(a) - len(l)

def sort(a):
    i = 0
    while i < len(a):
        smallest = find_position_of_smallest(a, i)
        swap(a, i, smallest)
        i += 1


def sort(a):
    x = int(a[0])
    i = 0
    while i < len(a) - 1:
        if int(a[i]) > int(a[i + 1]):
            x = a[i]
            a[i] = a[i + 1]
            a[i + 1] = x
        i = i + 1
    i = 0
    while i < len(a):
        print(a[i])
        i = i + 1


def sort(a):
    x = int(a[0])
    i = 0
    while i < len(a) - 1:
        if int(a[i]) > int(a[i + 1]):
            x = a[i]
            a[i] = a[i + 1]
            a[i + 1] = x
        i = i + 1
    i = 0
    while i < len(a):
        i = i + 1


def sort(a):
    p = 0
    j = 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i += 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def sort(a):
    i = 0
    while i < len(a):
        p = position_of_smallest(a, i)
        swap(a, i, p)
        i += 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i += 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, p, i)
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    j = 0
    while j < len(a):
        p = find_position_of_smallest(a, j)
        swap(a, j, p)
        j = j + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def sort(a):
    while i < len(a):
        p = find_position_of_smallest
        swap(a, i, j)
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    i = 0
    p = i
    i = i + 1
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i += 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    i = p
    p = i
    i = i + 1
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i += 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i += 1


def sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        j = i
        k = i + 1
        while k < len(a):
            if a[k] < a[j]:
                j = k
            k = k + 1
        tmp = a[j]
        a[j] = a[i]
        a[i] = tmp
        i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    i = 0
    while i < len(a):
        if a[i] < a[j]:
            i = i + 1
        return i

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1
    return p


def sort(a):
    i = 0
    while i < len(a):
        k = find_position_of_smallest(a, i)
        swap(a, i, k)
        i = i + 1


def sort(a):
    p = i + 1
    i = i + 2
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = p + 1
    while i < len(a):
        if a[j] < a[p]:
            p = j
            i = i + 1
        return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1
    return p


def sort(a):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = p + 1
    while i < len(a):
        if a[p] < a[j]:
            j = p
            i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1
    return p


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = p + 1
    while i < len(a):
        if a[p] < a[j]:
            j = p
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1
    return p


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = p + 1
    while i < len(a):
        if a[j] < a[p]:
            j = p
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1
    return p


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i += 1


def sort(a):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp
    i = i + 1


def sort(a):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    i = i + 1
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp


def sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp


def sort(a):
    p = i
    i = i + 1
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = p + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1
    return p


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1
    return p


def sort(a):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    i = i + 1
    tmp = a[p]
    a[p] = a[i]
    a[i] = tmp


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1
    return p


def sort(a):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    i = i + 1
    tmp = a[p]
    a[p] = a[j]
    a[j] = tmp


def sort(a):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    j = 0
    while j < len(a):
        p = find_position_of_smallest(a, j)
        swap(a, j, p)
        j = j + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def sort(a):
    i = 0
    while i < len(a):
        p = find_postion_of_smallest(a, i)
        swap(a, p, i)
        i = i + 1


def sort(a):
    i = 0
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    i = i + 1
    tmp = a[p]
    a[p] = a[j]
    a[j] = tmp


def sort(a):
    i = 0
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    i = i + 1
    tmp = a[p]
    a[i] = a[j]
    a[j] = tmp


def sort(a):
    i = 0
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp
    i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        k = find_position_of_smallest(a, i)
        swap(a, i, k)
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    i = i + 1
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def sort(a):
    i = 0
    while i < len(a):
        k = find_position_of_smallest(a, i)
        swap(a, i, k)
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    j = i
    while i < len(a):
        if a[i] < a[j]:
            j = i
        i = i + 1
    return j

def sort(a):
    i = 0
    while i < len(a):
        k = find_position_of_smallest(a, i)
        swap(a, i, k)
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    find_position_of_smallest(a, i)
    swap(a, i, j)
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    j = i + 1
    find_position_of_smallest(a, i)
    swap(a, i, j)
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    j = i + 1
    find_position_of_smallest(a, i)
    swap(a, i, j)
    j = j + 1
    i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort():
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, p, i)
        i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    j = i + 1
    while i < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)
    j = j + 1
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    j = i + 1
    while i < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)
    j = i
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, p, i)
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    j = i + 1
    while i < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)
        j = j + 1
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    j = i + 1
    while i < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)
    i = i + 1
    j = i


def swap(a, i, j):
    temp = a[i]
    a[i] = a[j]
    a[j] = temp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    while i < len(a):
        find_position_of_smallest(a, i).swap(a)
    swap(a, i, j).sort(a)


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    j = i + 1
    while i < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)
    i = i + 1
    j = j + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    tmp = i
    while i < len(a):
        if a[i] < a[tmp]:
            tmp = i
        i = i + 1
    return tmp

def sort(a):
    j = 0
    while j < len(a):
        p = find_position_of_smallest(a, j)
        swap(a, j, p)
        j = j + 1


def sort(a):
    while i < len(a):
        find_position_of_smallest.sort(a)
        swap.sort(a)
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    j = i + 1
    while j < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)
    i = i + 1
    j = j + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    i = i + 1
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        find_position_of_smallest.sort(a)
        swap.sort(a)
    i = i + 1


def swap(a, i, j):
    temp = a[i]
    a[i] = a[j]
    a[j] = temp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    while i < len(a):
        if find_position_of_smallest(a, i).swap(a):
            swap(a, i, j).sort(a)
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, j)
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, p, i)
    i = i + 1


def sort(a):
    b = a
    b = 0
    j = 1
    while j < len(a):
        if a[j] < a[b]:
            p = j
        j = j + 1
    return b


def sort(a):
    b = 0
    j = 1
    while j < len(a):
        if a[j] < a[b]:
            p = j
        j = j + 1
    return b


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    j = 0
    while j < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, j)
    j = j + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    j = 0
    while j < len(a):
        p = find_position_of_smallest(a, j)
        swap(a, j, p)
    j = j + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    j = 0
    while j < len(a):
        p = find_position_of_smallest(a, j)
        swap(a, j, p)
        j = j + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, p, i)
        i = i + 1


def swap(a, i, j):
    temp = a[i]
    a[i] = a[j]
    a[j] = temp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    j = 0
    while i < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)
    j = j + 1


def swap(a, i, j):
    temp = a[i]
    a[i] = a[j]
    a[j] = temp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    j = 0
    while j < len(a):
        find_position_of_smallest(a, i)
        swap(a, i, j)
    j = j + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    l = 0
    while l < len(a):
        p = find_position_of_smallest(a, l)
        swap(a, l, p)
    i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    l = 0
    while l < len(a):
        p = find_position_of_smallest(a, l)
        swap(a, l, p)
        l = l + 1


def swap(a, i, j):
    temp = a[i]
    a[i] = a[j]
    a[j] = temp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    l = 0
    while l < len(a):
        p = find_position_of_smallest(a, l)
        swap(a, p, l)
    l = l + 1


def swap(a, i, j):
    temp = a[i]
    a[i] = a[j]
    a[j] = temp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    l = 0
    while l < len(a):
        p = find_position_of_smallest(a, l)
        swap(a, p, l)
        l = l + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        if a[i] < a[n]:
            n = i
        i = i + 1
        tmp = a[i]
        a[i] = a[n]
        a[n] = tmp
        i = i + 1


def sort(a):
    i = 0
    n = 0
    while i < len(a):
        if a[i] < a[n]:
            n = i
        i = i + 1
        tmp = a[i]
        a[i] = a[n]
        a[n] = tmp
        i = i + 1


def sort(a):
    i = 0
    n = 0
    while i < len(a):
        if a[i] < a[n]:
            n = i
        i = i + 1
        tmp = a[i]
        a[i] = a[n]
        a[n] = tmp


def sort(a):
    i = 0
    p = 0
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    i = 0
    p = 0
    while i < len(a):
        if a[i] > a[p]:
            p = i
        i = i + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    i = 0
    p = 0
    while i > len(a):
        if a[i] > a[p]:
            p = i
        i = i + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    i = 0
    p = 0
    while i > len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    i = 1
    p = 0
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    i = 0
    p = 1
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    n = i
    i = i + 1
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    n = i
    i = i + 1
    while i < len(a):
        if a[i] < a[n]:
            n = i
        i = i + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    n = i
    i = i + 1
    while i < len(a):
        if a[i] < a[n]:
            n = i
        i = i + 1
        tmp = a[n]
        a[n] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    i = i + 1
    n = i
    while i < len(a):
        if a[i] < a[n]:
            n = i
        i = i + 1
        tmp = a[n]
        a[n] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        if a[i] < a[n]:
            n = i
        i = i + 1
        tmp = a[n]
        a[n] = a[i]
        a[i] = tmp
        i = i + 1


def sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def sort(a):
    i = 0
    while i < len(a):
        swap(a, i, find_position_of_smallest + i)
        i = i + 1


def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def find_position_of_smallest(a, i):
    p = i
    while i < len(a):
        if a[i] < a[p]:
            p = i
        i = i + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1


def reverse(a):
    b = []
    i = 0
    while i < len(a):
        b.append(a[len(a) - i - 1])
        i = i + 1
    return b

Reverse a list of elements.


Reverse a list of elements.


def reverse(a, i):
    i = 0
    lines = sys.stdin.readlines()
    while i < len(a):
        print(lines[i] - 1 - i)
    i = i + 1
    return a

Reverse a list of elements.


def reverse(n):
    reverse = a[len(a) - i - 1]
    return reverse

Reverse a list of elements.


def reverse(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[i] = tmp

Reverse a list of elements.


def reverse(a):
    a = a[::-1]
    return a

Reverse a list of elements.


def reverse(a):
    a = a[::a - 1]
    return a

Reverse a list of elements.


def reverse(a):
    a[::a - 1]
    return a

Reverse a list of elements.


def reverse(i, j, k):
    a = a[::-1]
    print(a)

Reverse a list of elements.


def reverse(a):
    a = a[::-1]
    print(a)

Reverse a list of elements.


def reverse(string):
    results = string[::-1]
    return string[::-1]

Reverse a list of elements.


def reverse(a):
    i = 0
    a = a[a:-i - 1]
    i = i + 1
    return a

Reverse a list of elements.


def reverse(a):
    while i < len(a):
        return len(a) - 1

Reverse a list of elements.


def reverse(a):
    i = 0
    j = len(a)
    while i < len(a):
        tmp = a[i]
        a[i] = a[j - i]
        a[j - i] = tmp
    print(a)

Reverse a list of elements.


def reverse(a):
    i = 0
    while i < len(a):
        tmp = a[i]
        a[i] = a[len(a) - i - 1]
        a[len(a) - i - 1] = a[i]
    return a

Reverse a list of elements.


def reverse(a_string):
    new_string = ''
    index = len(a_string)
    while index:
        index -= 1
        new_string += a_string[index]
    return new_string

Reverse a list of elements.


def reverse(a):
    i = 0
    while i < len(a):
        tmp = a[i]
        a[i] = a[len(a) - i]
        a[len(a) - i] = a[i]
    return a

Reverse a list of elements.


def reverse(a):
    i = 0
    j = len(a)
    while i < len(a):
        tmp = a[i]
        a[i] = a[j - i]
        a[j - i] = tmp
        i = i + 1
    print(a)

Reverse a list of elements.


def reverse(test):
    n = len(test)
    x = ''
    for i in range(n - 1, -1, -1):
        x += test[i]
    return x

Reverse a list of elements.


Reverse a list of elements.


def reverse(a):
    i = 0
    while i < len(a):
        tmp = a[i]
        a[i] = a[len(a) - i]
        a[len(a) - i] = tmp
        i = i + 1
    print(a)

Reverse a list of elements.


def reverse(a):
    a = []
    i = 0
    while i < len(a):
        tmp = a[i]
        a[i] = a[len(a) - i - 1]
        a[len(a) - i - 1] = a[i]
    return a

Reverse a list of elements.


def reverse(a):
    a = []
    i = 0
    rev = a[len(a) - i - 1]
    return rev

Reverse a list of elements.


def reverse(a):
    rev = a[len(a) - i - 1]
    return rev

Reverse a list of elements.


def reverse(a):
    i = 0
    rev = a[len(a) - i - 1]
    return rev

Reverse a list of elements.


def reverse(a):
    a = a[::-1]
    return a

Reverse a list of elements.


def reverse(a):
    print(reverse(a[i]))

Reverse a list of elements.


def reverse(a):
    i = 0
    while i < len(a):
        tmp = a[i]
        a[i] = a[len(a) - i - 1]
        a[len(a) - i - 1] = tmp
        i = i + 1
    print(a)

Reverse a list of elements.


def reverse(a):
    i = 0
    while i < len(a):
        tmp = a[i]
        a[i] = a[len(a) - i - 1]
        a[len(a) - i - 1] = tmp
        i = i + 1
    print(a.rstrip())

Reverse a list of elements.


def reverse(a):
    i = 0
    while i < len(a):
        tmp = a[i]
        a[i] = a[len(a) - i - 1]
        a[len(a) - i - 1] = tmp
        i = i + 1
    print(a.rstrip())
    print(tmp)
    print(a[i])

Reverse a list of elements.


def reverse(a):
    i = 0
    while i < len(a):
        tmp = a[i]
        a[i] = a[len(a) - i - 1]
        a[len(a) - i - 1] = tmp
        i = i + 1
    return a

Reverse a list of elements.


def reverse(a):
    i = 0
    while i < len(a) / 2:
        tmp = a[i]
        a[i] = a[len(a) - i - 1]
        a[len(a) - i - 1] = tmp
        i = i + 1
    return a

Reverse a list of elements.


def reverse(a, i, j):
    a = []
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp
    return a

Reverse a list of elements.


def reverse(a, i, j):
    a = []
    i = 0
    j = 0
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp
    return a

Reverse a list of elements.


def reverse(n):
    i = 0
    while i < len(a):
        print(n[len(n) - (i + 1)])
        i = i + 1

Reverse a list of elements.


def reverse(n):
    i = 0
    while i < len(n):
        print(n[len(n) - (i + 1)])
        i = i + 1

Reverse a list of elements.


def reverse(n):
    a = []
    i = 0
    while i < len(n):
        a.append(n)
        i = i + 1
    print(a)

Reverse a list of elements.


def reverse(n):
    i = 0
    while i < len(n):
        print(n)
        i = i + 1
    print(a)

Reverse a list of elements.


def reverse(n):
    a = []
    i = 0
    while i < len(n):
        print(n)
        i = i + 1
    print(a)

Reverse a list of elements.


def reverse(n):
    a = []
    i = 0
    j = len(n) - 1
    while i < len(n) / 2:
        tmp = a[i]
        a[i] = a[j]
        a[j] = tmp
        i = i + 1
    print(a)

Reverse a list of elements.


def reverse(a):
    b = a[::-1]
    return b

Reverse a list of elements.


Reverse a list of elements.


def reverse(n):
    i = 0
    while i < len(n) / 2:
        print(n[len(n) - i - 1])
    i = i + 1

Reverse a list of elements.


def reverse(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp
    return a

Reverse a list of elements.


def reverse(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp
    return a.rstrip()

Reverse a list of elements.


def reverse(a, i, j):
    a = []
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp
    return a

Reverse a list of elements.


def reverse(a):
    temp = []
    i = 0
    while i != len(a):
        temp.append(len(a) - 1)
        i = i + 1
    a = temp
    return a

Reverse a list of elements.


def reverse(a):
    temp = []
    i = 0
    while i != len(a):
        temp.append(len(a) - i)
        i = i + 1
    a = temp
    return a

Reverse a list of elements.


def reverse(a):
    temp = []
    i = 0
    while i != len(a):
        temp.append(a[len(a) - i])
        i = i + 1
    a = temp
    return a

Reverse a list of elements.


def reverse(a):
    temp = []
    i = 0
    while i != len(a):
        temp.append(a[len(a) - i - 1])
        i = i + 1
    a = temp
    return a

Reverse a list of elements.


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def reverse(a):
    i = 0
    while i < len(a) / 2:
        swap(a, i, len(a) - 1 - i)
        i += 1

Reverse a list of elements.


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def reverse(a):
    i = 0
    while i < len(a) / 2:
        swap(a, i, len(a) - 1 - i)
        i = i + 1

Reverse a list of elements.


def selection_sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1


def selection_sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j = j + 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i = i + 1
    return a


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = a[i]

def reverse(a):
    i = 0
    while i < len(a) / 2:
        swap(a, i, len(a) - 1 - i)
        i = i + 1

Reverse a list of elements.


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if j < p:
            p = j
        j = j + 1
    return p

def selection_sort(a):
    i = 0
    while i < len(a):
        p = position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def selection_sort(a):
    i = 0
    while i < len(a):
        p = position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1


def union(a, b):
    a = a + b
    seen = {}
    c = []
    i = 0
    while i < len(a):
        if a[i] not in seen:
            seen[a[i]] = True
        i = i + 1
    for number in seen:
        c.append(number)
    return c

Merge two lists into a single one.


Merge two lists into a single one.


def intersection(a, b):
    seen = {}
    append = {}
    c = []
    i = 0
    while i < len(a):
        seen[a[i]] = True
        i = i + 1
    i = 0
    while i < len(b):
        if b[i] in seen and b[i] not in append:
            c.append(b[i])
            append[b[i]] = True
        i = i + 1
    return c

Return the elements which are in both lists.


def reverse(a):
    i = 0
    while i < len(a) / 2:
        a[i] = a[-i - 1]
        i += 1

Reverse a list of elements.


def reverse(a):
    i = 0
    while i < len(a) / 2:
        a[i] = a[len(a) - i - 1]
        i += 1

Reverse a list of elements.


def reverse(a):
    i = 0
    while i < len(a) / 2:
        tmp = a[i]
        a[i] = a[-i - 1]
        a[-i - 1] = tmp
        i += 1

Reverse a list of elements.


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def reverse(a):
    i = 0
    while i < len(a) / 2:
        swap(i, -i - 1)
        i += 1

Reverse a list of elements.


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def reverse(a):
    i = 0
    while i < len(a) / 2:
        swap(a, i, -i - 1)
        i += 1

Reverse a list of elements.


Reverse a list of elements.


def selection_sort(a):
    i = 0
    while i < len(a):
        p = i
        j += 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j += 1
    tmp = a[p]
    a[p] = a[i]
    a[i] = tmp
    i += 1


def selection_sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j += 1
    tmp = a[p]
    a[p] = a[i]
    a[i] = tmp
    i += 1


def selection_sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j += 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i += 1


def reverse(a):
    i = 0
    while i < len(a):
        b.append(a[len(a) - 1 - i])
        i = i + 1
    a = b
    return a

Reverse a list of elements.


def reverse(a):
    a = a[::-1]
    return a

Reverse a list of elements.


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, p, i)
        i = i + 1


def find_position_of_smallest(a, i):
    j = i
    while i < len(a):
        if a[i] < a[j]:
            j = i
        i = i + 1
    return j

def sort(a):
    i = 0
    while i < len(a):
        k = find_position_of_smallest(a, i)
        swap(a, i, k)
        i = i + 1


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def reverse(a):
    i = 0
    while i < len(a) / 2:
        swap(a, i, len(a) - 1 - i)
        i += 1

Reverse a list of elements.


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = low + (high - low) / 2
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (high + low) / 2
        if a[mid] < q:
            low = mid
        else:
            high = mid
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (high + low) / 2
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
    return low


def bsearch(a, q):
    lo = 0
    hi = len(a)
    while lo < hi:
        mid = (lo + hi) / 2
        if a[mid] < q:
            lo = mid + 1
        else:
            hi = mid
    return lo


def bsearch(a, q):
    low = 0
    high = len(a)
    while high != low:
        mid = (low + high) / 2
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
    print(low)


def bsearch(a, q):
    low = 0
    high = len(a)
    while high != low:
        mid = (low + high) / 2
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
        return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        if a[mid] < q:
            low = mid + 1
            assert low == 0 or a[low - 1] < q
        else:
            high = mid
            assert high == len(a) or q <= a[high]
        return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        assert low <= mid and mid < high
        if a[mid] < q:
            low = mid + 1
            assert low == 0 or a[low - 1] < q
        else:
            high = mid
            assert high == len(a) or q <= a[high]
        return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        assert low <= mid and mid < high
        if a[mid] < q:
            low = mid + 1
            assert low == 0 or a[low - 1] < q
        else:
            high = mid
            assert high == len(a) or q <= a[high]
        return mid


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = low + high / 2
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        assert low <= mid and mid < high
        if q > a[mid]:
            assert a[low - 1] < q
            low = mid + 1
        else:
            high = mid
            assert q <= a[high]
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        if q > a[mid]:
            low = mid + 1
        else:
            high = mid
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        assert low <= mid and mid < high
        if q > a[mid]:
            low = mid + 1
            assert a[low - 1] < q
        else:
            high = mid
            assert q <= a[high]
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low != high:
        mid = (low + high) / 2
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
    print(low)


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
    if a[mid] < q:
        low = mid + 1
    else:
        high = mid


def bsearch(a, q):
    high = len(a)
    low = 0
    while low < high:
        mid = (low + high) / 2
        if a[mid] < p:
            low = mid + 1
        else:
            high = mid
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
    if a[mid] < q:
        low = mid + 1
    else:
        high = mid
    return low


def bsearch(a, q):
    high = len(a)
    low = 0
    while low < high:
        mid = (low + high) / 2
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low != high:
        mid = (low + high) / 2
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
        assert low == 0 or a[low - 1] < q
        assert high == len(a) or q <= a[high]
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    assert low == 0 or a[low - 1] < q
    assert high == len(a) or q <= a[high]
    while low < high:
        mid = (low + high) / 2
    if a[mid] < q:
        low = mid + 1
    else:
        high = mid
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        assert low <= mid and mid < high
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low != high:
        mid = (low + high) / 2
        if a[mid] <= q:
            low = mid + 1
        else:
            high = mid
    return low


def bsearch(a, q):
    low = 0
    high = 0
    while low < high:
        mid = (low + high) / 2
        assert low <= mid and mid < high
        if a[mid] < q:
            low = mid + 1
            assert a[low - 1] < q
        else:
            high = mid
            assert q <= a[high]
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    mid = 0
    i = 0
    if q in a:
        while a[i] != q:
            i += 1
        print(i)
    else:
        while low != high:
            mid = (high + low) / 2
            if q[mid] < low:
                high = mid
            else:
                low = mid
            print(low)


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        assert low <= mid and mid < high
        if a[mid] < q:
            low = mid + 1
            assert a[low - 1] < q
        else:
            high = mid
            assert q <= a[high]
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        assert low <= mid and mid < high
        if a[mid] < q:
            assert a[low - i] < q
            low = mid + 1
        else:
            assert q <= a[high]
            high = mid
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (high + low) / 2
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low != high:
        mid = (low + high) / 2
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        assert low <= mid and mid < high
        if a[mid] < q:
            assert a[mid + 1 - 1] < q
            low = mid + 1
        else:
            high = mid
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        assert low <= mid and mid < high
        if a[mid] < q:
            low = mid + 1
            assert a[low - 1] < q
        else:
            high = mid
            assert q <= [high]
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high - low) / 2
        assert low <= mid and mid < high
        if a[mid] < q:
            low = mid + 1
            assert low == 0 or a[low - 1] < q
        else:
            high = mid
            assert high == len(a) or q <= a[high]
    return low


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        if a[mid] <= q:
            low = mid + 1
        else:
            high = mid
    return low


def bsearch(arr, tgt):
    lo = 0
    hi = len(arr)
    while lo != hi:
        mid = (lo + hi) / 2
        if arr[mid] < tgt:
            lo = mid + 1
        else:
            hi = mid - 1
    return (lo + hi) // 2 + 1 if arr[-1] == tgt else (lo + hi) // 2


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        assert low <= mid and mid < high
        if a[mid] < q:
            low = mid + 1
            assert low == 0 or a[low - 1] < q
        else:
            high = mid
            assert high == len(a) or q <= a[high]
    return low