// Minimum of a vector. Shows how specialized functions
// are generally more convenient than for and for_each.
#include <algorithm>
#include <climits>
#include <iostream>

using namespace std;

int main ()
{
	vector <int> a = {4, 5, 2, 7, 3};

	int ans = INT_MAX;
	for (int i = 0; i < (int) a.size (); i++)
		if (ans > a[i]) ans = a[i];
	cout << ans << endl;

	int res = INT_MAX;
	for_each (a.begin (), a.end (), [&] (int x) {if (res > x) res = x;});
	cout << res << endl;

	cout << *min_element (a.begin (), a.end ()) << endl;

	return 0;
}
