import sequtils,strutils,osproc;const p = @[ """echo '{.experimental.} import threadpool import sequtils,strutils,algorithm,math,future,macros template get*():string = stdin.readLine().strip() macro unpack*(arr: auto,cnt: static[int]): auto = let t = genSym(); result = quote do:(let `t` = `arr`;()) for i in 0.. 1600 ms let M = get().parseInt() ABT = newSeqWith(M,get().split().map(parseFloat)) proc solve(m:int): float = let (a,b,t) = ABT[m].unpack(3) proc newton(): float = result = 1.1 var lnx = ln(result) for i in 1..25: result -= (a*lnx + b*lnx.ln - t.ln) / ((a*lnx + b) / (result*lnx)) lnx = result.ln return if a == 0: exp(pow(t, 1.0/b)) elif b == 0: pow(t, 1.0/a) else: newton() proc main() = var ans = newSeq[float](M) parallel: for m in 0..ans.high: ans[m] = spawn solve(m) for m in 0.. h.nim""","nim --hints:off -o:b.out -d:release --threads:on --experimental --parallelBuild:4 c h.nim"].mapIt(it.gorge) discard execProcess("""a="$(ls -1t ../time/ | head -1)";./b.out < ../test_in/$a > ../out/$a""")