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

#include "bits/stdc++.h"

#define REP(i,n) for(int i=0;i< (n);i++)
#define REPR(i, n) for(int i = (n);i >= 0;i--)
#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define FORR(i, m, n) for(int i = (m);i >= (n);i--)
#define SORT(v, n) std::sort(v, v+n);
#define VSORT(v) std::sort(v.begin(), v.end());
#define VRSORT(v) std::sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define ALL(obj) (obj).begin(),(obj).end()

using namespace std;

const int INF = 99999999;
const ll LINF = 9999999999999;

typedef pair<ll, ll> LP;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };


string S;

ll dfs(ll index,ll times,ll num) {
	ll add = ll(S[index]-ll('0')) * times;
	if (index + 1 == ll(S.size())) {return num + add; }
	return dfs(index + 1, times * 10,num+ add) + dfs(index + 1, 1, num + add);
}

int main() {
	cin >> S;
	reverse(ALL(S));

	cout << dfs(0, 1,0)<<endl;

	return 0;
}

Compiler output:
a.cc: In function 'long long int dfs(long long int, long long int, long long int)':
a.cc:10:12: error: expected primary-expression before 'long'
   10 | #define ll long long
      |            ^~~~
a.cc:27:18: note: in expansion of macro 'll'
   27 |         ll add = ll(S[index]-ll('0')) * times;
      |                  ^~
a.cc:10:12: error: expected primary-expression before 'long'
   10 | #define ll long long
      |            ^~~~
a.cc:28:26: note: in expansion of macro 'll'
   28 |         if (index + 1 == ll(S.size())) {return num + add; }
      |                          ^~
a.cc:28:25: error: expected ')' before 'long'
   28 |         if (index + 1 == ll(S.size())) {return num + add; }
      |            ~            ^
      |                         )
Language: C++

#include "bits/stdc++.h"

#define REP(i,n) for(int i=0;i< (n);i++)
#define REPR(i, n) for(int i = (n);i >= 0;i--)
#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define FORR(i, m, n) for(int i = (m);i >= (n);i--)
#define SORT(v, n) std::sort(v, v+n);
#define VSORT(v) std::sort(v.begin(), v.end());
#define VRSORT(v) std::sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define ALL(obj) (obj).begin(),(obj).end()

using namespace std;

const int INF = 99999999;
const ll LINF = 9999999999999;

typedef pair<ll, ll> LP;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };


string S;

ll dfs(ll index,ll times,ll num) {
	ll add = ll(S[index]-ll('0')) * times;
	if (index + 1 == S.size()) {return num + add; }
	return dfs(index + 1, times * 10,num+ add) + dfs(index + 1, 1, num + add);
}

int main() {
	cin >> S;
	reverse(ALL(S));

	cout << dfs(0, 1,0)<<endl;

	return 0;
}

Compiler output:
a.cc: In function 'long long int dfs(long long int, long long int, long long int)':
a.cc:10:12: error: expected primary-expression before 'long'
   10 | #define ll long long
      |            ^~~~
a.cc:27:18: note: in expansion of macro 'll'
   27 |         ll add = ll(S[index]-ll('0')) * times;
      |                  ^~
Language: C++

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

long long calc(string s){
  int N = s.size();
  long long ret = stoll(s);
  
  //recursive step
  for(int i=1;i<N;i++){
    string sl = s.substr(0,i);
    ret += stoll(sl)*pow(2,sr.size()-1);
    string sr = s.substr(i,N-i);
    ret += calc(sr);
  }
  
  return ret;
}

int main(){
  string s;
  cin >> s;
  cout << calc(s) << endl;
  
}

Compiler output:
a.cc: In function 'long long int calc(std::string)':
a.cc:11:28: error: 'sr' was not declared in this scope; did you mean 'sl'?
   11 |     ret += stoll(sl)*pow(2,sr.size()-1);
      |                            ^~
      |                            sl
Language: C++

#include <algorithm>
#include <cmath>
#include <ctype.h>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define ENDL '\n'
#define FOR(i, n) for (int i = 0; i < n; i++)
#define FOR_EACH(i, v) for (auto&& i : v)

long long* memo;

long long calc(string& s)
{
	int len = s.length();

	if (memo[len - 1]) {
		return memo[len - 1];
	}

	long long sum = stoll(s);
	for (int i = 1; i < len; i++) {
		sum += stoll(s.substr(0, i)) * (long long)pow(2, len - i - 1) + calc(s.substr(i));
	}
	memo[len - 1] = sum;
	return sum;
}

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string S;
	cin >> S;
	int len = S.length();
	memo = new long long[len];
	FOR(i, len) {
		memo[i] = 0LL;
	}

	cout << calc(S) << ENDL;

	delete memo;
	return 0;
}

Compiler output:
a.cc: In function 'long long int calc(std::string&)':
a.cc:34:94: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
   34 |                 sum += stoll(s.substr(0, i)) * (long long)pow(2, len - i - 1) + calc(s.substr(i));
      |                                                                                      ~~~~~~~~^~~
a.cc:24:24: note:   initializing argument 1 of 'long long int calc(std::string&)'
   24 | long long calc(string& s)
      |                ~~~~~~~~^
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>
#include<cstdlib>



using namespace std;

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

string s;

