




'''simple docstring'''





from __future__ import annotations

import os




class 				_snake_case	:
			lowerCAmelCase_  :   List[Any]		 =					(
			    "High card",
			    "One pair",
			    "Two pairs",
			    "Three of a kind",
			    "Straight",
			    "Flush",
			    "Full house",
			    "Four of a kind",
			    "Straight flush",
			    "Royal flush",
			)

			lowerCAmelCase_  :   Dict		 =					(
			    "",  # placeholder as tuples are zero-indexed
			    "One",
			    "Two",
			    "Three",
			    "Four",
			    "Five",
			    "Six",
			    "Seven",
			    "Eight",
			    "Nine",
			    "Ten",
			    "Jack",
			    "Queen",
			    "King",
			    "Ace",
			)




			def __init__(      self       ,							a__							)       ->       None:

										'''simple docstring'''




										if not isinstance(a__       ,							a__							):
																	snake_case_			      =   F'Hand should be of type \'str\': {hand!r}'
																	raise TypeError(a__							)
										# split removes duplicate whitespaces so no need of strip
										if len(hand.split(" "							)							) != 5:
																	snake_case_			      =   F'Hand should contain only 5 cards: {hand!r}'
																	raise ValueError(a__							)
										snake_case_			      =   hand
										snake_case_			      =   0
										snake_case_			      =   0
										snake_case_      ,   snake_case_			      =   self._internal_state()
										snake_case_			      =   self._get_hand_type()
										snake_case_			      =   self._card_values[0]




			@property
			def      lowerCAmelCase__       (      self							)       ->       List[Any]:

										'''simple docstring'''




										return self._hand




			def      lowerCAmelCase__       (      self       ,							a__							)       ->       str:

										'''simple docstring'''




										if self._hand_type > other._hand_type:
																	return "Win"
										elif self._hand_type < other._hand_type:
																	return "Loss"
										elif self._first_pair == other._first_pair:
																	if self._second_pair == other._second_pair:
																								return self._compare_cards(a__							)
																	else:
																								return "Win" if self._second_pair > other._second_pair else "Loss"
										return "Win" if self._first_pair > other._first_pair else "Loss"




			def      lowerCAmelCase__       (      self							)       ->       str:

										'''simple docstring'''




										snake_case_			      =   PokerHand._HAND_NAME[self._hand_type - 14]
										snake_case_			      =   PokerHand._CARD_NAME[self._high_card]
										snake_case_			      =   PokerHand._CARD_NAME[self._first_pair]
										snake_case_			      =   PokerHand._CARD_NAME[self._second_pair]
										if self._hand_type in [22, 19, 18]:
																	return name + F', {high}-high'
										elif self._hand_type in [21, 17, 15]:
																	return name + F', {paira}s'
										elif self._hand_type in [20, 16]:
																	snake_case_			      =   "over" if self._hand_type == 20 else "and"
																	return name + F', {paira}s {join} {paira}s'
										elif self._hand_type == 23:
																	return name
										else:
																	return name + F', {high}'




			def      lowerCAmelCase__       (      self       ,							a__							)       ->       str:

										'''simple docstring'''




										for index, card_value in enumerate(self._card_values							):
																	if card_value != other._card_values[index]:
																								return "Win" if card_value > other._card_values[index] else "Loss"
										return "Tie"




			def      lowerCAmelCase__       (      self							)       ->       int:

										'''simple docstring'''




										if self._is_flush():
																	if self._is_five_high_straight() or self._is_straight():
																								return 23 if sum(self._card_values							) == 60 else 22
																	return 19
										elif self._is_five_high_straight() or self._is_straight():
																	return 18
										return 14 + self._is_same_kind()




			def      lowerCAmelCase__       (      self							)       ->       bool:

										'''simple docstring'''




										return len(self._card_suit							) == 1




			def      lowerCAmelCase__       (      self							)       ->       bool:

										'''simple docstring'''




										if sorted(self._card_values							) == [2, 3, 4, 5, 14]:
																	if self._card_values[0] == 14:
																								# Remember, our list is sorted in reverse order
																								snake_case_			      =   self._card_values.pop(0							)
																								self._card_values.append(a__							)
																	return True
										return False




			def      lowerCAmelCase__       (      self							)       ->       bool:

										'''simple docstring'''




										for i in range(4							):
																	if self._card_values[i] - self._card_values[i + 1] != 1:
																								return False
										return True




			def      lowerCAmelCase__       (      self							)       ->       int:

										'''simple docstring'''




										snake_case_			      =   snake_case_			      =   snake_case_			      =   0
										for i in range(4							):
																	# Compare two cards at a time, if they are same increase 'kind',
																	# add the value of the card to val1, if it is repeating again we
																	# will add 2 to 'kind' as there are now 3 cards with same value.
																	# If we get card of different value than val1, we will do the same
																	# thing with val2
																	if self._card_values[i] == self._card_values[i + 1]:
																								if not vala:
																															snake_case_			      =   self._card_values[i]
																															kind += 1
																								elif vala == self._card_values[i]:
																															kind += 2
																								elif not vala:
																															snake_case_			      =   self._card_values[i]
																															kind += 1
																								elif vala == self._card_values[i]:
																															kind += 2
        # For consistency in hand type (look at note in _get_hand_type function)
										snake_case_			      =   kind + 2 if kind in [4, 5] else kind
										# first meaning first pair to compare in 'compare_with'
										snake_case_			      =   max(a__       ,							a__							)
										snake_case_			      =   min(a__       ,							a__							)
										# If it's full house (three count pair + two count pair), make sure
										# first pair is three count and if not then switch them both.
										if kind == 6 and self._card_values.count(a__							) != 3:
																	snake_case_      ,   snake_case_			      =   second, first
										snake_case_			      =   first
										snake_case_			      =   second
										return kind




			def      lowerCAmelCase__       (      self							)       ->       tuple[list[int], set[str]]:

										'''simple docstring'''




										snake_case_			      =   {"T": "10", "J": "11", "Q": "12", "K": "13", "A": "14"}
										snake_case_			      =   self._hand.translate(str.maketrans(a__							)							).split()
										snake_case_			      =   [int(card[:-1]							) for card in new_hand]
										snake_case_			      =   {card[-1] for card in new_hand}
										return sorted(a__       ,							reverse=a__							), card_suit




			def __repr__(      self							)       ->       Optional[Any]:

										'''simple docstring'''




										return F'{self.__class__}("{self._hand}")'




			def __str__(      self							)       ->       Union[str, Any]:

										'''simple docstring'''




										return self._hand




			def __eq__(      self       ,							a__							)       ->       str:

										'''simple docstring'''




										if isinstance(a__       ,							a__							):
																	return self.compare_with(a__							) == "Tie"
										return NotImplemented




			def __lt__(      self       ,							a__							)       ->       str:

										'''simple docstring'''




										if isinstance(a__       ,							a__							):
																	return self.compare_with(a__							) == "Loss"
										return NotImplemented




			def __le__(      self       ,							a__							)       ->       List[str]:

										'''simple docstring'''




										if isinstance(a__       ,							a__							):
																	return self < other or self == other
										return NotImplemented




			def __gt__(      self       ,							a__							)       ->       Any:

										'''simple docstring'''




										if isinstance(a__       ,							a__							):
																	return not self < other and self != other
										return NotImplemented




			def __ge__(      self       ,							a__							)       ->       Optional[int]:

										'''simple docstring'''




										if isinstance(a__       ,							a__							):
																	return not self < other
										return NotImplemented




			def __hash__(      self							)       ->       Any:

										'''simple docstring'''




										return object.__hash__(self							)


