#include #include using namespace std; int main() { int N; cin >> N; if (N < 10 || N > 1000010) { cout << "Invalid input! N must be in the range [10..1000010]." << endl; return 1; } stack binaryStack; while (N > 0) { binaryStack.push(N % 2); N /= 2; } while (!binaryStack.empty()) { cout << binaryStack.top() << " "; binaryStack.pop(); } cout << endl; return 0; }