Problem p03991 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define neko 200010
#define feko 800010
#define f(i, a, b) for (register int i = (a); i <= (b); i = -(~i))
#define fe(i, a, b) for (register int i = (a); i < (b); i = -(~i))
#define rf(i, a, b) for (register int i = (a); i >= (b); i = ~(-i))
int n, t, head[neko], siz[neko];
typedef long long arf[feko];
arf A, B, gi, rev;
typedef long long ll;
ll gpow[feko][2], F[neko], fac[neko], ifac[neko], mod = 924844033;
struct edge {
  int v, nex;
} e[neko << 1];
namespace IO {
const unsigned int bufsize = 1 << 16, outsize = 1 << 24;
static char ch[bufsize], *S = ch, *T = ch;
inline char getc() {
  return ((S == T) && (T = (S = ch) + fread(ch, 1, bufsize, stdin), S == T)
              ? 0
              : *S++);
}
static char Out[outsize], *nowp = Out;
inline void flush() {
  fwrite(Out, 1, nowp - Out, stdout);
  nowp = Out;
}
template <typename T> void read(T &x) {
  char c = getc();
  x = 0;
  for (; !isdigit(c); c = getc())
    ;
  for (; isdigit(c); x = (x << 1) + (x << 3) + (c ^ '0'), c = getc())
    ;
}
template <typename T> void write(T x, char c = '\n') {
  if (!x)
    *nowp++ = '0';
  static unsigned int stk[50], tp = 0;
  for (; x; x /= 10)
    stk[++tp] = x % 10;
  for (; tp; *nowp++ = stk[tp--] ^ '0')
    ;
  *nowp++ = c;
}
} // namespace IO
ll ADD(ll x, ll y) { return (x += y) >= mod ? x - mod : x; }
ll spow(ll m, ll n) {
  ll b = 1;
  for (; n; n >>= 1, m = m * m % mod)
    if (n & 1)
      b = b * m % mod;
  return b;
}
namespace Conv {
using std::swap;
ll gen = 5, igen = spow(5, mod - 2);
int n, m;
void NTT(ll *p, int opt) {
  fe(i, 0, n) if (i < rev[i]) swap(p[i], p[rev[i]]);
  int hfi;
  ll u, v;
  for (register int i = 2; i <= n; i <<= 1) {
    hfi = i >> 1;
    fe(j, 1, hfi) gi[j] = gi[j - 1] * gpow[i][opt] % mod;
    for (register int j = 0; j < n; j += i) {
      fe(k, 0, hfi) {
        u = p[j + k], v = gi[k] * p[j + k + hfi] % mod;
        p[j + k] = ADD(u, v), p[j + k + hfi] = ADD(u, mod - v);
      }
    }
  }
  if (!opt) {
    int in = spow(n, mod - 2);
    fe(i, 0, n) p[i] = p[i] * in % mod;
  }
}
int solve(int n1, int n2, int opt) {
  m = n1 + n2;
  int cnt = 0;
  for (n = 1; n <= m; n <<= 1)
    ++cnt;
  --cnt;
  fe(i, 0, n) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << cnt);
  NTT(A, 1), NTT(B, 1);
  if (opt == 1)
    fe(i, 0, n) A[i] = A[i] * B[i] % mod;
  if (opt == 2)
    fe(i, 0, n) A[i] = A[i] * B[i] % mod * B[i] % mod;
  NTT(A, 0);
  return n;
}
void init(int x, int n) {
  fac[0] = ifac[0] = gi[0] = 1;
  f(i, 1, n + 5) fac[i] = fac[i - 1] * i % mod;
  ifac[n + 5] = spow(fac[n + 5], mod - 2);
  rf(i, n + 4, 1) ifac[i] = ifac[i + 1] * (i + 1) % mod;
  for (register int i = 2; i <= x; i <<= 1)
    gpow[i][1] = spow(gen, (mod - 1) / i),
    gpow[i][0] = spow(igen, (mod - 1) / i);
}
} // namespace Conv
void dfs(int u, int fa) {
  siz[u] = 1;
  for (register int i = head[u], v = e[i].v; i; i = e[i].nex, v = e[i].v)
    if (v ^ fa)
      dfs(v, u), siz[u] += siz[v];
  ++F[siz[u]], ++F[n - siz[u]];
}
void add(int x, int y) {
  e[++t].v = y, e[t].nex = head[x], head[x] = t;
  e[++t].v = x, e[t].nex = head[y], head[y] = t;
}
int main() {
  freopen("F.in", "r", stdin);
  freopen("F.out", "w", stdout);
  using namespace IO;
  int x, y;
  read(n);
  for (x = 2; x <= n; x <<= 1)
    ;
  Conv::init(x << 1, n);
  f(i, 1, n - 1) read(x), read(y), add(x, y);
  dfs(1, 0);
  f(i, 0, n - 1) A[i] = fac[i] * (mod - F[i]) % mod;
  A[n] = fac[n] * n % mod;
  f(i, 0, n) B[i] = ifac[n - i];
  Conv::solve(n, n, 1);
  f(i, 1, n) printf("%lld\n", ADD(A[n + i] * ifac[i] % mod, mod));
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define neko 200010
#define feko 800010
#define f(i, a, b) for (register int i = (a); i <= (b); i = -(~i))
#define fe(i, a, b) for (register int i = (a); i < (b); i = -(~i))
#define rf(i, a, b) for (register int i = (a); i >= (b); i = ~(-i))
int n, t, head[neko], siz[neko];
typedef long long arf[feko];
arf A, B, gi, rev;
typedef long long ll;
ll gpow[feko][2], F[neko], fac[neko], ifac[neko], mod = 924844033;
struct edge {
  int v, nex;
} e[neko << 1];
namespace IO {
const unsigned int bufsize = 1 << 16, outsize = 1 << 24;
static char ch[bufsize], *S = ch, *T = ch;
inline char getc() {
  return ((S == T) && (T = (S = ch) + fread(ch, 1, bufsize, stdin), S == T)
              ? 0
              : *S++);
}
static char Out[outsize], *nowp = Out;
inline void flush() {
  fwrite(Out, 1, nowp - Out, stdout);
  nowp = Out;
}
template <typename T> void read(T &x) {
  char c = getc();
  x = 0;
  for (; !isdigit(c); c = getc())
    ;
  for (; isdigit(c); x = (x << 1) + (x << 3) + (c ^ '0'), c = getc())
    ;
}
template <typename T> void write(T x, char c = '\n') {
  if (!x)
    *nowp++ = '0';
  static unsigned int stk[50], tp = 0;
  for (; x; x /= 10)
    stk[++tp] = x % 10;
  for (; tp; *nowp++ = stk[tp--] ^ '0')
    ;
  *nowp++ = c;
}
} // namespace IO
ll ADD(ll x, ll y) { return (x += y) >= mod ? x - mod : x; }
ll spow(ll m, ll n) {
  ll b = 1;
  for (; n; n >>= 1, m = m * m % mod)
    if (n & 1)
      b = b * m % mod;
  return b;
}
namespace Conv {
using std::swap;
ll gen = 5, igen = spow(5, mod - 2);
int n, m;
void NTT(ll *p, int opt) {
  fe(i, 0, n) if (i < rev[i]) swap(p[i], p[rev[i]]);
  int hfi;
  ll u, v;
  for (register int i = 2; i <= n; i <<= 1) {
    hfi = i >> 1;
    fe(j, 1, hfi) gi[j] = gi[j - 1] * gpow[i][opt] % mod;
    for (register int j = 0; j < n; j += i) {
      fe(k, 0, hfi) {
        u = p[j + k], v = gi[k] * p[j + k + hfi] % mod;
        p[j + k] = ADD(u, v), p[j + k + hfi] = ADD(u, mod - v);
      }
    }
  }
  if (!opt) {
    int in = spow(n, mod - 2);
    fe(i, 0, n) p[i] = p[i] * in % mod;
  }
}
int solve(int n1, int n2, int opt) {
  m = n1 + n2;
  int cnt = 0;
  for (n = 1; n <= m; n <<= 1)
    ++cnt;
  --cnt;
  fe(i, 0, n) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << cnt);
  NTT(A, 1), NTT(B, 1);
  if (opt == 1)
    fe(i, 0, n) A[i] = A[i] * B[i] % mod;
  if (opt == 2)
    fe(i, 0, n) A[i] = A[i] * B[i] % mod * B[i] % mod;
  NTT(A, 0);
  return n;
}
void init(int x, int n) {
  fac[0] = ifac[0] = gi[0] = 1;
  f(i, 1, n + 5) fac[i] = fac[i - 1] * i % mod;
  ifac[n + 5] = spow(fac[n + 5], mod - 2);
  rf(i, n + 4, 1) ifac[i] = ifac[i + 1] * (i + 1) % mod;
  for (register int i = 2; i <= x; i <<= 1)
    gpow[i][1] = spow(gen, (mod - 1) / i),
    gpow[i][0] = spow(igen, (mod - 1) / i);
}
} // namespace Conv
void dfs(int u, int fa) {
  siz[u] = 1;
  for (register int i = head[u], v = e[i].v; i; i = e[i].nex, v = e[i].v)
    if (v ^ fa)
      dfs(v, u), siz[u] += siz[v];
  ++F[siz[u]], ++F[n - siz[u]];
}
void add(int x, int y) {
  e[++t].v = y, e[t].nex = head[x], head[x] = t;
  e[++t].v = x, e[t].nex = head[y], head[y] = t;
}
int main() {
  using namespace IO;
  int x, y;
  read(n);
  for (x = 2; x <= n; x <<= 1)
    ;
  Conv::init(x << 1, n);
  f(i, 1, n - 1) read(x), read(y), add(x, y);
  dfs(1, 0);
  f(i, 0, n - 1) A[i] = fac[i] * (mod - F[i]) % mod;
  A[n] = fac[n] * n % mod;
  f(i, 0, n) B[i] = ifac[n - i];
  Conv::solve(n, n, 1);
  f(i, 1, n) printf("%lld\n", ADD(A[n + i] * ifac[i] % mod, mod));
  return 0;
}