



"""simple docstring"""


import os
import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device


if is_torch_available():
				import torch

				from transformers import GPTaLMHeadModel







@require_torch
@require_sentencepiece
@require_tokenizers
class    A_    (  unittest.TestCase       ):



						"""simple docstring"""






						@slow
						@unittest.skip('Model is not available.'      )
						def 			UpperCAmelCase__  (      self				:Tuple      )       ->    str:
												UpperCAmelCase    =				'nvidia/megatron-gpt2-345m/'
												if "MYDIR" in os.environ:
																		UpperCAmelCase    =				os.path.join(os.environ['MYDIR']     ,						lowercase_      )
												UpperCAmelCase    =				GPTaLMHeadModel.from_pretrained(lowercase_      )
												model.to(lowercase_      )
												model.half()

												UpperCAmelCase    =				torch.tensor(
												    [[1_01, 71_10, 10_05, 10_56, 20_23, 1_13_33, 1_74_13, 10_29, 1_02]]     ,						device=lowercase_     ,						dtype=torch.long     ,						)

												with torch.no_grad():
																		UpperCAmelCase    =				model(lowercase_      ).logits

												UpperCAmelCase    =				torch.Size((1, 9, 5_02_57)      )
												self.assertEqual(output.shape     ,						lowercase_      )

												UpperCAmelCase    =				torch.tensor(
												    [
												        4.9414,
												        -0.2920,
												        -1.2148,
												        -4.0273,
												        -0.5161,
												        -5.2109,
												        -1.2412,
												        -1.8301,
												        -1.7734,
												        -4.7148,
												        -0.2317,
												        -1.0811,
												        -2.1777,
												        0.4141,
												        -3.7969,
												        -4.0586,
												        -2.5332,
												        -3.3809,
												        4.3867,
												    ]     ,						device=lowercase_     ,						dtype=torch.half     ,						)

												for i in range(19      ):
																		UpperCAmelCase   ,					UpperCAmelCase    =				8 * i // 17, 27_92 * i  # along the diagonal
																		UpperCAmelCase   ,					UpperCAmelCase    =				output[0, r, c], expected_diag[i]
																		UpperCAmelCase    =				f"""row={r} col={c} computed={computed} expected={expected}"""
																		self.assertAlmostEqual(lowercase_     ,						lowercase_     ,						delta=1E-4     ,						msg=lowercase_      )










"""simple docstring"""


from collections import Counter

def 				_lowerCAmelCase   (     lowercase_		):
						return sum(socks_by_color // 2 for socks_by_color in Counter(lowercase_		).values()		)


if __name__ == "__main__":
				import doctest

				doctest.testmod()

				snake_case_         = [int(x) for x in input("""Enter socks by color :""").rstrip().split()]
				print(f'''sock_merchant({colors}) = {sock_merchant(colors)}''')





