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

--------------              |   /

      |                     |  /

      |                     | /

      |             *       |/          |    |         ------            *

      |                     |           |    |        /      \

      |             |       |\          |    |       |       |\          |

   \  |             |       | \         |    |       |       | \         |

    \ |             |       |  \        |    |        \     /   \        |

     V              |       |   \        \__/|         -----     \       |

*/

#include <bits/stdc++.h>

using namespace std;



#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);

#define endl '\n'

#define mem(i,j) memset(i,j,sizeof i);

#define F first

#define S second

#define pb push_back

#define mp make_pair

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

#define bit(s,i) (((s)>>(i))&1LL)

#define lowbit(x) (x&-x)

#define siz(v) (long long)v.size()

typedef long long ll;

typedef unsigned long long ull;

typedef pair<int,int> pii;

typedef pair<ll, ll> pll;

const double EPS  = 1e-8;

const int INF     = 0x3F3F3F3F;

const ll LINF     = 4611686018427387903;

const int MOD     = 1e9+7;

const int MAXN    = 2e5+9;

/*-----------------------------------------------------------------------------------------------------*/



string toInt(int a) {

    string s, c;

    while(a>0) {

        s.pb(a%10+'0');

        a/=10;

    }

    for(int i = s.size()-1; i>=0; i--) c.pb(s[i]);

    return c;

}



int main() {

    EmiliaMyWife



    int n, a, b;

    cin >> n >> a >> b;

    if(a>b) swap(a, b);

    ll ans =0;

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

        string s = toInt(i);

        //cout << s << endl;

        int cur=0;

        for(auto x: s) {

            cur+=(x-'0');

        }

        if(a<=cur && cur<=b) ans+=i;

    }

    cout << ans;



	return 0;

}


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



int main(){

	int n;

	int a, b;

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

	int sum =0;

	

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

		int digitSum=0;

		int temp=i;

		while (temp!=0){

			digitSum = digitSum + temp%10;

			temp/= 10;

		}

		if (digitSum >=a && digitSum <= b){

			sum += i;

		}

			

	}

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

	return 0;

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

using namespace std;

int change(int a){

    int re = 0;

    while(a>0){

        re += a%10;

        a/=10;

    }

    return re;

}

int main(){

    int n,a,b;

    cin >> n>> a >> b;

    long long int ans = 0;

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

        int re = change(i);

        if(re >= a && re <= b){

            ans += i;

//            cout << i <<endl;

        }

    }

    cout << ans <<endl;

    return 0;

}


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



int main(){

	int n;

	int a, b;

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

	int sum =0;

	

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

		int digitSum=0;

		int temp=i;

		while (temp!=0){

			digitSum = digitSum + temp%10;

			temp/= 10;

		}

		if (digitSum >=a && digitSum <= b){

			sum += i;

		}

			

	}

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

	return 0;

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

using namespace std;

int sum(int n)

{

    int x=0;

    while(n)

    {

        x+=n%10;n/=10;

    }

    return x;

}

int main()

{

    int n,a,b,x; long long int cnt=0;

    cin >> n >> a >> b;

    n++;

    while(n--)

    {

        x= sum(n);

        if(x>=a&&x<=b)cnt+=n;

    }

    cout << cnt << endl;

    return 0;

}


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



#define ll long long int



int main() {

    int n, a, b;

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

    ll ans = 0;

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

        if(i >= 10){

            int temp = i, sum = 0;

            while(temp > 0){

                sum += temp%10;

                temp /= 10;

            }

            if(sum >= a && sum <= b){

                ans += i;

            }

        }else{

            if(i >= a && i <= b){

                ans += i;

            }

        }

    }

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

    

    return 0;

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

//#include<tr1/unordered_map>

#include<iostream>

#include<string>

#pragma GCC optimize ("Ofast")

#define ll long long

#define pll pair<long long,long long>

#define pii pair<int,int>

#define mp make_pair

#define pb push_back

#define F first

#define S second

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

#define Forn(i, n) for(int i=1; i<=int(n); i++)



using namespace std;



/*#include <ext/pb_ds/tree_policy.hpp>

#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;

typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> rbtree;*/



int sum_of_digits(int x)

{

    int ret = 0;

    while(x)

    {

        ret += x%10;

        x/=10;

    }

    return ret;

}



int main()

