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

#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

vector<bool> like2017(100100,true);
vector<bool> prime(100100,true);

void is_prime(){
  prime.at(0) = false;
  prime.at(1) = false;
  rep(i,3) like2017.at(i) = false;
  for(int i=2;i<=n;i++){
    if(prime.at(i)){
      for(int j=2; i*j<=n; j++){
        prime.at(i*j) = false;
        like2017.at(i*j) = false;
      }
    }
  }
  for(int i=3;i<=100010;i+=2){
    if(like2017.at(i) && !prime.at((i+1)/2)) like2017.at(i) = false;
  }
  return;
}

int main(){
  int q;
  cin >> q;
  is_prime();
  vi count(100100,0);
  rep(i,100010){
    count.at(i+1) = count.at(i) + like2017.at(i+1);
  }
  rep(i,q){
    int x,y;
    cin >> x >> y;
    cout << count.at(y) - count.at(x-1) << endl;
  }
}


Compiler output:
a.cc: In function 'void is_prime()':
a.cc:21:18: error: 'n' was not declared in this scope
   21 |   for(int i=2;i<=n;i++){
      |                  ^
Language: Java

import java.util.Scanner;

public class vistualcon {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Double x = sc.nextDouble();
		Double y = sc.nextDouble();
		int count = 1;
		Double z = y/x;
		while(z >= Math.pow(2,count-1)) {
			count++;
		}
		System.out.println(count-1);
		sc.close();

	}

}

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

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

int main(){
  set<int> s;
  set<int> s2;
  int val;

  for(int i=2;i<=100000;i++){
    s.insert(i);
  }  
  while(s.size()){
    val = *begin(s);
    s2.insert(val);
    s.erase(val);
    int val2 = val;
    while(val<=100000){
      val += val2;
      if(s.count(val)) s.erase(val);
    }
  }
  while(s2.size()){
    val = *begin(s2);
    cout << val << endl;
    s2.erase(val);
  }

  int q,l,r;
  cin >> q;
  int count;
  for(int i=0;i<q;i++){
    cin >> l >> r;
    count = 0 ;
    while(l<=r){
      if(s2.count(l) && s2.count((l+1)/2)) count++;
      }
      l += 2; 
    }
  }
}

Compiler output:
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
Language: C++

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

