





'''simple docstring'''






import os
import tempfile
import unittest

from transformers import FlaubertConfig, is_torch_available
from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
		import torch

		from transformers import (
		    FlaubertForMultipleChoice,
		    FlaubertForQuestionAnswering,
		    FlaubertForQuestionAnsweringSimple,
		    FlaubertForSequenceClassification,
		    FlaubertForTokenClassification,
		    FlaubertModel,
		    FlaubertWithLMHeadModel,
		)
		from transformers.models.flaubert.modeling_flaubert import FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST







class 			lowerCamelCase					(						__UpperCAmelCase  ):


					def __init__(					self	:  str       ,     __snake_case	:  Union[str, Any]       ,     __snake_case	:  List[str]=13       ,     __snake_case	:  str=7       ,     __snake_case	:  Optional[Any]=True       ,     __snake_case	:  int=True       ,     __snake_case	:  int=True       ,     __snake_case	:  List[Any]=True       ,     __snake_case	:  Dict=True       ,     __snake_case	:  Any=False       ,     __snake_case	:  Any=False       ,     __snake_case	:  Any=False       ,     __snake_case	:  Union[str, Any]=2       ,     __snake_case	:  Optional[Any]=99       ,     __snake_case	:  str=0       ,     __snake_case	:  Optional[int]=32       ,     __snake_case	:  int=5       ,     __snake_case	:  Any=4       ,     __snake_case	:  Dict=0.1       ,     __snake_case	:  List[Any]=0.1       ,     __snake_case	:  int=5_12       ,     __snake_case	:  Any=12       ,     __snake_case	:  List[str]=2       ,     __snake_case	:  int=0.02       ,     __snake_case	:  List[str]=3       ,     __snake_case	:  Dict=4       ,     __snake_case	:  List[Any]="last"       ,     __snake_case	:  Optional[Any]=None       ,     __snake_case	:  List[Any]=None       ,     ):





											'''simple docstring'''





											_snake_case:   Optional[int]  					=		parent
											_snake_case:   Union[str, Any]  					=		batch_size
											_snake_case:   Optional[int]  					=		seq_length
											_snake_case:   Optional[int]  					=		is_training
											_snake_case:   Union[str, Any]  					=		use_input_lengths
											_snake_case:   Tuple  					=		use_token_type_ids
											_snake_case:   List[Any]  					=		use_labels
											_snake_case:   Optional[Any]  					=		gelu_activation
											_snake_case:   Dict  					=		sinusoidal_embeddings
											_snake_case:   List[Any]  					=		causal
											_snake_case:   Any  					=		asm
											_snake_case:   Optional[int]  					=		n_langs
											_snake_case:   Any  					=		vocab_size
											_snake_case:   Optional[Any]  					=		n_special
											_snake_case:   List[str]  					=		hidden_size
											_snake_case:   Optional[int]  					=		num_hidden_layers
											_snake_case:   int  					=		num_attention_heads
											_snake_case:   Tuple  					=		hidden_dropout_prob
											_snake_case:   Any  					=		attention_probs_dropout_prob
											_snake_case:   str  					=		max_position_embeddings
											_snake_case:   List[str]  					=		type_vocab_size
											_snake_case:   Union[str, Any]  					=		type_sequence_label_size
											_snake_case:   List[str]  					=		initializer_range
											_snake_case:   str  					=		num_labels
											_snake_case:   List[Any]  					=		num_choices
											_snake_case:   Tuple  					=		summary_type
											_snake_case:   Optional[int]  					=		use_proj
											_snake_case:   Dict  					=		scope


					def    SCREAMING_SNAKE_CASE_		(					self	:  Optional[int]       ):





											'''simple docstring'''





											_snake_case:   List[str]  					=		ids_tensor([self.batch_size, self.seq_length]       ,     self.vocab_size       )
											_snake_case:   Tuple  					=		random_attention_mask([self.batch_size, self.seq_length]       )

											_snake_case:   int  					=		None
											if self.use_input_lengths:
																	_snake_case:   Optional[Any]  					=		(
																	    ids_tensor([self.batch_size]       ,     vocab_size=2       ) + self.seq_length - 2
																	)  # small variation of seq_length

											_snake_case:   Optional[Any]  					=		None
											if self.use_token_type_ids:
																	_snake_case:   Optional[Any]  					=		ids_tensor([self.batch_size, self.seq_length]       ,     self.n_langs       )

											_snake_case:   Union[str, Any]  					=		None
											_snake_case:   Any  					=		None
											_snake_case:   List[Any]  					=		None
											if self.use_labels:
																	_snake_case:   Tuple  					=		ids_tensor([self.batch_size]       ,     self.type_sequence_label_size       )
																	_snake_case:   str  					=		ids_tensor([self.batch_size, self.seq_length]       ,     self.num_labels       )
																	_snake_case:   Optional[int]  					=		ids_tensor([self.batch_size]       ,     2       ).float()
																	_snake_case:   List[Any]  					=		ids_tensor([self.batch_size]       ,     self.num_choices       )

											_snake_case:   str  					=		self.get_config()

											return (
											    config,
											    input_ids,
											    token_type_ids,
											    input_lengths,
											    sequence_labels,
											    token_labels,
											    is_impossible_labels,
											    choice_labels,
											    input_mask,
											)


					def    SCREAMING_SNAKE_CASE_		(					self	:  List[Any]       ):





											'''simple docstring'''





											return FlaubertConfig(
											    vocab_size=self.vocab_size       ,     n_special=self.n_special       ,     emb_dim=self.hidden_size       ,     n_layers=self.num_hidden_layers       ,     n_heads=self.num_attention_heads       ,     dropout=self.hidden_dropout_prob       ,     attention_dropout=self.attention_probs_dropout_prob       ,     gelu_activation=self.gelu_activation       ,     sinusoidal_embeddings=self.sinusoidal_embeddings       ,     asm=self.asm       ,     causal=self.causal       ,     n_langs=self.n_langs       ,     max_position_embeddings=self.max_position_embeddings       ,     initializer_range=self.initializer_range       ,     summary_type=self.summary_type       ,     use_proj=self.use_proj       ,     )


					def    SCREAMING_SNAKE_CASE_		(					self	:  List[str]       ,     __snake_case	:  int       ,     __snake_case	:  Any       ,     __snake_case	:  str       ,     __snake_case	:  Optional[Any]       ,     __snake_case	:  Any       ,     __snake_case	:  Dict       ,     __snake_case	:  List[str]       ,     __snake_case	:  int       ,     __snake_case	:  Optional[Any]       ,     ):





											'''simple docstring'''





											_snake_case:   Optional[int]  					=		FlaubertModel(config=__snake_case       )
											model.to(__snake_case       )
											model.eval()
											_snake_case:   Tuple  					=		model(__snake_case       ,     lengths=__snake_case       ,     langs=__snake_case       )
											_snake_case:   Tuple  					=		model(__snake_case       ,     langs=__snake_case       )
											_snake_case:   int  					=		model(__snake_case       )
											self.parent.assertEqual(result.last_hidden_state.shape       ,     (self.batch_size, self.seq_length, self.hidden_size)       )


					def    SCREAMING_SNAKE_CASE_		(					self	:  Dict       ,     __snake_case	:  str       ,     __snake_case	:  Dict       ,     __snake_case	:  str       ,     __snake_case	:  Any       ,     __snake_case	:  List[Any]       ,     __snake_case	:  Optional[int]       ,     __snake_case	:  Dict       ,     __snake_case	:  Union[str, Any]       ,     __snake_case	:  Any       ,     ):





											'''simple docstring'''





											_snake_case:   Any  					=		FlaubertWithLMHeadModel(__snake_case       )
											model.to(__snake_case       )
											model.eval()

											_snake_case:   Dict  					=		model(__snake_case       ,     token_type_ids=__snake_case       ,     labels=__snake_case       )
											self.parent.assertEqual(result.loss.shape       ,     ()       )
											self.parent.assertEqual(result.logits.shape       ,     (self.batch_size, self.seq_length, self.vocab_size)       )


					def    SCREAMING_SNAKE_CASE_		(					self	:  int       ,     __snake_case	:  str       ,     __snake_case	:  int       ,     __snake_case	:  Union[str, Any]       ,     __snake_case	:  Dict       ,     __snake_case	:  int       ,     __snake_case	:  str       ,     __snake_case	:  Dict       ,     __snake_case	:  Dict       ,     __snake_case	:  Optional[Any]       ,     ):





											'''simple docstring'''





											_snake_case:   Union[str, Any]  					=		FlaubertForQuestionAnsweringSimple(__snake_case       )
											model.to(__snake_case       )
											model.eval()

											_snake_case:   List[str]  					=		model(__snake_case       )

											_snake_case:   Any  					=		model(__snake_case       ,     start_positions=__snake_case       ,     end_positions=__snake_case       )
											self.parent.assertEqual(result.start_logits.shape       ,     (self.batch_size, self.seq_length)       )
											self.parent.assertEqual(result.end_logits.shape       ,     (self.batch_size, self.seq_length)       )


					def    SCREAMING_SNAKE_CASE_		(					self	:  Union[str, Any]       ,     __snake_case	:  Any       ,     __snake_case	:  Any       ,     __snake_case	:  Optional[int]       ,     __snake_case	:  Optional[Any]       ,     __snake_case	:  int       ,     __snake_case	:  Tuple       ,     __snake_case	:  List[str]       ,     __snake_case	:  List[str]       ,     __snake_case	:  Union[str, Any]       ,     ):





											'''simple docstring'''





											_snake_case:   Optional[Any]  					=		FlaubertForQuestionAnswering(__snake_case       )
											model.to(__snake_case       )
											model.eval()

											_snake_case:   Any  					=		model(__snake_case       )

											_snake_case:   Optional[Any]  					=		model(
											    __snake_case       ,     start_positions=__snake_case       ,     end_positions=__snake_case       ,     cls_index=__snake_case       ,     is_impossible=__snake_case       ,     p_mask=__snake_case       ,     )

											_snake_case:   Optional[int]  					=		model(
											    __snake_case       ,     start_positions=__snake_case       ,     end_positions=__snake_case       ,     cls_index=__snake_case       ,     is_impossible=__snake_case       ,     )

											(_snake_case						):   Optional[int]  					=		result_with_labels.to_tuple()

											_snake_case:   str  					=		model(__snake_case       ,     start_positions=__snake_case       ,     end_positions=__snake_case       )

											(_snake_case						):   Dict  					=		result_with_labels.to_tuple()

											self.parent.assertEqual(result_with_labels.loss.shape       ,     ()       )
											self.parent.assertEqual(result.start_top_log_probs.shape       ,     (self.batch_size, model.config.start_n_top)       )
											self.parent.assertEqual(result.start_top_index.shape       ,     (self.batch_size, model.config.start_n_top)       )
											self.parent.assertEqual(
											    result.end_top_log_probs.shape       ,     (self.batch_size, model.config.start_n_top * model.config.end_n_top)       )
											self.parent.assertEqual(
											    result.end_top_index.shape       ,     (self.batch_size, model.config.start_n_top * model.config.end_n_top)       )
											self.parent.assertEqual(result.cls_logits.shape       ,     (self.batch_size,)       )


					def    SCREAMING_SNAKE_CASE_		(					self	:  int       ,     __snake_case	:  Optional[Any]       ,     __snake_case	:  List[str]       ,     __snake_case	:  Any       ,     __snake_case	:  Optional[int]       ,     __snake_case	:  Optional[int]       ,     __snake_case	:  List[str]       ,     __snake_case	:  Any       ,     __snake_case	:  Optional[int]       ,     __snake_case	:  Any       ,     ):





											'''simple docstring'''





											_snake_case:   List[str]  					=		FlaubertForSequenceClassification(__snake_case       )
											model.to(__snake_case       )
											model.eval()

											_snake_case:   int  					=		model(__snake_case       )
											_snake_case:   Optional[int]  					=		model(__snake_case       ,     labels=__snake_case       )

											self.parent.assertEqual(result.loss.shape       ,     ()       )
											self.parent.assertEqual(result.logits.shape       ,     (self.batch_size, self.type_sequence_label_size)       )


					def    SCREAMING_SNAKE_CASE_		(					self	:  int       ,     __snake_case	:  Optional[Any]       ,     __snake_case	:  str       ,     __snake_case	:  List[Any]       ,     __snake_case	:  Any       ,     __snake_case	:  Tuple       ,     __snake_case	:  Optional[int]       ,     __snake_case	:  Tuple       ,     __snake_case	:  Any       ,     __snake_case	:  Dict       ,     ):





											'''simple docstring'''





											_snake_case:   str  					=		self.num_labels
											_snake_case:   Dict  					=		FlaubertForTokenClassification(__snake_case       )
											model.to(__snake_case       )
											model.eval()

											_snake_case:   int  					=		model(__snake_case       ,     attention_mask=__snake_case       ,     labels=__snake_case       )
											self.parent.assertEqual(result.logits.shape       ,     (self.batch_size, self.seq_length, self.num_labels)       )


					def    SCREAMING_SNAKE_CASE_		(					self	:  Any       ,     __snake_case	:  Any       ,     __snake_case	:  Optional[Any]       ,     __snake_case	:  Tuple       ,     __snake_case	:  Optional[int]       ,     __snake_case	:  List[str]       ,     __snake_case	:  Any       ,     __snake_case	:  List[str]       ,     __snake_case	:  List[Any]       ,     __snake_case	:  Union[str, Any]       ,     ):





											'''simple docstring'''





											_snake_case:   int  					=		self.num_choices
											_snake_case:   Any  					=		FlaubertForMultipleChoice(config=__snake_case       )
											model.to(__snake_case       )
											model.eval()
											_snake_case:   Any  					=		input_ids.unsqueeze(1       ).expand(-1       ,     self.num_choices       ,     -1       ).contiguous()
											_snake_case:   str  					=		token_type_ids.unsqueeze(1       ).expand(-1       ,     self.num_choices       ,     -1       ).contiguous()
											_snake_case:   Any  					=		input_mask.unsqueeze(1       ).expand(-1       ,     self.num_choices       ,     -1       ).contiguous()
											_snake_case:   str  					=		model(
											    __snake_case       ,     attention_mask=__snake_case       ,     token_type_ids=__snake_case       ,     labels=__snake_case       ,     )
											self.parent.assertEqual(result.logits.shape       ,     (self.batch_size, self.num_choices)       )




					def    SCREAMING_SNAKE_CASE_		(					self	:  Optional[int]       ):





											'''simple docstring'''





											_snake_case:   Optional[int]  					=		self.prepare_config_and_inputs()
											(
											    _snake_case						
											):   Tuple  					=		config_and_inputs
											_snake_case:   str  					=		{
											    'input_ids': input_ids,
											    'token_type_ids': token_type_ids,
											    'lengths': input_lengths,
											    'attention_mask': input_mask,
											}
											return config, inputs_dict







