SRM 315 DIV 2 easy mid hard

hard is josephus problem
O(n)