int main(){
    int ans=0;
    cin >> s;
    int n = s.size();
    long long int a;
    rep(i,(1<<(n-1) - 1){
        a = 0;
        rep(j,n-1){
            a = a*10 + s[j] - '0';
            if((i>>j) & 1){
                ans += a;
                a = 0;
            }
        }
        ans += a;
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc:36:2: error: unterminated argument list invoking macro "rep"
   36 | }
      |  ^
a.cc: In function 'int main()':
a.cc:23:5: error: 'rep' was not declared in this scope
   23 |     rep(i,(1<<(n-1) - 1){
      |     ^~~
a.cc:23:8: error: expected '}' at end of input
   23 |     rep(i,(1<<(n-1) - 1){
      |        ^
a.cc:18:11: note: to match this '{'
   18 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <cmath>

int main(int argc, const char * argv[]) {

    std::string S;
    std::cin >> S;

    unsigned long size = S.size();
    if(size == 1) {
        std::cout << S;
        return;
    }

    long long count = std::pow(2, size - 1);
    long long sum = 0;
    for(unsigned long i=0; i<count; i++) {
        std::string formula;
        formula.push_back(S[0]);
        for(unsigned long j=0; j<=size-2; j++) {
            if(i&(1<<j)) {
                formula.push_back('+');
            }
            std::cout << j <<std::endl;
            formula.push_back(S[j+1]);
        }

        std::istringstream strm(formula);
        std::string tmp;
        unsigned long ans = 0;
        while(getline(strm, tmp, '+')) {
            ans += std::stoll(tmp);
        }
        sum += ans;
    }

    std::cout << sum;

    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:14:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   14 |         return;
      |         ^~~~~~
Language: C++

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

int solve(string S)
{
    long long Ssize = S.size();
    long long sum = 0;
    if (Ssize == 1)
    {
        int ss = S[0] - '0';
        cout << ss << endl;
        return 0;
    }

    for (long long bit = 0; bit < (1 << (Ssize - 1)); bit++)
    {
        string num = "";
        for (long long i = 0; i < Ssize; i++)
        {
            num += S[i];
            if (bit & (1 << i)) //0:nasi 1:+
            {
                cout << setbit<8>(1 << i) << endl;
                sum += stoll(num);
                num = "";
            }
        }
        sum += stoll(num);
    }

    cout << sum << endl;
    return 0;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    string S;
    cin >> S;
    solve(S);
    return 0;
}


Compiler output:
a.cc: In function 'int solve(std::string)':
a.cc:23:25: error: 'setbit' was not declared in this scope; did you mean 'setuid'?
   23 |                 cout << setbit<8>(1 << i) << endl;
      |                         ^~~~~~
      |                         setuid
a.cc:23:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   23 |                 cout << setbit<8>(1 << i) << endl;
      |                                  ~~~~~~~~~^~~~~~~
Language: C

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;


int main(){
    string s;
    cin >> s;
    int n = s.size();

    ll ans = 0;

    for(int bit = 0; bit < (1 << (n-1)); bit++){
        ll tmp = 0;
        for(int i = 0; i < n; i++){
            if(i == n - 1){
                tmp = tmp*10 + s[i] - '0';
            }else if(bit & (1 << i)){
                ans += tmp*10 + s[i] - '0';
                tmp = 0;
            }else{
                tmp = tmp*10 + s[i] - '0';
            }
        }
        if(tmp > 0) ans += tmp;
    }

    cout << ans << endl;
}

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

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;

long long sum(int i, string &s){
  int n = s.size()-1;
  vector<long long> part;
  part.push_back(s[0]-'0');
  
  for(int j=0; j<n; j++){
    if((i<<j)&1){
      part.push_back(s[j+1]);
    }
    else{
      part.back() *= 10;
      part.back() += s[j+1];
    }
  }
  
  ll rtn = 0;
  for(int j=0; j<part.size(); j++){
    rtn += part[j];
  }
  return rtn;
}

int main(){
  string s; cin >> s;
  int n = s.size()-1;
  long long ans = 0;
  
  rep(i, 1<<n){
    ans += sum(i, s);
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'long long int sum(int, std::string&)':
a.cc:20:3: error: 'll' was not declared in this scope
   20 |   ll rtn = 0;
      |   ^~
a.cc:22:5: error: 'rtn' was not declared in this scope
   22 |     rtn += part[j];
      |     ^~~
a.cc:24:10: error: 'rtn' was not declared in this scope
   24 |   return rtn;
      |          ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
int res = 0;
string s;
void dfs(int i, int sum, int psum, string &s) {
  int n = s.size();
  int si = s.at(i) - '0';
  if (i == n - 1) {
    res += sum + si + 10 * psum;
    return;
  }
  dfs(i + 1, sum + si + 10 * psum, 0, s);
  dfs(i + 1, sum, 10 * psum + si, s);
}
signed main() {
  cin >> s;
  dfs(0, 0, 0, s);
  cout << res << endl;
}
  int res = 0;
  dfs(0, 0, s);
  cout << res << endl;
}



Compiler output:
a.cc:21:7: error: redefinition of 'long long int res'
   21 |   int res = 0;
      |       ^~~
a.cc:4:5: note: 'long long int res' previously defined here
    4 | int res = 0;
      |     ^~~
a.cc:22:6: error: expected constructor, destructor, or type conversion before '(' token
   22 |   dfs(0, 0, s);
      |      ^
a.cc:23:3: error: 'cout' does not name a type
   23 |   cout << res << endl;
      |   ^~~~
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
Language: C++

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

int main() {
  string s;
  cin >> s;
  int n = s.size() - 1;
  int res = 0;
  for (int bit = 0; bit < (1<<n); bit++) {
    int sum = 0;
    for (int i = 0; i < n; i++) {
      int si = s.at(i) - '0'
      if ((1<<i) & bit) {
        res = res + 10 * sum + si;
        sum = 0;
      }
      else {
        sum = si + sum * 10;
      }
    }
    res += 10 * sum;
    res += (int)s.at(n) - '0';
  }
  cout << res << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: expected ',' or ';' before 'if'
   13 |       if ((1<<i) & bit) {
      |       ^~
a.cc:17:7: error: 'else' without a previous 'if'
   17 |       else {
      |       ^~~~
Language: C

#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
#define ll long long
int n;
string ss;
vector<int> now;
ll ans;
void dfs(int cur)
{
    if(cur==n-1)
    {
        now.push_back(n-1);
        ll pre=0; int last=-1;
        for(int i=0;i<(int)now.size();i++)
        {
            for(int pos=last+1;pos<=now[i];pos++)
                pre=pre*(ll)10+(ll)(ss[pos]-'0');
            last=now[i]; ans+=pre; pre=0;
        }
        now.pop_back();
        return;
    }
    dfs(cur+1);
    now.push_back(cur);
    dfs(cur+1);
    now.pop_back();
    return;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>ss;
    n=(int)ss.length();
    dfs(0);
    cout<<ans<<'\n';
    return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
string s;
vector<int> v;
long long ans=0;
long long sti(int l,int r){
	long long sum=0;
	for(int i=l;i<=r;i++){
		sum=sum*10+s[i]-'0';
	}
	return sum;
}
void dfs(){
	if(v.size()+1==s.size()){
		long long l=0,sum=0;
		for(int i=0;i<s.size()-1;i++){
			if(v[i]==1){
				sum+=sti(l,i);
				l=i+1;
			}
		}
		sum+=sti(l,s.size()-1);
		//cout<<sum<<endl;
		ans+=sum;
	}else{
		v.push_back(0);
		dfs();
		v.pop_back();
		v.push_back(1);
		dfs();
		v.pop_back();
	}
}
int main(){
	cin>>s;
	dfs();
	cout<<ans<<endl;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int main(){

    long long sum = 0;
    string S;
    cin >> S;

    int n = S.size(); 
    for (int i = 0; i < pow(2, n-1);i++){
        long long  part = 0;
        for(int j = 0; j < n-1;j++){

            part *= 10;
            part += (int)(S[j] - '0');
            if((i & (int)pow(2, j)) != 0){
                sum += part;
                part = 0;
            }
        }
        part *= 10;
        part += (int)(S[n-1] - '0');
        sum += part;

    }

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

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


long long calc(string s)
{
     int len = s.length();
     long long sum ;

     sum = stoll(s);
  
    for(int i=1;i<len;i++)
    {
        string left =s.substr(0,i);
        sum += stoll(left) * pow(2,len-i-1);
        
        string right = substr(i,len-i);
       
         sum += calc(right);
    
    }

   return sum;
}



int main()
{
    string s;
    cin>>s;
  
  long long sum = calc(s);
  
  cout<<sum<<endl;

}



//standlineさん参考


Compiler output:
a.cc: In function 'long long int calc(std::string)':
a.cc:17:24: error: 'substr' was not declared in this scope; did you mean 'strstr'?
   17 |         string right = substr(i,len-i);
      |                        ^~~~~~
      |                        strstr
Language: C++

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


long long calc(string s)
{
     int len = s.length();
     long long sum ;

     sum = stoll(s);
  
    for(int i=1;i<len;i++)
    {
        string left =s.substr(0,i);
        sum += stoll(left) * pow(2,len-i-1);
        
        string right = substr(i,len-i);
       
         sum += calc(right);
    
    }

   return sum;
}



int main()
{
    string s;
    cin>>s;
  
  long long sum = calc(s);
  
  cout<<calc<<endl;

}



//standlineさん参考

Compiler output:
a.cc: In function 'long long int calc(std::string)':
a.cc:17:24: error: 'substr' was not declared in this scope; did you mean 'strstr'?
   17 |         string right = substr(i,len-i);
      |                        ^~~~~~
      |                        strstr
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
long f(long n) {
  if (n < 10) return n;
  
  long a = 100, b = 1, c = 11; 
  while (true) {
    if (n < a) return n/(a/10)*c + f(n%(a/10))*2;
    a *= 10;
    b *= 2;
    c = 10*c + b;
  }
}

long main() {
  long x;
  cin >> x;
  cout << f(x) << endl;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

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

int sum_plus(string &S, string plus, int n, int ans) {
  int sum = 0;
  if (n == 0) {
    sum = S.at(0);
    for (int i = 0; i < plus.size(); i++) {
      if (plus.at(i) == "0") {
        sum *= 10;
        sum += S.at(i + 1);
      }
      else {
        ans += sum;
        sum = S.at(i + 1);
      }
      if (i == plus.size() - 1) {
        ans += sum;
      }
    }
    plus.pop_back();
  }
  if (n > 0) {
    sum_plus(S, plus + "0", n - 1, ans);
    sum_plus(S, plus + "1", n - 1, ans);
  }
  return ans;
}

int main() {
  string S, plus;
  cin >> S;
  int ans = 0;
  cout << sum_plus(S, plus, S.size() - 1, ans) << endl;
}


Compiler output:
a.cc: In function 'int sum_plus(std::string&, std::string, int, int)':
a.cc:9:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |       if (plus.at(i) == "0") {
      |           ~~~~~~~~~~~^~~~~~
Language: C++

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

int sum_plus(string &S, string plus, int n, int ans) {
  int sum = 0;
  if (n == 0) {
    sum = S.at(0);
    for (int i = 0; i < plus.size(); i++) {
      if (plus.at(i) == "0") {
        sum *= 10;
        sum += S.at(i + 1);
      }
      else {
        ans += sum;
        sum = S.at(i + 1);
      }
      if (i == plus.size() - 1) {
        ans += sum;
      }
    }
    plus.pop_back;
  }
  if (n > 0) {
    sum_plus(S, plus + "0", n - 1, ans);
    sum_plus(S, plus + "1", n - 1, ans);
  }
  return ans;
}

int main() {
  string S, plus;
  cin >> S;
  int ans = 0;
  cout << sum_plus(S, plus, S.size() - 1, ans) << endl;
}

Compiler output:
a.cc: In function 'int sum_plus(std::string&, std::string, int, int)':
a.cc:9:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |       if (plus.at(i) == "0") {
      |           ~~~~~~~~~~~^~~~~~
a.cc:21:10: error: invalid use of non-static member function 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::pop_back() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
   21 |     plus.pop_back;
      |     ~~~~~^~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:2174:7: note: declared here
 2174 |       pop_back() noexcept
      |       ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int tmp,i,ans=0;
  long N;cin>>N;
  int sizN=to_string(N).size();
  for(tmp=0;tmp<(1<<(sizN-1));tmp++){
    bitset<9> s(tmp);
    long L=0,copyN=N;A
    int w=1;
    for(i=0;i<sizN-1;i++){
      w*=10;
      if(s[i]){L+=copyN%w;copyN/=w;w=1;}
    }
    ans+=L+copyN;
  }
  if(ans==0)ans+=N;
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:22: error: 'A' was not declared in this scope
    9 |     long L=0,copyN=N;A
      |                      ^
a.cc:12:7: error: 'w' was not declared in this scope
   12 |       w*=10;
      |       ^
Language: C++

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

int main() {
  int tmp,i;
  int ans=0;
  int N;
  string sN=N.to_string();
  cin>>N;
  for(tmp=0;tmp<(1<<(sN.size()-1));tmp++){
    bitset<9> s(tmp);
    int L=0,w=1,NN=N;
   for(i=0;i<sN.size()-1;i++){
     W*=10;
     if(s[i]){L+=NN%w;NN/=w;w=1;}
   }
    ans+=L;
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: request for member 'to_string' in 'N', which is of non-class type 'int'
    8 |   string sN=N.to_string();
      |               ^~~~~~~~~
a.cc:14:6: error: 'W' was not declared in this scope
   14 |      W*=10;
      |      ^
Language: C++

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

int main() {
  long int S,ans=0;
  cin>>S;
  int N;
  for(int tmp=0;tmp<(1<<S.size()-1);tmp++){
    bitset<10> sub(tmp);
    long int s=S;
    int i=0;
    ans+=s%10;
    N=1;s/=10;
    while(s){
      if(sub.test(i))N*=10;
      else N=1;
      ans+=(s%10)*N;
      s/=10;
      i++;
    }
  }
  cout <<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:27: error: request for member 'size' in 'S', which is of non-class type 'long int'
    8 |   for(int tmp=0;tmp<(1<<S.size()-1);tmp++){
      |                           ^~~~
Language: C++

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

int plus(string &S) {
  string num;
  int point = 0;
  for (int i = 1; i < S.size() - 1; i++) {
    num = "";
    for (int j = 0; j < S.size(); j++) {
      if (j == i) {
        num.push_back("+");
      }
      num.push_back(S.at(j));
    }
    for (int j = 0; j < num.size(); j++) {
      int ans = 0;
      int sum = 0;
      if (num.at(j) == "+") {
        ans += sum;
        sum = 0;
        j++;
      }
      sum *= 10;
      sum += num.at(j);
    }
    point += ans;
  }
}

int main() {
  string S;
  cin >> S;
  int ans = 0;
  

Compiler output:
a.cc: In function 'int plus(std::string&)':
a.cc:11:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
   11 |         num.push_back("+");
      |                       ^~~
      |                       |
      |                       const char*
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1572:24: note:   initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1572 |       push_back(_CharT __c)
      |                 ~~~~~~~^~~
a.cc:18:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   18 |       if (num.at(j) == "+") {
      |           ~~~~~~~~~~^~~~~~
a.cc:26:14: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |     point += ans;
      |              ^~~
      |              abs
a.cc:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
   28 | }
      | ^
a.cc: In function 'int main()':
a.cc:33:15: error: expected '}' at end of input
   33 |   int ans = 0;
      |               ^
a.cc:30:12: note: to match this '{'
   30 | int main() {
      |            ^
Language: Java

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int n = s.length();
		int[] a = new int[n];

		for(int i = 0;i < n; i++) {
			a[i] = s.charAt(i) - '0';
		}


		long ans = 0;

		for (int bit = 0; bit < 1 << (n-1); bit++){

			long num = 0;
			long sum = 0;

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

				num = num * 10 + a[j];

				if ((bit >> j & 1) == 1){
					sum += num;
					num = 0;
				}

			}

			sum += num;
			ans += sum;

		}

		System.out.println(ans);

	}

}


Compiler output:
Main.java:4: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

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

int main(){
  string s;
  cin>>s;
  int n=s.size();
  vector<int> a(n);
  for(int i=0;i<n;i++){
    a.at(i)=s.at(i);
  }
}

Compiler output:
a.cc:1:10: fatal error: bits/stdc+;.h: No such file or directory
    1 | #include <bits/stdc+;.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int64_t sum(int i, vector<int>A) {
  if(i==0)
    return A.at(0);
  int a=A.at(i);
  vector<int> B=A;
  B.at(i-1)=B.at(i-1)*10+a;
  return sum(i-1,A)+a*(int)pow(2,i-1)+sum(i-1,B);
}

int main() {
  string S;
  cin >> S;
  vector<int> A(S.size());
  for(int i=0;i<S.size(),i++)
    A.at(i)=S[i]-'0';
  cout << sum(S.size(),A) << endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:17:29: error: expected ';' before ')' token
   17 |   for(int i=0;i<S.size(),i++)
      |                             ^
      |                             ;
Language: C++

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

int main() {
  string s;
  cin >> s;
  
  int n = s.size();
  ll ans = 0;
  
  for (int bit = 0; i < (1 << n-1); i++) {
    ll temp = 0;
    for (int i = 0; i < n; i++) {
      temp = temp * 10 + S.at(i) - '0';
      if (bit & (1 << i)) {
        ans += temp;
        temp = 0;
      }
    }
    ans += temp;
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: 'i' was not declared in this scope
   12 |   for (int bit = 0; i < (1 << n-1); i++) {
      |                     ^
a.cc:15:26: error: 'S' was not declared in this scope
   15 |       temp = temp * 10 + S.at(i) - '0';
      |                          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int sum(string s, int n){
  if(n == 0) return atoi(s.c_str());
  if(s.length() <= n) return 0;
  if(s.length() == 2 && n == 1) return int(s.at(0) + s.at(1));

  int total = 0;
  for(int i = 1; i < s.length(); i++){
    int tmp = sum(s.substr(i), n-1);
    if(tmp != 0){ 
      total += atoi(s.substr(0, i)) + sum(s.substr(i), n-1);
    }
  }
  return total;
}

int main() {
  string s;
  cin >> s;
  int result = 0;
  for(int i = 0; i < s.length(); i++){
    result += sum(s, i);
  }
  cout << result << endl;
  
}


Compiler output:
a.cc: In function 'int sum(std::string, int)':
a.cc:13:29: error: cannot convert 'std::__cxx11::basic_string<char>' to 'const char*'
   13 |       total += atoi(s.substr(0, i)) + sum(s.substr(i), n-1);
      |                     ~~~~~~~~^~~~~~
      |                             |
      |                             std::__cxx11::basic_string<char>
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 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 <bits/stdc++.h>
using namespace std;
 
int sum(string s, int n){
  if(n == 0) return atoi(s);
  if(s.lenth() <= n) return 0;
  if(s.lenth() == 2 && n == 1) return int(s.at[0] + s.at[1]);

  int total = 0;
  for(int i = 1; i < s.length(); i++){
    int tmp = sum(s.substr(i), n-1);
    if(tmp != 0){ 
      total += atoi(s.substr(0, i)) + sum(s.substr(i), n-1);
    }
  }
  return total;
}

int main() {
  string s;
  cin >> s;
  int result = 0;
  for(int i = 0; i < s.length(); i++){
    result += sum(s, i);
  }
  cout << result << endl;
  
}

Compiler output:
a.cc: In function 'int sum(std::string, int)':
a.cc:5:26: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
    5 |   if(n == 0) return atoi(s);
      |                          ^
      |                          |
      |                          std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 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)
      |                  ~~~~~~~~~~~~^~~~~~
a.cc:6:8: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'lenth'; did you mean 'length'?
    6 |   if(s.lenth() <= n) return 0;
      |        ^~~~~
      |        length
a.cc:7:8: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'lenth'; did you mean 'length'?
    7 |   if(s.lenth() == 2 && n == 1) return int(s.at[0] + s.at[1]);
      |        ^~~~~
      |        length
a.cc:7:47: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
    7 |   if(s.lenth() == 2 && n == 1) return int(s.at[0] + s.at[1]);
      |                                               ^
a.cc:7:57: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
    7 |   if(s.lenth() == 2 && n == 1) return int(s.at[0] + s.at[1]);
      |                                                         ^
a.cc:13:29: error: cannot convert 'std::__cxx11::basic_string<char>' to 'const char*'
   13 |       total += atoi(s.substr(0, i)) + sum(s.substr(i), n-1);
      |                     ~~~~~~~~^~~~~~
      |                             |
      |                             std::__cxx11::basic_string<char>
/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 <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

string S;

int dfs(int i, int sum) {
    if (i == n) return sum;
    return dfs(i + 1, sum) + dfs(i + 1, sum + S[i] - '0');
}

int main() {
    cin >> S;
    cout << dfs(0, S[0] - '0') << endl;
}


Compiler output:
a.cc: In function 'int dfs(int, int)':
a.cc:8:14: error: 'n' was not declared in this scope
    8 |     if (i == n) return sum;
      |              ^
Language: C++

#include <bits/stdc++.h>
#include <math.h>        ////べき乗を使うのに必要
using namespace std;

//int S の桁数を求める関数 dig
int dig(int S) {
  int ans = 0;
  while (true) {
    S /= 10;
    ans++;
    if (S==0) 
      break;
  }
  return ans;  
}
//int S の左からx番目(x=0 始まり)の数字を求める関数 dig_at_i
int dig_at_i(int S, int x) {
  int a = pow(10,dig(S)-x);
  int b = S%a;
  int c = pow(10, dig(S)-x-1);

  return b/c;
}
 
int num(int x) {
  if (x==0)
    return 0;
    
  int ans = 0;
  for (int i=0; i<x; i++) {
    ans += num(i);
  }
  return ans; 
}

int sumA(int S, int x) {
  if (x=0)
    return S;
  
  int a = 0;
  for (int i=0; i<x; i++) {
    ans += sumA(S, i);
  }
  int b = pow(10, dig(S)-x);
  int c = S%b;
  return num(x-1)*c+a;


int main() {
  int S;
  cin >> S;
  int sum=0;
  for (int i=0; i<dig(S); i++) {
    sum += sumA(S, i);
  }
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int sumA(int, int)':
a.cc:42:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   42 |     ans += sumA(S, i);
      |     ^~~
      |     abs
a.cc:49:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   49 | int main() {
      |         ^~
a.cc:49:9: note: remove parentheses to default-initialize a variable
   49 | int main() {
      |         ^~
      |         --
a.cc:49:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:49:12: error: a function-definition is not allowed here before '{' token
   49 | int main() {
      |            ^
a.cc:57:2: error: expected '}' at end of input
   57 | }
      |  ^
a.cc:36:24: note: to match this '{'
   36 | int sumA(int S, int x) {
      |                        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
void sumA(long long S) {
  if (S<10) {
    return S;
  }
    
  return ((S-S%10)/10)+(S%10)+sumA(S);
}

int main() {
  long long S;
  cin >> S;
  cout << sumA(S)+S << endl;
}
 

Compiler output:
a.cc: In function 'void sumA(long long int)':
a.cc:6:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
    6 |     return S;
      |            ^
a.cc:9:30: error: invalid operands of types 'long long int' and 'void' to binary 'operator+'
    9 |   return ((S-S%10)/10)+(S%10)+sumA(S);
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
      |                       |           |
      |                       |           void
      |                       long long int
a.cc: In function 'int main()':
a.cc:15:18: error: invalid operands of types 'void' and 'long long int' to binary 'operator+'
   15 |   cout << sumA(S)+S << endl;
      |           ~~~~~~~^~
      |               |   |
      |               |   long long int
      |               void
Language: C++

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

int main() {
	
	string s;
	cin >> s;

	int n = s.size();
	int b =0;

	for (int bit = 0; bit < (1 << n-1); ++bit){
		bitset<10> a(bit);

		int t = 0;
		t += s.at(n - 1)-'0';
		int c = 0;
		for (int i = 2; i <= n; i++) {
			if (a.test(i-2) == 1) {
				c = 0;
			}
			else {
				c++;
			}
			t += (s.at(n-i)-'0')*pow(10, c);

		}

		b += t;
		
	}

	cout << b << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:46: error: 'pow' was not declared in this scope
   27 |                         t += (s.at(n-i)-'0')*pow(10, c);
      |                                              ^~~
Language: C++

s = input()
n = len(s)
ans = 0
i = 1

def dfs(i, s, ans):
    if i==n:
        #print(i, 'bottom', s, ans)
        ans += sum([int(i) for i in s.split('+')])
        return False, ans
    else:
        #print(i, 'left',s, ans)
        tf, ans = dfs(i+1, s, ans)
        if tf:
            return True, ans
        else:
            #print(i, 'right',s, ans)
            p = i + s.count('+')
            s = s[:p]+'+'+s[p:]
            tf, ans = dfs(i+1,  s, ans)
            return tf, ans

_, a = dfs(i, s, ans)
print(a)

Compiler output:
a.cc:8:10: error: invalid preprocessing directive #print
    8 |         #print(i, 'bottom', s, ans)
      |          ^~~~~
a.cc:12:10: error: invalid preprocessing directive #print
   12 |         #print(i, 'left',s, ans)
      |          ^~~~~
a.cc:17:14: error: invalid preprocessing directive #print
   17 |             #print(i, 'right',s, ans)
      |              ^~~~~
a.cc:1:1: error: 's' does not name a type
    1 | s = input()
      | ^
Language: C++

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

int main()
{
    string S;
    cin >> S;

    int n, ans = 0;
    n = (int)S.size();
    for (int tmp = 0; tmp < (1 << 9); tmp++)
    {
        bitset<9> s(tmp);
        int start = 0;
        for (int i = 0; i < n; i++)
        {
            if (s.test(i))
            {
                string c = S.substr(start, i - start + 1);
                start = i + 1;
                ans += atoi(c.c_str);
            }
        }
        string c = S.substr(start, n - start);
        ans += atoi(c.c_str);
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:31: error: invalid use of non-static member function 'const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
   21 |                 ans += atoi(c.c_str);
      |                             ~~^~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:2640:7: note: declared here
 2640 |       c_str() const _GLIBCXX_NOEXCEPT
      |       ^~~~~
a.cc:25:23: error: invalid use of non-static member function 'const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
   25 |         ans += atoi(c.c_str);
      |                     ~~^~~~~
/usr/include/c++/14/bits/basic_string.h:2640:7: note: declared here
 2640 |       c_str() const _GLIBCXX_NOEXCEPT
      |       ^~~~~
Language: C++

program name
    implicit none
    character(10):: s
    integer(8):: bmax,i,ni,j,ans,nans
    integer(8),allocatable:: bit(:)

    read*, s
    bmax = 2**(len_trim(s)-1)-1
    allocate(bit(len_trim(s)-1))
    ans=0
    do i=0,bmax
        ni=i
        do j=1,size(bit)
            bit(j) = and(ni,1)
            ni = rshift(ni,1)
        end do
        
        nans = ichar(s(1:1)) - ichar('0')

        do j=1,size(bit)
            if (bit(j) == 0)then
                nans=nans*10 + ichar(s(j+1:j+1)) - ichar('0')
            else
                ans=ans+nans
                nans=ichar(s(j+1:j+1)) - ichar('0')
            end if
        end do
        ans=ans+nans
    end do
    
    print*, ans
end program name

Compiler output:
a.cc:1:1: error: 'program' does not name a type
    1 | program name
      | ^~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;

int main(){
    string s;
    cin >> s;
    int64_t ans = 0;
    int64_t tmp;
    for (int bit = 0; bit < (1<<(s.size()-1)); ++bit) {
        tmp = S[0] - '0';
        for (int i = 0; i < s.size()-1; ++i) {
            if (bit&(1 << i)) {
                ans += tmp;
                tmp = 0;
            }
            tmp = tmp * 10 + (s[i + 1] - '0');
        }
        ans += tmp;
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: 'S' was not declared in this scope
   11 |         tmp = S[0] - '0';
      |               ^
Language: C

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

int main() {
 string S;
 cin >> S;
 long int ans;ans=0;
  string mstr="";
  int n=S.size();
  
 for(int tmp=0;tmp<(1<<S.size()-1);tmp++){
 	bitset<10>g(tmp);
   for(int i=0;i<S.size()-1;i++){
     //プラスなら、そこまでの文字列を加え、mstrメモ用のstringをリセット
     if(g.test(i)){
     mstr+=S.at(i);
     ans+=stol(mstr);
     mstr="";
     }
    //プラスでないなら文字列を伸ばすだけ！
     else{
     mstr+=S.at(i);
     }                                
    }
   //さいごの一文字の処理は手動
   mstr+=S.at(n-1);
    ans+=stol(mstr);
    mstr="";
 }
  cout <<ans<<endl; 
  
}
 

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
#define REP(i, n) for(int i=0; i<n; i++)
using namespace std;
using ll = long long;

int ctoi(char c){
	if(c >= '0' && c <= '9'){
		return c - '0';
	}
}

ll fullsearch(int n, int(&a)[10]) {
    int ret = 0;
    for (int bit = 0; bit < (1<<n-1); ++bit)
    {
        ll sum = a[0];
        ll tmp = 0;
        for (int i = 0; i < n-1; ++i) {
            if (bit & (1<<i)) {
                sum += tmp;
                tmp = 0; 
                sum += a[i+1];
            }else{
                tmp = tmp*10+a[i+1];
            }
        }
        sum += tmp;
        ret += sum;
    }
    return ret;
}


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	string S;
    cin >> S;
	N = S.length();
    int a[10];
	for (int i = 0; i < N; i++)
	{
		a[i] = ctoi(S[i]);
	}
	ll ans = fullsearch(N, a);
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:9: error: 'N' was not declared in this scope
   39 |         N = S.length();
      |         ^
a.cc: In function 'int ctoi(char)':
a.cc:10:1: warning: control reaches end of non-void function [-Wreturn-type]
   10 | }
      | ^
Language: C++

#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define INF INT_MAX;
typedef long long ll;
using namespace std;

int N;
ll ans;

void check_sum(string s,int x,vector<bool> &ope){
  if(x==N-1){
    ll sum=0;
    int f=0;
    for(int i=0;i<N-1;i++){
      if(ope.at(i)){
        sum += atoll(s.substr(f,i-f+1).c_str());
        f = i+1;
      }
    }
    sum += atoll(s.substr(f).c_str());
    ans += sum ;
    //puts("###");
    return ;
  }

  ope.at(x)=false;
  check_sum(s,x+1,ope);

  ope.at(x)=true;
  check_sum(s,x+1,ope);
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define INF INT_MAX;
typedef long long ll;
using namespace std;

int N;
ll ans;

void check_sum(string s,int x,vector<bool> &ope){
  if(x==N-1){
    ll sum=0;
    int f=0;
    for(int i=0;i<N-1;i++){
      if(ope.at(i)){
        sum += (ll)(atoi(s.substr(f,i-f+1).c_str()));
        f = i+1;
      }
    }
    sum += (ll)(atoi(s.substr(f).c_str()));
    ans += sum ;
    return ;
  }

  ope.at(x)=false;
  check_sum(s,x+1,ope);

  ope.at(x)=true;
  check_sum(s,x+1,ope);
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

int main(){
  int S;
  cin>>S;
  long ans;
  int len=to_string(S).length;
  for(int i=0;i<(1<<len;i++){
    int dig=1;
    for(int i=0;i<len;i++){
      if(bit & (1<<i){
        ans+=S/10*dig;
        dig=1;
      }else{
        dig++;
      }
    }
  }
  
//    int n = 10;
//
//    // {0, 1, ..., n-1} の部分集合の全探索
//    for (int bit = 0; bit < (1<<n); ++bit)
//    {
//        /* bit で表される集合の処理を書く */
//
//
//        /* きちんとできていることを確認してみる */
/*        // bit の表す集合を求める
        vector<int> S;
        for (int i = 0; i < n; ++i) {
            if (bit & (1<<i)) { // i が bit に入るかどうか
                S.push_back(i);
            }
        }

        // bit の表す集合の出力
        cout << bit << ": {";
        for (int i = 0; i < (int)S.size(); ++i) {
            cout << S[i] << " ";
        }
        cout << "}" << endl;
    }*/

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:24: error: cannot convert 'std::__cxx11::basic_string<char>::length' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'int'
    8 |   int len=to_string(S).length;
      |                        ^~~~~~
a.cc:9:24: error: expected ')' before ';' token
    9 |   for(int i=0;i<(1<<len;i++){
      |                 ~      ^
      |                        )
a.cc:12:10: error: 'bit' was not declared in this scope
   12 |       if(bit & (1<<i){
      |          ^~~
a.cc:12:22: error: expected ')' before '{' token
   12 |       if(bit & (1<<i){
      |         ~            ^
      |                      )
a.cc:18:5: error: expected primary-expression before '}' token
   18 |     }
      |     ^
Language: C++

#include <iostream>
#include <math.h>
#include <string>
#include <sstream>

using namespace std;
istringstream iss;
int sum, num, c;
string S;

int summary(string s, int x){
    //cout << s << " " << s.size() << " " << x << endl;
    if(x == s.size()){
        iss = istringstream(s.substr(0,1));
        iss >> num;
        //cout << x;
        for(int i=1;i<=s.size()-1;i++){
            if(s.substr(i,1)=="+"){
                //printf("%s \n", s.substr(i,1));
                sum += num;
                num = 0;
            }
            else{
                iss = istringstream(s.substr(i,1));
                iss >> c;
                num *= 10;
                num += c;
            }
            //cout << "num = "  << num << endl;
        }

        sum += num;
        //cout << "sum=" << sum << endl;
    }
    
    else {
        string s2 = s;
        summary(s.insert(x,"+"), x+2);
        s = s2;
        summary(s, x+1);
    }

}

int main(){
    
    cin >> S;
  /*
    if(S.size()==1){
        iss = istringstream(S.substr(0,1));
        iss >> sum;
    }
  */
    else if(S.size()==2){
        int x, y, z;
        iss = istringstream(S.substr(0,1));
        iss >> x;
        iss = istringstream(S.substr(1,1));
        iss >> y;
        iss = istringstream(S.substr(0,2));
        iss >> z;
        sum = x + y + z;
    }
  /*
    else{
        sum = 0;
        summary(S, 1);
    }
    */
    cout << sum;
    //S.insert(1,"+");
    //cout << S;

    cout << endl;
}


Compiler output:
a.cc: In function 'int summary(std::string, int)':
a.cc:43:1: warning: no return statement in function returning non-void [-Wreturn-type]
   43 | }
      | ^
a.cc: In function 'int main()':
a.cc:54:5: error: 'else' without a previous 'if'
   54 |     else if(S.size()==2){
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
char s[12345]; 

int main() {
  cin >> s;
  int n = s.size();
  long long ans = 0;
  for(int t = 0; t < (1 << (n-1)); t++){
    long long num = s[0];
    for(int i = 0; i < n-1; i++){
      if (t & (1 << i)) {
        ans = ans + num;
        num = 0;
      }
      num = num*10 + s[i+1];
    }
    ans = ans + num;
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: request for member 'size' in 's', which is of non-class type 'char [12345]'
    7 |   int n = s.size();
      |             ^~~~
Language: C++

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

int calculate(string s) {
    int sum = 0;
    if (s.size()==1) return stoi(s);
    sum += stoi(s) + (int)(s.at(s.size()-1));
    s.pop_back();
    sum += calculate(s);
    return sum;
}

int main() {
  string s;
  cin >> s;
  cout << calculate(s) << endl;
  }
}

Compiler output:
a.cc:19:1: error: expected declaration before '}' token
   19 | }
      | ^
Language: C++

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

int calculate(string s) {
    int sum = 0;
    if (s.size()==1) return stoi(s);
    sum += stoi(s) + ctoi(s.at(s.size()-1)) + calculate(s.pop_back());
    return sum;
}

int main() {
  string s;
  cin >> s;
  cout << calculate(s) << endl;
  }
}

Compiler output:
a.cc: In function 'int calculate(std::string)':
a.cc:8:22: error: 'ctoi' was not declared in this scope; did you mean 'atoi'?
    8 |     sum += stoi(s) + ctoi(s.at(s.size()-1)) + calculate(s.pop_back());
      |                      ^~~~
      |                      atoi
a.cc:8:67: error: invalid use of void expression
    8 |     sum += stoi(s) + ctoi(s.at(s.size()-1)) + calculate(s.pop_back());
      |                                                         ~~~~~~~~~~^~
a.cc: At global scope:
a.cc:17:1: error: expected declaration before '}' token
   17 | }
      | ^