{"problem":{"name":"Balls of Three Colors","description":{"content":"We have $R$ red balls, $G$ green balls, and $B$ blue balls. You can do the following operation any number of times: *   choose two balls of different colors and turn them into two balls of the remain","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc128_b"},"statements":[{"statement_type":"Markdown","content":"We have $R$ red balls, $G$ green balls, and $B$ blue balls. You can do the following operation any number of times:\n\n*   choose two balls of different colors and turn them into two balls of the remaining color.\n\nFor example, you can choose a red ball and a blue ball and turn them into two green balls.\nYour objective is to make all balls have the same color. Determine whether this objective is achievable. If it is, find the minimum number of operations required to achieve it.\nFor each input file, solve $T$ test cases.\n\n## Constraints\n\n*   $1 \\leq T \\leq 100$\n*   $1 \\leq R,G,B \\leq 10^8$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$T$\n$case_1$\n$case_2$\n$\\vdots$\n$case_T$\n\nEach case is in the following format:\n\n$R$ $G$ $B$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc128_b","tags":[],"sample_group":[["3\n1 2 2\n1 2 3\n1 2 4","2\n-1\n4\n\nFor example, in $case_3$, one optimal sequence of operations is:\n\n*   choose a green ball and blue ball, turning them into two red balls;\n*   choose a red ball and blue ball, turning them into two green balls;\n*   choose a red ball and blue ball, turning them into two green balls;\n*   choose a red ball and blue ball, turning them into two green balls."]],"created_at":"2026-03-03 11:01:14"}}