#include <algorithm>
#include <vector>
#include <iostream>
#include <iterator>
#include <numeric>
int main()
{
std::vector<int> array(100);
std::iota(array.begin(), array.end(), 0);
std::vector<int> even, odd;
std::partition_copy(array.begin(), array.end(),
std::back_inserter(even),
std::back_inserter(odd),
[](int x){return x%2 == 0;});
std::copy(even.begin(), even.end(), std::ostream_iterator<int>(std::cout, " "));
std::cout << std::endl;
std::copy(odd.begin(), odd.end(), std::ostream_iterator<int>(std::cout, " "));
}
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aXRlcmF0b3I+CiNpbmNsdWRlIDxudW1lcmljPgoKCmludCBtYWluKCkKewogICAgc3RkOjp2ZWN0b3I8aW50PiBhcnJheSgxMDApOwogICAgc3RkOjppb3RhKGFycmF5LmJlZ2luKCksIGFycmF5LmVuZCgpLCAwKTsKICAgIHN0ZDo6dmVjdG9yPGludD4gZXZlbiwgb2RkOwogICAgc3RkOjpwYXJ0aXRpb25fY29weShhcnJheS5iZWdpbigpLCBhcnJheS5lbmQoKSwKICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpiYWNrX2luc2VydGVyKGV2ZW4pLAogICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OmJhY2tfaW5zZXJ0ZXIob2RkKSwKICAgICAgICAgICAgICAgICAgICAgICAgW10oaW50IHgpe3JldHVybiB4JTIgPT0gMDt9KTsKICAgIHN0ZDo6Y29weShldmVuLmJlZ2luKCksIGV2ZW4uZW5kKCksIHN0ZDo6b3N0cmVhbV9pdGVyYXRvcjxpbnQ+KHN0ZDo6Y291dCwgIiAiKSk7CiAgICBzdGQ6OmNvdXQgPDwgc3RkOjplbmRsOwogICAgc3RkOjpjb3B5KG9kZC5iZWdpbigpLCBvZGQuZW5kKCksIHN0ZDo6b3N0cmVhbV9pdGVyYXRvcjxpbnQ+KHN0ZDo6Y291dCwgIiAiKSk7Cn0=