P6443 [COCI 2010/2011 #1] TIMSKO
Description
A university holds an informatics contest every year. In the contest, each team consists of $1$ boy and $2$ girls. In order to reduce the number of opponents, a dean of a faculty arranges for some opponents to go to an internship in a faraway country, and those sent to the internship will not be able to participate in the contest. Among all contestants, the number of female contestants is $m$, the number of male contestants is $n$, and the number of opponents that can be sent to the internship is $k$. The dean must form teams that can participate in the contest. Your task is to output the maximum number of teams that can be formed.
Input Format
The input consists of one line.
One line with three integers $m, n, k$, with the meanings as described above.
Output Format
The output consists of one line.
One line with one integer $ans$, indicating the maximum number of teams that can be formed.
Explanation/Hint
**Explanation for Sample Input/Output 1**
The dean can send one boy and one girl to the internship. Then it becomes: $m=5$, $n=2$. Two teams can be formed (one girl has no team), so the answer is $2$.
---
**Constraints**
For $100\%$ of the testdata, $0 \leq n, m \leq 100$, and $0 \leq k \leq m+n$.
---
**Notes**
**This problem is translated from [COCI2010-2011](https://hsin.hr/coci/archive/2010_2011/) [CONTEST #1](https://hsin.hr/coci/archive/2010_2011/contest1_tasks.pdf) *T1 TIMSKO*.**
Translated by ChatGPT 5