func_code_string: #include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1);   const int inf = 0x3fffffff;   const int maxn = 200005;   int n;   unsigned long long m;   struct P {     int x, y;   } p[maxn];   bool cmp(P a, P b) {     if (a.x == b.x) return a.y < b.y;     return a.x < b.x;   }   int main() {     scanf( %d , &n);     int y = 1;     for (int i = 1; i <= 2 * n; i++) {       int x;       scanf( %d , &x);       p[i].x = x, p[i].y = y;       y++;       if (y > n) y = 1;     }     scanf( %I64u , &m);     sort(p + 1, p + 2 * n + 1, cmp);     unsigned long long ans = 1, tmpans = 1, cnt = 0;     int now = -1;     for (int i = 1; i <= 2 * n; i++) {       if (now != p[i].x) {         now = p[i].x;         ans *= tmpans;         tmpans = 1LL;         ans %= m;         cnt = 0LL;       }       if (i < 2 * n) {         if (p[i + 1].x != p[i].x) {           tmpans *= (cnt + 1LL);           tmpans %= m;         } else {           if (p[i + 1].y != p[i].y) {             tmpans *= (cnt + 1LL);             tmpans %= m;             cnt++;           } else {             unsigned long long tmp1 = cnt + 1LL, tmp2 = cnt + 2LL;             if (tmp1 % 2LL == 0LL)               tmp1 /= 2LL;             else               tmp2 /= 2LL;             tmpans *= tmp1;             tmpans %= m;             tmpans *= tmp2;             tmpans %= m;             cnt += 2LL;             i++;             if (i == 2 * n) {               ans *= tmpans;               ans %= m;               break;             }           }         }       } else {         tmpans *= (cnt + 1LL);         tmpans %= m;         ans *= tmpans;         ans %= m;         break;       }     }     printf( %I64u n , ans);     return 0;   }   