#K49112. Fraudulent Transactions Detection

    ID: 28571 Type: Default 1000ms 256MiB

Fraudulent Transactions Detection

Fraudulent Transactions Detection

In this problem, you are given a list of financial transactions. Each transaction is represented by an integer amount and a string category. A transaction is considered potentially fraudulent if its amount is strictly greater than the average of all transactions in its category, provided that the category has more than one transaction. The average is computed as (\frac{\text{sum of amounts in the category}}{\text{number of transactions in the category}}). Your task is to identify and output all fraudulent transactions in the order they appear in the input.

inputFormat

The input is given via standard input (stdin). The first line contains a single integer (n) representing the number of transactions. Each of the next (n) lines contains an integer and a string separated by a space, representing the transaction amount and its category, respectively.

outputFormat

Output each fraudulent transaction on a separate line to standard output (stdout). Each line should contain the transaction amount and its category separated by a space. If there are no fraudulent transactions, print nothing.## sample

6
100 food
200 entertainment
150 food
300 food
250 entertainment
50 transport
300 food

250 entertainment

</p>