use size_t instead of intmax_t for indices and positions