Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = (ll)(1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
ll time10[20];
ll cnt[10];
void init() {
	rep(i, 10) {
		cnt[i] = 10 - i;
	}
	time10[0] = 1;
	rep1(i, 19) {
		time10[i] = time10[i - 1] * 10;
	}
}
int main() {
	init();
	ll d; cin >> d;
	ll ans = 0;
	Rep1(i,2, 18) {
		ll sum = 1; ll c = d;
		rep1(j, i / 2) {
			ll dif = time10[i - j] - time10[j - 1];
			ll r = (c / time10[j - 1]) % 10; r = (r + 10) % 10;
			ll t = 10 - r; if (t == 10)t = 0;
			c -= t * dif;
			if (abs(c) >= dif&&t!=0) {
				c += 10 * dif;
				t = 10 - t;
				else sum *= cnt[t];
			}
			else {
				if (j == 1)sum *= cnt[t] - 1;
				else sum *= cnt[t];
			}
		}
		if (i % 2)sum *= 10;
		if(!c)ans += sum;
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:62:33: error: expected '}' before 'else'
   62 |                                 else sum *= cnt[t];
      |                                 ^~~~
a.cc:59:50: note: to match this '{'
   59 |                         if (abs(c) >= dif&&t!=0) {
      |                                                  ^
a.cc:64:25: error: 'else' without a previous 'if'
   64 |                         else {
      |                         ^~~~
a.cc:65:37: error: 'j' was not declared in this scope
   65 |                                 if (j == 1)sum *= cnt[t] - 1;
      |                                     ^
a.cc:65:55: error: 't' was not declared in this scope
   65 |                                 if (j == 1)sum *= cnt[t] - 1;
      |                                                       ^
a.cc:66:49: error: 't' was not declared in this scope
   66 |                                 else sum *= cnt[t];
      |                                                 ^
a.cc:69:21: error: 'i' was not declared in this scope
   69 |                 if (i % 2)sum *= 10;
      |                     ^
a.cc:69:27: error: 'sum' was not declared in this scope
   69 |                 if (i % 2)sum *= 10;
      |                           ^~~
a.cc:70:21: error: 'c' was not declared in this scope
   70 |                 if(!c)ans += sum;
      |                     ^
a.cc:70:30: error: 'sum' was not declared in this scope
   70 |                 if(!c)ans += sum;
      |                              ^~~
a.cc: At global scope:
a.cc:72:9: error: 'cout' does not name a type
   72 |         cout << ans << endl;
      |         ^~~~
a.cc:73:9: error: expected unqualified-id before 'return'
   73 |         return 0;
      |         ^~~~~~
a.cc:74:1: error: expected declaration before '}' token
   74 | }
      | ^