{"problem":{"name":"Erasing Prime Pairs","description":{"content":"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: *   Choo","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc263_g"},"statements":[{"statement_type":"Markdown","content":"There are integers with $N$ different values written on a blackboard. The $i$\\-th value is $A_i$ and is written $B_i$ times.\nYou may repeat the following operation as many times as possible:\n\n*   Choose two integers $x$ and $y$ written on the blackboard such that $x+y$ is prime. Erase these two integers.\n\nFind the maximum number of times the operation can be performed.\n\n## Constraints\n\n*   $1 \\leq N \\leq 100$\n*   $1 \\leq A_i \\leq 10^7$\n*   $1 \\leq B_i \\leq 10^9$\n*   All $A_i$ are distinct.\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ \n$A_1$ $B_1$\n$A_2$ $B_2$\n$\\vdots$\n$A_N$ $B_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc263_g","tags":[],"sample_group":[["3\n3 3\n2 4\n6 2","3\n\nWe 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\n1 4","2\n\nWe 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."]],"created_at":"2026-03-03 11:01:14"}}