Problem Statement
Weird Algorithm
Implementation
void solve() {
ll n;
cin >> n;
vll ans;
ans.pb(n);
while (n != 1) {
n = (n % 2 == 0) ? n / 2 : 3 * n + 1;
ans.pb(n);
}
rep(i, sz(ans)) cout << ans[i] << " ";
cout << "\n";
}