code for binary splitting tournaments