#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <iterator>
using namespace std;
template <typename Iterator>
void printContainer(Iterator itBegin,
Iterator itEnd)
{
copy(itBegin, itEnd, ostream_iterator<typename iterator_traits<Iterator>::value_type>(cout, " "));
cout << endl;
}
int main() {
vector<int> v{1, 2, 3, 4, 5, 6};
list<int> l{1, 2, 3, 4, 5, 6};
printContainer(begin(v), end(v));
printContainer(begin(l), end(l));
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8bGlzdD4KI2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGl0ZXJhdG9yPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnRlbXBsYXRlIDx0eXBlbmFtZSBJdGVyYXRvcj4Kdm9pZCBwcmludENvbnRhaW5lcihJdGVyYXRvciBpdEJlZ2luLAogICAgICAgICAgICAgICAgICAgIEl0ZXJhdG9yIGl0RW5kKQp7CiAgICAgICAgY29weShpdEJlZ2luLCBpdEVuZCwgb3N0cmVhbV9pdGVyYXRvcjx0eXBlbmFtZSBpdGVyYXRvcl90cmFpdHM8SXRlcmF0b3I+Ojp2YWx1ZV90eXBlPihjb3V0LCAiICIpKTsKICAgICAgICBjb3V0IDw8IGVuZGw7Cn0KCmludCBtYWluKCkgewoJdmVjdG9yPGludD4gdnsxLCAyLCAzLCA0LCA1LCA2fTsKCWxpc3Q8aW50PiAgIGx7MSwgMiwgMywgNCwgNSwgNn07CglwcmludENvbnRhaW5lcihiZWdpbih2KSwgZW5kKHYpKTsKCXByaW50Q29udGFpbmVyKGJlZ2luKGwpLCBlbmQobCkpOwoJCglyZXR1cm4gMDsKfQ==