Language: C++

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define rep(n,m) for(int i = n; i < m; i++)

int main(void) {
	long int num[10];
	int n;
	int count = 0;
	cin >> n;
	rep(0, n) {
		cin >> num[i];
	}
	int diff[3] = { -1,0,1 };
	bool output[10] = { false,false,false,false,false,false,false,false,false,false };
	for (int a = 0; a < 3; a++) {
		if (n < 1) break;
		long long int ans = 1;
		if (num[0] + diff[a] == 0) {
			count++;
			output[9] = true;
			output[8] = true;
			output[7] = true;
			output[6] = true;
			output[5] = true;
			output[4] = true;
			output[3] = true;
			output[2] = true;
			output[1] = true;
			output[0] = true;
			continue;
		}
		ans *= (num[0] + diff[a]);
		for (int b = 0; b < 3; b++) {
			if (n < 2) break;
			if (num[1] + diff[b] == 0) {
				count++;
				output[9] = true;
				output[8] = true;
				output[7] = true;
				output[6] = true;
				output[5] = true;
				output[4] = true;
				output[3] = true;
				output[2] = true;
				output[1] = true;
				output[0] = true;
				continue;
			}
			ans *= (num[1] + diff[b]);
			for (int c = 0; c < 3; c++) {
				if (n < 3) break;
				if (num[2] + diff[c] == 0) {
					count++;
					output[9] = true;
					output[8] = true;
					output[7] = true;
					output[6] = true;
					output[5] = true;
					output[4] = true;
					output[3] = true;
					output[2] = true;
					output[1] = true;
					output[0] = true;
					continue;
				}
				ans *= (num[2] + diff[c]);
				for (int d = 0; d < 3; d++) {
					if (n < 4) break;
					if (num[3] + diff[d] == 0) {
						count++;
						output[9] = true;
						output[8] = true;
						output[7] = true;
						output[6] = true;
						output[5] = true;
						output[4] = true;
						output[3] = true;
						output[2] = true;
						output[1] = true;
						output[0] = true;
						continue;
					}
					ans *= (num[3] + diff[d]);
					
						for (int f = 0; f < 3; f++) {
							if (n < 5) break;
							if (num[4] + diff[f] == 0) {
								count++;
								output[9] = true;
								output[8] = true;
								output[7] = true;
								output[6] = true;
								output[5] = true;
								output[4] = true;
								output[3] = true;
								output[2] = true;
								output[1] = true;
								output[0] = true;
								continue;
							}
							ans *= (num[4] + diff[f]);
							for (int g = 0; g < 3; g++) {
								if (n < 6) break;
								if (num[5] + diff[g] == 0) {
									count++;
									output[9] = true;
									output[8] = true;
									output[7] = true;
									output[6] = true;
									output[5] = true;
									output[4] = true;
									output[3] = true;
									output[2] = true;
									output[1] = true;
									output[0] = true;
									continue;
								}
								ans *= (num[5] + diff[g]);
								for (int h = 0; h < 3; h++) {
									if (n < 7) break;
									if(num[6] + diff[h] == 0) {
										count++;
										output[9] = true;
										output[8] = true;
										output[7] = true;
										output[6] = true;
										output[5] = true;
										output[4] = true;
										output[3] = true;
										output[2] = true;
										output[1] = true;
										output[0] = true;
										continue;
									}
									ans *= (num[6] + diff[h]);
									for (int i = 0; i < 3; i++) {
										if (n < 8) break;
										if (num[7] + diff[i] == 0) {
											count++;
											output[9] = true;
											output[8] = true;
											output[7] = true;
											output[6] = true;
											output[5] = true;
											output[4] = true;
											output[3] = true;
											output[2] = true;
											output[1] = true;
											output[0] = true;
											continue;
										}
										ans *= (num[7] + diff[i]);
										for (int j = 0; j < 3; j++) {
											if (n < 9) break;
											if (num[8] + diff[j] == 0) {
												count++;
												output[9] = true;
												output[8] = true;
												output[7] = true;
												output[6] = true;
												output[5] = true;
												output[4] = true;
												output[3] = true;
												output[2] = true;
												output[1] = true;
												output[0] = true;
												continue;
											}
											ans *= (num[8] + diff[j]);
											if(num[9] + diff[k] == 0){
													count++;
													output[9] = true;
													output[8] = true;
													output[7] = true;
													output[6] = true;
													output[5] = true;
													output[4] = true;
													output[3] = true;
													output[2] = true;
													output[1] = true;
													output[0] = true;
													continue;
												}
											for (int k = 0; k < 3; k++) {
												if (n < 10) break;
												if(num[9] + diff[k] == 0){
													count++;
													output[9] = true;
													output[8] = true;
													output[7] = true;
													output[6] = true;
													output[5] = true;
													output[4] = true;
													output[3] = true;
													output[2] = true;
													output[1] = true;
													output[0] = true;
													continue;
												}
												ans *= (num[9] + diff[k]);
												if (ans % 2 == 0) {
													count++;
													output[9] = true;
													output[8] = true;
													output[7] = true;
													output[6] = true;
													output[5] = true;
													output[4] = true;
													output[3] = true;
													output[2] = true;
													output[1] = true;
													output[0] = true;

													
												}
												ans /= (num[9] + diff[k]);
											}
											if (!output[9] && ans % 2 == 0) {
												count++;
												output[8] = true;
												output[7] = true;
												output[6] = true;
												output[5] = true;
												output[4] = true;
												output[3] = true;
												output[2] = true;
												output[1] = true;
												output[0] = true;
											}
												ans /= (num[8] + diff[j]);
											
										}
										if (!output[8] && ans % 2 == 0) {
											count++;
											output[7] = true;
											
											output[6] = true;
											output[5] = true;
											output[4] = true;
											output[3] = true;
											output[2] = true;
											output[1] = true;
											output[0] = true;
										}
											ans /= (num[7] + diff[i]);
										
									}
									if (!output[7] && ans % 2 == 0) {
										count++;
										output[6] = true;
									
										output[5] = true;
										output[4] = true;
										output[3] = true;
										output[2] = true;
										output[1] = true;
										output[0] = true;
									}
										ans /= (num[6] + diff[h]);
									
								}
								if (!output[6] && ans % 2 == 0) {
									count++;
									output[5] = true;
							
									output[4] = true;
									output[3] = true;
									output[2] = true;
									output[1] = true;
									output[0] = true;
								}
									ans /= (num[5] + diff[g]);
								
							}
							if (!output[5] && ans % 2 == 0) {
								count++;
								
								output[4] = true;
								output[3] = true;
								output[2] = true;
								output[1] = true;
								output[0] = true;
							}
								ans /= (num[4] + diff[f]);
							
						}
						if (!output[4] && ans % 2 == 0) {
							count++;
							
							output[3] = true;
							output[2] = true;
							output[1] = true;
							output[0] = true;
						}
							ans /= (num[3] + diff[d]);
						
					}
					if (!output[3] && ans % 2 == 0) {
						count++;
						
						output[2] = true;
						output[1] = true;
						output[0] = true;
					}
						ans /= (num[2] + diff[c]);
					
				}
				if (!output[2] && ans % 2 == 0) {
					count++;
					
					output[1] = true;
					output[0] = true;
				}
					ans /= (num[1] + diff[b]);
				
			}
			if (!output[1] && ans % 2 == 0) {
				count++;
				output[0] = true;
			}
				ans /= (num[0] + diff[a]);
			
		}

	

	cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:223:106: error: 'k' was not declared in this scope
  223 |                                                                                         if(num[9] + diff[k] == 0){
      |                                                                                                          ^