





from __future__ import annotations


def       UpperCamelCase__(			UpperCamelCase__     :			list[float]					,	UpperCamelCase__     :			Optional[int]    )->int:
       print(f"Vertex\tShortest Distance from vertex {src}"    )
       for i, d in enumerate(UpperCamelCase__    ):
              print(f"{i}\t\t{d}"    )


def       UpperCamelCase__(			UpperCamelCase__     :			list[dict[str, int]]					,	UpperCamelCase__     :			list[float]					,	UpperCamelCase__     :			int    )->int:
       for j in range(UpperCamelCase__    ):
              A__   ,      A__   ,      A__		   =		(graph[j][k] for k in ['''src''', '''dst''', '''weight'''])
              if distance[u] != float('''inf'''    ) and distance[u] + w < distance[v]:
                     return True
       return False


def       UpperCamelCase__(			UpperCamelCase__     :			list[dict[str, int]]					,	UpperCamelCase__     :			int					,	UpperCamelCase__     :			int					,	UpperCamelCase__     :			int    )->list[float]:
       A__		   =		[float('''inf'''    )] * vertex_count
       A__		   =		0.0

       for _ in range(vertex_count - 1    ):
              for j in range(UpperCamelCase__    ):
                     A__   ,      A__   ,      A__		   =		(graph[j][k] for k in ['''src''', '''dst''', '''weight'''])

                     if distance[u] != float('''inf'''    ) and distance[u] + w < distance[v]:
                            A__		   =		distance[u] + w

       A__		   =		check_negative_cycle(UpperCamelCase__					,	UpperCamelCase__					,	UpperCamelCase__    )
       if negative_cycle_exists:
              raise Exception('''Negative cycle found'''    )

       return distance


if __name__ == "__main__":
       import doctest

       doctest.testmod()

       a__: List[Any]							   =						int(input('Enter number of vertices: ').strip())
       a__: Dict							   =						int(input('Enter number of edges: ').strip())

       a__: list[dict[str, int]]							   =						[{} for _ in range(E)]

       for i in range(E):
              print('Edge ', i + 1)
              a__   ,     a__   ,     a__: Union[str, Any]							   =						(
                  int(x)
                  for x in input('Enter source, destination, weight: ').strip().split(' ')
              )
              a__: Tuple							   =						{'src': src, 'dst': dest, 'weight': weight}

       a__: List[Any]							   =						int(input('\nEnter shortest path source:').strip())
       a__: List[Any]							   =						bellman_ford(graph, V, E, source)
       print_distance(shortest_distance, 0)












import json
import os
import unittest

from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer

from ...test_tokenization_common import TokenizerTesterMixin




class        SCREAMING_SNAKE_CASE__					(		UpperCamelCase__							,   unittest.TestCase ):
 __SCREAMING_SNAKE_CASE							=      CTRLTokenizer
 __SCREAMING_SNAKE_CASE							=      False
 __SCREAMING_SNAKE_CASE							=      False



 def 							UpperCamelCase     (				self					):
        super().setUp()

        # Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
        A__		   =		['''adapt''', '''re@@''', '''a@@''', '''apt''', '''c@@''', '''t''', '''<unk>''']
        A__		   =		dict(zip(__lowerCamelCase,range(len(__lowerCamelCase					)					)					)					)
        A__		   =		['''#version: 0.2''', '''a p''', '''ap t</w>''', '''r e''', '''a d''', '''ad apt</w>''', '''''']
        A__		   =		{'''unk_token''': '''<unk>'''}

        A__		   =		os.path.join(self.tmpdirname,VOCAB_FILES_NAMES['''vocab_file''']					)
        A__		   =		os.path.join(self.tmpdirname,VOCAB_FILES_NAMES['''merges_file''']					)
        with open(self.vocab_file,'''w''',encoding='''utf-8'''					) as fp:
               fp.write(json.dumps(__lowerCamelCase					) + '''\n'''					)
        with open(self.merges_file,'''w''',encoding='''utf-8'''					) as fp:
               fp.write('''\n'''.join(__lowerCamelCase					)					)



 def 							UpperCamelCase     (				self,**__lowerCamelCase					):
        kwargs.update(self.special_tokens_map					)
        return CTRLTokenizer.from_pretrained(self.tmpdirname,**__lowerCamelCase					)



 def 							UpperCamelCase     (				self,__lowerCamelCase					):
        A__		   =		'''adapt react readapt apt'''
        A__		   =		'''adapt react readapt apt'''
        return input_text, output_text




 def 							UpperCamelCase     (				self					):
        A__		   =		CTRLTokenizer(self.vocab_file,self.merges_file,**self.special_tokens_map					)
        A__		   =		'''adapt react readapt apt'''
        A__		   =		'''adapt re@@ a@@ c@@ t re@@ adapt apt'''.split()
        A__		   =		tokenizer.tokenize(__lowerCamelCase					)
        self.assertListEqual(__lowerCamelCase,__lowerCamelCase					)

        A__		   =		tokens + [tokenizer.unk_token]

        A__		   =		[0, 1, 2, 4, 5, 1, 0, 3, 6]
        self.assertListEqual(tokenizer.convert_tokens_to_ids(__lowerCamelCase					),__lowerCamelCase					)





