stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<cstdio>

#include<cstring>

#include<cmath>

#include<map>

#include<algorithm>

#include <iostream>

using namespace std;

typedef long long LL;

int a[100000];

int main()

{

    int sx, sy, tx, ty;

    cin >> sx >> sy >> tx >> ty;

    int x = tx-sx;

    int y = ty-sy;

    for(int i = 0;i < y;i++)

    {

        cout<<"U";

    }

    for(int i = 0;i < x;i++)

    {

        cout<<"R";

    }

    for(int i = 0;i < y;i++)

    {

        cout<<"D";

    }

    for(int i = 0;i < x;i++)

    {

        cout<<"L";

    }

    cout<<"L";

    for(int i = 0;i <= y;i++)

    {

        cout<<"U";

    }

    cout<<"R";

    for(int i = 0;i < x;i++)

    {

        cout<<"R";

    }

    cout<<"D";

    cout<<"R";

    for(int i = 0;i <= y;i++)

    {

        cout<<"D";

    }

    cout<<"L";

    for(int i = 0;i < x;i++)

    {

        cout<<"L";

    }

    cout<<"U";

    return 0;

}

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

#include <stdlib.h>

#include <string.h>

#include <math.h>

#define INF 0x3f3f3f3f



char s[100];

typedef long long ll;



void step(int x, int y)

{

    for (int i = 0; i < y; ++i)

    {

        printf("U");

    }

    for (int i = 0; i < x; ++i)

    {

        printf("R");

    }

    for (int i = 0; i < y; ++i)

    {

        printf("D");

    }

    for (int i = 0; i < x; ++i)

    {

        printf("L");

    }

}



int main()

{

    //freopen("C:\\Users\\tiger\\Desktop\\a.txt","r",stdin);

	int x1,y1;

    int x2,y2;

    while ( ~scanf("%d %d %d %d", &x1, &y1, &x2, &y2) )

    {

        int x = x2 - x1;

        int y = y2 - y1;

        step(x,y);

        printf("L");

        for (int i = 0; i <= y; ++i)

        {

            printf("U");

        }

        for (int i = 0; i <= x; ++i)

        {

            printf("R");

        }

        printf("D");

        printf("R");

        for (int i = 0; i <= y; ++i)

        {

            printf("D");

        }

        for (int i = 0; i <= x; ++i)

        {

            printf("L");

        }

        printf("U\n");

    }

	return 0;

}

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

#include<cstdio>

#include<cmath>

#include<cstring>

#include<algorithm>

#include<stack>

#include<queue>

using namespace std;

  int a[100000];

  int main()

  {

      int sx, sy, tx, ty;

 

	  cin >> sx >> sy >> tx >> ty;

      for(int i=1;i<=ty-sy;i++)

      {

         cout<<"U";

     }

     for(int i=1;i<=tx-sx;i++)

     {

         cout<<"R";

     }

     for(int i=1;i<=ty-sy;i++)

     {

         cout<<"D";

     }

     for(int i=1;i<=tx-sx;i++)

     {

         cout<<"L";

     }

     cout<<"L";

     for(int i=0;i<=ty-sy;i++)

     {

         cout<<"U";

     }

     cout<<"R";

     for(int i=1;i<=tx-sx;i++)

     {

         cout<<"R";

     }

     cout<<"D";

     cout<<"R";

     for(int i=0;i<=ty-sy;i++)

     {

         cout<<"D";

     }

     cout<<"L";

     for(int i=1;i<=tx-sx;i++)

     {

         cout<<"L";

     }

   cout<<"U";

   return 0;

 }

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

#include <algorithm>

using namespace std;



int main()

{

    int sx,sy,tx,ty,i=0,a,b,c,d;

    char ch[20000];

    scanf("%d%d%d%d",&sx,&sy,&tx,&ty);

    a=sx,b=sy,c=tx,d=ty;

    for(;;)

    {

      if(b<d)

      {

         ch[i++]='U';

          b++;

      }

      else if(a<c)

      {

          ch[i++]='R';

          a++;

      }

      if(a==tx&&b==ty)break;

    }

    int j=i;a=sx-1,b=sy;

    ch[j++]='L';

    for(;;)

    {

        if(b<d+1)

        {

            ch[j++]='U';

            b++;

        }

        else if(a<c)

        {

            ch[j++]='R';

            a++;

        }

        if(a==c&&b==d+1)

            break;

    }

    ch[j++]='D';

    int x;

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

        printf("%c",ch[x]);

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

    {

        if(ch[x]=='U')printf("D");

        else printf("L");

    }

    for(x=i;x<j;x++)

    printf("%c",ch[x]);

    for(x=i;x<j;x++)

    {

        if(ch[x]=='L')printf("R");

        else if(ch[x]=='U')printf("D");

        else if(ch[x]=='R')printf("L");

        else printf("U");

    }

    printf("\n");

    return 0;

}


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

