#include <iostream>
#include <vector>
#include <list>
int main()
{
int nums[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
std::vector<int> u(std::begin(nums), std::end(nums));
std::list<int> v(std::begin(nums), std::end(nums));
for (auto it = u.begin(); it != u.end(); ++it)
if (*it % 2 == 0)
it = u.erase(it);
for (auto it = v.begin(); it != v.end(); ++it)
if (*it % 2)
it = v.erase(it);
for (auto &i : u)
std::cout << i << " ";
std::cout << std::endl;
for (auto &i : v)
std::cout << i << " ";
std::cout << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8bGlzdD4KCgppbnQgbWFpbigpCnsKICAgICAgICBpbnQgbnVtc1tdID0gezEsIDIsIDMsIDQsIDUsIDYsIDcsIDgsIDksIDEwfTsKICAgICAgICBzdGQ6OnZlY3RvcjxpbnQ+IHUoc3RkOjpiZWdpbihudW1zKSwgc3RkOjplbmQobnVtcykpOwogICAgICAgIHN0ZDo6bGlzdDxpbnQ+ICAgdihzdGQ6OmJlZ2luKG51bXMpLCBzdGQ6OmVuZChudW1zKSk7CgogICAgICAgIGZvciAoYXV0byBpdCA9IHUuYmVnaW4oKTsgaXQgIT0gdS5lbmQoKTsgKytpdCkKICAgICAgICAgICAgICAgIGlmICgqaXQgJSAyID09IDApCiAgICAgICAgICAgICAgICAgICAgICAgIGl0ID0gdS5lcmFzZShpdCk7CiAgICAgICAgZm9yIChhdXRvIGl0ID0gdi5iZWdpbigpOyBpdCAhPSB2LmVuZCgpOyArK2l0KQogICAgICAgICAgICAgICAgaWYgKCppdCAlIDIpCiAgICAgICAgICAgICAgICAgICAgICAgIGl0ID0gdi5lcmFzZShpdCk7CgogICAgICAgIGZvciAoYXV0byAmaSA6IHUpCiAgICAgICAgICAgICAgICBzdGQ6OmNvdXQgPDwgaSA8PCAiICI7CiAgICAgICAgc3RkOjpjb3V0IDw8IHN0ZDo6ZW5kbDsKICAgICAgICBmb3IgKGF1dG8gJmkgOiB2KQogICAgICAgICAgICAgICAgc3RkOjpjb3V0IDw8IGkgPDwgIiAiOwogICAgICAgIHN0ZDo6Y291dCA8PCBzdGQ6OmVuZGw7Cn0K