Which is a better option among deque and vector for large input
Deque vs vector
More often than not, we recommend that a C++ programmer prefer the STL over hard coded arrays. This is because the vector and deque classes (those that resemble the functionality of an array most closely) are safer and easier to use. Here are some of the advantages to using a vector:
A vector manages its own memory. This is a wonderful feature because now you as the programmer need not worry about allocating enough memory or resizing an array if you run out of space. This is probably the biggest advantage to using a vector over an array, the vector will grow as required and destroy itself.
A vector has boundary checking with use of the at() member function. One of the biggest problems arrays have is that the random access with the [] operators allow an out of bounds index to be dereferenced. This is generally a Bad Thing and if you can avoid it you should. Granted, many programmers will opt to use the [] operator with vectors if they are confident in not going out of bounds, but if a slight slowdown is acceptable and added security is required, vectors offer an excellent alternative.
A vector has useful member functions for working with it.
A vector has more natural syntax when used with STL algorithms, arrays can be used but the syntax tends to be messy.
therefore a deque is better to use