Initialize the adjacency list and visited array
@ SuppressWarnings ( " unchecked " ) static Vector < Integer > [ ] adj = new Vector [ 100005 ] ; static int [ ] visited = new int [ 100005 ] ; static int ans = 0 ;