vector stop at newline
// read N1 & N2 using cin
int N1, N2;
cin >> N1;
cin >> N2;
// skip the new line which is after N2 (i.e; 2 value in 1st line)
cin.ignore(numeric_limits<streamsize>::max(), '\n');
// now read 3 4 5 elements
int ele;
// 2nd EOF condition may required,
// depending on if you dont have last new-line, and it is end of file.
while ((cin_.peek() != '\n') && (cin_.peek() != EOF)) {
cin >> ele;
// do something with ele
}