https://www.acmicpc.net/problem/2875
using System;
class Program
{
static void Main() {
string[] s=Console.ReadLine().Split(' ');
int n=int.Parse(s[0]);
int m=int.Parse(s[1]);
int k=int.Parse(s[2]);
int c=n/2;
int count=c>=m?m:c;
int re=n+m-3*count;
n=n-2*count;
m=m-count;
k-=re;
if(k>0){
int a=k/3;
int b=k%3;
if(b==0) count-=a;
else count-=a+1;
}
Console.Write(count);
}
}