#include #include #include #include #include using namespace std; int main() { vector cands = {1,5,10,50,100,500}; reverse(cands.begin(), cands.end()); map mp; int C, Y; cin >> C >> Y; for (int cand: cands) { int cnt = Y / cand; mp[cand] = cnt; Y -= cand * cnt; } if (mp[100] >= C) { cout << "no exchange" << endl; } else if (mp[500] * 5 + mp[100] < C) { cout << "can't exchange" << endl; } else { int need = C - mp[100]; int t = ((need + 4) / 5); int ans = mp[100] + t * 5; cout << ans << endl; } return 0; }