




'''simple docstring'''
A				: Tuple					      =			[
    ["""ab-e1""", """ac-e3""", """ad-e5""", """bc-e4""", """bd-e2""", """be-e6""", """bh-e12""", """cd-e2""", """ce-e4""",
     """de-e1""", """df-e8""", """dg-e5""", """dh-e10""", """ef-e3""", """eg-e2""", """fg-e6""", """gh-e6""", """hi-e3"""],
    ["""ab-e1""", """ac-e3""", """ad-e5""", """bc-e4""", """bd-e2""", """be-e6""", """cd-e2""", """de-e1""", """df-e8""",
     """ef-e3""", """eg-e2""", """fg-e6"""],
    ["""ab-e1""", """ac-e3""", """bc-e4""", """bd-e2""", """de-e1""", """df-e8""", """dg-e5""", """ef-e3""", """eg-e2""",
     """eh-e12""", """fg-e6""", """fh-e10""", """gh-e6"""],
    ["""ab-e1""", """ac-e3""", """bc-e4""", """bd-e2""", """bh-e12""", """cd-e2""", """df-e8""", """dh-e10"""],
    ["""ab-e1""", """ac-e3""", """ad-e5""", """bc-e4""", """bd-e2""", """cd-e2""", """ce-e4""", """de-e1""", """df-e8""",
     """dg-e5""", """ef-e3""", """eg-e2""", """fg-e6"""]
]
def 							snake_case_    (  a__						:      Optional[Any]     ):



    """simple docstring"""




    __lowercase     							=		set()
    for row in edge_array:
        for item in row:
            distinct_edge.add(item[0]     )
    return list(a__     )
def 							snake_case_    (  a__						:      List[str]       ,a__						:      Optional[Any]     ):



    """simple docstring"""




    __lowercase     							=		["""0"""] * len(a__     )
    for i, row in enumerate(a__     ):
        for item in row:
            if distinct_edge in item[0]:
                __lowercase     							=		"""1"""
                break
    return "".join(a__     )
def 							snake_case_    (  a__						:      Optional[int]     ):



    """simple docstring"""




    __lowercase     							=		get_distinct_edge(a__     )
    __lowercase     							=		{}

    for item in distinct_edge:
        __lowercase     							=		get_bitcode(a__       ,a__     )
        # print('bit',bit)
        # bt=''.join(bit)
        __lowercase     							=		bit.count("""1"""     )
        __lowercase     							=		[s, bit]
    # Store [Distinct edge, WT(Bitcode), Bitcode] in descending order
    __lowercase     							=		[
        [k, v[0], v[1]]
        for k, v in sorted(frequency_table.items()       ,key=lambda a__     : v[1][0]       ,reverse=a__     )
    ]
    return sorted_frequency_table
def 							snake_case_    (  a__						:      Any     ):



    """simple docstring"""




    __lowercase     							=		{}
    for _, item in enumerate(a__     ):
        nodes.setdefault(item[2]       ,[]     ).append(item[0]     )
    return nodes
def 							snake_case_    (  a__						:      List[str]     ):



    """simple docstring"""




    __lowercase     							=		{}
    for key, value in nodes.items():
        __lowercase     							=		value
    return cluster
def 							snake_case_    (  a__						:      List[Any]     ):



    """simple docstring"""




    return [i * 1_00 / len(a__     ) for i in cluster]
def 							snake_case_    (  ):



    """simple docstring"""




    print("""\nNodes\n"""     )
    for key, value in nodes.items():
        print(a__       ,a__     )
    print("""\nSupport\n"""     )
    print(a__     )
    print("""\n Cluster \n"""     )
    for key, value in sorted(cluster.items()       ,reverse=a__     ):
        print(a__       ,a__     )
    print("""\n Graph\n"""     )
    for key, value in graph.items():
        print(a__       ,a__     )
    print("""\n Edge List of Frequent subgraphs \n"""     )
    for edge_list in freq_subgraph_edge_list:
        print(a__     )
