Maximize It!

  • + 0 comments

    import itertools n = input() n = n.split(" ") n = list(map(int, n)) k = n[0] m = n[1] s = 0 finallist = [] for i in range(0, k): n = input() n = n.split(" ") n = list(map(int, n)) n = n[1:] n = [i**2 for i in n] finallist.append(n) combinations = list(itertools.product(*finallist)) result = [] for i in combinations: result.append(sum(i)%m) print(max(result))