#C1753. Count Correct Answers
Count Correct Answers
Count Correct Answers
Alice has attempted a number of questions in an exam. You are given two lists:
- \( Q \): the list of question IDs that Alice answered.
- \( A \): the list of question IDs that Alice answered correctly.
Your task is to determine the number of questions that Alice answered correctly. Mathematically, you need to compute the size of the intersection between \( Q \) and \( A \), i.e.,
$$ \text{result} = |Q \cap A| $$
Note that even if the same question ID appears more than once, it is only counted once.
inputFormat
The input consists of three lines:
- The first line contains two integers (N) and (M), where (N) is the number of questions Alice answered and (M) is the number of questions she answered correctly.
- The second line contains (N) space-separated integers representing the question IDs in list (Q).
- The third line contains (M) space-separated integers representing the question IDs in list (A).
outputFormat
Output a single integer which is the number of questions Alice answered correctly.## sample
5 3
1 2 3 4 5
2 4 6
2