#include<cstring>

#include<algorithm>

#include<cmath>

using namespace std;

int main()

{

	long long sx,sy,tx,ty,stx,sty;

	while(cin>>sx)

	{

		cin>>sy>>tx>>ty;

		stx=tx-sx;

		sty=ty-sy;

		for(int i=0;i<sty;i++)

		{

			cout<<'U';

		}

		for(int i=0;i<stx;i++)

		{

			cout<<'R';

		}

		for(int i=0;i<sty;i++)

		{

			cout<<'D';

		}

		for(int i=0;i<stx;i++)

		{

			cout<<'L';

		}

		cout<<'L';

		for(int i=0;i<=sty;i++)

		{

			cout<<'U';

		}

		for(int i=0;i<=stx;i++)

		{

			cout<<'R';

		}

		cout<<'D';

		cout<<'R';

		for(int i=0;i<=sty;i++)

		{

			cout<<'D';

		}

		for(int i=0;i<=stx;i++)

		{

			cout<<'L';

		}

		cout<<'U';

		cout<<endl;

	}

	return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>//https://vjudge.net/contest/215848#overview

#include<cmath>

#include<malloc.h>

#include<stdlib.h>

#include<cstring>

#include<algorithm>

using namespace std;

int main()

{

	int sx,sy,tx,ty;

	while(~scanf("%d %d %d %d",&sx,&sy,&tx,&ty))

	{

		int a,b,c,d,e,f,g,k;

		a=tx-sx;b=ty-sy;c=a+1;d=b+1;

		e=a;f=b;g=c;k=d;

		while(b--)

		{

			printf("U");

		}

		while(a--)

		{

			printf("R");

		}//第一次到达终点 

		while(f--)

		{

			printf("D");

		}

		while(e--)

		{

			printf("L");

		}//第一次回到起点 

		printf("L");

		while(d--)

		{

			printf("U");

		}

		while(c--)

		{

			printf("R");

		}

		printf("DR");//第二次到达终点 

		while(k--)

		{

			printf("D");

		}

		while(g--)

		{

			printf("L");

		}

		printf("U");//第二次回到起点 

		printf("\n");

	}

	return 0;

}

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

#include<cstdio>

using namespace std;

int main() 

{

	int sx,sy,tx,ty,ssx,ssy,ttx,tty;

	while(~scanf("%d%d%d%d",&sx,&sy,&tx,&ty))

	{

		ssx=sx;

		ssy=sy;

		//ttx=tx;

		//tty=ty;

		while(ssy<ty)

		{

			ssy++;

			cout<<'U';

		}

		while(ssx<tx)

		{

			ssx++;

			cout<<'R';

		}

		while(ssy>sy)

		{

			ssy--;

			cout<<'D';

		}

		while(ssx>sx)

		{

			ssx--;

			cout<<'L';

		}

		

		ssx--;

		cout<<'L';

		while(ssy<ty+1)

		{

			ssy++;

			cout<<'U';

		}

		while(ssx<tx)

		{

			ssx++;

			cout<<'R';

		}

		ssy--;

		cout<<'D';

		ssx++;

		cout<<'R';

		while(ssy>sy-1)

		{

			ssy--;

			cout<<'D';

		}

		while(ssx>sx)

		{

			ssx--;

			cout<<'L';

		}

		cout<<'U'<<endl;

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>//https://vjudge.net/contest/215848#overview

#include<cmath>

#include<malloc.h>

#include<stdlib.h>

#include<cstring>

#include<algorithm>

using namespace std;

int main()

{

	int sx,sy,tx,ty;

	while(~scanf("%d %d %d %d",&sx,&sy,&tx,&ty))

	{

		int a,b,c,d,e,f,g,k;

		a=tx-sx;b=ty-sy;c=a+1;d=b+1;

		e=a;f=b;g=c;k=d;

		while(b--)

		{

			printf("U");

		}

		while(a--)

		{

			printf("R");

		}//第一次到达终点 

		while(f--)

		{

			printf("D");

		}

		while(e--)

		{

			printf("L");

		}//第一次回到起点 

		printf("L");

		while(d--)

		{

			printf("U");

		}

		while(c--)

		{

			printf("R");

		}

		printf("DR");//第二次到达终点 

		while(k--)

		{

			printf("D");

		}

		while(g--)

		{

			printf("L");

		}

		printf("U");//第二次回到起点 

		printf("\n");

	}

	return 0;

}

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

#include <cstdio>

#include <cstring>

#include <cmath>

#include <algorithm>

using namespace std;

int main()

{

    int sx,sy,tx,ty;

    scanf("%d%d%d%d",&sx,&sy,&tx,&ty);

    for(int i=1;i<=(ty-sy);i++)printf("U");

    for(int i=1;i<=(tx-sx);i++)printf("R");

    for(int i=1;i<=(ty-sy);i++)printf("D");

    for(int i=1;i<=(tx-sx);i++)printf("L");

    printf("L");

    for(int i=1;i<=(ty-sy)+1;i++)printf("U");

    for(int i=1;i<=(tx-sx)+1;i++)printf("R");

    printf("D");

    printf("R");

    for(int i=1;i<=(ty-sy)+1;i++)printf("D");

    for(int i=1;i<=(tx-sx)+1;i++)printf("L");

    printf("U\n");

    return 0;

}




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

#include<string.h>

#include<math.h>

using namespace std;

void move(int d, char ch)

{

    while(d)

    {

        printf("%c",ch);

        d--;

    }

}

int main()

{

    int x1,x2,y1,y2,x,y,i;

    while(scanf("%d %d %d %d",&x1,&y1,&x2,&y2)!=EOF)

    {

        int x=x2-x1;

        int y=y2-y1;

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

        {

            if(i==1)

            {

                move(y,'U');

                move(x,'R');

            }

            else if(i==2)

            {

                move(y,'D');

                move(x,'L');

            }

            else if(i==3)

            {

                printf("L");

                move(y+1,'U');

                move(x+1,'R');

                printf("D");

            }

            else

            {

                printf("R");

                move(y+1,'D');

                move(x+1,'L');

                printf("U");

            }

        }

        printf("\n");

    }

    return 0;

}

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

using namespace std;



int main(){

    int a,b,c,d;

    cin>>a>>b>>c>>d;

    for(int x=0; x<d-b; x++){

        cout<<"U";

    }

    for(int x=0; x<c-a; x++){

        cout<<"R";

    }

    for(int x=0; x<d-b; x++){

        cout<<"D";

    }

    for(int x=0; x<c-a+1; x++){

        cout<<"L";

    }

    for(int x=0; x<d-b+1; x++){

        cout<<"U";

    }

    for(int x=0; x<c-a+1; x++){

        cout<<"R";

    }

    cout<<"DR";

    for(int x=0; x<d-b+1; x++){

        cout<<"D";

    }

    for(int x=0; x<c-a+1; x++){

        cout<<"L";

    }

    cout<<"U";

    return 0;

}


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

#include<string.h>

#include<math.h>

using namespace std;

void move(int d, char ch)

{

    while(d)

    {

        printf("%c",ch);

        d--;

    }

}

int main()

{

    int x1,x2,y1,y2,x,y,i;

    while(scanf("%d %d %d %d",&x1,&y1,&x2,&y2)!=EOF)

    {

        int x=x2-x1;

        int y=y2-y1;

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

        {

            if(i==1)

            {

                move(y,'U');

                move(x,'R');

            }

            else if(i==2)

            {

                move(y,'D');

                move(x,'L');

            }

            else if(i==3)

            {

                printf("L");

                move(y+1,'U');

                move(x+1,'R');

                printf("D");

            }

            else

            {

                printf("R");

                move(y+1,'D');

                move(x+1,'L');

                printf("U");

            }

        }

        printf("\n");

    }

    return 0;

}

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

#include<vector>

#include<algorithm>

using namespace std;

int main(){

    int a,b,c,n;

    while(cin>>a>>b>>c,a||b||c){

        cin>>n;

        int f[300];

        fill(f,f+300,2);

        int m=a+b+c;

        int x[1000],y[1000],z[1000];

        bool r[1000];

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

            cin>>x[i]>>y[i]>>z[i]>>r[i];

            x[i]--;y[i]--;z[i]--;

        }





        int cnt=0;

        while(cnt<100000){



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

                int a=x[i],b=y[i],c=z[i];

                bool Flag=r[i];

                if(Flag){



                    f[a]=f[b]=f[c]=1;

                }

                else{

                    if(f[b]==1&&f[c]==1){



                        f[a]=0;

                    }

                    if(f[a]==1&&f[c]==1){



                        f[b]=0;

                    }

                    if(f[a]==1&&f[b]==1){



                        f[c]=0;

                    }

                }

            }

            cnt++;

        }

        for(int i=0;i<m;i++)cout<<f[i]<<endl;

    }

}

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

using namespace std;

bool solve(){

    int A,B,C,N,t[1000][3],r[1000];

    cin>>A>>B>>C;

    if(A==0&&B==0&&C==0)return false;

    cin>>N;

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

        for(int j=0;j<3;j++){

            cin>>t[i][j];

            t[i][j]--;

        }

        cin>>r[i];

    }



    int S[1000]={0};

    for(int _=0;_<N;_++){

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

            if(r[i]){

                for(int j=0;j<3;j++){

                    S[t[i][j]]=1;

                }

            }

            else{

                int sum=0;

                for(int j=0;j<3;j++){

                    if(S[t[i][j]]==1)sum++;

                }

                if(sum!=2)continue;

                for(int j=0;j<3;j++){

                    if(S[t[i][j]]!=1)S[t[i][j]]=-1;

                }

            }

        }

    }



    for(int i=0;i<A+B+C;i++){

        if(S[i]==-1)cout<<0<<endl;

        else if(S[i])cout<<1<<endl;

        else cout<<2<<endl;

    }

    return true;

}



