Language: C++

#include <bits/stdc++.h>
using namespace std;
ll bs[20];
ll D,calc0[20], calc[20];
ll a[20],an,ans;
void dfs(int x,ll v,ll c)
{
	if(x == an)
	{
		ans += (v == D) * c;
		return;
	}
	if(abs(v - D) > a[x] * 20)return;
	for(int i = 0;i<20;i++)
	{
		int cnt;
		if(!x) cnt = calc0[i];
		else cnt = calc[i];
		if(!a[x])cnt = i < 10;
		if(!cnt) continue;
		dfs(x + 1, v + (i - 10) * a[x], c * cnt);
	}
}
void solve(int n)
{
	an = 0;
	for(int i = 0; i < n; i ++)
	{
		if(i > n - i - 1)break;
		a[an ++] = bs[n - i - 1] - bs[i];
	}
	dfs(0, 0, 1);
}
int main()
{
	for(int i = 0; i <= 9; i ++)
		for(int j = 0; j <= 9; j ++)
			calc[i - j + 10] ++;

	for(int i = 0; i <= 9; i ++)
		for(int j = 1; j <= 9; j ++)
			calc0[i - j + 10] ++;

	bs[0] = 1;
	for(int i = 1; i < 19; i ++)
        bs[i] = bs[i - 1] * 10;
	cin >> D;
	for(int i = 1; i <= 19; i ++)
		solve(i);
	cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc:3:1: error: 'll' does not name a type
    3 | ll bs[20];
      | ^~
a.cc:4:1: error: 'll' does not name a type
    4 | ll D,calc0[20], calc[20];
      | ^~
a.cc:5:1: error: 'll' does not name a type
    5 | ll a[20],an,ans;
      | ^~
a.cc:6:16: error: 'll' has not been declared
    6 | void dfs(int x,ll v,ll c)
      |                ^~
a.cc:6:21: error: 'll' has not been declared
    6 | void dfs(int x,ll v,ll c)
      |                     ^~
a.cc: In function 'void dfs(int, int, int)':
a.cc:8:17: error: 'an' was not declared in this scope; did you mean 'yn'?
    8 |         if(x == an)
      |                 ^~
      |                 yn
a.cc:10:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |                 ans += (v == D) * c;
      |                 ^~~
      |                 abs
a.cc:10:30: error: 'D' was not declared in this scope
   10 |                 ans += (v == D) * c;
      |                              ^
a.cc:13:20: error: 'D' was not declared in this scope
   13 |         if(abs(v - D) > a[x] * 20)return;
      |                    ^
a.cc:13:25: error: 'a' was not declared in this scope
   13 |         if(abs(v - D) > a[x] * 20)return;
      |                         ^
a.cc:17:30: error: 'calc0' was not declared in this scope
   17 |                 if(!x) cnt = calc0[i];
      |                              ^~~~~
a.cc:18:28: error: 'calc' was not declared in this scope
   18 |                 else cnt = calc[i];
      |                            ^~~~
a.cc:19:21: error: 'a' was not declared in this scope
   19 |                 if(!a[x])cnt = i < 10;
      |                     ^
a.cc:21:43: error: 'a' was not declared in this scope
   21 |                 dfs(x + 1, v + (i - 10) * a[x], c * cnt);
      |                                           ^
a.cc: In function 'void solve(int)':
a.cc:26:9: error: 'an' was not declared in this scope; did you mean 'n'?
   26 |         an = 0;
      |         ^~
      |         n
a.cc:30:17: error: 'a' was not declared in this scope
   30 |                 a[an ++] = bs[n - i - 1] - bs[i];
      |                 ^
a.cc:30:28: error: 'bs' was not declared in this scope; did you mean 'abs'?
   30 |                 a[an ++] = bs[n - i - 1] - bs[i];
      |                            ^~
      |                            abs
a.cc: In function 'int main()':
a.cc:38:25: error: 'calc' was not declared in this scope
   38 |                         calc[i - j + 10] ++;
      |                         ^~~~
a.cc:42:25: error: 'calc0' was not declared in this scope
   42 |                         calc0[i - j + 10] ++;
      |                         ^~~~~
a.cc:44:9: error: 'bs' was not declared in this scope; did you mean 'abs'?
   44 |         bs[0] = 1;
      |         ^~
      |         abs
a.cc:47:16: error: 'D' was not declared in this scope
   47 |         cin >> D;
      |                ^
a.cc:50:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   50 |         cout<<ans<<endl;
      |               ^~~
      |               abs