criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<iostream>
using namespace std;

int SumOfDigits(int n){
  int sum = 0;
  while(n>0){
    sum+= n % 10;
    n /= 10;
  }
  return sum;
}

int main(){
  int N,A,B;
  cin >> N>>A>>B;
  int total=0;
  for(int i =1;i<=N;i++){
    int sum = SumOfDigits(i);
    if(A<=sum &&sum<=B)total+=i;
  }
  count<<sum<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:3: error: 'count' was not declared in this scope
   21 |   count<<sum<<endl;
      |   ^~~~~
a.cc:21:10: error: 'sum' was not declared in this scope
   21 |   count<<sum<<endl;
      |          ^~~
Language: C++

#include<iostream>

using namespace std;

int func(int n)
{
  int sum = 0;
  while(n > 0){
    sum += n%10;
    n = n/10;
  }
  return sum;
}

int main(){

  int N,A,B;
  int counter = 0;
  cin >> N >> A >> B;
  for(int i=1;i<=N;i++)
  {
    if(func(n) >= A && func(n)<= B)
    {
      counter++;
    }
  }

  cout << counter << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:13: error: 'n' was not declared in this scope
   22 |     if(func(n) >= A && func(n)<= B)
      |             ^
Language: C++

#include<iostream>
#include<functional>
#include<algorithm>
using namespace std;
int sum(int x){
int a=0;
while(x>0){
  a+= x%10;
  x=x/10;
}
return a;
}

int main(){
  int n,c,d,count=0;
  cin>>n>>c>>d;
  for(int i=1;i<n+1;i++){
    int total=sum(i);
    if(total>=c and total<=d){
      total++;
    }
  }
  cout<<int total<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: expected primary-expression before 'int'
   23 |   cout<<int total<<endl;
      |         ^~~
Language: C++

#include<iostream>
#include<functional>
#include<algorithm>
using namespace std;
int sum(int x){
int a=0;
while(x>0){
  a+= x%10;
  x=x/10;
}
return a;
}

int main(){
  int n,c,d,count=0;
  cin>>n>>c>>d;
  for(int i=1;i<n+1;i++){
    int total=sum(i);
    if(total>=c and total<=d){
      total++;
    }
  }
  cout<<total<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: 'total' was not declared in this scope
   23 |   cout<<total<<endl;
      |         ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  
  int sum = 0;
  
  for(int num=1; num<=N; num++){
    while(true){
      int sho, amari;
      sho = num / 10;
      amari = num % 10;
      sum += amari;
      if(sho==0) break;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:2: error: expected '}' at end of input
   18 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++


#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	int N,A,B;
	cin>>N>>A>>B;
	int ans=0;
	fyg(N+1,1){
		int C=y;int n=0;
		while(C>0){
			n+=C%10;
			C/=10;
		}
		if(n>=A&&n<=B){ams+=y;}
	}
	ce(ans)
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:32: error: 'ams' was not declared in this scope; did you mean 'ans'?
   49 |                 if(n>=A&&n<=B){ams+=y;}
      |                                ^~~
      |                                ans
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int fcn(int n){
  int sum =0;
  while(n > 0){
    sum += n/ 10;
    n /=10;}
  return sum;}

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int d=0;
  for(int i=1; i <= N;i++){
    if (fcn(i) >= A && fcn(i) <= B){
      d += i}
  }
  cout << d << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: expected ';' before '}' token
   17 |       d += i}
      |             ^
      |             ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
  cin >> N;
  int A, B;
  cin >> A >> B;
  int sum =0;
  for(int i =0;i < N;i++){
    string s = str(i);
    int d=0;
    for(int j=0;j < s.size();j++){
      d += s(j);}
    if(A <= d <= B){
      sum += i;}
  }
   cout << sum << endl; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: 'str' was not declared in this scope; did you mean 'std'?
   11 |     string s = str(i);
      |                ^~~
      |                std
a.cc:14:13: error: no match for call to '(std::string {aka std::__cxx11::basic_string<char>}) (int&)'
   14 |       d += s(j);}
      |            ~^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int findsum(int m){
	int sum = 0;
	while(m>0){
		sum += n%10;
		sum /= 10;
	}
	return sum;
}

int main(){
	int n,a,b,l;
	cin >> n >> a >> b;
	int count = 0;

	for(int i=1;i<=n;i++){
		l = findsum(i);
		if(i>=a || i<=b) count += l;
	}
	cout << count << endl;
}

Compiler output:
a.cc: In function 'int findsum(int)':
a.cc:8:24: error: 'n' was not declared in this scope
    8 |                 sum += n%10;
      |                        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int findSumOfDigits(int n){
  int sum = 0;
  while (n > 0){
    sum += n % 10;
    n /= 10;
  }



int main(){
  int N, A, B;
  cin >> N >> A >> B;
  int counts, sum, one, ten, hund, thou, tenth;
  counts = 0;

  for (int i = 1; i <= N; i++){
    //one = i % 10;
    //ten = (i % 100 - one) / 10;
    //hund = ( i % 1000 - i % 100) / 100;
    //tenth = i / 10000;
    //thou = i / 1000 - tenth * 10;
    //sum = one + ten + hund + tenth + thou;
    sum = findSumOfDigits(i);
    if (sum >= A && sum <= B)
      counts += i;
  }
  cout << counts << endl;
}

Compiler output:
a.cc: In function 'int findSumOfDigits(int)':
a.cc:13:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   13 | int main(){
      |         ^~
a.cc:13:9: note: remove parentheses to default-initialize a variable
   13 | int main(){
      |         ^~
      |         --
a.cc:13:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:13:11: error: a function-definition is not allowed here before '{' token
   13 | int main(){
      |           ^
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:4:27: note: to match this '{'
    4 | int findSumOfDigits(int n){
      |                           ^
a.cc:31:2: warning: no return statement in function returning non-void [-Wreturn-type]
   31 | }
      |  ^
Language: Java

import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    int count = 0;
    int total = 0;
    
    for(int i = 1; i <= N; i++){
      int n=i;
      count = 0;
      while(int n>0){
        count += n % 10;
        n = n / 10;
      }
      if(A<=count && count<=B){
        total += i;
      }
 
    }
    System.out.println(total);
  }
}

Compiler output:
Main.java:16: error: '.class' expected
      while(int n>0){
                ^
Main.java:16: error: not a statement
      while(int n>0){
                 ^
Main.java:16: error: ';' expected
      while(int n>0){
                   ^
3 errors
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    int count = 0;
    int total = 0;
    
    for(i = 0; i <= N; i++){
      count += i % 10;
      N = N / 10;
      if (N == 0){
        if(A<=count && count<=B){
          total += i;
        }
      }
    }
    System.out.println(total);
  }
}

       
      

Compiler output:
Main.java:13: error: cannot find symbol
    for(i = 0; i <= N; i++){
        ^
  symbol:   variable i
  location: class Main
Main.java:13: error: cannot find symbol
    for(i = 0; i <= N; i++){
               ^
  symbol:   variable i
  location: class Main
Main.java:13: error: cannot find symbol
    for(i = 0; i <= N; i++){
                       ^
  symbol:   variable i
  location: class Main
Main.java:14: error: cannot find symbol
      count += i % 10;
               ^
  symbol:   variable i
  location: class Main
Main.java:18: error: cannot find symbol
          total += i;
                   ^
  symbol:   variable i
  location: class Main
5 errors
Language: Java

import java.util.*;

public class Main{
  public static void main(string[] args){
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    int count = 0;
    int total = 0;
    
    for(i = 0; i <= N; i++){
      count += i % 10;
      N = N / 10;
      if (N == 0){
        if(A<=count && count<=B){
          total += i;
        }
      }
    }
    System.out.println(total);
  }
}

       
      

Compiler output:
Main.java:4: error: cannot find symbol
  public static void main(string[] args){
                          ^
  symbol:   class string
  location: class Main
Main.java:13: error: cannot find symbol
    for(i = 0; i <= N; i++){
        ^
  symbol:   variable i
  location: class Main
Main.java:13: error: cannot find symbol
    for(i = 0; i <= N; i++){
               ^
  symbol:   variable i
  location: class Main
Main.java:13: error: cannot find symbol
    for(i = 0; i <= N; i++){
                       ^
  symbol:   variable i
  location: class Main
Main.java:14: error: cannot find symbol
      count += i % 10;
               ^
  symbol:   variable i
  location: class Main
Main.java:18: error: cannot find symbol
          total += i;
                   ^
  symbol:   variable i
  location: class Main
6 errors
Language: Java

import java.util.*;

public class Main{
  public static void main(string[] args){
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    int count = 0;
    int total = 0;
    
    for(i = 0; i <= N i++){
      count += i % 10;
      N = N / 10;
      if (N == 0){
        if(A<=count && count<=B){
          total += i;
        }
      }
    }
    System.out.println(total);
  }
}

       
      

Compiler output:
Main.java:13: error: ';' expected
    for(i = 0; i <= N i++){
                     ^
1 error
Language: C++

#include<iostream>
using namespace std;

int main(){
  int n,a,b;cin>>n>>a>>b;
  int e=0;
  for(int i=0;i<=n;i++){
    int c,t=i;
    for(int j=0;j<5;j++)c+=i%10;t/=10;
    if(c>=a&&c<=b)e+=i;
  }
  cout<<e<<endl;
  return 0;
}
#include<iostream>
using namespace std;

int main(){
  int n,a,b;cin>>n>>a>>b;
  int e=0;
  for(int i=0;i<=n;i++){
    int c,t=i;
    for(int j=0;j<5;j++)c+=i%10;t/=10;
    if(c>=a&&c<=b)e+=i;
  }
  cout<<e<<endl;
  return 0;
}


Compiler output:
a.cc:18:5: error: redefinition of 'int main()'
   18 | int main(){
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main(){
      |     ^~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
  int n,a,b;cin>>n>>a>>b;
  int e=0;
  for(int i=0;i<=n;i++){
    int c,t=i;
    for(int j=0;j<5;j++)c+=i%10;t/=10;
    if(tmp>=a&&tmp<=b)e+=i;
  }
  cout<<e<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:8: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   10 |     if(tmp>=a&&tmp<=b)e+=i;
      |        ^~~
      |        tm
Language: C++

#include <iostream>
using namespace std;

int main(){
  int n, a, b, sum, ans = 0;
  
  cin >> n >> a >> b;
  
  for ( int i = 1; i <= n; i++ ){
    sum = 0,
    while ( i % 10 != 0 ){
      sum += i % 10;
      i /= 10;
    }
    
    if ( a <= sum && sum <= b ){
      ans++;
    }
  }
  
  cout << ans << endl;
}
 

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: expected primary-expression before 'while'
   11 |     while ( i % 10 != 0 ){
      |     ^~~~~
Language: C

#include<stdio.h>

int main(){
int n,i,r,l;long ans=0;
scanf("%d%d%d",&n,&l,&r);
for(i=1;i<=n;i++){
int ketawa=0a=i;
while(a>0){
ketawa+=a%10;
a=(a-a%10)/10;
}
if(ketawa>=l&&ketawa<=r)ans+=i;
}
printf("%ld\n",ans);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:12: error: invalid suffix "a" on integer constant
    7 | int ketawa=0a=i;
      |            ^~
main.c:8:7: error: 'a' undeclared (first use in this function)
    8 | while(a>0){
      |       ^
main.c:8:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N,A,B,ans=0;

int wa(int x){
    int temp=0;
    for(int i=10;i<=1e6;i*=10){
        temp+=x%i;
    }
    return temp;
}

int main(){
    cin>>N>>A>>B;
    repi(i,1,N){
        if(A<=wa(i)&&wa(i)<=B){
            ans+=i;
        }
    }
    out(i);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:9: error: 'i' was not declared in this scope
   38 |     out(i);
      |         ^
a.cc:16:26: note: in definition of macro 'out'
   16 | #define out(str) cout << str << endl
      |                          ^~~
Language: C++

int main(){
    int N,A,B;
    cin>>N>>A>>B;
    int num=0;
    for (int i=1; i<N; i++) {
        int c=0;
        while (i>0) {
            c=+i%10;
            i=i/10;
        }
        if (B>=c>=A) {
            num++;
        }
    }
    
    cout<<num;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin>>N>>A>>B;
      |     ^~~
a.cc:16:5: error: 'cout' was not declared in this scope
   16 |     cout<<num;
      |     ^~~~
Language: C++

#include <iostream>
using namespace std;

int findSumOfDigits(int n); {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int total = 0;
  for (int i = 1; i <= N; ++i) {
    int sum = findSumOfDigits(i);
    if (sum >= A && sum <= B) {
      total += i;
    }
  }
  cout << total << endl;
}
  

Compiler output:
a.cc:4:29: error: expected unqualified-id before '{' token
    4 | int findSumOfDigits(int n); {
      |                             ^
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int n = getInputInteger(sc);
		int a = getInputInteger(sc);
		int b = getInputInteger(sc);
 
        // programming
        int sum = 0;
        for (int i = 0; i < n; i+;) {
            String bin = Integer.toBinaryString(i);
            int[] binlist = toIntegerList(bin);
            int dsum = 0;
            for (int v : binlist) {
                dsum += v;
            }
            if (a <= dsum && dsum <= b) {
                sum += i;
            }
        }
	}

	public static String getInputString(Scanner sc) {
		return sc.next();
	}

	public static int getInputInteger(Scanner sc) {
		return Integer.parseInt(sc.next());
	}

	public static void output(String... params) {
		boolean isInit = true;
		String str = "";
		for (String s : params) {
			if (!isInit) {
				str += " ";
			}
			str += s;
			isInit = false;
		}
		System.out.println(str);
	}

    public static int[] toIntegerList(String s) {
        int[] ret = new int[s.length()];
        for (int i = 0; i < s.length(); i++) {
            ret[i] = Integer.parseInt(String.valueOf(s.charAt(i)));
        }
        return ret;
    }
}

Compiler output:
Main.java:11: error: illegal start of expression
        for (int i = 0; i < n; i+;) {
                                 ^
Main.java:11: error: not a statement
        for (int i = 0; i < n; i+;) {
                                ^
Main.java:11: error: illegal start of expression
        for (int i = 0; i < n; i+;) {
                                  ^
3 errors
Language: Java

n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
  if a <= sum(list(map(int, list(str(i))))) <= b:
    ans += i
print(ans)

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
n, a, b = map(int, input().split())
^
1 error
Language: C++

// AtCoderC++.cpp : アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

//AtCoderC++.cpp

using namespace std;

void Show(vector<vector<int>> Ns) {
	for (int i = 0; i < Ns.size(); i++) {
		for (int j = 0; j < Ns[i].size(); j++) {
			if (j == Ns[i].size() - 1) {
				cout << Ns[i][j] << endl;
			} else {
				cout << Ns[i][j] << ",";
			}			
		}
	}
}

void Show(vector<int> N) {
	for (int i = 0; i < N.size(); i++) {
		cout << N[i];
		if (i != N.size() - 1) {
			cout << " ";
		} else {
			cout << endl;
		}
	}
}


int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int Answer = 0;
	int sum;
	for (int i = 1; i < N; i++) {
		sum = 0;
		int remain = i;
		for (int j = 0; j < 5; i++) {
			sum += remain / (int)pow(10, 4 - j);
			remain %= (int)pow(10, 4 - j);
		}
		if (A <= sum && sum <= B)Answer += i;
	}
}

Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
using namespace std;

int findSumOfDigits(int n) {
	int sum = 0;
	while (n > 0) {
		sum += n % 10;
		n / 10;
	}
	return sum;
}

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int ans=0;

	for (int i = 0; i < N; i++) {
		int sum = findSumDigits(i);
		if (sum >= A && sum <= B) {
			ans += i;
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:27: error: 'findSumDigits' was not declared in this scope; did you mean 'findSumOfDigits'?
   19 |                 int sum = findSumDigits(i);
      |                           ^~~~~~~~~~~~~
      |                           findSumOfDigits
Language: C++

#include<iostream>
using namespace std;

int findSumOfDigits(int n) {
	int sum=0
	while (n > 0) {
		sum += n % 10;
		n / 10;
	}
	return sum;
}

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int ans=0;

	for (int i = 0; i < N; i++) {
		if (findSumDigits(i) >= A && findSumDigits(i) <= B) {
			ans += i;
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int findSumOfDigits(int)':
a.cc:6:9: error: expected ',' or ';' before 'while'
    6 |         while (n > 0) {
      |         ^~~~~
a.cc: In function 'int main()':
a.cc:19:21: error: 'findSumDigits' was not declared in this scope; did you mean 'findSumOfDigits'?
   19 |                 if (findSumDigits(i) >= A && findSumDigits(i) <= B) {
      |                     ^~~~~~~~~~~~~
      |                     findSumOfDigits
Language: C++

#include <bits/stdc++.h>
using namespace std;
int ketawa(int N){
  wa =0;
  while(N != 0){
    wa = wa+N%10;
    N /= 10;
  }
  return wa;
}

int main(){
  int a,b,n;
  cin >>a>>b>>n;
  int ans=0;
  for(int i=1;i<=n;i++){
    int k = ketawa(i);
    if(k >= a && k <= b) ans++;
  }
  cout << ans << endl;
}
    

Compiler output:
a.cc: In function 'int ketawa(int)':
a.cc:4:3: error: 'wa' was not declared in this scope
    4 |   wa =0;
      |   ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int ketawa(int N){
  wa =0;
  while(N != 0){
    wa = wa+N%10;
    N /= 10;
  }
  return wa;
}

int main(){
  int a,b,n;
  cin >>a>>b>>n;
  int ans=0;
  for(int i=1;i<=n;i++){
    int k = wa(i);
    if(k >= a && k <= b) ans++;
  }
  cout << ans << endl;
}
    

Compiler output:
a.cc: In function 'int ketawa(int)':
a.cc:4:3: error: 'wa' was not declared in this scope
    4 |   wa =0;
      |   ^~
a.cc: In function 'int main()':
a.cc:17:13: error: 'wa' was not declared in this scope; did you mean 'a'?
   17 |     int k = wa(i);
      |             ^~
      |             a
Language: C++

#include <iostream>
#include <string>
using namespace std;

int sum(int n){
  int sum=0;
  while (n>0){
    sum+=n%10;
    n/=10;
  }
  return sum;
}

int main() {
    int N,A,B;
    cin >> N >> A >> B;
    int total=0;

    for (int i=1;i<N+1;++i){
      int sum=sum(i);
      if (A<= sum && sum <=B) total+=i;
    }
    
    cout<<total<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:18: error: 'sum' cannot be used as a function
   20 |       int sum=sum(i);
      |               ~~~^~~
Language: C++

#include <iostream>
#include <string>
using namespace std;

int sum(int n){
  int sum=0;
  while (n>0){
    sum+=n%10;
    n/=10;
  }
  return sum;
}

int main() {
    int N,A,B;
    cin >> N >> A >> B;
    int total=0;

    for (int i=1;i<N+1;++i){
      int sum(i)
      if (A<= sum && sum <=B) total+=i;
    }
    
    cout<<total<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:7: error: expected ',' or ';' before 'if'
   21 |       if (A<= sum && sum <=B) total+=i;
      |       ^~
Language: C++

#include <iostream>
#include <string>
using namespace std;

int sum(int n){
  while (n>0){
    sum+=n%10;
    n/=10;
  }
  return sum;
}

int main() {
    int N,A,B;
    cin >> N >> A >> B;
    int total=0;

    for (int i=1;i<N+1;++i){
      int sum(i)
      if (A<= sum && sum <=B) total+=i;
    }
    
    cout<<total<<endl;
}

Compiler output:
a.cc: In function 'int sum(int)':
a.cc:7:8: warning: pointer to a function used in arithmetic [-Wpointer-arith]
    7 |     sum+=n%10;
      |     ~~~^~~~~~
a.cc:7:8: error: assignment of read-only location 'sum'
a.cc:10:10: error: invalid conversion from 'int (*)(int)' to 'int' [-fpermissive]
   10 |   return sum;
      |          ^~~
      |          |
      |          int (*)(int)
a.cc: In function 'int main()':
a.cc:20:7: error: expected ',' or ';' before 'if'
   20 |       if (A<= sum && sum <=B) total+=i;
      |       ^~
Language: C++

#include <iostream>
#include <string>
using namespace std;

int N,A,B;

int main() {
    cin >> N >> A >> B;
    int count=0;

    for (i=1;i<N+1;++i){
      int sum=0;
      while(i>0){
        sum +=i%10;
        i/=10;
      }
      if (A<= sum & sum <=B) count+=i;
    }
    
    cout<<count<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: 'i' was not declared in this scope
   11 |     for (i=1;i<N+1;++i){
      |          ^
Language: C++

#include <iostream>
#include <string>
using namespace std;

int N,A,B;

int main() {
    cin >> N >> A >> B;
    int count=0;

    for (i=1;i<N+1;++i){
      sum=0;
      while(i>0){
        sum +=i%10;
        i/=10;
      }
      if (A<= sum & sum <=B) count+=i;
    }
    
    cout<<count<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: 'i' was not declared in this scope
   11 |     for (i=1;i<N+1;++i){
      |          ^
a.cc:12:7: error: 'sum' was not declared in this scope
   12 |       sum=0;
      |       ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;#include <iostream>
using namespace std; //头文件和命名空间
inline bool IsAddable(int iNum, int iLBound, int iUBound){ //判断是否满足要求的函数，iNum-判断的数字；iLBound-各位和下界；iUBound-各位和的上界
    int iSum = 0; //各位和
    while (iNum){ //求各位和
        iSum += iNum % 10; //加上最后一位
        iNum /= 10; //消去最后一位
    }
    return (iLBound <= iSum && iSum <= iUBound); //判断
}
int main(){
    ios::sync_with_stdio(false); //输入输出加速
    int iEnd, iLB, iUB; //区间结尾以及各位数字之和的上下界
    cin >> iEnd >> iLB >> iUB; //读入限制条件
    register int i; //循环变量
    register long long iSum = 0; //累加器
    for (i = 1; i <= iEnd; ++i){ //枚举
        if (IsAddable(i, iLB, iUB))
            iSum += i; //若满足则累加
    }
    cout << iSum << endl; 
    return 0; 
}
int main()
{
    int num=0,n,a,b,k;
    long long sum;
    cin>>n>>a>>b;
    for(int i=1;i<=n;i++)
	{
        k=i;
        while(k!=0)
		{
            num+=k%10;
            k/10;
        }
        if(num>=a&&num<=b)sum+=num;
        num=0;
    }
    cout<<sum<<endl;
    return 0;
}

Compiler output:
a.cc:2:21: error: stray '#' in program
    2 | using namespace std;#include <iostream>
      |                     ^
a.cc:2:22: error: 'include' does not name a type
    2 | using namespace std;#include <iostream>
      |                      ^~~~~~~
a.cc: In function 'int main()':
a.cc:16:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   16 |     register int i; //循环变量
      |                  ^
a.cc:17:24: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 |     register long long iSum = 0; //累加器
      |                        ^~~~
a.cc: At global scope:
a.cc:25:5: error: redefinition of 'int main()'
   25 | int main()
      |     ^~~~
a.cc:12:5: note: 'int main()' previously defined here
   12 | int main(){
      |     ^~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;

int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(){
    int A, B, C, X;
    cin >> N >> A >> B;
    int total = 0;
    for(int i = 1; i <= N; i++){
        int sum = findSumOfDigits(i);
        if(sum >= A && sum <= B){
            total += i;
        }
    }
    cout << total << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: 'N' was not declared in this scope
   16 |     cin >> N >> A >> B;
      |            ^
Language: C++

#include<iostream>
using namespace std;

int main()
{
	int a, b, n, i, nout, faa;
	cin >> n, a, b;
	nout = 0;
	for (i = 0; i < n+1; i++) {
		faa = n % 10 + (n / 10) % 10 + (n / 100) % 10 + (n / 1000) % 10 + (n / 10000) % 10;
		if (faa >= a && faa <= b) nout += n;
	}
	cout << ncount;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: 'ncount' was not declared in this scope; did you mean 'nout'?
   13 |         cout << ncount;
      |                 ^~~~~~
      |                 nout
Language: C

#include<iostream> 
#include<cstdio>
#include<cstring>
#include<algorithm>
#define sc scanf
using namespace std;
int n,e,b,ans;
inline bool judge(int p){
	int w=0;
	do{
		w+=p%10;
		p/=10;
	}while(p);
	return (w>=b&&w<=e);
}
int main(){
	sc("%d%d%d",&n,&b,&e);
	for(int i=1;i<=n;i++)if(judge(i))ans+=i;
	cout<<ans<<'\n';
	return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<iostream> 
#include<cstdio>
#include<cstring>
#include<algorithm>
#define sc scanf
using namespace std;
int n,e,b,ans;
inline judge(int p){
	int w=0;
	do{
		w+=p%10;
		p/=10;
	}while(p);
	return (w>=b&&w<=e);
}
int main(){
	sc("%d%d%d",&n,&b,&e);
	for(int i=1;i<=n;i++)if(judge(i))ans+=i;
	cout<<ans<<'\n';
	return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream> 
#include<cstdio>
#include<cstring>
#include<algorithm>
#define sc scanf
using namespace std;
int n,e,b,ans;
inline judge(int p){
	int w=0;
	do{
		w+=p%10;
		p/=10;
	}while(p);
	return (w>=b&&w<=e);
}
int main(){
	sc("%d%d%d",&n,&b,&e);
	for(int i=1;i<=n;i++)if(judge(i))ans+=i;
	cout<<ans<<'\n';
	return 0;
}

Compiler output:
a.cc:8:8: error: ISO C++ forbids declaration of 'judge' with no type [-fpermissive]
    8 | inline judge(int p){
      |        ^~~~~
Language: C++

#include<iostream>
using namespace std;

int findSumOfDigits(int n){
    int sum = 0;
    while(n>0){
        sum+=n%10;
        n/=10;
    }
    return sum;
}
int main(){
    int N,A,B;
    cin>>N>>A>>B;
    int total = 0;
    for(i=0;i<=N;i++){
        if(A<=findSumOfDigits(i)<=B) total+=1;
    }
    cout<<total<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'i' was not declared in this scope
   16 |     for(i=0;i<=N;i++){
      |         ^
Language: C++

#include<iostream>
using namespace std;
int iEnd,iLB,iUB;
inline bool IsAddable(int iNum, int iLBound, int iUBound){
    int iSum=0;
    while(iNum){
        iSum+=iNum%10; 
        iNum/=10;
    }
    return (iLBound<=iSum&&iSum<=iUBound);
}
int main(){
    cin>>iEnd>>iLB>>iUB;
    register int i;
    register long long iSum=0;
    for(i=1;i<=iEnd;++i){
        if(IsAddable(i,iLB iUB))
            iSum+=i;
    }
    cout<<iSum<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   14 |     register int i;
      |                  ^
a.cc:15:24: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   15 |     register long long iSum=0;
      |                        ^~~~
a.cc:17:27: error: expected ')' before 'iUB'
   17 |         if(IsAddable(i,iLB iUB))
      |                     ~     ^~~~
      |                           )
a.cc:17:21: error: too few arguments to function 'bool IsAddable(int, int, int)'
   17 |         if(IsAddable(i,iLB iUB))
      |            ~~~~~~~~~^~~~~~~~~~
a.cc:4:13: note: declared here
    4 | inline bool IsAddable(int iNum, int iLBound, int iUBound){
      |             ^~~~~~~~~
Language: C++

#include<iostream>
using namespace std; 
inline bool IsAddable(int iNum, int iLBound, int iUBound){
    int iSum=0;
    while(iNum){
        iSum+=iNum%10; 
        iNum/=10;
    }
    return (iLBound<=iSum&&iSum<=iUBound);
}
int main(){
    int iEnd,iLB,iUB;
    cin>>iEnd>>iLB>>iUB;
    register int i;
    register long long iSum=0;
    for(i=1;i<=iEnd;++i){
        if(IsAddable(i,iLB iUB))
            iSum+=i;
    }
    cout<<iSum<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   14 |     register int i;
      |                  ^
a.cc:15:24: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   15 |     register long long iSum=0;
      |                        ^~~~
a.cc:17:27: error: expected ')' before 'iUB'
   17 |         if(IsAddable(i,iLB iUB))
      |                     ~     ^~~~
      |                           )
a.cc:17:21: error: too few arguments to function 'bool IsAddable(int, int, int)'
   17 |         if(IsAddable(i,iLB iUB))
      |            ~~~~~~~~~^~~~~~~~~~
a.cc:3:13: note: declared here
    3 | inline bool IsAddable(int iNum, int iLBound, int iUBound){
      |             ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int findSumOfDigits(int n)
{
  int sum = 0;
  while (n > 0)
  { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
main()
{
  int N,a,b;
  cin >> N >> a >> b;
  int total = 0;
  for (int i = 1; i <= N;i++){
    　int sum = findSumOfDigits(i);
    if(a<=sum&&sum<=b)
      total += i;
  }
  cout << total << endl;
}


Compiler output:
a.cc:19:5: error: extended character 　 is not valid in an identifier
   19 |     　int sum = findSumOfDigits(i);
      |     ^
a.cc:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:19:5: error: '\U00003000int' was not declared in this scope
   19 |     　int sum = findSumOfDigits(i);
      |     ^~~~~
a.cc:20:11: error: 'sum' was not declared in this scope
   20 |     if(a<=sum&&sum<=b)
      |           ^~~
Language: C++

#include <iostream>
using namespace std;

int main() {
    int n,a,b;
    cin >> n>>a>>b;
    
    int hoge = 0;
    
    for(int i = 1;i<=n;i++){
        int fuga = i%10 + ((i-i%10)/10)%10 + ((i-i%100)/100)%10 + ((i-i%1000)/1000)%10 + (i-i%10000)/10000


if(fuga>=a&&fuga<=b){
    hoge+=i;
}
    }
    
    cout << hoge<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:1: error: expected ',' or ';' before 'if'
   14 | if(fuga>=a&&fuga<=b){
      | ^~
Language: C++

int find(int n) {
  int sum = 0;
  while(n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
  int N;
  cin >> N;
  int num = find (N);
  if (N % num == 0 )  cout << "Yes" << endl;
  else  cout << "No" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'cin' was not declared in this scope
   12 |   cin >> N;
      |   ^~~
a.cc:14:23: error: 'cout' was not declared in this scope
   14 |   if (N % num == 0 )  cout << "Yes" << endl;
      |                       ^~~~
a.cc:14:40: error: 'endl' was not declared in this scope
   14 |   if (N % num == 0 )  cout << "Yes" << endl;
      |                                        ^~~~
a.cc:15:9: error: 'cout' was not declared in this scope
   15 |   else  cout << "No" << endl;
      |         ^~~~
a.cc:15:25: error: 'endl' was not declared in this scope
   15 |   else  cout << "No" << endl;
      |                         ^~~~
Language: C++

#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>


using namespace std;


int main() {
    int N, A, B;
    cin >> N >> A >> B;
    int total = 0;
    for (size_t i = 1; i <= N; i++) {
        int sum = i / 1000 + (i % 1000 / 100) + (i % 100 / 10) + (i % 10);
        if (sum >= A && sum <= B) {
            total += i;
        }
    }
    std::cout << total << '\n';
    return 0;
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>


using namespace std;


int main() {
    int N, A, B;
    cin >> N >> A >> B;
    int total = 0;
    for (size_t i = 1; i <= N; i++) {
        int sum = i / 1000 + (i % 1000 / 100) + (i % 100 / 10) + (i % 10);
        if (sum >= A && sum <= B) {
            total += i;
        }
    }
    std::cout << total << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   55 | int main() {
      |         ^~
a.cc:55:9: note: remove parentheses to default-initialize a variable
   55 | int main() {
      |         ^~
      |         --
a.cc:55:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:55:12: error: a function-definition is not allowed here before '{' token
   55 | int main() {
      |            ^
a.cc:67:2: error: expected '}' at end of input
   67 | }
      |  ^
a.cc:22:12: note: to match this '{'
   22 | int main() {
      |            ^
Language: C++

#include<stdio.h>

int total(int n){
int sum=0;
 do{sum= sum+n%10;
    n=n/10
   }while(n>0);
 return sum;
}

int main(void){
int a,b;
int c;
int sum=0;
int n,i;
scanf("%d%d%d",&n,&a,&b);
for(i=1; i<n+1; i++){
 c=total(i);
 if(a<=c&&c<=b){
 sum= sum+c;}
}
printf("%d\n",sum);
return 0;
}

Compiler output:
a.cc: In function 'int total(int)':
a.cc:6:11: error: expected ';' before '}' token
    6 |     n=n/10
      |           ^
      |           ;
    7 |    }while(n>0);
      |    ~
Language: C++

#include<iostream>
using namespace std;
int main(){
 int n,a,b;
 cin>>n>>a>>b;

 ans==0;

 for(int i=0;i<n+1;i++){
  int wa=i/10000+(i/1000)%10+(i/100)%10+(i/10)%10+1%10;
  if(wa>=a && wa<=b){
   ans+=i;
  }
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:7:2: error: 'ans' was not declared in this scope; did you mean 'abs'?
    7 |  ans==0;
      |  ^~~
      |  abs
a.cc:14:3: error: expected '}' at end of input
   14 |  }
      |   ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<iostream>
using namespace std;
int main(){
 int n,a,b;
 cin>>n>>a>.b;

 ans==0;

 for(int i=0;i<N+1;i++){
  int wa=i/10000+(i/1000)%10+(i/100)%10+(i/10)%10+1%10;
  if(wa>=a && wa<=b){
   ans+=wa;
  }
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:5:12: error: expected primary-expression before '.' token
    5 |  cin>>n>>a>.b;
      |            ^
a.cc:7:2: error: 'ans' was not declared in this scope; did you mean 'abs'?
    7 |  ans==0;
      |  ^~~
      |  abs
a.cc:9:16: error: 'N' was not declared in this scope
    9 |  for(int i=0;i<N+1;i++){
      |                ^
a.cc:14:3: error: expected '}' at end of input
   14 |  }
      |   ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

n,a,b,s,i,m;
main(c){
	while((c=getchar())>47)n=n*10+c-48;
	while((c=getchar())>47)a=a*10+c-48;
	while((c=getchar())>47)b=b*10+c-48;
	for(;i++<n;){
		m++;
		if(i%10000==0)m=1;
		else if(i%1000==0)m-=27;
		else if(i%100==0)m-=18;
		else if(i%10==0)m-=9;
		if(a<=m&&m<=b)s+=i;
	}
	printf("%d",s);
}

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,a,b,s,i,m;
      | ^
a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token
    2 | main(c){
      |     ^
Language: C++

#include<iostream>
#include<ios>
using namespace std;
constexpr int f(int a){
	return a?a%10+f(a/10):0;
}
template<int N>struct ans{
	int a[37][N+1];
	constexpr ans():a(){
		for(int i=1;i<=N;i++){
			for(int j=1;j<=36;j++)a[j][i]=a[j][i-1];
			a[f(i)][i]+=i;
		}
		for(int i=1;i<=N;i++){
			for(int j=1;j<=36;j++)a[j][i]+=a[j-1][i];
		}
	}
};
void print(int a){
	a?print(a/10),putchar(a%10+48):0;
}
constexpr auto s=ans<10000>();
int t,in[3],ini;
char buf[114514];
main(){
	gets(buf);
	for(char*p=buf;*p;p++){
		if(*p<47)ini++;
		else in[ini]=in[ini]*10+*p-48;
	}
	t=s.a[in[2]][in[0]]-s.a[in[1]-1][in[0]];
	t?print(t),0:putchar(48);
}


Compiler output:
a.cc:25:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   25 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:26:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   26 |         gets(buf);
      |         ^~~~
      |         getw
Language: C++

#include<iostream>
using namespace std;
constexpr int f(int a){
	return a?a%10+f(a/10):0;
}
template<int N>struct ans{
	int a[37][N+1];
	constexpr ans():a(){
		for(int i=1;i<=N;i++){
			for(int j=1;j<=36;j++)a[j][i]=a[j][i-1];
			a[f(i)][i]+=i;
		}
		for(int i=1;i<=N;i++){
			for(int j=1;j<=36;j++)a[j][i]+=a[j-1][i];
		}
	}
};
void print(int a){
	a?print(a/10),putchar(a%10+48):0;
}
constexpr auto s=ans<10000>();
int t,c,in[3],ini;
char buf[114514];
main(){
	gets(buf);
	for(char*p=buf;*p;p++){
		if(*p<47)ini++;
		else in[ini]=in[ini]*10+*p-48;
	}
	t=s.a[in[2]][in[0]]-s.a[in[1]-1][in[0]];
	t?print(t),0:putchar(48);
}


Compiler output:
a.cc:24:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   24 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:25:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   25 |         gets(buf);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
void sumofdigits(int n) {
  int sum = 0;
  while (n>0) {
    sum+=n%10;
    n/=10;
  }
  return sum;
}
 int main () {
   int total=0 ;
   int a,b,n;
   cin>>a>>b>>n;
   for (int i = 0; i < n; ++i)
    {
        int sum = sumofdigits(i);
        if (sum>=a && sum<=b)
        {
            total+=i;
        }
    } 
    cout<<total<<endl;
   
}

Compiler output:
a.cc: In function 'void sumofdigits(int)':
a.cc:9:10: error: return-statement with a value, in function returning 'void' [-fpermissive]
    9 |   return sum;
      |          ^~~
a.cc: In function 'int main()':
a.cc:17:30: error: void value not ignored as it ought to be
   17 |         int sum = sumofdigits(i);
      |                   ~~~~~~~~~~~^~~
Language: C++

#include <iostream>

using namespace std;

int sum_of_digits(int i){
    string s = to_string(i);
    int v=0;
    for (i=0;i<s.size();i++){
        v+=atoi(string(1,s[i].c_str()));
    }
    return v;
}

int sum_of_digits2(int i){
    int sum = 0;
    while (i>0){
        sum += i%10;
        i/=10;
    }
    return sum;
}

int main(void){
    int n,a,b;
    int sum = 0;

    cin >> n >> a >> b;

    for (int i=1;i<=n;i++){
        int v = sum_of_digits(i);
        if ((v>=a)&&(v<=b)) sum+=i;
    }
    cout << sum;
}

Compiler output:
a.cc: In function 'int sum_of_digits(int)':
a.cc:9:31: error: request for member 'c_str' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
    9 |         v+=atoi(string(1,s[i].c_str()));
      |                               ^~~~~
Language: C++

#include <iostream>

using namespace std;

int sum_of_digits(int i){
    string s = to_string(i);
    int v=0;
    for (i=0;i<s.size();i++){
        char digit = s[i];
        v+=atoi(digit);
    }
    return v;
}

int sum_of_digits2(int i){
    int sum = 0;
    while (i>0){
        sum += i%10;
        i/=10;
    }
    return sum;
}

int main(void){
    int n,a,b;
    int sum = 0;

    cin >> n >> a >> b;

    for (int i=1;i<=n;i++){
        int v = sum_of_digits(i);
        if ((v>=a)&&(v<=b)) sum+=i;
    }
    cout << sum;
}

Compiler output:
a.cc: In function 'int sum_of_digits(int)':
a.cc:10:17: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   10 |         v+=atoi(digit);
      |                 ^~~~~
      |                 |
      |                 char
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
Language: C++

#include <iostream>

using namespace std;

int sum_of_digits(int i){
    string s = to_string(i);
    int v=0;
    for (i=0;i<s.size();i++){
        v+=atoi(s[i]);
    }
    return v;
}

int sum_of_digits2(int i){
    int sum = 0;
    while (i>0){
        sum += i%10;
        i/=10;
    }
    return sum;
}

int main(void){
    int n,a,b;
    int sum = 0;

    cin >> n >> a >> b;

    for (int i=1;i<=n;i++){
        int v = sum_of_digits(i);
        if ((v>=a)&&(v<=b)) sum+=i;
    }
    cout << sum;
}

Compiler output:
a.cc: In function 'int sum_of_digits(int)':
a.cc:9:16: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
    9 |         v+=atoi(s[i]);
      |            ~~~~^~~~~~
      |                |
      |                __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
Language: C++

#include <iostream>

using namespace std;

int sum_of_digits(int i){
    string s = to_string(i);
    int v=0;
    for (i=0;i<s.size();i++){
        v+=atoi(&s[i]);
    }
    return v;
}

int sum_of_digits2(int i){
    int sum = 0;
    while (i>0){
        sum += i%10;
        i/=10:
    }
    return sum;
}

int main(void){
    int n,a,b;
    int count = 0;

    cin >> n >> a >> b;

    for (int i=1;i<=n;i++){
        int v = sum_of_digits2(i);
        if ((v>=a)&&(v<=b)) count++;
    }
    cout << count;
}

Compiler output:
a.cc: In function 'int sum_of_digits2(int)':
a.cc:18:14: error: expected ';' before ':' token
   18 |         i/=10:
      |              ^
      |              ;
Language: C++

#include <iostream>

using namespace std;

int sum_of_digits(int i){
    string s = to_string(i);
    int v=0;
    for (i=0;i<s.size();i++){
        v+=atoi(&s[i]);
    }
    return v;
}

int sum_of_digits2(int i){
    int sum = 0;
    while (n>0){
        sum += i%10;
        i/=10:
    }
    return sum;
}

int main(void){
    int n,a,b;
    int count = 0;

    cin >> n >> a >> b;

    for (int i=1;i<=n;i++){
        int v = sum_of_digits2(i);
        if ((v>=a)&&(v<=b)) count++;
    }
    cout << count;
}

Compiler output:
a.cc: In function 'int sum_of_digits2(int)':
a.cc:16:12: error: 'n' was not declared in this scope
   16 |     while (n>0){
      |            ^
a.cc:18:14: error: expected ';' before ':' token
   18 |         i/=10:
      |              ^
      |              ;
Language: C++

#include <iostream>

using namespace std;

int main(void){
    int n,a,b;
    int count = 0;

    cin >> n >> a >> b;

    for (int i=1;i<=n;i++){
        string s = to_string(i);
        int v=0;
        for (i=0;i<s.size();i++){
            v+=atoi(s.at(i));
        }
        if ((v>=a)&&(v<=b)) count++;
    }
    cout << count;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
   15 |             v+=atoi(s.at(i));
      |                     ~~~~^~~
      |                         |
      |                         __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~