int main(){

    while(solve());

}

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

#include<cmath>  

#include<iostream>  

#include<cstring>  

#include<iostream>  

#include<cstdlib>  

#include<string>  

using namespace std;  

#define LL long long   

const int MaxN = 1e5 + 7;  

LL a[MaxN], b[MaxN];    

LL x[MaxN], v[MaxN];  

  

int main()  

{  

    LL n, c;  

    scanf("%lld %lld", &n, &c);  

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

        scanf("%lld %lld", &x[i], &v[i]);  

      

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

        a[i] = a[i - 1] + v[i] - (x[i] - x[i - 1]);  // 顺时针走到i点时的能量  

    x[n + 1] = c;  

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

        b[i] = b[i + 1] + v[i] - (x[i+1] - x[i]);  // 逆时针走到i点时的能量  

  

    for(LL i = 2; i <= n; i++)   

        a[i] = max(a[i-1], a[i]);  //走或者不走（和走之前的值进行比较）  

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

        b[i] = max(b[i], b[i + 1]);  

  

    LL ans = 0;  

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

        ans = max(ans, a[i] - x[i] + b[i + 1]);  // 顺时针走后并返回一次的值  

        ans = max(ans, b[i] - (c - x[i]) + a[i - 1]);  // 逆时针走后返回一次的值  

        ans = max(ans, a[i]);  // 顺时针的最大值  

        ans = max(ans, b[i]); //逆时针的最大值  

    }  

  

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

} 

