#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main()
{
// Create a vector object that contains 10 elements.
vector<int> v;
for (int i = 1; i < 10; ++i) {
v.push_back(i);
}
int sum = 0;
for_each(v.begin(), v.end(), [&sum](int i){ sum += i; });
cout << "SUM IS: " << sum;
}
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSAKewogICAvLyBDcmVhdGUgYSB2ZWN0b3Igb2JqZWN0IHRoYXQgY29udGFpbnMgMTAgZWxlbWVudHMuCiAgIHZlY3RvcjxpbnQ+IHY7CiAgIGZvciAoaW50IGkgPSAxOyBpIDwgMTA7ICsraSkgewogICAgICB2LnB1c2hfYmFjayhpKTsKICAgfQoJCiAgIGludCBzdW0gPSAwOwogICBmb3JfZWFjaCh2LmJlZ2luKCksIHYuZW5kKCksIFsmc3VtXShpbnQgaSl7IHN1bSArPSBpOyB9KTsKICAgY291dCA8PCAiU1VNIElTOiAiIDw8IHN1bTsKfQ==