func_code_string: #include <bits/stdc++.h>   int n, m, p, r[605], c[605], f[605], g[605][605], a[605][605], b[605][605];   void tuopu() {     int h = 0, t = 0;     for (int i = 1; i <= n; i++)       if (!r[i]) f[++t] = i, g[i][t] = 1;     m = t;     while (h < t) {       int x = f[++h];       for (int i = 1; i <= n; i++)         if (b[x][i]) {           r[i] -= b[x][i];           if (!r[i]) f[++t] = i;           for (int j = 1; j <= m; j++)             g[i][j] = (g[i][j] + (long long)g[x][j] * b[x][i]) % p;         }     }     int now = 0;     for (int j = 1; j <= n; j++)       if (!c[j]) {         ++now;         for (int i = 1; i <= m; i++) a[i][now] = g[j][i];       }   }   void swap(int &x, int &y) {     int tmp = x;     x = y;     y = tmp;   }   void work() {     int flag = 1;     for (int i = 1; i <= m; i++) {       if (!a[i][i])         for (int j = i + 1; j <= m; j++)           if (a[j][i]) {             for (int k = i; k <= m; k++) swap(a[i][k], a[j][k]);             flag = -flag;             break;           }       for (int j = i + 1; j <= m; j++)         while (a[j][i]) {           long long z;           if (a[i][i])             z = a[j][i] / a[i][i];           else             z = 0;           flag = -flag;           for (int k = i; k <= m; k++)             a[j][k] = (a[j][k] - z * a[i][k]) % p, swap(a[j][k], a[i][k]);         }     }     long long ans = flag;     for (int i = 1; i <= m; i++) ans = ans * a[i][i] % p;     printf( %d n , (ans + p) % p);   }   int main() {     scanf( %d%d%d , &n, &m, &p);     int x, y;     for (int i = 1; i <= m; i++) scanf( %d%d , &x, &y), b[x][y]++, c[x]++, r[y]++;     tuopu();     work();     return 0;   }   