https://www.acmicpc.net/problem/2875
#include <iostream>
using namespace std;
int main() {
int n,m,k;
cin >> n >> m >> k;
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;
}
cout << count;
}