fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t;
  6. cin >> t;
  7. while(t--!=0)
  8. {
  9. int a, b, c, d;
  10. cin >> a >> b;
  11. c = max(a, b);
  12. d = min(a, b);
  13. if(a == b)
  14. {
  15. cout << "YES" << "\n";
  16. }
  17. else if((c%2) != 0)
  18. {
  19. cout << "NO" << "\n";
  20. }
  21. else
  22. {
  23. while(d < c)
  24. {
  25. d = d*2;
  26. }
  27. if(d == c)
  28. {
  29. cout << "YES" << "\n";
  30. }
  31. else
  32. {
  33. cout << "NO" << "\n";
  34. }
  35. }
  36. }
  37. return 0;
  38. }
Success #stdin #stdout 0.01s 5544KB
stdin
4
5 20
6 6
12 2
37 37
stdout
YES
YES
NO
YES