using System.Collections.Generic;
public static void Main()
public static int FindCircleNum(int[][] M)
List<bool> friendZoned = new List<bool>(new bool[M.Length]);
foreach(bool b in friendZoned)
Stack<int> dfs = new Stack<int>();
for(int i = 0; i < M.Length; i++)
int current = dfs.Peek(); dfs.Pop();
friendZoned[current] = true;
for(int j = 0 ; j < M[current].Length; j++)
if(!friendZoned[j] && M[current][j] == 1)