You are viewing a single comment's thread. Return to all comments →
K, M = map(int, input().split()) could = {0} for i in range(K): new = list(map(int, input().split()))[1:] could = {(n*n + c) % M for n in new for c in could} print(max(could))
Maximize It!
You are viewing a single comment's thread. Return to all comments →