Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace D {
    class Program {
        static bool[] IsPrimeNumberTable;
        static int[] L, R;
        static int MaxR;

        static void LoadBoundaries(System.IO.TextReader reader) {
            var Q=int.Parse(reader.ReadLine());
            L = new int[Q]; R = new int[Q];
            for(var i = 0; i != Q; ++i) {
                var query=reader.ReadLine().Split().ToArray();
                L[i] = int.Parse(query[0]);
                R[i] = int.Parse(query[1]);
                if(MaxR < R[i]) MaxR = R[i];
            }
        }

        internal static void MakeIsPrimeNumberTable(int UpLimit) {
            IsPrimeNumberTable = new bool[UpLimit + 1];
            for(var i = 2; i <= UpLimit; ++i) IsPrimeNumberTable[i] = true;
            for(var i = 2; i <= UpLimit; ++i) {
                for(var j = i + i; j <= UpLimit; j += i)
                    IsPrimeNumberTable[j] = false;
            }
        }

        static int Count2017LikeNumbers(int LBound, int UBound) {
            int n = 0;
            for(var i = LBound; i <= UBound; ++i) {
                if(IsPrimeNumberTable[i] && IsPrimeNumberTable[( i + 1 ) / 2]) ++n;
            }
            return n;
        }

        internal static void SolveProblem(System.IO.TextReader reader, System.IO.TextWriter writer) {
            LoadBoundaries(reader);
            MakeIsPrimeNumberTable(MaxR);
            for(int i=0, cnt=L.Count(); i != cnt; ++i) {
                writer.WriteLine(Count2017LikeNumbers(L[i], R[i]));
            }
        }

        static void Main(string[] args) {
            SolveProblem(Console.In, Console.Out);
        }
    }
}


Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Text;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Threading.Tasks;
      |       ^~~~~~
a.cc:10:20: error: expected unqualified-id before '[' token
   10 |         static bool[] IsPrimeNumberTable;
      |                    ^
a.cc:11:19: error: expected unqualified-id before '[' token
   11 |         static int[] L, R;
      |                   ^
a.cc:14:36: error: 'System' has not been declared
   14 |         static void LoadBoundaries(System.IO.TextReader reader) {
      |                                    ^~~~~~
a.cc:14:42: error: expected ',' or '...' before '.' token
   14 |         static void LoadBoundaries(System.IO.TextReader reader) {
      |                                          ^
a.cc:25:9: error: 'internal' does not name a type
   25 |         internal static void MakeIsPrimeNumberTable(int UpLimit) {
      |         ^~~~~~~~
a.cc:42:9: error: 'internal' does not name a type
   42 |         internal static void SolveProblem(System.IO.TextReader reader, System.IO.TextWriter writer) {
      |         ^~~~~~~~
a.cc:50:26: error: 'string' has not been declared
   50 |         static void Main(string[] args) {
      |                          ^~~~~~
a.cc:50:35: error: expected ',' or '...' before 'args'
   50 |         static void Main(string[] args) {
      |                                   ^~~~
a.cc:53:6: error: expected ';' after class definition
   53 |     }
      |      ^
      |      ;
a.cc: In static member function 'static void D::Program::LoadBoundaries(int)':
a.cc:15:13: error: 'var' was not declared in this scope
   15 |             var Q=int.Parse(reader.ReadLine());
      |             ^~~
a.cc:16:13: error: 'L' was not declared in this scope
   16 |             L = new int[Q]; R = new int[Q];
      |             ^
a.cc:16:25: error: 'Q' was not declared in this scope
   16 |             L = new int[Q]; R = new int[Q];
      |                         ^
a.cc:16:29: error: 'R' was not declared in this scope
   16 |             L = new int[Q]; R = new int[Q];
      |                             ^
a.cc:17:21: error: expected ';' before 'i'
   17 |             for(var i = 0; i != Q; ++i) {
      |                     ^
a.cc:17:28: error: 'i' was not declared in this scope
   17 |             for(var i = 0; i != Q; ++i) {
      |                            ^
a.cc:18:21: error: expected ';' before 'query'
   18 |                 var query=reader.ReadLine().Split().ToArray();
      |                     ^~~~~
a.cc:19:24: error: expected primary-expression before 'int'
   19 |                 L[i] = int.Parse(query[0]);
      |                        ^~~
a.cc:20:24: error: expected primary-expression before 'int'
   20 |                 R[i] = int.Parse(query[1]);
      |                        ^~~
a.cc: In static member function 'static int D::Program::Count2017LikeNumbers(int, int)':
a.cc:36:17: error: 'var' was not declared in this scope
   36 |             for(var i = LBound; i <= UBound; ++i) {
      |                 ^~~
a.cc:36:33: error: 'i' was not declared in this scope
   36 |             for(var i = LBound; i <= UBound; ++i) {
      |                                 ^
a.cc:37:20: error: 'IsPrimeNumberTable' was not declared in this scope
   37 |                 if(IsPrimeNumberTable[i] && IsPrimeNumberTable[( i + 1 ) / 2]) ++n;
      |                    ^~~~~~~~~~~~~~~~~~
a.cc: In static member function 'static void D::Program::Main(int*)':
a.cc:51:26: error: 'Console' was not declared in this scope
   51 |             SolveProblem(Console.In, Console.Out);
      |                          ^~~~~~~
a.cc:51:13: error: 'SolveProblem' was not declared in this scope
   51 |             SolveProblem(Console.In, Console.Out);
      |             ^~~~~~~~~~~~