1 for (int c0 = 1; c0 <= M; c0 += 1)
2   for (int c1 = 2; c1 <= M + c0; c1 += 1)
3     for (int c2 = max(1, -c0 + c1); c2 <= min(M, c1 - 1); c2 += 1)
4       S1(c0, c2, c1 - c2);
5