

import unittest
from pathlib import Path

from transformers import is_vision_available, load_tool
from transformers.testing_utils import get_tests_dir

from .test_tools_common import ToolTesterMixin


if is_vision_available():
		from PIL import Image







class    UpperCamelCase_			(  unittest.TestCase		,     _snake_case			):


		"""simple docstring"""



		def      _UpperCamelCase    (	self    :				Tuple	)					-> int:
						SCREAMING_SNAKE_CASE__					     =						load_tool("image-captioning"	)
						self.tool.setup()
						SCREAMING_SNAKE_CASE__					     =						load_tool("image-captioning"     ,  remote=A_	)



		def      _UpperCamelCase    (	self    :				Tuple	)					-> Optional[Any]:
						SCREAMING_SNAKE_CASE__					     =						Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"	)	) / "000000039769.png"	)
						SCREAMING_SNAKE_CASE__					     =						self.tool(A_	)
						self.assertEqual(A_     ,  "two cats sleeping on a couch"	)



		def      _UpperCamelCase    (	self    :				List[Any]	)					-> Any:
						SCREAMING_SNAKE_CASE__					     =						Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"	)	) / "000000039769.png"	)
						SCREAMING_SNAKE_CASE__					     =						self.remote_tool(A_	)
						self.assertEqual(A_     ,  "two cats sleeping on a couch"	)



		def      _UpperCamelCase    (	self    :				int	)					-> Tuple:
						SCREAMING_SNAKE_CASE__					     =						Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"	)	) / "000000039769.png"	)
						SCREAMING_SNAKE_CASE__					     =						self.tool(image=A_	)
						self.assertEqual(A_     ,  "two cats sleeping on a couch"	)







		def      _UpperCamelCase    (	self    :				List[Any]	)					-> int:
						SCREAMING_SNAKE_CASE__					     =						Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"	)	) / "000000039769.png"	)
						SCREAMING_SNAKE_CASE__					     =						self.remote_tool(image=A_	)
						self.assertEqual(A_     ,  "two cats sleeping on a couch"	)





def 							__a       (					__A ,       __A ,       __A	):
    SCREAMING_SNAKE_CASE__					     =						index
    SCREAMING_SNAKE_CASE__					     =						2 * index + 1
    SCREAMING_SNAKE_CASE__					     =						2 * index + 2
    if left_index < heap_size and unsorted[left_index] > unsorted[largest]:
        SCREAMING_SNAKE_CASE__					     =						left_index

    if right_index < heap_size and unsorted[right_index] > unsorted[largest]:
        SCREAMING_SNAKE_CASE__					     =						right_index

    if largest != index:
        SCREAMING_SNAKE_CASE__     ,		SCREAMING_SNAKE_CASE__					     =						unsorted[index], unsorted[largest]
        heapify(__A ,       __A ,       __A	)





def 							__a       (					__A	):
    SCREAMING_SNAKE_CASE__					     =						len(__A	)
    for i in range(n // 2 - 1 ,       -1 ,       -1	):
        heapify(__A ,       __A ,       __A	)
    for i in range(n - 1 ,       0 ,       -1	):
        SCREAMING_SNAKE_CASE__     ,		SCREAMING_SNAKE_CASE__					     =						unsorted[i], unsorted[0]
        heapify(__A ,       0 ,       __A	)
    return unsorted


if __name__ == "__main__":
  A__        =			input("Enter numbers separated by a comma:\n").strip()
  A__        =			[int(item) for item in user_input.split(",")]
  print(heap_sort(unsorted))


