Consider adopting any of the common styles for code-formatting.
As-is, your current formatting seriously impedes readability.#include <bits/stdc++.h>
is a bad idea, sharply limiting portability adand increasing compile-times. See: How does #include<bits/stdc++.h>
work in C++?How does#include <bits/stdc++.h>
work in C++?
Just include those headers you need, which are<vector>
and<iostream>
.You are courting conflicting symbols and general bafflement with any minor change of your toolchain. See: Why is
using namespace std;
considered bad practice?Why isusing namespace std;
considered bad practice?You are using the popular for-if-antipattern. See Introducing the for-if anti-pattern
Why don't you just enumerate the ones you are actually interested in?A for-range-loop is simpler than explicitly using iterators/indices. Unless you actually need them.
In the end you don't actually want that whole list, only whether one of them divides your input-number. So why store them at all, and why also those bigger than the input-number?
return 0;
is implicit formain
in C++.