stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
/**

 *    This code has been written by YueGuang, feel free to ask me question. Blog: http://www.yx.telstudy.xyz

 *    created:

 */

#include <cstdio>

#include <iostream>

#include <set>

#include <map>

#include <algorithm>

#include <cstring>

#include <string>

#include <cmath>

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

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

#define sl(n) scanf("%lld", &n);

#define si(n) scanf("%d", &n);

#define RepAll(a) for(auto x: a)

#define cout(ans) cout << ans << endl;

typedef long long ll;



using namespace std;

bool judge(int n){

    string s = to_string(n);

    //cout << s << endl;

    for(int i = 0; i < s.size()/2; i++){  //cout << s[i] << " " << s[s.size() - 1 - i] << endl;

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



            return false;

        }

    }

    return true;

}

int main(){

    int a, b, cnt = 0;

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

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

        if (judge(i)){

            cnt++;

        }

    }

    cout << cnt << endl;

}


// Faster C++ solution for the same problem (measured speedup: 9.462431048221571x):
#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 <algorithm>

#include <string>

#include <cmath>

#include <cstdio>

#include <cstring>

#include <sstream>



using namespace std;



const int maxn = 15;

char a[maxn][maxn];

int visit[maxn];

int way = 0;

int cnt = 0;

int n, k;

bool ishuiwen(string a)

{

    string t(a.rbegin(), a.rend());

    if(a == t)

        return 1;

    else

        return 0;

}





int main()

{

    int a, b;

    cin >> a >> b;

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

    {

        string temp;

        stringstream ss;

        ss << i;

        ss >> temp;

        if(ishuiwen(temp))

            cnt++;

    }

    cout << cnt << endl;

}


// Faster C++ solution for the same problem (measured speedup: 26.311463211211493x):
#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;

typedef long long ll;

typedef pair<int,int> pi;



int main() {

	ios_base::sync_with_stdio(0);

	cin.tie(0);

	int a,b;

	cin >> a >> b;

	int ans = 0;

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

		string str = to_string(i);

		bool flag = true;

		for (int j = 0; j < (int)str.length()/2; j++) {

			if (str[j] == str[str.length()-1-j]) continue;

			else {

				flag = false;

				break;

			}

		}

		if (flag) ans++;

	}

	cout << ans;

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 10.013307308977497x):
#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<stdio.h>

#include<math.h>

#include<string.h>

#include<iostream>

#include<algorithm>

using namespace std;

int hui(int n)

{

	int k=0;	int m,h=0;

	while(n>0)

	{

		m=n%10;

		n=n/10;

		h=h*10+m; 

	}

	return h;

}

int main()

{

	int a,b;

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

	int h=0;

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

	{

		int b=hui(i);

		if(b==i)

		h++;

	}

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

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.4476134088846946x):
#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, ans = 0;

    cin >> a >> b;



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

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

            ans++;

            // cout << i << endl;

        }

    }

    cout << ans << endl;

    return 0;

}


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

 

int main(void){

 

	int in[2]={0};

	

	int i;

	int count=0;

	int rev=0,num=0;

	scanf("%d %d",&in[0],&in[1]);

	

	

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

		

		num=i;

		rev=0;

		while(num>0){

			rev=rev*10+num%10;

			num/=10;

		}

		

		if(i==rev){

			count++;

		}

	}

	

	printf("%d",count);	

	

	return 0;

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

using namespace std;

 

typedef long long ll;

typedef vector<pair<ll, ll>> pll;

 

#define mod 1000000007

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

#define pb push_back

#define popcount(x) __builtin_popcountll(x)

 

const long double PI = acos(-1);

 

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}

ll lcm(ll a,ll b){return a / gcd(a,b) * b;}

ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}

bool isInteger(double x){return floor(x) == x;}



int main(){

  ios::sync_with_stdio(false);

  cin.tie(0);



  ll a, b;

  cin >> a >> b;

  ll ans = 0;

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

    if(i/10000 == i%10 && i/1000%10 == i/10%10) ans++;

  }

  cout << ans << endl;

  return 0;

}

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

 

