#K61037. Unique User Pairs with Recommendation Limit

    ID: 31220 Type: Default 1000ms 256MiB

Unique User Pairs with Recommendation Limit

Unique User Pairs with Recommendation Limit

In a social network, every user can be paired with every other user. The number of such unique user pairs is given by the formula \(\binom{N}{2} = \frac{N(N-1)}{2}\), where \(N\) is the number of users.

Your task is to compute the number of unique pairs for each test case. However, there is a constraint: if the computed number of pairs exceeds a given limit \(M\), you should output "Exceeds Limit" instead of the number.

inputFormat

The input is read from standard input (stdin) and is formatted as follows:

  1. The first line contains an integer \(T\), denoting the number of test cases.
  2. Each of the following \(T\) lines contains two space-separated integers \(N\) and \(M\), where \(N\) represents the number of users and \(M\) is the maximum allowed number of recommendations.

outputFormat

For each test case, output a single line to standard output (stdout):

  • If the computed number of unique pairs (i.e. \(\frac{N(N-1)}{2}\)) is less than or equal to \(M\), output the number.
  • Otherwise, output "Exceeds Limit".
## sample
2
5 10
10 30
10

Exceeds Limit

</p>