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

#include <bits/stdc++.h>

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
 
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> c(n), f(n), s(n);
	rep(i,n-1) cin >>c[i] >>f[i] >>s[i];
	
	rep(i, n){
		
		ll ans =0, cr =0;
		//rep(t, 500) if(f[i] + s[i]*t > cr
		rep2(j, i, n-1){
			int p = max(0LL, (cr - f[j] + s[j] -1)/s[j]);
			cr = f[j] + s[j] * p + c[j];
			//dbg(i,j,p,cr);
		}
		cout << cr << "\n";
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:36: error: no matching function for call to 'max(long long int, ll)'
   32 |                         int p = max(0LL, (cr - f[j] + s[j] -1)/s[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:32:36: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'll' {aka 'long int'})
   32 |                         int p = max(0LL, (cr - f[j] + s[j] -1)/s[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:32:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   32 |                         int p = max(0LL, (cr - f[j] + s[j] -1)/s[j]);
      |                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int n,c[510],s[510],f[510],time;
void ans(int k,int t)
{
    if(k==n-1) {time=t;return;}
    if(t<=s[k]) ans(k+1,s[k]+c[k]);
    else ans(k+1,t+c[k]+t%f[k]);
}
int main()
{
    scanf("%d",&n);
    for(int i=0;i<n-1;i++)
    {
        scanf("%d %d %d",&c[i],&s[i],&f[i]);
    }
    for(int i=0;i<n;i++)
    {
        time=0;
        ans(i,0);
        printf("%d\n",time);
    }
    return 0;
}


Compiler output:
a.cc:6:28: error: 'int time' redeclared as different kind of entity
    6 | int n,c[510],s[510],f[510],time;
      |                            ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'void ans(int, int)':
a.cc:9:21: error: assignment of function 'time_t time(time_t*)'
    9 |     if(k==n-1) {time=t;return;}
      |                 ~~~~^~
a.cc: In function 'int main()':
a.cc:22:13: error: assignment of function 'time_t time(time_t*)'
   22 |         time=0;
      |         ~~~~^~
Language: C

#include <stdio.h>

int main {
    int N;
    int C[], S[], F[];

    for (int i=0; i<N-1; i++) {
        scanf("%d %d %d", &C[i], &S[i], &F[i]);
    }


    int sumC=0, sumF=0;
    
    for (int t=0; t<N-1; t++) {
        for (int j=t; j<N-1; j++) {
            sumC += C[j];
        }
        printf("%d", S[t]+sumC);
    }
    printf("0");
}



Compiler output:
main.c:3:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    3 | int main {
      |          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<int,P>
#define vpp vector<PP>
#define fi first
#define se second
#define INF (1<<30)
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
signed main(){
    int n;
    cin>>n;
    int now=0;
    vi vec(n);
    REP(i,n-1){
        int a,b,c;
        cin>>a>>b>>c;
        int t=max(0,(now-b+c-1)/c);
        now=a+b+c*t;
        vec[i+1]=now;
    }
    reverse(all(vec));
    REP(i,n){
        cout<<vec[i]<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:18: error: no matching function for call to 'max(int, long long int)'
   28 |         int t=max(0,(now-b+c-1)/c);
      |               ~~~^~~~~~~~~~~~~~~~~
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:28:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   28 |         int t=max(0,(now-b+c-1)/c);
      |               ~~~^~~~~~~~~~~~~~~~~
/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:28:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   28 |         int t=max(0,(now-b+c-1)/c);
      |               ~~~^~~~~~~~~~~~~~~~~
Language: C

 
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9

int main(){
    int n;cin>>n;
    vvi t(n-1,vi(3));
    rep(i,n-1){
        rep(j,3)cin>>t[i][j];
    }
    rep(i,n){
        int a=0;
        range(j,i,n-1){
            if(a>t[j][1]){
                a+=(a-t[j][1])%t[j][2];
            }else{
                a=t[j][1];
            }
            a+=t[j][0];
        }
        cout<<a<<endl;
    }
	return 0;
}


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

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<typename T> void chmax(T &a, T b) { a = max(a, b); }
template<typename T> void chmin(T &a, T b) { a = min(a, b); }
using ll = long long;
using P = pair<int,int>;

// Sieve of Eratosthenes
// https://youtu.be/UTVg7wzMWQc?t=2774
struct Sieve {
    int n;
    vector<int> f, primes;
    Sieve(int n=1):n(n), f(n+1) {
        f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
  vector<pair<ll,int>> factor(ll x) {
    vector<pair<ll,int>> res;
    for (int p : primes) {
      int y = 0;
      while (x%p == 0) x /= p, ++y;
      if (y != 0) res.emplace_back(p,y);
    }
    if (x != 1) res.emplace_back(x,1);
    return res;
  }
};

const int MAX_N = 100005;
int op (int x, int y) {
    return x + y;
}

int e () {
    return 0;
}

int main() {
    int q;
    cin >> q;
    Sieve s(MAX_N);
    segtree<int, op, e> seg(MAX_N);

    for (int p : s.primes) {
        int q = (p+1) / 2;
        if (s.isPrime(q)) seg.set(p, 1);
    }

    rep(i, q) {
        int l, r;
        cin >> l >> r;
        cout << seg.prod(l, r + 1) << endl;
    }
    return 0;
}


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

// https://atcoder.jp/contests/abc084/tasks/abc084_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

// constexprな素数列挙(エラトステネスの篩)
// https://259-momone.hatenablog.com/entry/2018/05/06/015026
template <int_fast64_t max_N> struct Prime {
    bool b[max_N + 1];
    constexpr Prime() : b() {
        for (int_fast64_t i = 0; i <= max_N; ++i)
            b[i] = true;
        b[0] = b[1] = false;
        for (int_fast64_t i = 2; i <= max_N; ++i) {
            for (int_fast64_t j = i * i; j <= max_N; j += i)
                b[j] = false;
        }
    }
};

// BIT(Binary-Indexed-Tree) 別名：Fenwick Tree
template <typename T> struct BIT {
    int n;
    vector<T> d;
    BIT(int n = 0) : n(n), d(n + 1) {}
    // 要素iにxを加算
    void add(int i, T x = 1) {
        for (i++; i <= n; i += i & -i) {
            d[i] += x;
        }
    }
    // 区間[0, i]の合計を求める（閉区間）
    T sum(int i) {
        T x = 0;
        for (i++; i; i -= i & -i) {
            x += d[i];
        }
        return x;
    }
};

const int SZ = 1e6;
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    BIT<int> bit(SZ);
    constexpr auto prime = Prime<SZ>();
    for (int i = 1; i < SZ; i += 2) {
        if (prime.b[i] && prime.b[(i + 1) / 2]) {
            bit.add(i, 1);
        }
    }
    int Q;
    cin >> Q;
    while (Q--) {
        int l, r;
        cin >> l >> r;
        cout << bit.sum(r) - bit.sum(l - 1) << "\n";
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:38:   in 'constexpr' expansion of 'Prime<1000000>()'
a.cc:16:9: error: 'constexpr' loop iteration count exceeds limit of 262144 (use '-fconstexpr-loop-limit=' to increase the limit)
   16 |         for (int_fast64_t i = 0; i <= max_N; ++i)
      |         ^~~
Language: C++

import java.util.Scanner;
public class Main{
 public static void main(String args[]){
  boolean flag=false;
  Scanner scan=new Scanner(System.in);
  String s;

  s=scan.next();
  int n=Integer.parseInt(s);

  int l[]=new int[n+10];
  int r[]=new int[n+10];
  int mx=0; 

  for(int i=0;i<n;i++){
   s=scan.next();
   l[i]=Integer.parseInt(s);
   s=scan.next();
   r[i]=Integer.parseInt(s);
   if(mx<r[i])mx=r[i];
  }

  boolean f1,f2;
  long a[]=new long[mx+10];
  for(int i=0;i<mx+1;i++){
   f1=prime(i);
   f2=prime((i+1)/2);
   if(i>0)a[i]=a[i-1];
   if(f1&&f2&&i%2==1)a[i]++;
  }

  for(int i=0;i<n;i++)System.out.println(a[r[i]]-a[l[i]-1]);
 }
 public static boolean prime(long a){
  if(a<=1)return false;
  for(int i=2;i*i<=a;i++){
   if(a%i==0)return false;
  }
  return true;
 }
}



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

#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int func(int k){
	int j,s;
	s=1;
	if(k==1||k==0){
		s=0;
		return s;
	}
	for(j=2;j<=k/2;j++){
			if(k%j==0){
				s=0;
				break;
			}
		}
		return s;
} 
int main(){
	int n,i,j;
	cin>>n;
	int a[n],b[n],c[n];
	for(i=0;i<n;i++){
		cin>>a[i]>>b[i];
	} 
	for(i=0;i<n;i++){
		c[i]=0;
		for(j=a[i];j<=b[i];j++){
			if(func(j)==1&&func((j+1)/2)==1){
				c[i]=c[i]+1;
			}
		}
	}
	for(i=0;i<n;i++){
		cout<<c[i]<<endl;
	}
	return 0;
    } 

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

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

int main() {
  int q=1;
  cin >> q;
  vector<int> l(q), r(q);
  rep(i,q){
    l.at(i) = 3; r.at(i) = 7;
    cin >> l.at(i) >> r.at(i);
  }

  vector<bool> prime(100001,true);
  prime.at(0) = false;
  prime.at(1) = false;
  int rootN = (int)sqrt(100000);
  int i=2;
  while(i<=rootN){
    if(prime.at(i)){
      int mul = 2*i;
      while(mul<=100000){
        prime.at(mul) = false;
        mul += i;
      }
    }
    i++;
  }

  vector<int> s(100002,0);
  i=3;
  while(i<=100000{
    if(prime.at(i))  cout << "prime : " << i << endl;
    s.at(i+2) = s.at(i);
    if( (prime.at(i)) && (prime.at((i+1)/2)) )  s.at(i+2)++;
    i += 2;
  }

  int ans=0;
  rep(i,q){
    ans = s.at(r.at(i)+2)-s.at(l.at(i));
    cout << ans << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:18: error: expected ')' before '{' token
   34 |   while(i<=100000{
      |        ~         ^
      |                  )
Language: C++

void init_is_prime(int n, vector<int>& is_prime)
{
	is_prime[0] = is_prime[1] = 0;
	for (int i = 2; i <= sqrt(n); ++i)
	{
		if (!is_prime[i]) continue;
		for (int j = i * i; j < n; j += i)
			is_prime[j] = 0;
	}
}
int main()
{
	vector<int> is_prime(pow(10, 5), 1);
	init_is_prime(pow(10, 5), is_prime);
	vector<int> prime2017(pow(10, 5), 0);
	int n = 0;
	function<bool(int)> judge = [&](int x)
	{
		if (is_prime[x] && is_prime[(x + 1) / 2])
		{
			return true;
		}
		return false;
	};
	lp(i, pow(10, 5))
	{
		if (!judge(i)) prime2017[i] = n;
		else
		{
			prime2017[i] = ++n;
		}
	}
	int m;
	int l, r;
	cin >> m;
	lp(i, m)
	{
		cin >> l >> r;
		cout << prime2017[r] - prime2017[l - 1] << endl;
	}
}

Compiler output:
a.cc:1:27: error: 'vector' has not been declared
    1 | void init_is_prime(int n, vector<int>& is_prime)
      |                           ^~~~~~
a.cc:1:33: error: expected ',' or '...' before '<' token
    1 | void init_is_prime(int n, vector<int>& is_prime)
      |                                 ^
a.cc: In function 'void init_is_prime(int, int)':
a.cc:3:9: error: 'is_prime' was not declared in this scope; did you mean 'init_is_prime'?
    3 |         is_prime[0] = is_prime[1] = 0;
      |         ^~~~~~~~
      |         init_is_prime
a.cc:4:30: error: 'sqrt' was not declared in this scope
    4 |         for (int i = 2; i <= sqrt(n); ++i)
      |                              ^~~~
a.cc: In function 'int main()':
a.cc:13:9: error: 'vector' was not declared in this scope
   13 |         vector<int> is_prime(pow(10, 5), 1);
      |         ^~~~~~
a.cc:13:16: error: expected primary-expression before 'int'
   13 |         vector<int> is_prime(pow(10, 5), 1);
      |                ^~~
a.cc:14:23: error: 'pow' was not declared in this scope
   14 |         init_is_prime(pow(10, 5), is_prime);
      |                       ^~~
a.cc:14:35: error: 'is_prime' was not declared in this scope; did you mean 'init_is_prime'?
   14 |         init_is_prime(pow(10, 5), is_prime);
      |                                   ^~~~~~~~
      |                                   init_is_prime
a.cc:15:16: error: expected primary-expression before 'int'
   15 |         vector<int> prime2017(pow(10, 5), 0);
      |                ^~~
a.cc:17:9: error: 'function' was not declared in this scope; did you mean 'union'?
   17 |         function<bool(int)> judge = [&](int x)
      |         ^~~~~~~~
      |         union
a.cc:17:18: error: expected primary-expression before 'bool'
   17 |         function<bool(int)> judge = [&](int x)
      |                  ^~~~
a.cc:25:12: error: 'i' was not declared in this scope
   25 |         lp(i, pow(10, 5))
      |            ^
a.cc:25:9: error: 'lp' was not declared in this scope
   25 |         lp(i, pow(10, 5))
      |         ^~
a.cc:35:9: error: 'cin' was not declared in this scope
   35 |         cin >> m;
      |         ^~~
Language: C++

#include <iostream>
#include <math.h>
using namespace std;
const int n=100001;
int a[n];
 
int main(){
  for(int i=0;i<n;i++){
    a[i]=1;
  }
  for(int i=2;i<sqrt(n);i++){
    if(a[i]){
      for(int j=0;i*(j+2)<n;j++){
        a[i*(j+2)]=0;
      }
    }
  }
  a[0]=a[1]=0;
  vector<int> b(n,0);
  for(int i=3;i<n;i+=2){
    if(a[i]==1&&a[(i+1)/2]==1) b[i]=1;
  }
  for(int i=1;i<n;i++){
    b[i]+=b[i-1];
  }
  int q;cin>>q;
  vector<int> ans(q);
  for(int i=0;i<q;i++){
    int l,r;cin>>l>>r;
    ans[i]=b[r]-b[l-1];
  }
  for(int i=0;i<q;i++) cout<<ans[i]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:3: error: 'vector' was not declared in this scope
   19 |   vector<int> b(n,0);
      |   ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <math.h>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:19:10: error: expected primary-expression before 'int'
   19 |   vector<int> b(n,0);
      |          ^~~
a.cc:21:32: error: 'b' was not declared in this scope
   21 |     if(a[i]==1&&a[(i+1)/2]==1) b[i]=1;
      |                                ^
a.cc:24:5: error: 'b' was not declared in this scope
   24 |     b[i]+=b[i-1];
      |     ^
a.cc:27:10: error: expected primary-expression before 'int'
   27 |   vector<int> ans(q);
      |          ^~~
a.cc:30:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |     ans[i]=b[r]-b[l-1];
      |     ^~~
      |     abs
a.cc:30:12: error: 'b' was not declared in this scope
   30 |     ans[i]=b[r]-b[l-1];
      |            ^
a.cc:32:30: error: 'ans' was not declared in this scope; did you mean 'abs'?
   32 |   for(int i=0;i<q;i++) cout<<ans[i]<<endl;
      |                              ^~~
      |                              abs
Language: C++


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

//a[i]=iが2017に似た数なら1、違ければ0 を考えると累積和になる

int main(){
    int q;
    cin >> q;
    
   
   //エラトステネスのふるい
    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<maxi; i++){
        if(i % 2 == 0) continue; //偶数は与えられないし絶対素数じゃない
        if(is_prime[i] && is_prime[(i+1)/2]) a[i]=1;
    }

    //l<=x<=rで2017に似た数の総和はaの累積和を用いて高速に求められる
    vector<int> s(MAX+1,0);
    for(int i=0; i<MAX; i++) s[i+1] = s[i] + a[i];

    //クエリ処理
    int Q; 
    cin >> Q; //Q個のクエリが与えられる
    for(int q=0; q < Q; ++q){
        int l, r;
        cin >> l >> r;
        ++r; //今回のクエリではr自身も含むので+1する

        cout << s.at(r) - s.at(l) << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:20: error: 'maxi' was not declared in this scope
   28 |     for(int i=0; i<maxi; i++){
      |                    ^~~~
Language: C++


#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static void ABC084D();

#if 1
int main()
{
	ABC084D();
	fflush(stdout);
	return 0;
}
#endif

static void ABC084D()
{
	int Q;
	getint(Q);
	std::vector<int> pnCounts(100001, 0);
	pnCounts[0] = 0;
	pnCounts[1] = 0;
	
	for (int i = 2; i < 100001; i++) {
		std::map<int, int> primes, primes2;
		pnCounts[i] = pnCounts[i - 1];

		if ((i % 2) == 0) continue;

		tp_getPrimes(i, primes);
		if ((primes.size() == 1) && (primes.begin()->second == 1)) {
			tp_getPrimes((i + 1) / 2, primes2);
			if ((primes2.size() == 1) && (primes2.begin()->second == 1)) {
				pnCounts[i]++;
			}
		}
	}

	for (int i = 0; i < Q; i++) {
		int li, ri;
		getint(li, ri);
		printf("%d\n", pnCounts[ri] - pnCounts[li - 1]);
	}
}


Compiler output:
a.cc: In function 'void ABC084D()':
a.cc:74:17: error: 'tp_getPrimes' was not declared in this scope
   74 |                 tp_getPrimes(i, primes);
      |                 ^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  int c=0;
  int d=9999;
  vector<int>result;
    for(int j=0;j<(d-c)/2+1;j++){
      int e=c+2*j;
      int f=0;
      if(e==1){
        f=1;
      }
      if(f==0){
        for(int k=1;k<(sqrt(e)+1)/2;k++){
          if(e%(2*k+1)==0){
            f=1;
          	break;
          }
        }
      }
      int g=(e+1)/2;
        if(g%2==0){
          f=1;
        }
      if(f==0){
        for(int l=1;l<sqrt(g)/2+1;l++){
          if(g%(2*l+1)==0){
            f=1;
          	break;
          }
        } 
      }
      if(e==3||e==5){
        f=0;
      }
      if(f==0){
        result.push_back(e);
        
        
      }
    }
  int co=result.size();
  for(int i=0;i<N;i++){
    int e;
    int f;
    cin>>e;
    cin>>f;
    int count=0;
    for(int j=0;j<co;j++){
      if(e<=result.at(j)<=f){
        count+=1;
      }
    }
    cout<<count<<endl;
  }
}
      
    



}


        
        
        


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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  int c=0;
  int d=9999;
  vector<int>result;
    for(int j=0;j<(d-c)/2+1;j++){
      int e=c+2*j;
      int f=0;
      if(e==1){
        f=1;
      }
      if(f==0){
        for(int k=1;k<(sqrt(e)+1)/2;k++){
          if(e%(2*k+1)==0){
            f=1;
          	break;
          }
        }
      }
      int g=(e+1)/2;
        if(g%2==0){
          f=1;
        }
      if(f==0){
        for(int l=1;l<sqrt(g)/2+1;l++){
          if(g%(2*l+1)==0){
            f=1;
          	break;
          }
        } 
      }
      if(e==3||e==5){
        f=0;
      }
      if(f==0){
        result.push_back(e);
        
        
      }
    }
  int co=result.size()
  for(int i=0;i<N;i++){
    int e;
    int f;
    cin>>e;
    cin>>f;
    int count=0;
    for(int j=0;j<co;j++){
      if(e<=result.at(j)<=f){
        count+=1;
      }
    }
    cout<<count<<endl;
  }
}
      
    



}


        
        
        


Compiler output:
a.cc: In function 'int main()':
a.cc:46:3: error: expected ',' or ';' before 'for'
   46 |   for(int i=0;i<N;i++){
      |   ^~~
a.cc:46:15: error: 'i' was not declared in this scope
   46 |   for(int i=0;i<N;i++){
      |               ^
a.cc: At global scope:
a.cc:65:1: error: expected declaration before '}' token
   65 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  int c=0;
  int d=9999;
  vector<int>result;
    for(int j=0;j<(d-c)/2+1;j++){
      int e=c+2*j;
      int f=0;
      if(e==1){
        f=1;
      }
      if(f==0){
        for(int k=1;k<(sqrt(e)+1)/2;k++){
          if(e%(2*k+1)==0){
            f=1;
          	break;
          }
        }
      }
      int g=(e+1)/2;
        if(g%2==0){
          f=1;
        }
      if(f==0){
        for(int l=1;l<sqrt(g)/2+1;l++){
          if(g%(2*l+1)==0){
            f=1;
          	break;
          }
        } 
      }
      if(e==3||e==5){
        f=0;
      }
      if(f==0){
        result.push_back(e);
        
        
      }
    }
  int co=result.size()
  for(i=0;i<N;i++){
    int e;
    int f;
    cin>>e;
    cin>>f;
    int count=0;
    for(j=0;j<co;j++){
      if(e<=result.at(j)<=f){
        count+=1;
      }
    }
    cout<<count<<endl;
  }
}
      
    



}


        
        
        


Compiler output:
a.cc: In function 'int main()':
a.cc:46:3: error: expected ',' or ';' before 'for'
   46 |   for(i=0;i<N;i++){
      |   ^~~
a.cc:46:11: error: 'i' was not declared in this scope
   46 |   for(i=0;i<N;i++){
      |           ^
a.cc: At global scope:
a.cc:65:1: error: expected declaration before '}' token
   65 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  int count=0;
  for(int i=0;i<N;i++){
    int c;
    int d;
    cin>>c;
    cin>>d;
    for(int j=0;j<(d-c)/2+1;j++){
      int e=c+2j;
      int f=0
      for(int k=2;k<e/2+1;k++){
        if(e/k==0){
          f=1;
          break;
        }
      }
      if(f=0){
        for(int l=2;l<e/4+1;l++){
          if(e/l==0){
            f=1;
          	break;
          }
        } 
      }
      if(f==0){
        count+=1
      }
    }
  }
}

        
        
        

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: cannot convert '__complex__ int' to 'int' in initialization
   14 |       int e=c+2j;
      |             ~^~~
      |              |
      |              __complex__ int
a.cc:16:7: error: expected ',' or ';' before 'for'
   16 |       for(int k=2;k<e/2+1;k++){
      |       ^~~
a.cc:16:19: error: 'k' was not declared in this scope
   16 |       for(int k=2;k<e/2+1;k++){
      |                   ^
a.cc:31:17: error: expected ';' before '}' token
   31 |         count+=1
      |                 ^
      |                 ;
   32 |       }
      |       ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#defene int long long
signed main() {
    vector<int> is_prime(100005,1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (int i = 2; i < 100005; i++) {
        if (!is_prime[i]) continue;
        for (int j = i*2; j < 100005; j+=i) is_prime[j] = 0;
    }
    vector<int> a(100005, 0);
    for (int i = 0; i < 100005; i++) {
        if (i % 2 == 0) continue;
        if (is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
    }
    vector<int> s(100005, 0);
    for (int i = 0; i < 100005; i++) s[i+1] = s[i] + a[i];
    int Q; 
    cin >> Q;
    for (int i = 0; 1 < Q; i++) {
        int l, r;
        cin >> l >> r;
        cout << s[r+1]-s[l] << endl;
    }
}


Compiler output:
a.cc:3:2: error: invalid preprocessing directive #defene; did you mean #define?
    3 | #defene int long long
      |  ^~~~~~
      |  define
Language: C++

#include <bits/stdc++.h>
using namespace std;
#defene int long long
signed main() {
    vector<int> is_prime(100005,1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (int i = 2; i < 100005; i++) {
        if (!is_prime[i]) continue;
        for (int j = i*2; j < 100005; j+=i) is_prime[j] = 0;
    }
    vector<int> a(100005, 0);
    for (int i = 0; i < 100005; i++) {
        if (i % 2 == 0) continue;
        if (is_prime[i] && is_prime[(i+1)/2]) a[i] = 1;
    }
    vector<int> s(100005, 0);
    for (int i = 0; i < MAX; i++) s[i+1] = s[i] + a[i];
    int Q; 
    cin >> Q;
    for (int i = 0; 1 < Q; i++) {
        int l, r;
        cin >> l >> r;
        cout << s[r+1]-s[l] << endl;
    }
}

Compiler output:
a.cc:3:2: error: invalid preprocessing directive #defene; did you mean #define?
    3 | #defene int long long
      |  ^~~~~~
      |  define
a.cc: In function 'int main()':
a.cc:17:25: error: 'MAX' was not declared in this scope
   17 |     for (int i = 0; i < MAX; i++) s[i+1] = s[i] + a[i];
      |                         ^~~
Language: C++

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

// 素数
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

vector<int> a(100010);

int main(){
    for(int i=1;i<100010;i+=2){
        if(is_prime(i) && is_prime((i+1)/2)){
          a[i]=1;
        }
    }

    ll s(100010,0);
    rep(i,100010){
      s[i+1]=s[i]+a[i];
    }
    ll q;
    cin>>q;
    while(q--){
        ll l,r;
        cin>>l>>r;
        r++;
        cout<<s[r]-s[l]<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:18: error: expression list treated as compound expression in initializer [-fpermissive]
   24 |     ll s(100010,0);
      |                  ^
a.cc:26:8: error: invalid types 'long long int[int]' for array subscript
   26 |       s[i+1]=s[i]+a[i];
      |        ^
a.cc:26:15: error: invalid types 'long long int[int]' for array subscript
   26 |       s[i+1]=s[i]+a[i];
      |               ^
a.cc:34:16: error: invalid types 'long long int[long long int]' for array subscript
   34 |         cout<<s[r]-s[l]<<endl;
      |                ^
a.cc:34:21: error: invalid types 'long long int[long long int]' for array subscript
   34 |         cout<<s[r]-s[l]<<endl;
      |                     ^
Language: C++

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

// 素数
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

vector<int> a(100010);

int main(){
    for(int i=1;i<100010;i+=2){
        if(is_prime(i) && is_prime((i+1)/2)){
          a[i]=1;
        }
    }

    ll s(100010,0);
    rep(i,100010){
      s[i+1]=s[i]+a[i];
    }
    ll q;
    cin>>q;
    while(q--){
        ll l,r;
        cin>>l>>r;
        r++;
        cout<<s[r]-s[l]<<endl;
    }
    return 0;
}

Compiler output:
a.cc:3:2: error: invalid preprocessing directive #difine; did you mean #define?
    3 | #difine ll long long
      |  ^~~~~~
      |  define
a.cc:7:15: error: 'll' was not declared in this scope
    7 | bool is_prime(ll n){
      |               ^~
a.cc: In function 'int main()':
a.cc:19:20: error: 'is_prime' cannot be used as a function
   19 |         if(is_prime(i) && is_prime((i+1)/2)){
      |            ~~~~~~~~^~~
a.cc:19:35: error: 'is_prime' cannot be used as a function
   19 |         if(is_prime(i) && is_prime((i+1)/2)){
      |                           ~~~~~~~~^~~~~~~~~
a.cc:24:5: error: 'll' was not declared in this scope
   24 |     ll s(100010,0);
      |     ^~
a.cc:26:7: error: 's' was not declared in this scope
   26 |       s[i+1]=s[i]+a[i];
      |       ^
a.cc:28:7: error: expected ';' before 'q'
   28 |     ll q;
      |       ^~
      |       ;
a.cc:29:10: error: 'q' was not declared in this scope
   29 |     cin>>q;
      |          ^
a.cc:31:11: error: expected ';' before 'l'
   31 |         ll l,r;
      |           ^~
      |           ;
a.cc:32:14: error: 'l' was not declared in this scope
   32 |         cin>>l>>r;
      |              ^
a.cc:32:17: error: 'r' was not declared in this scope
   32 |         cin>>l>>r;
      |                 ^
a.cc:34:15: error: 's' was not declared in this scope
   34 |         cout<<s[r]-s[l]<<endl;
      |               ^
Language: C

#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// string to int : -48
// a to A : -32
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

struct PrimeNumber
{
    //O(sqrt(n))
    bool is_prime(long long n){
        for(long long i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return n != 1;
    }

    //O(sqrt(n))  isn't sorted
    vector<long long> divisor(long long n){
        vector<long long> res;
        for(long long i = 1; i * i <= n; i++){
            if(n % i == 0){
                res.push_back(i);
                if(i != n / i) res.push_back(n / i);
            }
        }
        return res;
    }

    //O(sqrt(n))
    map<long long, long long> prime_factor(long long n){
        map<long long, long long> res;
        for(long long i = 2; i * i <= n; i++){
            while(n % i == 0){
                n /= i;
                res[i]++;
            }
        }
        if(n != 1) res[n] = 1;
        return res;
    }

    //O(n log log n)
    map<long long, ll> eratosthenes(long long n){
        map<long long, ll> prime;
        vector<bool> is_prime(n + 1, true);
        long long p = 0;
        is_prime[0] = false; is_prime[1] = false;
        for(long long i = 2; i <= n; i++){
            if(is_prime[i]) prime[i]++;
            for(long long j = 2 * i; j <= n; j += i) is_prime[j] = false;
        }
        return prime;
    }
};

int main() {
    std::cout << std::fixed << std::setprecision(15);
    ll Q; cin >> Q;
    PrimeNumber num;
    map<ll, ll> primes = num.eratosthenes(100000);

    vector<ll> like_2017(100000);
    vector<bool> is_like_2017(100000, false);
    ll count = 0;
    
    for(ll i = 1; i <= 100001; i += 2){
        if(primes.count(i) >= 1 && primes.count((i+1) / 2) >= 1){
            count++;
            like_2017[i] = count;
            is_like_2017[i] = true;
        }else{
            like_2017[i] = count;
        }
    }

    rep(q, Q){
        ll l, r; cin >> l >> r;
        if(l == r){
            cout << like_2017[r] - like_2017[l] + is_like_2017[l] << endl;
        }else{
            cout << like_2017[r] - like_2017[l] + is_like_2017[l] + is_like_2017[r] << endl;
        }
    }
    

}

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++

// ref: https://img.atcoder.jp/abc084/editorial.pdf

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
    
    int N=100000;
    
    int Q; cin >> Q;
    
    vector<bool> pTbl(size+1, true);
    pTbl[0] = false;
    pTbl[1] = false;
    for(int prime=2; prime<=size; ++prime){
        if(!pTbl[prime]){ continue; }
        for(int tmp=2*prime; tmp<=size; tmp+=prime){ pTbl[tmp]=false; }
    }
    
    vector<int> vSimilar2017;
    for(uint i=0; i<=N; ++i){
        if(pTbl[i] && pTbl[(i+1)/2]){
            vSimilar2017.push_back(vPrime[i]);
        }
    }
    
    vector<int> cSum(N+1, 0);
    for(uint i=0; i<vSimilar2017.size(); ++i){
        ++cSum[ vSimilar2017[i] ];
    }
    for(int i=1; i<=N; ++i){ cSum[i] += cSum[i-1]; }
    
    for(int i=0; i<Q; ++i){
        int l, r; cin >> l >> r;
        cout << (cSum[r] - cSum[l-1]) << endl;
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:27: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+'
   53 |     vector<bool> pTbl(size+1, true);
      |                       ~~~~^~
a.cc:56:27: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<='
   56 |     for(int prime=2; prime<=size; ++prime){
      |                      ~~~~~^~~~~~
a.cc:58:33: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<='
   58 |         for(int tmp=2*prime; tmp<=size; tmp+=prime){ pTbl[tmp]=false; }
      |                              ~~~^~~~~~
a.cc:64:36: error: 'vPrime' was not declared in this scope
   64 |             vSimilar2017.push_back(vPrime[i]);
      |                                    ^~~~~~
Language: C++

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

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll n;
  cin >> n;
  vector <ll> prime(100001, 1);
  prime.at(0) = 0; prime.at(1) = 0;
  for (ll i = 2; i < 100001; i++) {
    if (prime.at(i)) {
      for (ll j = 2*i; j < 100001; j += i) prime.at(j) = 0;
    }
  }
  vector <ll> tmp(100001, 0);
  rep(i, 100000) tmp.at(i+1) = tmp.at(i) + prime.at(i+1)
  rep(i, n) {
    ll l, r;
    cin >> l >> r;
    cout << tmp.at(r) - tmp.at(l-1) << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:57: error: expected ';' before 'for'
   66 |   rep(i, 100000) tmp.at(i+1) = tmp.at(i) + prime.at(i+1)
      |                                                         ^
      |                                                         ;
a.cc:67:7: error: 'i' was not declared in this scope
   67 |   rep(i, n) {
      |       ^
a.cc:6:35: note: in definition of macro 'rep'
    6 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                   ^
Language: C++

#include <iostream>
#include <set>

#define NMAX 100001

using namespace std;

int main()
{
	int a[NMAX];
	a[0] = 0;
	a[1] = 0;
	for (int i = 2; i < NMAX; i++) {
		a[i] = 1;
	}
	for (int i = 2; i <= sqrt(NMAX); i++) {
		if (a[i] == 1) {
			for (int j = i + i; j < NMAX; j += i) {
				a[j] = 0;
			}
		}
	}

	int b[NMAX] = {};
	for (int i = 1; i < NMAX; i += 2) {
		if (a[i] == 1 && a[(i + 1) / 2] == 1) {
			b[i] = 1;
		}
	}
	for (int i = 1; i < NMAX; i += 2) {
		if (a[i] == 1 && a[(i + 1) / 2] == 1) {
			b[i] = 1;
		}
	}
	for (int i = 1; i < NMAX; i++) {
		b[i] += b[i - 1];
	}

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

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:30: error: 'sqrt' was not declared in this scope
   16 |         for (int i = 2; i <= sqrt(NMAX); i++) {
      |                              ^~~~
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];
	int Q;
  	cin>>Q;
  	vi l(Q);
  	vi r(Q);
  	rep(i,Q){
    	cout << c[l[i]] -c[r[i]-1] <<endl;
    }
}

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

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

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

#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstio>
#include<cstring>
using namespace std;
long long n[50050],f[100050],zs,a,lefts,rights;
//n[]为辅助空间，里面处理完全是质数；f[]用来前缀和，zs代表质数个数（欧拉线筛需要）
bool b[100050];
//标准的质数表
int main()
{
	b[0]=1,b[1]=1;//初始值
	for(int s=2;s<=100005;s++)//欧拉线筛
	{
		if(!b[s])//一个质数
		{
			n[zs++]=s;
		}
		for(int v=0;v<zs;v++)//处理
		{
			if(s*n[v]>100005)break;//超过了所求的质数范围
			b[n[v]*s]=true;//筛质数
			if(s%n[v]==0)break;//压成到O(n)的关键
		}
	}
	cin>>a;
	for(int s=2;s<=100005;s++)//前缀和
	{
		if(s%2==1&&b[s]==0&&b[(s+1)/2]==0)
		f[s]=1;
		f[s]+=f[s-1];
	}
	while(a--)//输入
	{
		cin>>lefts>>rights;
		cout<<f[rights]-f[lefts-1]<<endl;//前缀和的大法
	}
    return 0;
}

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

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

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

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

public class Solution {
    private static final int MAXN = 100000;
    private static boolean[] isPrime = new boolean[MAXN + 1];

    private static void generatePrimes() {
        Arrays.fill(isPrime, true);
        isPrime[0] = isPrime[1] = false;
        for(int i = 2; i <= MAXN; ++i) {
            if(isPrime[i]) {
                for(int j = 2 * i; j <= MAXN; j += i) {
                    isPrime[j] = false;
                }
            }
        }
    }

    private static Scanner scanner = new Scanner(System.in);
    public static void main(String[] args) {
        generatePrimes();
        int[] cumulativeCount = new int[MAXN + 1];
        for(int i = 1; i <= MAXN; ++i) {
            cumulativeCount[i] = cumulativeCount[i-1];
            if(isPrime[i] && isPrime[(i + 1) / 2]) {
                ++cumulativeCount[i];
            }
        }
        int q = scanner.nextInt();
        StringBuilder ans = new StringBuilder();
        while(q-- > 0) {
            int l = scanner.nextInt();
            int r = scanner.nextInt();
            int cnt = cumulativeCount[r] - cumulativeCount[l - 1];
            ans.append(cnt + "\n");
        }
        scanner.close();
        System.out.println(ans.toString());
    }
}

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