import sequtils,algorithm,math proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "" .} proc scan(): int = while true: var k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord template times*(n:int,body) = (for _ in 0.. 0) if rgb.len == 0 : break # echo rgb,ans let x = rgb.max() let y = rgb.min() if rgb.len == 3: # 3つ rgb = rgb.mapIt(it - y) ans += y elif rgb.len == 2: if x <= 2 : break if x - y <= 1: let n = (x div 4).min(y div 4) ans += n rgb = @[x - 2 * n,y - 2 * n] else: let n = (x div 3).min(y) ans += n rgb = @[y - n,x - n * 3] elif rgb.len == 1: ans += x div 5 break echo ans