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

#include <iostream>
#include <vector>
#define MAX_N 100001
 
using namespace std;
 
vector<bool> IsPrime(MAX_N, true);
 
// エラトステネスの篩
void get_primes() {
    IsPrime[0] = false;
    IsPrims[1] = false;

    for (int i = 2; i*i <= MAX_N; i++) {
        if (IsPrime[i]) {
            for (int j = i*i; j <= MAX_N; j += i) {
                IsPrime[j]= false;
            }
        }
    }
}

int main() {
    int Q, l, r;
    vector<int> cnt(MAX_N, 0);
 
    get_primes();
 
    for (int i = 3; i <= MAX_N; i += 2) {
        if (IsPrime[i] && IsPrime[(i+1)/2]) { cnt[i]++; }
    }
    // 2017 に似てる数の累積和をとっている
    for (int i = 1; i <= MAX_N; i++) {
        cnt[i] += cnt[i-1];
    }
 
    cin >> Q;
 
    while (Q--) {
        cin >> l >> r;
        cout << cnt[r] - cnt[l-1] << endl;
    }
 
    return 0;
}

Compiler output:
a.cc: In function 'void get_primes()':
a.cc:12:5: error: 'IsPrims' was not declared in this scope; did you mean 'IsPrime'?
   12 |     IsPrims[1] = false;
      |     ^~~~~~~
      |     IsPrime
Language: C++

#include <iostream>
#include <vecotr>
#define MAX_N 100001

using namespace std;

vector<bool> IsPrime(MAX_N, true);

// 愚直な素数列挙
void get_primes() {
    IsPrime[0] = false; IsPrime[1] = false;

    for (int i = 2; i < MAX_N; i++) {
        for (int j = 2; j*j <= i; j++) {
            if (i % j == 0) { IsPrime[i] = false; }
        }
    }
}

int main() {
    int Q, l, r;
    vector<int> cnt(MAX_N, 0);

    get_primes();

    for (int i = 3; i <= MAX_N; i += 2) {
        if (IsPrime[i] && IsPrime[(i+1)/2]) { cnt[i]++; }
    }
    // 2017 に似てる数の累積和をとっている
    for (int i = 1; i <= MAX_N; i++) {
        cnt[i] += cnt[i-1];
    }

    cin >> Q;

    while (Q--) {
        cin >> l >> r;
        cout << cnt[r] - cnt[l-1] << endl;
    }

    return 0;
}

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

#include <queue>
#include <cmath>
#include <iterator>
#include <math.h>
#include <cstdio>
#include <map>
 
using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
 
