{"problem":{"name":"A. Left-handers, Right-handers and Ambidexters","description":{"content":"You are at a water bowling training. There are _l_ people who play with their left hand, _r_ people, who play with their right hand, and _a_ ambidexters, who can play with left or right hand. The coa","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF950A"},"statements":[{"statement_type":"Markdown","content":"You are at a water bowling training. There are _l_ people who play with their left hand, _r_ people, who play with their right hand, and _a_ ambidexters, who can play with left or right hand.\n\nThe coach decided to form a team of even number of players, exactly half of the players should play with their right hand, and exactly half of the players should play with their left hand. One player should use only on of his hands.\n\nAmbidexters play as well with their right hand as with their left hand. In the team, an ambidexter can play with their left hand, or with their right hand.\n\nPlease find the maximum possible size of the team, where equal number of players use their left and right hands, respectively.\n\n## Input\n\nThe only line contains three integers _l_, _r_ and _a_ (0 ≤ _l_, _r_, _a_ ≤ 100) — the number of left-handers, the number of right-handers and the number of ambidexters at the training.\n\n## Output\n\nPrint a single even integer — the maximum number of players in the team. It is possible that the team can only have zero number of players.\n\n[samples]\n\n## Note\n\nIn the first example you can form a team of 6 players. You should take the only left-hander and two ambidexters to play with left hand, and three right-handers to play with right hand. The only person left can't be taken into the team.\n\nIn the second example you can form a team of 14 people. You have to take all five left-handers, all five right-handers, two ambidexters to play with left hand and two ambidexters to play with right hand.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"你正在参加水瓶保龄球训练。有 #cf_span[l] 个人使用左手，#cf_span[r] 个人使用右手，还有 #cf_span[a] 个左右手皆能的全能选手，他们可以用左手或右手打球。\n\n教练决定组建一支人数为偶数的队伍，其中恰好一半的球员使用右手，另一半使用左手。每个球员只能使用其中一只手。\n\n全能选手使用左手或右手的能力相同。在队伍中，全能选手可以选择使用左手或右手。\n\n请找出满足以下条件的最大队伍规模：使用左手和右手的球员人数相等。\n\n输入仅一行，包含三个整数 #cf_span[l], #cf_span[r] 和 #cf_span[a]（#cf_span[0 ≤ l, r, a ≤ 100]），分别表示训练中左撇子、右撇子和全能选手的人数。\n\n请输出一个偶数——队伍中球员的最大数量。队伍人数可能为零。 \n\n在第一个例子中，你可以组建一支由 #cf_span[6] 名球员组成的队伍：取唯一的左撇子和两个全能选手使用左手，三个右撇子使用右手。剩下的一个人无法入选队伍。\n\n在第二个例子中，你可以组建一支由 #cf_span[14] 人组成的队伍：必须取全部五个左撇子、全部五个右撇子，两个全能选手使用左手，两个全能选手使用右手。\n\n## Input\n\n输入仅一行，包含三个整数 #cf_span[l], #cf_span[r] 和 #cf_span[a]（#cf_span[0 ≤ l, r, a ≤ 100]），分别表示训练中左撇子、右撇子和全能选手的人数。\n\n## Output\n\n请输出一个偶数——队伍中球员的最大数量。队伍人数可能为零。\n\n[samples]\n\n## Note\n\n在第一个例子中，你可以组建一支由 #cf_span[6] 名球员组成的队伍：取唯一的左撇子和两个全能选手使用左手，三个右撇子使用右手。剩下的一个人无法入选队伍。\n\n在第二个例子中，你可以组建一支由 #cf_span[14] 人组成的队伍：必须取全部五个左撇子、全部五个右撇子，两个全能选手使用左手，两个全能选手使用右手。","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ l, r, a \\in \\mathbb{Z}_{\\geq 0} $ denote the number of left-handers, right-handers, and ambidexters, respectively.  \n\n**Constraints**  \n$ 0 \\leq l, r, a \\leq 100 $  \n\n**Objective**  \nFind the maximum even integer $ 2x $ such that there exist non-negative integers $ x_L, x_R $ satisfying:  \n- $ x_L \\leq l + a $,  \n- $ x_R \\leq r + a $,  \n- $ x_L + x_R \\leq l + r + a $,  \n- $ x_L \\geq x $, $ x_R \\geq x $,  \n- $ x_L - x \\leq a $, $ x_R - x \\leq a $,  \n- $ x_L - x + x_R - x \\leq a $ (i.e., total ambidexters used $ \\leq a $).  \n\nEquivalently, maximize $ 2x $ subject to:  \n$$\nx \\leq \\min(l + a, r + a, \\left\\lfloor \\frac{l + r + a}{2} \\right\\rfloor)\n$$\nand  \n$$\nx \\leq l + r + a - x \\quad \\text{(redundant)}, \\quad x \\leq \\min(l, r) + a\n$$\n\n**Final Formulation**  \nMaximize $ 2x $ where:  \n$$\nx \\in \\mathbb{Z}_{\\geq 0}, \\quad x \\leq \\min(l + a, r + a, l + r + a - x)\n$$  \nEquivalently:  \n$$\nx \\leq \\min(l + a, r + a, \\left\\lfloor \\frac{l + r + a}{2} \\right\\rfloor)\n$$  \nThus, the maximum team size is:  \n$$\n2 \\cdot \\min\\left(l + a, r + a, \\left\\lfloor \\frac{l + r + a}{2} \\right\\rfloor\\right)\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF950A","tags":["implementation","math"],"sample_group":[["1 4 2","6"],["5 5 5","14"],["0 2 0","0"]],"created_at":"2026-03-03 11:00:39"}}