fork download
  1. #include <iostream>
  2. using namespace std;
  3. typedef long long int ll;
  4.  
  5. int main() {
  6.  
  7. ll t;
  8. cin>>t;
  9.  
  10. for(ll i=0;i<t;i++)
  11. {
  12. ll a,b;
  13. cin>>a>>b;
  14.  
  15. ll an=0,bn=0;
  16. ll temp=a;
  17.  
  18. while(temp!=0)
  19. {
  20. if(temp%2==1)
  21. an++;
  22.  
  23. temp=temp/2;
  24. }
  25. temp=b;
  26.  
  27. while(temp!=0)
  28. {
  29. if(temp%2==1)
  30. bn++;
  31.  
  32. temp=temp/2;
  33. }
  34.  
  35. if(an==bn)
  36. cout<<"Equal"<<endl;
  37. else if(an>bn)
  38. cout<<a<<endl;
  39. else
  40. cout<<b<<endl;
  41. }
  42. return 0;
  43. }
Success #stdin #stdout 0s 15240KB
stdin
3
2 3
7 18
9 5
stdout
3
7
Equal