criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, b, n) for (int i = b; i <= n; ++i)

using namespace std;

// global
unordered_map<long, bool> is_prime{{1,false}};
long max_n(0);

bool isPrime(long x) {
  // already found primes
  if (is_prime.count(x))
    return is_prime[x];

  FOR(i, 2, floor(sqrt(x))) {
    if (x % i == 0) {
      is_prime[x] = false;
      return false;
    }
  }
  is_prime[x] = true;
  return true;
}

void solve(long Q, vector<long> l, vector<long> r) {
  REP(i, Q) {
    long ans = 0;
    for(long x = l[i]; x <= r[i]; x+= 2)
      if (isPrime(x) && isPrime((x + 1) / 2))
	ans++;
    }
    cout << ans << endl;
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  long Q;
  cin >> Q;
  vector<long> l(Q);
  vector<long> r(Q);
  REP(i, Q)
    cin >> l[i] >> r[i];

  solve(Q, move(l), move(r));

  return 0;
}


Compiler output:
a.cc: In function 'void solve(long int, std::vector<long int>, std::vector<long int>)':
a.cc:33:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   33 |     cout << ans << endl;
      |             ^~~
      |             abs
a.cc: At global scope:
a.cc:35:1: error: expected declaration before '}' token
   35 | }
      | ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  int max=100001;
  vector<int> a(max,1);
  a[0]=0;
  a[1]=0;
  for(int i=2;i<max;i++){
    for(int j=i*2;j<max;j+=i) a[j]=0;
  }
  vector<int> a(max,0);
  for(int i=0;i<max;i++){
    if(a[i]==1&&a[(i+1)/2]) a[i]=1;
  }
  
  vector<int> s(max+1,0);
  for(int i=0;i<max;i++) s[i+1]=s[i]+a[i];
  
  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    int l,r;
    cin>>l>>r;
    r++;
    cout<<s[r]-s[l]<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: redeclaration of 'std::vector<int> a'
   12 |   vector<int> a(max,0);
      |               ^
a.cc:6:15: note: 'std::vector<int> a' previously declared here
    6 |   vector<int> a(max,1);
      |               ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  int max=101010;
  vector<int> a(max,1);
  a[0]=0;
  a[1]=0;
  for(int i=2;i<max;++i){
    for(int j=i*2;j<max;j+=i) a[j]=0;
  }
  vector<int> a(max,0);
  for(int i=0;i<max;i++){
    if(a[i]==1&&a[(i+1)/2]) a[i]=1;
  }
  
  vector<int> s(max+1,0);
  for(int i=0;i<max;i++) s[i+1]=a[i]+s[i];
  
  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    int l,r;
    cin>>l>>r;
    r++;
    cout<<s[r]-s[l]<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: redeclaration of 'std::vector<int> a'
   12 |   vector<int> a(max,0);
      |               ^
a.cc:6:15: note: 'std::vector<int> a' previously declared here
    6 |   vector<int> a(max,1);
      |               ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  int max=101010;
  vector<int> a(max,1)
  a[0]=0;
  a[1]=0;
  for(int i=2;i<max;++i){
    for(int j=i*2;j<max;j+=i) a[j]=0;
  }
  vector<int> a(max,0);
  for(int i=0;i<max;i++){
    if(a[i]==1&&a[(i+1)/2]) a[i]=1;
  }
  
  vector<int> s(max+1,0);
  for(int i=0;i<max;i++) s[i+1]=a[i]+s[i];
  
  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    int l,r;
    cin>>l>>r;
    r++;
    cout<<s[r]-s[l]<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected ',' or ';' before 'a'
    7 |   a[0]=0;
      |   ^
a.cc:12:15: error: redeclaration of 'std::vector<int> a'
   12 |   vector<int> a(max,0);
      |               ^
a.cc:6:15: note: 'std::vector<int> a' previously declared here
    6 |   vector<int> a(max,1)
      |               ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
 
