code: 
  
  
  
  
  
  
  from typing import Dict, Optional, Tuple
  
  import torch
  def        UpperCAmelCase      (   _lowercase      ):
  
  
      '''simple docstring'''
  
  
  
      _lowercase     =	boundaries[1] - boundaries[0]
      _lowercase     =	boundaries + step / 2
      _lowercase     =	torch.cat([bin_centers, (bin_centers[-1] + step).unsqueeze(-1      )],      dim=0      )
      return bin_centers
  def        UpperCAmelCase      (   _lowercase,      _lowercase,      ):
  
  
      '''simple docstring'''
  
  
  
      _lowercase     =	_calculate_bin_centers(_lowercase      )
      return (
          torch.sum(aligned_distance_error_probs * bin_centers,      dim=-1      ),
          bin_centers[-1],
      )
  def        UpperCAmelCase      (   _lowercase,      _lowercase = 31,      _lowercase = 64,      **_lowercase,      ):
  
  
      '''simple docstring'''
  
  
  
      _lowercase     =	torch.linspace(0,      _lowercase,      steps=(no_bins - 1),      device=logits.device      )
  
      _lowercase     =	torch.nn.functional.softmax(_lowercase,      dim=-1      )
      _lowercase ,    _lowercase     =	_calculate_expected_aligned_error(
          alignment_confidence_breaks=_lowercase,      aligned_distance_error_probs=_lowercase,      )
  
      return {
          "aligned_confidence_probs": aligned_confidence_probs,
          "predicted_aligned_error": predicted_aligned_error,
          "max_predicted_aligned_error": max_predicted_aligned_error,
      }
  def        UpperCAmelCase      (   _lowercase,      _lowercase = None,      _lowercase = 31,      _lowercase = 64,      _lowercase = 1e-8,      **_lowercase,      ):
  
  
      '''simple docstring'''
  
  
  
      if residue_weights is None:
          _lowercase     =	logits.new_ones(logits.shape[-2]      )
  
      _lowercase     =	torch.linspace(0,      _lowercase,      steps=(no_bins - 1),      device=logits.device      )
  
      _lowercase     =	_calculate_bin_centers(_lowercase      )
      torch.sum(_lowercase      )
      _lowercase     =	logits.shape[-2]
      _lowercase     =	max(_lowercase,      19      )
  
      _lowercase     =	1.24 * (clipped_n - 15) ** (1.0 / 3) - 1.8
  
      _lowercase     =	torch.nn.functional.softmax(_lowercase,      dim=-1      )
  
      _lowercase     =	1.0 / (1 + (bin_centers**2) / (da**2))
      _lowercase     =	torch.sum(probs * tm_per_bin,      dim=-1      )
  
      _lowercase     =	residue_weights / (eps + residue_weights.sum())
      _lowercase     =	torch.sum(predicted_tm_term * normed_residue_mask,      dim=-1      )
  
      _lowercase     =	per_alignment * residue_weights
  
      _lowercase     =	(weighted == torch.max(_lowercase      )).nonzero()[0]
      return per_alignment[tuple(_lowercase      )]
  
style_context: 
  
  
  
  
  
  
  from __future__ import annotations
  def        UpperCAmelCase      (   _lowercase      ):
  
  
      '''simple docstring'''
  
  
  
      global graph, reversed_graph, scc, component, visit, stack
      if visit[u]:
          return
      _lowercase     =	True
      for v in graph[u]:
          dfs(_lowercase      )
      stack.append(_lowercase      )
  def        UpperCAmelCase      (   _lowercase      ):
  
  
      '''simple docstring'''
  
  
  
      global graph, reversed_graph, scc, component, visit, stack
      if visit[u]:
          return
      _lowercase     =	True
      component.append(_lowercase      )
      for v in reversed_graph[u]:
          dfsa(_lowercase      )
  def        UpperCAmelCase      (   ):
  
  
      '''simple docstring'''
  
  
  
      global graph, reversed_graph, scc, component, visit, stack
      for i in range(_lowercase      ):
          dfs(_lowercase      )
      _lowercase     =	[False] * n
      for i in stack[::-1]:
          if visit[i]:
              continue
          _lowercase     =	[]
          dfsa(_lowercase      )
          scc.append(_lowercase      )
      return scc
  
  
  if __name__ == "__main__":
     # n - no of nodes, m - no of edges
     lowerCamelCase						,		lowerCamelCase										=  list(map(int, input().strip().split()))
  
     lowerCamelCase										=  [[] for _ in range(n)]  # graph
     lowerCamelCase										=  [[] for i in range(n)]  # reversed graph
     # input graph data (edges)
     for _ in range(m):
        lowerCamelCase						,		lowerCamelCase										=  list(map(int, input().strip().split()))
        graph[u].append(v)
        reversed_graph[v].append(u)
  
     lowerCamelCase										=  []
     lowerCamelCase										=  [False] * n
     lowerCamelCase										=  []
     lowerCamelCase										=  []
     print(kosaraju())
  