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