int main(){
    int n=1e5;
    vector<int> linep;
    vector<int> like;
    vector<bool> is_prime(n + 1, 1);
    for (int p = 2; p <= n; p++) {
        if (!is_prime[p]) continue;
        for (int k = 2*p; k <= n; k += p) is_prime[k] = false;
        linep.push_back(p);
        if(is_prime[(p+1)/2]){
            is_like[p]=1;
            like.push_back(p);
        }
    }

	int q;
	cin >> q;
    for(int i=0; i<q; i++){
	    int l, r;
        cin >> l >> r;
        if(l==1) l=3;
        int cnt=upper_bound(like.begin(), like.end(), r)-lower_bound(like.begin(), like.end(), l);
        cout << cnt << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: 'is_like' was not declared in this scope
   14 |             is_like[p]=1;
      |             ^~~~~~~
Language: C++

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

int main(){
    int n=1e5;
    vector<int> linep;
    vector<bool> is_prime(n + 1, 1);
    for (int p = 2; p <= n; p++) {
        if (!is_prime[p]) continue;
        for (int k = 2*p; k <= n; k += p) is_prime[k] = false;
        linep.push_back(p);
    }

	int q;
	cin >> q;
    for(int i=0; i<q; i++){
	    int l, r;
        cin >> l >> r;
        int cnt=0;
        
        for(int j=max(1, lower_bound(linep.begin(), linep.end(), l)-linep.begin()); linep[j]<=r; j++){
            if(is_prime[(linep[j]+1)/2]) cnt++; 
        }
        cout << cnt << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: no matching function for call to 'max(int, __gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type)'
   21 |         for(int j=max(1, lower_bound(linep.begin(), linep.end(), l)-linep.begin()); linep[j]<=r; j++){
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:21:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type' {aka 'long int'})
   21 |         for(int j=max(1, lower_bound(linep.begin(), linep.end(), l)-linep.begin()); linep[j]<=r; j++){
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:21:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 |         for(int j=max(1, lower_bound(linep.begin(), linep.end(), l)-linep.begin()); linep[j]<=r; j++){
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main() {
    int MAX = 101010;
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0;
    is_prime[1] = 0;

    for(int i=2, i<MAX; ++i){
        if(!is_prime[i]){
            continue;
        }
        for(int j=i*2; j<MAX; j+=i){
            is_prime[j] = 0;
        }
    }

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

    vector<int> s(MAX+1, 0);
    for(int i=0; i<MAX; ++i){
        s[i+1] = s[i] + a[i];
    }

    int q;
    cin >> q;

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

        cout << s[r] - s[l] << endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:19: error: expected ';' before '<' token
   11 |     for(int i=2, i<MAX; ++i){
      |                   ^
      |                   ;
a.cc:11:19: error: expected primary-expression before '<' token
Language: C++

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

int main() {
    int MAX = 101010;
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0;
    is_prime[1] = 0;

    for(int i=2, i<MAX, ++i){
        if(!is_prime[i]){
            continue;
        }
        for(int j=i*2; j<MAX; j+=i){
            is_prime[j] = 0;
        }
    }

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

    vector<int> s(MAX+1, 0);
    for(int i=0; i<MAX; ++i){
        s[i+1] = s[i] + a[i];
    }

    int q;
    cin >> q;

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

        cout << s[r] - s[l] << endl;
    }

    return 0;
}

Compiler output:
a.cc:40:20: error: extended character   is not valid in an identifier
   40 |         cin >> l >> r;
      |                    ^
a.cc: In function 'int main()':
a.cc:11:19: error: expected ';' before '<' token
   11 |     for(int i=2, i<MAX, ++i){
      |                   ^
      |                   ;
a.cc:11:19: error: expected primary-expression before '<' token
a.cc:11:28: error: expected ';' before ')' token
   11 |     for(int i=2, i<MAX, ++i){
      |                            ^
      |                            ;
a.cc:40:20: error: '\U000000a0r' was not declared in this scope
   40 |         cin >> l >> r;
      |                    ^~
Language: C++

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

int main() {
    int MAX = 101010;
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0;
    is_prime[1] = 0;

    for(int i=2, i<MAX, ++i){
        if(!is_prime[i]){
            continue;
        }
        for(int j=i*2; j<MAX; j+=i){
            is_prime[j] = 0;
        }
    }

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

    vector<int> s(MAX+1, 0);
    for(int i=0; i<MAX; ++i){
        s[i+1] = s[i] + a[i];
    }

    int q;
    cin >> q;

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

        cout << s[r] - s[l] << endl;
    }

    return 0;
}

Compiler output:
a.cc:40:20: error: extended character   is not valid in an identifier
   40 |         cin >> l >> r;
      |                    ^
a.cc: In function 'int main()':
a.cc:11:19: error: expected ';' before '<' token
   11 |     for(int i=2, i<MAX, ++i){
      |                   ^
      |                   ;
a.cc:11:19: error: expected primary-expression before '<' token
a.cc:11:28: error: expected ';' before ')' token
   11 |     for(int i=2, i<MAX, ++i){
      |                            ^
      |                            ;
a.cc:20:5: error: 'vectore' was not declared in this scope
   20 |     vectore<int> a(MAX, 0);
      |     ^~~~~~~
a.cc:20:13: error: expected primary-expression before 'int'
   20 |     vectore<int> a(MAX, 0);
      |             ^~~
a.cc:26:13: error: 'a' was not declared in this scope
   26 |             a[i] = 1;
      |             ^
a.cc:32:25: error: 'a' was not declared in this scope
   32 |         s[i+1] = s[i] + a[i];
      |                         ^
a.cc:40:20: error: '\U000000a0r' was not declared in this scope
   40 |         cin >> l >> r;
      |                    ^~
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:28:5: error: expected unqualified-id before 'for'
   28 |     for(int q = 0; q < Q; ++q) {
      |     ^~~
a.cc:28:20: error: 'q' was not declared in this scope
   28 |     for(int q = 0; q < Q; ++q) {
      |                    ^
Language: C

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

int main() {
    // エラトステネスのふるい
    int MAX = 101010;
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (int i = 2; i < MAX; ++i) {
        if (!is_prime[i]) continue;
        for (int j = i*2; j < MAX; j += i) is_prime[j] = 0;
    }

    // 2017-like 数かどうか
    vector<int> a(MAX, 0);
    for (int i = 0; i < MAX; ++i) {
        if (i % 2 == 0) continue;
        if (is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
    }

    // 累積和
    vector<int> s(MAX+1, 0);
    for (int i = 0; i < MAX; ++i) s[i+1] = s[i] + a[i];

    // クエリ処理
    int Q; cin >> Q;
    for (int q = 0; q < Q; ++q) {
        int l, r;
        cin >> l >> r;
        ++r;

        cout << s[r] - s[l] << endl;
    }
}


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

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

int main() {
    // エラトステネスのふるい
    int MAX = 101010;
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (int i = 2; i < MAX; ++i) {
        if (!is_prime[i]) continue;
        for (int j = i*2; j < MAX; j += i) is_prime[j] = 0;
    }

    // 2017-like 数かどうか
    vector<int> a(MAX, 0);
    for (int i = 0; i < MAX; ++i) {
        if (i % 2 == 0) continue;
        if (is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
    }

    // 累積和
    vector<int> s(MAX+1, 0);
    for (int i = 0; i < MAX; ++i) s[i+1] = s[i] + a[i];

    // クエリ処理
    int Q; cin >> Q;
    for (int q = 0; q < Q; ++q) {
        int l, r;
        cin >> l >> r;
        ++r;

        cout << s[r] - s[l] << endl;
    }
}

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

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

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


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

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

Compiler output:
a.cc:1:25: warning: extra tokens at end of #include directive
    1 | #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]);}}
      |                         ^
a.cc:1:11: fatal error: cstdio >boo: No such file or directory
    1 | #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]);}}
      |           ^~~~~~~~~~~~~
compilation terminated.
Language: C++

bool isPrime(ll n){
    if(n == 2)return true;
    if(n == 1 || n == 0)return false;
    ll sq = sqrt(n) + 1;
    ll tmp = n; 
    for(int i = 2; i <= sq; i++){
        sq = sqrt(tmp) + 1;
        while(tmp%i == 0)tmp/=i;
    }
    if(tmp == n)return  true;
    return false;
}

Compiler output:
a.cc:1:14: error: 'll' was not declared in this scope
    1 | bool isPrime(ll n){
      |              ^~
Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
#include <stdio.h>
    
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using TP = tuple<ll, ll, ll>;
ll MOD = 1e9+7;
const int INF = 1000*1000*1000;
const ll LINF = (ll)1e18;
int xv[4] = {-1, 1, 0, 0};
int yv[4] = {0, 0, -1, 1};

int dp[100001];
int dp2[100001];

bool check(int a){
    for(int i = 2; i < a; i++){
        if(i > a){
            break;
        }
        if(a % i == 0){
            dp[a] = 0;
            return dp[a];
        }
    }
    dp[a] = 1;
    return dp[a];
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    memset(dp, 0, sizeof(dp));
    
    dp[1] = 0;
    dp[2] = 1;
    for(int i = 3; i <= 100000; i+=2){
        check(i);
    }
    for(int i = 0; i <= 100000; i++){
        dp2[i] = dp[i] && dp[(i+1)/2];
    }
    for(int i = 0; i <= 100000; i++){
        dp2[i+1] += dp2[i];
    }
    
    //return 0;
    int Q;
    cin >> Q;
    REP(i, Q){
        int l, r;
        cin >> l >> r;
        cout <<  dp2[r] - dp2[l-1] << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:5: error: 'memset' was not declared in this scope
   45 |     memset(dp, 0, sizeof(dp));
      |     ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <queue>
  +++ |+#include <cstring>
   10 | #include <stdio.h>
Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
    
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using TP = tuple<ll, ll, ll>;
ll MOD = 1e9+7;
const int INF = 1000*1000*1000;
const ll LINF = (ll)1e18;
int xv[4] = {-1, 1, 0, 0};
int yv[4] = {0, 0, -1, 1};

int dp[100001];
int dp2[100001];

bool check(int a){
    for(int i = 2; i < a; i++){
        if(i > a){
            break;
        }
        if(a % i == 0){
            dp[a] = 0;
            return dp[a];
        }
    }
    dp[a] = 1;
    return dp[a];
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    memset(dp, 0, sizeof(dp));
    
    dp[1] = 0;
    dp[2] = 1;
    for(int i = 3; i <= 100000; i+=2){
        check(i);
    }
    for(int i = 0; i <= 100000; i++){
        dp2[i] = dp[i] && dp[(i+1)/2];
    }
    for(int i = 0; i <= 100000; i++){
        dp2[i+1] += dp2[i];
    }
    
    //return 0;
    int Q;
    cin >> Q;
    REP(i, Q){
        int l, r;
        cin >> l >> r;
        cout <<  dp2[r] - dp2[l-1] << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:5: error: 'memset' was not declared in this scope
   44 |     memset(dp, 0, sizeof(dp));
      |     ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <queue>
  +++ |+#include <cstring>
   10 |
Language: C++

#include <iostream>

using std::cout;
using std::endl;
using std::cin;

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];
	int N, L, R;
	cin >> N;
	while (N--) {
		cin >> L >> R;
		cout << c[R] - c[L-1] << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: 'f' was not declared in this scope
    9 |                 if(!f[i])
      |                     ^
a.cc:13:21: error: 'f' was not declared in this scope
   13 |                 if(!f[i] && !f[(i + 1) / 2])
      |                     ^
a.cc:14:27: error: 'c' was not declared in this scope
   14 |                         ++c[i];
      |                           ^
a.cc:16:17: error: 'c' was not declared in this scope
   16 |                 c[i]+= c[i - 1];
      |                 ^
a.cc:21:25: error: 'c' was not declared in this scope
   21 |                 cout << c[R] - c[L-1] << endl;
      |                         ^
Language: C++

#include <bits/stdc++.h>

#define mod 1000000007

using namespace std;
typedef long long ll; 
 
int main(void){
	
	int Q;
	
	cin >> Q;
	
	int l, r, count[100001];
	bool check[100001];
	
	for(int i=2; i<=100000; i++){
		if(!check[i]){
			for(int j=2*i; j<=100000; j+=i)
				check[j] = true;
		}
	}
	
	for(int i=3; i<=100000; i+=2)
		if(!check[i] && !check[(i+1)/2])
			count[i]++;
	
	for(i=3; i<=100000; i++)
		count[i] += count[i-1];
	
	for(int i=0; i<Q; i++){
		cin >> l >> r;
		cout << count[r] - count[l-1];
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:13: error: 'i' was not declared in this scope
   28 |         for(i=3; i<=100000; i++)
      |             ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <vector>
using namespace std;

struct obj 
{
	int l;
	int r;
};

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 * 1.0);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main(void) {
	
	int N;
	cin >> N;

	vector<obj> list(N);

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

	for (int i = 0; i < N; i++)
	{
		int ans = 0;
		for (int j = list[i].l; j <= list[i].r; j+=2)
		{
			if (IsPrime(j) && IsPrime((j + 1)/2))
			{
				ans++;
			}
		}
		cout << ans << endl;
	}

	return 0;
}

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

#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <vector>
using namespace std;

struct obj 
{
	int l;
	int r;
};

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(void) {
	
	int N;
	cin >> N;

	vector<obj> list(N);

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

	for (int i = 0; i < N; i++)
	{
		int ans = 0;
		for (int j = list[i].l; j <= list[i].r; j+=2)
		{
			if (IsPrime(j) && IsPrime((j + 1)/2))
			{
				ans++;
			}
		}
		cout << ans << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'bool IsPrime(int)':
a.cc:21:24: error: '::sqrt' has not been declared
   21 |     double sqrtNum = ::sqrt(num);
      |                        ^~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <vector>
using namespace std;

struct obj 
{
	int l;
	int r;
};

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(void) {
	
	int N;
	cin >> N;

	vector<obj> list(N);

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

	for (int i = 0; i < N; i++)
	{
		int ans = 0;
		for (int j = list[i].l; j <= list[i].r; j+=2)
		{
			if (IsPrime(j) && IsPrime((j + 1)/2))
			{
				ans++;
			}
		}
		cout << ans << endl;
	}

	return 0;
}

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

#include <stdio.h>

int num[100010], primes[10000];

pri(){
    num[0] = 0;
    num[1] = 0;
    int idx=0;
    for(int i=2; i<=100000; i++){
        if(num[i] == 0){
            num[i] = 2;
            primes[idx] = i;
            for(int j=i+i; j<=100000; j+=i){
                num[j] = 1;
            }
            idx+=1;
        }
    }
}

int main(){
    pri();
    int a, b, q, cont;

    scanf("%d", &q);
    for(int i=0; i<q; i++){
        scanf("%d %d", &a, &b);
        cont = 0;
        for(int j=a; j<=b; j++){
            if(num[j] == 2 && num[(j+1)/2] == 2){
                cont += 1;
                //printf("%d %d \n", j, (j+1)/2);
            }
        }
        printf("%d\n", cont);
    }
}


Compiler output:
a.cc:5:1: error: ISO C++ forbids declaration of 'pri' with no type [-fpermissive]
    5 | pri(){
      | ^~~
a.cc: In function 'int pri()':
a.cc:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

bool isPrime[100011]; //最初全部trueにしておく
void computePrimes(int limit=100010) {
    assert(limit < 100011);
    fill(isPrime, isPrime+limit+1, true);
    isPrime[0] = isPrime[1] = false;
    for (int i=2; i<=limit; i++)
        if (isPrime[i])
            for (int j = 2 * i; j <= limit; j += i)
                isPrime[j] = false;
}

int main() {
    computePrimes();
    int q;
    cin >> q;
    int rui[100010] = {0};
    for (int i=1; i<50004; i++) {
        rui[2*i - 1] = rui[2*i] = rui[2*i - 2] + (isPrime[i] && isPrime[2*i - 1]);
    }
    for (int i=0; i<q; i++) {
        int l, r;
        cin >> l >> r;
        cout << rui[r] - rui[l-1] << '\n';
    }
    return 0;
}

Compiler output:
a.cc: In function 'void computePrimes(int)':
a.cc:8:5: error: 'assert' was not declared in this scope
    8 |     assert(limit < 100011);
      |     ^~~~~~
a.cc:3:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    2 | #include <algorithm>
  +++ |+#include <cassert>
    3 |
Language: Java

import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] $) {
        int q=sc.nextInt();
        int[] ln=new int[100001];
        for (int i = 3; i < 100000; i+=2) {
            if(isPrime(i)&&isPrime((i+1)/2)){
                ln[i]++;
            }
        }
        for (int i = 0; i < 100000; i++) {
            ln[i+1]+=ln[i];
        }
        for (int i = 0; i < q; i++) {
            int l=sc.nextInt();
            int r=sc.nextInt();
            out.println(ln[r]-ln[l-1]);
        }
        out.close();
    }

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

    static PrintWriter out = new PrintWriter(System.out);

    static class sc {
        static Scanner s = new Scanner(System.in);

        static String next() {
            return s.next();
        }

        static String nextLine() {
            return s.nextLine();
        }

        static int nextInt() {
            return Integer.parseInt(s.next());
        }

        static long nextLong() {
            return Long.parseLong(s.next());
        }

        static double nextDouble() {
            return Double.parseDouble(s.next());
        }

        static boolean hasNext() {
            return s.hasNext();
        }
    }
}

Compiler output:
Main.java:24: error: cannot find symbol
        int l=(int)sqrt(p)+1;
                   ^
  symbol:   method sqrt(int)
  location: class Main
1 error
Language: C++

q=int(input())
l=[list(map(int,input().split())) for i in range(q)]

def primes(n):
  is_prime=[True]*(n+1)
  is_prime[0]=False
  is_prime[1]=False
  for i in range(2,int(n**0.5)+1):
    if not is_prime[i]:
      continue
    for j in range(i*2,n+1,i):
      is_prime[j]=False
  return [i for i in range(n+1) if is_prime[i]]

L1=primes(100000)
L2=set(L1)
like2017=[]
for i in range(len(L1)):
  if (L1[i]+1)//2 in L2:like2017.append(L1[i])
like2017=set(like2017)
ansL=[]
ct=0
for i in range(100000):
  if i in like2017:ct+=1
  ansL.append(ct)

for i in range(q):
  print(ansL[l[i][1]]-ansL[l[i][0]-1])

Compiler output:
a.cc:1:1: error: 'q' does not name a type
    1 | q=int(input())
      | ^
Language: C++

#include <iostream>
using namespace std;

bool isPrime(int n){
  int f=0;
  for(int i=2;i<n;++i){
    if(n%i==0){
      f = 1;
      break;
    }
  }
  if(f==0)
    return true;
  else
    return false;
}

int main(){
  int q,i,re=0;
  cin >> q;
  long long int l[q],r[q],t;
  for(i=0;i<q;i++){
    cin >> l[i] >> r[i];
  }
  for(i=0;i<q;i++){
    for(t=l[i];t<=r[i];t+2){
      if(isPrime(t) && isPrime(t+1)/2))
        re++;
    }
    cout << re << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:39: error: expected primary-expression before ')' token
   27 |       if(isPrime(t) && isPrime(t+1)/2))
      |                                       ^
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <fstream>
#include <iterator>
// #include "prettyprint.hpp"

using namespace std;
using ll = long long;

vector<ll> calc_prime_number(int upper_num)
{
    vector<int> is_prime(upper_num, 1); // 0 is not prime number.
    is_prime[0] = 0;
    is_prime[1] = 0;
    for (int i = 2; i < upper_num; ++i)
    {
        if (!is_prime[i])
        {
            continue;
        }
        for (int j = i * 2; j < upper_num; j += i)
        {
            is_prime[j] = 0;
        }
    }
    return is_prime;
}

int main()
{
    int MAX = 10010;
    auto is_prime = calc_prime_number(MAX);
    // cout << is_prime << endl;

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

    vector<int> s(MAX + 1, 0);
    for (int i = 0; i < MAX; ++i)
    {
        s[i + 1] = s[i] + a[i];
    }
    int Q;
    cin >> Q;

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

        cout << s[r] - s[l] << endl;
    }
}


Compiler output:
a.cc: In function 'std::vector<long long int> calc_prime_number(int)':
a.cc:36:12: error: could not convert 'is_prime' from 'vector<int>' to 'vector<long long int>'
   36 |     return is_prime;
      |            ^~~~~~~~
      |            |
      |            vector<int>
Language: C++

#include<bits/stdc++.h>
bool f[100001];
int c[100002],N,L,R,i,j;
int main(){
  fill(f,f+100001,true);
  for(i=2;i<=100000;i++)if(f[i])for(j=i+i;j<=100000;j+=i)f[j]=false;
  for(i=3;i<=100000;i+=2)if(f[i]&&f[(i+1)/2])c[i]++;
  for(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:5:3: error: 'fill' was not declared in this scope; did you mean 'std::fill'?
    5 |   fill(f,f+100001,true);
      |   ^~~~
      |   std::fill
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: 'std::fill' declared here
  191 | fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
Language: C++

#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <math.h>
#include <iomanip>
#include <map>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int const static Q_MAX = 1000 * 100 + 10;

int Q;
int l[Q_MAX];
int r[Q_MAX];

bool era[Q_MAX+10];
int like_2017[Q_MAX+100];

void init_era(){
  memset(era,true,sizeof(era));
  era[1] = false;
  era[2] = true;
  for(int i=2; i<Q_MAX;i++){
    if(era[i] == true){
      for(int j=2;i*j < Q_MAX; j++){
        era[i*j] = false;
      }
    }
  }
}

void init_like_2017(){

  memset(like_2017,0,sizeof(like_2017));
  like_2017[3] = 1;
  for(int i=4;i<Q_MAX;i++){
    if(i%2==1 && era[i] && era[(i+1)/2]) like_2017[i] = 1;
    like_2017[i] += like_2017[i-1];
  }
}

int main(){
  init_era();
  init_like_2017();

  //rep(i,100) cout<<"i:"<<i<<" v:" << era[i]<<endl;
  cin>>Q;
  rep(i,Q){
    int a,b;cin>>a>>b;
    //cout<< (like_2017[b]-like_2017[a]) <<endl;
    cout<< (like_2017[b] - like_2017[a-1]) <<endl;
  }


}

Compiler output:
a.cc: In function 'void init_era()':
a.cc:23:3: error: 'memset' was not declared in this scope
   23 |   memset(era,true,sizeof(era));
      |   ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <map>
  +++ |+#include <cstring>
   10 | #define rep(i,n) for(int i=0;i<(n);i++)
a.cc: In function 'void init_like_2017()':
a.cc:37:3: error: 'memset' was not declared in this scope
   37 |   memset(like_2017,0,sizeof(like_2017));
      |   ^~~~~~
a.cc:37:3: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include<bits/stdc++.h>
using namespace std;
main()
{
    int p[100000],a[100000];
    p[1]=1;
    for (int i=2;i<=100000;i++)
    {
        for (int j=2*i;j<=100000;j+=i)
            p[j]=1;
    }
    p[2]=0;
    for(int i=1;i<=100000;i++)
    {
        if(p[i]==0 && p[(i+1)/2]==0 && i!=2)
        {
            a[i]=a[i-1]+1;
        }
        else
            a[i]=a[i-1];
    }
    int q;
    cin>>q;
    while(q--)
    {
        int l,r;
        cin>>l>>r;
        cout<<a[r]-a[l-1]<<endl；
    }
}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:28:28: error: 'endl\U0000ff1b' was not declared in this scope
   28 |         cout<<a[r]-a[l-1]<<endl；
      |                            ^~~~~~
Language: C++

ない

    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(){
sieve(10003);
cin>>q;
int count[10005]={0};
for(int i =3;i<10003;i++){
count[i]=count[i-1];
if(IsPrime[i]&&IsPrime[(i+1)/2]){
count[i]++;
}
}
for(int i=0;i<q;i++){
int l,r;
cin>>l>>r;
  int ans=count[r]-count[l-1];
cout<<ans<<endl;
}
return 0;
}

Compiler output:
a.cc:1:1: error: '\U0000306a\U00003044' does not name a type
    1 | ない
      | ^~~~
a.cc:3:21: error: 'i' does not name a type
    3 |     for(size_t i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
      |                     ^
a.cc:3:31: error: expected unqualified-id before '++' token
    3 |     for(size_t i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
      |                               ^~
a.cc:5:29: error: 'i' does not name a type
    5 |             for(size_t j=2; i*j<=max; ++j) // (max以下の)iの倍数は
      |                             ^
a.cc:5:39: error: expected unqualified-id before '++' token
    5 |             for(size_t j=2; i*j<=max; ++j) // (max以下の)iの倍数は
      |                                       ^~
a.cc:7:1: error: expected declaration before '}' token
    7 | }
      | ^
a.cc: In function 'int main()':
a.cc:10:1: error: 'sieve' was not declared in this scope
   10 | sieve(10003);
      | ^~~~~
a.cc:11:1: error: 'cin' was not declared in this scope
   11 | cin>>q;
      | ^~~
a.cc:11:6: error: 'q' was not declared in this scope
   11 | cin>>q;
      |      ^
a.cc:15:4: error: 'IsPrime' was not declared in this scope
   15 | if(IsPrime[i]&&IsPrime[(i+1)/2]){
      |    ^~~~~~~
a.cc:23:1: error: 'cout' was not declared in this scope; did you mean 'count'?
   23 | cout<<ans<<endl;
      | ^~~~
      | count
a.cc:23:12: error: 'endl' was not declared in this scope
   23 | cout<<ans<<endl;
      |            ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
std::vector<bool> IsPrime;
int q;

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(){
sieve(10003);
cin>>q;
int count[10005]={0};
for(int i =3;i<10003;i++){
count[i]=count[i-1];
if(IsPrime[i]&&IsPrime[(i+1)/2]){
count[i]++;
}
}
for(int i=0;i<q;i++){
int l,r;
cin>>l>>r;
count<<count[r]-count[l-1]<<endl;
}

return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:6: error: invalid operands of types 'int [10005]' and 'int' to binary 'operator<<'
   32 | count<<count[r]-count[l-1]<<endl;
      | ~~~~~^~~~~~~~~~~~~~~~~~~~~
      | |              |
      | int [10005]    int
Language: C++

#include<bits/stdc++.h>
using namespace std;
std::vector<bool> IsPrime;
int q;

void sieve(int 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(){
sieve(10003);
cin>>q;
int count[10005]={0};
for(int i =3;i<10003;i++){
count[i]=count[i-1];
if(IsPrime[i]=true&&IsPrime[(i+1)/2]=true){
count[i]++;
}
}
for(int i=0;i<q;i++){
int l,r;
cin>>l>>r;
count<<count[r]-count[l-1]<<endl;
}


}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:19: error: lvalue required as left operand of assignment
   25 | if(IsPrime[i]=true&&IsPrime[(i+1)/2]=true){
      |               ~~~~^~~~~~~~~~~~~~~~~~
a.cc:32:6: error: invalid operands of types 'int [10005]' and 'int' to binary 'operator<<'
   32 | count<<count[r]-count[l-1]<<endl;
      | ~~~~~^~~~~~~~~~~~~~~~~~~~~
      | |              |
      | int [10005]    int
Language: C++

#include<bits/stdc++.h>
using namespace std;
std::vector<bool> IsPrime;
int q;

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(){
sieve(10003);
cin>>q;
int count[10005]={0};
for(int i =3;i<10003;i++){
count[i]=count[i-1];
if(IsPrime[i]&&IsPrime[(i+1)/2]){
count[i]++;
}
}
for(int i=0;i<q;i++){
int l,r;
cin>>l>>r;
count<<count[r]-count[l-1];
}


}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:6: error: invalid operands of types 'int [10005]' and 'int' to binary 'operator<<'
   32 | count<<count[r]-count[l-1];
      | ~~~~~^~~~~~~~~~~~~~~~~~~~~
      | |              |
      | int [10005]    int
Language: C++

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

using namespace std;
typedef pair<int, int> P;
vector<int> prime;
bool isPrime[100001];

void primeCalc()
{
	memset(isPrime, 1, 100001);
	isPrime[0] = isPrime[1] = false;
	for (int i = 2; i < 100001; ++i)
	{
		if (isPrime[i])
		{
			prime.push_back(i);
			for (int j = i * 2; j < 100001; j += i)
			{
				isPrime[j] = false;
			}
		}
	}
}

void solve()
{
	primeCalc();
	int Q;
	cin >> Q;
	for (int i = 0; i < Q; ++i)
	{
		int l, r;
		cin >> l >> r;
		int cnt = 0;
		for (int j = l; j <= r; j += 2)
		{
			if (isPrime[j] && isPrime[(j + 1) / 2])
			{
				++cnt;
			}
		}
		cout << cnt << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Compiler output:
a.cc: In function 'void primeCalc()':
a.cc:13:9: error: 'memset' was not declared in this scope
   13 |         memset(isPrime, 1, 100001);
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <algorithm>
  +++ |+#include <cstring>
    5 |
Language: C++

#include <iostream>
using namespace std;

int sq(int n){
  for(int i=1;;i++){
    if(i*i>=n){
      return i;
      break;
    }
  }
}
int pr(int n){
  int count=0;
  sq(n)=m;
  for(int i=2;i<=m;i++){
    if(n%i==0){
      count++;
    }
  }
  if(count==0){
    return 1;
  }
  else{
    return 0;
  }
}

int main(){
  int n;
  cin >> n;
  int a[n],b[n];
  for(int i=0;i<n;i++){
    cin >> a[i] >> b[i];
  }
  int x[50000],y[50000];
  for(int i=1;i<100000;i+=2){
    if(pr(i)==1&&pr((i+1)/2)==1){
      x[(i-1)/2]=1;
    }
    else{
      x[(i-1)/2]=0;
    }
  }
  for(int i=0;i<50000;i++){
    y[i]=0;
  }
  for(int i=0;i<50000;i++){
    for(int j=0;j<=i;j++){
      y[i]+=x[j];
    }
  }
  for(int i=0;i<n;i++){
    cout << y[b[i]]-y[a[i]-1] << endl;
  }
}
      
  

Compiler output:
a.cc: In function 'int pr(int)':
a.cc:14:9: error: 'm' was not declared in this scope
   14 |   sq(n)=m;
      |         ^
Language: C++

#include <iostream>
using namespace std;

int sq(int n){
  for(int i=1;;i++){
    if(i*i>=n){
      return i;
      break;
    }
  }
}
int pr(int n){
  int count=0;
  int sq(n)=m;
  for(int i=2;i<=m;i++){
    if(n%i==0){
      count++;
    }
  }
  if(count==0){
    return 1;
  }
  else{
    return 0;
  }
}

int main(){
  int n;
  cin >> n;
  int a[n],b[n];
  for(int i=0;i<n;i++){
    cin >> a[i] >> b[i];
  }
  int x[50000],y[50000];
  for(int i=1;i<100000;i+=2){
    if(pr(i)==1&&pr((i+1)/2)==1){
      x[(i-1)/2]=1;
    }
    else{
      x[(i-1)/2]=0;
    }
  }
  for(int i=0;i<50000;i++){
    y[i]=0;
  }
  for(int i=0;i<50000;i++){
    for(int j=0;j<=i;j++){
      y[i]+=x[j];
    }
  }
  for(int i=0;i<n;i++){
    cout << y[b[i]]-y[a[i]-1] << endl;
  }
}
      
  

Compiler output:
a.cc: In function 'int pr(int)':
a.cc:14:12: error: expected ',' or ';' before '=' token
   14 |   int sq(n)=m;
      |            ^
a.cc:15:18: error: 'm' was not declared in this scope
   15 |   for(int i=2;i<=m;i++){
      |                  ^
Language: C++

#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>

#define MAX 10e5

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() {
	int q;
	cin >> q;
	vector<int> l;
	vector<int> r;
	for (int i = 0; i < q; i++) {
		int a, b;
		cin >> a >> b;
		l.push_back(a);
		r.push_back(b);
	}

	vector<int> sum(MAX,0);
	vector<int> isPrime(MAX,0);

	for (int i = 3; i < MAX; i += 2) {
		if (IsPrime(i))
			isPrime[i] = 1;
	}

	for (int i = 2; i < MAX / 2; i++) {
		if (isPrime[2 * i - 1] != 1)
			continue;
		if (IsPrime(i)) {
			//cout << 2 * i - 1 << "は素数" << endl;
			continue;
		}
		else {
			isPrime[2 * i - 1] = 0;
		}
	}

	sum[3] = 1;

	for (int i = 5; i < MAX; i += 2) {
		sum[i] = sum[i - 2] + isPrime[i];
	}

	for (int i = 0; i < q; i++) {
		int x = sum[r[i]] - sum[l[i]];
		if (isPrime[l[i]])
			x += 1;
		cout << x << endl;
		//cout << r[i] << " " << sum[r[i]] << endl << l[i] << " " << sum[l[i]] << endl;
	}

	for (int i = 0; i < q; i++) {
		//cout << sum[i] << endl;
	}


}

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

#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
using namespace std;
#define int long long
#define rep(i,n) for(int i=1;i<=n;i++)
const int inf = 1000000007;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int a[100010], b[100010];
signed main() {
	int n;
	cin >> n;
	rep(i, n) {
		cin >> a[i] >> b[i];
	}
	rep(i, n) {
		int cnt = 0;
		for (int j = a[i]; j <= b[i]; j += 2) {
			if (prime(j) == true && prime((j + 1) / 2) == true)cnt++;
		}
		cout << cnt << endl;
	}
}

Compiler output:
a.cc: In function 'bool prime(long long int)':
a.cc:12:30: error: 'sqrt' was not declared in this scope
   12 |         for (int i = 2; i <= sqrt(n); i++) {
      |                              ^~~~
Language: C

#include<stdio.h>
#include<string.h>
#include<math.h>

int main()
{
	int i,j,k.q,num;
	int l[100001]={},r[100001]={},ans[100001]={};
	int flag=0;
 
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d %d",&l[i],&r[i]);
	}
 
	for(i=0;i<q;i++){
		for(j=l[i];j<=r[i];j++){
			for(k=2;k<j;k++){
				if(j%i==0){
					ans[i]++;
					break;
				}
			}
		}
	}

 	for(i=0;i<q;i++){
 		printf("%d\n",ans[i]);
 	}

  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:7:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    7 |         int i,j,k.q,num;
      |                  ^
main.c:11:21: error: 'q' undeclared (first use in this function)
   11 |         scanf("%d",&q);
      |                     ^
main.c:11:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:29: error: 'k' undeclared (first use in this function)
   18 |                         for(k=2;k<j;k++){
      |                             ^
Language: C++

#include <iostream>
#include <math.h>
// #include <algorithm>
#include <vector>
using namespace std;

bool IsPrime(int num)
{
  // 合成数とは？→　素数以外の数のこと
  // xが合成数ならば、√x以下の約数を持つ
  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() {
  int q;
  cin >> q;

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

  // 累積和の配列の範囲を特定
  int max = *max_element(r.begin(), r.end());

  // 累積和の配列を生成
  int s[max+1];
  s[0] = 0;
  for(int i = 1; i < max+1; i++) {
    s[i] = s[i-1] + ((IsPrime(i) && IsPrime((i+1)/2))? 1 : 0);
  }

  // ラムダ式
  auto partSum = [&](int l, int r) -> int {
    if(l==0) return s[r];
    return s[r] - s[l-1];
  };

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


Compiler output:
a.cc: In function 'int main()':
a.cc:40:14: error: 'max_element' was not declared in this scope
   40 |   int max = *max_element(r.begin(), r.end());
      |              ^~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int dis[100009],vis[100009],n,l,r;
int main()
{
    dis[1]=1;
    for (int i=2;i<=100000;i++)
    {
        for (int j=2*i;j<=100000;j=j+i)
            dis[j]=1;
    }
    dis[2]=0;
    for (int i=1;i<=100000;i++)
    {
        if(dis[i]==0&&dis[(i+1)/2]==0&&i!=2)
        {
            vis[i]=vis[i-1]+1;
        }
        else 
        {
            vis[i]=vis[i-1];
        }
    }
    cin>>n;
    while(n--)
    {
        cin>>l>>r;
        cout<<vis[r]-vis[l-1]<<endl;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:29:6: error: expected '}' at end of input
   29 |     }
      |      ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^