For this Question: Given a directed graph of N vertices, Print 1 if you can perform a topological sort on the given graph. Otherwise, print 0.

There are no self-loops or multiple edges.The first line contains two integers N and E, denoting the number of nodes and number of edges in the graph respectively. Next E lines contain two integers u and v, denoting an edge from u to v

Constraints
1 <= N, E <= 1000
0 <= u,  v <= N-1
u != vPrint 1 if topological sort can be done correctly. Otherwise, print 0.Sample Input 1:
4 5
0 1
1 2
2 3
3 0
0 2

Sample Output 1:
0

Sample Input 2:
4 3
0 1
1 2
2 3

Sample Output 2:
1
, I have written this Solution Code: #include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

vector<int> g[N];
int vis[N];
bool flag = 0;

void dfs(int u, int p){
	vis[u] = 1;
	for(auto i: g[u]){
		if(i == p)	continue;
		if(vis[i] == 1)
			flag = 1;
		if(vis[i] == 0)	dfs(i, u);
	}
	vis[u] = 2;
}

signed main() {
	IOS;
	int n, m;
	cin >> n >> m;
	for(int i = 1; i <= m; i++){
		int u, v;
		cin >> u >> v;
		g[u].push_back(v);
	}	
	for(int i = 0; i < n; i++){
		if(vis[i])	continue;
		dfs(i, n);
	}
	if(!flag)
		cout << 1;
	else
		cout << 0;
	return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?