Python Segment Tree Cpp Canvas