# import algorithm, future, macros, math, sequtils, sets, strutils, tables import algorithm, sugar, macros, math, sequtils, sets, strutils, tables macro unpack(rhs: seq, cnt: static[int]): auto = let v = genSym(); result = quote do:(let `v` = `rhs`;()) if NimMinor <= 17: for i in 0..>=`(n: var int, m: int) = n = n shr m proc `?=`(n: var SomeNumber, m: SomeNumber) = n = max(n, m) proc newSeq2[T](n1, n2: Natural): seq[seq[T]] = newSeqWith(n1, newSeq[T](n2)) proc newSeq3[T](n1, n2, n3: Natural): seq[seq[seq[T]]] = newSeqWith(n1, newSeqWith(n2, newSeq[T](n3))) # -------------------------------------------------- # var (X, Y, Z) = input(int, 3) var res = 0 if X == 0 and Z > 0: inc X dec Z if Y == 0 and Z > 0: inc Y dec Z while X > 0 and Y > 0: inc res dec X dec Y if X == 0 and Z > 0: inc X dec Z if Y == 0 and Z > 0: inc Y dec Z echo res