def   UpperCamelCase_(			):

							'''simple docstring'''






							snake_case_			      =   0
							snake_case_			      =   os.path.abspath(os.path.dirname(snake_case  )  )
							snake_case_			      =   os.path.join(snake_case							,       "poker_hands.txt"  )
							with open(snake_case  ) as file_hand:
														for line in file_hand:
																					snake_case_			      =   line[:1_4].strip()
																					snake_case_			      =   line[1_5:].strip()
																					snake_case_      ,   snake_case_			      =   PokerHand(snake_case  ), PokerHand(snake_case  )
																					snake_case_			      =   player.compare_with(snake_case  )
																					if output == "Win":
																												answer += 1
							return answer


if __name__ == "__main__":
		solution()










'''simple docstring'''





import qiskit
from qiskit.providers import Backend


def   UpperCamelCase_(			snake_case							: int							,       snake_case							: int  ):

							'''simple docstring'''






							snake_case_      ,   snake_case_			      =   bin(snake_case  )[2:], bin(snake_case  )[2:]  # Remove leading '0b'

							# Ensure that both strings are of the same length
							if len(snake_case  ) > len(snake_case  ):
														snake_case_			      =   y.zfill(len(snake_case  )  )
							else:
														snake_case_			      =   x.zfill(len(snake_case  )  )

							# We need (3 * number of bits in the larger number)+1 qBits
							# The second parameter is the number of classical registers, to measure the result
							snake_case_			      =   qiskit.QuantumCircuit((len(snake_case  ) * 3) + 1							,       len(snake_case  ) + 1  )

							# We are essentially "not-ing" the bits that are 1
							# Reversed because it's easier to perform ops on more significant bits
							for i in range(len(snake_case  )  ):
														if x[::-1][i] == "1":
																					circuit.x(snake_case  )
							for j in range(len(snake_case  )  ):
														if y[::-1][j] == "1":
																					circuit.x(len(snake_case  ) + j  )

							return circuit, x, y


def   UpperCamelCase_(			snake_case							: qiskit.QuantumCircuit							,       snake_case							: int							,       snake_case							: int							,       snake_case							: int							,       snake_case							: int							,       ):

							'''simple docstring'''






							circuit.ccx(snake_case							,       snake_case							,       snake_case  )
							circuit.cx(snake_case							,       snake_case  )
							circuit.ccx(snake_case							,       snake_case							,       snake_case  )
							circuit.cx(snake_case							,       snake_case  )
							circuit.cx(snake_case							,       snake_case  )


def   UpperCamelCase_(			snake_case							: int							,       snake_case							: int							,       snake_case							: Backend = qiskit.Aer.get_backend("aer_simulator"  )							,       ):

							'''simple docstring'''






							if vala < 0 or vala < 0:
														raise ValueError("Both Integers must be positive!"  )

							# Store the Integers
							snake_case_      ,   snake_case_      ,   snake_case_			      =   store_two_classics(snake_case							,       snake_case  )
							for i in range(len(snake_case  )  ):
														full_adder(snake_case							,       snake_case							,       len(snake_case  ) + i							,       len(snake_case  ) + len(snake_case  ) + i							,       len(snake_case  ) + len(snake_case  ) + i + 1  )
														circuit.barrier()  # Optional, just for aesthetics

							# Measure the resultant qBits
							for i in range(len(snake_case  ) + 1  ):
														circuit.measure([(len(snake_case  ) * 2) + i]							,       [i]  )

							snake_case_			      =   qiskit.execute(snake_case							,       snake_case							,       shots=1  ).result()

							# The result is in binary. Convert it back to int
							return int(list(res.get_counts()  )[0]							,       2  )


if __name__ == "__main__":
		import doctest

		doctest.testmod()




