/**
* list<int> and queue<int, list<int>> allocates and deallocates memory => works slow
* deque<int> has "operator[]", it works in O(1)
* queue = stack = vector = массив с удвоением
*
* time = 0.24 : v
* time = 0.14 : s
* time = 0.15 : q
* time = 2.14 : l
* time = 0.15 : d
* time = 2.22 : q2
* time = 3.00 : after destructors
*/
#include <cstdio>
#include <ctime>
#include <queue>
#include <vector>
#include <list>
#include <stack>
using namespace std;
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
double start = 0;
void timeS( const char *str = 0 ) { printf("time = %.2f : %s\n", (clock() - start) / CLOCKS_PER_SEC, str ? str : ""), start = clock(); }
void f() {
queue<int> q;
list<int> l;
deque<int> d;
vector<int> v;
stack<int> s;
queue<int, list<int>> q2;
int N = 1e7;
forn(i, N) v.push_back(i);
timeS("v");
forn(i, N) s.push(i);
timeS("s");
forn(i, N) q.push(i);
timeS("q");
forn(i, N) l.push_back(i);
timeS("l");
forn(i, N) d.push_back(i);
timeS("d");
forn(i, N) q2.push(i);
timeS("q2");
d[1]; // compilable!
}
int main() {
f();
timeS("after destructors");
}