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,A,B;

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

    

    int count = 0;

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

        int num = i;

        int sum = 0;

        while(num != 0){

            sum += num % 10;

            num /= 10;

        }

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

            count+= i;

        }

    }

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

    

    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,A,B;

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

    

    int count = 0;

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

        int num = i;

        int sum = 0;

        while(num != 0){

            sum += num % 10;

            num /= 10;

        }

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

            count+= i;

        }

    }

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

    

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

int main(){

    int N,A,B, i, temp, t, remainder, sum, total = 0;

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



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

        t = i;

        sum  = 0;

        while (t != 0){

              remainder = t % 10;

              sum += remainder;

              t /= 10;

           }



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

               total += i;

        }

    }



    printf("%d", total);



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

int main(){

    int N,A,B, i, temp, t, remainder, sum, total = 0;

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



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

        t = i;

        sum  = 0;

        while (t != 0){

              remainder = t % 10;

              sum += remainder;

              t /= 10;

           }



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

               total += i;

        }

    }



    printf("%d", total);



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

int main(){

    int N,A,B, i, temp, t, remainder, sum, total = 0;

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



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

        t = i;

        sum  = 0;

        while (t != 0){

              remainder = t % 10;

              sum += remainder;

              t /= 10;

           }



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

               total += i;

        }

    }



    printf("%d", total);



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

int main(){

    int N,A,B, i, temp, t, remainder, sum, total = 0;

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



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

        t = i;

        sum  = 0;

        while (t != 0){

              remainder = t % 10;

              sum += remainder;

              t /= 10;

           }



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

               total += i;

        }

    }



    printf("%d", total);



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



int main(){

	int N, A, B;

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

	int ans = 0;

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

		int temp = i;

		int total = 0;

		

		while(temp > 0){

			total += temp % 10;

			temp /= 10;

		}

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

			ans += i;

		}

	}

	printf("%d\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.297890408563685x):
#include <stdio.h>



int main(){

	int N, A, B;

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

	int ans = 0;

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

		int temp = i;

		int total = 0;

		

		while(temp > 0){

			total += temp % 10;

			temp /= 10;

		}

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

			ans += i;

		}

	}

	printf("%d\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.298771370874699x):
#include <stdio.h>



int main(){

	int N, A, B;

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

	int ans = 0;

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

		int temp = i;

		int total = 0;

		

		while(temp > 0){

			total += temp % 10;

			temp /= 10;

		}

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

			ans += i;

		}

	}

	printf("%d\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.2271735052032495x):
#include <stdio.h>



int main(){

	int N, A, B;

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

	int ans = 0;

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

		int temp = i;

		int total = 0;

		

		while(temp > 0){

			total += temp % 10;

			temp /= 10;

		}

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

			ans += i;

		}

	}

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

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

//#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.310254646947035x):
#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 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:
/*

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

      |                     |  /

      |                     | /

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

      |                     |           |    |        /      \

      |             |       |\          |    |       |       |\          |

   \  |             |       | \         |    |       |       | \         |

    \ |             |       |  \        |    |        \     /   \        |

     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, 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, 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.240037266394949x):
#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>

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

}