#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b;     cin >> a >> b;     int ans = 0;     while ((a >= 1 && b > 1) || (a > 1 && b >= 1)) {       if (a < b) {         ans++;         a--;         b -= 2;       } else {         ans++;         a -= 2;         b--;       }     }     cout << ans << endl;   }   