stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

#define ll long long

using namespace std;



bool sumofdigit(int x, int a, int b){

    int s=0;

    while(x){



    s+=x%10;

    x/=10;

    }

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

        return true;

    }

    else{

        return false;

    }

}





int main()

{

    ll int jogfol=0;

    int n,a,b;

    cin>>n>>a>>b;



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

        if(sumofdigit(i,a,b)){

            jogfol+=i;

        }

    }

    cout<<jogfol;

    return 0;

}


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



int main()

{

	int N, A, B;

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

	int sum = 0;

	//i == 123

	//123 % 10 == 3; 123/10 == 12

	//12 % 10 == 2; 12/10 == 1

	//1 % 10 == 1; 1/10 == 0

	//3+2+1 = 6;

	

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

		int digitSum = 0;

		int temp = i;

		while(temp != 0) {

			digitSum = digitSum + temp % 10;

			temp /= 10;

		}

		//temp = 0;

		if(digitSum >= A && digitSum <= B){

			sum += i;

		}

	}

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

	

	return 0;

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

#include <algorithm>

#include <cmath>

#include <bitset>

#include <cstring>

#include <string.h>

#include <sstream>

#include <iomanip>

#include <queue>

#include <stack>

#include <deque>

#include <map>

#include <set>

#include <unordered_set>

#include <unordered_map>

#include <vector>

#include <stdio.h>

#include <stdlib.h>

using namespace std;

 

typedef unsigned long ul;

typedef unsigned long long ull;

typedef long long ll;

typedef pair<int,int> pii;

typedef pair<ll,ll> pll;

 

const ll MOD = 1e9+7;

const double PI  = 3.14159265358;

const double EPS = 1e-8;



#define INT_MX 2147483647

#define INF ((int)1e9)

#define LLINF ((ll)1e18)

#define F first

#define S second

#define mp(x,y) make_pair(x,y)

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

#define rs(n) resize(n)

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

#define reset(v) memset((v),0,sizeof(v))

#define EB emplace_back

#define pb push_back

#define pf push_front

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

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

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





void solve(){

    int n, a, b, ct;

    ll ans;

    string s;

    

    ans = 0;

    

    cin >> n >> a >> b;

    rep1(i, n){

        s = to_string(i);

        ct = 0;

        for(auto i:s)

            ct += i - '0';

        if(ct >= a && ct <= b)

            ans += i;

    }

    cout << ans << '\n';

}



int main(){

    

    solve();

}








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



int main()

{

	int N, A, B;

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

	int sum = 0;

	//i == 123

	//123 % 10 == 3; 123/10 == 12

	//12 % 10 == 2; 12/10 == 1

	//1 % 10 == 1; 1/10 == 0

	//3+2+1 = 6;

	

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

		int digitSum = 0;

		int temp = i;

		while(temp != 0) {

			digitSum = digitSum + temp % 10;

			temp /= 10;

		}

		//temp = 0;

		if(digitSum >= A && digitSum <= B){

			sum += i;

		}

	}

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

	

	return 0;

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

using namespace std;

#define AC ios_base::sync_with_stdio(0),cin.tie(0);

int main(void)

{

	AC;

	int T,a,n,i,b,k,t,sum=0;

	cin>>n>>a>>b;

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

		k=i;

		t=0;

		while(k!=0){

			t+=k%10;

			k/=10;

		}

		if(t>=a && b>=t) sum+=i;

	}

	cout<<sum<<"\n";

}




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



int main()

{

	int N, A, B;

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

	int sum = 0;

	//i == 123

	//123 % 10 == 3; 123/10 == 12

	//12 % 10 == 2; 12/10 == 1

	//1 % 10 == 1; 1/10 == 0

	//3+2+1 = 6;

	

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

		int digitSum = 0;

		int temp = i;

		while(temp != 0) {

			digitSum = digitSum + temp % 10;

			temp /= 10;

		}

		//temp = 0;

		if(digitSum >= A && digitSum <= B){

			sum += i;

		}

	}

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

	

	return 0;

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

using namespace std;



int sums(int n){

    int re=0;

    while(n>9){

        re+=n%10;

        n/=10;

    }

    re+=n;

    return re;

}



int main(){

    int n,a,b;

    cin>>n>>a>>b;

    int sum=0;

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

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

            sum+=i;

        }

    }

    cout<<sum;

    return 0;

}

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



int main()

