Language: C++

#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
using u8t = std::uint64_t;
using i8t = std::int64_t;
#define F(I,N) for(i8t I=0,_N=N;I<_N;I++)
#define R(V) i8t V;std::cin>>V;
#define RV(V,N) std::vector<i8t> V;F(i,N){R(x)V.push_back(x);}
#define RL1(line) std::getline(std::cin,line);
#define RL(line) std::string line;RL0(line)
#define P(X) std::cout<<(X)<<std::endl;
i8t ipow10(i8t x){i8t r=1;F(i,x)r*=10;return r;}
int main() {
  R(D);
  i8t count = 0;
  //i8t dmin = std::ceil(std::log10(D/9+1)+1);//P(dmin);
  for(i8t d=2;d<=18;d++){
    i8t Dmin=(d&1? 99: 9)*(ipow10(d/2-1));
    //std::cout<<d<<":"<<Dmin<<std::endl;
    if(D<Dmin&&(d&1)==0)break;
    i8t poss = 1;
    auto Drest = D;
    for(i8t i=0;i<d/2;i++){
      i8t mod = ipow10(d-1-2*i)-1;
      i8t lsb = (Drest>=0?Drest:-Drest)%10;
      i8t c = (10-lsb)%10;
      if(Drest>=0){
        Drest -= c*mod;
        poss *= (i==0? 9: 10) - c;
      }else{
        Drest += c*mod;
        poss *= 10-c;
      }
      if(poss<=0||Drest%10!=0){poss=0;break;}
      Drest/=10;
    }
    if((d&1)&&d>1)poss*=10;
    if(Drest)poss=0;
    count+=poss;
  }
  P(count);
  return 0;
}

Compiler output:
a.cc:5:18: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
    5 | using u8t = std::uint64_t;
      |                  ^~~~~~~~
      |                  wint_t
a.cc:6:18: error: 'int64_t' in namespace 'std' does not name a type
    6 | using i8t = std::int64_t;
      |                  ^~~~~~~
a.cc:13:1: error: 'i8t' does not name a type; did you mean 'int'?
   13 | i8t ipow10(i8t x){i8t r=1;F(i,x)r*=10;return r;}
      | ^~~
      | int
a.cc: In function 'int main()':
a.cc:8:14: error: 'i8t' was not declared in this scope; did you mean 'int'?
    8 | #define R(V) i8t V;std::cin>>V;
      |              ^~~
a.cc:15:3: note: in expansion of macro 'R'
   15 |   R(D);
      |   ^
a.cc:8:25: error: 'cin' is not a member of 'std'
    8 | #define R(V) i8t V;std::cin>>V;
      |                         ^~~
a.cc:15:3: note: in expansion of macro 'R'
   15 |   R(D);
      |   ^
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <string>
  +++ |+#include <iostream>
    5 | using u8t = std::uint64_t;
a.cc:15:5: error: 'D' was not declared in this scope
   15 |   R(D);
      |     ^
a.cc:8:30: note: in definition of macro 'R'
    8 | #define R(V) i8t V;std::cin>>V;
      |                              ^
a.cc:16:6: error: expected ';' before 'count'
   16 |   i8t count = 0;
      |      ^~~~~~
      |      ;
a.cc:18:10: error: expected ';' before 'd'
   18 |   for(i8t d=2;d<=18;d++){
      |          ^~
      |          ;
a.cc:18:15: error: 'd' was not declared in this scope
   18 |   for(i8t d=2;d<=18;d++){
      |               ^
a.cc:19:8: error: expected ';' before 'Dmin'
   19 |     i8t Dmin=(d&1? 99: 9)*(ipow10(d/2-1));
      |        ^~~~~
      |        ;
a.cc:21:10: error: 'Dmin' was not declared in this scope; did you mean 'fmin'?
   21 |     if(D<Dmin&&(d&1)==0)break;
      |          ^~~~
      |          fmin
a.cc:22:8: error: expected ';' before 'poss'
   22 |     i8t poss = 1;
      |        ^~~~~
      |        ;
a.cc:24:12: error: expected ';' before 'i'
   24 |     for(i8t i=0;i<d/2;i++){
      |            ^~
      |            ;
a.cc:24:17: error: 'i' was not declared in this scope
   24 |     for(i8t i=0;i<d/2;i++){
      |                 ^
a.cc:25:10: error: expected ';' before 'mod'
   25 |       i8t mod = ipow10(d-1-2*i)-1;
      |          ^~~~
      |          ;
a.cc:26:10: error: expected ';' before 'lsb'
   26 |       i8t lsb = (Drest>=0?Drest:-Drest)%10;
      |          ^~~~
      |          ;
a.cc:27:10: error: expected ';' before 'c'
   27 |       i8t c = (10-lsb)%10;
      |          ^~
      |          ;
a.cc:29:18: error: 'c' was not declared in this scope
   29 |         Drest -= c*mod;
      |                  ^
a.cc:29:20: error: 'mod' was not declared in this scope; did you mean 'modf'?
   29 |         Drest -= c*mod;
      |                    ^~~
      |                    modf
a.cc:30:9: error: 'poss' was not declared in this scope
   30 |         poss *= (i==0? 9: 10) - c;
      |         ^~~~
a.cc:32:18: error: 'c' was not declared in this scope
   32 |         Drest += c*mod;
      |                  ^
a.cc:32:20: error: 'mod' was not declared in this scope; did you mean 'modf'?
   32 |         Drest += c*mod;
      |                    ^~~
      |                    modf
a.cc:33:9: error: 'poss' was not declared in this scope
   33 |         poss *= 10-c;
      |         ^~~~
a.cc:35:10: error: 'poss' was not declared in this scope
   35 |       if(poss<=0||Drest%10!=0){poss=0;break;}
      |          ^~~~
a.cc:38:19: error: 'poss' was not declared in this scope
   38 |     if((d&1)&&d>1)poss*=10;
      |                   ^~~~
a.cc:39:14: error: 'poss' was not declared in this scope
   39 |     if(Drest)poss=0;
      |              ^~~~
a.cc:40:5: error: 'count' was not declared in this scope; did you mean 'std::count'?
   40 |     count+=poss;
      |     ^~~~~
      |     std::count
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: 'std::count' declared here
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
a.cc:40:12: error: 'poss' was not declared in this scope
   40 |     count+=poss;
      |            ^~~~
a.cc:12:19: error: 'cout' is not a member of 'std'
   12 | #define P(X) std::cout<<(X)<<std::endl;
      |                   ^~~~
a.cc:42:3: note: in expansion of macro 'P'
   42 |   P(count);
      |   ^
a.cc:12:19: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
   12 | #define P(X) std::cout<<(X)<<std::endl;
      |                   ^~~~
a.cc:42:3: note: in expansion of macro 'P'
   42 |   P(count);
      |   ^
a.cc:42:5: error: 'count' was not declared in this scope; did you mean 'std::count'?
   42 |   P(count);
      |     ^~~~~
a.cc:12:26: note: in definition of macro 'P'
   12 | #define P(X) std::cout<<(X)<<std::endl;
      |                          ^
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: 'std::count' declared here
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
a.cc:12:35: error: 'endl' is not a member of 'std'
   12 | #define P(X) std::cout<<(X)<<std::endl;
      |                                   ^~~~
a.cc:42:3: note: in expansion of macro 'P'
   42 |   P(count);
      |   ^
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    4 | #include <string>
  +++ |+#include <ostream>
    5 | using u8t = std::uint64_t;