// Optimized solution to the same problem (faster):
/*Lucky_Glass*/

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

#define MAXN int(1e5)

typedef long long ll;

int n;

ll rod;

struct Sushi{ll pos,val;}poi[MAXN+5];

ll a[MAXN+5],b[MAXN+5];

int main()

{

	scanf("%d%lld",&n,&rod);

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

		scanf("%lld%lld",&poi[i].pos,&poi[i].val);

	poi[n+1].pos=rod;poi[n+1].val=0;

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

		a[i]=a[i-1]-(poi[i].pos-poi[i-1].pos)+poi[i].val;

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

		b[i]=b[i+1]-(poi[i+1].pos-poi[i].pos)+poi[i].val;

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

		a[i]=max(a[i],a[i-1]);

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

		b[i]=max(b[i],b[i+1]);

	ll ans=0;

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

	{

		ans=max(ans,max(a[i],b[i]));

		ans=max(ans,max(a[i]-poi[i].pos+b[i+1],b[i]-(rod-poi[i].pos)+a[i-1]));

	}

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

	return 0;

}


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

#include<string.h>

#include<stdio.h>

using namespace std;

long long c,x[100005],maxx,shun[100005],ni[100005];

long long v[100005],val[100005],rval[100005];

int main()

{

	int i,j,n;

	while(scanf("%d%lld",&n,&c)!=EOF)

	{

		memset(shun,0,sizeof(shun));

		memset(ni,0,sizeof(ni));

		memset(val,0,sizeof(val));

		memset(rval,0,sizeof(rval));

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

    {

        scanf("%lld%d",&x[i],&v[i]);

        val[i]=val[i-1]+v[i];

        shun[i]=max(shun[i-1],val[i]-x[i]);

    }

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

    {

    	

        rval[i]=rval[i+1]+v[i];

        ni[i]=max(ni[i+1],rval[i]-c+x[i]);

    }

    maxx=0;

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

    {

        maxx=max(maxx,rval[i]-2*(c-x[i])+shun[i-1]);

        maxx=max(maxx,ni[i]);

    }

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

    {

        maxx=max(maxx,val[i]-2*x[i]+ni[i+1]);

        maxx=max(maxx,shun[i]);

    }

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

	}

	

	return 0;

}

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

