stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <vector>

#include <iostream>

using namespace std;

int n, q, com, x, y; int group[10000]; vector<int> f[10000];

int main() {

	scanf("%d%d", &n, &q);

	for(int i = 0; i < n; i++) group[i] = i, f[i].push_back(i);

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

		scanf("%d%d%d", &com, &x, &y);

		if(com == 0) {

			if(group[x] == group[y]) continue;

			x = group[x], y = group[y];

			if(f[y].size() > f[x].size()) swap(x, y);

			for(int j = f[y].size() - 1; j >= 0; j--) {

				group[f[y][j]] = group[x];

				f[x].push_back(f[y][j]);

				f[y].pop_back();

			}

		}

		else printf("%d\n", (group[x] == group[y] ? 1 : 0));

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.2544562002380117x):
#include <bits/stdc++.h>

using namespace std;

int par[10009];

int root(int x) {

    if(par[x]== x) return x;

    return par[x] = root(par[x]);

}

void unite(int x, int y) {

    x = root(x); y = root(y);

    if(x == y) return;

    par[x] = y;

}

bool same(int x, int y) {

    int rx = root(x);

    int ry = root(y);

    return rx == ry;

}

int n, q, tp, x, y;

int main() {

    scanf("%d%d", &n, &q);

    for(int i = 0; i < n; i++) par[i] = i;

    while(q--) {

        scanf("%d%d%d", &tp, &x, &y);

        if(tp == 0) unite(x, y);

        else {

            bool ret = same(x, y);

            puts(ret ? "1" : "0");

        }

    }

    return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <vector>

using namespace std;



vector<int> l[10000];

int s[10000];

int n;



void unite(int x, int y){

    if(s[x]==s[y])return;



    int i,j,tmp;

    int sx = s[x];

    int sy = s[y];

    for(i=0;i<l[sy].size();i++){

        tmp = l[sy][i];

        s[tmp] = sx;

        l[sx].push_back(tmp);

    }

    l[sy].clear();

    return;

}



bool same(int x, int y){

    return s[x]==s[y];

}



int main(){

    int i,q,com,x,y;

    scanf("%d %d",&n,&q);

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

        s[i]=i;

        l[i].push_back(i);

    }

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

        scanf("%d %d %d",&com,&x,&y);

        if(com==0)unite(x,y);

        else{

            if(same(x,y))printf("1\n");

            else printf("0\n");

        }

    }

    return 0;

}




// Faster C++ solution for the same problem (measured speedup: 5.973780293392153x):
#include <cstdio>

#include <cstdlib>



typedef struct node_{

    int key;

    int height;

    struct node_ *parent;

}node;



node *nd;



node* top(node* nd){

    while(true){

        if(nd->parent==NULL)break;

        nd = nd->parent;

    }

    return nd;

}



void unite(int x, int y){

    node* a = top(nd+x);

    node* b = top(nd+y);

    if(a==b)return;

    if(a->height < b->height){

        a->parent = b;

    }else{

        b->parent = a;

        if(a->height == b->height){

            a->height++;

        }

    }

    return;

}



int same(int x, int y){

    node* a = top(nd+x);

    node* b = top(nd+y);

    if(a==b)return 1;

    else return 0;

}



int main(){

    int i,n,q,x,y,com;

    scanf("%d %d",&n,&q);

    nd = (node *)malloc(sizeof(node)*n);



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

        nd[i].key = i;

        nd[i].height = 1;

        nd[i].parent = NULL;

    }



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

        scanf("%d %d %d",&com,&x,&y);

        switch(com){

        case 0://unite

            unite(x,y);

            break;

        case 1://same

            printf("%d\n",same(x,y));

            break;

        default:

            perror("error\n");

            return -1;

            break;

        }

    }

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int i,p,j,n,k,q,m;

    int x=0;

    int a,b;

    cin>>a>>b;

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

   {



       n=i;m=i;q=0;

       while(n>0)

       {

           p=n%10;

           q=q*10+p;

           n=n/10;

       }

       if(n>0)

       {

           q=q*10+n;

       }



       if(q==m)

        x++;



    }

    cout<<x<<endl;



 return 0;

}


// Faster C++ solution for the same problem (measured speedup: 3.8468337254372367x):
#include <stdio.h>

int main()

