I’m trying to follow the SBC example in the Stan’s user guide but I have some questions
In 25.3.3, it says

K
is the number of parameters 
N
is the total number of simulated data sets and fits 
M
is the number of posterior draws per simulated data set
but section 25.4.1 is confusing. Shouldn’t I have one rank for each parameter for each simulation? That is r_{n,k} rather than r_{n,m}?
So to make it consistent with the previous page, shouldn’t this
Inputs: M draws, J bins, N parameters, ranks r[n, m]
b[1:J] = 0
for (m in 1:M)
++b[1 + floor(r[n, m] * J / (M + 1))]
be as follows
Inputs: N simulations, J bins, K parameters, ranks r[n, k]
b[1:J, 1:K] = 0
for (k in 1:K)
for (n in 1:N)
++b[1 + floor(r[n, k] * J / (N + 1)), k]