CF950A Left-handers, Right-handers and Ambidexters

题目描述

你现在在一个运动队里。 这个队里有l 个人只能用他的左手训练(左撇子),另外有r 个人只能用右手训练(右撇子),还有a 个两只手都可以训练的人(既不是左撇子也不是右撇子,但只能用一只手)。 你们的教练决定组建一支队伍,但要保证队伍里用左手训练的人和用右手训练的人一样多。 你的任务是找到这个团队里最多能有多少个人。

输入格式

输入的是3个整数l,r,a(0

输出格式

输出一个整数,代表这个队伍里最多有多少人,如果组不成这样的队伍,则输出0 . Translated by @cn:苏卿念

说明/提示

In 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. In 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.