int main(void){

 

	int in[2]={0};

	

	int i;

	int count=0;

	int rev=0,num=0;

	scanf("%d %d",&in[0],&in[1]);

	

	

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

		

		num=i;

		rev=0;

		while(num>0){

			rev=rev*10+num%10;

			num/=10;

		}

		

		if(i==rev){

			count++;

		}

	}

	

	printf("%d",count);	

	

	return 0;

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

using namespace std;

 

typedef long long ll;

typedef vector<pair<ll, ll>> pll;

 

#define mod 1000000007

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

#define pb push_back

#define popcount(x) __builtin_popcountll(x)

 

const long double PI = acos(-1);

 

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}

ll lcm(ll a,ll b){return a / gcd(a,b) * b;}

ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}

bool isInteger(double x){return floor(x) == x;}

 

int main(){

  ios::sync_with_stdio(false);

  cin.tie(0);

 

	int in[2]={0};

	

	char tmp;

	int i,j;

	int count=0;

	int rev=0,num=0;

	scanf("%d %d",&in[0],&in[1]);

	

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

		

		num=i;

		rev=0;

		while(num>0){

			rev=rev*10+num%10;

			num/=10;

		}

		

		if(i==rev){

			count++;

		}

	}

	

	printf("%d",count);	

	

	return 0;

}

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

 

int main(void){

 

	int in[2]={0};

	

	int i;

	int count=0;

	int rev=0,num=0;

	scanf("%d %d",&in[0],&in[1]);

	

	

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

		

		num=i;

		rev=0;

		while(num>0){

			rev=rev*10+num%10;

			num/=10;

		}

		

		if(i==rev){

			count++;

		}

	}

	

	printf("%d",count);	

	

	return 0;

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



using namespace std;

using ll=long long;

using vi=vector<int>;

using vl=vector<ll>;

using vs=vector<string>;



#define pb push_back

#define pf push_front

#define mp make_pair

#define fi first

#define se second

#define All(s) s.begin(),s.end()

#define rAll(s) s.rbegin(),s.rend()

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

#define repr(i, a, n) for (int i = (n); i >= (a); --i)



template<typename T,typename U>

void Inparray(T &f,U n){

  for(int i=0;i<n;i++) cin>>f[i];

}



template<typename T,typename U>

void Printarray(T f,U n){

  for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];

}



void flagfunc(bool flag,string A,string B){

  flag ? cout<<A<<endl : cout<<B<<endl;

}



void flag2func(bool flag){

  flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;

}



void flag3func(bool flag){

  flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;

}



int main(){

  cin.tie(nullptr);ios_base::sync_with_stdio(false);

  cout << fixed << setprecision(15);

  int a,b;cin>>a>>b;

  string c;

  int ans=0;

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

  	c=to_string(i);

  	if ((c[0]==c[4])&&(c[1]==c[3])) ans++;

  }

  cout<<ans<<endl;

}

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

int main(){

  int a,b;

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

  int r=0;

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

    int s=i%10,t=i/10000%10;

    int u=i/10%10,v=i/1000%10;

    if(s==t&&u==v)r++;

  }

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

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



using namespace std ;



#define sz(v) (int)v.size()

#define ll long long

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

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

#define pf push_front

#define pb push_back

#define fast FastInputOutput() ;

#define Clear( container , value ) memset( container , value , sizeof container )

#define PI acos( -1.0 )

#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )

#define fore( x , j ) for( auto x : j )

#define se second

#define fr first

//#define c_b fflush(stdin);



const ll Long_max = numeric_limits < ll > :: max() ;

const int Int_max = numeric_limits < int > :: max() ;



void File_input( string pathIn ) {

    freopen( pathIn.c_str(), "r", stdin ) ;

}



void File_output( string pathOut ) {

    freopen( pathOut.c_str(), "w", stdout ) ;

}



int msg() {

    srand( time( 0 ) ) ;

    vector < string > st = {

        "Wish everyone high ratings!",

        "Good luck!",

        "Have fun!",

        "Please, read all the problems!",

        "Go Go fight!"

    } ;

    cerr << st[ rand() % sz( st ) ] ;

    return 0 ;

}



void FastInputOutput() {

    ios_base :: sync_with_stdio( 0 ) ;

    cin.tie( 0 ) ;

    cout.tie( 0 ) ;

}



int a , b ;