@require_torch
class 			lowerCamelCase					(						__UpperCAmelCase     ,							__UpperCAmelCase     ,							unittest.TestCase  ):
					_SCREAMING_SNAKE_CASE							   =    (
					    (
					        FlaubertModel,
					        FlaubertWithLMHeadModel,
					        FlaubertForQuestionAnswering,
					        FlaubertForQuestionAnsweringSimple,
					        FlaubertForSequenceClassification,
					        FlaubertForTokenClassification,
					        FlaubertForMultipleChoice,
					    )
					    if is_torch_available()
					    else ()
					)
					_SCREAMING_SNAKE_CASE							   =    (
					    {
					        "feature-extraction": FlaubertModel,
					        "fill-mask": FlaubertWithLMHeadModel,
					        "question-answering": FlaubertForQuestionAnsweringSimple,
					        "text-classification": FlaubertForSequenceClassification,
					        "token-classification": FlaubertForTokenClassification,
					        "zero-shot": FlaubertForSequenceClassification,
					    }
					    if is_torch_available()
					    else {}
					)


					def    SCREAMING_SNAKE_CASE_		(					self	:  Tuple       ,     __snake_case	:  Optional[Any]       ,     __snake_case	:  List[Any]       ,     __snake_case	:  Optional[int]       ,     __snake_case	:  str       ,     __snake_case	:  Optional[Any]       ):





											'''simple docstring'''





											if (
											    pipeline_test_casse_name == "QAPipelineTests"
											    and tokenizer_name is not None
											    and not tokenizer_name.endswith('Fast'       )
											):
																	# `QAPipelineTests` fails for a few models when the slower tokenizer are used.
																	# (The slower tokenizers were never used for pipeline tests before the pipeline testing rework)
																	# TODO: check (and possibly fix) the `QAPipelineTests` with slower tokenizer
																	return True

											return False


					def    SCREAMING_SNAKE_CASE_		(					self	:  Tuple       ,     __snake_case	:  Optional[int]       ,     __snake_case	:  Any       ,     __snake_case	:  Union[str, Any]=False       ):





											'''simple docstring'''





											_snake_case:   str  					=		super()._prepare_for_class(__snake_case       ,     __snake_case       ,     return_labels=__snake_case       )

											if return_labels:
																	if model_class.__name__ == "FlaubertForQuestionAnswering":
																							_snake_case:   str  					=		torch.zeros(
																							    self.model_tester.batch_size       ,     dtype=torch.long       ,     device=__snake_case       )
																							_snake_case:   List[str]  					=		torch.zeros(
																							    self.model_tester.batch_size       ,     dtype=torch.long       ,     device=__snake_case       )

											return inputs_dict


					def    SCREAMING_SNAKE_CASE_		(					self	:  Union[str, Any]       ):





											'''simple docstring'''





											_snake_case:   Optional[int]  					=		FlaubertModelTester(self       )
											_snake_case:   List[str]  					=		ConfigTester(self       ,     config_class=__snake_case       ,     emb_dim=37       )


					def    SCREAMING_SNAKE_CASE_		(					self	:  Optional[Any]       ):





											'''simple docstring'''





											self.config_tester.run_common_tests()


					def    SCREAMING_SNAKE_CASE_		(					self	:  Optional[int]       ):





											'''simple docstring'''





											_snake_case:   Optional[int]  					=		self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_flaubert_model(*__snake_case       )


					def    SCREAMING_SNAKE_CASE_		(					self	:  Any       ):





											'''simple docstring'''





											_snake_case:   Any  					=		self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_flaubert_lm_head(*__snake_case       )


					def    SCREAMING_SNAKE_CASE_		(					self	:  Union[str, Any]       ):





											'''simple docstring'''





											_snake_case:   List[str]  					=		self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_flaubert_simple_qa(*__snake_case       )


					def    SCREAMING_SNAKE_CASE_		(					self	:  List[Any]       ):





											'''simple docstring'''





											_snake_case:   Tuple  					=		self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_flaubert_qa(*__snake_case       )


					def    SCREAMING_SNAKE_CASE_		(					self	:  Tuple       ):





											'''simple docstring'''





											_snake_case:   List[str]  					=		self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_flaubert_sequence_classif(*__snake_case       )


					def    SCREAMING_SNAKE_CASE_		(					self	:  List[str]       ):





											'''simple docstring'''





											_snake_case:   List[str]  					=		self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_flaubert_token_classif(*__snake_case       )


					def    SCREAMING_SNAKE_CASE_		(					self	:  int       ):





											'''simple docstring'''





											_snake_case:   Any  					=		self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_flaubert_multiple_choice(*__snake_case       )


					@slow
					def    SCREAMING_SNAKE_CASE_		(					self	:  Any       ):





											'''simple docstring'''





											for model_name in FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																	_snake_case:   Tuple  					=		FlaubertModel.from_pretrained(__snake_case       )
																	self.assertIsNotNone(__snake_case       )




					@slow
					@require_torch_gpu
					def    SCREAMING_SNAKE_CASE_		(					self	:  Optional[Any]       ):





											'''simple docstring'''





											_snake_case:   Dict  					=		self.model_tester.prepare_config_and_inputs_for_common()
											for model_class in self.all_model_classes:
																	# FlauBertForMultipleChoice behaves incorrectly in JIT environments.
																	if model_class == FlaubertForMultipleChoice:
																							return

																	_snake_case:   Tuple  					=		True
																	_snake_case:   int  					=		model_class(config=__snake_case       )

																	_snake_case:   List[Any]  					=		self._prepare_for_class(__snake_case       ,     __snake_case       )
																	_snake_case:   Any  					=		torch.jit.trace(
																	    __snake_case       ,     (inputs_dict['input_ids'].to('cpu'       ), inputs_dict['attention_mask'].to('cpu'       ))       )

																	with tempfile.TemporaryDirectory() as tmp:
																							torch.jit.save(__snake_case       ,     os.path.join(__snake_case       ,     'traced_model.pt'       )       )
																							_snake_case:   Optional[Any]  					=		torch.jit.load(os.path.join(__snake_case       ,     'traced_model.pt'       )       ,     map_location=__snake_case       )
																							loaded(inputs_dict['input_ids'].to(__snake_case       )       ,     inputs_dict['attention_mask'].to(__snake_case       )       )







