Company: Makemytrip_26july
Difficulty: medium
City Travel Rewards Problem Description Jack lives in a city that has A tourist places and M roads connecting them. All the roads in the city are one-way (i.e., directed roads). As a result, some tourist places may become isolated and abandoned. Two tourist places may have multiple direct roads connecting them. The city authorities have decided to launch a loyalty program to attract tourists. In this loyalty program, a person will receive rewards when traveling through roads. Each road has a fixed base reward point. When a person travels through a road for the i-th time, with a base reward point of Z, they will receive a reward calculated using the formula B + (i-1)^2 * Z. If the reward comes out to be negative according to this formula, the reward will be set to zero. Jack wants to know the maximum reward points he can accumulate using this loyalty program. Since Jack is busy, he asks you to find it for him. You are given integers A and B, where A represents the number of tourist plac