#include <vector>
#include <iostream>
#include <algorithm>
int main() {
// Sort a vector of ints so that even numbers are on the
// left and odd numbers are on the right
std::vector<int> foo {1, 2, 3, 4, 5};
std::partition( foo.begin(), foo.end(), [](int x) { return x % 2 == 0; } );
for(auto &x : foo) std::cout << x << " ";
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKCmludCBtYWluKCkgewogICAgLy8gU29ydCBhIHZlY3RvciBvZiBpbnRzIHNvIHRoYXQgZXZlbiBudW1iZXJzIGFyZSBvbiB0aGUKICAgIC8vIGxlZnQgYW5kIG9kZCBudW1iZXJzIGFyZSBvbiB0aGUgcmlnaHQKICAgIHN0ZDo6dmVjdG9yPGludD4gZm9vIHsxLCAyLCAzLCA0LCA1fTsKICAgIHN0ZDo6cGFydGl0aW9uKCBmb28uYmVnaW4oKSwgZm9vLmVuZCgpLCBbXShpbnQgeCkgeyByZXR1cm4geCAlIDIgPT0gMDsgfSApOwogICAgZm9yKGF1dG8gJnggOiBmb28pIHN0ZDo6Y291dCA8PCB4IDw8ICIgIjsKfQ==