{

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

    int n, a, b;

    cin >> n >> a >> b;

    int ans = 0;

    Forn(i, n)

    {

        int temp = sum_of_digits(i);

        if(a<=temp && temp<=b) ans += i;

    }

    cout << ans << endl;

}


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



#define ll long long int



int main() {

    int n, a, b;

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

    ll ans = 0;

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

        if(i >= 10){

            int temp = i, sum = 0;

            while(temp > 0){

                sum += temp%10;

                temp /= 10;

            }

            if(sum >= a && sum <= b){

                ans += i;

            }

        }else{

            if(i >= a && i <= b){

                ans += i;

            }

        }

    }

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

    

    return 0;

}
// Slower C++ solution:
/*

--------------              |   /

      |                     |  /

      |                     | /

      |             *       |/          |    |         ------            *

      |                     |           |    |        /      \

      |             |       |\          |    |       |       |\          |

   \  |             |       | \         |    |       |       | \         |

    \ |             |       |  \        |    |        \     /   \        |

     V              |       |   \        \__/|         -----     \       |

*/

#include <bits/stdc++.h>

using namespace std;



#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);

#define endl '\n'

#define mem(i,j) memset(i,j,sizeof i);

#define F first

#define S second

#define pb push_back

#define mp make_pair

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

#define bit(s,i) (((s)>>(i))&1LL)

#define lowbit(x) (x&-x)

#define siz(v) (long long)v.size()

typedef long long ll;

typedef unsigned long long ull;

typedef pair<int,int> pii;

typedef pair<ll, ll> pll;

const double EPS  = 1e-8;

const int INF     = 0x3F3F3F3F;

const ll LINF     = 4611686018427387903;

const int MOD     = 1e9+7;

const int MAXN    = 2e5+9;

/*-----------------------------------------------------------------------------------------------------*/



string toInt(int a) {

    string s, c;

    while(a>0) {

        s.pb(a%10+'0');

        a/=10;

    }

    for(int i = s.size()-1; i>=0; i--) c.pb(s[i]);

    return c;

}



int main() {

    EmiliaMyWife



    int n, a, b;

    cin >> n >> a >> b;

    if(a>b) swap(a, b);

    ll ans =0;

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

        string s = toInt(i);

        //cout << s << endl;

        int cur=0;

        for(auto x: s) {

            cur+=(x-'0');

        }

        if(a<=cur && cur<=b) ans+=i;

    }

    cout << ans;



	return 0;

}


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



#define ll long long int



int main() {

    int n, a, b;

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

    ll ans = 0;

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

        if(i >= 10){

            int temp = i, sum = 0;

            while(temp > 0){

                sum += temp%10;

                temp /= 10;

            }

            if(sum >= a && sum <= b){

                ans += i;

            }

        }else{

            if(i >= a && i <= b){

                ans += i;

            }

        }

    }

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

    

    return 0;

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

using namespace std;

int change(int a){

    int re = 0;

    while(a>0){

        re += a%10;

        a/=10;

    }

    return re;

}

int main(){

    int n,a,b;

    cin >> n>> a >> b;

    long long int ans = 0;

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

        int re = change(i);

        if(re >= a && re <= b){

            ans += i;

//            cout << i <<endl;

        }

    }

    cout << ans <<endl;

    return 0;

}


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



#define ll long long int



int main() {

    int n, a, b;

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

    ll ans = 0;

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

        if(i >= 10){

            int temp = i, sum = 0;

            while(temp > 0){

                sum += temp%10;

                temp /= 10;

            }

            if(sum >= a && sum <= b){

                ans += i;

            }

        }else{

            if(i >= a && i <= b){

                ans += i;

            }

        }

    }

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

    

    return 0;

}
// Slower C++ solution:




#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n,a,b,sum,sum2=0,temp=0,var,i;

    cin>>n>>a>>b;

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

    {



        sum=0,temp=i;

        while(temp!=0)

        {

            var=temp%10;

            sum=sum+var;

            temp=temp/10;

        }



        if(a<=sum&& sum<=b)

        {



            sum2=sum2+i;

        }

    }

    cout<<sum2<<endl;

    return 0;

}


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



int main(){

	int n, a, b;

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

	int sum = 0;



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

		int c = 0;

		int temp = i;

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

			c += temp % 10;

			temp /= 10;

		}

		if (c >= a && c <= b){

			sum += i;

		}

	}



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



	return 0;

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

