I've not done that yet, but have thought about it. I would transfer half of it to one bottling bucket and half to another if you have something you can use. Otherwise, you can just take turns.
then I'd probably start with the kegged beer, half in the bucket, then straight to the keg. No sugar! Then do the other half with, yes, half the sugar and bottle. I guess you could even just do the first half straight into the keg as you probably would stir up to much trub if you just stick the siphon in halfway.