fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int x,y;
  6. if(x<y)
  7. {
  8. int t = y-x;
  9. if(t<=2)
  10. {
  11. cout << "Yes" << endl;
  12. }
  13. else cout << "No" << endl;
  14. }
  15. else
  16. {
  17. int n = x-y;
  18. if(n<=3)
  19. {
  20. cout << "Yes" << endl;
  21. }
  22. else cout << "No" << endl;
  23. }
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5320KB
stdin
1 4

stdout
Yes