using namespace std;



int R , ans=0 ;



int dec(int n){

	int temp=0;

	while(n){

		temp+=n%10;

		n/=10;

	}

	return temp;	

}



int main()

{

	int N , a , b ;

	

	cin>>N>>a>>b;

	

	int m=min(a,b) , M=max(a,b) ;

	

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

		int te = dec(i);

		if( te>=m && te<=M )

			ans+=i;

	}

	

	cout<<ans<<endl;

	return 0;			

}

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



int main(){

	int n, a, b;

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

	int sum = 0;



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

		int c = 0;

		int temp = i;

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

			c += temp % 10;

			temp /= 10;

		}

		if (c >= a && c <= b){

			sum += i;

		}

	}



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



	return 0;

}
// Slower C++ solution:
#pragma GCC optimize("O3")

#include<bits/stdc++.h>

#define ll long long

#define endl '\n'

using namespace std;



int main(){

	ios::sync_with_stdio(0);cin.tie(0);

	ll n,a,b,ans=0;

	cin>>n>>a>>b;

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

		string str=to_string(i);

		ll cnt=0;

		for(char j:str)	cnt+=j-'0';

		if(a<=cnt&&cnt<=b)	ans+=i;

	}

	cout<<ans<<endl;

	return 0;

}

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



int main(){

	int n, a, b;

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

	int sum = 0;



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

		int c = 0;

		int temp = i;

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

			c += temp % 10;

			temp /= 10;

		}

		if (c >= a && c <= b){

			sum += i;

		}

	}



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



	return 0;

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

#include<algorithm>

#include<string>

#include<cmath>

#include<set>

#include<cstdio>



#define endl '\n'

#define ll long long

#define ull unsigned ll

#define x first

#define y second



using namespace std;



int shuzihe(int x){

    int ans=0;

    while(x){

        ans+=x%10;

        x/=10;

    }

    return ans;

}

int main(){

    int n,a,b;

    cin>>n;

    cin>>a>>b;

    int temp;

    int ans=0;

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

        temp=shuzihe(i);

        if(temp>=a && temp<=b){

            ans+=i;

        }

    }

    cout<<ans<<endl;

    return 0;

}


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



int main(){

	int n, a, b;

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

	int sum = 0;



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

		int c = 0;

		int temp = i;

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

			c += temp % 10;

			temp /= 10;

		}

		if (c >= a && c <= b){

			sum += i;

		}

	}



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



	return 0;

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

#include <string>

#include <algorithm>

#include <cmath>



using namespace std;



int main(){

	

	int n, a, b;

	cin >> n >> a >> b;

	

	int ans = 0;

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

		string s = to_string(i);

		int dsum = 0;

		

		for(int j = 0; j < s.length(); j++){

			dsum = dsum + s[j] - '0';

		

		}

		

		if(a <= dsum && dsum <= b) ans = ans + i;

	

	}

	

	

	cout << ans << endl;

	

	return 0;

}

/*

+++++ +++++ +++++ +++++

+++++ +++++ ++

>,[[-<->]]



*/


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



int main(){

	int n, a, b;

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

	int sum = 0;



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

		int c = 0;

		int temp = i;

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

			c += temp % 10;

			temp /= 10;

		}

		if (c >= a && c <= b){

			sum += i;

		}

	}



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



	return 0;

}
// Slower C++ solution:




#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n,a,b,sum,sum2=0,temp=0,var,i;

    cin>>n>>a>>b;

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

    {



        sum=0,temp=i;

        while(temp!=0)

        {

            var=temp%10;

            sum=sum+var;

            temp=temp/10;

        }



        if(a<=sum&& sum<=b)

        {



            sum2=sum2+i;

        }

    }

    cout<<sum2<<endl;

    return 0;

}


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



int main() {

	int n, a,b;

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

	int sum = 0;

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

		int temp = i, total = 0;

		while (temp > 0){

			total += temp % 10;

			temp /= 10;

		}

		if(total >= a && total <= b){

			sum += i;

		}

	}

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

	

	return 0;

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

using namespace std;



int R , ans=0 ;



int dec(int n){

	int temp=0;

	while(n){

		temp+=n%10;

		n/=10;

	}

	return temp;	

}