int main() {
    // エラトステネスのふるい
    int MAX = 101010;
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (int i = 2; i<MAX; i++) {
        if (!is_prime[i]) continue;
        for (int j = i*2; j < MAX; j += i) is_prime[j] = 0;
    }
    
    // 2017likeかどうか
    vector<int> a(MAX, 0);
    for (int i = 0; i < MAX; i++) {
        if (i%2 == 0) continue;
        if (is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
    }
    
    // 累積和
    vector<int> s(MAX, 0);
    for (int i = 0; i < MAX; i++) s[i+1] = s[i] + a[i];
    
    int Q;
    cin >> Q;
    //for (int i = 0; i<Q; i++) {
    REP(i,Q) {
        int l, r;
        cin >> l >> r;
        r++;
        
        cout << s[r] - s[l] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:22: error: 'll' was not declared in this scope
    4 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                      ^~
a.cc:30:5: note: in expansion of macro 'REP'
   30 |     REP(i,Q) {
      |     ^~~
a.cc:30:9: error: 'i' was not declared in this scope
   30 |     REP(i,Q) {
      |         ^
a.cc:4:29: note: in definition of macro 'REP'
    4 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
 
int main() {
    // エラトステネスのふるい
    int MAX = 101010;
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (int i = 2; i<MAX; i++) {
        if (!is_prime[i]) continue;
        for (int j = i*2; j < MAX; j += i) is_prime[j] = 0;
    }
    
    // 2017likeかどうか
    vector<int> a(MAX, 0);
    for (int i = 0; i < MAX; i++) {
        if (i%2 == 0) continue;
        if (is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
    }
    
    // 累積和
    vector<int> s(MAX, 0);
    for (int i = 0; i < MAX; i++) s[i+1] = s[i] + a[i];
    
    int Q;
    cin >> Q;
    //for (int i = 0; i<Q; i++) {
    REP(i,Q) {}
        int l, r;
        cin >> l >> r;
        r++;
        
        cout << s[r] - s[l] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:22: error: 'll' was not declared in this scope
    4 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                      ^~
a.cc:30:5: note: in expansion of macro 'REP'
   30 |     REP(i,Q) {}
      |     ^~~
a.cc:30:9: error: 'i' was not declared in this scope
   30 |     REP(i,Q) {}
      |         ^
a.cc:4:29: note: in definition of macro 'REP'
    4 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
a.cc: At global scope:
a.cc:37:1: error: expected declaration before '}' token
   37 | }
      | ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)

int main() {
    // エラトステネスのふるい
    int MAX = 101010;
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (int i = 2; i<MAX; i++) {
        if (!is_prime[i]) continue;
        for (int j = i*2; j < MAX; j += i) is_prime[j] = 0;
    }
    
    // 2017likeかどうか
    vector<int> a(MAX, 0);
    for (int i = 0; i < MAX; i++) {
        if (i%2 == 0) continue;
        if (is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
    }
    
    // 累積和
    vector<int> s(MAX, 0);
    for (int i = 0; i < MAX; i++) s[i+1] = s[i] + a[i];
    
    int Q;
    cin >> Q;
    REP(i,Q) {
        int l, r;
        cin >> l >> r;
        r++;
        
        cout << s[r] - s[l] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:22: error: 'll' was not declared in this scope
    4 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                      ^~
a.cc:29:5: note: in expansion of macro 'REP'
   29 |     REP(i,Q) {
      |     ^~~
a.cc:29:9: error: 'i' was not declared in this scope
   29 |     REP(i,Q) {
      |         ^
a.cc:4:29: note: in definition of macro 'REP'
    4 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)

int main() {
    // エラトステネスのふるい
    int MAX = 101010;
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (int i = 2; i<MAX; i++) {
        if (!is_prime[i]) continue;
        for (int j = i*2; j < MAX; j += i) is_prime[j] = 0;
    }
    
    // 2017likeかどうか
    vector<int> a(MAX, 0);
    for (int i = 0; i < MAX; i++) {
        if (i%2 == 0) continue;
        if (is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
    }
    
    // 累積和
    vector<int> s(MAX, 0);
    for (int i = 0; i < MAX; i++) s[i+1] = s[i] + a[i];
    
    int Q, l, r;
    cin >> Q;
    REP(i,Q) {
        cin >> l >> r;
        r++;
        
        cout << s[r] - s[l] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:22: error: 'll' was not declared in this scope; did you mean 'l'?
    4 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                      ^~
a.cc:29:5: note: in expansion of macro 'REP'
   29 |     REP(i,Q) {
      |     ^~~
a.cc:29:9: error: 'i' was not declared in this scope
   29 |     REP(i,Q) {
      |         ^
a.cc:4:29: note: in definition of macro 'REP'
    4 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)

int Q, l, r;
int MAX = 101010;

int main() {
    // エラトステネスのふるい
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (int i = 2; i<MAX; i++) {
        if (!is_prime[i]) continue;
        for (int j = i*2; j < MAX; j += i) is_prime[j] = 0;
    }
    
    // 2017likeかどうか
    vector<int> a(MAX, 0);
    for (int i = 0; i < MAX; i++) {
        if (i%2 == 0) continue;
        if (is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
    }
    
    // 累積和
    vector<int> s(MAX, 0);
    for (int i = 0; i < MAX; i++) s[i+1] = s[i] + a[i];
    
    cin >> Q;
    REP(i,Q) {
        cin >> l >> r;
        r++;
        
        cout << s[r] - s[l] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:22: error: 'll' was not declared in this scope; did you mean 'l'?
    4 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                      ^~
a.cc:30:5: note: in expansion of macro 'REP'
   30 |     REP(i,Q) {
      |     ^~~
a.cc:30:9: error: 'i' was not declared in this scope
   30 |     REP(i,Q) {
      |         ^
a.cc:4:29: note: in definition of macro 'REP'
    4 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
Language: C++

#include <iostream>
#include <iomanip>
#include <algorithm>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)
ios::sync_with_stdio(false);
cin.tie(nullptr);

int main()
{
    int q;
    cin >> q;
    bool prime[100001] = {false};
    int sum[100002] = {0};
    repi(i, 100000 + 1, 2)
    {
        if (!prime[i])
        {
            for (int j = i + i; j <= 100000; j += i)
            {
                prime[j] = true;
            }
        }
    }
    for (int i = 3; i <= 100000; i += 2)
    {
        if (!prime[i] && !prime[(i + 1) / 2])
            sum[i]++;
    }
    repi(i, 100000 + 1, 3)
    {
        sum[i + 1] += sum[i];
    }
    repi(ri, q, 0)
    {
        int r,l;
        cin >> l >> r;
        cout << sum[r] - sum[l - 1] << endl;
    }

    return 0;
}


Compiler output:
a.cc:9:1: error: specializing member 'std::basic_ios<char>::sync_with_stdio' requires 'template<>' syntax
    9 | ios::sync_with_stdio(false);
      | ^~~
a.cc:10:1: error: 'cin' does not name a type
   10 | cin.tie(nullptr);
      | ^~~
Language: C++

# include < cstdio >
bool f [100001];
int c [100002];
int N ,L , R ;
int main ()
{
for ( int i =2; i <=100000; i ++) if (! f [ i ]) for ( int j = i + i ;j <=100000; j += i )
f[ j ]= true ;
for ( int i =3; i <=100000; i +=2) if (! f [ i ]&&! f [( i +1)/2]) c [ i ]++;
for ( int i =3; i <=100000; i ++) c [ i ]+= c [i -1];
scanf ("% d " ,& N );
while (N - -)
{
scanf ("% d % d " ,&L ,& R );
printf ("% d \ n " , c [ R ] - c [L -1]);
}
}


Compiler output:
a.cc:1:11: fatal error:  cstdio : No such file or directory
    1 | # include < cstdio >
      |           ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

const int N = pow(10,5);

vector<bool> isp(N+1, true);

void sieve() {
  isp[0] = false;
  isp[1] = false;
  for (int i=2; pow(i,2)<=N; i++) {
    if (isp[i]) for(int j=2; i*j<=N; j++) isp[i*j] = false;
  }
}

int main() {
  int Q,a,b;
  int counter=0;
  cin>>Q>>a>>b;
　vector<int>vec(100000);
  // N以下の整数に対して素数判定をしてくれます。
  // nが素数ならば isp(n)=true、そうでなければ isp(n)=false
  sieve();
  // ex. 51から80までの素数を出力
  for (int i=0; i<=100000; i++) {if (isp[i]&&isp[(i+1)/2]) vec.at(i)=i;}
  sort(vec.begin(), vec.end());
  for (int i=0; i<Q; i++){
  for (int i=0; i<vec.size(); i++){
  if(a<=vec.(i)&&vec.(i)<=b){
  counter++;}
  }
  cout<<counter<<endl;
  counter=0;
  cin>>a>>b;}

  return 0;
}


Compiler output:
a.cc:22:1: error: extended character 　 is not valid in an identifier
   22 | 　vector<int>vec(100000);
      | ^
a.cc: In function 'int main()':
a.cc:22:1: error: '\U00003000vector' was not declared in this scope
   22 | 　vector<int>vec(100000);
      | ^~~~~~~~
a.cc:22:10: error: expected primary-expression before 'int'
   22 | 　vector<int>vec(100000);
      |          ^~~
a.cc:27:60: error: 'vec' was not declared in this scope
   27 |   for (int i=0; i<=100000; i++) {if (isp[i]&&isp[(i+1)/2]) vec.at(i)=i;}
      |                                                            ^~~
a.cc:28:8: error: 'vec' was not declared in this scope
   28 |   sort(vec.begin(), vec.end());
      |        ^~~
a.cc:28:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   28 |   sort(vec.begin(), vec.end());
      |   ^~~~
      |   sqrt
a.cc:31:13: error: expected unqualified-id before '(' token
   31 |   if(a<=vec.(i)&&vec.(i)<=b){
      |             ^
a.cc:31:22: error: expected unqualified-id before '(' token
   31 |   if(a<=vec.(i)&&vec.(i)<=b){
      |                      ^
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

const int N = pow(10,5);

vector<bool> isp(N+1, true);

void sieve() {
  isp[0] = false;
  isp[1] = false;
  for (int i=2; pow(i,2)<=N; i++) {
    if (isp[i]) for(int j=2; i*j<=N; j++) isp[i*j] = false;
  }
}

int main() {
  int N,a,b;
  int counter=0;
  cin>>N>>a>>b;
　vector<int>vec(N);
  // N以下の整数に対して素数判定をしてくれます。
  // nが素数ならば isp(n)=true、そうでなければ isp(n)=false
  sieve();
  // ex. 51から80までの素数を出力
  for (int i=0; i<=N; i++) {if (isp[i]&&isp[(i+1)/2]) vec.at(i)=i;}
  for (int i=0; i<=N; i++){
  if(a<=vec.(i)&&vec.(i)<=b){
  counter++;
  }
  }

  return 0;
}


Compiler output:
a.cc:22:1: error: extended character 　 is not valid in an identifier
   22 | 　vector<int>vec(N);
      | ^
a.cc: In function 'int main()':
a.cc:22:1: error: '\U00003000vector' was not declared in this scope
   22 | 　vector<int>vec(N);
      | ^~~~~~~~
a.cc:22:10: error: expected primary-expression before 'int'
   22 | 　vector<int>vec(N);
      |          ^~~
a.cc:27:55: error: 'vec' was not declared in this scope
   27 |   for (int i=0; i<=N; i++) {if (isp[i]&&isp[(i+1)/2]) vec.at(i)=i;}
      |                                                       ^~~
a.cc:29:9: error: 'vec' was not declared in this scope
   29 |   if(a<=vec.(i)&&vec.(i)<=b){
      |         ^~~
a.cc:29:13: error: expected unqualified-id before '(' token
   29 |   if(a<=vec.(i)&&vec.(i)<=b){
      |             ^
a.cc:29:22: error: expected unqualified-id before '(' token
   29 |   if(a<=vec.(i)&&vec.(i)<=b){
      |                      ^
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

const int N = pow(10,5);

vector<bool> isp(N+1, true);

void sieve() {
  isp[0] = false;
  isp[1] = false;
  for (int i=2; pow(i,2)<=N; i++) {
    if (isp[i]) for(int j=2; i*j<=N; j++) isp[i*j] = false;
  }
}

int main() {
  int N,a,b;
  int counter=0;
  cin>>N>>a>>b;
　vector<int>vec(N);
  // N以下の整数に対して素数判定をしてくれます。
  // nが素数ならば isp(n)=true、そうでなければ isp(n)=false
  sieve();
  // ex. 51から80までの素数を出力
  for (int i=0; i<=N; i++) {if (isp[i]&&isp[(i+1)/2]) vec.at(i)=i;}
  sort(vec.begin(),vec.end());
  for (int i=0; i<=N; i++){
  if(a<=vec.(i)&&vec.(i)<=b){
  counter++;
  }
  }
  }

  return 0;
}


Compiler output:
a.cc:22:1: error: extended character 　 is not valid in an identifier
   22 | 　vector<int>vec(N);
      | ^
a.cc: In function 'int main()':
a.cc:22:1: error: '\U00003000vector' was not declared in this scope
   22 | 　vector<int>vec(N);
      | ^~~~~~~~
a.cc:22:10: error: expected primary-expression before 'int'
   22 | 　vector<int>vec(N);
      |          ^~~
a.cc:27:55: error: 'vec' was not declared in this scope
   27 |   for (int i=0; i<=N; i++) {if (isp[i]&&isp[(i+1)/2]) vec.at(i)=i;}
      |                                                       ^~~
a.cc:28:8: error: 'vec' was not declared in this scope
   28 |   sort(vec.begin(),vec.end());
      |        ^~~
a.cc:28:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   28 |   sort(vec.begin(),vec.end());
      |   ^~~~
      |   sqrt
a.cc:30:13: error: expected unqualified-id before '(' token
   30 |   if(a<=vec.(i)&&vec.(i)<=b){
      |             ^
a.cc:30:22: error: expected unqualified-id before '(' token
   30 |   if(a<=vec.(i)&&vec.(i)<=b){
      |                      ^
a.cc: At global scope:
a.cc:36:3: error: expected unqualified-id before 'return'
   36 |   return 0;
      |   ^~~~~~
a.cc:37:1: error: expected declaration before '}' token
   37 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

const int N = pow(10,5);

vector<bool> isp(N+1, true);

void sieve() {
  isp[0] = false;
  isp[1] = false;
  for (int i=2; pow(i,2)<=N; i++) {
    if (isp[i]) for(int j=2; i*j<=N; j++) isp[i*j] = false;
  }
}

int main() {
  int N,a,b;
  int counter=0;
  cin>>N>>a>>b;
　vector<int>vec.(N);
  // N以下の整数に対して素数判定をしてくれます。
  // nが素数ならば isp(n)=true、そうでなければ isp(n)=false
  sieve();
  // ex. 51から80までの素数を出力
  for (int i=0; i<=N; i++) {if (isp[i]&&isp[(i+1)/2]) vec.at(i)=i;}
  sort(vec.begin(),vec.end());
  for (int i=0; i<=N; i++){
  if(a<=vec.(i)&&vec.(i)<=b){
  counter++;
  }
  }
  }

  return 0;
}


Compiler output:
a.cc:22:1: error: extended character 　 is not valid in an identifier
   22 | 　vector<int>vec.(N);
      | ^
a.cc: In function 'int main()':
a.cc:22:1: error: '\U00003000vector' was not declared in this scope
   22 | 　vector<int>vec.(N);
      | ^~~~~~~~
a.cc:22:10: error: expected primary-expression before 'int'
   22 | 　vector<int>vec.(N);
      |          ^~~
a.cc:27:55: error: 'vec' was not declared in this scope
   27 |   for (int i=0; i<=N; i++) {if (isp[i]&&isp[(i+1)/2]) vec.at(i)=i;}
      |                                                       ^~~
a.cc:28:8: error: 'vec' was not declared in this scope
   28 |   sort(vec.begin(),vec.end());
      |        ^~~
a.cc:28:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   28 |   sort(vec.begin(),vec.end());
      |   ^~~~
      |   sqrt
a.cc:30:13: error: expected unqualified-id before '(' token
   30 |   if(a<=vec.(i)&&vec.(i)<=b){
      |             ^
a.cc:30:22: error: expected unqualified-id before '(' token
   30 |   if(a<=vec.(i)&&vec.(i)<=b){
      |                      ^
a.cc: At global scope:
a.cc:36:3: error: expected unqualified-id before 'return'
   36 |   return 0;
      |   ^~~~~~
a.cc:37:1: error: expected declaration before '}' token
   37 | }
      | ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  int max=101010;
  vector<int＞is_prime(max,1);
  is_prime[0]=0,is_prime[1]=0;
  for(int i=2;i<max;++i){
    if(!is_prime[i]) continue;
    for(int j=i*2;j<max;j+=i) is_prime[j]=0;
  }
  vector<int> a(max,0);
  for(int i=0;i<max;++i){
    if(i%2==0) continue;
    if(is_prime[i]&&is_prime[(i+1)/2]) a[i]=1;
  }
  vector<int>s(max+1,0);
  for(int i=0;i<max;++i) s[i+1]=s[i]+a[i];
  int q;
  cin>>q;
  for(int s=0;s<q;++s){
    int l,r;
    cin>>l>>r;
    ++r;
    cout<<s[r]-s[l]<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:10: error: 'int\U0000ff1eis_prime' was not declared in this scope
    6 |   vector<int＞is_prime(max,1);
      |          ^~~~~~~~~~~~~
a.cc:6:29: error: template argument 1 is invalid
    6 |   vector<int＞is_prime(max,1);
      |                             ^
a.cc:6:29: error: template argument 2 is invalid
a.cc:7:3: error: 'is_prime' was not declared in this scope
    7 |   is_prime[0]=0,is_prime[1]=0;
      |   ^~~~~~~~
a.cc:25:12: error: invalid types 'int[int]' for array subscript
   25 |     cout<<s[r]-s[l]<endl;
      |            ^
a.cc:25:17: error: invalid types 'int[int]' for array subscript
   25 |     cout<<s[r]-s[l]<endl;
      |                 ^
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Answer {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        boolean[] isPrime = makePrimes(100000);
        boolean[] isLike2017 = new boolean[100001];
        for (int i = 0; i <= 100000; i++) {
            isLike2017[i] = isPrime[i] && isPrime[(i + 1) / 2];
        }

        int[] sum = new int[100002];
        sum[0] = 0;
        for (int i = 0; i <= 100000; i++) {
            sum[i + 1] = sum[i];
            if (isLike2017[i]) {
                sum[i + 1]++;
            }
        }

        for (int i = 0; i < n; i++) {
            int l = in.nextInt();
            int r = in.nextInt();
            System.out.println(sum[r + 1] - sum[l]);
        }
    }

    private static boolean[] makePrimes(int n) {
        boolean[] isPrime = new boolean[n + 1];
        Arrays.fill(isPrime, false);
        for (int i = 0; i < n; i++) {
            isPrime[i] = true;
        }
        isPrime[0] = false;
        isPrime[1] = false;
        for (int i = 2; i <= n; i++) {
            for (int j = i * 2; j <= n; j += i) {
                isPrime[j] = false;
            }
        }

        return isPrime;
    }
}


Compiler output:
Main.java:4: error: class Answer is public, should be declared in a file named Answer.java
public class Answer {
       ^
1 error
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int A[100001]={1}, S[100002]={0};
A[0]=0;
A[1]=0;

void processA(){
    for(int i=2;i<=100000;i++){
        if(!A[i]) continue;
        for(int j=2*i;j<=100000;j+=i) A[j]=0;
    }
}

int main(){
    int q, l, r;
    processA();
    for(int i=2;i<=100000;i++){
        if(A[i]&&A[(1+i)/2]) S[i+1]=S[i]+1;
    }
    for(int i=0;i<q;i++){
        cin >> l >> r;
        r++;
        cout << S[r]-S[l] << endl;
    }

    return 0;

}

Compiler output:
a.cc:6:1: error: 'A' does not name a type
    6 | A[0]=0;
      | ^
a.cc:7:1: error: 'A' does not name a type
    7 | A[1]=0;
      | ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int A[100001]={1}, S[100002]={0};
A[0]=0;
A[1]=0;

void processA(){
    for(int i=2;i<=100000;i++){
        if(!A[i]) continue;
        for(int j=2*i;j<=100000;j+=i) A[j]=0;
    }
}

int main(){
    int q;
    processA();
    for(int i=2;i<=100000;i++){
        if(A[i]&&A[(1+i)/2]) S[i+1]=S[i]+1;
    }
    for(int i=0;i<q;i++){
        cin >> l >> r;
        r++;
        cout << S[r]-S[l] << endl;
    }

    return 0;

}

Compiler output:
a.cc:6:1: error: 'A' does not name a type
    6 | A[0]=0;
      | ^
a.cc:7:1: error: 'A' does not name a type
    7 | A[1]=0;
      | ^
a.cc: In function 'int main()':
a.cc:23:16: error: 'l' was not declared in this scope
   23 |         cin >> l >> r;
      |                ^
a.cc:23:21: error: 'r' was not declared in this scope
   23 |         cin >> l >> r;
      |                     ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll=long long;

int main() {
	int max=101010;
	
	//素数なら1の配列準備
	vector<int> prime(max);
	for(int i=2;i<max;i++)prime[i]=1;
	for(int i=2;i<max;i++){
		if(prime[i]==1){
			for(int j=i*2;j<max;j+=i)prime[j]=0;
		}
	}
	
	//like2017なら1の配列を準備
	vector<int> like(max);
	for(int i=3;i<max;i+=2){
		if(prime[i]==1&&prime[(i+1)/2]==1)like[i]=1;
	}
	
	//累積和
	vector<int> s(max+1,0);
	for(int i=0;i<max;i++)s[i+1]=s[i]+like[i];
	
	int q;
	cin>>q;
	for(int i=1;i<=q;i++){
		cin>>l>>r;
		int l,r;
		l--;
		r--;
		
		cout<<s[r+1]-s[l]<<endl;
	}
	
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:22: error: 'l' was not declared in this scope
   31 |                 cin>>l>>r;
      |                      ^
a.cc:31:25: error: 'r' was not declared in this scope
   31 |                 cin>>l>>r;
      |                         ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll=long long;

int main() {
	int max=101010;
	
	//素数なら1の配列準備
	vector<int> prime(max);
	for(int i=2;i<max;i++)prime[i]=1;
	for(int i=2;i<max;i++){
		if(prime[i]==1){
			for(int j=i*2;j<max;j+=i)prime[j]=0;
		}
	}
	
	//like2017なら1の配列を準備
	vector<int> like(max);
	for(int i=3;i<max;i+=2){
		if(prime[i]==1&&prime[(i+1)/2]==1)like[i]=1;
	}
	
	//累積和
	vector<int> s(max+1,0);
	for(int =0;i<max;i++)s[i+1]=s[i]+like[i];
	
	int q;
	cin>>q;
	for(int i=1;i<=q;i++){
		int l,r;
		l--;
		r--;
		
		cout<<s[r+1]-s[l]<,endl;
	}
	
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: expected unqualified-id before '=' token
   26 |         for(int =0;i<max;i++)s[i+1]=s[i]+like[i];
      |                 ^
a.cc:26:16: error: expected ';' before '=' token
   26 |         for(int =0;i<max;i++)s[i+1]=s[i]+like[i];
      |                ^~
      |                ;
a.cc:26:17: error: expected primary-expression before '=' token
   26 |         for(int =0;i<max;i++)s[i+1]=s[i]+like[i];
      |                 ^
a.cc:26:20: error: 'i' was not declared in this scope
   26 |         for(int =0;i<max;i++)s[i+1]=s[i]+like[i];
      |                    ^
a.cc:26:25: error: expected ')' before ';' token
   26 |         for(int =0;i<max;i++)s[i+1]=s[i]+like[i];
      |            ~            ^
      |                         )
a.cc:26:26: error: 'i' was not declared in this scope
   26 |         for(int =0;i<max;i++)s[i+1]=s[i]+like[i];
      |                          ^
a.cc:35:35: error: expected primary-expression before ',' token
   35 |                 cout<<s[r+1]-s[l]<,endl;
      |                                   ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll=long long;

int main() {
	int max=101010
	
	//素数なら1の配列準備
	vector<int> prime(max);
	for(int i=2;i<max;i++)prime[i]=1;
	for(int i=2;i<max;i++){
		if(prime[i]==1){
			for(int j=i*2;j<max;j+=i)prime[j]=0;
		}
	}
	
	//like2017なら1の配列を準備
	vector<int> like(max);
	for(int i=3;i<max;i+=2){
		if(prime[i]==1&&prime[(i+1)/2]==1)like[i]=1;
	}
	
	//累積和
	vector<int> s(max+1,0);
	for(int =0;i<max;i++)s[i+1]=s[i]+like[i];
	
	int q;
	cin>>q;
	rep(i,q){
		int l,r;
		l--;
		r--;
		
		cout<<s[r+1]-s[l]<,endl;
	}
	
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: expected ',' or ';' before 'vector'
   10 |         vector<int> prime(max);
      |         ^~~~~~
a.cc:11:31: error: 'prime' was not declared in this scope
   11 |         for(int i=2;i<max;i++)prime[i]=1;
      |                               ^~~~~
a.cc:13:20: error: 'prime' was not declared in this scope
   13 |                 if(prime[i]==1){
      |                    ^~~~~
a.cc:21:20: error: 'prime' was not declared in this scope
   21 |                 if(prime[i]==1&&prime[(i+1)/2]==1)like[i]=1;
      |                    ^~~~~
a.cc:26:17: error: expected unqualified-id before '=' token
   26 |         for(int =0;i<max;i++)s[i+1]=s[i]+like[i];
      |                 ^
a.cc:26:16: error: expected ';' before '=' token
   26 |         for(int =0;i<max;i++)s[i+1]=s[i]+like[i];
      |                ^~
      |                ;
a.cc:26:17: error: expected primary-expression before '=' token
   26 |         for(int =0;i<max;i++)s[i+1]=s[i]+like[i];
      |                 ^
a.cc:26:20: error: 'i' was not declared in this scope
   26 |         for(int =0;i<max;i++)s[i+1]=s[i]+like[i];
      |                    ^
a.cc:26:25: error: expected ')' before ';' token
   26 |         for(int =0;i<max;i++)s[i+1]=s[i]+like[i];
      |            ~            ^
      |                         )
a.cc:26:26: error: 'i' was not declared in this scope
   26 |         for(int =0;i<max;i++)s[i+1]=s[i]+like[i];
      |                          ^
a.cc:35:35: error: expected primary-expression before ',' token
   35 |                 cout<<s[r+1]-s[l]<,endl;
      |                                   ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;

vector<bool> make_primes(int n) {
	vector<bool> is_prime(n, true);
	is_prime[0] = false;
	is_prime[1] = false;
	for (int i = 2; i < n; ++i) {
		for (int j = i * 2; j < n; j += i) {
			is_prime[j] = false;
		}
	}
	return is_prime;
}

bool is_like_2017[100001];
int sum[100002];

int main() {
	int n;
	cin >> n;

	vector<bool> is_prime = make_primes(n);

	for (int i = 0; i <= 100000; ++i) {
		is_like_2017[i] = is_prime[i] && is_prime[(i + 1) / 2];
	}

	sum[0] = 0;
	for (int i = 0; i <= 100000; ++i) {
		sum[i + 1] = sum[i];
		if (is_like_2017[i]) {
			sum[i + 1]++;
		}
	}

	for (int i = 0; i < n;  ++i) {
		int l, r;
		cin >> l >> r;

		cout << sum[r + 1] - sum[l] << endl;
	}

	cout << res << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:17: error: 'res' was not declared in this scope
   45 |         cout << res << endl;
      |                 ^~~
Language: C++

#include <iostream>
using namespace std;

vector<bool> make_primes(int n) {
	vector<bool> is_prime(n, true);
	is_prime[0] = false;
	is_prime[1] = false;
	for (int i = 2; i < n; ++i) {
		for (int j = i * 2; j < n; j += i) {
			is_prime[j] = false;
		}
	}
	return is_prime;
}

bool is_like_2017[100001];
int sum[100002];

int main() {
	int n;
	cin >> n;

	vector<bool> is_prime = make_primes(n);

	for (int i = 0; i <= 100000; ++i) {
		is_like_2017[i] = is_prime[i] && is_prime[(i + 1) / 2];
	}

	sum[0] = 0;
	for (int i = 0; i <= 100000; ++i) {
		sum[i + 1] = sum[i];
		if (is_like_2017[i]) {
			sum[i + 1]++;
		}
	}

	for (int i = 0; i < n;  ++i) {
		int l, r;
		cin >> l >> r;

		cout << sum[r + 1] - sum[l] << endl;
	}

	cout << res << endl;

	return 0;
}

Compiler output:
a.cc:4:1: error: 'vector' does not name a type
    4 | vector<bool> make_primes(int n) {
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:23:9: error: 'vector' was not declared in this scope
   23 |         vector<bool> is_prime = make_primes(n);
      |         ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:23:16: error: expected primary-expression before 'bool'
   23 |         vector<bool> is_prime = make_primes(n);
      |                ^~~~
a.cc:26:35: error: 'is_prime' was not declared in this scope
   26 |                 is_like_2017[i] = is_prime[i] && is_prime[(i + 1) / 2];
      |                                   ^~~~~~~~
a.cc:44:17: error: 'res' was not declared in this scope
   44 |         cout << res << endl;
      |                 ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

bool isp(int n) {
  if (n < 2) return false;
  else if (n == 2) return true;
  else if (n % 2 == 0) return false;
  for (int i = 3; i <= (int)sqrt(n); i += 2) if (n % i == 0) return false;
  return true;
}

int main() {
  int N = 1e5 + 1
  vector<int> V(N);
  for (int i = 1, cnt = 0; i < N; i++) {
    if (!((i + 1) % 2) && isp(i) && isp((i + 1) / 2)) cnt++;
    V.at(i) = cnt;
  }
  int Q;
  cin >> Q;
  for (int l, r; cin >> l >> r;) cout << V.at(r) - V.at(l - 1) << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: expected ',' or ';' before 'vector'
   14 |   vector<int> V(N);
      |   ^~~~~~
a.cc:17:5: error: 'V' was not declared in this scope
   17 |     V.at(i) = cnt;
      |     ^
a.cc:21:42: error: 'V' was not declared in this scope
   21 |   for (int l, r; cin >> l >> r;) cout << V.at(r) - V.at(l - 1) << "\n";
      |                                          ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll=long long;

//エラトステネスでqのmaxまでの素数をbitsetにぶちこみ
bitset<101010> is_prime(0);

void eratos(){
int max=101010;
for(int i=2;i<=max;i++)is_prime.set(i);
for(int i=2;i<=max;i++){
	if(is_prime[i]){
		for(int j=i*2;j<=max;j+=i)is_prime.reset(j);	
	}
}
}


//2017数判定おｋなら1
int is_2017(int x){
	int x1,x2;
	x1=x+1;//bit配列のインデックスに
	x2=(x+1)/2+1;
	
	if(is_prime.test(x1)&&is_prime.test(x2))return 1;
	else return 0;
	
}

//Qがデカいので正攻法だとTLE
int main() {
	int q;
	cin>>q;
	
	eratos();
	
	vector<int> s(101010);
	int count=0; 
	for(int i=3;i<max;i+=2){
		if(is_prime.test(i))count++;
		s[i]=count;
	}
	
	rep(i,q){
		int l,r;
		cin>>l>>r;
		if(is_2017(l))cout<<s[r]-s[l]+1<<endl;
		else cout<<s[r]-s[l];
	}
	
	
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:22: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<'
   40 |         for(int i=3;i<max;i+=2){
      |                     ~^~~~
Language: C++

#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
  int Q,l,r,cnt=0;
  int x=1;
  cin>>Q;
  vector<int> S(Q);
  	for(int i=0;i<Q;i++){
      cin>>l>>r;
      if(l==1){
        l=3;
      }
      if(r==1){
        r=3;
      }
  	  for(int j=l;j<=r;j++){
        for(int k=2;k<=sqrt((j+1)/2);k++){
          if(((j+1)/2)%k==0){
          x*=0;
          break;
          }
        }
		
        for(int k=2;k<=sqrt(j);k++){
          if(x==0){
          break;
        }
          if(j%k==0){
          x*=0;
          break;
          }
        }
        }
        if(x==1){
          cnt++;
        }
        x=1;
        
      }
      S.at(i)=cnt;
      cnt=0;
    }
      
      for(int i=0;i<Q;i++){
        cout<<S.at(i)<<endl;
      }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:12: error: 'i' was not declared in this scope
   41 |       S.at(i)=cnt;
      |            ^
a.cc: At global scope:
a.cc:45:7: error: expected unqualified-id before 'for'
   45 |       for(int i=0;i<Q;i++){
      |       ^~~
a.cc:45:19: error: 'i' does not name a type
   45 |       for(int i=0;i<Q;i++){
      |                   ^
a.cc:45:23: error: 'i' does not name a type
   45 |       for(int i=0;i<Q;i++){
      |                       ^
a.cc:48:1: error: expected declaration before '}' token
   48 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
  int Q,l,r,cnt=0;
  int x=1;
  cin>>Q;
  vector<int> S(Q);
  	for(int i=0;i<Q;i++){
      cin>>l>>r;
      if(l==1){
        l=3;
      }
      if(r==1){
        r=3;
      }
  	  for(int j=l;j<=r;j++){
        for(int k=2;k<=sqrt((j+1)/2);k++){
          if(((j+1)/2)%k==0){
          x*=0;
          break;
          }
        }
		if(x==0){
          break;
        }
        for(int k=2;k<=sqrt(j);k++){
          if(j%k==0){
          x*=0;
          break;
          }
        }
        }
        if(x==1){
          cnt++;
        }
        x=1;
        
      }
      S.at(i)=cnt;
      cnt=0;
    }
      
      for(int i=0;i<Q;i++){
        cout<<S.at(i)<<endl;
      }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:12: error: 'i' was not declared in this scope
   40 |       S.at(i)=cnt;
      |            ^
a.cc: At global scope:
a.cc:44:7: error: expected unqualified-id before 'for'
   44 |       for(int i=0;i<Q;i++){
      |       ^~~
a.cc:44:19: error: 'i' does not name a type
   44 |       for(int i=0;i<Q;i++){
      |                   ^
a.cc:44:23: error: 'i' does not name a type
   44 |       for(int i=0;i<Q;i++){
      |                       ^
a.cc:47:1: error: expected declaration before '}' token
   47 | }
      | ^
Language: C++

import java.util.Scanner;

public class Main {

	boolean isprime[] = new boolean[100001];
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Main main =new Main();
		main.sieve();
		int primeCount[]=new int[100001];
		int count =0;
		for(int i=0;i<=100000;i++) {
			if(main.isprime[i]==true&&main.isprime[(i+1)/2]==true) {
				count ++;
			}
			primeCount[i] =count;
		}
		int Q= sc.nextInt();
		for (int i=0;i<Q;i++) {
			int l= sc.nextInt();
			int r =sc.nextInt();
			if (l==r) {
				if (main.isprime[i]==true&&main.isprime[(i+1)/2]==true) {
					System.out.println(1);
				} else {
					System.out.println(0);
				}
			} else {
				System.out.println(primeCount[r]-primeCount[l]);
			}
		}
	}

	public void  sieve() {
		for (int i=0;i<=100000;i++) {
			isprime[i]=true;
		}
		isprime[0] =false;
		isprime[1] =false;
		for (int i=2;i<=100000;i++) {
			if (isprime[i]==true) {
				for(int j=2*i;j<=100000;j+=i) {
					isprime[j] =false;
				}
			}
		}
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

open System

// prelude
let readStr () = stdin.ReadLine()

let readInt () = stdin.ReadLine() |> int
let readInts () = stdin.ReadLine().Split() |> Array.map int

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

// start
  
let N=101010
let isPrime =
  let primes=Array.create N true
  primes.[0] <- false
  primes.[1] <- false
  for p in 0..(N-1) do
    if primes.[p] then do
      let rec go i =
        if i>=N then ()
        else
          primes.[i]<-false
          go (i+p)
      go (2*p)
  Array.get primes

let like2017sum=
  let s=Array.init N (fun n -> if n%2=1&&isPrime n && isPrime ((n+1)/2) then 1 else 0)
  for i in 1..(N-1) do
    Array.modify s i ((+) s.[i-1])
  fun l r -> s.[r]-s.[l-1]

let Q=readInt()
for _ in 1..Q do
  let (l,r) = readInts() |> pair
  like2017sum l r
  |> printfn "%d"

Compiler output:
a.cc:43:12: error: too many decimal points in number
   43 |   for p in 0..(N-1) do
      |            ^~~
a.cc:55:12: error: too many decimal points in number
   55 |   for i in 1..(N-1) do
      |            ^~~
a.cc:60:10: error: too many decimal points in number
   60 | for _ in 1..Q do
      |          ^~~~
a.cc:1:1: error: 'open' does not name a type
    1 | open System
      | ^~~~
a.cc:10:8: error: 'b' does not name a type
   10 | | [|a; b|] -> (a, b)
      |        ^
a.cc:14:8: error: 'b' does not name a type
   14 | | [|a; b; c|] -> (a, b, c)
      |        ^
a.cc:14:11: error: 'c' does not name a type
   14 | | [|a; b; c|] -> (a, b, c)
      |           ^
Language: C++

n = 10**5
a = [0 for i in range(n+1)]

is_prime = [1 for i in range(n+1)]
is_prime[0], is_prime[1] = 0, 0

#エラトステネスの篩
for i in range(2, n+1):
    if (not is_prime[i]):
        continue
    for j in range(i*2, n+1, i):
        is_prime[j] = 0

for i in range(2, n+1):
    if i % 2 == 0:
        continue
    if is_prime[i] and is_prime[int((i+1)/2)]:
        a[i] = 1

s = [0 for i in range(n+1)]
for i in range(n):
    s[i+1] = s[i] + a[i]

Q = int(input())
for i in range(Q):
    l, r = map(int, input().split())
    print(s[r+1]-s[l])

Compiler output:
a.cc:7:2: error: invalid preprocessing directive #\U000030a8\U000030e9\U000030c8\U000030b9\U000030c6\U000030cd\U000030b9\U0000306e\U00007be9
    7 | #エラトステネスの篩
      |  ^~~~~~~~~~~~~~~~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n = 10**5
      | ^
Language: Java

package _2017_like_number;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        boolean isPrime[] = new boolean[100001];
        for (int i = 0; i <= 100000; i++) {
            isPrime[i] = true;
        }
        isPrime[0] = false;
        isPrime[1] = false;
        for (long i = 2; i <= 100000; i++) {
            for (long j = i * 2; j <= 100000; j += i) {
                isPrime[(int) j] = false;
            }
        }

        boolean isLike2017[] = new boolean[100001];
        for (int i = 0; i <= 100000; i++) {
            isLike2017[i] = isPrime[i] && isPrime[(i + 1) / 2];
        }
        int sum[] = new int[100002];
        sum[0] = 0;
        for (int i = 0; i <= 100000; i++) {
            sum[i + 1] = sum[i];
            if (isLike2017[i]) {
                sum[i + 1]++;
            }
        }

        for (int i = 0; i <= 40; i++) {
            System.out.print(sum[100000-i]);
            System.out.print(" ");
        }
        System.out.println();
        int n = in.nextInt();
        for (int i = 0; i < n; i++) {
            int l = in.nextInt();
            int r = in.nextInt();
            System.out.println(sum[r + 1] - sum[l]);
        }
    }
}


Compiler output:
Main.java:5: error: cannot find symbol
        Scanner in = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
        Scanner in = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        boolean isPrime[] = new boolean[100001];
        for (int i = 0; i <= 100000; i++) {
            isPrime[i] = true;
        }
        isPrime[0] = false;
        isPrime[1] = false;
        for (long i = 2; i <= 1000; i++) {
            for (long j = i * 2; i * j <= 100000; j += i) {
                isPrime[j] = false;
            }
        }

        int n = in.nextInt();
        boolean isLike2017[] = new boolean[100001];
        for (int i = 0; i <= 100000; i++) {
            isLike2017[i] = isPrime[i] && (i % 2 > 0) && isPrime[(i + 1) / 2];
        }
        int sum[] = new int[100002];
        sum[0] = 0;
        for (int i = 0; i <= 100000; i++) {
            sum[i + 1] = sum[i];
            if (isLike2017[i]) {
                sum[i + 1]++;
            }
        }
        for (int i = 0; i < n; i++) {
            int l = in.nextInt();
            int r = in.nextInt();
            System.out.println(sum[r + 1] - sum[l]);
        }
    }
}


Compiler output:
Main.java:14: error: incompatible types: possible lossy conversion from long to int
                isPrime[j] = false;
                        ^
1 error
Language: C++

#include <iostream>
#include <vector>
using namespace std;
template<class T> inline void chmax(T& a, T b) { 
    if (a < b) a = b;
}
const int INF = 1<<29;
int dp[100];
bitset<100000> is_prime(0);
int era(int n){
    
    bitset<100000> is_prime(0);
    for(int i=2; i<=n; i++) is_prime.set(i);
    for(int i=2; i<=n; i++){
        if(is_prime[i]){
            for(int j=i*2; j<=n; j+=i){
                is_prime.reset(j);
            }
        }
        //cout << is_prime[i] << endl;
    }
    int a[n],s[n];
    for(int i=0; i<=n; i++) a[i] = 0, s[i]=0;
    for(int i=0; i<=n; i++){
        if(i%2 == 0) continue;
        if (is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
        //cout << a[i] << endl;
    }  
    for(int i=0; i<n; i++){
        //cout << a[i] << endl;
        s[i+1] = s[i] + a[i];
    }
    return s[n];
}

int main(){
    int Q; cin >> Q;
    int l[Q], r[Q];
    for(int i=0; i<Q; i++){
        cin >> l[i] >> r[i];
        r[i]++;
    } 

    for(int i=0; i<Q; i++){
        cout << era(r[i]) - era(l[i]) << endl;
    }
    //cout << era(5) << endl;

}

Compiler output:
a.cc:9:1: error: 'bitset' does not name a type
    9 | bitset<100000> is_prime(0);
      | ^~~~~~
a.cc: In function 'int era(int)':
a.cc:12:5: error: 'bitset' was not declared in this scope
   12 |     bitset<100000> is_prime(0);
      |     ^~~~~~
a.cc:3:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
    2 | #include <vector>
  +++ |+#include <bitset>
    3 | using namespace std;
a.cc:12:20: error: 'is_prime' was not declared in this scope
   12 |     bitset<100000> is_prime(0);
      |                    ^~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
template<class T> inline void chmax(T& a, T b) { 
    if (a < b) a = b;
}
const int INF = 1<<29;
int dp[100];

int era(int n){
    
    bitset<100000> is_prime(0);
    for(int i=2; i<=n; i++) is_prime.set(i);
    for(int i=2; i<=n; i++){
        if(is_prime[i]){
            for(int j=i*2; j<=n; j+=i){
                is_prime.reset(j);
            }
        }
        //cout << is_prime[i] << endl;
    }
    int a[n],s[n];
    for(int i=0; i<=n; i++) a[i] = 0, s[i]=0;
    for(int i=0; i<=n; i++){
        if(i%2 == 0) continue;
        if (is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
        //cout << a[i] << endl;
    }  
    for(int i=0; i<n; i++){
        //cout << a[i] << endl;
        s[i+1] = s[i] + a[i];
    }
    return s[n];
}

int main(){
    int Q; cin >> Q;
    int l[Q], r[Q];
    for(int i=0; i<Q; i++){
        cin >> l[i] >> r[i];
        r[i]++;
    } 

    for(int i=0; i<Q; i++){
        cout << era(r[i]) - era(l[i]) << endl;
    }
    //cout << era(5) << endl;

}

Compiler output:
a.cc: In function 'int era(int)':
a.cc:12:5: error: 'bitset' was not declared in this scope
   12 |     bitset<100000> is_prime(0);
      |     ^~~~~~
a.cc:3:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
    2 | #include <vector>
  +++ |+#include <bitset>
    3 | using namespace std;
a.cc:12:20: error: 'is_prime' was not declared in this scope
   12 |     bitset<100000> is_prime(0);
      |                    ^~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int main(){
  int MAX = 101011;
  vector<int> is_prime(MAX, 1);
  is_prime[0] = 0, is_prime[1] = 0;
  for(int i=2; i<MAX; i++){
    if(!is_prime[i]) continue;
    for(int j=i*2; i<MAX; j += i;) is_prime[j]=0;
  }
  
  vector<int> a(MAX, 0);
  for(int i=0; i<MAX; i++){
    if(i%2 == 0) continue;
    if(is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
  }
  
  vector<int> s(MAX, 0);
  for(int i=0; i<MAX; i++) s[i+1] = s[i] + a[i];
  
  int Q; cin >> Q;
  for(int q=0; q<Q; q++){
    int l, r;
    cin >> l >> r;
    r++;
    
    cout << s[r] - s[l] << endl;
  }
}
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:11:33: error: expected ')' before ';' token
   11 |     for(int j=i*2; i<MAX; j += i;) is_prime[j]=0;
      |        ~                        ^
      |                                 )
a.cc:11:34: error: expected primary-expression before ')' token
   11 |     for(int j=i*2; i<MAX; j += i;) is_prime[j]=0;
      |                                  ^
Language: C++

#自然数m以下の素数を返す
def prime_numbers(m):
    primes = set()
    n = 2
    while n <= m:
        if all(n % i != 0 for i in primes):
            primes.add(n)
        n += 1
    return primes

q = int(input())
l = []
r = []
for i in range(q):
    L,R = map(int,input().split())
    l.append(L)
    r.append(R)

p = prime_numbers(max(r))
cnt = [0 for i in range(max(r)+1)]
for i in p:
    if (i + 1) // 2 in p:
        cnt[i]+=1

for i in range(1,len(cnt)):
    cnt[i]+=cnt[i - 1]

for i in range(q):
    print(cnt[r[i]] - cnt[l[i] - 1])

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #\U000081ea\U00007136\U00006570m\U00004ee5\U00004e0b\U0000306e\U00007d20\U00006570\U00003092\U00008fd4\U00003059
    1 | #自然数m以下の素数を返す
      |  ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:2:1: error: 'def' does not name a type
    2 | def prime_numbers(m):
      | ^~~