'''simple docstring'''





lowerCAmelCase_	:		List[Any]			=     [0, 2, 4, 6, 8]
lowerCAmelCase_	:		str			=     [1, 3, 5, 7, 9]
def 						__A							(     UpperCAmelCase     ,UpperCAmelCase     ,UpperCAmelCase     ,UpperCAmelCase					)     ->			int:




						'''simple docstring'''
						if remaining_length == 0:
												if digits[0] == 0 or digits[-1] == 0:
																		return 0

												for i in range(length // 2 - 1     ,-1     ,-1					):
																		remainder += digits[i] + digits[length - i - 1]

																		if remainder % 2 == 0:
																								return 0

																		remainder //= 1_0

												return 1

						if remaining_length == 1:
												if remainder % 2 == 0:
																		return 0

												_UpperCamelCase			:			Union[str, Any]   			=						0
												for digit in range(1_0					):
																		_UpperCamelCase			:			Union[str, Any]   			=						digit
																		result += reversible_numbers(
																		    0     ,(remainder + 2 * digit) // 1_0     ,UpperCAmelCase     ,UpperCAmelCase					)
												return result

						_UpperCamelCase			:			str   			=						0
						for digita in range(1_0					):
												_UpperCamelCase			:			Union[str, Any]   			=						digita

												if (remainder + digita) % 2 == 0:
																		_UpperCamelCase			:			Dict   			=						ODD_DIGITS
												else:
																		_UpperCamelCase			:			Dict   			=						EVEN_DIGITS

												for digita in other_parity_digits:
																		_UpperCamelCase			:			Tuple   			=						digita
																		result += reversible_numbers(
																		    remaining_length - 2     ,(remainder + digita + digita) // 1_0     ,UpperCAmelCase     ,UpperCAmelCase     ,)
						return result
def 						__A							(     UpperCAmelCase = 9					)     ->			int:




						'''simple docstring'''
						_UpperCamelCase			:			Tuple   			=						0
						for length in range(1     ,max_power + 1					):
												result += reversible_numbers(UpperCAmelCase     ,0     ,[0] * length     ,UpperCAmelCase					)
						return result


if __name__ == "__main__":
			print(f"""{solution() = }""")



'''simple docstring'''





import argparse
import logging
import pickle
from collections import Counter


logging.basicConfig(
    format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO
)
lowerCAmelCase_	:		Optional[int]			=     logging.getLogger(__name__)

if __name__ == "__main__":
			lowerCAmelCase_	:		Optional[Any]			=     argparse.ArgumentParser(
			    description="""Token Counts for smoothing the masking probabilities in MLM (cf XLM/word2vec)"""
			)
			parser.add_argument(
			    """--data_file""", type=str, default="""data/dump.bert-base-uncased.pickle""", help="""The binarized dataset."""
			)
			parser.add_argument(
			    """--token_counts_dump""", type=str, default="""data/token_counts.bert-base-uncased.pickle""", help="""The dump file."""
			)
			parser.add_argument("""--vocab_size""", default=3_0522, type=int)
			lowerCAmelCase_	:		str			=     parser.parse_args()

			logger.info(f"""Loading data from {args.data_file}""")
			with open(args.data_file, """rb""") as fp:
						lowerCAmelCase_	:		Tuple			=     pickle.load(fp)

			logger.info("""Counting occurrences for MLM.""")
			lowerCAmelCase_	:		str			=     Counter()
			for tk_ids in data:
						counter.update(tk_ids)
			lowerCAmelCase_	:		Any			=     [0] * args.vocab_size
			for k, v in counter.items():
						lowerCAmelCase_	:		Optional[Any]			=     v

			logger.info(f"""Dump to {args.token_counts_dump}""")
			with open(args.token_counts_dump, """wb""") as handle:
						pickle.dump(counts, handle, protocol=pickle.HIGHEST_PROTOCOL)


