Maximize It!

  • + 0 comments

    from itertools import product A, B = map(int, input().split(" "))

    appended_list = [] for i in range (1, A+1): K = list(map(int, input().split(" "))) all_list= [n for n in K if n != K[0]] appended_list.append(all_list)

    V = list(product(*(appended_list)))

    greatest_value = 0 for j in V: add_num = 0 for l in j:
    add_num = add_num+l2
    current_value = add_num%B if current_value > greatest_value: greatest_value = current_value else: greatest_value = greatest_value

    print(greatest_value)