func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1010000;   long long binpow(long long a, long long b, long long c) {     long long res = 1;     while (b) {       if (b & 1) res = (res * a) % c;       a = (a * a) % c;       b >>= 1;     }     return res;   }   int gcd(int a, int b) {     if (!b) return a;     return gcd(b, a % b);   }   int phi;   int lp[N], pr[N], k = 0;   int cnt[N];   int n, m, mod, x;   long long go[N];   vector<pair<int, int> > fact(int x) {     vector<pair<int, int> > res;     while (x > 1) {       if (res.size() > 0 && res[(int)res.size() - 1].first == lp[x])         res[(int)res.size() - 1].second++;       else         res.push_back(make_pair(lp[x], 1));       x /= lp[x];     }     return res;   }   long long f[N], inv[N];   long long C(int n, int m) {     if (n < m) return 0;     long long res = f[n];     res = (res * inv[m]) % phi;     res = (res * inv[n - m]) % phi;     return res;   }   long long ans[N];   int main() {     lp[0] = lp[1] = 1;     for (int i = 2; i <= 1000123; ++i) {       if (!lp[i]) {         lp[i] = i;         pr[++k] = i;       }       for (int j = 1; j <= k && pr[j] <= lp[i]; ++j) {         if ((long long)pr[j] * i > 1000123) break;         lp[pr[j] * i] = pr[j];       }     }     cin >> n >> m >> x >> mod;     for (int i = 1; i < mod; ++i) {       if (binpow(x, i, mod) == 1) {         phi = i;         break;       }     }     f[0] = inv[0] = 1;     for (int i = 1; i <= 1000123; ++i) {       f[i] = (f[i - 1] * i) % phi;       inv[i] = binpow(f[i], phi - 2, phi);     }     go[0] = 1;     for (int i = 1; i <= n; ++i) {       go[i] = (go[i - 1] + C(m, i)) % phi;     }     for (int i = 1; i <= n; ++i) {       ans[i] = binpow(x, go[i - 1], mod);     }     for (int i = n; i > 0; --i) printf( %lld  , ans[i]);     return 0;   }   