Can i take input like this for 2d vector?

int k,n,e;
cin>>k>>n;
vector<vector>v;
for(int i=0;i<k;i++){
for(int j=0;j<n;j++){
cin>>e;
v[i].push_back(e);
}
}

no, you should instead, push elements into temp vector and pust that vector into v