fork download
  1. #include <iostream>
  2. #include <unordered_set>
  3. using namespace std;
  4.  
  5. int main() {
  6. long long n, k;
  7. cin >> n >> k;
  8.  
  9. unordered_set<int> remainders;
  10.  
  11. for (long long i = 1; i <= k; ++i) {
  12. int remainder = n % i;
  13. if (remainders.count(remainder)) {
  14. cout << "No" << endl;
  15. return 0; // Exit immediately if a duplicate remainder is found
  16. }
  17. remainders.insert(remainder);
  18. }
  19.  
  20. cout << "Yes" << endl;
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 5276KB
stdin
4 4
stdout
No