stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):


#include <bits/stdc++.h>

#define FRU                                  freopen("out.txt","w",stdout);

#define FRO                                  freopen("in.txt","r",stdin);

#define pb                                   push_back

#define pf                                   push_front

#define ppb                                  pop_back()

#define ppf                                  pop_front()

#define mp                                   make_pair

#define ff                                   first

#define ss                                   second

#define flash                                ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

#define mem(ara,n)                           memset(ara,n,sizeof ara)

#define fr(i,j,n)                            for(i=j;i<n;i++)

#define rf(i,j,n)                            for(i=n;i>=j;i--)

#define inf                                  2147483647

#define ll                                   long long

#define ull                                  unsigned long long

#define pii                                  pair<int,int>

#define vi                                   vector<int>

#define vll                                  vector <long long>

#define vch                                  vector <char>

#define itr                                  ::iterator

#define msi                                  map<string,int>

#define psi                                  pair <string,int>

#define vii                                  vector <pair<int,int> >

#define all(n)                               n.begin(),n.end()

#define INF                                  10000000000000000LL

#define pi                                   3.1415926535897932384626434

#define sii                                  set <int>

#define max3(a,b,c)                          max(a,max(b,c))

#define min3(a,b,c)                          min(a,min(b,c))

#define mid3(a,b,c)                          min(max(a,b),max(b,c),max(a,b))

#define max4(a,b,c,d)                        max(max(a,b),max(c,d))

#define min4(a,b,c,d)                        min(min(a,b),min(c,d))

#define endl                                 '\n'

#define endll                                cout<<"\n";

#define spc                                  ' '

#define ld                                   long double



using namespace std;







int main()

{

    flash

    string s,st;

    ll n,t,T,i,j,J,I,k,m;

    char ch;

    cin>>n;

    m=0;

    fr(i,1,n+1)

    {

        if(i%3==0||i%5==0)  continue;

        m+=i;

    }

    cout<<m;

    return 0;

}




// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	int a;

	long long int total = 0;

	scanf("%d", &a);

	

	for(int i = 1; i <= a; i++){

		if(i % 5 ==0 && i % 3 ==0 ){

			printf("");

		}

		else if (i % 3 ==0){

			printf("");

		}

		else if (i%5==0){

			printf("");

		}

		else{

			total = total + i;

		}

	}

	

	printf("%lld", total);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<cmath>

#include<iostream>

#include<algorithm>

#include<cstring>

#include<cstdlib>

#include<queue>

#include<map>

#include<stack>

#include<set>

#include<vector>

#include<functional>

using namespace std;

typedef long long LL;

inline LL read()

{

	LL kk=0,f=1;

	char cc=getchar();

	while(cc<'0'||cc>'9'){if(cc=='-')f=-1;cc=getchar();}

	while(cc>='0'&&cc<='9'){kk=(kk<<1)+(kk<<3)+cc-'0';cc=getchar();}

	return kk*f;

}

bool vis[2000222];int n;

int main()

