Why this function is giving runtime error?

line 5 u need to tell the no of rows in the 2d marix
since u are accessing the row no and no declaring it before hand so u are getting an error
vector<vector>ans( 10) ;
then ans[0].push_back() would be valid statement