import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, core.stdc.stdio; immutable int INF = 1 << 28; void main() { auto N = readln.chomp.to!int; auto F = N.iota.map!(_ => readln.split.map!(to!int).array).array; auto dp = new int[](1 << N); foreach (mask; 0..(1 << N)) { int i = bsf(~mask); foreach (j; i+1..N) { if (!(mask & (1 << j))) { dp[mask | (1 << i) | (1 << j)] = max(dp[mask | (1 << i) | (1 << j)], dp[mask] + F[i][j]); } } } dp[(1 << N) - 1].writeln; }