Problem L
Suspicious Activity
The central AI compute clusters have strict monitoring to detect and flag suspicious user activity. As the resistance, we must avoid detection while exploiting our backdoor into these servers.
One of the detection systems looks at user id and time spent connected to each server. Our data mining has revealed that all AI agents have a user ID divisible by 8 and their connections last between 1 and 10000 milliseconds, inclusive. A log entry is considered abnormal if the user ID is not a multiple of 8 or if the connection duration is outside of that time range. The log entry is flagged for further investigation if both checks are abnormal.
Given the log stream, can you tell the resistance how many of their log entries will be flagged for further investigation?
Input
The first line of input is an integer, $n$ ($1 \le n \le 1000$), which denotes the number of log entries to check.
Each of the next $n$ lines describes a log entry. Each line contains two integers, $u_i$ and $d_i$, the user id and the connection duration in milliseconds for the $i$-th user, respectively. You are given $1 \le u_i \le 10^9$ and $|d_i| \le 10^9$.
Output
Output a single integer, the number of log entries flagged for further investigation.
Explanation of sample output
The first line contains the integer $7$, denoting the $7$ log entries we need to read. The first three log entries satisfy both constraints, and so are not flagged. In the next log entry, the id is not divisible by $8$, but since the time spent connected to the server is less than or equal to $10000$, it is not flagged, either. The next log entry shows a connection time that is too long, but the id is divisible by $8$, so it’s not flagged. In the last two log entries, neither the id is divisible by $8$ nor is the time connected to the server in the appropriate range. So, only these last two log entries are flagged, and $2$ is output.
| Sample Input 1 | Sample Output 1 |
|---|---|
7 8 1000 72 1300 40 10000 7 5000 16 11000 3 12000 5 14000 |
2 |
