Language: C++

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>

#define fo(i,a,b) for(int i=a;i<=b;i++)

typedef long long LL;
	
using namespace std;

LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
LL a[10];
int l;
int cnt;

void dfs(int x,LL d,int c){
	if (x>l){
		if (d==0)cnt+=c;
		return;
	}
	if (d>=1ll*a[x]*10||d<=-1ll*a[x]*10)return;
	fo(i,1,9){
		if (x==1)dfs(x+1,d-1ll*i*a[x],c*(9-i));
		else dfs(x+1,d-1ll*i*a[x],c*(10-i));
	}
	if (x==1)dfs(x+1,d,c*9);
	else dfs(x+1,d,c*10);
	fo(i,-9,-1){
		if (x==1)dfs(x+1,d-1ll*i*a[x],c*(9+i));
		else dfs(x+1,d-1ll*i*a[x],c*(10+i));
	}
}

int main(){
	int d;
	scanf("%d",&d);
	int ans=0;
	for(int len=2;len<=18;len++){
		for(int i=1;i<=len/2;i++)a[i]=mi10[len-i]-mi10[i-1];
		l=len/2;
		cnt=0;
		dfs(1,d,1);
		if (len&1)cnt=cnt*10;
		ans=ans+cnt;
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc:12:19: error: narrowing conversion of '1.0e+2' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                   ^~~~
a.cc:12:24: error: narrowing conversion of '1.0e+3' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                        ^~~
a.cc:12:28: error: narrowing conversion of '1.0e+4' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                            ^~~
a.cc:12:32: error: narrowing conversion of '1.0e+5' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                                ^~~
a.cc:12:36: error: narrowing conversion of '1.0e+6' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                                    ^~~
a.cc:12:40: error: narrowing conversion of '1.0e+7' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                                        ^~~
a.cc:12:44: error: narrowing conversion of '1.0e+8' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                                            ^~~
a.cc:12:48: error: narrowing conversion of '1.0e+9' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                                                ^~~
a.cc:12:52: error: narrowing conversion of '1.0e+10' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                                                    ^~~~
a.cc:12:57: error: narrowing conversion of '1.0e+11' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                                                         ^~~~
a.cc:12:62: error: narrowing conversion of '1.0e+12' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                                                              ^~~~
a.cc:12:67: error: narrowing conversion of '1.0e+13' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                                                                   ^~~~
a.cc:12:72: error: narrowing conversion of '1.0e+14' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                                                                        ^~~~
a.cc:12:77: error: narrowing conversion of '1.0e+15' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                                                                             ^~~~
a.cc:12:82: error: narrowing conversion of '1.0e+16' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                                                                                  ^~~~
a.cc:12:87: error: narrowing conversion of '1.0e+17' from 'double' to 'LL' {aka 'long long int'} [-Wnarrowing]
   12 | LL mi10[20]={1,10,1e+2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17};
      |                                                                                       ^~~~