func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, m;   vector<pair<long long, long long> > a;   vector<pair<long long, long long> > fact(2, {1, 0});   long long pow2(long long i, long long m) {     long long r = 1, a = 2, b = i;     while (b != 0) {       if (b % 2 == 1) {         r = (r * a) % m;         b--;       } else {         a = (a * a) % m;         b /= 2;       }     }     return r;   }   bool fun(pair<long long, long long> x, pair<long long, long long> y) {     if (x.first == y.first) {       return x.second < y.second;     }     return x.first < y.first;   }   int main() {     cin >> n;     long long tmp;     for (int i = 0; i < n; i++) {       cin >> tmp;       a.push_back({tmp, i});     }     for (int i = 0; i < n; i++) {       cin >> tmp;       a.push_back({tmp, i});     }     sort(a.begin(), a.end(), fun);     cin >> m;     for (int i = 2; i <= 2 * n + 3; i++) {       int r = i, ct = 0;       while (r % 2 == 0) {         r /= 2;         ct++;       }       pair<long long, long long> p = fact[i - 1];       fact.push_back({(r * p.first) % m, p.second + ct});     }     long long ans = 1;     long long curr = 1, ct = 0;     for (int i = 1; i < a.size(); i++) {       if (a[i].first == a[i - 1].first) {         curr++;         if (a[i].second == a[i - 1].second) {           ct++;         }       } else {         ans = (ans * fact[curr].first) % m;         ans = (ans * pow2(fact[curr].second - ct, m)) % m;         curr = 1;         ct = 0;       }     }     ans = (ans * fact[curr].first) % m;     ans = (ans * pow2(fact[curr].second - ct, m)) % m;     curr = 1;     ct = 0;     cout << ans << endl;     return 0;   }   