int main()

{

	int N , a , b ;

	

	cin>>N>>a>>b;

	

	int m=min(a,b) , M=max(a,b) ;

	

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

		int te = dec(i);

		if( te>=m && te<=M )

			ans+=i;

	}

	

	cout<<ans<<endl;

	return 0;			

}

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



int main() {

	int n, a,b;

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

	int sum = 0;

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

		int temp = i, total = 0;

		while (temp > 0){

			total += temp % 10;

			temp /= 10;

		}

		if(total >= a && total <= b){

			sum += i;

		}

	}

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

	

	return 0;

}
// Slower C++ solution:
#pragma GCC optimize("O3")

#include<bits/stdc++.h>

#define ll long long

#define endl '\n'

using namespace std;



int main(){

	ios::sync_with_stdio(0);cin.tie(0);

	ll n,a,b,ans=0;

	cin>>n>>a>>b;

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

		string str=to_string(i);

		ll cnt=0;

		for(char j:str)	cnt+=j-'0';

		if(a<=cnt&&cnt<=b)	ans+=i;

	}

	cout<<ans<<endl;

	return 0;

}

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



int main() {

	int n, a,b;

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

	int sum = 0;

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

		int temp = i, total = 0;

		while (temp > 0){

			total += temp % 10;

			temp /= 10;

		}

		if(total >= a && total <= b){

			sum += i;

		}

	}

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

	

	return 0;

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

#include<algorithm>

#include<string>

#include<cmath>

#include<set>

#include<cstdio>



#define endl '\n'

#define ll long long

#define ull unsigned ll

#define x first

#define y second



using namespace std;



int shuzihe(int x){

    int ans=0;

    while(x){

        ans+=x%10;

        x/=10;

    }

    return ans;

}

int main(){

    int n,a,b;

    cin>>n;

    cin>>a>>b;

    int temp;

    int ans=0;

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

        temp=shuzihe(i);

        if(temp>=a && temp<=b){

            ans+=i;

        }

    }

    cout<<ans<<endl;

    return 0;

}


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



int main() {

	int n, a,b;

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

	int sum = 0;

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

		int temp = i, total = 0;

		while (temp > 0){

			total += temp % 10;

			temp /= 10;

		}

		if(total >= a && total <= b){

			sum += i;

		}

	}

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

	

	return 0;

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

#include <string>

#include <algorithm>

#include <cmath>



using namespace std;



int main(){

	

	int n, a, b;

	cin >> n >> a >> b;

	

	int ans = 0;

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

		string s = to_string(i);

		int dsum = 0;

		

		for(int j = 0; j < s.length(); j++){

			dsum = dsum + s[j] - '0';

		

		}

		

		if(a <= dsum && dsum <= b) ans = ans + i;

	

	}

	

	

	cout << ans << endl;

	

	return 0;

}

/*

+++++ +++++ +++++ +++++

+++++ +++++ ++

>,[[-<->]]



*/


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



int main() {

	int n, a,b;

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

	int sum = 0;

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

		int temp = i, total = 0;

		while (temp > 0){

			total += temp % 10;

			temp /= 10;

		}

		if(total >= a && total <= b){

			sum += i;

		}

	}

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

	

	return 0;

}
// Slower C++ solution:




#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n,a,b,sum,sum2=0,temp=0,var,i;

    cin>>n>>a>>b;

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

    {



        sum=0,temp=i;

        while(temp!=0)

        {

            var=temp%10;

            sum=sum+var;

            temp=temp/10;

        }



        if(a<=sum&& sum<=b)

        {



            sum2=sum2+i;

        }

    }

    cout<<sum2<<endl;

    return 0;

}


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



int main(){

	

	int n,a,b;

	

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

	int sum =0;

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

		if((i/10000)+((i/1000)%10)+((i/100)%10)+((i/10)%10)+(i%10)>=a&&((i/10000)+((i/1000)%10)+((i/100)%10)+((i/10)%10)+(i%10))<=b){

			sum +=i;

		}

	}

	printf("%d",sum);

	return 0;

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

using namespace std;



int R , ans=0 ;



int dec(int n){

	int temp=0;

	while(n){

		temp+=n%10;

		n/=10;

	}

	return temp;	

}



int main()