@require_torch
class 			lowerCamelCase					(						unittest.TestCase  ):


					@slow
					def    SCREAMING_SNAKE_CASE_		(					self	:  Optional[Any]       ):





											'''simple docstring'''





											_snake_case:   Dict  					=		FlaubertModel.from_pretrained('flaubert/flaubert_base_cased'       )
											_snake_case:   List[Any]  					=		torch.tensor([[0, 3_45, 2_32, 3_28, 7_40, 1_40, 16_95, 69, 60_78, 15_88, 2]]       )
											with torch.no_grad():
																	_snake_case:   Optional[int]  					=		model(__snake_case       )[0]
											_snake_case:   Optional[int]  					=		torch.Size((1, 11, 7_68)       )
											self.assertEqual(output.shape       ,     __snake_case       )
											_snake_case:   int  					=		torch.tensor(
											    [[[-2.6_251, -1.4_298, -0.0_227], [-2.8_510, -1.6_387, 0.2_258], [-2.8_114, -1.1_832, -0.3_066]]]       )

											self.assertTrue(torch.allclose(output[:, :3, :3]       ,     __snake_case       ,     atol=1e-4       )       )












'''simple docstring'''






from __future__ import annotations

A   : Union[str, Any]             =			[-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0]
A   : Optional[int]             =			[-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1]





