题目描述
Problem Description
A university holds an annual informatics competition where each team consists of 1 boy and 2 girls. A college dean, aiming to reduce competition, arranges other competitors to intern in a distant country, making them unable to participate in the competition. Among all contestants, there are $m$ female contestants and $n$ male contestants, with $k$ competitors that can be sent for internship. The dean must form teams that can participate in the competition. Your task is to output the maximum number of teams that can be created.
Input Format
The input consists of a single line.
Three integers, $m, n, k$, as described in the problem.
Output Format
The output consists of a single line.
A single integer, $ans$, representing the maximum number of teams that can be formed.
Sample Input and Output
Sample Input #1
6 3 2
Sample Output #1
2
Sample Input #2
2 1 1
Sample Output #2
0
Sample Input #3
6 10 3
Sample Output #3
3
Notes
Explanation of Sample Input and Output 1
The dean can send one boy and one girl for internship, resulting in $m=5$ and $n=2$. This allows for two teams to be formed (with one girl left without a team), so the answer is $2$.
Data Range and Constraints
For $100\%$ of the data, $0 \leq n, m \leq 100$, and $0 \leq k \leq m+n$.
Note
This problem is translated from COCI2010-2011 CONTEST #1 T1 TIMSKO.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分