{

	int N , a , b ;

	

	cin>>N>>a>>b;

	

	int m=min(a,b) , M=max(a,b) ;

	

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

		int te = dec(i);

		if( te>=m && te<=M )

			ans+=i;

	}

	

	cout<<ans<<endl;

	return 0;			

}

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



int main(){

	

	int n,a,b;

	

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

	int sum =0;

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

		if((i/10000)+((i/1000)%10)+((i/100)%10)+((i/10)%10)+(i%10)>=a&&((i/10000)+((i/1000)%10)+((i/100)%10)+((i/10)%10)+(i%10))<=b){

			sum +=i;

		}

	}

	printf("%d",sum);

	return 0;

}
// Slower C++ solution:
#pragma GCC optimize("O3")

#include<bits/stdc++.h>

#define ll long long

#define endl '\n'

using namespace std;



int main(){

	ios::sync_with_stdio(0);cin.tie(0);

	ll n,a,b,ans=0;

	cin>>n>>a>>b;

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

		string str=to_string(i);

		ll cnt=0;

		for(char j:str)	cnt+=j-'0';

		if(a<=cnt&&cnt<=b)	ans+=i;

	}

	cout<<ans<<endl;

	return 0;

}

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



int main(){

	

	int n,a,b;

	

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

	int sum =0;

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

		if((i/10000)+((i/1000)%10)+((i/100)%10)+((i/10)%10)+(i%10)>=a&&((i/10000)+((i/1000)%10)+((i/100)%10)+((i/10)%10)+(i%10))<=b){

			sum +=i;

		}

	}

	printf("%d",sum);

	return 0;

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

#include<algorithm>

#include<string>

#include<cmath>

#include<set>

#include<cstdio>



#define endl '\n'

#define ll long long

#define ull unsigned ll

#define x first

#define y second



using namespace std;



int shuzihe(int x){

    int ans=0;

    while(x){

        ans+=x%10;

        x/=10;

    }

    return ans;

}

int main(){

    int n,a,b;

    cin>>n;

    cin>>a>>b;

    int temp;

    int ans=0;

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

        temp=shuzihe(i);

        if(temp>=a && temp<=b){

            ans+=i;

        }

    }

    cout<<ans<<endl;

    return 0;

}


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



int main(){

	

	int n,a,b;

	

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

	int sum =0;

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

		if((i/10000)+((i/1000)%10)+((i/100)%10)+((i/10)%10)+(i%10)>=a&&((i/10000)+((i/1000)%10)+((i/100)%10)+((i/10)%10)+(i%10))<=b){

			sum +=i;

		}

	}

	printf("%d",sum);

	return 0;

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

#include <string>

#include <algorithm>

#include <cmath>



using namespace std;



int main(){

	

	int n, a, b;

	cin >> n >> a >> b;

	

	int ans = 0;

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

		string s = to_string(i);

		int dsum = 0;

		

		for(int j = 0; j < s.length(); j++){

			dsum = dsum + s[j] - '0';

		

		}

		

		if(a <= dsum && dsum <= b) ans = ans + i;

	

	}

	

	

	cout << ans << endl;

	

	return 0;

}

/*

+++++ +++++ +++++ +++++

+++++ +++++ ++

>,[[-<->]]



*/


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



int main(){

	

	int n,a,b;

	

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

	int sum =0;

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

		if((i/10000)+((i/1000)%10)+((i/100)%10)+((i/10)%10)+(i%10)>=a&&((i/10000)+((i/1000)%10)+((i/100)%10)+((i/10)%10)+(i%10))<=b){

			sum +=i;

		}

	}

	printf("%d",sum);

	return 0;

}
// Slower C++ solution:




#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n,a,b,sum,sum2=0,temp=0,var,i;

    cin>>n>>a>>b;

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

    {



        sum=0,temp=i;

        while(temp!=0)

        {

            var=temp%10;

            sum=sum+var;

            temp=temp/10;

        }



        if(a<=sum&& sum<=b)

        {



            sum2=sum2+i;

        }

    }

    cout<<sum2<<endl;

    return 0;

}


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



int main(){

	int a,b,c;

	int sum=0;

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

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

        int x = 0;

        int y = i;

        while(y != 0){

            x += (y%10);

            y = y / 10;

        }

        if(x >= a && x <= b){

        sum += i;

    }

}

	printf("%d",sum);  

    return 0;

}