Language: C

import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Iterator;
import java.util.Collections;
import java.util.Comparator;
import java.util.Random;
import java.util.Map;
import java.util.HashMap;
 
class Main{
        public static void main(String args[]){
                Scanner sc = new Scanner(System.in);
                int Q = sc.nextInt();
                int[] l = new int[Q];
                int[] r = new int[Q];
                int maxR=0;
                int minL=10000;
                for(int i=0; i<Q; i++){
                    l[i] = sc.nextInt();
                    r[i] = sc.nextInt();
                    maxR = Math.max(maxR,r[i]);
                    minL = Math.min(minL,l[i]);
                }
                ArrayList<Integer> sosu = new ArrayList<Integer>();
                //ArrayList<Integer> niteru = new ArrayList<Integer>();
                //素数を(minL+1)/2からmaxRまで列挙
                int[] ans = new int[Q];
                for(int i=0; i<Q; i++)ans[i]=0;
                boolean ch = true;
                //int start = Math.max((minL+1)/2, 3);
                //if(start % 2 ==0)start++;
                sosu.add(2);
                
                for(int i=3; i<=maxR; i+=2){
                    ch = true;
                    for(int j=1; j<sosu.size(); j++){
                        if(i%sosu.get(j)== 0){
                            ch =false;
                            break;
                        }
                    }
                    if(ch){
                    sosu.add(i);
                    if(sosu.indexOf((i+1)/2) != -1){
                        //niteru.add(i);
                        for(int k=0; k<Q; k++){
                            if(l[k]<=i && i<=r[k]){
                                ans[k] ++;
                            }
                        }
                    }
                    }
                }
                
                for(int i=0; i<Q; i++){
                    System.out.println(ans[i]);
                }
        }
}

Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.util.Scanner;
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.util.Scanner;
      |            ^
main.c:2:1: error: unknown type name 'import'
    2 | import java.util.ArrayList;
      | ^~~~~~
main.c:2:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    2 | import java.util.ArrayList;
      |            ^
main.c:3:1: error: unknown type name 'import'
    3 | import java.util.Arrays;
      | ^~~~~~
main.c:3:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    3 | import java.util.Arrays;
      |            ^
main.c:4:1: error: unknown type name 'import'
    4 | import java.util.List;
      | ^~~~~~
main.c:4:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    4 | import java.util.List;
      |            ^
main.c:5:1: error: unknown type name 'import'
    5 | import java.util.Iterator;
      | ^~~~~~
main.c:5:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    5 | import java.util.Iterator;
      |            ^
main.c:6:1: error: unknown type name 'import'
    6 | import java.util.Collections;
      | ^~~~~~
main.c:6:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    6 | import java.util.Collections;
      |            ^
main.c:7:1: error: unknown type name 'import'
    7 | import java.util.Comparator;
      | ^~~~~~
main.c:7:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    7 | import java.util.Comparator;
      |            ^
main.c:8:1: error: unknown type name 'import'
    8 | import java.util.Random;
      | ^~~~~~
main.c:8:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    8 | import java.util.Random;
      |            ^
main.c:9:1: error: unknown type name 'import'
    9 | import java.util.Map;
      | ^~~~~~
main.c:9:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    9 | import java.util.Map;
      |            ^
main.c:10:1: error: unknown type name 'import'
   10 | import java.util.HashMap;
      | ^~~~~~
main.c:10:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
   10 | import java.util.HashMap;
      |            ^
main.c:12:1: error: unknown type name 'class'
   12 | class Main{
      | ^~~~~
main.c:12:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   12 | class Main{
      |           ^