def       lowercase_      (		lowercase__						)   ->list[float]:
						_snake_case:   Tuple  					=		[]
						_snake_case:   List[Any]  					=		len(lowercase__						)

						for i in range(lowercase__						):
												_snake_case:   float  					=		-1
												for j in range(i + 1				,  lowercase__						):
																		if arr[i] < arr[j]:
																								_snake_case:   List[str]  					=		arr[j]
																								break
												result.append(lowercase__						)
						return result





def       lowercase_      (		lowercase__						)   ->list[float]:
						_snake_case:   Tuple  					=		[]
						for i, outer in enumerate(lowercase__						):
												_snake_case:   float  					=		-1
												for inner in arr[i + 1 :]:
																		if outer < inner:
																								_snake_case:   List[Any]  					=		inner
																								break
												result.append(lowercase__						)
						return result





def       lowercase_      (		lowercase__						)   ->list[float]:
						_snake_case:   int  					=		len(lowercase__						)
						_snake_case:   list[float]  					=		[]
						_snake_case:   list[float]  					=		[-1] * arr_size

						for index in reversed(range(lowercase__						)						):
												if stack:
																		while stack[-1] <= arr[index]:
																								stack.pop()
																								if not stack:
																														break
												if stack:
																		_snake_case:   Dict  					=		stack[-1]
												stack.append(arr[index]						)
						return result


if __name__ == "__main__":
		from doctest import testmod
		from timeit import timeit

		testmod()
		print(next_greatest_element_slow(arr))
		print(next_greatest_element_fast(arr))
		print(next_greatest_element(arr))

		A   : Union[str, Any]             =			(
		    'from __main__ import arr, next_greatest_element_slow, '
		    'next_greatest_element_fast, next_greatest_element'
		)
		print(
		    'next_greatest_element_slow():',
		    timeit('next_greatest_element_slow(arr)', setup=setup),
		)
		print(
		    'next_greatest_element_fast():',
		    timeit('next_greatest_element_fast(arr)', setup=setup),
		)
		print(
		    '     next_greatest_element():',
		    timeit('next_greatest_element(arr)', setup=setup),
		)





