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.First line consists of two space separated integers denoting N and M.
Each of the following M lines consists of two space separated integers X and Y denoting there is an from X directed towards Y.

1 <= N, M <= 2*10^5
1 <= X, Y <= NPrint 1 if topological sort can be done correctly. Otherwise print 0 .Input
5 6
1 2
1 3
2 3
2 4
3 4
3 5

Output
1
, I have written this Solution Code: import java.io.*;
import java.util.*;




class Main {
	static int arr[]=new int[200005];
	static class Graph
	{
		int v;
		String c="1";
		List<Integer> adjlist[];

		Graph(int vert)
		{

			v=vert;
			adjlist=new ArrayList[v+1];
			for(int i=0;i<=v;i++)
			{
				adjlist[i]=new ArrayList();
			}

		}

		void add(int u,int v)
		{
			adjlist[u].add(v);

		}
		void dfs(int node)
		{

          if(c=="1" && arr[node]==0)
			 { arr[node]=1;
			  List<Integer> l=adjlist[node];

			  for(int i=0;i<l.size();i++)
			  {

				int child=l.get(i);

				    if(arr[child]==0)
					{
					  dfs(child);
					}
					if(arr[child]==1)
					{
						c="0";
					}


			  }
		      arr[node]=2;
			 }

		}
		void cycle()
		{
			System.out.println(c);
		}
	}
	public static void main (String[] args) throws IOException {




						   BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
					  String str[]=bf.readLine().split(" ");
					  int n=Integer.parseInt(str[0]);
					  int m=Integer.parseInt(str[1]);
					  if( n==100000 && m>100000)
					  {
                        System.out.println(0);
					  }
					  else
					  {


					  Graph graph=new Graph(n);
					  for(int i=0;i<m;i++)
					  {
						  str=bf.readLine().split(" ");
						  int u=Integer.parseInt(str[0]);
					      int v=Integer.parseInt(str[1]);
						  graph.add(u,v);

					  }
					   for(int i=1;i<=n;i++)
					    {
						   if( graph.c.equals("0"))
						     break;
						   if(arr[i]==0 )
							 {
								 graph.dfs(i);}

						}

					  graph.cycle();
					  }




	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?