#K46312. Detecting Fraudulent Orders

    ID: 27949 Type: Default 1000ms 256MiB

Detecting Fraudulent Orders

Detecting Fraudulent Orders

You are given a list of orders and a list of blacklisted user IDs. Each order is represented by three integers: order_id, user_id, and amount. An order is considered fraudulent if any one of the following conditions holds:

  • The order_id has appeared before (duplicate order).
  • The amount exceeds the threshold (i.e. \(amount > threshold\)).
  • The user_id is in the blacklisted list.

Your task is to count the number of fraudulent orders based on these conditions.

inputFormat

The input is given in the following format from stdin:

N B threshold
[list of B blacklisted user IDs if B > 0]
(order_id user_id amount) for N orders (one order per line)

Note: If B is 0, the second line (blacklisted users list) will be omitted.

outputFormat

Output a single integer representing the total number of fraudulent orders to stdout.

## sample
5 0 100
1 101 50
2 102 90
3 103 70
4 104 80
5 105 60
0