#include <bits/stdc++.h.>
using namespace std;
using lint = long long;
vector<int> factors;
set<lint> ans;
map<tuple<int, lint, lint>, bool> memo;
void brute_force(int n = 0, lint now = 0, lint sum = 0) {
if (n == factors.size()) return void(ans.emplace(now + sum));
if (n >= 20) {
if (memo[make_tuple(n, now, sum)]) return;
memo[make_tuple(n, now, sum)] = true;
}
brute_force(n + 1, now * factors[n] + now + factors[n], sum);
brute_force(n + 1, now, sum + factors[n]);
brute_force(n + 1, 0, now + sum + factors[n]);
brute_force(n + 1, factors[n], now + sum);
}
int main() {
int N; cin >> N;
for (int i = 2; i <= N; i++) {
while (N % i == 0) {
factors.push_back(i - 1);
N /= i;
}
if (i * i > N) {
if (N > 1) factors.push_back(N - 1);
brute_force();
break;
}
}
cout << ans.size() << "\n";
for (auto i : ans) cout << i << " ";
cout << "\n";
}
Compilation message
toy.cpp:1:10: fatal error: bits/stdc++.h.: No such file or directory
#include <bits/stdc++.h.>
^~~~~~~~~~~~~~~~
compilation terminated.