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.2041963800546345x):
#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);

 

}
// 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.30640694765046x):
#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);

 

}
// 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.290171529456349x):
#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);

 

}
// 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.207916465573914x):
#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);

 

}
// 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.207822359096057x):
#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);

 

}
// 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.2607521867179985x):
#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);

 

}
// 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.230062039625291x):
#include <stdio.h>

 

int main () {

	int n, a, b, num1, num2, num3, num4, num5;

	int sum = 0;

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

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

		num1 = i % 10;

		num2 = (i / 10) % 10;

		num3 = (i / 100) % 10;

		num4 = (i / 1000) % 10;

		num5 = (i / 10000) % 10;

		if ((num1+num2+num3+num4+num5) >= a && (num1+num2+num3+num4+num5) <= 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.184558033160505x):
#include <stdio.h>

 

int main () {

	int n, a, b, num1, num2, num3, num4, num5;

	int sum = 0;

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

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

		num1 = i % 10;

		num2 = (i / 10) % 10;

		num3 = (i / 100) % 10;

		num4 = (i / 1000) % 10;

		num5 = (i / 10000) % 10;

		if ((num1+num2+num3+num4+num5) >= a && (num1+num2+num3+num4+num5) <= 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.286382903054686x):
#include <stdio.h>

 

int main () {

	int n, a, b, num1, num2, num3, num4, num5;

	int sum = 0;

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

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

		num1 = i % 10;

		num2 = (i / 10) % 10;

		num3 = (i / 100) % 10;

		num4 = (i / 1000) % 10;

		num5 = (i / 10000) % 10;

		if ((num1+num2+num3+num4+num5) >= a && (num1+num2+num3+num4+num5) <= 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.270208750184015x):
#include <stdio.h>

 

int main () {

	int n, a, b, num1, num2, num3, num4, num5;

	int sum = 0;

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

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

		num1 = i % 10;

		num2 = (i / 10) % 10;

		num3 = (i / 100) % 10;

		num4 = (i / 1000) % 10;

		num5 = (i / 10000) % 10;

		if ((num1+num2+num3+num4+num5) >= a && (num1+num2+num3+num4+num5) <= 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.1882640807141565x):
#include <stdio.h>

 

int main () {

	int n, a, b, num1, num2, num3, num4, num5;

	int sum = 0;

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

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

		num1 = i % 10;

		num2 = (i / 10) % 10;

		num3 = (i / 100) % 10;

		num4 = (i / 1000) % 10;

		num5 = (i / 10000) % 10;

		if ((num1+num2+num3+num4+num5) >= a && (num1+num2+num3+num4+num5) <= 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.188170329352733x):
#include <stdio.h>

 

int main () {

	int n, a, b, num1, num2, num3, num4, num5;

	int sum = 0;

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

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

		num1 = i % 10;

		num2 = (i / 10) % 10;

		num3 = (i / 100) % 10;

		num4 = (i / 1000) % 10;

		num5 = (i / 10000) % 10;

		if ((num1+num2+num3+num4+num5) >= a && (num1+num2+num3+num4+num5) <= 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.240900423098399x):
#include <stdio.h>

 

int main () {

	int n, a, b, num1, num2, num3, num4, num5;

	int sum = 0;

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

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

		num1 = i % 10;

		num2 = (i / 10) % 10;

		num3 = (i / 100) % 10;

		num4 = (i / 1000) % 10;

		num5 = (i / 10000) % 10;

		if ((num1+num2+num3+num4+num5) >= a && (num1+num2+num3+num4+num5) <= 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.277225599239065x):
#include <stdio.h>



int main (){

	int n, a, b;

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

	int sum = 0;

	

	// cth

	// i == 123

	// memecah ambil tiap digit jd 3 + 2 + 1 = 6;

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

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

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

	

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

		int digitSum = 0;

		int temp = i; // i ditampung ke temp biar ga infinite loop

		while (temp != 0){

			digitSum = digitSum + temp % 10;

			temp /= 10;

		}

		// temp = 0; makanya jadi sum += i;

		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.231311247561296x):
#include <stdio.h>



int main (){

	int n, a, b;

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

	int sum = 0;

	

	// cth

	// i == 123

	// memecah ambil tiap digit jd 3 + 2 + 1 = 6;

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

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

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

	

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

		int digitSum = 0;

		int temp = i; // i ditampung ke temp biar ga infinite loop

		while (temp != 0){

			digitSum = digitSum + temp % 10;

			temp /= 10;

		}

		// temp = 0; makanya jadi sum += i;

		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;

	

	// cth

	// i == 123

	// memecah ambil tiap digit jd 3 + 2 + 1 = 6;

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

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

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

	

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

		int digitSum = 0;

		int temp = i; // i ditampung ke temp biar ga infinite loop

		while (temp != 0){

			digitSum = digitSum + temp % 10;

			temp /= 10;

		}

		// temp = 0; makanya jadi sum += i;

		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;

	

	// cth

	// i == 123

	// memecah ambil tiap digit jd 3 + 2 + 1 = 6;

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

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

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

	

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

		int digitSum = 0;

		int temp = i; // i ditampung ke temp biar ga infinite loop

		while (temp != 0){

			digitSum = digitSum + temp % 10;

			temp /= 10;

		}

		// temp = 0; makanya jadi sum += i;

		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;

	

	// cth

	// i == 123

	// memecah ambil tiap digit jd 3 + 2 + 1 = 6;

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

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

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

	

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

		int digitSum = 0;

		int temp = i; // i ditampung ke temp biar ga infinite loop

		while (temp != 0){

			digitSum = digitSum + temp % 10;

			temp /= 10;

		}

		// temp = 0; makanya jadi sum += i;

		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;

	

	// cth

	// i == 123

	// memecah ambil tiap digit jd 3 + 2 + 1 = 6;

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

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

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

	

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

		int digitSum = 0;

		int temp = i; // i ditampung ke temp biar ga infinite loop

		while (temp != 0){

			digitSum = digitSum + temp % 10;

			temp /= 10;

		}

		// temp = 0; makanya jadi sum += i;

		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;

	

	// cth

	// i == 123

	// memecah ambil tiap digit jd 3 + 2 + 1 = 6;

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

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

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

	

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

		int digitSum = 0;

		int temp = i; // i ditampung ke temp biar ga infinite loop

		while (temp != 0){

			digitSum = digitSum + temp % 10;

			temp /= 10;

		}

		// temp = 0; makanya jadi sum += i;

		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.277225599239065x):
#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;

}