Problem:
Rabbit Party A rabbit Taro decided to hold a party and invite some friends as guests.
He has n rabbit friends, and m pairs of rabbits are also friends with each other.

Friendliness of each pair is expressed  with a positive integer.
If two rabbits are not friends, their friendliness is assumed to be 0. When a rabbit is invited to the party, his satisfaction score is defined as the minimal friendliness with any other guests.
 The satisfaction of the party itself is defined as the sum of satisfaction score  for all the guests. To maximize satisfaction scores for the party,  who should Taro invite?
Write a program to calculate the maximal possible satisfaction score for the party. Input The first line of the input contains two integers, n and m ( 1 \leq n \leq 100 , 0 \leq m \leq 100 ).
The rabbits are numbered from 1 to n . Each of the following m lines has three integers, u , v and f . u and v ( 1 \leq u, v \leq n , u \neq v , 1 \leq f \leq 1,000,000 ) stands for  the rabbits' number, and f stands for their friendliness. You may assume that the friendliness of  a pair of rabbits will be given at most once. Output Output the maximal possible satisfaction score of the party in a line. Sample Input 1 3 3
1 2 3
2 3 1
3 1 2 Output for the Sample Input 1 6 Sample Input 2 2 1
1 2 5 Output for the Sample Input 2 10 Sample Input 3 1 0 Output for the Sample Input 3 0 Sample Input 4 4 5
1 2 4
1 3 3
2 3 7
2 4 5
3 4 6 Output for the Sample Input 4 16

Solution (Python):
from itertools import product
def main():
    INF = 10**9
    N, M = map(int, input().split())
    E = [[INF]*N for i in range(N)]
    G = [set() for i in range(N)]
    D = [0]*N
    for i in range(M):
        u, v, f = map(int, input().split()); u -= 1; v -= 1
        E[u][v] = E[v][u] = f
        G[u].add(v)
        G[v].add(u)
        D[u] += 1; D[v] += 1

    def calc(vs):
        if len(vs) == 1:
            return 0
        res = 0
        for ps in product([0, 1], repeat=len(vs)):
            R = [v for p, v in zip(ps, vs) if p]
            if len(R) == 1:
                continue
            rs = 0
            for v in R:
                r = INF
                for w in R:
                    if v == w:
                        continue
                    r = min(r, E[v][w])
                rs += r
            res = max(res, rs)
        return res

    def dfs(V, P, X):
        if not P and not X:
            return calc(V)
        u = next(iter(X or P))
        r = 0
        for v in P - G[u]:
            r = max(r, dfs(V | {v}, P & G[v], X & G[v]))
            P.remove(v)
            X.add(v)
        return r

    *I, = range(N)
    I.sort(key = D.__getitem__, reverse=1)

    ans = 0
    P = set(range(N))
    X = set()
    for v in I:
        ans = max(ans,  dfs({v}, P & G[v], X & G[v]))
        P.remove(v)
        X.add(v)
    print(ans)
main()

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,m = LI()
    e = []
    f = [[0]*n for i in range(n)]
    v = [[] for i in range(n)]
    for i in range(m):
        a,b,c = LI()
        a -= 1
        b -= 1
        e.append([a,b,c])
        f[a][b] = c
        f[b][a] = c
        v[a].append(b)
        v[b].append(a)
    ans = 0
    S = []
    for p in range(n):
        K = [{p}]
        for q in v[p]:
            K += [s|{q} for s in K]
        S += K
    for s in S:
        for x in s:
            for y in s:
                if x == y:
                    continue
                if f[x][y] > 0:
                    continue
                else:
                    break
            else:
                continue
            break
        else:
            m = [float("inf")]*n
            for a in s:
                for b in s:
                    if a == b:
                        continue
                    if f[a][b] < m[a]:
                        m[a] = f[a][b]
                    if f[a][b] < m[b]:
                        m[b] = f[a][b]
            k = 0
            for i in m:
                if i != float("inf"):
                    k += i
            if ans < k:
                ans = k


    print(ans)
    return


if __name__ == "__main__":
    solve()

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    def f(n,m):
        e = [[0]*n for _ in range(n)]
        cs = []
        for _ in range(m):
            a,b,c = LI_()
            c += 1
            e[a][b] = c
            e[b][a] = c
            cs.append([a,b])

        r = 0
        while cs:
            ns = []
            for a in cs:
                t = 0
                for i in a:
                    m = inf
                    for j in a:
                        if i == j:
                            continue
                        if m > e[i][j]:
                            m = e[i][j]
                    t += m
                if r < t:
                    r = t
                for i in range(a[-1]+1,n):
                    f = True
                    for j in a:
                        if e[i][j] < 1:
                            f = False
                            break
                    if f:
                        ns.append(a + [i])
            cs = ns

        return r


    while 1:
        n,m = LI()
        if n == 0:
            break
        rr.append(f(n,m))
        
        break

    return '\n'.join(map(str,rr))


print(main())