func_code_string: #include <bits/stdc++.h>   using namespace std;   int N, M;   const int MAX = 1e6;   vector<int> edges[MAX];   int indeg[MAX];   vector<int> source;   map<int, int> sink;   int reachable[20];   const int BITMAX = 1 << 20;   int dp[BITMAX];   void dfs(int start, int i) {     if (sink.count(i)) {       reachable[start] |= sink[i];     } else {       for (auto j : edges[i]) dfs(start, j);     }   }   int main() {     int i, j, k;     cin >> N >> M;     for (i = 0; i < M; i++) {       int x, y;       scanf( %d %d , &x, &y);       edges[x - 1].push_back(y - 1);       indeg[y - 1]++;     }     int num = 1;     for (i = 0; i < N; i++) {       if (indeg[i] == 0) source.push_back(i);       if (edges[i].size() == 0) {         sink[i] = num;         num *= 2;       }     }     int sz = source.size();     for (i = 0; i < sz; i++) dfs(i, source[i]);     int bitmax = 1 << sz;     for (i = 1; i < bitmax; i++) {       bool updated = false;       int in = 0;       for (j = 0; j < sz; j++) {         if ((i >> j) & 1) {           in++;           if (!updated) {             dp[i] = dp[i - (1 << j)] | reachable[j];             updated = true;           }         }       }       int out = 0;       for (j = 0; j < sz; j++) {         if ((dp[i] >> j) & 1) out++;       }       if (in >= out && in < sz) {         cout <<  NO  << endl;         return 0;       }     }     cout <<  YES  << endl;     return 0;   }   