#C12333. Improved Fraud Detection
Improved Fraud Detection
Improved Fraud Detection
This problem involves implementing an improved fraud detection algorithm. You are given transaction data along with user location and IP addresses. Your task is to identify potentially fraudulent transactions by comparing each transaction's amount to the average transaction amount multiplied by a threshold.
Let \(\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i\) be the average transaction amount. A transaction is flagged as fraudulent if its amount is less than threshold × \(\bar{x}\). Otherwise, it is considered legitimate.
You are required to read input from standard input (stdin) and print the results to standard output (stdout).
inputFormat
The first line contains an integer \(n\), the number of transactions.
The next \(n\) lines each contain two space-separated numbers representing the transaction amount and frequency.
The following line contains \(n\) space-separated integers representing the user locations.
The next line contains \(n\) space-separated integers representing the user IP addresses.
The last line contains a floating point number representing the threshold.
outputFormat
Output a single line containing \(n\) space-separated integers (either 0 or 1). A value of 1 indicates that the corresponding transaction is fraudulent, while 0 indicates it is not fraudulent.
## sample3
1000 10
250 2
400 5
1 2 1
10 20 10
0.5
0 1 0