For any i, someVector[i] has 0 elements, which means that someVector[i][j] does not exist.
And the most outer one should be initialised to iMax, not kMax.
Code:const int iMax = 50; const int jMax = 20; const int kMax = 10; int x = 5; int y; vector<vector<vector<int>>> someVector(iMax, vector<vector<int>>(jMax)); for (int i =0; i<iMax; i++) { for(int j = 0; j<jMax; j++) { for(int k = 0; k <kMax; k++) { y = k * j * i * x; someVector[i][j].push_back(y); } } }