





"""simple docstring"""





# This code is adapted from OpenAI's release
# https://github.com/openai/human-eval/blob/master/human_eval/execution.py

import contextlib
import faulthandler
import io
import multiprocessing
import os
import platform
import signal
import tempfile


def       a__					(					_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE    ):




		"""simple docstring"""


		UpperCamelCase   =	multiprocessing.Manager()
		UpperCamelCase   =	manager.list()

		UpperCamelCase   =	multiprocessing.Process(target=_SCREAMING_SNAKE_CASE  ,	args=(check_program, result, timeout)    )
		p.start()
		p.join(timeout=timeout + 1    )
		if p.is_alive():
				p.kill()

		if not result:
				result.append("timed out"    )

		return {
		    "task_id": task_id,
		    "passed": result[0] == "passed",
		    "result": result[0],
		    "completion_id": completion_id,
		}


def       a__					(					_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE    ):




		"""simple docstring"""


		with create_tempdir():
				# These system calls are needed when cleaning up tempdir.
				import os
				import shutil

				UpperCamelCase   =	shutil.rmtree
				UpperCamelCase   =	os.rmdir
				UpperCamelCase   =	os.chdir

				# Disable functionalities that can make destructive changes to the test.
				reliability_guard()

				# Run program.
				try:
						UpperCamelCase   =	{}
						with swallow_io():
								with time_limit(_SCREAMING_SNAKE_CASE    ):
										exec(_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE    )
						result.append("passed"    )
				except TimeoutException:
						result.append("timed out"    )
				except BaseException as e:
						result.append(F"failed: {e}"    )

				# Needed for cleaning up.
				UpperCamelCase   =	rmtree
				UpperCamelCase   =	rmdir
				UpperCamelCase   =	chdir


@contextlib.contextmanager
def       a__					(					_SCREAMING_SNAKE_CASE    ):




		"""simple docstring"""


		def signal_handler(_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE    ):
				raise TimeoutException("Timed out!"    )

		signal.setitimer(signal.ITIMER_REAL  ,	_SCREAMING_SNAKE_CASE    )
		signal.signal(signal.SIGALRM  ,	_SCREAMING_SNAKE_CASE    )
		try:
				yield
		finally:
				signal.setitimer(signal.ITIMER_REAL  ,	0    )


@contextlib.contextmanager
def       a__					(					):




		"""simple docstring"""


		UpperCamelCase   =	WriteOnlyStringIO()
		with contextlib.redirect_stdout(_SCREAMING_SNAKE_CASE    ):
				with contextlib.redirect_stderr(_SCREAMING_SNAKE_CASE    ):
						with redirect_stdin(_SCREAMING_SNAKE_CASE    ):
								yield


@contextlib.contextmanager
def       a__					(					):




		"""simple docstring"""


		with tempfile.TemporaryDirectory() as dirname:
				with chdir(_SCREAMING_SNAKE_CASE    ):
						yield dirname





class        _lowerCamelCase      (       _lowercase ):
						pass





class        _lowerCamelCase      (       io.StringIO ):


						def     snake_case_   (self   ,							*__a   ,							**__a		) ->   Union[str, Any]:
								raise OSError


						def     snake_case_   (self   ,							*__a   ,							**__a		) ->   str:
								raise OSError


						def     snake_case_   (self   ,							*__a   ,							**__a		) ->   List[str]:
								raise OSError




						def     snake_case_   (self   ,							*__a   ,							**__a		) ->   List[Any]:
								return False





class        _lowerCamelCase      (       contextlib._RedirectStream ):  # type: ignore
						UpperCAmelCase_ =			"stdin"



@contextlib.contextmanager
def       a__					(					_SCREAMING_SNAKE_CASE    ):




		"""simple docstring"""


		if root == ".":
				yield
				return
		UpperCamelCase   =	os.getcwd()
		os.chdir(_SCREAMING_SNAKE_CASE    )
		try:
				yield
		except BaseException as exc:
				raise exc
		finally:
				os.chdir(_SCREAMING_SNAKE_CASE    )






def       a__					(					_SCREAMING_SNAKE_CASE=None    ):




		"""simple docstring"""


		if maximum_memory_bytes is not None:
				import resource

				resource.setrlimit(resource.RLIMIT_AS  ,	(maximum_memory_bytes, maximum_memory_bytes)    )
				resource.setrlimit(resource.RLIMIT_DATA  ,	(maximum_memory_bytes, maximum_memory_bytes)    )
				if not platform.uname().system == "Darwin":
						resource.setrlimit(resource.RLIMIT_STACK  ,	(maximum_memory_bytes, maximum_memory_bytes)    )

		faulthandler.disable()

		import builtins

		UpperCamelCase   =	None
		UpperCamelCase   =	None

		import os

		UpperCamelCase   =	"1"

		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None

		import shutil

		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None

		import subprocess

		UpperCamelCase   =	None  # type: ignore

		UpperCamelCase   =	None

		import sys

		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None
		UpperCamelCase   =	None













"""simple docstring"""





import string


def       a__					(					_SCREAMING_SNAKE_CASE    ):




		"""simple docstring"""


		for key in range(len(string.ascii_uppercase    )    ):
				UpperCamelCase   =	""
				for symbol in message:
						if symbol in string.ascii_uppercase:
								UpperCamelCase   =	string.ascii_uppercase.find(_SCREAMING_SNAKE_CASE    )
								UpperCamelCase   =	num - key
								if num < 0:
										UpperCamelCase   =	num + len(string.ascii_uppercase    )
								UpperCamelCase   =	translated + string.ascii_uppercase[num]
						else:
								UpperCamelCase   =	translated + symbol
				print(F"Decryption using Key #{key}: {translated}"    )


def       a__					(					):




		"""simple docstring"""


		UpperCamelCase   =	input("Encrypted message: "    )
		UpperCamelCase   =	message.upper()
		decrypt(_SCREAMING_SNAKE_CASE    )


if __name__ == "__main__":
						import doctest

						doctest.testmod()
						main()