bool is(int c ){

int rev = 0 , t = c ;

while( c ){

    rev = rev * 10 + c % 10 ;

    c /= 10 ;

}

return rev == t ;

}



int main() {

   cin >> a >> b ;

   int cn = 0 ;

   forn( int , i , a , b + 1 ){

     cn += is( i ) ;

   }

   cout << cn ;

   return 0 ;

}


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

int hws(int x)

{

    int num=0;

    while(x)

    {

        num*=10;

        num+=x%10;

        x=x/10;

    }

    return num;

}

int main()

{

    int a,b;

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

    int sum=0;

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

    {

        if(i==hws(i))

            sum++;

    }

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

    return 0;

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

using namespace std;



vector<int> v;



int main(){



    int a, b;

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

    int cnt=0;



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

        v.clear();

        int num=i;

        while(num){

            v.push_back(num%10);

            num/=10;

        }

        int sz=v.size();

        bool pal=true;

        for(int i=0, j=sz-1; i<j ; ++i, --j){

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

                pal=false;

        }

        if(pal)

            ++cnt;

    }



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

















    return 0;

}


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

int hws(int x)

{

    int num=0;

    while(x)

    {

        num*=10;

        num+=x%10;

        x=x/10;

    }

    return num;

}

int main()

{

    int a,b;

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

    int sum=0;

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

    {

        if(i==hws(i))

            sum++;

    }

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

    return 0;

}
// Slower C++ solution:
//

// Created by mustafa on 17/07/19.

//

#pragma GCC optimize("O3")

#include<bits/stdc++.h>

using namespace std ;



#define ll long long

#define submitStage int TCF = 1 ;

#define testStage int TCF = 1000 ;

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

#define Start while(TCF--)

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

#define FORd(i, a, b) for (int i = (a); i >= (b); i--)

#define REP(i, n) FOR(i, 0, n)

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

#define ReadFromFile(x)  freopen( x, "rt" , stdin ) ;

#define WriteToFile(x)  freopen( "in.txt", "wt" , stdout ) ;

#define D(x) scanf("%d",&x);

#define LLD(X) scanf("%lld",&x);

#define in(x,...) scanf(x,__VA_ARGS__)

#define out(x,...) printf(x,__VA_ARGS__)

/// for debugging

string to_string(string s) {return '"' + s + '"';}string to_string(const char* s) {return to_string((string) s);}string to_string(bool b) {return (b ? "true" : "false");}template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v) {bool first = true;string res = "{";for (const auto &x : v) {if (!first) {res += ", ";}first = false;res += to_string(x);}res += "}";return res;}void debug_out() { cerr << endl; }template <typename Head, typename... Tail>void debug_out(Head H, Tail... T) {cerr << " " << to_string(H);debug_out(T...);}

#ifndef ONLINE_JUDGE

#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

#else

#define dbg(...) {}

#endif



/// start driven program

const int N=1e6+7  , MOD= 1e9+7;



int mod(int k, int n){

    return((k %= n) < 0) ? k+n : k;

}

bool isP(int num){

    int ret=0;

    int temp=num;

    while(num){

        int m=num%10;

        ret=ret*10 + m;

        num/=10;

    }

    return (temp==ret);

}



int main(){

    submitStage Start {

        int n,m;

        D(n)   D(m)

        int cnt=0;

        FOR(i,n,m+1){

            cnt+= isP(i);

        }

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

    }

}

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

int hws(int x)

{

    int num=0;

    while(x)

    {

        num*=10;

        num+=x%10;

        x=x/10;

    }

    return num;

}

int main()