using namespace std;

typedef long long ll;

#define INF 0x3f3f3f3f

#define Max int(1e5+10)

ll x[Max],v[Max],a[Max],b[Max];

int main()  

{  

    ll n,c;

    while(~scanf("%lld%lld",&n,&c))

	{

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

	     {

	     	scanf("%lld%lld",&x[i],&v[i]);

	     	a[i]=a[i-1]-x[i]+x[i-1]+v[i];

		 }

		 x[n+1]=c;

		 for(ll i=n;i>0;i--)

	     	b[i]=b[i+1]-x[i+1]+x[i]+v[i];

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

		     a[i]=max(a[i-1],a[i]);

		for(ll i=n-1;i>0;i--)

		     b[i]=max(b[i+1],b[i]);	 	

		ll ma=0;

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

		 {

		 	ma=max(ma,a[i]);

		 	ma=max(ma,b[i]);

		 	ma=max(ma,a[i]-x[i]+b[i+1]);

		 	ma=max(ma,b[i]-(c-x[i])+a[i-1]);

		 }

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

	} 

    return 0;  

      

} 

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

using namespace std;



#define int long long



#define rep(i,n) for(int i=0;i<(n);i++)

#define pb push_back

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

#define fi first

#define se second

typedef vector<int>vint;

typedef pair<int,int>pint;

typedef vector<pint>vpint;



template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}

template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}



const int INF=1001001001001001001ll;



int N,C;

int X[555555],V[555555];

int S[555555];



int ans;



void solve()

{

    for(int i=0;i<N;i++) S[i+1]=S[i]+V[i];

    int ma=-INF;

    for(int i=N-1;i>=0;i--)

    {

        chmax(ans,S[i+1]-X[i]);

        chmax(ans,S[i+1]-2*X[i]+ma);

        chmax(ma,S[N]-S[i]+X[i]-C);

    }

}