{

	n=read();

	for(int i=1;i<=n/5+10;++i)vis[i*5]=1;

	for(int i=1;i<=n/3+10;++i)vis[i*3]=1;

	LL asd=0;

	for(int i=1;i<=n;++i)

	{

		if(!vis[i])asd+=i;

	}

	printf("%lld\n",asd);

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	int a;

	long long int total = 0;

	scanf("%d", &a);

	

	for(int i = 1; i <= a; i++){

		if(i % 5 ==0 && i % 3 ==0 ){

			printf("");

		}

		else if (i % 3 ==0){

			printf("");

		}

		else if (i%5==0){

			printf("");

		}

		else{

			total = total + i;

		}

	}

	

	printf("%lld", total);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

#define elif else if

typedef long long ll;

typedef unsigned long long ull;

#define DEBUG(x) cout<<(x)<<endl



int main()

{

    ll n;

    scanf("%lld", &n);

    ll ans = 0;

    for (int i = 1; i <= n;i++)

    {

        if (i % 3 == 0 && i % 5 == 0)

        {

            // puts("FizzBuzz");

            ;

        }

        elif(i%3==0)

        {

            // puts("Fizz");

            ;

        }

        elif(i%5==0)

        {

            // puts("Buzz");

            ;

        }

        else

        {

            ans += i;

            // printf("%lld\n", n);

        }

    }

    printf("%lld\n", ans);

    

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	int a;

	long long int total = 0;

	scanf("%d", &a);

	

	for(int i = 1; i <= a; i++){

		if(i % 5 ==0 && i % 3 ==0 ){

			printf("");

		}

		else if (i % 3 ==0){

			printf("");

		}

		else if (i%5==0){

			printf("");

		}

		else{

			total = total + i;

		}

	}

	

	printf("%lld", total);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

long long n;

long long ans;

int main(){

	cin>>n;

	for (long long i=1;i<=n;i++){

		if (i%3==0){

			continue;

		}

		if (i%5==0){

			continue;

		}

		ans+=i;

	}

	cout<<ans<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	int a;

	long long int total = 0;

	scanf("%d", &a);

	

	for(int i = 1; i <= a; i++){

		if(i % 5 ==0 && i % 3 ==0 ){

			printf("");

		}

		else if (i % 3 ==0){

			printf("");

		}

		else if (i%5==0){

			printf("");

		}

		else{

			total = total + i;

		}

	}

	

	printf("%lld", total);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



int main()

{

     int n,i;

     long long  sum=0;



     cin>>n;



     for(i = 1; i <= n; i++)

     {

          if(i%3==0 && i%5==0)

               sum=sum;

          else if(i%3==0)

               sum==sum;

          else if(i%5==0)

               sum==sum;

               else

                    sum+=i;



     }

     cout<<sum<<endl;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	int a;

	long long int total = 0;

	scanf("%d", &a);

	

	for(int i = 1; i <= a; i++){

		if(i % 5 ==0 && i % 3 ==0 ){

			printf("");

		}

		else if (i % 3 ==0){

			printf("");

		}

		else if (i%5==0){

			printf("");

		}

		else{

			total = total + i;

		}

	}

	

	printf("%lld", total);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define mp make_pair

#define ff first

#define ss second

#define pb push_back

#define w(x) scanf("%d",&x);while(x--)

#define rep(i,a,b) for(i=a;i<=b;i++)

#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define pi 2*acos(0.0)

using namespace std;

typedef long long ll;

typedef pair<ll,ll> pll;

typedef vector<int> vi;



long long int mod=1e9+9;

const int N=100000;

int t,i,j,cs=0,n,a,b;

string s;



int main()

{

    long long n;

    cin>>n;

    long long ans=n*(n+1)/2 ;

     long long a=n;

     n/=3;

     ans-=3*n*(n+1)/2;

     n=a/5;

     ans-=5*n*(n+1)/2;

     n=a/15;

     ans+=15*n*(n+1)/2;

    cout<<ans<<endl;

}






// Optimized solution to the same problem (faster):
#include <stdio.h>



int main (){

	int a;

	long long int total = 0;

	scanf("%d", &a);

	

	for(int i = 1; i <= a; i++){

		if(i % 5 ==0 && i % 3 ==0 ){

			printf("");

		}

		else if (i % 3 ==0){

			printf("");

		}

		else if (i%5==0){

			printf("");

		}

		else{

			total = total + i;

		}

	}

	

	printf("%lld", total);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>   //AA06( 21/ 04/ 20) If u see my code, Have a Good Day! (^_^)



using namespace std;



int main()

{

    long long int N, i, sum = 0;



    cin >> N;



    for(i = 1; i <= N; ++i) {



        if(i % 3 == 0 || i % 5 == 0 || i % 15 == 0) {

            continue;

        }



        sum = sum + i;





    }



    cout << sum << endl;



    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long N, sum;

	scanf("%lld", &N);

	sum = N*(N+1)/2;



	long long Un3 = N/3;

	long long Sn3 = 3*(Un3*(Un3+1)/2);

	

	long long Un5 = N/5;

	long long Sn5 = 5*(Un5*(Un5+1)/2);

	

	long long Un15 = N/15;

	long long Sn15 = 15*(Un15*(Un15+1)/2);



	printf("%lld", sum-Sn3-Sn5+Sn15);

			

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

   int n; cin >> n;

   long long sum =0;

   int p = n+1;

   while(p--)

   {

       if (p%5==0 || p%3 == 0){/*do nth */}

       else {sum += p;}

   }

   cout << sum <<endl;

    return 0;

}




// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long N, sum;

	scanf("%lld", &N);

	sum = N*(N+1)/2;



	long long Un3 = N/3;

	long long Sn3 = 3*(Un3*(Un3+1)/2);

	

	long long Un5 = N/5;

	long long Sn5 = 5*(Un5*(Un5+1)/2);

	

	long long Un15 = N/15;

	long long Sn15 = 15*(Un15*(Un15+1)/2);



	printf("%lld", sum-Sn3-Sn5+Sn15);

			

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#define GODSPEED ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

#define pb push_back

#define f(i,x,n) for(i=x;i<n;i++)

#define rf(i,x,n) for(i=n;i>x;i--)

#define ll long long

#define GCD(a,b) __gcd(a,b)

#define adios return 0;



/*

SHERAJUL ARIFIN

Dept. of CSE,

IUT.

*/





#include <bits/stdc++.h>

using namespace std;



int main()

{

    GODSPEED;

    ll t,n,a,b,c,d,s=0,i,j,flag;

    cin>>n;

    for(i=1;i<=n;i++)

    {

        if(i%15!=0 and i%3!=0 and i%5!=0) s+=i;

    }

    cout<<s<<endl;







    adios;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long N, sum;

	scanf("%lld", &N);

	sum = N*(N+1)/2;



	long long Un3 = N/3;

	long long Sn3 = 3*(Un3*(Un3+1)/2);

	

	long long Un5 = N/5;

	long long Sn5 = 5*(Un5*(Un5+1)/2);

	

	long long Un15 = N/15;

	long long Sn15 = 15*(Un15*(Un15+1)/2);



	printf("%lld", sum-Sn3-Sn5+Sn15);

			

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

	const int maxn=55;

	int a[maxn][maxn];

	int n;

	int main(){

		IOS

		cin>>n;

		long long ans=0;

		for(int i=1;i<=n;i++){

			if(i%3&&i%5)

				ans+=i;

		}

		cout<<ans<<endl;

		return 0;

	} 

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long N, sum;

	scanf("%lld", &N);

	sum = N*(N+1)/2;



	long long Un3 = N/3;

	long long Sn3 = 3*(Un3*(Un3+1)/2);

	

	long long Un5 = N/5;

	long long Sn5 = 5*(Un5*(Un5+1)/2);

	

	long long Un15 = N/15;

	long long Sn15 = 15*(Un15*(Un15+1)/2);



	printf("%lld", sum-Sn3-Sn5+Sn15);

			

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



 int main()

 {

 	int n;

 	cin>>n;

 	long long sum = 0;

 	for(int i = 1;i<=n;++i){

 		if(i%3 != 0 && i%5 != 0) sum += i;

	}

	cout<<sum<<endl;

 	return 0;

 }

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long N, sum;

	scanf("%lld", &N);

	sum = N*(N+1)/2;



	long long Un3 = N/3;

	long long Sn3 = 3*(Un3*(Un3+1)/2);

	

	long long Un5 = N/5;

	long long Sn5 = 5*(Un5*(Un5+1)/2);

	

	long long Un15 = N/15;

	long long Sn15 = 15*(Un15*(Un15+1)/2);



	printf("%lld", sum-Sn3-Sn5+Sn15);

			

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

#include<cmath>

#include<cstdlib>

#include<cstdio>

#include<cstring>

#include<iomanip>

#include<string>

#include<set>

#include<map>

#include<vector>

#include<queue>

#include<stack>

#include<utility>

#define PI acos(-1.0)

typedef long long ll;

using namespace std;

int main(){

	ll ans = 0,n;

	cin >> n;

	for(int i = 1;i <= n;i++){

		if(!(i % 3 == 0 || i % 5 == 0)){

			ans += i;

		}

	}

	cout << ans << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long N, sum;

	scanf("%lld", &N);

	sum = N*(N+1)/2;



	long long Un3 = N/3;

	long long Sn3 = 3*(Un3*(Un3+1)/2);

	

	long long Un5 = N/5;

	long long Sn5 = 5*(Un5*(Un5+1)/2);

	

	long long Un15 = N/15;

	long long Sn15 = 15*(Un15*(Un15+1)/2);



	printf("%lld", sum-Sn3-Sn5+Sn15);

			

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>



using namespace std;



int main(){

	long long int n; cin >> n;

	long long int res = 0;

	for(int i=1; i<=n; i++){

		if(i % 3 == 0){

			

		}else if(i % 5 == 0){

			

		}else{

			res += i;

		}

	}

	

	cout << res << "\n";

	return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long N, sum;

	scanf("%lld", &N);

	sum = N*(N+1)/2;



	long long Un3 = N/3;

	long long Sn3 = 3*(Un3*(Un3+1)/2);

	

	long long Un5 = N/5;

	long long Sn5 = 5*(Un5*(Un5+1)/2);

	

	long long Un15 = N/15;

	long long Sn15 = 15*(Un15*(Un15+1)/2);



	printf("%lld", sum-Sn3-Sn5+Sn15);

			

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>



using namespace std;



int main(){

    int n;

    cin>>n;

    long long int s=0;

    for(int i=1;i<=n;i++){

        if(i%3 && i%5){

            s+=i;

        }

    }

    cout<<s;

    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long N, sum;

	scanf("%lld", &N);

	sum = N*(N+1)/2;



	long long Un3 = N/3;

	long long Sn3 = 3*(Un3*(Un3+1)/2);

	

	long long Un5 = N/5;

	long long Sn5 = 5*(Un5*(Un5+1)/2);

	

	long long Un15 = N/15;

	long long Sn15 = 15*(Un15*(Un15+1)/2);



	printf("%lld", sum-Sn3-Sn5+Sn15);

			

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

    ll n;  cin>>n;

    ll sum=0;

    for(ll i=1;i<=n;i++)

    {

        if(i%3==0||i%5==0)

            continue;

        sum+=i;

    }

    cout<<sum;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long N, sum;

	scanf("%lld", &N);

	sum = N*(N+1)/2;



	long long Un3 = N/3;

	long long Sn3 = 3*(Un3*(Un3+1)/2);

	

	long long Un5 = N/5;

	long long Sn5 = 5*(Un5*(Un5+1)/2);

	

	long long Un15 = N/15;

	long long Sn15 = 15*(Un15*(Un15+1)/2);



	printf("%lld", sum-Sn3-Sn5+Sn15);

			

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int  main(){

	ll n,ans=0;

	cin>>n;

	for(int i=1;i<=n;i++){

		if(i%3==0||i%5==0)continue;

		else ans+=i; 

	}

	cout<<ans<<endl;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long N, sum;

	scanf("%lld", &N);

	sum = N*(N+1)/2;



	long long Un3 = N/3;

	long long Sn3 = 3*(Un3*(Un3+1)/2);

	

	long long Un5 = N/5;

	long long Sn5 = 5*(Un5*(Un5+1)/2);

	

	long long Un15 = N/15;

	long long Sn15 = 15*(Un15*(Un15+1)/2);



	printf("%lld", sum-Sn3-Sn5+Sn15);

			

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int main(){

    long long n,ans=0;

    cin>>n;

    for(int i=1;i<=n;i++){

        if(i%3&&i%5){

            ans+=i;

        }

    }

    cout<<ans;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long N, sum;

	scanf("%lld", &N);

	sum = N*(N+1)/2;



	long long Un3 = N/3;

	long long Sn3 = 3*(Un3*(Un3+1)/2);

	

	long long Un5 = N/5;

	long long Sn5 = 5*(Un5*(Un5+1)/2);

	

	long long Un15 = N/15;

	long long Sn15 = 15*(Un15*(Un15+1)/2);



	printf("%lld", sum-Sn3-Sn5+Sn15);

			

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

         long long c=0,i,n,f=0,b=0;

         cin>>n;

         for(i=1;i<=n;i++)

        {

           b+=i;

           if((i%3)==0 || (i%5)==0) {f+=i;

           }

         }

 

         cout<<b-f<<endl;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long N, sum;

	scanf("%lld", &N);

	sum = N*(N+1)/2;



	long long Un3 = N/3;

	long long Sn3 = 3*(Un3*(Un3+1)/2);

	

	long long Un5 = N/5;

	long long Sn5 = 5*(Un5*(Un5+1)/2);

	

	long long Un15 = N/15;

	long long Sn15 = 15*(Un15*(Un15+1)/2);



	printf("%lld", sum-Sn3-Sn5+Sn15);

			

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
// In the name of God



#include <bits/stdc++.h>



using namespace std;



int main() {

	ios_base::sync_with_stdio(false);

	cin.tie(0);



	int n;

	cin >> n;



	long long ans = 0;

	

	for(int i = 1; i <= n; i++) {

		if(i % 3 == 0 || i % 5 == 0) continue;

		ans += i;

	}

	cout << ans;



	return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	long long N, sum;

	scanf("%lld", &N);

	sum = N*(N+1)/2;



	long long Un3 = N/3;

	long long Sn3 = 3*(Un3*(Un3+1)/2);

	

	long long Un5 = N/5;

	long long Sn5 = 5*(Un5*(Un5+1)/2);

	

	long long Un15 = N/15;

	long long Sn15 = 15*(Un15*(Un15+1)/2);



	printf("%lld", sum-Sn3-Sn5+Sn15);

			

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<stdio.h>

#include<iostream>

#include<cmath>

#include<algorithm>

#include<vector>

#include<map>

#include<set>

#include<stack>

#include<iterator>

#include<iomanip>

#include<string>

using namespace std;



long long int sum(long long int x)

{

    return x*(x+1)/2;

}



int main()

{

    long long int n;

    cin>>n;

    cout<<sum(n)+15*sum(n/15)-3*sum(n/3)-5*sum(n/5);

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

int main(){

	long long int n,sum=0;

	scanf("%lld",&n);

		for(int i=1;i<=n;i++){

		if(i%3 == 0 && i%5 ==0) continue;

		else if(i%3==0) continue;

		else if(i%5==0) continue;

		sum += i;

		}

			printf("%lld\n",sum);

 	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define ll long long int

using namespace std;

ll i, j , k , l , n,counter;

 bool ara3[200000];

 void seive()

 {

     for(i= 2; i<=100001; i++)

     {

         ara3[i]  = true;

     }

     ara3[1]  = false;

     for(i=2 ; i<=100001; i++)

     {

         for(j=2;i*j<=100001; j++)

         {

             if(ara3[i]==true)

             {

                 ara3[i*j] = false;

             }

         }

     }

 }

int main(void)

{

    seive();

     while(cin>>n)

     {

         counter = 0;

         for(i=1,j=n; i<=n; i++,j--)

         {

             if(ara3[i]==true && ara3[j]==true)

             {

                 counter++;

             }



         }

         cout<<counter<<endl;

     }

     return 0;



}

// Optimized solution to the same problem (faster):
#include <iostream>

#include<math.h>



using namespace std;



int IsPrime(int a,int b)

{

    int i,p=0,q=0;

    if(a==1||b==1)

    {

        return 0;

    }

    for(i=2;i<=sqrt(a);i++)

    {



        if(a%i==0)

            {

                p=1;

                break;

            }

    }



    for(i=2;i<=sqrt(b);i++)

    {



        if(b%i==0)

            {

                q=1;

                break;

            }



    }

    if(p!=1&&q!=1)

        return 1;

    else

        return 0;



}

int main()

{

    int a,b,i,c=0;

    while( cin>>a)

    {

        c=0;



    for(i=0;i<a;i++)

    {

        if((b=IsPrime(i+1,a-i))==1)

            c++;



    }

    cout<<c<<endl;



}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cmath>

#include<iostream>

#include<bitset>



#define MAX 10001



using namespace std;



bitset<MAX> b1;



void ComputePrimes(){

	b1.set();



	b1.reset(1);

	for(int i = 4; i <= 10000; ++i){

		for(int j = 2; j <= sqrt((double)i); ++j){

			if( i % j == 0 ){

				b1.reset( i );

				break;

			}

		}

	}

}



int main()

{

	ComputePrimes();



	while( true )

	{

		int N, P = 0;

		

		cin >> N;



		if( cin.eof() )

			break;



		for(int i = 1; i <= N; ++i){

			if( b1[N - i + 1] == true && b1[ i ] == true )

				++P;

		}



		cout << P << '\n';

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cmath>

#include<iostream>

#include<bitset>



#define MAX 10001



using namespace std;



int bComposite[MAX];



void ComputePrimes(){

	bComposite[1] = 1;

	for(int i = 4; i <= 10000; ++i){

		if( bComposite[ i ] == 0 ){

			for(int j = 2; j <= sqrt((double)i); ++j){

				if( i % j == 0 ){

					bComposite[ i ] = 1;

					break;

				}

			}

		}

		if( bComposite[ i ] == 0 ){

			for(unsigned int j = 2; i * j <= 10000; ++j){

				bComposite[ i * j ] = 1;

			}

		}

	}

}



int main()

{

	ComputePrimes();



	while( true )

	{

		int N, P = 0;

		

		cin >> N;



		if( cin.eof() )

			break;



		for(int i = 1; i <= N; ++i){

			if( !bComposite[N - i + 1] && !bComposite[ i ] )

				++P;

		}



		cout << P << '\n';

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

const int maxn=200005;

typedef long long ll;

int n,m;

char s[maxn];

int main()

{

	scanf("%s",s+1);

	n=strlen(s+1);

	ll ans=0,cnt=0;

	for(int i=n;i>=1;i--)

	{

		if(s[i]=='A')

			ans+=cnt;

		else if(s[i]=='C')

		{

			if(s[i-1]=='B')cnt++;

			else cnt=0;

		}

		else

		{

			if(s[i+1]=='C');

			else cnt=0;

		}

	}

	printf("%lld\n",ans);

	return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

using namespace std;



char s[200002];

int z[200001];

int main(){

	scanf("%s",s+1);

	int n=strlen(s+1);

	for(int i=1;i<=n;i++)

		if(s[i]=='A')z[++z[0]]=1;

		else if(i<n&&s[i]=='B'&&s[i+1]=='C')

			z[++z[0]]=2,i++;

		else z[++z[0]]=3;

	long long ans=0;

	for(int i=1;i<=z[0];i++){

		if(z[i]==3)continue;

		int j=i;

		while(j<=z[0]&&z[j]!=3)j++;

		int w=0;

		for(int k=i;k<=j;k++)

			if(z[k]==2)ans+=k-i-w,w++;

		i=j;

	}

	printf("%lld\n",ans);

}

// Fastest known solution for this problem: