1#include <vector>
2#include <iostream>
3#include <ctime>
4using namespace std;
5
6int main() {
7 const int BIG = 20000000;
8 vector <int> v;
9 for ( int i = 0; i < BIG; i++ ) {
10 v.push_back( i );
11 }
12
13 int now = time(0);
14 cout << "start" << endl;
15 int n = 0;
16 for(vector<int>::iterator it = v.begin(); it != v.end(); ++it) {
17 n += *it;
18 }
19
20 cout << time(0) - now << endl;
21 now = time(0);
22 for(size_t i = 0; i < v.size(); ++i) {
23 n += v[i];
24 }
25 cout << time(0) - now << endl;
26
27 return n != 0;
28}