{

    int m,n,a[10],i,k=0;

    scanf("%d %d",&m,&n);

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

    {

        a[0]=i/10000;

        a[1]=i%10000/1000;

        a[2]=i%10000%1000/100;

        a[3]=i%100/10;

        a[4]=i%10;

        if(a[0]==a[4]&&a[1]==a[3])

            k++;

    }

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



    return 0;

}
// Slower C++ solution:
// Author : Mohamed Sameh

#include <bits/stdc++.h>

typedef long long ll ;

#define pb push_back

#define f first

#define s second

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

#define rall(v) v.rbegin(),v.rend()

#define SZ(a) (int)a.size()

#define Flush fflush(stdout);

using namespace std ;

bool pal (int x )

{

    int t[20];

    int id =0 ;

    while (x)

    {

        t[id++] = x %10 ;

        x/=10;

    }

    id--;

    int i =0 ;

    while (i < id )

    {

        if (t[i] != t[id])return false ;

        i++; id--;

    }

    return true ;

}

int main()

{

    int a, b ;

    scanf ("%d%d" , &a ,&b );

    int ans =0 ;

    while (a <= b )

    {

        ans += pal(a);

        a++;

    }

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



}


// Faster C++ solution for the same problem (measured speedup: 4.0795685894403375x):
#include <stdio.h>

int main()

