338. Familystrokes Link < 2026 Update >

if childCnt > 0: // v has at least one child → internal internalCnt += 1 if childCnt >= 2: horizontalCnt += 1

Proof. The drawing rules require a vertical line from the node down to the row of its children whenever it has at least one child. The line is mandatory and unique, hence exactly one vertical stroke. ∎ An internal node requires a horizontal stroke iff childCnt ≥ 2 . 338. FamilyStrokes

import sys sys.setrecursionlimit(200000) if childCnt &gt; 0: // v has at