"""Given a pivot x, and a list lst, partition the list into three parts.
    The first part contains all elements in lst that are less than x
    The second part contains all elements in lst that are equal to x
    The third part contains all elements in lst that are larger than x
Ordering within a part can be arbitrary.

For example, given x = 10 and lst = [9, 12, 3, 5, 14, 10, 10], 
one partition may be [9, 3, 5, 10, 10, 12, 14]."""


def get_partitions(x: int, lst: list):
    return [i for i in lst if i < x] + [x]*lst.count(x) + [i for i in lst if i > x]

if __name__ == "__main__":
    assert get_partitions(10, [9, 12, 3, 5, 14, 10, 10]) == [9, 3, 5, 10, 10, 12, 14]