{

    int m,n,a[10],i,k=0;

    scanf("%d %d",&m,&n);

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

    {

        a[0]=i/10000;

        a[1]=i%10000/1000;

        a[2]=i%10000%1000/100;

        a[3]=i%100/10;

        a[4]=i%10;

        if(a[0]==a[4]&&a[1]==a[3])

            k++;

    }

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



    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;

#define ll long long

const int MAX =1e5+9;











int main ()

{



    int n , m , ans=0;

    cin>>n>>m;

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

    {



            if (i%10==(i/10000)%10&&(i/10)%10==(i/1000)%10)

                ans++;

    }

    cout<<ans;

}


// Faster C++ solution for the same problem (measured speedup: 3.6020937861971545x):
#include <stdio.h>

int main()

{

    int m,n,a[10],i,k=0;

    scanf("%d %d",&m,&n);

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

    {

        a[0]=i/10000;

        a[1]=i%10000/1000;

        a[2]=i%10000%1000/100;

        a[3]=i%100/10;

        a[4]=i%10;

        if(a[0]==a[4]&&a[1]==a[3])

            k++;

    }

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



    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include<cstring>

#include<algorithm>

#include<vector>

#include<cmath>

#include<map>

#include<set>

#include<cstdio>

#define MAXA 100000

#define MAX 20000000000

#define s(i) scanf("%d", &(i))

#define p(i) printf("%d", (i))

#define ps() printf(" ") 

#define rer(i,j,k) for((i)=(j);(i)<(k);++(i))

#define ret(i,j,k) for((i)=(j);(i)>(k);--(i))

using namespace std;

int a1[MAXA] = {0}, a2[MAXA] = {0};

int main(){

	int a, b, c, i, j;

	int Count = 0;

	cin >> a >> b;

	for(i = a; i <= b; i++){

		int t = 0, is = 0, q;

		q = i;

		while(q){

			a1[t++] = q%10;

			q/=10;

		}

		for(j = 0; j < (t+1)/2; j++){

			if(a1[j]!=a1[t-1-j]){

				is = 1;

				break;

			}

		}

		if(!is){

			Count++;

		}

		memset(a1,0,sizeof(a1));

	}

	cout << Count << endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.257386808493194x):
#include <stdio.h>

int main()

{

    int m,n,a[10],i,k=0;

    scanf("%d %d",&m,&n);

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

    {

        a[0]=i/10000;

        a[1]=i%10000/1000;

        a[2]=i%10000%1000/100;

        a[3]=i%100/10;

        a[4]=i%10;

        if(a[0]==a[4]&&a[1]==a[3])

            k++;

    }

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



    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int i,p,j,n,k,q,m;

    int x=0;

    int a,b;

    cin>>a>>b;

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

   {



       n=i;m=i;q=0;

       while(n>0)

       {

           p=n%10;

           q=q*10+p;

           n=n/10;

       }

       if(n>0)

       {

           q=q*10+n;

       }



       if(q==m)

        x++;



    }

    cout<<x<<endl;



 return 0;

}


// Faster C++ solution for the same problem (measured speedup: 2.620936957549568x):
#include<stdio.h>

#include<string.h>

void hws(int a,int b)

{

    int i,l=0,s=0,t=0,dzs=0;

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

    {

        t=i;

        dzs=0;

        while(t!=0)

        {

            l=t%10;

            t=t/10;

            dzs=dzs*10+l;

            if(i==dzs)

                s++;



        }

    }

    printf("%d",s);

}

int main()

{

    int a,b;

    scanf("%d%d",&a,&b);

    hws(a,b);

    return 0;

}
// Slower C++ solution:
// Author : Mohamed Sameh

#include <bits/stdc++.h>

typedef long long ll ;

#define pb push_back

#define f first

#define s second

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

#define rall(v) v.rbegin(),v.rend()

#define SZ(a) (int)a.size()

#define Flush fflush(stdout);

using namespace std ;

bool pal (int x )

{

    int t[20];

    int id =0 ;

    while (x)

    {

        t[id++] = x %10 ;

        x/=10;

    }

    id--;

    int i =0 ;

    while (i < id )

    {

        if (t[i] != t[id])return false ;

        i++; id--;

    }

    return true ;

}

int main()

{

    int a, b ;

    scanf ("%d%d" , &a ,&b );

    int ans =0 ;

    while (a <= b )

    {

        ans += pal(a);

        a++;

    }

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



}


// Faster C++ solution for the same problem (measured speedup: 2.7795046134226244x):
#include<stdio.h>

#include<string.h>

void hws(int a,int b)

{

    int i,l=0,s=0,t=0,dzs=0;

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

    {

        t=i;

        dzs=0;

        while(t!=0)

        {

            l=t%10;

            t=t/10;

            dzs=dzs*10+l;

            if(i==dzs)

                s++;



        }

    }

    printf("%d",s);

}

int main()

{

    int a,b;

    scanf("%d%d",&a,&b);

    hws(a,b);

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;

#define ll long long

const int MAX =1e5+9;











int main ()

{



    int n , m , ans=0;

    cin>>n>>m;

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

    {



            if (i%10==(i/10000)%10&&(i/10)%10==(i/1000)%10)

                ans++;

    }

    cout<<ans;

}


// Faster C++ solution for the same problem (measured speedup: 2.454189965731028x):
#include<stdio.h>

#include<string.h>

void hws(int a,int b)

{

    int i,l=0,s=0,t=0,dzs=0;

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

    {

        t=i;

        dzs=0;

        while(t!=0)

        {

            l=t%10;

            t=t/10;

            dzs=dzs*10+l;

            if(i==dzs)

                s++;



        }

    }

    printf("%d",s);

}

int main()

{

    int a,b;

    scanf("%d%d",&a,&b);

    hws(a,b);

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include<cstring>

#include<algorithm>

#include<vector>

#include<cmath>

#include<map>

#include<set>

#include<cstdio>

#define MAXA 100000

#define MAX 20000000000

#define s(i) scanf("%d", &(i))

#define p(i) printf("%d", (i))

#define ps() printf(" ") 

#define rer(i,j,k) for((i)=(j);(i)<(k);++(i))

#define ret(i,j,k) for((i)=(j);(i)>(k);--(i))

using namespace std;

int a1[MAXA] = {0}, a2[MAXA] = {0};

int main(){

	int a, b, c, i, j;

	int Count = 0;

	cin >> a >> b;

	for(i = a; i <= b; i++){

		int t = 0, is = 0, q;

		q = i;

		while(q){

			a1[t++] = q%10;

			q/=10;

		}

		for(j = 0; j < (t+1)/2; j++){

			if(a1[j]!=a1[t-1-j]){

				is = 1;

				break;

			}

		}

		if(!is){

			Count++;

		}

		memset(a1,0,sizeof(a1));

	}

	cout << Count << endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.2701043075964975x):
#include<stdio.h>

#include<string.h>

void hws(int a,int b)

{

    int i,l=0,s=0,t=0,dzs=0;

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

    {

        t=i;

        dzs=0;

        while(t!=0)

        {

            l=t%10;

            t=t/10;

            dzs=dzs*10+l;

            if(i==dzs)

                s++;



        }

    }

    printf("%d",s);

}

int main()

{

    int a,b;

    scanf("%d%d",&a,&b);

    hws(a,b);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int i,p,j,n,k,q,m;

    int x=0;

    int a,b;

    cin>>a>>b;

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

   {



       n=i;m=i;q=0;

       while(n>0)

       {

           p=n%10;

           q=q*10+p;

           n=n/10;

       }

       if(n>0)

       {

           q=q*10+n;

       }



       if(q==m)

        x++;



    }

    cout<<x<<endl;



 return 0;

}


// Faster C++ solution for the same problem (measured speedup: 2.8380963007258697x):
#include<stdio.h>

int acm(int n)

{

    int rest=0;

    int ans=n;

    while(n!=0)

    {

       rest*=10;

       rest+=n%10;

       n/=10;

    }

    if(rest==ans)

        return 1;

    return 0;

}

int main()

{

    int a,b;

    int flag=0;

    scanf("%d%d",&a,&b);

    for(int i=a;i<=b;i++)

    {

        if(acm(i)==1)

            flag++;

    }

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

    return 0;

}
// Slower C++ solution:
// Author : Mohamed Sameh

#include <bits/stdc++.h>

typedef long long ll ;

#define pb push_back

#define f first

#define s second

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

#define rall(v) v.rbegin(),v.rend()

#define SZ(a) (int)a.size()

#define Flush fflush(stdout);

using namespace std ;

bool pal (int x )

{

    int t[20];

    int id =0 ;

    while (x)

    {

        t[id++] = x %10 ;

        x/=10;

    }

    id--;

    int i =0 ;

    while (i < id )

    {

        if (t[i] != t[id])return false ;

        i++; id--;

    }

    return true ;

}

int main()

{

    int a, b ;

    scanf ("%d%d" , &a ,&b );

    int ans =0 ;

    while (a <= b )

    {

        ans += pal(a);

        a++;

    }

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



}


// Faster C++ solution for the same problem (measured speedup: 3.009802177226176x):
#include<stdio.h>

int acm(int n)

{

    int rest=0;

    int ans=n;

    while(n!=0)

    {

       rest*=10;

       rest+=n%10;

       n/=10;

    }

    if(rest==ans)

        return 1;

    return 0;

}

int main()

{

    int a,b;

    int flag=0;

    scanf("%d%d",&a,&b);

    for(int i=a;i<=b;i++)

    {

        if(acm(i)==1)

            flag++;

    }

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

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;

#define ll long long

const int MAX =1e5+9;











int main ()

{



    int n , m , ans=0;

    cin>>n>>m;

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

    {



            if (i%10==(i/10000)%10&&(i/10)%10==(i/1000)%10)

                ans++;

    }

    cout<<ans;

}


// Faster C++ solution for the same problem (measured speedup: 2.6575333843710167x):
#include<stdio.h>

int acm(int n)

{

    int rest=0;

    int ans=n;

    while(n!=0)

    {

       rest*=10;

       rest+=n%10;

       n/=10;

    }

    if(rest==ans)

        return 1;

    return 0;

}

int main()

{

    int a,b;

    int flag=0;

    scanf("%d%d",&a,&b);

    for(int i=a;i<=b;i++)

    {

        if(acm(i)==1)

            flag++;

    }

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

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include<cstring>

#include<algorithm>

#include<vector>

#include<cmath>

#include<map>

#include<set>

#include<cstdio>

#define MAXA 100000

#define MAX 20000000000

#define s(i) scanf("%d", &(i))

#define p(i) printf("%d", (i))

#define ps() printf(" ") 

#define rer(i,j,k) for((i)=(j);(i)<(k);++(i))

#define ret(i,j,k) for((i)=(j);(i)>(k);--(i))

using namespace std;

int a1[MAXA] = {0}, a2[MAXA] = {0};

int main(){

	int a, b, c, i, j;

	int Count = 0;

	cin >> a >> b;

	for(i = a; i <= b; i++){

		int t = 0, is = 0, q;

		q = i;

		while(q){

			a1[t++] = q%10;

			q/=10;

		}

		for(j = 0; j < (t+1)/2; j++){

			if(a1[j]!=a1[t-1-j]){

				is = 1;

				break;

			}

		}

		if(!is){

			Count++;

		}

		memset(a1,0,sizeof(a1));

	}

	cout << Count << endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.251838038742202x):
#include<stdio.h>

int acm(int n)

{

    int rest=0;

    int ans=n;

    while(n!=0)

    {

       rest*=10;

       rest+=n%10;

       n/=10;

    }

    if(rest==ans)

        return 1;

    return 0;

}

int main()

{

    int a,b;

    int flag=0;

    scanf("%d%d",&a,&b);

    for(int i=a;i<=b;i++)

    {

        if(acm(i)==1)

            flag++;

    }

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

    return 0;

}
// Slower C++ solution:
#include<stdio.h>

#include<string.h>

#include<algorithm>

#include<iostream>

#include<math.h>

#define ll long long

using namespace std;



int JUDGE(int n)

{

    int a;

	a=0;

	while(n>0)

	{

		a=a*10+n%10;

		n=n/10;

	}

	return a;

}

int main()

{

    int a,b;

    while(~scanf("%d%d",&a,&b))

    {

        int m, sum=0;

        for(int i=a; i<=b; i++)

        {



           m=JUDGE(i);

            if(m==i)

                sum++;



        }

        cout<<sum<<endl;



    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 2.8360726122193687x):
#include<stdio.h>

int acm(int n)

{

    int rest=0;

    int ans=n;

    while(n!=0)

    {

       rest*=10;

       rest+=n%10;

       n/=10;

    }

    if(rest==ans)

        return 1;

    return 0;

}

int main()

{

    int a,b;

    int flag=0;

    scanf("%d%d",&a,&b);

    for(int i=a;i<=b;i++)

    {

        if(acm(i)==1)

            flag++;

    }

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

    return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<iostream>

using namespace std;

int a,b,ans;

int main()

{

    cin>>a>>b;

    for(int i=a;i<=b;i++)

    {

        int x=i/10000,y=i/1000%10;

        if(x==i%10&&y==i/10%10)

            ans++;

    }

    cout<<ans;

}

// Faster C++ solution for the same problem (measured speedup: 0.40427348735474683x):
#include<cstdio>

#include<cstring>



int Check(int x){

    char s[10];

    sprintf(s+1,"%d",x);

    int len=strlen(s+1);

    for(int i=1;i<=len/2;i++)

        if(s[i]!=s[len-i+1])

            return 0;

    return 1;

}



int main(){

    int A,B,Ans=0;

    scanf("%d%d",&A,&B);

    for(int i=A;i<=B;i++)

        Ans+=Check(i);

    printf("%d",Ans);

    return 0;

}

/**/
// Slower C++ solution:
#include<cstdio>

#include<iostream>

using namespace std;

int a,b,ans;

int main()

{

    cin>>a>>b;

    for(int i=a;i<=b;i++)

    {

        int x=i/10000,y=i/1000%10;

        if(x==i%10&&y==i/10%10)

            ans++;

    }

    cout<<ans;

}

// Faster C++ solution for the same problem (measured speedup: 5.340192675117356x):
/*Lucky_Glass*/

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int main()

{

	int A,B;

	scanf("%d%d",&A,&B);

	int ans=0;

	for(int i=100;i<=999;i++)

	{

		int n=i*100+i/10%10*10+i/100;

		if(A<=n && n<=B) ans++;

	}

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

	return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<iostream>

using namespace std;

int a,b,ans;

int main()

{

    cin>>a>>b;

    for(int i=a;i<=b;i++)

    {

        int x=i/10000,y=i/1000%10;

        if(x==i%10&&y==i/10%10)

            ans++;

    }

    cout<<ans;

}

// Faster C++ solution for the same problem (measured speedup: 2.8741051587481565x):
#include<stdio.h>

int nixu (int x)

{

    int a=0;

    while(x>0)

    {

        a=a*10+x%10;

        x=x/10;

    }

    return a;

}

int main()

{

    int a,b,i;

    int sum=0;

    scanf("%d %d",&a,&b);

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

    {

        if(i==nixu(i))

            sum++;

    }



    printf("%d",sum);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int A,B,i,p,p1,q,q1,r,r1,s,s1,t,t1;

    int flag=0;

    cin>>A>>B;

    for(i=A;i<=B;i++)

    {

         p=i%10;

         p1=i/10;

         q=p1%10;

         q1=p1/10;

         r=q1%10;

         r1=q1/10;

         s=r1%10;

         s1=r1/10;

        t=s1%10;

         t1=s1/10;

         if(t==p && q==s)

         {

             flag++;

         }





    }





    cout<<flag<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 3.1513556455396023x):
#include<stdio.h>

int nixu (int x)

{

    int a=0;

    while(x>0)

    {

        a=a*10+x%10;

        x=x/10;

    }

    return a;

}

int main()

{

    int a,b,i;

    int sum=0;

    scanf("%d %d",&a,&b);

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

    {

        if(i==nixu(i))

            sum++;

    }



    printf("%d",sum);

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



#define vi vector<int>

#define ii pair<int,int>

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

#define vvi vector<vector<int>>



typedef long long ll;

typedef unsigned long long ull;



#define pb push_back

#define mp make_pair

#define fi first

#define se second



using namespace std;



int a,b;

int result = 0;



bool is_palindrome (int k) {

    string s = to_string(k);

    int i = 0;

    int j = s.length()-1;

    while (i <= j) {

        if (s[i] != s[j])

            return false;

        i++;

        j--;

    }

    return true;

}



int main (void) {

    ios_base::sync_with_stdio(false);



    cin >> a >> b;

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

        if (is_palindrome(i))

            result++;

    }



    cout << result << endl;



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 10.015611473319737x):
#include<stdio.h>

int nixu (int x)

{

    int a=0;

    while(x>0)

    {

        a=a*10+x%10;

        x=x/10;

    }

    return a;

}

int main()

{

    int a,b,i;

    int sum=0;

    scanf("%d %d",&a,&b);

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

    {

        if(i==nixu(i))

            sum++;

    }



    printf("%d",sum);

    return 0;

}
// Slower C++ solution:
/*

** author:mahmoud magdy

*/

#include <bits/stdc++.h>

using namespace std;



#define ll long long

#define endl "\n"



void fast()

{

    ios_base :: sync_with_stdio( 0 ) ;

    cin.tie( 0 ) ;

    cout.tie( 0 ) ;

}

inline int D()

{

    int m ;

    scanf("%d",&m);

    return m ;

}

inline ll lD()

{

    ll m ;

    scanf("%lld",&m);

    return m ;

}

inline double dD()

{

    double m ;

    scanf("%llf",&m);

    return m ;

}

ll LCM(ll a, ll b)

{

    return a / __gcd(a, b) * b;

}

ll power(ll a, ll b, ll m)

{

    if(!b)  return 1;

    ll t = power(a, b>>1, m)%m;

    return ((t*t)%m * (b&1 ? a : 1)%m)%m;

}

bool isPaind(int n){

string s="";

int t=n;

while(n){

    s+=n%10+'0';

 n/=10;

}

 stringstream geek(s);

   int x = 0;

   geek >> x;

   return (x==t);

}

int main()

{

    int x=D(),y=D(),cnt=0;

     for(int i=x;i<=y;++i){

        if(isPaind(i))

            cnt++;

     }

     cout<<cnt<<endl;

}


// Faster C++ solution for the same problem (measured speedup: 25.296341794709736x):
#include<stdio.h>

int nixu (int x)

{

    int a=0;

    while(x>0)

    {

        a=a*10+x%10;

        x=x/10;

    }

    return a;

}

int main()

{

    int a,b,i;

    int sum=0;

    scanf("%d %d",&a,&b);

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

    {

        if(i==nixu(i))

            sum++;

    }



    printf("%d",sum);

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<stdio.h>

#include<cstring>

#include<cmath>

#include<algorithm>

#include<vector>

#include<map>

#define ll long long

using namespace std;

int ishui(string s){

	int n=s.size();

	for(int i=0;i<s.size()/2;i++){

		if(s[i]!=s[s.size()-i-1]){

			return 0;

		}

	}

	return 1;

}

int main(){

	ll a,b;

	cin>>a>>b;

	int ans=0;

	for(ll i=a;i<=b;i++){

		string s=to_string(i);

		if(ishui(s)){

			ans++;

		}

	} 

	cout<<ans<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 10.527654724607558x):
#include<stdio.h>

int nixu (int x)

{

    int a=0;

    while(x>0)

    {

        a=a*10+x%10;

        x=x/10;

    }

    return a;

}

int main()

{

    int a,b,i;

    int sum=0;

    scanf("%d %d",&a,&b);

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

    {

        if(i==nixu(i))

            sum++;

    }



    printf("%d",sum);

    return 0;

}