{

	int N, A, B;

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

	int sum = 0;

	//i == 123

	//123 % 10 == 3; 123/10 == 12

	//12 % 10 == 2; 12/10 == 1

	//1 % 10 == 1; 1/10 == 0

	//3+2+1 = 6;

	

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

		int digitSum = 0;

		int temp = i;

		while(temp != 0) {

			digitSum = digitSum + temp % 10;

			temp /= 10;

		}

		//temp = 0;

		if(digitSum >= A && digitSum <= B){

			sum += i;

		}

	}

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

	

	return 0;

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

#define R(X) cin>>X



using namespace std;

inline int digitSum(int num){

	int out=0;

	while(num!=0){

		out+=num%10;

		num/=10;

	}

	return out;

}

int main(){

	int N;R(N);

	int a,b;R(a);R(b);

	int sum=0;

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

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

		    sum+=i;

	cout<<sum;

	return 0;

}

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



int main()

{

	int N, A, B;

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

	int sum = 0;

	//i == 123

	//123 % 10 == 3; 123/10 == 12

	//12 % 10 == 2; 12/10 == 1

	//1 % 10 == 1; 1/10 == 0

	//3+2+1 = 6;

	

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

		int digitSum = 0;

		int temp = i;

		while(temp != 0) {

			digitSum = digitSum + temp % 10;

			temp /= 10;

		}

		//temp = 0;

		if(digitSum >= A && digitSum <= B){

			sum += i;

		}

	}

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

	

	return 0;

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

#include <string>

using namespace std;

int n;

int a,b;



int main() {

    cin>>n>>a>>b;

    int answer=0;

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

    {

        string temp= to_string(i);

        int count=0;

        for(int t=0;t<temp.length();t++)

        {

            count+=temp[t]-'0';

        }

        if(count>=a&&count<=b)

        answer+=i;

    }

    cout<<answer;

}


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



int main()

{

	int N, A, B;

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

	int sum = 0;

	//i == 123

	//123 % 10 == 3; 123/10 == 12

	//12 % 10 == 2; 12/10 == 1

	//1 % 10 == 1; 1/10 == 0

	//3+2+1 = 6;

	

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

		int digitSum = 0;

		int temp = i;

		while(temp != 0) {

			digitSum = digitSum + temp % 10;

			temp /= 10;

		}

		//temp = 0;

		if(digitSum >= A && digitSum <= B){

			sum += i;

		}

	}

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

	

	return 0;

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

#include<cmath>

#include<string>

using namespace std;



int sum(int x)

{

  int b=10,s=0,i,q,ar[5],y;

  ar[0]=0;

  q=log10(x);

  if(q==log10(x))

  {

      y=log10(x)+1;

  }

  else

  {

     y=ceil(log10(x));

  }

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

  {

      ar[i]=((x%b)-ar[i-1])/(b/10);

      s=s+ar[i];

      b=b*10;

  }

  return s;

}



int main()

{

   int a,b,n,s=0,i;

   cin >> n >> a >> b;

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

   {

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

       {

           s=s+i;

       }



   }

   cout << s;

   return 0;

}


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



int main (){

	int N, a, b;

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

	int sum = 0;

	

	for (int i = 0; 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>

#define ll long long

using namespace std;



bool sumofdigit(int x, int a, int b){

    int s=0;

    while(x){



    s+=x%10;

    x/=10;

    }

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

        return true;

    }

    else{

        return false;

    }

}





int main()

{

    ll int jogfol=0;

    int n,a,b;

    cin>>n>>a>>b;



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

        if(sumofdigit(i,a,b)){

            jogfol+=i;

        }

    }

    cout<<jogfol;

    return 0;

}


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



