Score : $600$ points
There are integers with $N$ different values written on a blackboard. The $i$-th value is $A_i$ and is written $B_i$ times.
You may repeat the following operation as many times as possible:
Find the maximum number of times the operation can be performed.
Input is given from Standard Input in the following format:
$N$ $A_1$ $B_1$ $A_2$ $B_2$ $\vdots$ $A_N$ $B_N$
Print the answer.
3 3 3 2 4 6 2
3
We have $2 + 3 = 5$, and $5$ is prime, so you can choose $2$ and $3$ to erase them, but nothing else. Since there are four $2$s and three $3$s, you can do the operation three times.
1 1 4
2
We have $1 + 1 = 2$, and $2$ is prime, so you can choose $1$ and $1$ to erase them. Since there are four $1$s, you can do the operation twice.