For an integer ```k``` rearrange all the elements of the given array in such way, that:

all elements that are less than ```k``` are placed before elements that are not less than ```k```;
all elements that are less than ```k``` remain in the same order with respect to each other;
all elements that are not less than ```k``` remain in the same order with respect to each other.

For ```k = 6``` and ```elements = [6, 4, 10, 10, 6]```, the output should be
```splitByValue(k, elements) = [4, 6, 10, 10, 6]```.

For ```k``` = 5 and ```elements = [1, 3, 5, 7, 6, 4, 2]```, the output should be
```splitByValue(k, elements) = [1, 3, 4, 2, 5, 7, 6]```.

S: codefights.com

Difficulty: introductory

Starter code:

def split_by_value(k, elements):
	

Solutions:
def split_by_value(k, elements):
    return sorted(elements, key=lambda x: x >= k)

def split_by_value(k, elements):
    return [x for x in elements if x < k] + [x for x in elements if x >= k]

def split_by_value(k, elements):
    res = [[], []]
    for x in elements:
        res[k<=x].append(x)
    return res[0] + res[1]

def split_by_value(k, elements):
    return sorted(elements, key=lambda y: y>=k)
        


def split_by_value(k, elements):
    return sorted(elements, key=k.__le__)

def split_by_value(k, elements):
    return [x for f in (lambda x: x < k, lambda x: x >= k) for x in elements if f(x)]

def split_by_value(k, elements):
    return [i for i in elements if i<k]+[i for i in elements if i>=k]

def split_by_value(k, elements):
    return sorted(elements, key=lambda a: a>=k)

def split_by_value(k, elements):
    l = []
    elem2 = elements.copy()
    for i in elements:
        if i < k:
            l.append(i)
            elem2.remove(i)
             
    return l + elem2

from itertools import chain

def split_by_value(k, arr):
    lst = [[],[]]
    for v in arr: lst[v>=k].append(v)
    return list(chain(*lst))