int main (){

	int N, a, b;

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

	int sum = 0;

	

	for (int i = 0; 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>

#include <algorithm>

#include <cmath>

#include <bitset>

#include <cstring>

#include <string.h>

#include <sstream>

#include <iomanip>

#include <queue>

#include <stack>

#include <deque>

#include <map>

#include <set>

#include <unordered_set>

#include <unordered_map>

#include <vector>

#include <stdio.h>

#include <stdlib.h>

using namespace std;

 

typedef unsigned long ul;

typedef unsigned long long ull;

typedef long long ll;

typedef pair<int,int> pii;

typedef pair<ll,ll> pll;

 

const ll MOD = 1e9+7;

const double PI  = 3.14159265358;

const double EPS = 1e-8;



#define INT_MX 2147483647

#define INF ((int)1e9)

#define LLINF ((ll)1e18)

#define F first

#define S second

#define mp(x,y) make_pair(x,y)

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

#define rs(n) resize(n)

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

#define reset(v) memset((v),0,sizeof(v))

#define EB emplace_back

#define pb push_back

#define pf push_front

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

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

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





void solve(){

    int n, a, b, ct;

    ll ans;

    string s;

    

    ans = 0;

    

    cin >> n >> a >> b;

    rep1(i, n){

        s = to_string(i);

        ct = 0;

        for(auto i:s)

            ct += i - '0';

        if(ct >= a && ct <= b)

            ans += i;

    }

    cout << ans << '\n';

}



int main(){

    

    solve();

}








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



int main (){

	int N, a, b;

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

	int sum = 0;

	

	for (int i = 0; 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;

#define AC ios_base::sync_with_stdio(0),cin.tie(0);

int main(void)

{

	AC;

	int T,a,n,i,b,k,t,sum=0;

	cin>>n>>a>>b;

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

		k=i;

		t=0;

		while(k!=0){

			t+=k%10;

			k/=10;

		}

		if(t>=a && b>=t) sum+=i;

	}

	cout<<sum<<"\n";

}




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



int main (){

	int N, a, b;

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

	int sum = 0;

	

	for (int i = 0; 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 sums(int n){

    int re=0;

    while(n>9){

        re+=n%10;

        n/=10;

    }

    re+=n;

    return re;

}



int main(){

    int n,a,b;

    cin>>n>>a>>b;

    int sum=0;

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

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

            sum+=i;

        }

    }

    cout<<sum;

    return 0;

}

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



int main (){

	int N, a, b;

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

	int sum = 0;

	

	for (int i = 0; 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>

#define R(X) cin>>X



using namespace std;

inline int digitSum(int num){

	int out=0;

	while(num!=0){

		out+=num%10;

		num/=10;

	}

	return out;

}

int main(){

	int N;R(N);

	int a,b;R(a);R(b);

	int sum=0;

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

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

		    sum+=i;

	cout<<sum;

	return 0;

}

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



int main (){

	int N, a, b;

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

	int sum = 0;

	

	for (int i = 0; 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>

#include <string>

using namespace std;

int n;

int a,b;



int main() {

    cin>>n>>a>>b;

    int answer=0;

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

    {

        string temp= to_string(i);

        int count=0;

        for(int t=0;t<temp.length();t++)

        {

            count+=temp[t]-'0';

        }

        if(count>=a&&count<=b)

        answer+=i;

    }

    cout<<answer;

}


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



int main (){

	int N, a, b;

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

	int sum = 0;

	

	for (int i = 0; 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>

#include<cmath>

#include<string>

using namespace std;



int sum(int x)

{

  int b=10,s=0,i,q,ar[5],y;

  ar[0]=0;

  q=log10(x);

  if(q==log10(x))

  {

      y=log10(x)+1;

  }

  else

  {

     y=ceil(log10(x));

  }

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

  {

      ar[i]=((x%b)-ar[i-1])/(b/10);

      s=s+ar[i];

      b=b*10;

  }

  return s;

}



int main()

{

   int a,b,n,s=0,i;

   cin >> n >> a >> b;

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

   {

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

       {

           s=s+i;

       }



   }

   cout << s;

   return 0;

}


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



int main () {

	int ans = 0;

	int N, A, B;

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

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

		int digit = 0;

		int aa = i;

		while (aa != 0) {

			digit = digit + aa % 10;

			aa /= 10;

		}

		

		if (digit >= A && digit <= B) {

			ans += i;

		}

//		if (i == 10 || i == 100 || i == 1000 || i == 10000) {

//			if (1 >= A && 1 <= B) {

//				ans += i;	

//			}

//		} else if (i < 10) {

//			if (i >= A && i <= B) {

//				ans += i;

//				}

//		} else if (i > 10 && i < 100) {

//			int Bb = i / 10;

//			int Bbb = i - (Bb*10);

//			int B1 = Bb + Bbb;

//			if (B1 >= A && B1 <= B) {

//				ans += i;

//			}	

//		} else if (i > 100 && i < 1000) {

//			int Cc = i / 100;

//			int Ccc = (i - (Cc*100)) / 10;

//			int Cccc = i - (Cc * 100) - (Ccc * 10);

//			int C1 = Cc + Ccc + Cccc;

//			if (C1 >= A && C1 <= B) {

//				ans += i;

//			}	

//		} else if (i > 1000 && i < 10000) {

//			int D = i / 1000;

//			int Dd = (i - (D*100)) / 100;

//			int Ddd = (i - (D * 1000) - (Dd * 100) / 10);

//			int Dddd = i - (D * 1000) - (Dd * 100) - (Ddd * 10);

//			int D1 = D + Dd + Ddd + Dddd;

//			if (D1 >= A && D1 <= B) {

//				ans += i;

//			}

//		}

	}

	printf ("%d", ans);

	return 0;

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

#define ll long long

using namespace std;



bool sumofdigit(int x, int a, int b){

    int s=0;

    while(x){



    s+=x%10;

    x/=10;

    }

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

        return true;

    }

    else{

        return false;

    }

}





int main()

{

    ll int jogfol=0;

    int n,a,b;

    cin>>n>>a>>b;



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

        if(sumofdigit(i,a,b)){

            jogfol+=i;

        }

    }

    cout<<jogfol;

    return 0;

}


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



int main () {

	int ans = 0;

	int N, A, B;

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

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

		int digit = 0;

		int aa = i;

		while (aa != 0) {

			digit = digit + aa % 10;

			aa /= 10;

		}

		

		if (digit >= A && digit <= B) {

			ans += i;

		}

//		if (i == 10 || i == 100 || i == 1000 || i == 10000) {

//			if (1 >= A && 1 <= B) {

//				ans += i;	

//			}

//		} else if (i < 10) {

//			if (i >= A && i <= B) {

//				ans += i;

//				}

//		} else if (i > 10 && i < 100) {

//			int Bb = i / 10;

//			int Bbb = i - (Bb*10);

//			int B1 = Bb + Bbb;

//			if (B1 >= A && B1 <= B) {

//				ans += i;

//			}	

//		} else if (i > 100 && i < 1000) {

//			int Cc = i / 100;

//			int Ccc = (i - (Cc*100)) / 10;

//			int Cccc = i - (Cc * 100) - (Ccc * 10);

//			int C1 = Cc + Ccc + Cccc;

//			if (C1 >= A && C1 <= B) {

//				ans += i;

//			}	

//		} else if (i > 1000 && i < 10000) {

//			int D = i / 1000;

//			int Dd = (i - (D*100)) / 100;

//			int Ddd = (i - (D * 1000) - (Dd * 100) / 10);

//			int Dddd = i - (D * 1000) - (Dd * 100) - (Ddd * 10);

//			int D1 = D + Dd + Ddd + Dddd;

//			if (D1 >= A && D1 <= B) {

//				ans += i;

//			}

//		}

	}

	printf ("%d", ans);

	return 0;

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

#include <algorithm>

#include <cmath>

#include <bitset>

#include <cstring>

#include <string.h>

#include <sstream>

#include <iomanip>

#include <queue>

#include <stack>

#include <deque>

#include <map>

#include <set>

#include <unordered_set>

#include <unordered_map>

#include <vector>

#include <stdio.h>

#include <stdlib.h>

using namespace std;

 

typedef unsigned long ul;

typedef unsigned long long ull;

typedef long long ll;

typedef pair<int,int> pii;

typedef pair<ll,ll> pll;

 

const ll MOD = 1e9+7;

const double PI  = 3.14159265358;

const double EPS = 1e-8;



#define INT_MX 2147483647

#define INF ((int)1e9)

#define LLINF ((ll)1e18)

#define F first

#define S second

#define mp(x,y) make_pair(x,y)

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

#define rs(n) resize(n)

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

#define reset(v) memset((v),0,sizeof(v))

#define EB emplace_back

#define pb push_back

#define pf push_front

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

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

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





void solve(){

    int n, a, b, ct;

    ll ans;

    string s;

    

    ans = 0;

    

    cin >> n >> a >> b;

    rep1(i, n){

        s = to_string(i);

        ct = 0;

        for(auto i:s)

            ct += i - '0';

        if(ct >= a && ct <= b)

            ans += i;

    }

    cout << ans << '\n';

}



int main(){

    

    solve();

}








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



int main () {

	int ans = 0;

	int N, A, B;

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

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

		int digit = 0;

		int aa = i;

		while (aa != 0) {

			digit = digit + aa % 10;

			aa /= 10;

		}

		

		if (digit >= A && digit <= B) {

			ans += i;

		}

//		if (i == 10 || i == 100 || i == 1000 || i == 10000) {

//			if (1 >= A && 1 <= B) {

//				ans += i;	

//			}

//		} else if (i < 10) {

//			if (i >= A && i <= B) {

//				ans += i;

//				}

//		} else if (i > 10 && i < 100) {

//			int Bb = i / 10;

//			int Bbb = i - (Bb*10);

//			int B1 = Bb + Bbb;

//			if (B1 >= A && B1 <= B) {

//				ans += i;

//			}	

//		} else if (i > 100 && i < 1000) {

//			int Cc = i / 100;

//			int Ccc = (i - (Cc*100)) / 10;

//			int Cccc = i - (Cc * 100) - (Ccc * 10);

//			int C1 = Cc + Ccc + Cccc;

//			if (C1 >= A && C1 <= B) {

//				ans += i;

//			}	

//		} else if (i > 1000 && i < 10000) {

//			int D = i / 1000;

//			int Dd = (i - (D*100)) / 100;

//			int Ddd = (i - (D * 1000) - (Dd * 100) / 10);

//			int Dddd = i - (D * 1000) - (Dd * 100) - (Ddd * 10);

//			int D1 = D + Dd + Ddd + Dddd;

//			if (D1 >= A && D1 <= B) {

//				ans += i;

//			}

//		}

	}

	printf ("%d", ans);

	return 0;

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

using namespace std;

#define AC ios_base::sync_with_stdio(0),cin.tie(0);

int main(void)

{

	AC;

	int T,a,n,i,b,k,t,sum=0;

	cin>>n>>a>>b;

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

		k=i;

		t=0;

		while(k!=0){

			t+=k%10;

			k/=10;

		}

		if(t>=a && b>=t) sum+=i;

	}

	cout<<sum<<"\n";

}




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



int main () {

	int ans = 0;

	int N, A, B;

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

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

		int digit = 0;

		int aa = i;

		while (aa != 0) {

			digit = digit + aa % 10;

			aa /= 10;

		}

		

		if (digit >= A && digit <= B) {

			ans += i;

		}

//		if (i == 10 || i == 100 || i == 1000 || i == 10000) {

//			if (1 >= A && 1 <= B) {

//				ans += i;	

//			}

//		} else if (i < 10) {

//			if (i >= A && i <= B) {

//				ans += i;

//				}

//		} else if (i > 10 && i < 100) {

//			int Bb = i / 10;

//			int Bbb = i - (Bb*10);

//			int B1 = Bb + Bbb;

//			if (B1 >= A && B1 <= B) {

//				ans += i;

//			}	

//		} else if (i > 100 && i < 1000) {

//			int Cc = i / 100;

//			int Ccc = (i - (Cc*100)) / 10;

//			int Cccc = i - (Cc * 100) - (Ccc * 10);

//			int C1 = Cc + Ccc + Cccc;

//			if (C1 >= A && C1 <= B) {

//				ans += i;

//			}	

//		} else if (i > 1000 && i < 10000) {

//			int D = i / 1000;

//			int Dd = (i - (D*100)) / 100;

//			int Ddd = (i - (D * 1000) - (Dd * 100) / 10);

//			int Dddd = i - (D * 1000) - (Dd * 100) - (Ddd * 10);

//			int D1 = D + Dd + Ddd + Dddd;

//			if (D1 >= A && D1 <= B) {

//				ans += i;

//			}

//		}

	}

	printf ("%d", ans);

	return 0;

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

using namespace std;



int sums(int n){

    int re=0;

    while(n>9){

        re+=n%10;

        n/=10;

    }

    re+=n;

    return re;

}



int main(){

    int n,a,b;

    cin>>n>>a>>b;

    int sum=0;

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

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

            sum+=i;

        }

    }

    cout<<sum;

    return 0;

}

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



int main () {

	int ans = 0;

	int N, A, B;

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

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

		int digit = 0;

		int aa = i;

		while (aa != 0) {

			digit = digit + aa % 10;

			aa /= 10;

		}

		

		if (digit >= A && digit <= B) {

			ans += i;

		}

//		if (i == 10 || i == 100 || i == 1000 || i == 10000) {

//			if (1 >= A && 1 <= B) {

//				ans += i;	

//			}

//		} else if (i < 10) {

//			if (i >= A && i <= B) {

//				ans += i;

//				}

//		} else if (i > 10 && i < 100) {

//			int Bb = i / 10;

//			int Bbb = i - (Bb*10);

//			int B1 = Bb + Bbb;

//			if (B1 >= A && B1 <= B) {

//				ans += i;

//			}	

//		} else if (i > 100 && i < 1000) {

//			int Cc = i / 100;

//			int Ccc = (i - (Cc*100)) / 10;

//			int Cccc = i - (Cc * 100) - (Ccc * 10);

//			int C1 = Cc + Ccc + Cccc;

//			if (C1 >= A && C1 <= B) {

//				ans += i;

//			}	

//		} else if (i > 1000 && i < 10000) {

//			int D = i / 1000;

//			int Dd = (i - (D*100)) / 100;

//			int Ddd = (i - (D * 1000) - (Dd * 100) / 10);

//			int Dddd = i - (D * 1000) - (Dd * 100) - (Ddd * 10);

//			int D1 = D + Dd + Ddd + Dddd;

//			if (D1 >= A && D1 <= B) {

//				ans += i;

//			}

//		}

	}

	printf ("%d", ans);

	return 0;

}