



'''simple docstring'''


import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
  import torch

if is_vision_available():
  from PIL import Image

  from transformers import GLPNImageProcessor







class 	UpperCAmelCase	(		unittest.TestCase):


 '''simple docstring'''




 def __init__(   self							,  lowerCAmelCase_							,  lowerCAmelCase_=7							,  lowerCAmelCase_=3							,  lowerCAmelCase_=1_8							,  lowerCAmelCase_=3_0							,  lowerCAmelCase_=4_0_0							,  lowerCAmelCase_=True							,  lowerCAmelCase_=3_2							,  lowerCAmelCase_=True							,  ) ->      Tuple:



      """simple docstring"""







      a_       		=parent
      a_       		=batch_size
      a_       		=num_channels
      a_       		=image_size
      a_       		=min_resolution
      a_       		=max_resolution
      a_       		=do_resize
      a_       		=size_divisor
      a_       		=do_rescale




 def       lowercase_  (   self) ->      List[Any]:



      """simple docstring"""







      return {
          "do_resize": self.do_resize,
          "size_divisor": self.size_divisor,
          "do_rescale": self.do_rescale,
      }







@require_torch
@require_vision
class 	UpperCAmelCase	(		__a					,	unittest.TestCase):


 '''simple docstring'''




 __magic_name__					: Dict  =      GLPNImageProcessor if is_vision_available() else None




 def       lowercase_  (   self) ->      Optional[Any]:



      """simple docstring"""







      a_       		=GLPNImageProcessingTester(self)




 @property
 def       lowercase_  (   self) ->      Dict:



      """simple docstring"""







      return self.image_processor_tester.prepare_image_processor_dict()




 def       lowercase_  (   self) ->      Any:



      """simple docstring"""







      a_       		=self.image_processing_class(**self.image_processor_dict)
      self.assertTrue(hasattr(lowerCAmelCase_							,  "do_resize"))
      self.assertTrue(hasattr(lowerCAmelCase_							,  "size_divisor"))
      self.assertTrue(hasattr(lowerCAmelCase_							,  "resample"))
      self.assertTrue(hasattr(lowerCAmelCase_							,  "do_rescale"))




 def       lowercase_  (   self) ->      Optional[int]:



      """simple docstring"""







      pass




 def       lowercase_  (   self) ->      Any:



      """simple docstring"""







      a_       		=self.image_processing_class(**self.image_processor_dict)
      # create random PIL images
      a_       		=prepare_image_inputs(self.image_processor_tester							,  equal_resolution=lowerCAmelCase_)
      for image in image_inputs:
           self.assertIsInstance(lowerCAmelCase_							,  Image.Image)

      # Test not batched input (GLPNImageProcessor doesn't support batching)
      a_       		=image_processing(image_inputs[0]							,  return_tensors="pt").pixel_values
      self.assertTrue(encoded_images.shape[-1] % self.image_processor_tester.size_divisor == 0)
      self.assertTrue(encoded_images.shape[-2] % self.image_processor_tester.size_divisor == 0)




 def       lowercase_  (   self) ->      List[Any]:



      """simple docstring"""







      a_       		=self.image_processing_class(**self.image_processor_dict)
      # create random numpy tensors
      a_       		=prepare_image_inputs(self.image_processor_tester							,  equal_resolution=lowerCAmelCase_							,  numpify=lowerCAmelCase_)
      for image in image_inputs:
           self.assertIsInstance(lowerCAmelCase_							,  np.ndarray)

      # Test not batched input (GLPNImageProcessor doesn't support batching)
      a_       		=image_processing(image_inputs[0]							,  return_tensors="pt").pixel_values
      self.assertTrue(encoded_images.shape[-1] % self.image_processor_tester.size_divisor == 0)
      self.assertTrue(encoded_images.shape[-2] % self.image_processor_tester.size_divisor == 0)




 def       lowercase_  (   self) ->      int:



      """simple docstring"""







      a_       		=self.image_processing_class(**self.image_processor_dict)
      # create random PyTorch tensors
      a_       		=prepare_image_inputs(self.image_processor_tester							,  equal_resolution=lowerCAmelCase_							,  torchify=lowerCAmelCase_)
      for image in image_inputs:
           self.assertIsInstance(lowerCAmelCase_							,  torch.Tensor)

      # Test not batched input (GLPNImageProcessor doesn't support batching)
      a_       		=image_processing(image_inputs[0]							,  return_tensors="pt").pixel_values
      self.assertTrue(encoded_images.shape[-1] % self.image_processor_tester.size_divisor == 0)
      self.assertTrue(encoded_images.shape[-2] % self.image_processor_tester.size_divisor == 0)







'''simple docstring'''


import os

# Precomputes a list of the 100 first triangular numbers
lowercase							       =			[int(0.5 * n * (n + 1)) for n in range(1, 101)]






def  UpperCAmelCase_       (		):


     '''simple docstring'''







     a_       		=os.path.dirname(os.path.realpath(lowercase__       )       )
     a_       		=os.path.join(lowercase__       ,	"words.txt"       )

     a_       		=""
     with open(lowercase__       ) as f:
          a_       		=f.readline()

     a_       		=[word.strip("\""       ) for word in words.strip("\r\n"       ).split(","       )]
     a_       		=[
         word
         for word in [sum(ord(lowercase__       ) - 6_4 for x in word       ) for word in words]
         if word in TRIANGULAR_NUMBERS
     ]
     return len(lowercase__       )


if __name__ == "__main__":
  print(solution())


