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

//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
//----------------------------------------------------------------------
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;


bool fac(int n) {
    if(n==1)
        return false;
    int a = 2;
    while(n>=a*a) {
        if(n %a == 0) {
            n = n/a;
            return false;
        }else {
            a++;
        }
    }
    return true;
}


int main(void) {
    int n ; cin >> n;
    vector<P> p(n);

    REP(i,n) {
        cin >> p[i].first >> p[i].second;
    }

    REP(i,n) {
        int l, r;
        l = p[i].first;
        r = p[i].second;
        int ans = 0;
        for(int j = l; j <= r; j+=2) {
            if(fac(j)) {
                fac((j+1)/2){
                    ans++;
                }
            }
        }
        cout << ans << endl;;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:29: error: expected ';' before '{' token
   43 |                 fac((j+1)/2){
      |                             ^
      |                             ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int n=1e5+10;
bitset<n> isprime;
vector<int>answer;
void sieve()
{
    isprime[0]=isprime[1]=0;
    for(int p=2; p<=n; ++p)
        if(isprime[p])
            for(int m=2*p; m<n; m+=p)
                isprime[m]=0;

}


int the2017ers[n];
void is2017()
{
    int sum=0;
    for (int p=1; p<=n; p++)
    {
        if(isprime[p]&&isprime[(p+1)/2]){
            sum++
        }
        //sum+=(isprime[p]&&isprime[(p+1)/2]);
        the2017ers[p]=sum;

    }

}

int main()
{

    isprime.set();
    sieve();
    is2017();
    int tc,l,r;
    cin>>tc;
    while(tc--)
    {
        cin>>l>>r;
        cout<<the2017ers[r]-the2017ers[l-1]<<endl;
    }


    return 0;
}


Compiler output:
a.cc: In function 'void is2017()':
a.cc:24:18: error: expected ';' before '}' token
   24 |             sum++
      |                  ^
      |                  ;
   25 |         }
      |         ~
Language: C++

 #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << endl
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
int dx8[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
//ポイントは範囲クエリが来たらあらかじめ答えを計算しておくことを考えてみる、そしてその場合累積和が絡んできそう
int MAX = 1000100;
vi is_prime(MAX,1);
vi sieve (int n){
    is_prime[0] = 0,is_prime[1] = 0;
    for(int i=2;i<MAX; ++i){
        //落とされた奴はcont
        if(!is_prime[i]) continue;
        //  素数の倍数をどんどん落としておく
        for(int j=i*2; j < MAX; j+=i) is_prime[j] = 0;
    }
}
int main(void) {
    //1~1000000までの範囲
    
    //まずmaxまでの素数を求める
    sieve(MAX);
    vi is2017Like(MAX,0);
    //次にその中から2017likeを抜き出して
    for(int i=0,i<MAX;++i){
        if(i%2 == 0)continue;//枝狩り 
        if(is_prime[i]&& is_prime[(i+1)/2]){
            is2017Like[i] = 1;
        }
    }
    //累積和を作る
    vi S(MAX+1,0);
    S[0] = 0;
    rrep(i,MAX){
        S[i] = S[i-1] + is2017Like[i-1];
    }

    int Q;
    cin >> Q;
    rep(i,Q){
        int l,r;
        cin >> l>> r;
        //累積和ではrの一つ前までの和、例えばS[5]はa1~4までなので5の結果も欲しいならr++しなければいけない
        r++;
        fin(S[r] - S[l]);
    }

    
}

Compiler output:
a.cc: In function 'vi sieve(int)':
a.cc:69:1: warning: no return statement in function returning non-void [-Wreturn-type]
   69 | }
      | ^
a.cc: In function 'int main()':
a.cc:77:18: error: expected ';' before '<' token
   77 |     for(int i=0,i<MAX;++i){
      |                  ^
      |                  ;
a.cc:77:18: error: expected primary-expression before '<' token
Language: C++

#include <bits/stdc++.h>
#include <iostream>
using namespace  std;
vector<long long int>vc;
const int N=1e5+2;
bool p[N];
void prime(){





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

    for(int k=0;k<q;k++){
    memset(p,true,sizeof(p));
int x,y;
cin>>x>>y;
 for(int i=2;i*i<=y;i++){
     if(p[i]==true){
     for(int j=i*i;j<=y;j+=i){
         p[j]=false;

     }

 }

}
 for(int w=0;w<=y;w++){
 if(p[w]==true)vc.push_back(w);
 }

 


    }










Compiler output:
a.cc: In function 'void prime()':
a.cc:13:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   13 | int main() {
      |         ^~
a.cc:13:9: note: remove parentheses to default-initialize a variable
   13 | int main() {
      |         ^~
      |         --
a.cc:13:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:13:12: error: a function-definition is not allowed here before '{' token
   13 | int main() {
      |            ^
a.cc:38:6: error: expected '}' at end of input
   38 |     }
      |      ^
a.cc:7:13: note: to match this '{'
    7 | void prime(){
      |             ^
Language: C++

#include < iostream >
using namespace std;
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];
    cin >> N;
    while (N--)
    {
        cin >> L >> R;
        cout << "\n"
             << c[R] - c[L - 1];
    }
}

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

#include < iostream >
using namespace std;
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];
    cin >> N;
    while (N--)
    {
        cin >> L >> R;
        cout << "\n"
             << c[R] - c[L - 1];
    }
}

Compiler output:
main.c:1:10: fatal error:  iostream : No such file or directory
    1 | #include < iostream >
      |          ^~~~~~~~~~~~
compilation terminated.
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 <bits/stdc++.h>

// #define fi first
// #define se second
#define rep(i, n) for (ll i=0;i<(n); i++)
#define ALL(v) (v).begin(), (v).end()
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;

const ll M=1000000007ll;
const ll MOD=1000000007ll;
const ll MAX=100000001ll;
const int N=100000;
//const ll M = 1000000000+7;

ll cnt = 0; 

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(ll n){
  if(n==0) return 1;
  mint ans = f(n/2);
  ans *= ans;
  if(n%2==1) ans*= 2;
  return ans;
}

mint choose(ll n, ll k){
  mint x=1, y=1;
  rep(i,k){
    x *= (n-i);
    y *= (i+1);
  }
  return x / y;
}

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

  rep(i, n ){
    cin >> l[i]>>r[i];
  }

  bool table[N+1];
  for(ll cnt=2;cnt<=N;cnt++){
    if(!table[cnt]){
      for(int i=2;i<=N/cnt;i++){
      	table[cnt*i] = true;
      }
    }
  }
  table[0] = true;
  table[1] = true;
  
  ll ac[N+1];
  ac[0] = 0;
  for(int i=1;i<=N;i++){
    if(!table[i]&&!table[(i+1)/2]) ac[i] = ac[i-1]+1;
    else ac[i] = ac[i-1];
  }

  //rep(i,54) cout << i<<" " <<table[i]<<endl;
  ll l,r;
  rep(i,n){
    cin >> l >> r;
    cout <<ac[r] -ac[l-1] <<endl;
  }
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:95:12: error: 'l' was not declared in this scope
   95 |     cin >> l[i]>>r[i];
      |            ^
a.cc:95:18: error: 'r' was not declared in this scope
   95 |     cin >> l[i]>>r[i];
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int p[100009],f[100009];
main()
{
    p[1]=1;

    for (int i=2; i<=100000; i++)
    {
        for (int j=2*i; j<=100000; j+=i)
            p[j]=1;
    }
    p[2]=0;
    {
        if(p[i]==0 && p[(i+1)/2]==0 && i!=2)
            {
                f[i]=f[i-1]+1;
            }
        else f[i]=f[i-1];
    }
    int q;
    cin>>q;
    while(q--)
    {
        int l,r;
        cin>>l>>r;
        cout<<f[r]-f[l-1]<<endl;
    }
}

Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:15:14: error: 'i' was not declared in this scope
   15 |         if(p[i]==0 && p[(i+1)/2]==0 && i!=2)
      |              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[100010],l[100000],r[100000],cont[100000]; 
void prime()					 
{
	a[1] = 1;
	int t=sqrt(100000)					
	for(int i=2;i<=t;i++){
		if(!a[i]) {
			for(int j=i*i;j<=100000;j+=i)
			     a[j] = 1;	
		}				
	}
}
int main(){
	prime(); 						 
	int q;
	cin>>q;							
	for(int i=0;i<q;i++){
		cin>>l[i]>>r[i];
		for(int j=l[i];j<=r[i];j++){
		    if(a[j]==0&&a[(j+1)/2]==0)  cont[i]++; 
	    }
	}
	for(int i=0;i<q-1;i++)  cout<<cont[i]<<endl;
	printf("%d",cont[q-1]);
	return 0;
}

Compiler output:
a.cc: In function 'void prime()':
a.cc:8:9: error: expected ',' or ';' before 'for'
    8 |         for(int i=2;i<=t;i++){
      |         ^~~
a.cc:8:21: error: 'i' was not declared in this scope
    8 |         for(int i=2;i<=t;i++){
      |                     ^
Language: C

#include<iostream>
using namespace std;
int a[100010];
int l[100000],r[100000];			//开始定义一个全局变量数组
int cont[100000]; 
void prime()						//这个函数可以将1~100010内的所有素数都找出来，所以在main()函数开头执行一遍就行了 
{
	a[1] = 1;						//希望读者能将这一块跟第二种方法进行一个比较，便于理解 
	for(int i=2;i*i<=100010;i++)
	{
		if(!a[i]) 
		{
			for(int j=i*i;j<=100010;j+=i)
			a[j] = 1;	
		}				
	}
}
int main(){
	prime(); 						 //执行程序开始的打表操作 
	int q;
	cin>>q;							
	for(int i=0;i<q;i++){
		cin>>l[i]>>r[i];
		for(int j=l[i];j<=r[i];j++){
		    if(a[j]==0&&a[(j+1)/2]==0)  cont[i]++; 	//判断是否为素数 
	    }
	}
	for(int i=0;i<q-1;i++)  cout<<cont[i]<<endl;
	printf("%d",cont[q-1]);
	return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
pair<int, bool> dp[101000];
bool  is_prime(int n){
    if (n == 1) return false;
    if (dp[n].first != -1) return dp[n].second;
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) { 
              dp[n].first = 0;
              dp[n].second = false;
              return false;
         }
}
      dp[n].first = 0;
              dp[n].second = true;
    return true;
}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;

}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    int Q;
    cin >> Q;
    vi a(Q);
   pair<int, bool> p = make_pair<-1, false>;
   fill(dp, dp+101000, p);
    rep(i, 0, Q) {
        int res = 0;
        int l, r;
        cin >> l >> r;
        rep(k, l, r+1) {
            if (k % 2 != 0) {
               if (is_prime(k)) {
                   if (is_prime((k+1)*0.5)) {
                       ++res;
                   }
               } else {
                   continue;
               }
            }
        }
        a[i] = res;
    }
    rep(i, 0, Q) {
        cout << a[i] << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:71:24: error: conversion from '<unresolved overloaded function type>' to non-scalar type 'std::pair<int, bool>' requested
   71 |    pair<int, bool> p = make_pair<-1, false>;
      |                        ^~~~~~~~~~~~~~~~~~~~
Language: C++

#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
pair<int, bool> dp[101000];
bool  is_prime(int n){
    if (n == 1) return false;
    if (dp[n].first != INF) return dp[n].second;
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) { 
              dp[n].first = 0;
              dp[n].second = false;
              return false;
         }
}
      dp[n].first = 0;
              dp[n].second = true;
    return true;
}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;

}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    int Q;
    cin >> Q;
    vi a(Q);
   pair<int, bool> p = make_pair<INF, false>;
   fill(dp, dp+101000, p);
    rep(i, 0, Q) {
        int res = 0;
        int l, r;
        cin >> l >> r;
        rep(k, l, r+1) {
            if (k % 2 != 0) {
               if (is_prime(k)) {
                   if (is_prime((k+1)*0.5)) {
                       ++res;
                   }
               } else {
                   continue;
               }
            }
        }
        a[i] = res;
    }
    rep(i, 0, Q) {
        cout << a[i] << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:71:24: error: conversion from '<unresolved overloaded function type>' to non-scalar type 'std::pair<int, bool>' requested
   71 |    pair<int, bool> p = make_pair<INF, false>;
      |                        ^~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
pair<int, bool> dp[101000];
bool  is_prime(int n){
    if (n == 1) return false;
    if (dp[n].first != INF) return dp[n].second;
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) { 
              dp[n].first = 0;
              dp[n].second = false;
              return false;
    }
      dp[n].first = 0;
              dp[n].second = true;
    return true;
}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;

}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    int Q;
    cin >> Q;
    vi a(Q);
   pair<int, bool> p = make_pair<INF, false>;
   fill(dp, dp+101000, p);
    rep(i, 0, Q) {
        int res = 0;
        int l, r;
        cin >> l >> r;
        rep(k, l, r+1) {
            if (k % 2 != 0) {
               if (is_prime(k)) {
                   if (is_prime((k+1)*0.5)) {
                       ++res;
                   }
               } else {
                   continue;
               }
            }
        }
        a[i] = res;
    }
    rep(i, 0, Q) {
        cout << a[i] << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'bool is_prime(int)':
a.cc:42:28: error: a function-definition is not allowed here before '{' token
   42 | int findSumOfDigits(int n) {
      |                            ^
a.cc:51:1: error: a template declaration cannot appear at block scope
   51 | template<class T> inline bool chmin(T& a, T b) {
      | ^~~~~~~~
a.cc:66:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   66 | int main() {
      |         ^~
a.cc:66:9: note: remove parentheses to default-initialize a variable
   66 | int main() {
      |         ^~
      |         --
a.cc:66:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:66:12: error: a function-definition is not allowed here before '{' token
   66 | int main() {
      |            ^
a.cc:93:2: error: expected '}' at end of input
   93 | }
      |  ^
a.cc:27:22: note: to match this '{'
   27 | bool  is_prime(int n){
      |                      ^
a.cc:93:2: warning: control reaches end of non-void function [-Wreturn-type]
   93 | }
      |  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep_1(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main(){
    int mx = INF;
    vector<int> is_prime(mx,1);
    is_prime[0] = 0,is_prime[1] = 0;
    for(int i = 0;i < mx;i++){
        if(!is_prime[i]) continue;
        for(int j = i*2;j <mx;j+=i) is_prime[j] = 0;
    }

    vector<int> a(mx);
    rep(i,mx){
        if(i % 2 == 0) continue;
        if(is_prime[i] && is_prime[ (i+1) / 2 ] ) a[i] = 1;
    }

    vector<int> s(mx+1);
    rep(i,n) s[i+1] = a[i] + s[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:28:11: error: 'n' was not declared in this scope
   28 |     rep(i,n) s[i+1] = a[i] + s[i];
      |           ^
a.cc:4:37: note: in definition of macro 'rep'
    4 | #define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
      |                                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep_1(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main(){
    int mx = INF;
    vector<int> is_prime(mx,1);
    is_prime[0] = 0,is_prime[1] = 0;
    for(int i = 0;i < mx;i++){
        if(!is_prime[i]) continue;
        for(int j = i*2;j <mx;j+=i) is_prime[j] = 0;
    }

    vector<int> a(n);
    rep(i,mx){
        if(i % 2 == 0) continue;
        if(is_prime[i] && is_prime[ (i+1) / 2 ] ) a[i] = 1;
    }

    vector<int> s(n+1);
    rep(i,n) s[i+1] = a[i] + s[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:21:19: error: 'n' was not declared in this scope
   21 |     vector<int> a(n);
      |                   ^
Language: Java

import java.util.Scanner;

public class s3 {
static boolean pd(int t){
for(int i=2;i<=t/2;i++){
if(t%i==0)
	return false;
}	
return true;	
}
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int n=in.nextInt();
for(int i = 0;i<n;i++){
int a,b,ans=0;
a=in.nextInt();
b=in.nextInt();
if(a%2==0){
	for(int j=a+1;j<=b;j+=2){
		if(pd(j)&&pd((j+1)/2)){
			ans++;
		}	
		}
}
else{
for(int j=a;j<=b;j+=2){
if(pd(j)&&pd((j+1)/2)){
	ans++;
}	
}}
System.out.println(ans);
ans=0;
}
}
}


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

#include<bits/stdc++.h>
using namespace std;
int p[100009],f[100009];
main()
{
    p[1]=1;

    for (int i=2; i<100000; i++)
    {
        for (int j=2*i; j<100000; j+=i)
            p[j]=1;
    }
    p[2]=0;
    for (int i=1; i<=100000; i++)//构造前缀和
    {
        if(p[i]==0 && p[(i+1)]==0 && i!=2)
            {
                f[i]=f[i-1];
            }
        else f[i]=f[i-1];
    }
    int q;
    cin>>q;
    while(q--)
    {
        int l,r;
        cin>>l>>r;
        cout<<f[r]-f[l-1]<<endl
    }
}

Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:28:32: error: expected ';' before '}' token
   28 |         cout<<f[r]-f[l-1]<<endl
      |                                ^
      |                                ;
   29 |     }
      |     ~
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
bool prime[233333];
void makeprime(int n){
    memset(prime,1,sizeof(prime));
    prime[0]=prime[1]=0;
    for(int i=2;i<=sqrt(n);i++){
        if(prime[i]){
            for(int j=2;j<=n/i;j++){
                prime[i*j]=0;
            }
        }
    }
}
int f[233333];
int main(){
	int T;
	cin>>T;
	makeprime(100010);
	for(int i=3;i<=100000;i++){
		if(i%2==1 && prime[i] && prime[(i+1)/2]){
			f[i]=f[i-1]+1;
		}
		else{
			f[i]=f[i-1];
		}
	}
	while(T--){
		int l,r,ans=0;
		cin>>l>>r;
		cout<<f[r]-f[l-1]<<endl;
	}
	return 0;
}#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
bool prime[233333];
void makeprime(int n){
    memset(prime,1,sizeof(prime));
    prime[0]=prime[1]=0;
    for(int i=2;i<=sqrt(n);i++){
        if(prime[i]){
            for(int j=2;j<=n/i;j++){
                prime[i*j]=0;
            }
        }
    }
}
int f[233333];
int main(){
	int T;
	cin>>T;
	makeprime(100010);
	for(int i=3;i<=100000;i++){
		if(i%2==1 && prime[i] && prime[(i+1)/2]){
			f[i]=f[i-1]+1;
		}
		else{
			f[i]=f[i-1];
		}
	}
	while(T--){
		int l,r,ans=0;
		cin>>l>>r;
		cout<<f[r]-f[l-1]<<endl;
	}
	return 0;
}

Compiler output:
a.cc:38:2: error: stray '#' in program
   38 | }#include<iostream>
      |  ^
a.cc:38:3: error: 'include' does not name a type
   38 | }#include<iostream>
      |   ^~~~~~~
a.cc:44:6: error: redefinition of 'bool prime [233333]'
   44 | bool prime[233333];
      |      ^~~~~
a.cc:7:6: note: 'bool prime [233333]' previously declared here
    7 | bool prime[233333];
      |      ^~~~~
a.cc:45:6: error: redefinition of 'void makeprime(int)'
   45 | void makeprime(int n){
      |      ^~~~~~~~~
a.cc:8:6: note: 'void makeprime(int)' previously defined here
    8 | void makeprime(int n){
      |      ^~~~~~~~~
a.cc:56:5: error: redefinition of 'int f [233333]'
   56 | int f[233333];
      |     ^
a.cc:19:5: note: 'int f [233333]' previously declared here
   19 | int f[233333];
      |     ^
a.cc:57:5: error: redefinition of 'int main()'
   57 | int main(){
      |     ^~~~
a.cc:20:5: note: 'int main()' previously defined here
   20 | int main(){
      |     ^~~~
Language: C++

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

const int INF = 100100100;
const int MOD = (int)1e9 + 7;

typedef long long ll;

int main(){
    vector <int> num(10001,1);
    vector <int> l_num(100001,0);
    num[0] = 0; num[1] = 0;
    for(int i = 2; i<=sqrt(100000); ++i){
        if(num[i]){
            for(int j = 2; i*j<=max; ++j) num[i*j] = 0;
        }
    for(int i = 0; i<100001; ++i) l_num[i+1] = l_num[i] + num[i];
    int q, ans = 0; cin >> q;
    for(int i = 0; i<q; ++i){
        int s,e; cin >> s >> e;
        ans += l_num[e+1] - l_num[s];
    }
    cout << ans << endl; return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:31: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<='
   15 |             for(int j = 2; i*j<=max; ++j) num[i*j] = 0;
      |                            ~~~^~~~~
a.cc:24:2: error: expected '}' at end of input
   24 | }
      |  ^
a.cc:9:11: note: to match this '{'
    9 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
ll llmax = LLONG_MAX;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
vi d1 = {1, 0, -1, 0}, d2 = {0, 1, 0, -1};
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

//素数判定．1:素数
ll is_prime(ll n) {
  if (n == 1) return 0;
  if (n == 2) return 1;
  if (n % 2 == 0) return 0;
  for (ll i = 3; i <= sqrt(n); i += 2)
    if (n % i == 0) return 0;
  return 1;
}

int main() {
  ll q;
  cin >> q;

  vll like2017(1, 3);
  for (ll i = 3; i <= 50000; i += 2) {
    if (is_prime(i) == 1) {
      if (is_prime(2 * i - 1) == 1) {
        like2017.push_back(2 * i - 1);
      }
    }
  }
  ll m = like2017.size();

  for (ll i = 0; i < q; i++) {
    ll l, r;
    cin >> l >> r;
    ll memo1 = -1, memo2 = -1;
    for (ll j = 0; j < m; j++) {
      if (like2017[j] >= l) {
        if (like2017[j] <= r)
          memo1 = j;
          break;
        }
        else break;
      }
    }
    if (memo1 == -1) {
      cout << 0 << endl;
      continue;
    }
    for (ll j = memo1 + 1; j < m; j++) {
      if (like2017[j] > r) {
        memo2 = j;
        break;
      }
      if (j == m - 1) memo2 = j;
    }
    cout << memo2 - memo1 + 1 << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:9: error: 'memo1' was not declared in this scope
   54 |     if (memo1 == -1) {
      |         ^~~~~
a.cc:56:7: error: continue statement not within a loop
   56 |       continue;
      |       ^~~~~~~~
a.cc:58:17: error: 'memo1' was not declared in this scope
   58 |     for (ll j = memo1 + 1; j < m; j++) {
      |                 ^~~~~
a.cc:59:25: error: 'r' was not declared in this scope
   59 |       if (like2017[j] > r) {
      |                         ^
a.cc:60:9: error: 'memo2' was not declared in this scope
   60 |         memo2 = j;
      |         ^~~~~
a.cc:63:23: error: 'memo2' was not declared in this scope
   63 |       if (j == m - 1) memo2 = j;
      |                       ^~~~~
a.cc:65:13: error: 'memo2' was not declared in this scope
   65 |     cout << memo2 - memo1 + 1 << endl;
      |             ^~~~~
a.cc:65:21: error: 'memo1' was not declared in this scope
   65 |     cout << memo2 - memo1 + 1 << endl;
      |                     ^~~~~
a.cc: At global scope:
a.cc:67:1: error: expected declaration before '}' token
   67 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
ll llmax = LLONG_MAX;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
vi d1 = {1, 0, -1, 0}, d2 = {0, 1, 0, -1};
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

//素数判定．1:素数
ll is_prime(ll n) {
  if (n == 1) return 0;
  if (n == 2) return 1;
  if (n % 2 == 0) return 0;
  for (ll i = 3; i <= sqrt(n); i += 2)
    if (n % i == 0) return 0;
  return 1;
}

int main() {
  ll q;
  cin >> q;

  vll like2017(1, 3)
  for (ll i = 3; i <= 50000; i += 2) {
    if (is_prime(i) == 1) {
      if (is_prime(2 * i - 1) == 1) {
        like2017.push_back(2 * i - 1);
      }
    }
  }
  ll m = like2017.size();

  for (ll i = 0; i < q; i++) {
    ll l, r;
    cin >> l >> r;
    ll memo1 = -1, memo2 = -1;
    for (ll j = 0; j < m; j++) {
      if (like2017[j] >= l) {
        memo1 = j;
        break;
      }
    }
    if (memo1 == -1) {
      cout << 0 << endl;
      continue;
    }
    for (ll j = 0; j < m; j++) {
      if (like2017[m - 1 - j] <= r) {
        memo2 = m - 1 - j;
        break;
      }
    }
    if (memo2 == -1) cout << 0 << endl;
    else cout << memo2 - memo1 + 1 << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:3: error: expected ',' or ';' before 'for'
   32 |   for (ll i = 3; i <= 50000; i += 2) {
      |   ^~~
a.cc:32:18: error: 'i' was not declared in this scope
   32 |   for (ll i = 3; i <= 50000; i += 2) {
      |                  ^
Language: Java

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int Q = sc.nextInt();
		int[] cumulativeSum = new int[999999];
		for (int i = 1; i < cumulativeSum.length; i++) {
			if (isPrime(i) && isPrime((i + 1) / 2)) {
				cumulativeSum[i]++;
			}
			cumulativeSum[i] += cumulativeSum[i - 1];
		}
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < Q; i++) {
			int l = sc.nextInt();
			int r = sc.nextInt();
			int count = cumulativeSum[r] - cumulativeSum[l - 1];
			ans.append(count);
			if (i < Q - 1) {
				ans.append("\n");
			}
		}
		System.out.println(ans.toString());
	}

	static boolean isPrime(int n) {
		if (n == 1)
			return false;
		for (int i = 2; i * i <= n; ++i) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

Compiler output:
Main.java:4: error: cannot find symbol
		FastScanner sc = new FastScanner();
		^
  symbol:   class FastScanner
  location: class Main
Main.java:4: error: cannot find symbol
		FastScanner sc = new FastScanner();
		                     ^
  symbol:   class FastScanner
  location: class Main
2 errors
Language: C++


def main():
    n = int(input())

    sosuu_mask = sosuu()

    r = [0 for i in range(int(1e5+1))]
    l = [0 for i in range(int(1e5+1))]
    for i in range(len(r)-2,0,-1):
        r[i] += r[i+1] + sosuu_mask[i+1]
    for i in range(1,len(l)):
        l[i] += l[i-1] + sosuu_mask[i-1]
    _all = len([s for s in sosuu_mask if s==1])
    # print(sosuu_mask[:20])
    # print(_all)
    # print(r[:10])
    # print(l[:10])

    for i in range(n):
        a,b = list(map(int,input().split(' ')))
        # print(list(map(int,input().split(' '))))
        print(_all-l[a]-r[b])
    return 

def sosuu():
    ret = [1 for i in range(int(1e5+1))]
    ret[0]=0
    ret[1]=0
    for i in range(2,len(ret)):
        if ret[i]==0:
            continue
        else:
            for j in range(2*i,len(ret),i):
                ret[j] = 0
    ret2 = [s for s in ret]
    for i in range(len(ret)):
        if i%2==1 and ret[(i+1)//2]!=1:
            ret2[i]=0
    return ret2


if __name__ == "__main__":
    main()

Compiler output:
a.cc:14:7: error: invalid preprocessing directive #print
   14 |     # print(sosuu_mask[:20])
      |       ^~~~~
a.cc:15:7: error: invalid preprocessing directive #print
   15 |     # print(_all)
      |       ^~~~~
a.cc:16:7: error: invalid preprocessing directive #print
   16 |     # print(r[:10])
      |       ^~~~~
a.cc:17:7: error: invalid preprocessing directive #print
   17 |     # print(l[:10])
      |       ^~~~~
a.cc:21:11: error: invalid preprocessing directive #print
   21 |         # print(list(map(int,input().split(' '))))
      |           ^~~~~
a.cc:2:1: error: 'def' does not name a type
    2 | def main():
      | ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>

#define rep(i,n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef long long ll;

const long long int INF = 1 << 30; //10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

vector<bool> erat(int n) {
  vector<bool> primes(n,true);
  int mult = 2, k = 2;
	while (k < n-mult) {
		k += mult;
	  primes[k] = false;
	}

	mult = k = 3;
	while (mult < n) {
	  if (primes[mult]){
			while (k < n-mult) {
				k += mult;
				primes[k] = false;
		  }
			mult += 2; k = mult;
		}
		else {
			mult += 2; k = mult; 
			continue;
		}
	}

	return primes;
}

int main() {
	vector<bool> primes = erat(100001);
	vector<int>  likes(100001,0);

	primes[0] = primes[1] = false;
	int k = 0;
	for (int i = 1; i < 100001; i++) {
	  if(primes[i] && primes[(i+1)/2]) k++;
		likes[i] = k;
	}
  　
  　int q;
	cin >> q;

	rep(i, q) {
		int l,r;
		cin >> l >> r;

		cout << likes[r] - likes[l-1] << endl;
	}
}

Compiler output:
a.cc:54:3: error: extended character 　 is not valid in an identifier
   54 |   　
      |   ^
a.cc:55:3: error: extended character 　 is not valid in an identifier
   55 |   　int q;
      |   ^
a.cc: In function 'int main()':
a.cc:54:3: error: '\U00003000' was not declared in this scope
   54 |   　
      |   ^~
a.cc:56:16: error: 'q' was not declared in this scope
   56 |         cin >> q;
      |                ^
Language: C++

#include <iostream>
#include <vector>

int main(void){
    // Your code here!
    
    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; //iは素数ではない
        for(int j = 2 * i; j < MAX; j += i) is_prime[j] = 0; //iの倍数をすべてふるい落とす
    }
    
    //determine whether an input is 2017-like or not 
    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;
    }
    
    //累積和 [c, d)にある2017-like numberの数を表す
    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++;
        
        std::cout << s[r] - s[l] << std::endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'vector' was not declared in this scope
    8 |     vector<int> is_prime(MAX, 1);
      |     ^~~~~~
a.cc:8:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:8:12: error: expected primary-expression before 'int'
    8 |     vector<int> is_prime(MAX, 1);
      |            ^~~
a.cc:9:5: error: 'is_prime' was not declared in this scope
    9 |     is_prime[0] = 0, is_prime[1] = 0;
      |     ^~~~~~~~
a.cc:16:12: error: expected primary-expression before 'int'
   16 |     vector<int> a(MAX, 0);
      |            ^~~
a.cc:19:48: error: 'a' was not declared in this scope
   19 |         if(is_prime[i] && is_prime[(i+1) / 2]) a[i] = 1;
      |                                                ^
a.cc:23:12: error: expected primary-expression before 'int'
   23 |     vector<int> s(MAX+1, 0);
      |            ^~~
a.cc:24:34: error: 's' was not declared in this scope
   24 |     for(int i = 0; i < MAX; i++) s[i+1] = s[i] + a[i];
      |                                  ^
a.cc:24:50: error: 'a' was not declared in this scope
   24 |     for(int i = 0; i < MAX; i++) s[i+1] = s[i] + a[i];
      |                                                  ^
a.cc:28:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   28 |     cin >> q;
      |     ^~~
      |     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:35:22: error: 's' was not declared in this scope
   35 |         std::cout << s[r] - s[l] << std::endl;
      |                      ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

bool isPrime(int n){
  if(n < 2) return false;
  else if(n == 2) return true;
  else if(n % 2 == 0) return false; // 1と偶数はあらかじめ除く
  for(int i = 3; i <= sqrt(n); i += 2){
    if(n % i == 0) return false;
  }
  return true;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ABC084D - 2017-like Number
  int Q; cin >> Q;
  vector<bool> prime(1e5+1, false);
  vector<int> dp(1e5+1, 0);
  prime[2] = true;
  for(int i = 3; i <= 1e5; i += 2){
    if(isPrime(i)){
      prime[i] = true;
      if(prime[(i+1)/2]){
        dp[i] = dp[i-2] + 1;
      }else{
        dp[i] = dp[i-2]
      }
    }else{
      dp[i] = dp[i-2];
    }
  }
  vector<pair<int, int> > q(Q, pair<int, int>());
  REP(i, Q){
    int l, r; cin >> l >> r;
    q[i] = {l, r};
  }
  REP(i, Q){
    cout << dp[q[i].second] - dp[q[i].first - 2] << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:24: error: expected ';' before '}' token
   32 |         dp[i] = dp[i-2]
      |                        ^
      |                        ;
   33 |       }
      |       ~
Language: C++

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

vector<int> sieve_of_eratosthenes(int n) {
  vector<int> primes(n);
  for (int i = 2; i < n; ++i)
    primes[i] = i;
  for (int i = 2; i*i < n; ++i)
    if (primes[i])
      for (int j = i*i; j < n; j+=i)
        primes[j] = 0;
  return primes;
}

vector<int> like_numbers(int n){

  vector<int> prime(n);
  prime=sieve_of_eratosthenes(n);
  vector<int> like(n);
  for(int i=1;i<n;++i){
    if(prime.at(i)!=0 && prime.at((i+1)/2)!=0){
      like[i]=1;
    }
  }
  return like;
}


int main(){
  int Q;
  cin>>Q;
  
  vector<int> l(Q),r(Q);
  for(int i=0;i<Q;++i){
    cin>>l.at(i)>>r.at(i);
  }

  vector<int> like_list(100010);
  like_list=like_numbers(100010);

  vector<int> sum(100010);
  sum.at(0)=0;

  for(int i=1;i<100005;++i){
    sum.at(i)=sum.at(i-1)+like_list.at(i);
  }
  
  for(int i=0;i<Q;++i){
  cout<<sum.at(r.at(i))-sum.at(l.at(i)-1)<<endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:50:4: error: expected '}' at end of input
   50 |   }
      |    ^
a.cc:29:11: note: to match this '{'
   29 | int main(){
      |           ^
Language: C++

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

vector<bool>flag(100005);
vector<int>cnt(100005);

int main() {
	for (int i = 2; i <= 100000; i++)if (!flag[i])for (int j = i + i; j <= 100000; j += i)flag[j] = true;
	for (int i = 3; i <= 100000; i += 2)if (!flag[i] && !flag[(i + 1) / 2])cnt[i]++;
	for (int i = 3; i <= 100000; i++)cnt[i] += c[i - 1];
	int q; cin >> q;
	for (int i = 0; i < q; i++) {
		int l, r; cin >> l >> r;
		cout << cnt[r] - cnt[l] << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:52: error: 'c' was not declared in this scope
   11 |         for (int i = 3; i <= 100000; i++)cnt[i] += c[i - 1];
      |                                                    ^
Language: C++

#include <cstdio>

using namespace std;

int parse_int()
{
    int n = 0, c;
    while (1)
    {
        c = getchar_unlocked();
        if ('0' <= c && c <= '9')
            n = n * 10 + c - '0';
        else
            break;
    }
    return n;
}

template <size_t N>
struct Solver
{
    bool is_prime[N + 1];
    short ans[N + 1];
    constexpr Solver() : is_prime(), ans()
    {
        is_prime[0] = false;
        is_prime[1] = false;
        for (size_t i = 2; i <= N; i++)
        {
            is_prime[i] = true;
        }
        for (size_t prime = 2; prime <= N; prime++)
        {
            if (is_prime[prime])
            {
                for (size_t q = prime * 2; q <= N; q += prime)
                {
                    is_prime[q] = false;
                }
            }
        }
        for (size_t i = 1; i <= N; i++)
        {
            ans[i] += ans[i - 1];
            if (is_prime[i] && is_prime[(i + 1) / 2])
            {
                ans[i] += 1;
            }
        }
    }
};

int main()
{
    auto M = 100000;
    auto solver = Solver<M>();

    int Q = parse_int();
    for (size_t i = 0; i < Q; i++)
    {
        int l = parse_int();
        int r = parse_int();
        auto ans = solver.ans[r] - solver.ans[l - 1];
        printf("%d\n", ans);
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:27: error: the value of 'M' is not usable in a constant expression
   56 |     auto solver = Solver<M>();
      |                           ^
a.cc:55:10: note: 'int M' is not const
   55 |     auto M = 100000;
      |          ^
a.cc:56:27: note: in template argument for type 'long unsigned int'
   56 |     auto solver = Solver<M>();
      |                           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int p[100009],f[100009];
main()
{
    p[1]=1;

    for (int i=2; i<=100000; i++)
    {
        for (int j=2*i; j<=100000; j+=i)
            p[j]=1;
    }
    p[2]=0;
    for (int i=1; i<=100000; i++)//构造前缀和
    {
        if(p[i]==0 && p[(i+1)/2]==0 && i!=2)//如果该数满足要求，前缀和加1；否则不变
            {
                f[i]=f[i-1]+1;
            }
        else f[i]=f[i-1];
    }
    int q;
    cin>>q;
    while(q--)
    {
        int l,r;
        cin>>l>>r;
        cout<<f[r]-f[l-1]<<endl//对于每组询问，直接输出f[r]-f[l-1]
    }
}

Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:28:32: error: expected ';' before '}' token
   28 |         cout<<f[r]-f[l-1]<<endl//对于每组询问，直接输出f[r]-f[l-1]
      |                                ^
      |                                ;
   29 |     }
      |     ~
Language: C++

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

int main() {

	bool f[100001];
	int c[100002];
 	int Q;
  	int l[100005], r[100005];

	// Sieve of Eratosthenes
	for(int i=2;i<=100000;i++){
		if(!f[i]){
			for(int j=i+i;j<=100000;j+=i){
				f[j] = true;
            }
        }
	}

	// judge wheter i is a 2017-like-number or not
	for(int i=3; i<=100000;i+=2){
		if(!f[i]&&!f[(i+1)/2])
			c[i]++;
	}

	// c[i] is the number of 2017-like-numbers from 1 to i
	for(int i=3; i<=100000;i++){
		c[i] += c[i-1];
	}
  
  cin >> Q;
  for(int i=0;i<Q;i++){
    cin >> l[i] >> r[i];
  }
  for(int i=0;i<Q;i++){
    cout << c[r[i]] - c[l[i]-1] << endl;
  	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:2: error: expected '}' at end of input
   38 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main() {

	bool f[100001];
	int c[100002];
 	int Q;
  	int l[100005], r[100005];

	// Sieve of Eratosthenes
	for(int i=2;i<=100000;i++){
		if(!f[i]){
			for(int j=i+i;j<=100000;j+=i){
				f[j] = true;
            }
        }
	}

	// judge wheter i is a 2017-like-number or not
	for(int i=3; i<=100000;i+=2){
		if(!f[i]&&!f[(i+1)/2])
			c[i]++;
	}

	// c[i] is the number of 2017-like-numbers from 1 to i
	for(int i=3; i<=100000;i++){
		c[i] += c[i-1];
	}
  
  cin >> Q;
  for(i=0;i<Q;i++){
    cin >> l[i] >> r[i];
  }
  for(i=0;i<Q;i++){
    cout << c[r[i]] - c[l[i]-1] << endl;
  	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:7: error: 'i' was not declared in this scope
   32 |   for(i=0;i<Q;i++){
      |       ^
a.cc:35:7: error: 'i' was not declared in this scope
   35 |   for(i=0;i<Q;i++){
      |       ^
a.cc:38:2: error: expected '}' at end of input
   38 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
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:
main.c:1:10: fatal error: cstdio : No such file or directory
    1 | #include <cstdio >
      |          ^~~~~~~~~
compilation terminated.
Language: C++

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

int main() {
	int n;
	cin >> n;
	
	bool sosuu[100000] = {};
	
	for (int i = 2; i < 100000; i++) {
		sosuu[i] = true;
	}
	for (int i = 2; i < 100000; i++) {
		if (!sosuu[i]) continue;
		for (int k = i + i; k < j; k += i) {
			sosuu[k] = false;
		}
	}
	
	int anss[100001] = {};
	
	for (int i = 1; i < 100000; i+= 2) {
		if (sosuu[i] && sosuu[(i + 1) / 2]) anss[i] = 1;
	}
	for (int i = 0; i < 100000; i++) {
		anss[i + 1] += anss[i];
	}
	for (int i = 0; i < n; i++) {
		int l, r;
		cin >> l >> r;
		cout << anss[r] - anss[l - 1] << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:41: error: 'j' was not declared in this scope
   18 |                 for (int k = i + i; k < j; k += i) {
      |                                         ^