func main() var n: int :: cui@inputInt() var m: int :: cui@inputInt() var nums: []int :: #[n]int var reverseFlag: bool :: false var skipFlag: bool :: false var id: int :: 0 var prev: []char var add: int :: 0 for i(1, m) var s: []char :: cui@inputStr() if a(skipFlag) if(s[0] = 'd' & s = prev) break a end if do skipFlag :: false do nums[id] :- add do add :: 0 do next(&id, reverseFlag, n) end if switch(s) case "number" do nums[id] :+ 1 case "drawtwo", "drawfour" do add :+ s = "drawtwo" ?(2, 4) do skipFlag :: true do nums[id] :+ 1 case "skip" do nums[id] :+ 1 if(i <> m) do next(&id, reverseFlag, n) end if case "reverse" do reverseFlag :: !reverseFlag do nums[id] :+ 1 end switch do prev :: s if(i <> m) do next(&id, reverseFlag, n) end if end for do cui@print("\{id + 1} \{nums[id]}\n") func next(id: &int, reverseFlag: bool, n: int) do id :+ reverseFlag ?(n - 1, 1) do id :% n end func end func