def 							snake_case_    (  a__						:      int       ,a__						:      List[str]       ,a__						:      str       ,a__						:      Optional[int]     ):



    """simple docstring"""




    for i in cluster[ca]:
        __lowercase     							=		0
        __lowercase     							=		ca + 1
        while ca < max(cluster.keys()     ):
            for j in cluster[ca]:
                if int(a__       ,2     ) & int(a__       ,2     ) == int(a__       ,2     ):
                    if tuple(nodes[i]     ) in graph:
                        graph[tuple(nodes[i]     )].append(nodes[j]     )
                    else:
                        __lowercase     							=		[nodes[j]]
                    count += 1
            if count == 0:
                __lowercase     							=		ca + 1
            else:
                break
def 							snake_case_    (  a__						:      List[str]       ,a__						:      Dict     ):



    """simple docstring"""




    __lowercase     							=		cluster[max(cluster.keys()     )]
    __lowercase     							=		"""Header"""
    __lowercase     							=		{}
    for i in x:
        if (["Header"],) in graph:
            graph[(["Header"],)].append(x[i]     )
        else:
            __lowercase     							=		[x[i]]
    for i in x:
        __lowercase     							=		[["""Header"""]]
    __lowercase     							=		1
    while i < max(a__     ) - 1:
        create_edge(a__       ,a__       ,a__       ,a__     )
        __lowercase     							=		i + 1
    return graph
def 							snake_case_    (  a__						:      int       ,a__						:      Optional[int]       ,a__						:      int       ,a__						:      Union[str, Any]=None     ):



    """simple docstring"""




    __lowercase     							=		(path or []) + [start]
    if start == end:
        paths.append(a__     )
    for node in graph[start]:
        if tuple(a__     ) not in path:
            my_dfs(a__       ,tuple(a__     )       ,a__       ,a__     )
def 							snake_case_    (  a__						:      Any       ,a__						:      Any       ,a__						:      Union[str, Any]     ):



    """simple docstring"""




    __lowercase     							=		int(s / 1_00 * (len(a__     ) - 1)     )
    for i in cluster[k]:
        my_dfs(a__       ,tuple(cluster[k][i]     )       ,(["""Header"""],)     )
def 							snake_case_    (  a__						:      Union[str, Any]     ):



    """simple docstring"""




    __lowercase     							=		[]
    for edges in paths:
        __lowercase     							=		[]
        for j in range(len(a__     ) - 1     ):
            __lowercase     							=		list(edges[j]     )
            for e in temp:
                __lowercase     							=		(e[0], e[1])
                el.append(a__     )
        freq_sub_el.append(a__     )
    return freq_sub_el
def 							snake_case_    (  a__						:      List[Any]     ):



    """simple docstring"""




    for i in range(len(a__     )     ):
        for j in range(len(edge_array[i]     )     ):
            __lowercase     							=		edge_array[i][j].split("""-"""     )
            __lowercase     							=		t


if __name__ == "__main__":
  preprocess(edge_array)
  A				: List[str]					      =			get_frequency_table(edge_array)
  A				: List[Any]					      =			get_nodes(frequency_table)
  A				: str					      =			get_cluster(nodes)
  A				: Optional[int]					      =			get_support(cluster)
  A				: int					      =			construct_graph(cluster, nodes)
  find_freq_subgraph_given_support(60, cluster, graph)
  A				: list					      =			[]
  A				: Any					      =			freq_subgraphs_edge_list(paths)
  print_all()










'''simple docstring'''
import os
def 							snake_case_    (  ):



    """simple docstring"""




    __lowercase     							=		os.path.dirname(os.path.realpath(a__     )     )
    __lowercase     							=		os.path.join(a__       ,"""triangle.txt"""     )

    with open(a__     ) as f:
        __lowercase     							=		f.readlines()

    __lowercase     							=		[[int(a__     ) for y in x.rstrip("""\r\n"""     ).split(""" """     )] for x in triangle]

    for i in range(1       ,len(a__     )     ):
        for j in range(len(a[i]     )     ):
            __lowercase     							=		a[i - 1][j] if j != len(a[i - 1]     ) else 0
            __lowercase     							=		a[i - 1][j - 1] if j > 0 else 0
            a[i][j] += max(a__       ,a__     )
    return max(a[-1]     )


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