int main(void){
    //素数生成
    vector<int> sosu;
    sosu.push_back(2);
    for(int i=3;i<100001;i+=2){
        if(!any_of(sosu.begin(),sosu.end(),[i](int x){return i%x == 0;})){
            sosu.push_back(i);
        }
    }
    
    //2017に似た数生成
    vector<int> like;
    for(int i=3;i<100001;i+=2){
        if(i == 2017){
            like.push_back(i);
            continue;
        }
        if(binary_search(sosu.begin(),sosu.end(),(i+1)/2) && binary_search(sosu.begin(),sosu.end(),i))like.push_back(i);
    }
    
    //累積和生成
    array<int ,100001>rui;
    
    for(int i=3;i<100001;i++){
        rui[i] = rui[i-1];
        if(binary_search(like.begin(),like.end(),i))rui[i]++;
    }
 
    int roop,a,b;
    cin >> roop;
    for(int i = 0;i<roop;i++){
        cin >> a >> b;
        cout << rui[b]-rui[a-1] << endl;
    }
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: 'any_of' was not declared in this scope
   17 |         if(!any_of(sosu.begin(),sosu.end(),[i](int x){return i%x == 0;})){
      |             ^~~~~~
a.cc:29:12: error: 'binary_search' was not declared in this scope
   29 |         if(binary_search(sosu.begin(),sosu.end(),(i+1)/2) && binary_search(sosu.begin(),sosu.end(),i))like.push_back(i);
      |            ^~~~~~~~~~~~~
a.cc:33:23: error: aggregate 'std::array<int, 100001> rui' has incomplete type and cannot be defined
   33 |     array<int ,100001>rui;
      |                       ^~~
a.cc:7:1: note: 'std::array' is defined in header '<array>'; this is probably fixable by adding '#include <array>'
    6 | #include <map>
  +++ |+#include <array>
    7 | 
a.cc:37:12: error: 'binary_search' was not declared in this scope
   37 |         if(binary_search(like.begin(),like.end(),i))rui[i]++;
      |            ^~~~~~~~~~~~~
a.cc:41:5: error: 'cin' was not declared in this scope
   41 |     cin >> roop;
      |     ^~~
a.cc:7:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    6 | #include <map>
  +++ |+#include <iostream>
    7 | 
a.cc:44:9: error: 'cout' was not declared in this scope
   44 |         cout << rui[b]-rui[a-1] << endl;
      |         ^~~~
a.cc:44:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:44:36: error: 'endl' was not declared in this scope
   44 |         cout << rui[b]-rui[a-1] << endl;
      |                                    ^~~~
a.cc:7:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    6 | #include <map>
  +++ |+#include <ostream>
    7 |
Language: C++

#includ#include <bits/stdc++.h>
#define N 100005
using namespace std;
typedef long long ll;
int vis[N],a[N];
void creat()
{
    for(int i=2; i<=400; i++)
    {
        if(!vis[i])
        {
            for(int j=i*2; j<=N; j+=i)
                vis[j]=1;
        }
    }
}
int main()
{

    memset(vis,0,sizeof(vis));
    creat();
    vis[1]=1;
    int sum=0,n;
    for(int i=1; i<=N; i++)
    {
        if(i%2==1)
        {
            if(vis[i]==0&&vis[(i+1)/2]==0)
                sum++;
        }

        a[i]=sum;
    }
    while(scanf("%d",&n)==1)
    {
        while(n--)
        {
            int c,b;
            scanf("%d%d",&c,&b);

            printf("%d\n",a[b]-a[c-1]);
        }
    }
}
e<>

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #includ; did you mean #include?
    1 | #includ#include <bits/stdc++.h>
      |  ^~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:20:5: error: 'memset' was not declared in this scope
   20 |     memset(vis,0,sizeof(vis));
      |     ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | #includ#include <bits/stdc++.h>
a.cc:34:11: error: 'scanf' was not declared in this scope
   34 |     while(scanf("%d",&n)==1)
      |           ^~~~~
a.cc:41:13: error: 'printf' was not declared in this scope
   41 |             printf("%d\n",a[b]-a[c-1]);
      |             ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #includ#include <bits/stdc++.h>
a.cc: At global scope:
a.cc:45:1: error: 'e' does not name a type
   45 | e<>
      | ^
Language: C++

#include<iostream>
using namespace std;

int main()
{
  bool list[100001];
  list[1] = true;
  for (int i = 2; i*i <= 100000; i++) {
    if (! list[i]) {
      for (int j = i + i; j <= 100000; j += i) {
        list[j] = true;
      }
    }
  }

  int number[100001];
  number[1] = 0;
  for (int i = 3; i <= 100000; i += 2) {
    if (!(list[i] && list[(i + 1) / 2]) {
      number[i] = number[i - 2] + 1;
    } else {
      number[i] = number[i - 2];
    }
  }

  int Q, l, r;
  cin >> Q;

  for (int i = 0; i < Q; i++) {
    cin >> l >> r;
    cout << number[r] - number[l - 2] << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:40: error: expected ')' before '{' token
   19 |     if (!(list[i] && list[(i + 1) / 2]) {
      |        ~                               ^~
      |                                        )
a.cc:24:3: error: expected primary-expression before '}' token
   24 |   }
      |   ^
Language: C++

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

typedef long long int LL;
typedef unsigned long long uLL;
typedef pair< int,int > ii;
typedef pair< int,ii > iii;
const int inf = 1e9;
const LL INF = 1e18;
const int N = 100005;
const int MOD = 1e9+7;
const double EPS = 1e-6;
const double PI = acos(-1.0);

int ans[ N ];

vector <int> prime;
vector <bool> isprime( N , true );

void sieve( ) {
    isprime[ 0 ] = isprime[ 1 ] = false;
    for( int i = 4; i <= N; i += 2 ) {
        isprime[ i ] = false;
    }
    prime.push_back( 2 );
    int sq = sqrt( N );
    for( int i = 3; i <= sq; i += 2 ) {
        if( isprime[ i ] ) {
            for( int j = i*i; j <= N; j += 2*i ) {
                isprime[ j ] = false;
            }
        }
    }
    for( int i = 3; i <= N; i += 2 ) {
        if( isprime[ i ] ) prime.push_back( i );
    }
}
bool ok( int x ) {
    LL y = (x*(x+1)/2);
    //cout << "----"<<endl;
    if( isprime[x] && isprime[y] ) return true;
    return false;
}
void calc( ) {
    for( int i = 1; i <= 100000; i += 2 ) {
        if( ok( i ) ) ans[i] = 1;
    }
    for( int i = 1; i <= 100000; i++ ) {
        ans[i] += ans[i-1];
    }
}
int main( int argc, char const *argv[] ) {
    sieve();
    calc();
    int q;
    cin >> q;
    while( q-- ) {
       int l , r;
       cin >> l >> r;
       cout << res[r]-res[l-1] << endl;
    }
    return 0;
}




Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:60:16: error: 'res' was not declared in this scope
   60 |        cout << res[r]-res[l-1] << endl;
      |                ^~~
Language: C++

#include<iostream>
#include<map>
#include<cstdio>
#include<cmath>
using namespace std;
int a[100005],a[100005],b[100005];
int main()
{
	int n;
	cin>>n;
	int win[n+1][3];
	for(int i=1;i<=n;i++)
	{
		cin>>win[i][1]>>win[i][2];
	}
	for(int i=2;i<=100000;i++)
	{
		s[i]=1;
	}
	for(int i=2;i<(int)sqrt(100000);i++)
	{
		if(s[i]==1)
		{
			for(int j=2*i;j<=100000;j+=i)
			{
				s[j]=0;
			}
		}
	}
	for(int i=1;i<=100000;i++)
	{
		if(s[i]&&s[(i+1)/2])
		{
			a[i]=1;
		}
	}
	for(int i=1;i<=100000;i++)
	{
		b[i]=a[i]+b[i-1];
	}
	for(int i=1;i<=n;i++)
	{
		int x=b[win[i][2]]-b[win[i][1]-1];
		cout<<x<<'\n';
	}
	return 0;
}

Compiler output:
a.cc:6:15: error: redefinition of 'int a [100005]'
    6 | int a[100005],a[100005],b[100005];
      |               ^
a.cc:6:5: note: 'int a [100005]' previously declared here
    6 | int a[100005],a[100005],b[100005];
      |     ^
a.cc: In function 'int main()':
a.cc:18:17: error: 's' was not declared in this scope
   18 |                 s[i]=1;
      |                 ^
a.cc:22:20: error: 's' was not declared in this scope
   22 |                 if(s[i]==1)
      |                    ^
a.cc:32:20: error: 's' was not declared in this scope
   32 |                 if(s[i]&&s[(i+1)/2])
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a[q];
	int i;
	cin>>q;
	for (i=2;i<=10000;i++)
	{
		a[i]=1;
		cin>>a[i];
	} 
	for (i=2;int (sqrt(n));i++)
		if (a[i]==1)
		{
			for (int j=i+i;j<=n;j+=i)
			  a[j]=0;
		}
	int s[q];
	for (i=0;i<=q;i++)
	{
		a[i]=s[i];
		s[i]=s[i]+s[i-1]
	}
	cout<<s[i]<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:15: error: 'q' was not declared in this scope
    5 |         int a[q];
      |               ^
a.cc:10:17: error: 'a' was not declared in this scope
   10 |                 a[i]=1;
      |                 ^
a.cc:13:28: error: 'n' was not declared in this scope
   13 |         for (i=2;int (sqrt(n));i++)
      |                            ^
a.cc:14:21: error: 'a' was not declared in this scope
   14 |                 if (a[i]==1)
      |                     ^
a.cc:22:17: error: 'a' was not declared in this scope
   22 |                 a[i]=s[i];
      |                 ^
a.cc:22:22: error: 's' was not declared in this scope
   22 |                 a[i]=s[i];
      |                      ^
a.cc:25:15: error: 's' was not declared in this scope
   25 |         cout<<s[i]<<endl;
      |               ^
Language: C++

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

int main()
{
	int q, ans = 0;
	cin >> q;
	int s[q], e[q];
	for ( int i = 0; i < q; i++ )
	{
		cin >> s[i] >> e[i];
		for ( int j = s[i]; j <= e[i]; j++ )
		{
			if ( a[i] / 2 != 0 && ( a[i] + 1 ) / 4 != 0 )
				ans++;
		}
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:30: error: 'a' was not declared in this scope
   14 |                         if ( a[i] / 2 != 0 && ( a[i] + 1 ) / 4 != 0 )
      |                              ^
Language: C++

#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;
 
#define SIZE (1E5)+1
 
int main(void)
{
	vector<bool> prime(SIZE, true);
	vector<int> cnt(SIZE, 0);
 
	prime[0] = false;
	prime[1] = false;
	for(int i=2; i<SIZE; i++){
		cnt[i] = cnt[i-1];
 
		if(prime[i] == false)
			continue;
 
		for(int j=i+i; j<SIZE; j+=i)
			prime[j] = false;
 
		if(prime[(i+1)/2] == true)
			cnt[i]++;
	}
 
	int Q;
	cin >> Q;
 
	for(int i=0; i<Q; i++){
		int l, r;
		cin >> l >> r;
 
		cout << cnt[r] - cnt[l-1] << endl;
	}
 
	return 0;
}
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

#define SIZE (1E5)+1

int main(void)
{
	vector<bool> prime(SIZE, true);
	vector<int> cnt(SIZE, 0);

	prime[0] = false;
	prime[1] = false;
	for(int i=2; i<SIZE; i++){
		cnt[i] = cnt[i-1];

		if(prime[i] == false)
			continue;

		for(int j=i+i; j<SIZE; j+=i)
			prime[j] = false;

		if(prime[(i+1)/2] == true)
			cnt[i]++;
	}

	int Q;
	cin >> Q;

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

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

	return 0;
}
Submission

Compiler output:
a.cc:49:5: error: redefinition of 'int main()'
   49 | int main(void)
      |     ^~~~
a.cc:9:5: note: 'int main()' previously defined here
    9 | int main(void)
      |     ^~~~
a.cc:81:1: error: 'Submission' does not name a type
   81 | Submission
      | ^~~~~~~~~~
Language: C++

// ConsoleApplication46.cpp: 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;


int ans;
bool is_prime(int n)
{
	if (n <= 2)
	{
		return true;
	}
	else if(n%2!=0)
	{
		for (int i = 2; i <= sqrt(n) + 1; i++)
		{
			if (n%i == 0)
				return false;
		}
		if (is_prime((n + 1) / 2))
			return true;
	}
	return false;
}

int main()
{

	int n;
	cin >> n;
	while(n--)
	{
		int l, r;
		cin >> l >> r;
		for (; l <= r; l++)
		{
			if (is_prime(l))
			{
				ans++;
			}
		}
		cout << ans << endl;
		ans = 0;
	}
    return 0;
}



Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
using namespace std;
int main(){
    bool f[100001]={};
    int c[100002]={};
    int N,L,R;
    //エラトステネスの篩
    for(int i=2;i<=100000;i++){
        if(f[i]==0){
            for(int j=i+i;j<=100000;j+=i){
                f[j]=true;
            }
        }
    }
    //
    for(int i=3;i<=100000;i+=2){
        if(f[i]==0&&f[(i+1)/2]==0)  c[i]++
    }
    for(int i=3;i<=100000;i++)  c[i]+=c[i-1];
    
    cin >> N;
    while(N--){
        cin >> L >> R;
        cout << c[R]-c[L-1] << "\n";
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:43: error: expected ';' before '}' token
   17 |         if(f[i]==0&&f[(i+1)/2]==0)  c[i]++
      |                                           ^
      |                                           ;
   18 |     }
      |     ~
Language: C++

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

int main(void){
	bool prime[100001];
	int cnt[100002], n, l, r;
	// エラトステネスの篩(ふるい)を用いて素数判定
	// falseが素数でtrueが素数でないもの
	for (int i = 2; i <= 100000; i++){
		if (!prime[i]){
			for (int j = i+i; j <= 100000; j += i){
				prime[j] = true;
			}
		}
	}
	// 2017に似た数の捜索
	for (int i = 3; i <= 100000; i += 2){
		if (!prime[i] && !prime[(i+1)/2]){
			cnt[i]++;
		}
	}
	// 累積和を用いる
	for (int i = 3; i <= 100000; i++){
		cnt[i] += cnt[i-1];
	}
	scanf("%d", &n);
	while (n--){
		scanf("%d %d", &l, %r);
		printf("%d\n", cnt[r]-cnt[l-1]);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:36: error: expected primary-expression before '%' token
   28 |                 scanf("%d %d", &l, %r);
      |                                    ^
Language: C++

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

void hurui(vector<bool> &primes){
  int n = primes.size();
  primes[0] = primes[1] = false;
  for(int i=2;i<n;i++){
    if(!primes[i])
      continue;
    for(int j=2;i*j<n;j++)
      primes[i*j] = false;
  
}


int main(){
  vector<bool> primes(100001, true);
  hurui(primes);
  vector<int> ruiseki(100001, 0);
  for(int i=1;i<=100000;i++)
    ruiseki[i] = ruiseki[i-1] + ((i % 2 && primes[i]&&primes[(i+1)/2])?1:0);
  
  int q;
  cin >> q;
  for(int i=0;i<q;i++){
    int l, r;
    cin >> l >> r;
  	cout << ruiseki[r] - ruiseki[l-1] << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'void hurui(std::vector<bool>&)':
a.cc:17:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   17 | int main(){
      |         ^~
a.cc:17:9: note: remove parentheses to default-initialize a variable
   17 | int main(){
      |         ^~
      |         --
a.cc:17:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:17:11: error: a function-definition is not allowed here before '{' token
   17 | int main(){
      |           ^
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:5:33: note: to match this '{'
    5 | void hurui(vector<bool> &primes){
      |                                 ^
Language: C++

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

void hurui(vector<bool> &primes){
  int n = primes.size();
  primes[0] = primes[1] = false;
  for(int i=2;i<n;i++){
    if(!primes[i])
      continue;
    for(int j=2;i*j<n;j++)
      primes[i*j] = false;
  
}


int main(){
  vector<bool> primes(100001, true);
  hurui(primes);
  vector<int> ruiseki(100001, 0);
  for(int i=1;i<=100000;i++)
    ruiseki[i] = ruiseki[i-1] + (primes[i]?1:0);
  
  int q;
  cin >> q;
  for(int i=0;i<q;i++){
    int l, r;
    cin >> l >> r;
  	cout << ruiseki[r] - ruiseki[l-1] << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'void hurui(std::vector<bool>&)':
a.cc:17:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   17 | int main(){
      |         ^~
a.cc:17:9: note: remove parentheses to default-initialize a variable
   17 | int main(){
      |         ^~
      |         --
a.cc:17:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:17:11: error: a function-definition is not allowed here before '{' token
   17 | int main(){
      |           ^
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:5:33: note: to match this '{'
    5 | void hurui(vector<bool> &primes){
      |                                 ^
Language: C++

#include <iostream>
int Q, l, r;
bool prime[100001];
int c[100002];
int main()
{
    for (int i = 0; i <= 100000; ++i) if (!prime[i]) for (int j = i+i; j <= 100000; j += i) prime[i] = true;
    for (int i = 3; i <= 100000; i += 2) if (!prime[i]&&prime[(i+1)/2])c[i]++;
    for (int i = 3; i <= 100000; ++i) c[i] += c[i-1];
    cin >> Q;
    while(Q--) {
        std::cin >> l >> r;
        std::cout << c[r]-c[l-1] << std::endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   10 |     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
      |                  ^~~
Language: C++

#include <cstring>
#include<cstdio>
#include <cmath>
#include<string>
#include<cmath>
using namespace std;

#define N 100000

int judge(int n){
	int ans = 1;
	for (int i = 2; i < sqrt(n) + 1; i++){
		if (!(n % i))
			ans = 0;
	}

	if (n == 2)
		ans = 1;

	return ans;
}

int main()
{
	int q, cnt;
	int l[N], r[N];


	cin >> q;

	for (int i = 0; i < q; i++)
		cin >> l[i] >> r[i];

	for (int i = 0; i < q; i++){
		cnt = 0;
		for (int j = l[i]; j < r[i] + 1; j += 2){
			if (judge(j) && judge((j + 1) / 2))
				cnt++;
		}
		cout << cnt << endl;
	}



	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: 'cin' was not declared in this scope
   29 |         cin >> q;
      |         ^~~
a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    5 | #include<cmath>
  +++ |+#include <iostream>
    6 | using namespace std;
a.cc:40:17: error: 'cout' was not declared in this scope
   40 |                 cout << cnt << endl;
      |                 ^~~~
a.cc:40:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:40:32: error: 'endl' was not declared in this scope
   40 |                 cout << cnt << endl;
      |                                ^~~~
a.cc:6:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    5 | #include<cmath>
  +++ |+#include <ostream>
    6 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n[10001];
int main(){
int p[5000];
for(int i=3;i*i<=10000;I+=2)
if(p[i/2-1]]for(int j=i;j<=10000;j+=i)p[j/2-1]=1;
for(int i=1;i<=10000;i++)
p[i]=p[i-1]+(i==3?1:(i%4==1?p[i/2-1]&p[(i+1)/2/2-1]:0));
int q;
cin>>q;
for(int i=0;i<q;I++){
int l,r;cin>>l>>r;
cout<<n[r]-n[l-1];
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:24: error: 'I' was not declared in this scope
    6 | for(int i=3;i*i<=10000;I+=2)
      |                        ^
a.cc:7:12: error: expected ')' before ']' token
    7 | if(p[i/2-1]]for(int j=i;j<=10000;j+=i)p[j/2-1]=1;
      |   ~        ^
      |            )
a.cc:7:12: error: expected primary-expression before ']' token
a.cc:7:25: error: 'j' was not declared in this scope
    7 | if(p[i/2-1]]for(int j=i;j<=10000;j+=i)p[j/2-1]=1;
      |                         ^
a.cc:7:37: error: 'i' was not declared in this scope
    7 | if(p[i/2-1]]for(int j=i;j<=10000;j+=i)p[j/2-1]=1;
      |                                     ^
a.cc:12:17: error: 'I' was not declared in this scope
   12 | for(int i=0;i<q;I++){
      |                 ^
Language: C++

#include <iostream>
#include<string>
#include<vector>

using namespace std;

bool IsPrime(int num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}
	return true;
}

int main() {
	vector<bool> flag(100000 + 10, false);
	vector<int> like2017(100000 + 10, 0);
	//vector<int> S(100000 + 10, 0);
	int Q, r, l;

	for (int i = 1; i <= 100000; i++) flag[i] = IsPrime(i);

	for (int i = 0; i <= 100000; i++) {
		if (flag[i] && flag[(i + 1) / 2]) like2017[i] = 1;
	}

	cin >> Q;
	for (int i = 0; i < Q; i++) {
		cin >> l >> r;
		int ans = 0;

		for (int i = l; i <= r; i++) {
			if (like2017[i]) ans++;
		}
		cout << ans << "\n";
	}


	return 0;
}

Compiler output:
a.cc: In function 'bool IsPrime(int)':
a.cc:12:26: error: 'sqrt' was not declared in this scope
   12 |         double sqrtNum = sqrt(num);
      |                          ^~~~
Language: C

#include <stdio.h>
#include <string.h>
const int Max = 100000+50;
int a[Max];
int ss[Max];
int isprime()
{
	int i,j;
	memset(a,0,sizeof(a));
	a[0]=1;
	a[1]=1;
	for(i=2;i<Max;i++)
	{
		if(a[i])
		{
			continue;
		} 
		for(j=i*2;j<Max;j+=i)
		{
			a[j]=1;
		}
	} 
}
int main(int argc, char *argv[])
{
	isprime();
	ss[0]=ss[1]=0;
	for(int i=2;i<Max;i++)
	{
		ss[i]=ss[i-1];
		if(!a[i]&&!a[(i+1)/2])
		{
			ss[i]++;
		}
	}
	int cases;
	scanf("%d",&cases);
	while(cases--)
	{
		int n,m;
		scanf("%d%d",&n,&m);
		int sum=0;
		if(n==m&&!a[n]&&!a[(n+1)/2])
		{
			printf("1\n");
			continue;
		}
		int t=0;
		if(!a[n]&&!a[(n+1)/2])
			t++;
		printf("%d\n",ss[m]-ss[n]+t);
	}
	return 0;
}


Compiler output:
main.c:4:5: error: variably modified 'a' at file scope
    4 | int a[Max];
      |     ^
main.c:5:5: error: variably modified 'ss' at file scope
    5 | int ss[Max];
      |     ^~
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: In function 'int main()':
a.cc:12:13: error: expected primary-expression before ')' token
   12 | while (N - -)
      |             ^
a.cc:15:9: warning: unknown escape sequence: '\040'
   15 | printf ("% d \ n " , c [ R ] - c [L -1]);
      |         ^~~~~~~~~~
Language: C++

# include < stdio.h >
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:  stdio.h : No such file or directory
    1 | # include < stdio.h >
      |           ^~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
using namespace std;
#define MAX 100000
bool p[MAX+1];
int main(){
  for(int i=0;)
  int Q;
  cin>>Q;
  int l[Q+1],r[Q+1];
  for(int i=0;i<Q;i++)cin>>l[i+1]>>r[i+1];
  
  for(int i=1;i<N;i++)cout<<a[i]<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:15: error: expected primary-expression before ')' token
    6 |   for(int i=0;)
      |               ^
a.cc:6:15: error: expected ';' before ')' token
    6 |   for(int i=0;)
      |               ^
      |               ;
a.cc:8:8: error: 'Q' was not declared in this scope
    8 |   cin>>Q;
      |        ^
a.cc:10:28: error: 'l' was not declared in this scope
   10 |   for(int i=0;i<Q;i++)cin>>l[i+1]>>r[i+1];
      |                            ^
a.cc:10:36: error: 'r' was not declared in this scope
   10 |   for(int i=0;i<Q;i++)cin>>l[i+1]>>r[i+1];
      |                                    ^
a.cc:12:17: error: 'N' was not declared in this scope
   12 |   for(int i=1;i<N;i++)cout<<a[i]<<endl;
      |                 ^
a.cc:12:29: error: 'a' was not declared in this scope
   12 |   for(int i=1;i<N;i++)cout<<a[i]<<endl;
      |                             ^
Language: C++

#include<cstdio>
#include<iostream>
using namespace std;
#define MAX 100001
int n;
int prime[MAX];
int cnt[MAX]={};
void eratos() {
	for (int i=0;i<MAX;i++) {
	//全部primeと設定する
	prime[i] = 1;
	}
	prime[0] = prime[1] = 0;

	for (int i=2;i<MAX;i++) {
	for (int j=i+i;j<MAX;j+=i) {
	if (prime[j]) prime[j] = 0;
	}
	}
}

void like() {
	for (int i=3;i<MAX;i+=2) {
	{	
	if (prime[i] && prime[(i+1)/2]) {
	++cnt[i];
	}
	for (int i=4;i<MAX;i++) {
	cnt[i] += cnt[i-1];
	}
	
}



int main() {
	int q;
	int l,r;
	cin >> q;
	eratos();
	like();
	for (int i=0;i<q;i++) {
	scanf("%d %d", &l, &r);
	printf("%d\n", cnt[r]-cnt[l-1]);
	}

/*	for (int i=0;i<=11;i++) {
	cout << "p "<<prime[i] << endl;
	cout << "c "<<cnt[i] << endl;
	}
*/
	return 0;
}


Compiler output:
a.cc: In function 'void like()':
a.cc:36:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   36 | int main() {
      |         ^~
a.cc:36:9: note: remove parentheses to default-initialize a variable
   36 | int main() {
      |         ^~
      |         --
a.cc:36:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:36:12: error: a function-definition is not allowed here before '{' token
   36 | int main() {
      |            ^
a.cc:53:2: error: expected '}' at end of input
   53 | }
      |  ^
a.cc:23:34: note: to match this '{'
   23 |         for (int i=3;i<MAX;i+=2) {
      |                                  ^
a.cc:53:2: error: expected '}' at end of input
   53 | }
      |  ^
a.cc:22:13: note: to match this '{'
   22 | void like() {
      |             ^
Language: C++

#pragma GCC optimize ("O3")
#include <istream>
#include <map>
#include <ostream>
namespace ac {
    using namespace std;
}
using namespace std;
using namespace ac;
namespace ac {
    template<typename T> map<T, bool> sieveOfEratosthenes(T n) {
        map<T, bool> res;
        res[0] = false;
        res[1] = false;
        for (size_t i = 2; i <= (size_t)n; i++) {
            res[i] = true;
        }
        // size_t p = 0;
        for (size_t i = 2; i <= (size_t)n; i++) {
            if (res[i]) {
                // prime[p++] = i;
                for (size_t j = 2 * i; j <= (size_t)n; j += i) {
                    res[j] = false;
                }
            }
        }
        return res;
    }
}
int table2017[100005];
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        int n;
        in >> n;
        auto s = sieveOfEratosthenes(100005);
        memset(table2017, 0, sizeof(table2017));
        for (int i = 1; i <= 100000; i++) {
            table2017[i] = (s[i] && s[(i + 1) / 2]) + table2017[i - 1];
        }
        for (int i = 0; i < n; i++) {
            int l, r, ans = 0;
            in >> l >> r;
            ans = table2017[r] - table2017[l - 1];
            out << ans << '\n';
        }
    }
};
void solve(std::istream& in, std::ostream& out) {
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


Compiler output:
a.cc: In member function 'void Solution::solve(std::istream&, std::ostream&)':
a.cc:36:9: error: 'memset' was not declared in this scope
   36 |         memset(table2017, 0, sizeof(table2017));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <map>
  +++ |+#include <cstring>
    4 | #include <ostream>
Language: C

#include <cstdio>
using namespace std;

int main()
{
  bool f[100000];
  int c[100000];

  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];

  int q, l, r;
  scanf("%d", &q);
  while (q--)
  {
    scanf("%d%d", &l, &r);
    printf("%d\n", c[r] - c[l - 1]);
  }

  return 0;
}


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

#include "stdafx.h"
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <map>
#include <algorithm>
#include <cmath>

std::list<unsigned int> Eratosthenes(int N) {
	std::list<unsigned int> search_list, prime_list;
	for (int i = 2; i <= N; i++) search_list.push_back(i);

	unsigned int p;
	while (1) {
		p = search_list.front();
		prime_list.push_back(p);
		search_list.pop_front();
		if (p > sqrt(N)) break;
		auto it = search_list.begin();
		auto prev_it = it;
		while(it != search_list.end()) {
			
			if (*it%p == 0) {
				search_list.erase(it);
				it = prev_it;
			}
			prev_it = it;
			++it;

		}
	}
	for (auto it = search_list.begin(); it != search_list.end(); ++it) {
		prime_list.push_back(*it);
	}
	return prime_list;
}

int main() {
	std::list<unsigned int> prime_list = Eratosthenes(100000);
	std::map<unsigned int, unsigned int> prime_map;

	int order = 1;
	for (auto it = prime_list.begin(); it != prime_list.end(); ++it) {
		prime_map[*it] = order++;
	}

	std::map<unsigned int, unsigned int> like2017_map;
	order = 1;
	for (auto it = prime_map.begin(); it != prime_map.end(); ++it) {
		if ((it->first + 1) % 2 == 0 && prime_map.find((it->first + 1) / 2) != prime_map.end()) {
			like2017_map[it->first] = order;
			order++;
		}
	}

	int Q;
	std::cin >> Q;
	for (int i = 0; i < Q; i++) {
		int l, r;
		std::cin >> l;
		std::cin >> r;
		//if (like2017_map.upper_bound(l) != like2017_map.end() && like2017_map.lower_bound(r) != like2017_map.end()) {
			//printf("%d %d %d %d\n", (like2017_map.lower_bound(r))->first, (like2017_map.upper_bound(l))->first,(like2017_map.lower_bound(r))->second, (like2017_map.upper_bound(l))->second);
			std::cout << std::max(static_cast<unsigned int>(0), (like2017_map.upper_bound(r))->second - (like2017_map.lower_bound(l))->second) << '\n';
		//}
		//else
		//	std::cout << 0 << '\n';
	}

	return 0;
}

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>

int isPrime[10001];

void screenScan(int &l, int &r){
    int count = 0;
    for(; l <= r; ++l) {
        int foo = (l + 1) / 2;
        if(IsPrime[l] || isPrime[foo]){
            ++count;
        }
    }
    std::cout << count << std::endl;
}

int main(){
    int q;
    std::cin >> q;
    int l[q], r[q];
    for(int i = 0; i < q; ++i){
        std::cin >> l[i] >> r[i];
    }
    IsPrime[0] = false;
    IsPrime[1] = false;
    for(size_t i = 2; i * i <= 10000; ++i)
        if(IsPrime[i])
            for(size_t j = 2; i * j <= 10000; ++j)
                IsPrime[i * j] = false;

    for(int i = 0; i < q; ++i){
        screenScan(l[i], r[i]);
    }
}

Compiler output:
a.cc: In function 'void screenScan(int&, int&)':
a.cc:9:12: error: 'IsPrime' was not declared in this scope; did you mean 'isPrime'?
    9 |         if(IsPrime[l] || isPrime[foo]){
      |            ^~~~~~~
      |            isPrime
a.cc: In function 'int main()':
a.cc:23:5: error: 'IsPrime' was not declared in this scope; did you mean 'isPrime'?
   23 |     IsPrime[0] = false;
      |     ^~~~~~~
      |     isPrime
Language: C++

//#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <map>
#include <vector>

using namespace std;



bool is_prime(int num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

bool is_nitakazu(int n) {
	if (is_prime(n)==true && is_prime((n + 1) / 2)==true) {
		return true;
	}
	else
	{
		return false;
	}
}


int main() {

	int n;
	int memo[100001];
	memo[1] = 0;
	
	memo[3] = 1;
	cin >> n;
	
	for (int i= 5; i < 100001; i+=2)
	{
		int temp;
		if (is_prime(i) == true) {
			temp = 1;
		}
		else {
			temp = 0;
		}
		memo[i] += temp;
	}

	int l, r;
	for (int i = 0; i < n; i++)
	{
		
		cin >> l >> r;
		cout << memo[r] - memo[l] + 1 << endl;
	}

	return 0;
}



Compiler output:
a.cc: In function 'bool is_prime(int)':
a.cc:17:26: error: 'sqrt' was not declared in this scope
   17 |         double sqrtNum = sqrt(num);
      |                          ^~~~
Language: C++

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

typedef long long ll;
const int ma = 100010;
ll notprime[ma] = { false };
ll sim2017[ma] = { 0 };
ll pref[ma] = { 0 };
void init()
{
	notprime[0] = notprime[1] = 1LL;
	for (int i = 2; i < ma; i++)
		if (!notprime[i])
		{
			if (i > ma / i)
				continue;
			for (int j = i * i; j < ma; j += i)
				notprime[j] = 1LL;
		}
	sim2017[0] = 0LL;
	for (int i = 1; i < ma-1; i++)
	{
		if (i % 2 == 0)
			sim2017[i] = 0LL;
		else
		{
			if ((!notprime[i]) && (!notprime[(i + 1) / 2]))
				sim2017[i] = 1LL;
		}
	}
	pref[0] = sim2017[0];
	for (int i = 1; i < ma;i++)
		pref[i] = pref[i - 1] + sim2017[i];
}
int main()
{
	ofstream f("out.txt");
	f << 10000 << endl;

	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	init();
	ll n;
	cin >> n;
	while (n--)
	{
		ll l, r;
		cin >> l >> r;
		cout << pref[r]-pref[l-1] << endl;
	}
	return 0;
}

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

#include <iostream>
#include <set>
using namespace std;
int main(){
    /*エラトステネスの篩----------------*/
    int i, j, k=0;
    int n[100000];
    set<int> p;
    for(i=0; i<100000; i++) n[i] = i;

    for(i=2; i<333; i++)
        if(n[i])
            for(j=2; i*j<100000; j++)
                n[i*j] = 0;

    for(i=2; i<100000; i++)
        if(n[i])
            p.insert(i);
    /*--------------------------------*/

    int Q, l, r;
    cin >> Q;
    for(int i=0; i<Q; i++){
        cin >> l >> r;
        int count=0;
        for(int j=l; j<=r; j+=2){
            decltype(p)::iterator it=p.find(j);
            if(it!=p.end()){
                int pn = *it;
                it = p.((pn+1)/2);
                if(it!=p.end())count++;
            }
        }
        cout<<count<<endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:24: error: expected unqualified-id before '(' token
   30 |                 it = p.((pn+1)/2);
      |                        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int q;
	cin >> q;
	int a[q];
	int b[q];
	for(int i=0;i<q;i++){
	cin >> a[i] >> b[i];
}
int c[100000];
c[0]=0;
c[1]=0;
	for(int j=2;j<100001;j++){
	c[j]=1;
}
	for(int k=2;k<100001;k=k+1){
	if(c[k]==1){
	for(int l=2*k;l<100001;l=l+k){
	c[l]=0;
}
}
int d[100000];
d[1]=0;
	for(int m=3;m<100001;m=m+2){
	if(c[m]==1&&c[(m+1)/2]==1){d[m]=d[m-2]+1;}
}
	for(int n=0;n<q;n++){
if(a[n]==1){
		cout << d[b[n]] << endl;
}
else{
		cout << d[b[n]]-d[a[n]-2] << endl;

}
}
}

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

#include <bits/stdc++.h>

using namespace std;

bool is_prime[100000];
bool is_prime_small[100000];

bool IsPrime(int num) {
  if(num < 2) return false;
  else if(num == 2) return true;
  else if(num % 2 == 0) return false;

  double sqrtNum = sqrt(num);
  for(int i = 3; i <= sqrtNum; i += 2) {
    if(num % i == 0) {
      return false;
    }
  }
  return true;
}

void segment_sieve(int a, int b) {
  for(int i = 0; i * i < b; i++) {
    is_prime_small[i] = true;
  }

  for(int i = 0; i < b - a; i++) {
    is_prime[i] = true;
  }

  for(int i = 2; i * i < b; i++) {
    if(is_prime_small[i]) {
      for(int j = 2 * i; j * j < b; j += i) {
	is_prime_small[j] = false;
      }
      for(int j = max(2, (a + i - 1) / i) * i; j < b; j += i) {
	is_prime[j - a] = false;
      }
    }
  }
  
}

int main(void) {
  int q;
  cin >> q;
  vector< pair<int, int> > lr;

  for(int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    lr.push_back(pair<int, int>(l, r));
  }

  for(int i = 0; i < q; i++) {
    int count2017 = 0;
    segment_sieve(lr[i].first, lr[i].second);
    for(int j = lr[i].first; j <= lr[i].second; j += 2) {
      if(is_prime[j - a] && IsPrime((j + 1) / 2)) {
	count2017++;
      }
    }
    cout << count2017 << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:23: error: 'a' was not declared in this scope
   59 |       if(is_prime[j - a] && IsPrime((j + 1) / 2)) {
      |                       ^
Language: C++

//#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <map>
#include <vector>

using namespace std;



bool is_prime(int num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

bool is_nitakazu(int n) {
	if (is_prime(n)==true && is_prime((n + 1) / 2)==true) {
		return true;
	}
	else
	{
		return false;
	}
}


int main() {

	int n;
	int memo[10001];
	for (int i = 0; i < 10001; i++)
	{
		memo[i] = -1;
	}
	cin >> n;
	int l, r;
	for (int i = 0; i < n; i++)
	{
		int sum = 0;
		cin >> l >> r;
		for (int j = l; j <= r; j++)
		{
			if(memo[j]==-1){
				if (is_nitakazu(j) == true) {
					sum++;
					memo[j] = 1;
				}
				else {
					memo[j] = 0;
				}
			}
			else {
				sum += memo[j];
			}
		}
		cout << sum << endl;


	}





	return 0;
}



Compiler output:
a.cc: In function 'bool is_prime(int)':
a.cc:17:26: error: 'sqrt' was not declared in this scope
   17 |         double sqrtNum = sqrt(num);
      |                          ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int q;
	cin >> q;
	int a[q];
	int b[q];
	for(int i=0;i<q;i++){
	cin >> a[i] >> b[i];
}
int c[100000];
int c[0]=0;
int c[1]=0;
	for(int j=2;j<100001;j++){
	c[j]=1;
}
	for(int k=2;k<100001;k=k+1){
	if(c[k]==1){
	for(int l=2*k;l<100001;l=l+k){
	c[l]=0;
}
}
int d[100000];
int d[1]=0;
	for(int m=3;m<100001;m=m+2){
	if(c[m]==1&&c[(m+1)/2]==1){d[m]=d[m-2]+1;}
}
	for(int n=0;n<q;n++){
if(a[n]==1){
		cout << d[b[n]] << endl;
}
else{
		cout << d[b[n]]-d[a[n]-2] << endl;

}
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: conflicting declaration 'int c [0]'
   13 | int c[0]=0;
      |     ^
a.cc:12:5: note: previous declaration as 'int c [100000]'
   12 | int c[100000];
      |     ^
a.cc:14:5: error: conflicting declaration 'int c [1]'
   14 | int c[1]=0;
      |     ^
a.cc:12:5: note: previous declaration as 'int c [100000]'
   12 | int c[100000];
      |     ^
a.cc:25:5: error: conflicting declaration 'int d [1]'
   25 | int d[1]=0;
      |     ^
a.cc:24:5: note: previous declaration as 'int d [100000]'
   24 | int d[100000];
      |     ^
a.cc:38:2: error: expected '}' at end of input
   38 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

//#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <map>
#include <vector>

using namespace std;



bool is_prime(const unsigned n) {
	switch (n) {
	case 0: // fall-through
	case 1: return false;
	case 2: // fall-through
	case 3: return true;
	} // n > 3 が保証された

	if (n % 2 == 0) return false;
	if (n % 3 == 0) return false;
	// 2と3の倍数でないので6の倍数ではないことが保証された

	if (n % 6 != 1 && n % 6 != 5) return false;
	// 6の倍数前後の数(素数かもしれない数)であることが保証された

	// 6の倍数前後の数を使って試し割りをする
	for (unsigned i = 5; i*i <= n; i += 6) {
		if (n%i == 0) return false; // 6n-1
		if (n % (i + 2) == 0) return false; // 6n+1
	}

	return true;
}

bool is_nitakazu(int n) {
	if (is_prime(n)==true && is_prime((n + 1) / 2)==true) {
		return true;
	}
	else
	{
		return false;
	}
}


int main() {

	int n;
	int memo[10000];
	memset(memo, -1, 10000);
	cin >> n;
	int l, r;
	for (int i = 0; i < n; i++)
	{
		int sum = 0;
		cin >> l >> r;
		for (int j = l; j <= r; j++)
		{
			if(memo[j]==-1){
				if (is_nitakazu(j) == true) {
					sum++;
					memo[j] = 1;
				}
				else {
					memo[j] = 0;
				}
			}
			else {
				sum += memo[j];
			}
		}
		cout << sum << endl;


	}





	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:50:9: error: 'memset' was not declared in this scope
   50 |         memset(memo, -1, 10000);
      |         ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <vector>
  +++ |+#include <cstring>
    6 |
Language: C++

#include <cstdio>
#include <cstring>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

const int maxn = 100000 + 20;

bool prime[maxn];

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

int presum[maxn];

void init()
{
    memset(prime, true, sizeof(prime));
    prime[0] = false;
    prime[1] = false;
    for(int i = 2; i < maxn; i++)
    {
        if(!prime[i])
        {
            continue;
        }
        if(isprime(i))
        {
            for(int j = 2; j * i < maxn; j++)
            {
                prime[j * i] = false;
            }
        }
        else
        {
            prime[i] = false;
        }
    }
    for(int i = 1; i < maxn; i++)
    {
        presum[i] = presum[i-1] + (prime[i] && prime[(i+1)/2]);
    }
}

int getsum(int l, int r)
{
    return presum[r] - presum[l - 1];
}

int main()
{
    init();
    int T;
    cin >> T;
    while(T--)
    {
        int l, r;
        scanf("%d%d", &l, &r);
        cout << getsum(l, r) << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'bool isprime(int)':
a.cc:14:13: error: 'sqrt' was not declared in this scope
   14 |     int t = sqrt(n);
      |             ^~~~
Language: Java

import java.util.Scanner;

public class ABC084D {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int q = sc.nextInt();
        boolean[] sieve = sieve(100000 + 10);

        for (int i = 0; i < q; i++) {
            int l = sc.nextInt();
            int r = sc.nextInt();

            int ans = 0;
            for (int j = l; j <= r; j += 2) {
                if (sieve[j] == true && sieve[(j + 1) / 2] == true) {
                    ans += 1;
                }
            }
            System.out.println(ans);
        }
    }

    public static boolean[] sieve(int n) {
        final boolean[] sieve = new boolean[n+1];
        sieve[0] = false;
        sieve[1] = false;
        sieve[2] = true;
        for (int i = 3; i <= n; i += 2) {
            sieve[i] = true;
        }

        for (int i = 3; i * i <= n; i += 2) {
            if (sieve[i]) {
                for (int j = i * 2; j <= n; j += i) {
                    sieve[j] = false;
                }
            }
        }

        return sieve;
    }
}


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

#include<iostream>
using namespace std;
int main() {
  	int Q;
  	cin >> Q;
  	long A[100000] = 1;
  	A[0] = 0;
  	A[1] = 0;
  	long s = 0;
  	for(long i = 3;	i <= 99999; i += 1) {
      	for(long j = 1; j <= i / 2; j += 1){
          	if(i % j != 0) s = 0;
        }
    }
  	for(int i = 1; i <= Q; i++){
      	int l, r;
      	cin >> l >> r;
      	int s = 0;
      	for(int j = l; j <= r; j++){
          	s += A[j];
        }
      	cout << s;
    }
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:26: error: array must be initialized with a brace-enclosed initializer
    6 |         long A[100000] = 1;
      |                          ^
Language: C++

#include<iostream>
using namespace std;
bool prime(int n)
{
	int k = (int)(sqrt(n)+1);
	bool ans = true;
	if (n == 1)
		return false;
	if (n == 2 || n == 3)
		return true;
	for (int i = 2; i <= k; i++)
	{
		if (n%i == 0)
		{
			ans = false;
		}
	}
	return ans;
}
bool zns(int n)
{
	if (prime(n) && (prime((n + 1) / 2)))
		return true;
	else
		return false;
}
int main()
{
	int n;
	cin >> n;
	while (n--)
	{
		int a, b, count = 0;
		cin >> a >> b;
		for (int i = a; i <= b; i++)
		{
			if (zns(i))
				count++;
		}
		cout << count << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'bool prime(int)':
a.cc:5:23: error: 'sqrt' was not declared in this scope
    5 |         int k = (int)(sqrt(n)+1);
      |                       ^~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
#define NUM 100000  // NUM以下の素数を求める
#define rep(i,n) for(int i=0;i<n;++i)
bool prime[NUM];

int eratos() {
	int i, j;
	int sq_num = (int)sqrt((double)NUM);

	// 1が立っているものが素数
	// 0が立っているものが合成数（素数ではない）

	for (i = 0; i < NUM; i++)
		prime[i] = 1;  // 全ての数に1を立てる
	prime[0] = 0;    // 1は素数ではない

	for (i = 1; i < sq_num; i++) {
		if (prime[i] == 1)          // prime[i]が素数なら
			for (j = (i + 1); (i + 1) * j <= NUM; j++)
				prime[(i + 1) * j - 1] = 0;  // 素数の倍数は素数ではない
	}



	return (0);
}
int main() {
	eratos();
	int q;
	cin >> q;
	rep(j ,q) {
		int r, l,cnt=0;
		cin >> l >> r;

		for (int i = l; i <= r; i += 2)
			if (prime[i - 1])
				if (prime[((i + 1) / 2) - 1])
					cnt++;
		cout << cnt<<endl;
	}

}

Compiler output:
a.cc: In function 'int eratos()':
a.cc:10:27: error: 'sqrt' was not declared in this scope
   10 |         int sq_num = (int)sqrt((double)NUM);
      |                           ^~~~
Language: C++

MAX_X = 100000

a = [True] * MAX_X
a[0] = a[1] = False

for (i, isprime) in enumerate(a):
    if isprime:
        for n in range(i*i, MAX_X, i):
            a[n] = False

pre = [0, 0]

for i in range(3, MAX_X + 1, 2):
    if a[i] and a[(i + 1) // 2]:
        pre.append(pre[-1] + 1)
    else:
        pre.append(pre[-1])

q = int(input())

for i in range(q):
    l, r = [int(i) for i in input().split()]
    print(pre[(r + 1) // 2] - pre[(l + 1) // 2 - 1])


Compiler output:
a.cc:1:1: error: 'MAX_X' does not name a type
    1 | MAX_X = 100000
      | ^~~~~