





from itertools import product





def      _UpperCamelCase  (a__ :int ,      a__ :int							):






							"""simple docstring"""





							UpperCamelCase__					  =      sides_number
							UpperCamelCase__					  =      max_face_number * dice_number
							UpperCamelCase__					  =      [0] * (max_total + 1)

							UpperCamelCase__					  =      1
							UpperCamelCase__					  =      range(a__ ,      max_face_number + 1							)
							for dice_numbers in product(a__ ,      repeat=a__							):
														UpperCamelCase__					  =      sum(a__							)
														totals_frequencies[total] += 1

							return totals_frequencies





def      _UpperCamelCase  ():






							"""simple docstring"""





							UpperCamelCase__					  =      total_frequency_distribution(
							    sides_number=4 ,      dice_number=9							)
							UpperCamelCase__					  =      total_frequency_distribution(
							    sides_number=6 ,      dice_number=6							)

							UpperCamelCase__					  =      0
							UpperCamelCase__					  =      9
							UpperCamelCase__					  =      4 * 9
							UpperCamelCase__					  =      6
							for peter_total in range(a__ ,      max_peter_total + 1							):
														peter_wins_count += peter_totals_frequencies[peter_total] * sum(
														    colin_totals_frequencies[min_colin_total:peter_total]							)

							UpperCamelCase__					  =      (4**9) * (6**6)
							UpperCamelCase__					  =      peter_wins_count / total_games_number

							UpperCamelCase__					  =      round(a__ ,      ndigits=7							)

							return rounded_peter_win_probability


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











import unittest

import torch

from diffusers import VQModel
from diffusers.utils import floats_tensor, torch_device
from diffusers.utils.testing_utils import enable_full_determinism

from .test_modeling_common import ModelTesterMixin, UNetTesterMixin


enable_full_determinism()

class 							__SCREAMING_SNAKE_CASE       (  _a ,		_a ,		unittest.TestCase							):
							snake_case  :   List[str]      =							VQModel
							snake_case  :   Dict      =							"""sample"""






							@property
							def 					_lowerCamelCase		(    self	,			__lowerCAmelCase=(32, 32)	):
														UpperCamelCase__					  =      4
														UpperCamelCase__					  =      3

														UpperCamelCase__					  =      floats_tensor((batch_size, num_channels) + sizes	).to(__lowerCAmelCase	)

														return {"sample": image}






							@property
							def 					_lowerCamelCase		(    self	):
														return (3, 32, 32)






							@property
							def 					_lowerCamelCase		(    self	):
														return (3, 32, 32)






							def 					_lowerCamelCase		(    self	):
														UpperCamelCase__					  =      {
														    """block_out_channels""": [32, 64],
														    """in_channels""": 3,
														    """out_channels""": 3,
														    """down_block_types""": ["""DownEncoderBlock2D""", """DownEncoderBlock2D"""],
														    """up_block_types""": ["""UpDecoderBlock2D""", """UpDecoderBlock2D"""],
														    """latent_channels""": 3,
														}
														UpperCamelCase__					  =      self.dummy_input
														return init_dict, inputs_dict






							def 					_lowerCamelCase		(    self	):
														pass






							def 					_lowerCamelCase		(    self	):
														pass






							def 					_lowerCamelCase		(    self	):
														UpperCamelCase__  ,  UpperCamelCase__					  =      VQModel.from_pretrained("""fusing/vqgan-dummy"""	,			output_loading_info=__lowerCAmelCase	)
														self.assertIsNotNone(__lowerCAmelCase	)
														self.assertEqual(len(loading_info["""missing_keys"""]	)	,			0	)

														model.to(__lowerCAmelCase	)
														UpperCamelCase__					  =      model(**self.dummy_input	)

														assert image is not None, "Make sure output is not None"







							def 					_lowerCamelCase		(    self	):
														UpperCamelCase__					  =      VQModel.from_pretrained("""fusing/vqgan-dummy"""	)
														model.to(__lowerCAmelCase	).eval()

														torch.manual_seed(0	)
														if torch.cuda.is_available():
																					torch.cuda.manual_seed_all(0	)

														UpperCamelCase__					  =      torch.randn(1	,			model.config.in_channels	,			model.config.sample_size	,			model.config.sample_size	)
														UpperCamelCase__					  =      image.to(__lowerCAmelCase	)
														with torch.no_grad():
																					UpperCamelCase__					  =      model(__lowerCAmelCase	).sample

														UpperCamelCase__					  =      output[0, -1, -3:, -3:].flatten().cpu()
														# fmt: off
														UpperCamelCase__					  =      torch.tensor([-0.0153, -0.4044, -0.1880, -0.5161, -0.2418, -0.4072, -0.1612, -0.0633, -0.0143]	)
														# fmt: on
														self.assertTrue(torch.allclose(__lowerCAmelCase	,			__lowerCAmelCase	,			atol=1E-3	)	)




