#include <algorithm>
#include <functional>
#include <iostream>
#include <iterator>
#include <numeric>
#include <vector>
int main()
{
std::vector<int> v(10, 2);
std::partial_sum(v.cbegin(), v.cend(), v.begin());
std::cout << "Among the numbers: ";
std::copy(v.cbegin(), v.cend(), std::ostream_iterator<int>(std::cout, " "));
std::cout << '\n';
if (std::all_of(v.cbegin(), v.cend(), [](int i) { return i % 2 == 0; }))
std::cout << "All numbers are even\n";
if (std::none_of(v.cbegin(), v.cend(), [](int i) { return i % 2 != 0; }))
std::cout << "None of them are odd\n";
struct DivisibleBy
{
const int d;
DivisibleBy(int n) : d(n) {}
bool operator()(int n) const { return n % d == 0; }
};
if (std::any_of(v.cbegin(), v.cend(), DivisibleBy(7)))
std::cout << "At least one number is divisible by 7\n";
}
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGZ1bmN0aW9uYWw+CiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPGl0ZXJhdG9yPgojaW5jbHVkZSA8bnVtZXJpYz4KI2luY2x1ZGUgPHZlY3Rvcj4KIAppbnQgbWFpbigpCnsKICAgIHN0ZDo6dmVjdG9yPGludD4gdigxMCwgMik7CiAgICBzdGQ6OnBhcnRpYWxfc3VtKHYuY2JlZ2luKCksIHYuY2VuZCgpLCB2LmJlZ2luKCkpOwogICAgc3RkOjpjb3V0IDw8ICJBbW9uZyB0aGUgbnVtYmVyczogIjsKICAgIHN0ZDo6Y29weSh2LmNiZWdpbigpLCB2LmNlbmQoKSwgc3RkOjpvc3RyZWFtX2l0ZXJhdG9yPGludD4oc3RkOjpjb3V0LCAiICIpKTsKICAgIHN0ZDo6Y291dCA8PCAnXG4nOwogCiAgICBpZiAoc3RkOjphbGxfb2Yodi5jYmVnaW4oKSwgdi5jZW5kKCksIFtdKGludCBpKSB7IHJldHVybiBpICUgMiA9PSAwOyB9KSkKICAgICAgICBzdGQ6OmNvdXQgPDwgIkFsbCBudW1iZXJzIGFyZSBldmVuXG4iOwogCiAg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