#include <algorithm>
#include <iostream>
int main()
{
using namespace std;
int a[] = {1, 2, 3, 4, 5};
auto const f = [&](){
return [=](){
for_each(a, a + (sizeof(a) / sizeof(a[0])), [](int i){ cout << i << endl; });
};
}();
a[0] = 2;
f();
}
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGlvc3RyZWFtPgoKaW50IG1haW4oKQp7Cgl1c2luZyBuYW1lc3BhY2Ugc3RkOwoJaW50IGFbXSA9IHsxLCAyLCAzLCA0LCA1fTsKCQoJYXV0byBjb25zdCBmID0gWyZdKCl7CgkJcmV0dXJuIFs9XSgpewoJCQlmb3JfZWFjaChhLCBhICsgKHNpemVvZihhKSAvIHNpemVvZihhWzBdKSksIFtdKGludCBpKXsgY291dCA8PCBpIDw8IGVuZGw7IH0pOwoJCX07Cgl9KCk7CgkKCWFbMF0gPSAyOwoJCglmKCk7Cn0KCQoJ