Contextuality and noncontextuality measures and generalized Bell inequalities for cyclic systems