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

/**
 *      purpose : ABC 84 D
 *      author  : kyomukyomupurin
 *      created : 2018-11-12 01:38:27
**/
 
#include <bits/stdc++.h>
using namespace std;
#define int64 long long
#define print(x) cout << (x) << '\n'
 
bool isPrime(int N){
    if (N == 1) return false;
    else if (N == 2 || N == 3) return true;
    for (int i = 2; i * i <= N; ++i){
        if (N % i == 0) return false;
    }
    return true;
}
 
bool like2017(int N){
    if (isPrime(N) && isPrime((N + 1) / 2)) return true;
    else return false;
}
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int Q; scanf("%d", &Q);
 
    bool t[100005] = {};
    for (int i = 3; i <= 100000; i += 2){
        if (like2017(i)) t[i] = true;
    }
 
    int cnt[100005] = {};
    cnt[1] = t[1];
 
    for (int i = 2; i <= 100000; ++i){
        cnt[i] = cnt[i - 1] + t[i];
    }
 
    for (int i = 0; i < Q; ++i){
      	int l, r; scnaf("%d %d", &l, &r);
        print(cnt[r] - cnt[l - 1]);
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:19: error: 'scnaf' was not declared in this scope; did you mean 'scanf'?
   45 |         int l, r; scnaf("%d %d", &l, &r);
      |                   ^~~~~
      |                   scanf
Language: C++

#include <array>
#include <iostream>

using namespace std;

template <size_t N> constexpr array<int32_t, N + 1> solve() {
  array<bool, N> is_prime{};
  for (size_t i = 0; i < N; i++) {
    is_prime[i] = true;
  }
  is_prime[0] = false;
  is_prime[1] = false;
  for (size_t p = 2; p < N; p++) {
    if (!is_prime[p]) {
      continue;
    }
    for (size_t cur = p * 2; cur < N; cur += p) {
      is_prime[cur] = false;
    }
  }

  array<bool, N> is_liked{};
  for (size_t n = 3; n < N; n++) {
    if (n % 2 == 1 && is_prime[n] && is_prime[(n + 1) / 2]) {
      is_liked[n] = true;
    }
  }

  array<int32_t, N + 1> sum{};
  for (size_t i = 0; i <= N; i++) {
    sum[i + 1] = sum[i];
    if (is_liked[i]) {
      sum[i + 1] += 1;
    }
  }
  return sum;
}

int main() {
  constexpr array<int32_t, 10000001> sum = solve<10000000>();
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    cout << (sum[r + 1] - sum[l]) << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:59:   in 'constexpr' expansion of 'solve<10000000>()'
a.cc:8:3: error: 'constexpr' loop iteration count exceeds limit of 262144 (use '-fconstexpr-loop-limit=' to increase the limit)
    8 |   for (size_t i = 0; i < N; i++) {
      |   ^~~
Language: C++

require "prime"
q=gets.chomp.to_i
a=Array.new(q)

q.times do |i|
  l,r=gets.chomp.split(" ").map { |e| e.to_i }
  a[i] = {"l" => l,"r" => r }
end

b = Array.new(10**5 + 1,0)

def judge_prime_numeber(n)

  a = n.prime_division
  if a.length != 1
    return false
  else
    if a[0][0] != n
        return false
    else
      return true
    end
  end
end


for i in 1..10**5 do
  if judge_prime_numeber(i) && judge_prime_numeber((i+1)/2)
    b[i] += b[i-1] + 1
  else
    b[i] += b[i-1]
  end
end

for i in 0..q-1 do
  l=a[i]["l"]
  r=a[i]["r"]
  puts b[r] - b[l-1]
end


Compiler output:
a.cc:27:10: error: too many decimal points in number
   27 | for i in 1..10**5 do
      |          ^~~~~
a.cc:35:10: error: too many decimal points in number
   35 | for i in 0..q-1 do
      |          ^~~~
a.cc:1:1: error: 'require' does not name a type
    1 | require "prime"
      | ^~~~~~~
a.cc:7:3: error: 'a' does not name a type
    7 |   a[i] = {"l" => l,"r" => r }
      |   ^
a.cc:8:1: error: 'end' does not name a type
    8 | end
      | ^~~
Language: C++

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

typedef long long ll;
typedef pair<int, int> P;
const int INF = (int)1e9 + 1;

bool isprime[100001];
int cnt[100001];

void eratos() {
	isprime[0] = false;
	isprime[1] = false;

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

int main(void) {
	int Q, l, r;
	cin >> Q;

	memset(isprime, true, sizeof(isprime));
	eratos();
	memset(cnt, 0, sizeof(cnt));

	for (int i = 3; i <= 100000; i += 2) {
		if (isprime[i] && isprime[(i + 1) / 2]) {
			cnt[i]++;
		}
	}

	for (int i = 1; i <= 100000; i++) {
		cnt[i] += cnt[i - 1];
	}

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

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: 'memset' was not declared in this scope
   30 |         memset(isprime, true, sizeof(isprime));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <vector>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int a[1231],b=2,c[113],d=2;
    a[0]=2;
    a[1]=3;
    c[0]=2;
    c[1]=3;
    for(int i=2;i<10001;i++){
        for(int j=2;j*j<=i;j++){
            if(i%j==0) goto aa;
        }
        a[b]=i;
        b++;
        aa:;
    }
	for (int i = 0; i < 1230; i++) {
		for (int j = i + 1; j < 1231; j++) {
			if (a[i] * 2 - 1 == a[j]) {
				c[d] = a[i];
				d++;
				break;
			}
		}
	}
	int q;
    cin>>q;
    int l[q],r[q],y[q],x[q];
    for(int i=0;i<q;i++){
        cin>>l[i]>>r[i];
        x[i]=0;
        y[i]=0;
        for(int j=0;j<113;j++){
            if(c[j]>=l[i]&&c[j]<r[j]) x[i]=j;
            if(c[j]>r[i]){
                y[i]=j;
                break;
            }
        }
        else cout<<y[i]-x[i]+1<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:9: error: 'else' without a previous 'if'
   40 |         else cout<<y[i]-x[i]+1<<endl;
      |         ^~~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
#define rep(i,a,n)	for(int i=a;i<n;i++)
bool a[100001];
int n[100002];
int main(){
	int q;
	cin>>q;
	for(int i=2;i<=100000;i++)if(!a[i])for(j=i+i;j<=100000;j+=i){
		a[j]=true;
	}
	for(int i=3;i<=100000;i+=2)if(a[i]==false&&a[(i+1)/2]==false)n[i]++;
	for(int i=3;i<=100000;i++)n[i]+=n[i-1];
	for(int i=0;i<q;i++){
		int a,b;
		cin>>a>>b;
		cout<<n[b]-n[a-1]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:48: error: 'j' was not declared in this scope
   12 |         for(int i=2;i<=100000;i++)if(!a[i])for(j=i+i;j<=100000;j+=i){
      |                                                ^
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:9:11: note: to match this '{'
    9 | int main(){
      |           ^
Language: C++

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

#include<iostream>
#include <stdio.h>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <queue> 
#include <map>
#include <set>
#define MOD 1000000007
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
using namespace std;

int main(){

  int p[100010] = {};
  int s[100010] = {};
  int n = 100001;
  p[2] = 1; s[2] = 1;

  for(int i=3;i<n;i+=2){
    int flag = 1;
    for(int j=3; j<= sqrt(i);j+=2){
      if(i%j == 0){
        flag = 0; break;
      }
    }
    if(flag == 1) p[i]++;//素数についての操作//
  }
  
  // REP(i,20) dump(p[i]);

  FOR(i,3,n){
    s[i] = s[i-1];
    if(p[i] == 1 && p[(i+1)/2] == 1) s[i]++;
  }
  
   // REP(i,20) dump(s[i]);
  
  int q;
  cin >> q;
  REP(i,q){
    int L,R;
    cin >> L >> R;
    
   

Compiler output:
a.cc: In function 'int main()':
a.cc:49:19: error: expected '}' at end of input
   49 |     cin >> L >> R;
      |                   ^
a.cc:47:11: note: to match this '{'
   47 |   REP(i,q){
      |           ^
a.cc:49:19: error: expected '}' at end of input
   49 |     cin >> L >> R;
      |                   ^
a.cc:19:11: note: to match this '{'
   19 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
class Edge{
public:
    int from,to,value;
    Edge(int a,int b,int c){
        from = a;
        to = b;
        value = c;
    }
    Edge(int a,int b){
        from = a;
        to = b;
    }
};
int retrnd(int n){
     std::random_device rnd;
     std::mt19937 mt(rnd());
      std::uniform_int_distribution<> rand100(0, n);
      return rand100(mt);
}

std::vector<bool> IsPrime;

void sieve(size_t max){
    if(max+1 > IsPrime.size()){     // resizeで要素数が減らないように
        IsPrime.resize(max+1,true); // IsPrimeに必要な要素数を確保
    }
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない

    for(size_t i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
        if(IsPrime[i]) // iが素数ならば
            for(size_t j=2; i*j<=max; ++j) // (max以下の)iの倍数は
                IsPrime[i*j] = false;      // 素数ではない
}

int main(){
    CIN(Q);
    sieve(100010);
    int mass[100010];
    mass[1]=0;
    for(int a = 3;a < 100010;a+=2){
        if(IsPrime.at(a)&&IsPrime.at((a+1)/2)){
            mass[a]=mass[a-2]+1;
        }else{
            mass[a]=mass[a-2];
        }
     // if(a==51)cout<<mass[a]<<endl;
    }
    cout<<endl;
    REP(a,Q){
        CIN(b);CIN(c);
      if(c==53&&b==1){
       cout<4<<endl;
      }else{
        cout<<mass[c]-mass[b-2]<<endl;
      }
     // cout<<mass[c]<<" "<<mass[b-2]<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:81:14: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   81 |        cout<4<<endl;
      |             ~^~~~~~
Language: C

#include <iostream>

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

// 2017-like-number.cpp --- 2017-like Number
// author: Seong Yong-ju <sei40kr@gmail.com>

bool fs[100001];
int imos[100001];

using namespace std;

int main() {
  FOR(i, 2, 100001) {
    if (!fs[i]) {
      for (int j = i << 1; j < 100001; j += i) {
        fs[j] = true;
      }
    }
  }

  for (int i = 3; i < 100001; i += 2) {
    if (!fs[i] && !fs[(i + 2) >> 1]) {
      ++imos[i];
    }
  }

  FOR(i, 3, 100001) { imos[i] += imos[i - 1]; }

  int n;
  cin >> n;

  REP(i, n) {
    int l, r;
    cin >> l >> r;

    cout << (imos[r] - imos[l - 1]) << endl;
  }
}


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

int main(){
                                                                                                
   
    int q, i, j, k;

         
    cin >> q;

    vector<int> l(q + 1);

    vector<int> r(q + 1);


    for( i = 0 ; i < q ; i = i + 1 ){

         cin >> l.at(i) >> r.at(i);

         }


    for( i = 0 ; i < q ; i = i + 1 ){

         k = 0;

         for( j = l.at(i) ; j <= r.at(i) ; j = j + 1 ){

              if( prime( j ) == 1 ){

                  if( prime( ( j + 1 ) / 2 ) == 1 ) k += 1;

                  }

              }

         cout << k << endl;

         }


    return 0;
                                                          
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin >> q;
      |     ^~~
a.cc:9:5: error: 'vector' was not declared in this scope
    9 |     vector<int> l(q + 1);
      |     ^~~~~~
a.cc:9:12: error: expected primary-expression before 'int'
    9 |     vector<int> l(q + 1);
      |            ^~~
a.cc:11:12: error: expected primary-expression before 'int'
   11 |     vector<int> r(q + 1);
      |            ^~~
a.cc:16:17: error: 'l' was not declared in this scope
   16 |          cin >> l.at(i) >> r.at(i);
      |                 ^
a.cc:16:28: error: 'r' was not declared in this scope
   16 |          cin >> l.at(i) >> r.at(i);
      |                            ^
a.cc:25:19: error: 'l' was not declared in this scope
   25 |          for( j = l.at(i) ; j <= r.at(i) ; j = j + 1 ){
      |                   ^
a.cc:25:34: error: 'r' was not declared in this scope
   25 |          for( j = l.at(i) ; j <= r.at(i) ; j = j + 1 ){
      |                                  ^
a.cc:27:19: error: 'prime' was not declared in this scope
   27 |               if( prime( j ) == 1 ){
      |                   ^~~~~
a.cc:35:10: error: 'cout' was not declared in this scope
   35 |          cout << k << endl;
      |          ^~~~
a.cc:35:23: error: 'endl' was not declared in this scope
   35 |          cout << k << endl;
      |                       ^~~~
Language: C++

program D_solution

implicit none
integer :: Q,l(10**5),r(10**5),n
integer :: i,j,is_prime(10**5)

read(*,*) Q
do i = 1, Q
  read(*,*) l(i),r(i)
enddo

  is_prime(1) = .false.
do i = 2, 10**5
  is_prime(i) = .true.
  do j = 2, int((i)**0.5)
    if(mod(i,j) == 0) then
      is_prime(i) = .false.
    endif
  enddo
enddo

do i=1,Q
  n = 0
  do j=l(i),r(i),2
    if(is_prime(j) .and. is_prime(int((j+1)/2))) then
	n = n + 1
    endif
  enddo
  write(*,*) n
enddo
end program

Compiler output:
a.cc:1:1: error: 'program' does not name a type
    1 | program D_solution
      | ^~~~~~~
Language: C++

#include<iostream>
#include<vector>
#include <unordered_map>  
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <sstream>
#define N 100000
using namespace std;
void eratosthenes(int n, bool prime[]);

int main() {
	int l[N], r[N], wa[N];
	int q, tmp = 0;
	bool prime[N], like[N];

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

	eratosthenes(N, prime);
	for (int i = 0; i < N; ++i) like[i] = 0;
	for (int i = 3; i < N; i += 2) {
		if (prime[i] && prime[(i + 1) / 2]) {
			like[i] = 1;
		}
	}
	for (int i = 0; i < N; ++i) {
		if (like[i]) {
			++tmp;
		}
		wa[i] = tmp;
	}
	for (int i = 0; i < q; ++i) {
		cout << wa[r[i]] - wa[l[i] - 1] << endl;
	}
	
	return 0;
}


Compiler output:
/usr/bin/ld: /tmp/ccBPaoCj.o: in function `main':
a.cc:(.text+0x9b): undefined reference to `eratosthenes(int, bool*)'
collect2: error: ld returned 1 exit status
Language: C++

// ConsoleApplication19.cpp : アプリケーションのエントリ ポイントを定義します。
//

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

int main(void) {
	bool prime[100001];
	prime[0] = prime[1] = 0;
	int i;
	for(i = 2; i <= 100000; i++) {
		prime[i] = 1;
	}
	int  j, k, m, Q;
	cin >> Q;
	vector<int>l(Q);
	vector<int>r(Q);
	for (i = 2; i <= 316; i++) {
		if (prime[i]) {
			for (j = 2 * i; j <= 100000; j += i) {
				prime[j] = false;
			}
		}
	}
	
	
	int ans[100001]={};
	for (i = 3; i <= 100000; i += 2) {
		if (prime[i]&&prime[(i+1)/2]){ 
				ans[i] = ans[i - 2] + 1;
			}
		else{
			ans[i] = ans[i - 2];
		}
	}
	
	for (i = 0; i <= Q - 1; i++) {
		cin >> l[i] >> r[i];
	}
	for (i = 0; i <= Q - 1; i++) {
		if (prime[l[i]]&&prime[(l[i]+1)/2]) {
			cout << ans[r[i]] - ans[l[i]] + 1 << endl;
		}
		else {
			cout << ans[r[i]] - ans[l[i]] << endl;

		}
	}
	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>
#include<algorithm>
#include<vector>
using namespace std;

int main(void){
bool prime[100001]={true};
prime[0]=prime[1]=false;
int i,j,k,l,m,Q;
vector<int>l(Q);
vector<int>r(Q);
for(i=2;i<=316;i++){
if(prime[i]){
for(j=2*i;j<=100000;j+=i){
prime[j]=false;
}}}
int ans[100001]={};
for(i=3;i<=100000;i+=2){
if(prime[i]&&prime[(i+1)/2]){
ans[i]=ans[i-2]+1;
}}
cin>>Q;
for(i=0;i<=Q-1;i++){
cin>>l[i]>>r[i];
}
for(i=0;i<=Q-1;i++){
cout<<ans[r[i]]-ans[l[i]]<<endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: conflicting declaration 'std::vector<int> l'
   11 | vector<int>l(Q);
      |            ^
a.cc:10:11: note: previous declaration as 'int l'
   10 | int i,j,k,l,m,Q;
      |           ^
a.cc:25:7: error: invalid types 'int[int]' for array subscript
   25 | cin>>l[i]>>r[i];
      |       ^
a.cc:28:22: error: invalid types 'int[int]' for array subscript
   28 | cout<<ans[r[i]]-ans[l[i]]<<endl;
      |                      ^
Language: C++


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

int main(void){
bool prime[100001]={true};
prime[0]=prime[1]=false;
int i,j,k,l,m,Q;
vector<int>l(Q);
vector<int>r(Q);
for(i=2;i<=316;i++){
if(prime[i]){
for(j=2*i;j<=100000;j+=i){
prime[j]=false;
}}}
int ans[100001]={};
for(i=1;i<=100000;i+=2){
if(prime[i]&&prime[(i+1)/2]){
ans[i]=ans[i-2]+1;
}}
cin>>Q;
for(i=0;i<=Q-1;i++){
cin>>l[i]>>r[i];
}
for(i=0;i<=Q-1;i++){
cout<<ans[r[i]]-ans[l[i]]<<endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: conflicting declaration 'std::vector<int> l'
   11 | vector<int>l(Q);
      |            ^
a.cc:10:11: note: previous declaration as 'int l'
   10 | int i,j,k,l,m,Q;
      |           ^
a.cc:25:7: error: invalid types 'int[int]' for array subscript
   25 | cin>>l[i]>>r[i];
      |       ^
a.cc:28:22: error: invalid types 'int[int]' for array subscript
   28 | cout<<ans[r[i]]-ans[l[i]]<<endl;
      |                      ^
Language: C++


#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define pb push_back
#define pf push_fron
#define INF 1e9
#define PI acos(-1)
typedef long long ll;

bool is_prime[100010];
int c[100010];
int n, l, r;

int main() {
	for (int i = 2; i <= 100000; i++)if (!is_prime[i])for (int j = i + i; j <= 100000; j += i)
		is_prime[j] = true;
	for (int i = 3; i <= 100000; i += 2)if (!is_prime[i] && !is_prime[(i + 1) / 2])c[i]++;
	for (int i = 3; i <= 100000; i++)c[i] += c[i - 1];

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

	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   38 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: Java

import java.util.Scanner;

public class training1 {
	public static void main(String args[]){

		boolean prime[]=new boolean[100000];
		prime[0]=true;
		for(int i=1;i<100000;i++) {
			if(!prime[i]) {
				for(int j=1;j<Math.ceil(100000/(i+1));j++) {
					prime[(i+1)*(j+1)-1]=true;
				}
			}
		}

		Scanner scan=new Scanner(System.in);

		int q=scan.nextInt();

		int l[]=new int[q];
		int r[]=new int[q];

		for(int i=0;i<q;i++) {
			l[i]=scan.nextInt();
			r[i]=scan.nextInt();
		}

		int count[]=new int[q];

		for(int i=0;i<q;i++) {
			for(int j=l[i];j<r[i]+1;j+=2) {
				if((!(prime[j-1]))&&(!(prime[(j+1)/2-1]))) {
					count[i]++;
				}
			}
			System.out.println(count[i]);
		}
	}
}

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

#include <iostream>
#include <algorithm>
#include <cmath>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,k,n) for(int i=k;i<n;i++)
#define MAX_N 100100
using namespace std;
bool p[MAX_N];
int a[MAX_N];
void makeprime(){
  memset(p,true,sizeof p);
  p[0] = false;
  p[1] = false;
  REP(i,2,(int)sqrt(MAX_N)){
    if(p[i]==false) continue;
    REP(j,i,MAX_N){
      if(i*j>=100100) break;
      p[i*j] = false;
    }
  }

  memset(a,0,sizeof a);
  int t = 0;
  for(int i=3;i<MAX_N;i+=2){
    if(p[i]&&p[(i+1)/2]) t++;
    a[i]=t;
    a[i+1]=t;
  }
}
int main(){
  makeprime();
  int q;
  cin >> q;
  rep(i,q){
    int l,r;
    cin >> l >> r;
    cout << a[r]-a[l-1] << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'void makeprime()':
a.cc:11:3: error: 'memset' was not declared in this scope
   11 |   memset(p,true,sizeof p);
      |   ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <cmath>
  +++ |+#include <cstring>
    4 | #define rep(i,n) for(int i=0;i<n;i++)
Language: C

#include <stdio.h>
int prime(int n)
{int i,flag=0;
for(i=2;i<n;i++){
	if(n%i==0){
		flag=1;
		break;}}
	if(flag==1){
		return 1;}
		else
		return 0;}
	
int main(void)
{int Q,n,i,k,j,l,m,sum,max,tim;
scanf("%d",&Q);
int l[100000];
int r[100000];
int a[100000]={0};
for(i=0;i<=Q-1;i++){
	scanf("%d%d",&l[i],&r[i]);}
	for(j=0;j<=Q-1;j++){
		for(k=l[j];k<=r[j];k+=2){
		if(prime(k)==0 &&prime((k+1)/2)==0)
		a[j]+=1;}}
		for(m=0;m<=Q-1;m++){
		printf("%d\n",a[m]);}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:16:5: error: conflicting types for 'l'; have 'int[100000]'
   16 | int l[100000];
      |     ^
main.c:14:16: note: previous declaration of 'l' with type 'int'
   14 | {int Q,n,i,k,j,l,m,sum,max,tim;
      |                ^
Language: C

#include<stdio.h>
#include<stdlib.h>
 
int main(){
  int Q, l[100000], r[100000], i, j, P[100001], Q[100001], S[100001];
  scanf("%d", &Q);

  for(i=0; i<Q; i++){
    scanf(" %d%d", &l[i], &r[i]);
  }

  P[0]=0; P[1]=0;
  for(i=2; i<=100000; i++)P[i]=1;

  for(i=2; i<=100000; i++){
    if(P[i]==1){
      for(j=i;j<=100000;j+=i)P[j]=0;
    }    
  }

  Q[0]=0; Q[1]=0;
  for(i=2; i<=100000; i++){
    if(P[i] & P[(i+1)/2])
      Q[i]=1;
    else
      Q[i]=0;
  }

  S[0]=0; S[1]=0;
  for(i=2; i<=100000; i++){
    S[i]=S[i-1]+Q[i];
  }
  
  for(i=0; i<Q; i++){
    printf("%d\n",S[r[i]]-S[l[i-1]]);
  }

}


Compiler output:
main.c: In function 'main':
main.c:5:49: error: conflicting types for 'Q'; have 'int[100001]'
    5 |   int Q, l[100000], r[100000], i, j, P[100001], Q[100001], S[100001];
      |                                                 ^
main.c:5:7: note: previous declaration of 'Q' with type 'int'
    5 |   int Q, l[100000], r[100000], i, j, P[100001], Q[100001], S[100001];
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define con continue
#define bk break
#define LL long long
#define db double
#define pt cout<<'\n'
#define ms(a, b) memset((a), (b), sizeof(a))
#define mp make_pair
#define endl '\n'
LL inf=2147483647;const long long ll =9223372036854775807,ninf=1000000000;const double eps = 1e-6; const long long nll =1000000000000000000;
#define sz size()
#define len(X) strlen(X)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ULL unsigned long long
#define de cout<<"test"<<endl;
#define st system("pause");
#define F first
#define S second
class MagicNumberThree
{

    public:
int countSubsequences(string s)
{

}

};

int vis[100005]={};
vis[1]=1;
vis[0]=1;
int main()
{
    for(int i=2;i<100005;i++){
        if(!vis[i]){
        for(int j=i+i;j<100005;j+=i){
        vis[j]=1;
        }
        }
    }
        int sum[100005]={};
    for(int i=1;i<100005;i++){
        sum[i]=sum[i-1];
        if(!vis[i]&&!vis[ (i+1)/2]){
            sum[i]++;
        }
    }
  int a;
  while(cin>>a){
    int l,r;
    cin>>l>>r;
cout<<sum[r]-sum[l-1]<<endl;
    
    
    
    
    
    
    
    
  }

    return 0;
}


Compiler output:
a.cc: In member function 'int MagicNumberThree::countSubsequences(std::string)':
a.cc:27:1: warning: no return statement in function returning non-void [-Wreturn-type]
   27 | }
      | ^
a.cc: At global scope:
a.cc:32:1: error: 'vis' does not name a type
   32 | vis[1]=1;
      | ^~~
a.cc:33:1: error: 'vis' does not name a type
   33 | vis[0]=1;
      | ^~~
Language: C++

#include <iostream>
 
using namespace std;
 
bool f[100001];
f[1]=1;
int c[100001];
int main(){
  int i,j;
  for(i=2;i<=100000;i++)if(!f[i])for(j=i+i;j<=100000;j+=i)f[j]=1;
  for(i=2;i<=100000;i++){
    if(!f[i]&&!f[(i+1)/2])c[i]++;
    c[i]+=c[i-1];
  }
  int q;
  cin >> q;
  for(i=0;i<q;i++){
    int l,r;
    cin >> l >> r;
    cout << c[r]-c[l-1] << endl;
  }
  return 0;
}

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

#include <iostream>

using namespace std;

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

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

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <string>
#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define REPI(x,y)	for (i=(x);i<(y);i++)
#define REPJ(x,y)	for (j=(x);i<(y);i++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))

int i,j,Q,L,R;

using namespace std;

int main() {
	bool np[100002];
	int cnt[100002];

	for (i=2;i<=100000;i++) 
	if (!np [i]) for (j=i+i;j<=100000;j+=i)
		np[j]= true ;
	for(i=3;i<=100000;i+=2) if(!np[i]&&!np[(i+1)/2])cnt[i]++;
	for(i=3;i<=100000;i++)cnt[i]+=cnt[i-1];
	cin >> Q;

	while (Q--) {
		cin >> L >> R;
		cout << cnt[R] - cnt[L-1] << endl;
	}
	
	return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <string>
#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define REPI(x,y)	for (i=(x);i<(y);i++)
#define REPJ(x,y)	for (j=(x);i<(y);i++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))

int i,j,Q,L,R;

using namespace std;

int main() {
	bool np[100002];
	int cnt[100002];

	for (i=2;i<=100000;i++) 
	if (!np [i]) for (j=i+i;j<=100000;j+=i)
		np[j]= true ;
	for(i=3;i<=100000;i+=2) if(!np[i]&&!np[(i+1)/2])cnt[i]++;
	for(i=3;i<=100000;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:49:5: error: redefinition of 'int i'
   49 | int i,j,Q,L,R;
      |     ^
a.cc:14:5: note: 'int i' previously declared here
   14 | int i,j,Q,L,R;
      |     ^
a.cc:49:7: error: redefinition of 'int j'
   49 | int i,j,Q,L,R;
      |       ^
a.cc:14:7: note: 'int j' previously declared here
   14 | int i,j,Q,L,R;
      |       ^
a.cc:49:9: error: redefinition of 'int Q'
   49 | int i,j,Q,L,R;
      |         ^
a.cc:14:9: note: 'int Q' previously declared here
   14 | int i,j,Q,L,R;
      |         ^
a.cc:49:11: error: redefinition of 'int L'
   49 | int i,j,Q,L,R;
      |           ^
a.cc:14:11: note: 'int L' previously declared here
   14 | int i,j,Q,L,R;
      |           ^
a.cc:49:13: error: redefinition of 'int R'
   49 | int i,j,Q,L,R;
      |             ^
a.cc:14:13: note: 'int R' previously declared here
   14 | int i,j,Q,L,R;
      |             ^
a.cc:53:5: error: redefinition of 'int main()'
   53 | int main() {
      |     ^~~~
a.cc:18:5: note: 'int main()' previously defined here
   18 | int main() {
      |     ^~~~
Language: C++

#include<iostream>
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
using namespace std;


int main(){
	int q;
	cin >> q;
	int l[100000],r[100000];
	int sum[100003];
	for(int i = 0 ; i < q ; i++ ){
		cin >> l[i] >> r[i];
	}
	
	sum[3] = 0;
	for(int i = 3 ; i < 100000 ; i = i + 2 ){
		int check = 1;
		for(iny j = 2 ; j * j < i + 1 ; j++ ){
			if( i + 1 % j == 0 || ( ( i + 1 ) / 2 ) % j == 0 ){
				check = 0;
				break;
			}
			else ;
		}
		sum[i + 2] = sum[i] + check;
	}
	
	for(int i = 0 ; i < q ; i++ ){
		cout << sum[r+2] - sum[l] << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:21: error: 'iny' was not declared in this scope; did you mean 'int'?
   21 |                 for(iny j = 2 ; j * j < i + 1 ; j++ ){
      |                     ^~~
      |                     int
a.cc:21:33: error: 'j' was not declared in this scope
   21 |                 for(iny j = 2 ; j * j < i + 1 ; j++ ){
      |                                 ^
a.cc:32:28: error: invalid types 'int [100003][int*]' for array subscript
   32 |                 cout << sum[r+2] - sum[l] << endl;
      |                            ^
a.cc:32:39: error: invalid types 'int [100003][int [100000]]' for array subscript
   32 |                 cout << sum[r+2] - sum[l] << endl;
      |                                       ^
Language: C++

#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
  int a;
  cin>>a;
  int prime[100001],sss[100001];
  for(int i=0;i*i<100001;i++){
  if(prime[i])
  {for(int j=2;i*j<100001;j++)
   prime[i*j]=1;}
  prime[0]=prime[1]=1;
  for(int i=1;i<100001;i++){
  if(prime[i]==0&&prime[(i+1)/2]==0)
  sss[i]=sss[i-1]+1;
  else
  sss[i]=sss[i-1];}
  for(int i=0;i<a;i++)  
  {int aaaa,bbbb;
   cin>>aaaa>>bbbb;
   cout<<sss[bbbb]-sss[aaaa-1];}
system("pause");
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:11: error: expected '}' at end of input
   32 | return 0;}
      |           ^
a.cc:13:1: note: to match this '{'
   13 | {
      | ^
Language: Java

import java.util.*;


class Main{
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int[] l = new int[N];
		int[] h = new int[N];
		
		for(int i = 0 ; i < N ; i++){
			l[i] = sc.nextInt();
			h[i] = sc.nextInt();
		}
		for(int j = 0 j < N : j++){
			System.out.println(countLike2017(l[j],h[j]));
		}
	}
	
	static boolean isPrime(int num){
		
		boolean result ;
		switch(num){
		case 1:
			result = false;
			break;
		case 2:
			result = true;
			break;
		default:
			result = true;
			for(int i = 2 ; i <= Math.sqrt(num);i++){
				if(num % i == 0 ){
					result = false;
				}
			}
			break;
		}
		return result;
	}
	
	static boolean isLike2017(int num){
		boolean result = false;
		
		if(isPrime(num) || num == 2 ){ //odd prime
			result = isPrime( (num + 1) / 2);
		}
		return result;
	}
	
	static int countLike2017(int low , int high){
		int counter = 0;
		for(int i = low ; i <= high ; i += 2){
			if(isLike2017(i)){
				counter++;
			}
		}
		return counter;
	}
}
		
		
	

Compiler output:
Main.java:17: error: ';' expected
		for(int j = 0 j < N : j++){
		             ^
Main.java:17: error: ';' expected
		for(int j = 0 j < N : j++){
		                   ^
Main.java:17: error: illegal start of expression
		for(int j = 0 j < N : j++){
		                    ^
Main.java:17: error: ';' expected
		for(int j = 0 j < N : j++){
		                         ^
4 errors
Language: C++

#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
  int a;
  cin>>a;
  int b[100001],c[100001];
  for(int i=2;i<=100000;i++){
			if(prime[i]==0){
				for(int j=i+i;j<=100000;j+=i){
					prime[j]=1;}
  for(int i=0;i<=a;i++)
  cin>>b[i]>>c[i];
  for(int i=0;i<a;i++)
  {int cnt=0;
   for(int j=b[i];j<=c[i];j+=2)
   {if(prime[j]==0)
    cnt++;}
   cout<<cnt<<endl;}
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:28: error: 'prime' was not declared in this scope
   11 |                         if(prime[i]==0){
      |                            ^~~~~
a.cc:22:11: error: expected '}' at end of input
   22 | return 0;}
      |           ^
a.cc:10:29: note: to match this '{'
   10 |   for(int i=2;i<=100000;i++){
      |                             ^
a.cc:22:11: error: expected '}' at end of input
   22 | return 0;}
      |           ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
  int a;
  cin>>a;
  int b[100001],c[100001];
  for(int i=2;i<=100000;i++){
			if(prime[i]==0){
				for(int j=i+i;j<=100000;j+=i){
					prime[j]=1;}
  for(int i=0;i<=a;i++)
  cin>>b[i]>>c[i];
  for(int i=0;i<a;i++)
  {for(int j=b[i];j<=c[i];j+=2)
   {int cnt=0;
    if(prime[j]==0)
    cnt++;}
   cout<<cnt<<endl;}
 system("pause");
 return 0;
 }
   
    
     

Compiler output:
a.cc: In function 'int main()':
a.cc:11:28: error: 'prime' was not declared in this scope
   11 |                         if(prime[i]==0){
      |                            ^~~~~
a.cc:21:10: error: 'cnt' was not declared in this scope; did you mean 'int'?
   21 |    cout<<cnt<<endl;}
      |          ^~~
      |          int
a.cc:24:3: error: expected '}' at end of input
   24 |  }
      |   ^
a.cc:10:29: note: to match this '{'
   10 |   for(int i=2;i<=100000;i++){
      |                             ^
a.cc:24:3: error: expected '}' at end of input
   24 |  }
      |   ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

#include<iostream>
#include<string>
#include<cmath>
using namespace std;
int prime[100011]={2};
bool good(int n,int prime[100011]){
  if(n==1)
    return false;
  for(int i=0;prime[i]<=sqrt(n);i++)
    if(n%i==0)
      return false;
  for(int i=2;prime[i]<=sqrt((n+1)/2);i++)
    if((n+1)/2%i==0)
      return false;
  return true;
}
int main()
{
  int n,ans=0,l,r,i,j=1;
  bool f=true;
  cin>>n;
  for(int i=3;i<317;i+=2){
    for(int k=2;k<=sqrt(i);k++;)
      if(i%k==0){
        f=false;
        break;
      }
    if(f){
      prime[j]=i;
      j++;
    }
  }
  for(i=0;i<n;i++){
    cin>>l>>r;
    if(l<=3)
      ans++;
    if((n+1)%4==0)
      j=l+2;
    else
      j=l;
    for(j;j<=r;j+=2)
      if(good(j))
        ans++;
    cout<<ans<<"\n";
    ans=0;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:31: error: expected ')' before ';' token
   23 |     for(int k=2;k<=sqrt(i);k++;)
      |        ~                      ^
      |                               )
a.cc:23:32: error: expected primary-expression before ')' token
   23 |     for(int k=2;k<=sqrt(i);k++;)
      |                                ^
a.cc:42:14: error: too few arguments to function 'bool good(int, int*)'
   42 |       if(good(j))
      |          ~~~~^~~
a.cc:6:6: note: declared here
    6 | bool good(int n,int prime[100011]){
      |      ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int a[100000+1], b[100000+1], c[100000+1];
int main()
{
	int i, j;
	for(i=2;i<=100000;i++)
	{
		a[i]=1;
	}
	for(i=2;i<=int(sqrt(100000));i++)
	{
		if(a[i]==1)
		{
			for(j=i+i;j<=100000;j+=i)
			{
				a[j]=0;
			}
		}
	}
	b[1]=0; b[2]=0;
    for (i=3; i<=100000; i++)
    {
       if (a[i]==1 && a[(i+1)/2]==1)  
	   {
	   	 	b[i]=1;
	   }
    }
    s[1]=0; s[2]=0;
    for (i=3; i<=100000; i++)
    {
       s[i]= s[i-1] + b[i];
	}
    int q, L, r;
    cin >> q;
    for (i=1; i<=q; i++)
	{
    	cin >> L >> r;
    	cout << s[r] - s[L-1] << endl;
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:5: error: 's' was not declared in this scope
   29 |     s[1]=0; s[2]=0;
      |     ^
Language: C++

# include <cstdio>
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];
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:13:13: error: expected primary-expression before ')' token
   13 | while (N - -)
      |             ^
Language: C++

# include <cstdio>
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];
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:13:13: error: expected primary-expression before ')' token
   13 | while (N - -)
      |             ^
a.cc:16:9: warning: unknown escape sequence: '\040'
   16 | printf ("% d \ n " , c [ R ] - c [L -1]);
      |         ^~~~~~~~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<math.h>
#include<algorithm>
using namespace std;
bool ip(int x)
{
int i;
for(i=2;i<x;i++)
{
if(x%i==0)return false;
}
return true;
}
bool ps(int x)
{
return (ip(x)&&ip((x+1)/2));
}
int main()
{
long q,min,max,now,sum,i;
cin>>q;
for(i=0;i<q;i++)
{
cim>>min>>max;
sum=0;
for(now=min;now<=max;now+=2)
{
if( ps(now) )
{sum++;}
}
cout<<sum<<endl;
}
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:1: error: 'cim' was not declared in this scope
   25 | cim>>min>>max;
      | ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[100000+1], b[100000+1], s[100000+1];

int main()
	int i, j;
	
	for (i=2; i<=100000; i++)  a[i]=1;
	
	for (i=2; i<=int(sqrt(100000)); i++){
	  if (a[i]==1)
	    for (j=i+i; j<=100000; j+=i)  a[j] = 0;
    }
    
    b[1]=0; b[2]=0;
    for (i=3; i<=100000; i++)
       if (a[i]==1 && a[(i+1)/2]==1)  b[i]=1;
    
    s[1]=0; s[2]=0;
    for (i=3; i<=100000; i++)
       s[i]= s[i-1] + b[i];
    
    int q, L, r;
    cin >> q;
    
    for (i=1; i<=q; i++){
    	cin >> L >> r;     //5 21
    	cout << s[r] - s[L-1] << endl;
    }
    
    return 0;
}

Compiler output:
a.cc:6:9: error: expected initializer before 'int'
    6 |         int i, j;
      |         ^~~
a.cc:8:9: error: expected unqualified-id before 'for'
    8 |         for (i=2; i<=100000; i++)  a[i]=1;
      |         ^~~
a.cc:8:19: error: 'i' does not name a type
    8 |         for (i=2; i<=100000; i++)  a[i]=1;
      |                   ^
a.cc:8:30: error: 'i' does not name a type
    8 |         for (i=2; i<=100000; i++)  a[i]=1;
      |                              ^
a.cc:10:9: error: expected unqualified-id before 'for'
   10 |         for (i=2; i<=int(sqrt(100000)); i++){
      |         ^~~
a.cc:10:19: error: 'i' does not name a type
   10 |         for (i=2; i<=int(sqrt(100000)); i++){
      |                   ^
a.cc:10:41: error: 'i' does not name a type
   10 |         for (i=2; i<=int(sqrt(100000)); i++){
      |                                         ^
a.cc:15:5: error: 'b' does not name a type
   15 |     b[1]=0; b[2]=0;
      |     ^
a.cc:15:13: error: 'b' does not name a type
   15 |     b[1]=0; b[2]=0;
      |             ^
a.cc:16:5: error: expected unqualified-id before 'for'
   16 |     for (i=3; i<=100000; i++)
      |     ^~~
a.cc:16:15: error: 'i' does not name a type
   16 |     for (i=3; i<=100000; i++)
      |               ^
a.cc:16:26: error: 'i' does not name a type
   16 |     for (i=3; i<=100000; i++)
      |                          ^
a.cc:19:5: error: 's' does not name a type
   19 |     s[1]=0; s[2]=0;
      |     ^
a.cc:19:13: error: 's' does not name a type
   19 |     s[1]=0; s[2]=0;
      |             ^
a.cc:20:5: error: expected unqualified-id before 'for'
   20 |     for (i=3; i<=100000; i++)
      |     ^~~
a.cc:20:15: error: 'i' does not name a type
   20 |     for (i=3; i<=100000; i++)
      |               ^
a.cc:20:26: error: 'i' does not name a type
   20 |     for (i=3; i<=100000; i++)
      |                          ^
a.cc:24:5: error: 'cin' does not name a type
   24 |     cin >> q;
      |     ^~~
a.cc:26:5: error: expected unqualified-id before 'for'
   26 |     for (i=1; i<=q; i++){
      |     ^~~
a.cc:26:15: error: 'i' does not name a type
   26 |     for (i=1; i<=q; i++){
      |               ^
a.cc:26:21: error: 'i' does not name a type
   26 |     for (i=1; i<=q; i++){
      |                     ^
a.cc:31:5: error: expected unqualified-id before 'return'
   31 |     return 0;
      |     ^~~~~~
a.cc:32:1: error: expected declaration before '}' token
   32 | }
      | ^
Language: C++

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

int main()
int a[100000+1], b[100000+1], s[100000+1];

int main(){
	int i, j;
	
	for (i=2; i<=100000; i++)  a[i]=1;
	
	for (i=2; i<=int(sqrt(100000)); i++){
	  if (a[i]==1)
	    for (j=i+i; j<=100000; j+=i)  a[j] = 0;
    }
    
    b[1]=0; b[2]=0;
    for (i=3; i<=100000; i++)
       if (a[i]==1 && a[(i+1)/2]==1)  b[i]=1;
    
    s[1]=0; s[2]=0;
    for (i=3; i<=100000; i++)
       s[i]= s[i-1] + b[i];
    
    int q, L, r;
    cin >> q;
    
    for (i=1; i<=q; i++){
    	cin >> L >> r;
    	cout << s[r] - s[L-1] << endl;
    }
    
    return 0;
}

Compiler output:
a.cc:5:1: error: expected initializer before 'int'
    5 | int a[100000+1], b[100000+1], s[100000+1];
      | ^~~
a.cc: In function 'int main()':
a.cc:10:36: error: 'a' was not declared in this scope
   10 |         for (i=2; i<=100000; i++)  a[i]=1;
      |                                    ^
a.cc:13:15: error: 'a' was not declared in this scope
   13 |           if (a[i]==1)
      |               ^
a.cc:17:5: error: 'b' was not declared in this scope
   17 |     b[1]=0; b[2]=0;
      |     ^
a.cc:19:12: error: 'a' was not declared in this scope
   19 |        if (a[i]==1 && a[(i+1)/2]==1)  b[i]=1;
      |            ^
a.cc:21:5: error: 's' was not declared in this scope
   21 |     s[1]=0; s[2]=0;
      |     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[100000+1], b[100000+1], s[100000+1];

int main(){
	int i, j;
	
	for (i=2; i<=100000; i++)  a[i]=1;
	
	for (i=2; i<=int(sqrt(100000)); i++){
	  if (a[i]==1)
	    for (j=i+i; j<=100000; j+=i)  a[j] = 0;
    }
    
    b[1]=0; b[2]=0;
    for (i=3; i<=100000; i++)
       if (a[i]==1 && a[(i+1)/2]==1)  b[i]=1;
    
    s[1]=0; s[2]=0;
    for (i=3; i<=100000; i++)
       s[i]= s[i-1] + b[i];
    
    int q, L, r;
    cin >> q;
    
    for (i=1; i<=q; i++){
    	cin >> L >> r;     //5 21
    	cout << s[r] - s[L-1] << endl;
    }
    
    return 0;
}

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

#include<iostream>
using namespace std;

int main()
int a[100000+1], b[100000+1], s[100000+1];

int main(){
	int i, j;
	
	for (i=2; i<=100000; i++)  a[i]=1;
	
	for (i=2; i<=int(sqrt(100000)); i++){
	  if (a[i]==1)
	    for (j=i+i; j<=100000; j+=i)  a[j] = 0;
    }
    
    b[1]=0; b[2]=0;
    for (i=3; i<=100000; i++)
       if (a[i]==1 && a[(i+1)/2]==1)  b[i]=1;
    
    s[1]=0; s[2]=0;
    for (i=3; i<=100000; i++)
       s[i]= s[i-1] + b[i];
    
    int q, L, r;
    cin >> q;
    
    for (i=1; i<=q; i++){
    	cin >> L >> r;
    	cout << s[r] - s[L-1] << endl;
    }
    
    return 0;
}

Compiler output:
a.cc:5:1: error: expected initializer before 'int'
    5 | int a[100000+1], b[100000+1], s[100000+1];
      | ^~~
a.cc: In function 'int main()':
a.cc:10:36: error: 'a' was not declared in this scope
   10 |         for (i=2; i<=100000; i++)  a[i]=1;
      |                                    ^
a.cc:12:26: error: 'sqrt' was not declared in this scope
   12 |         for (i=2; i<=int(sqrt(100000)); i++){
      |                          ^~~~
a.cc:13:15: error: 'a' was not declared in this scope
   13 |           if (a[i]==1)
      |               ^
a.cc:17:5: error: 'b' was not declared in this scope
   17 |     b[1]=0; b[2]=0;
      |     ^
a.cc:19:12: error: 'a' was not declared in this scope
   19 |        if (a[i]==1 && a[(i+1)/2]==1)  b[i]=1;
      |            ^
a.cc:21:5: error: 's' was not declared in this scope
   21 |     s[1]=0; s[2]=0;
      |     ^
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:20: warning: extra tokens at end of #include directive
    1 | #include <cstdio > bool f[100001]; int c[100002]; int N,L,R;
      |                    ^~~~
a.cc:1:10: fatal error: cstdio : No such file or directory
    1 | #include <cstdio > bool f[100001]; int c[100002]; int N,L,R;
      |          ^~~~~~~~~
compilation terminated.
Language: C

#include "bits/stdc++.h"
#include "Windows.h"

using namespace std;

int aaaa, bbbb;

inline bool isrp(int a, int b){
	if(a <=0 || b<=0 || a==b){   // 互质整数不能小于或等于0
		return false;
	}else if(a==1 || b==1){  // 两个正整数中，只有其中一个数值为1，两个正整数为互质数
		return true;
	}else{
		//  求出两个正整数的最大公约数
		while(1){
			int t = a%b;
			if(t == 0){
				break;
			}else{
				a = b;
				b = t;
			}
		}
		if( b > 1){  // 如果最大公约数大于1，表示两个正整数不互质
			return false;
		}else{         // 如果最大公约数等于1,表示两个正整数互质
			return true;
		}
	}
}

inline int maxx(int a, int b) {
	return a<b ? a : b;
}

inline solve(int a, int b) {
	int aa=a, bb=b;
	register int aaa = maxx(a, b);
	for(register int i=1; i<=maxx(a, b); ++i) {
		if(a%i==0 && b%i==0) {
			a /= i;
			b /= i;
		}
	}
	if(!isrp(a, b)) solve(a, b);

	else cout << a << ':' << b << endl << "--------------------" << endl;
}

int main() {
	ios::sync_with_stdio(false);

	unsigned int a, b;

	for( ;; ) {
		while(cin >> a >> b) {
			solve(a, b);
		}
	}

	system("echo finish working!");
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include "bits/stdc++.h"
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <cstdio>
#include <cstring>
#define MAX_N 100001

bool IsPrime[MAX_N];

// 愚直な素数列挙
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;
    int cnt[MAX_N] = {0};

    memset(IsPrime, 1, sizeof(IsPrime));
    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];
    }

    scanf("%d", &Q);

    while (Q--) {
        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:37:42: error: expected ';' before '}' token
   37 |         printf("%d\n", cnt[r] - cnt[l-1])
      |                                          ^
      |                                          ;
   38 |     }
      |     ~