{

    int a,b;

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

    int sum=0;

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

    {

        if(i==hws(i))

            sum++;

    }

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

    return 0;

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

using namespace std;

typedef long long ll;





const int N=1e6,OO = 0x3f3f3f3f;

int d()

{

    int ret;

    scanf("%d", &ret);

    return ret;

}

long long lld()

{

    long long ret;

    scanf("%lld", &ret);

    return ret;

}

bool isplaind(int n){

    string s=to_string(n);

    string s1="";

    for(int i=s.length()-1;i>=0;i--)

        s1+=s[i];

    return (s==s1);

}

int main(){

    int a=d(),b=d();

    int ans=0;

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

    if(isplaind(i))ans++;

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

}


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

int hws(int x)

{

    int num=0;

    while(x)

    {

        num*=10;

        num+=x%10;

        x=x/10;

    }

    return num;

}

int main()

{

    int a,b;

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

    int sum=0;

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

    {

        if(i==hws(i))

            sum++;

    }

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

    return 0;

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

using namespace std ;

#define ll long long

void FastInputOutput(){

    ios_base :: sync_with_stdio( 0 ) ;

    cin.tie( 0 ) ;

    cout.tie( 0 ) ;

}



inline int D(){

    int t ;

    scanf( "%d" , &t ) ;

    return t ;

}

inline ll LLD(){

    ll t ;

    scanf( "%lld" , &t ) ;

    return t ;

}



ll power(ll x, ll p, ll m){

    ll res = 1;

    while(p){

        if(p&1)    res = (res * x)%m;

        x = (x * x)%m;

        p >>= 1;

    }

    return res;

}

long double ModLog(long double base, long double x) {

    return (logl(x) / logl(base));

}



const int N = 2e6 + 5, MX = 1e9;

char a[N];

int rev(int n){

    int ret = 0;

    while (n) {

        ret = ret * 10 + n % 10;

        n /= 10;

    }

    return ret;

}

int main(){

    int a = D(), b = D(), ans = 0;

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

        ans += rev(i) == i;

    }

    printf("%d", ans);

    return 0;

}


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

int hws(int x)

{

    int num=0;

    while(x)

    {

        num*=10;

        num+=x%10;

        x=x/10;

    }

    return num;

}

int main()

{

    int a,b;

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

    int sum=0;

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

    {

        if(i==hws(i))

            sum++;

    }

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

    return 0;

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

#include <string.h>

#include <iostream>

#include <algorithm>

#include <math.h>

#include <limits.h>

#include <map>

#include <stack>

#include <queue>

#include <vector>

#include <set>

#include <string>

using namespace std;

#define ll long long

const int maxx = 100005;

int ans[maxx];

int solve(int x)

{

    int k = 10000,cnt = 0,y = x;

    while(y){

        int now = y%10;

        y /= 10;

        cnt += now*k;

        k /= 10;

    }

    //cout<<cnt<<endl;

    if(cnt == x){

        return 1;

    }

    return 0;

}

int main()

{

    int x,y,cnt = 0;

    cin>>x>>y;

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

        if(solve(i)){

            cnt++;

        }

    }

    cout<<cnt<<endl;

    //cout<<ans[y] - ans[x]<<endl;

    return 0;

}


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

int hws(int x)

{

    int num=0;

    while(x)

    {

        num*=10;

        num+=x%10;

        x=x/10;

    }

    return num;

}

int main()

{

    int a,b;

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

    int sum=0;

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

    {

        if(i==hws(i))

            sum++;

    }

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

    return 0;

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

#include <cstdio>

#include <cmath>

#include <string>

#include <cstring>

#include <algorithm>

#include <iomanip>

#include <cstdlib>

#include <cctype>

#define ll long long

#define PI 3.14159265358979323846

using namespace std;

const int maxn = 1e6+7;



int main(){

	ll a,b;

	cin>>a>>b;

	ll temp;ll jw=10000;

	ll tempa;

	ll cnt=0;

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

		temp=0;

		tempa=i;

		jw=10000;

		while(jw!=0){

			temp+=(tempa%10*jw);

			jw/=10;

			tempa/=10;

		}

		if(temp==i){

			cnt++;

		}

	}

	cout<<cnt<<endl;

	return 0;

}


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

int hws(int x)

{

    int num=0;

    while(x)

    {

        num*=10;

        num+=x%10;

        x=x/10;

    }

    return num;

}

int main()

{

    int a,b;

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

    int sum=0;

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

    {

        if(i==hws(i))

            sum++;

    }

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

    return 0;

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

#include <list>

#include <map>

#include <set>

#include <deque>

#include <stack>

#include <bitset>

#include <algorithm>

#include <functional>

#include <iostream>

#include <iomanip>

#include <cstdio>

#include <cmath>

#include <set>

//#inlcude<stringstream>

#define ll long long

#define MODD 1000000007

using namespace std;



int main() {

    int a, b;cin >>a>>b;

    int sum=0;



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

        //cout<<i%10<< " "<<i/10000<<endl;

        int n = i;

        if((n%10)==(n/10000)){

            //cout<<i%10<< " "<<i/10000<<endl;

            if(((n-n%10)/10%10)==(n-n/10000*10000)/1000)

                sum++;

           // cout<<"ddd"<<(i-i%10)%10<< " "<<(i-i/10000*10000)/1000<<endl;

        }

    }

    cout<<sum<<endl;

    return 0;

}


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

int hws(int x)

{

    int num=0;

    while(x)

    {

        num*=10;

        num+=x%10;

        x=x/10;

    }

    return num;

}

int main()

{

    int a,b;

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

    int sum=0;

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

    {

        if(i==hws(i))

            sum++;

    }

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

    return 0;

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

#include <stdio.h>

#include <string.h>

#include <algorithm>

#include <math.h>

#include <map>

#include <set>

#include <stdlib.h>

#define ll long long

#define inf 0x3f3f3f3f

#define mem(a,b) memset(a,b,sizeof(a))

using namespace std;

const int maxn=1e6+5;

ll a[maxn];

int inverse(int x)

{

    int b=log10(x);

    int m=0,y;

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

    {

       y=x%10;

        m=m*10+y;

        x/=10;

    }

    //cout<<m<<endl;

    return m;

}

int main()

{

    ll a,b;

    cin>>a>>b;

    int sum=0;

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

    {

        if(inverse(i)==i)

        {

              sum++;

              //cout<<i<<endl;

        }

    }

    cout<<sum<<endl;

    return 0;

}

/*

10

5 1 8 8 8 8 8 9 9 9

*/


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

int hws(int x)

{

    int num=0;

    while(x)

    {

        num*=10;

        num+=x%10;

        x=x/10;

    }

    return num;

}

int main()

{

    int a,b;

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

    int sum=0;

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

    {

        if(i==hws(i))

            sum++;

    }

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

    return 0;

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

#include<math.h>

#include<string.h>

#include<iostream>

#include<algorithm>

#include<queue>

#include<stack>

#include<set>

#include<map>

#include<vector>

#include<deque>

#include<string>

#define dint __int128

using namespace std;

#define kk putchar(32)

#define gc getchar()

#define fup(i,a,b) for(int i=a,i##e=b;i<=i##e;++i)

#define fdn(i,a,b) for(int i=a,i##e=b;i>=i##e;--i)

#define mem(a,b) memset(a,b,sizeof(a))

#define hh putchar(10)

#define ll long long

inline ll rrr(){ll x,f=1;char a;while((a=gc)<48||a>57)if(a==45)f=-1;

for(x=a^48;(a=gc)>47&&a<58;x=(x<<3)+(x<<1)+(a^48));return f*x;}

struct nnn{int x,y,z;};

void Main();



int main()

{

    Main();

    return 0;

}



inline int huiwen(int x)

{

    int a=x,b=0;

    while(a)b=10*b+a%10,a/=10;

    if(x==b)return 1;

    return 0;

}

void Main()

{

    int a,b;

    cin>>a>>b;

    int ans=0;

    fup(i,a,b)(huiwen(i))&&(++ans);

    cout<<ans;

}


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

int hws(int x)

{

    int num=0;

    while(x)

    {

        num*=10;

        num+=x%10;

        x=x/10;

    }

    return num;

}

int main()

{

    int a,b;

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

    int sum=0;

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

    {

        if(i==hws(i))

            sum++;

    }

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

    return 0;

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

#include<stdio.h>

#include<algorithm>

#include<string.h>

using namespace std;

int huiwen(int s)

{

    int d=0;

    while(s)

    {

        d=d*10+s%10;

        s=s/10;

    }

    return d;

}

int main()

{

    int a,b,sum=0;

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

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

    {

        int q=huiwen(i);

        if(i==q)

          sum++;

    }

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

    return 0;

}

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

int hws(int x)

{

    int num=0;

    while(x)

    {

        num*=10;

        num+=x%10;

        x=x/10;

    }

    return num;

}

int main()

{

    int a,b;

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

    int sum=0;

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

    {

        if(i==hws(i))

            sum++;

    }

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

    return 0;

}