CodeForces: Creating the Contest
There is no need to store the entries in a vector. There is also no need for a nested loop.  This solution will run in O(n) time and O(1) space.

Technically, int is only guaranteed to hold up to 16 bits. Use long to ensure that you can accommodate the limits.

Also, please avoid using namespace std;. You can drop the useless cout&lt;&lt;"".

#include &lt;algorithm&gt;
#include &lt;iostream&gt;

int main() {
    long n, a, seq_len = 0, longest = 0;
    std::cin &gt;&gt; n;
    for (long prev_a = 0; n--; prev_a = a) {
        std::cin &gt;&gt; a;
        if (a &lt;= 2 * prev_a) {
            seq_len++;
        } else {
            seq_len = 1;
        }
        longest = std::max(longest, seq_len);
    }
    std::cout &lt;&lt; longest &lt;&lt; '\n';
}