fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int n=(int)1e7;
  13. boolean arr[]=new boolean[n+1];
  14. Arrays.fill(arr, true);
  15. arr[0]=arr[1]=false;
  16. for(int i=2;i<=n;i++){
  17. if(arr[i]){
  18. for(int j=2*i;j<=n;j+=i){
  19. arr[j]=false;
  20. }
  21. }
  22. }
  23. Scanner sc = new Scanner(System.in);
  24. while(sc.hasNextLong()){
  25. long a = sc.nextLong();
  26. int b = sc.nextInt();
  27. System.out.println(a);
  28. System.out.println(b);
  29. }
  30.  
  31. }
  32. }
Success #stdin #stdout 0.23s 62352KB
stdin
4 12


70 110

5 150
stdout
4
12
70
110
5
150