func_code_string: #include <bits/stdc++.h>   int dx[] = {-1, -1, -1, 0, 1, 1, 1, 0};   int dy[] = {-1, 0, 1, 1, 1, 0, -1, -1};   using namespace std;   long long power(long long a, long long p, long long M) {     long long r = 1;     a = a % M;     while (p > 0) {       if (p % 2) r = (r * a) % M;       a = (a * a) % M;       p /= 2;     }     return r;   }   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long n, m;   set<long long> e[100005];   stack<long long> cycle, temp;   long long vis[505];   bool found;   void findCycle(long long x) {     temp.push(x);     vis[x] = 1;     for (auto y : e[x]) {       if (vis[y] == 0)         findCycle(y);       else if (vis[y] == 1) {         if (found) return;         cycle = temp;         cycle.push(y);         found = 1;         return;       }     }     if (!temp.empty()) temp.pop();     vis[x] = 2;   }   void fc(long long x) {     vis[x] = 1;     for (auto y : e[x]) {       if (vis[y] == 0)         fc(y);       else if (vis[y] == 1) {         found = 1;         return;       }     }     vis[x] = 2;   }   void solve() {     cin >> n >> m;     for (long long i = 0; i < m; i++) {       long long a, b;       scanf( %lld%lld , &a, &b);       e[a].insert(b);     }     for (long long i = 1; i < n + 1; i++) {       if (!vis[i]) {         findCycle(i);         if (found) break;       }     }     if (!found) {       cout <<  YES n ;       return;     }     vector<long long> c;     for (long long i = 0; i < 505; i++) vis[i] = 0;     while (!cycle.empty()) {       c.push_back(cycle.top());       if (vis[cycle.top()]) {         break;       }       vis[cycle.top()] = 1;       cycle.pop();     }     reverse(c.begin(), c.end());     for (long long i = 0; i < c.size() - 1; i++) {       found = 0;       e[c[i]].erase(c[i + 1]);       for (long long j = 0; j < 505; j++) vis[j] = 0;       for (long long j = 1; j < n + 1; j++) {         if (!vis[j]) fc(j);         if (found) {           break;         }       }       if (!found) {         cout <<  YES n ;         return;       }       e[c[i]].insert(c[i + 1]);     }     cout <<  NO n ;   }   int main() {     solve();     return 0;   }   