Company: inmobi_14june_iitbhu
Difficulty: medium
A logistics company operates a delivery network across N cities, numbered 1 to N . Each day is divided into two operational shifts: Morning and Afternoon . You are given M scheduled courier routes. Each route is a directed path that allows packages to move from one city's specific shift to another city's shift. Additionally, within the same city, packages can naturally transition from the Morning shift to the Afternoon shift, but never from Afternoon to Morning (as time moves forward). A delivery between an ordered pair of cities (u, v) is considered possible if a package starting at City u in the Morning can reach City v (in either its Morning or Afternoon shift) by following any sequence of scheduled courier routes or intra-city shift transitions. Your task is to find the total number of ordered pairs of cities (u, v) such that a delivery from City u to City v is impossible . Input Format: The first line contains two space-separated integers, N (the number of cities) and M (the numbe