https://www.acmicpc.net/problem/2875
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int m=s.nextInt();
int k=s.nextInt();
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;
}
System.out.print(count);
}
}