
# 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     __lowerCAmelCase			(			a__						,    a__						,    a__						,    a__  )       ->  str:
				__a										=    multiprocessing.Manager()
				__a										=    manager.list()

				__a										=    multiprocessing.Process(target=a__						,    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     __lowerCAmelCase			(			a__						,    a__						,    a__  )       ->  List[Any]:
				with create_tempdir():
								# These system calls are needed when cleaning up tempdir.
								import os
								import shutil

								__a										=    shutil.rmtree
								__a										=    os.rmdir
								__a										=    os.chdir

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

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

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


@contextlib.contextmanager
def     __lowerCAmelCase			(			a__  )       ->  str:
				def signal_handler(a__						,    a__  ):
								raise TimeoutException('''Timed out!'''  )

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


@contextlib.contextmanager
def     __lowerCAmelCase			(			)       ->  Tuple:
				__a										=    WriteOnlyStringIO()
				with contextlib.redirect_stdout(a__  ):
								with contextlib.redirect_stderr(a__  ):
												with redirect_stdin(a__  ):
																yield


@contextlib.contextmanager
def     __lowerCAmelCase			(			)       ->  Tuple:
				with tempfile.TemporaryDirectory() as dirname:
								with chdir(a__  ):
												yield dirname







class 			__A( a			):
				pass







class 			__A( io.StringIO			):




				def 				SCREAMING_SNAKE_CASE_		(     self		,     *_snake_case		,     **_snake_case				)    ->      int:


								'''simple docstring'''




								raise OSError




				def 				SCREAMING_SNAKE_CASE_		(     self		,     *_snake_case		,     **_snake_case				)    ->      List[Any]:


								'''simple docstring'''




								raise OSError




				def 				SCREAMING_SNAKE_CASE_		(     self		,     *_snake_case		,     **_snake_case				)    ->      List[Any]:


								'''simple docstring'''




								raise OSError




				def 				SCREAMING_SNAKE_CASE_		(     self		,     *_snake_case		,     **_snake_case				)    ->      Optional[int]:


								'''simple docstring'''




								return False







class 			__A( contextlib._RedirectStream			):  # type: ignore
				snake_case_						   =    '''stdin'''



@contextlib.contextmanager
def     __lowerCAmelCase			(			a__  )       ->  List[Any]:
				if root == ".":
								yield
								return
				__a										=    os.getcwd()
				os.chdir(a__  )
				try:
								yield
				except BaseException as exc:
								raise exc
				finally:
								os.chdir(a__  )






def     __lowerCAmelCase			(			a__=None  )       ->  Union[str, Any]:

				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

				__a										=    None
				__a										=    None

				import os

				__a										=    '''1'''

				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None

				import shutil

				__a										=    None
				__a										=    None
				__a										=    None

				import subprocess

				__a										=    None  # type: ignore

				__a										=    None

				import sys

				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None
				__a										=    None



"""simple docstring"""


def _lowerCamelCase	(		_UpperCamelCase    , _UpperCamelCase      ):

			'''simple docstring'''




			if not isinstance(_UpperCamelCase    , _UpperCamelCase      ):
						raise ValueError("iterations must be defined as integers"      )
			if not isinstance(_UpperCamelCase    , _UpperCamelCase      ) or not number >= 1:
						raise ValueError(
						    "starting number must be\n                         and integer and be more than 0"      )
			if not iterations >= 1:
						raise ValueError("Iterations must be done more than 0 times to play FizzBuzz"      )

			__lowerCAmelCase				    =			""
			while number <= iterations:
						if number % 3 == 0:
									out += "Fizz"
						if number % 5 == 0:
									out += "Buzz"
						if 0 not in (number % 3, number % 5):
									out += str(_UpperCamelCase      )

						# print(out)
						number += 1
						out += " "
			return out


if __name__ == "__main__":
	import doctest

	doctest.testmod()




