#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
class Pocket
{
int value;
public:
Pocket (int value):value (value)
{
}
int getValue () const
{
return value;
}
operator int () const
{
return value;
}
bool operator < (const Pocket & _Right) const
{
return value < _Right.value;
}
};
ostream & operator << (ostream & stream, const Pocket & pocket)
{
stream << pocket.getValue ();
return stream;
}
void
printer (Pocket i)
{ // LINE I
cout << i << ", ";
}
int
main ()
{
Pocket mynumbers1[] = { 8, 9, 7, 6, 4, 1 };
Pocket mynumbers2[] = { 8, 9, 1, 2, 2, 1 };
vector < Pocket > v1 (mynumbers1, mynumbers1 + 6);
vector < Pocket > v2 (mynumbers2, mynumbers2 + 6);
vector < Pocket > v3 (6, 0);
transform (v1.begin (), v1.end (), v2.begin (), v3.begin (), minus < Pocket > ()); //LINE II
for_each (v1.rbegin (), v1.rend (), printer);
return 0;
}
I2luY2x1ZGUgPHZlY3Rvcj4KCiNpbmNsdWRlIDxpb3N0cmVhbT4KCiNpbmNsdWRlIDxhbGdvcml0aG0+CgojaW5jbHVkZSA8ZnVuY3Rpb25hbD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpjbGFzcyBQb2NrZXQKewoKICBpbnQgdmFsdWU7CgpwdWJsaWM6CgogICAgUG9ja2V0IChpbnQgdmFsdWUpOnZhbHVlICh2YWx1ZSkKICAgewogICB9CgogIGludCBnZXRWYWx1ZSAoKSBjb25zdAogIHsKICAgIHJldHVybiB2YWx1ZTsKICB9CgogIG9wZXJhdG9yICBpbnQgKCkgY29uc3QKICB7CiAgICByZXR1cm4gdmFsdWU7CiAgfQoKICBib29sIG9wZXJhdG9yIDwgKGNvbnN0IFBvY2tldCAmIF9SaWdodCkgY29uc3QKICB7CiAgICByZXR1cm4gdmFsdWUgPCBfUmlnaHQudmFsdWU7CiAgfQoKfTsKCm9zdHJlYW0gJiBvcGVyYXRvciA8PCAob3N0cmVhbSAmIHN0cmVhbSwgY29uc3QgUG9ja2V0ICYgcG9ja2V0KQp7Cgog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