#!/usr/bin/ruby a=[] gets a<=cur idx[turn]+=1 end if idx[turn]==a[turn].size break end cur=a[turn][idx[turn]] r+=1 turn=turn^1 } r }.max