atcoder#ABC263G. [ABC263G] Erasing Prime Pairs
[ABC263G] Erasing Prime Pairs
Score : points
Problem Statement
There are integers with different values written on a blackboard. The -th value is and is written times.
You may repeat the following operation as many times as possible:
- Choose two integers and written on the blackboard such that is prime. Erase these two integers.
Find the maximum number of times the operation can be performed.
Constraints
- All are distinct.
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
3
3 3
2 4
6 2
3
We have , and is prime, so you can choose and to erase them, but nothing else. Since there are four s and three s, you can do the operation three times.
1
1 4
2
We have , and is prime, so you can choose and to erase them. Since there are four s, you can do the operation twice.