import strutils, sequtils, math, algorithm proc solve() = var N = stdin.readLine.parseInt M = mapIt(1..N, stdin.readLine.parseInt) dp: array[2^16, int] const INF = 10000 * 15 dp.fill(INF) dp[0] = 0 for S in 0..<1 shl N: var m_sum = 0 for i in 0..