https://www.acmicpc.net/problem/16204
#include <iostream> using namespace std; int main() { int n,m,k; cin>>n>>m>>k; cout<<min(m,k)+min(n-m,n-k); }