

'''simple docstring'''



def 						__lowerCamelCase	(       __snake_case					:		Tuple	)	->							Union[str, Any]:






						"""simple docstring"""





						A__					:       str     =0
						A__					:       int     =len(__snake_case	)

						for i in range(n - 1	):
												for j in range(i + 1,		__snake_case	):
																		if arr[i] > arr[j]:
																								num_inversions += 1

						return num_inversions
def 						__lowerCamelCase	(       __snake_case					:		List[Any]	)	->							Dict:






						"""simple docstring"""





						if len(__snake_case	) <= 1:
												return arr, 0
						A__					:       List[Any]     =len(__snake_case	) // 2
						A__					:       Optional[Any]     =arr[0:mid]
						A__					:       Optional[Any]     =arr[mid:]

						A__					:       Tuple     =count_inversions_recursive(__snake_case	)
						A__					:       Tuple     =count_inversions_recursive(__snake_case	)
						A__					:       Optional[Any]     =_count_cross_inversions(__snake_case,		__snake_case	)

						A__					:       Union[str, Any]     =inversion_p + inversions_q + cross_inversions
						return c, num_inversions
def 						__lowerCamelCase	(       __snake_case					:		Union[str, Any],		__snake_case					:		Optional[Any]	)	->							List[Any]:






						"""simple docstring"""





						A__					:       Any     =[]
						A__					:       Union[str, Any]     =0
						while i < len(__snake_case	) and j < len(__snake_case	):
												if p[i] > q[j]:
																		# if P[1] > Q[j], then P[k] > Q[k] for all  i < k <= len(P)
																		# These are all inversions. The claim emerges from the
																		# property that P is sorted.
																		num_inversion += len(__snake_case	) - i
																		r.append(q[j]	)
																		j += 1
												else:
																		r.append(p[i]	)
																		i += 1

						if i < len(__snake_case	):
												r.extend(p[i:]	)
						else:
												r.extend(q[j:]	)

						return r, num_inversion
def 						__lowerCamelCase	(       )	->							str:






						"""simple docstring"""





						A__					:       Any     =[10, 2, 1, 5, 5, 2, 11]

						# this arr has 8 inversions:
						# (10, 2), (10, 1), (10, 5), (10, 5), (10, 2), (2, 1), (5, 2), (5, 2)

						A__					:       Tuple     =count_inversions_bf(__snake_case	)
						A__					:       Dict     =count_inversions_recursive(__snake_case	)

						assert num_inversions_bf == num_inversions_recursive == 8

						print("""number of inversions = """,		__snake_case	)

						# testing an array with zero inversion (a sorted arr_1)

						arr_a.sort()
						A__					:       List[Any]     =count_inversions_bf(__snake_case	)
						A__					:       List[str]     =count_inversions_recursive(__snake_case	)

						assert num_inversions_bf == num_inversions_recursive == 0
						print("""number of inversions = """,		__snake_case	)

						# an empty list should also have zero inversions
						A__					:       int     =[]
						A__					:       List[str]     =count_inversions_bf(__snake_case	)
						A__					:       Tuple     =count_inversions_recursive(__snake_case	)

						assert num_inversions_bf == num_inversions_recursive == 0
						print("""number of inversions = """,		__snake_case	)


if __name__ == "__main__":
		main()




'''simple docstring'''



import math

__snake_case			:     List[Any]										=      10
__snake_case			:     Dict										=      7
__snake_case			:     str										=      BALLS_PER_COLOUR * NUM_COLOURS
def 						__lowerCamelCase	(       __snake_case					:		int = 20	)	->							str:






						"""simple docstring"""





						A__					:       Union[str, Any]     =math.comb(__snake_case,		__snake_case	)
						A__					:       str     =math.comb(NUM_BALLS - BALLS_PER_COLOUR,		__snake_case	)

						A__					:       Optional[int]     =NUM_COLOURS * (1 - missing_colour / total)

						return f"{result:.9f}"


if __name__ == "__main__":
		print(solution(20))

