fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. //import System.out.*;
  5. import java.lang.*;
  6. import java.io.*;
  7. import java.math.BigInteger;
  8.  
  9. /* Name of the class has to be "Main" only if the class is public. */
  10. class Ideone
  11. {
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14. Scanner cin = new Scanner(System.in);
  15. int t;
  16. t = cin.nextInt();
  17. for(int ttt = 0;ttt <t;ttt++){
  18. int p1;
  19. int p2;
  20.  
  21. b1 = cin.nextBigInteger();
  22. p1 = cin.nextInt();
  23. b2 = cin.nextBigInteger();
  24. p2 = cin.nextInt();
  25. BigInteger r1 = b1.pow(p1);
  26. BigInteger r2 = b2.pow(p2);
  27.  
  28. int res = r1.compareTo(r2);
  29.  
  30. if(res == 0){
  31. System.out.println("Lazy");
  32. }
  33. else if(res == 1){
  34. System.out.println("HaHa");
  35. }
  36. else{
  37. System.out.println("Congrats");
  38. }
  39. }
  40. }
  41. }
Success #stdin #stdout 0.09s 35636KB
stdin
3
2 3 4 2
2 2 3 1
2 4 4 2
stdout
Congrats
HaHa
Lazy