Language: C++

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

int main(){
  string S;
  cin >> S;
  int sum=0, size, flag=0;
  size = S.size();
  
  vector<int> A(size);
  for(int i=0;i<size;i++){
    A.at(i) = (S.at(i) - '0');
  }
  
  for(int tmp=0;tmp < (1 << 9);tmp++){
    bitset(10) p(tmp);
    p.set(9);
    for(int i=0;i<size;i++){
      if(p.test(i)){
        while(flag > 0){
          sum += A.at(i-flag) * pow(10,flag);
          flag--;
        }
        sum += A.at(i);
      }else{
        flag++;
      }
    }
    cout << sum << endl;
  }
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: class template argument deduction failed:
   16 |     bitset(10) p(tmp);
      |              ^
a.cc:16:14: error: no matching function for call to 'bitset(int)'
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bitset:1020:9: note: candidate: 'template<long unsigned int _Nb, class _CharT> bitset(const _CharT*, typename std::__bitset::__string<_CharT>::size_type, _CharT, _CharT)-> std::bitset<_Nb>'
 1020 |         bitset(const _CharT* __str,
      |         ^~~~~~
/usr/include/c++/14/bitset:1020:9: note:   template argument deduction/substitution failed:
a.cc:16:14: note:   mismatched types 'const _CharT*' and 'int'
   16 |     bitset(10) p(tmp);
      |              ^
/usr/include/c++/14/bitset:996:9: note: candidate: 'template<long unsigned int _Nb, class _CharT, class _Traits, class _Alloc> bitset(const std::__cxx11::basic_string<_Ch_type, _St, _Sa>&, std::size_t, std::size_t, _CharT, _CharT)-> std::bitset<_Nb>'
  996 |         bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s,
      |         ^~~~~~
/usr/include/c++/14/bitset:996:9: note:   candidate expects 4 arguments, 1 provided
/usr/include/c++/14/bitset:984:9: note: candidate: 'template<long unsigned int _Nb, class _CharT, class _Traits, class _Alloc> bitset(const std::__cxx11::basic_string<_Ch_type, _St, _Sa>&, std::size_t, std::size_t)-> std::bitset<_Nb>'
  984 |         bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s,
      |         ^~~~~~
/usr/include/c++/14/bitset:984:9: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bitset:962:9: note: candidate: 'template<long unsigned int _Nb, class _CharT, class _Traits, class _Alloc> bitset(const std::__cxx11::basic_string<_Ch_type, _St, _Sa>&, std::size_t)-> std::bitset<_Nb>'
  962 |         bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s,
      |         ^~~~~~
/usr/include/c++/14/bitset:962:9: note:   template argument deduction/substitution failed:
a.cc:16:14: note:   mismatched types 'const std::__cxx11::basic_string<_Ch_type, _St, _Sa>' and 'int'
   16 |     bitset(10) p(tmp);
      |              ^
/usr/include/c++/14/bitset:941:17: note: candidate: 'template<long unsigned int _Nb> bitset(long long unsigned int)-> std::bitset<_Nb>'
  941 |       constexpr bitset(unsigned long long __val) noexcept
      |                 ^~~~~~
/usr/include/c++/14/bitset:941:17: note:   template argument deduction/substitution failed:
a.cc:16:14: note:   couldn't deduce template parameter '_Nb'
   16 |     bitset(10) p(tmp);
      |              ^
/usr/include/c++/14/bitset:936:26: note: candidate: 'template<long unsigned int _Nb> bitset()-> std::bitset<_Nb>'
  936 |       _GLIBCXX_CONSTEXPR bitset() _GLIBCXX_NOEXCEPT
      |                          ^~~~~~
/usr/include/c++/14/bitset:936:26: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bitset:804:11: note: candidate: 'template<long unsigned int _Nb> bitset(std::bitset<_Nb>)-> std::bitset<_Nb>'
  804 |     class bitset
      |           ^~~~~~
/usr/include/c++/14/bitset:804:11: note:   template argument deduction/substitution failed:
a.cc:16:14: note:   mismatched types 'std::bitset<_Nb>' and 'int'
   16 |     bitset(10) p(tmp);
      |              ^
a.cc:17:5: error: 'p' was not declared in this scope
   17 |     p.set(9);
      |     ^