signed main(){

    cin>>N>>C;

    vector<int> x(N),v(N);

    for(int i=0;i<N;i++) cin>>x[i]>>v[i];



    for(int t=0;t<2;t++)

    {

        for(int i=0;i<N;i++)

        {

            X[i]=x[i];

            V[i]=v[i];

        }

        solve();

        for(int i=0;i<N;i++) x[i]=C-x[i];

        reverse(all(x));

        reverse(all(v));

    }

    cout<<ans<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
//Zory in 2018

//*******************头文件*******************

#include<cstdio>

#include<cstring>

#include<cmath>

#include<queue>

#include<vector>

#include<set>

#include<queue>

#include<algorithm>

typedef long long ll;

typedef unsigned long long ull;

ll mymax(ll x,ll y) {return x>y?x:y;}

int mymin(int x,int y) {return x<y?x:y;}

int myabs(int x) {return x>0?x:-x;}

//*******************全局常量*******************

const int MAXN=110000;

//*******************全局定义*******************

ll f[MAXN],g[MAXN];//顺时针，逆时针

ll x[MAXN],v[MAXN];

//*******************实现*******************



//*******************主函数*******************

int main()

{

	//freopen("tmp.in","r",stdin);

    int n;ll c;scanf("%d%lld",&n,&c);

    for(int i=1;i<=n;i++) scanf("%lld%lld",&x[i],&v[i]);



    ll ans=0,sum;

    sum=0;for(int i=1;i<=n;i++) sum+=v[i],f[i]=sum-x[i],ans=mymax(ans,f[i]);

    sum=0;for(int i=n;i>=1;i--) sum+=v[i],g[i]=sum-(c-x[i]),ans=mymax(ans,g[i]);



    ll mx;

    mx=0;for(int i=n-1;i>=1;i--) mx=mymax(mx,g[i+1]),ans=mymax(ans,f[i]+mx-x[i]);

    mx=0;for(int i=2;i<=n;i++) mx=mymax(mx,f[i-1]),ans=mymax(ans,g[i]+mx-(c-x[i]));



    printf("%lld",ans);

}


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

#include<stdio.h>

#include<algorithm>

#include<math.h>

using namespace std;

int a[10001];

int main()

{

    int n,b,c,m=0;

    scanf("%d",&n);

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

        scanf("%d",&a[i]);

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

 {   if(a[i]==1)continue;

   else

   {

     int t=0;

    b=sqrt(a[i]);

    for(int j=2;j<=b;j++)

    if(a[i]%j==0)t++;

    if(t==0)m++;

   }

 }

    printf("%d\n",m);

    return 0;

}

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



bool is_prime(int n)

{

	for (int i = 2; i * i <= n; i++)

		if (n % i == 0)

			return false;

	return true;

}



int main()

{

	int N, n, k = 0;

	scanf("%d", &N);

	while (N--)

	{

		scanf("%d", &n);

		if (is_prime(n))

			k++;

	}

	printf("%d\n", k);



	return 0;

}




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

#include<stdio.h>

#include<string.h>

using namespace std;



bool isprime(int k)

{

    if(k<2) return 0;

    else if(k==2) return 1;

    if(k%2==0) return 0;

    for(int i=3;i*i<=k;i+=2)

    {

        if(k%i==0) return 0;

    }

    return 1;

}



int main()

{

	int n,m,ans=0;

	scanf("%d",&n);

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

	{

		scanf("%d",&m);

		if(isprime(m)) ans++;

	}

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

	return 0;

}

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



bool is_prime(int n)

{

	for (int i = 2; i * i <= n; i++)

		if (n % i == 0)

			return false;

	return true;

}



int main()

{

	int N, n, k = 0;

	scanf("%d", &N);

	while (N--)

	{

		scanf("%d", &n);

		if (is_prime(n))

			k++;

	}

	printf("%d\n", k);



	return 0;

}




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

#include<vector>

#include <algorithm>



using namespace std;

vector<int> n;



int main(void)

{

    int count,temp,ans=0,rant=0;



    cin>>count;

    for(int i=0;i<count;i++)

    {

        cin>>temp;

        rant=rant>temp?rant:temp;

        n.push_back(temp);

    }



  vector<bool> pri(++rant,0);



   for(int i=2;i*i<rant;i++)

  {

      if(!pri.at(i))

         {



             for(int j=i;j*i<rant;j++)

                {

                   pri[i*j]=true;

                }

         }

  }



    for(int i=0;i<count;i++)

    {

        if(!pri.at(n.at(i)))

            ans++;

    }



  cout<<ans<<endl;

return 0;

}

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



bool is_prime(int n)

{

	for (int i = 2; i * i <= n; i++)

		if (n % i == 0)

			return false;

	return true;

}



int main()

{

	int N, n, k = 0;

	scanf("%d", &N);

	while (N--)

	{

		scanf("%d", &n);

		if (is_prime(n))

			k++;

	}

	printf("%d\n", k);



	return 0;

}




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

#include<iostream>

#include<math.h>

using namespace std;

int n,tot=0,temp;

bool m[10005];

bool pri(int mt){

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

		if(mt%i==0){

			return 0;

		}

	}

	return 1;

}

int main(void){

	scanf("%d",&n);

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

		scanf("%d",&temp);

		if(temp>2){

			if(pri(temp)){

				tot++;

			}

		}

		else if(temp==2){

			tot++;

		}

		else if(temp==1||temp==0){

		}

	}

	printf("%d\n",tot);

	return 0;

}

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



bool is_prime(int n)

{

	for (int i = 2; i * i <= n; i++)

		if (n % i == 0)

			return false;

	return true;

}



int main()

{

	int N, n, k = 0;

	scanf("%d", &N);

	while (N--)

	{

		scanf("%d", &n);

		if (is_prime(n))

			k++;

	}

	printf("%d\n", k);



	return 0;

}




// Fastest known solution for this problem: