namespace; include rt; // a +1 loop whose bound is len of the fixed array: the check is gone, the sum is not fn acc(fixed int[?] f) { int n = len(f), i = 0, s = 0; for (; i < n; i += 1) f[i] = i + 1; for (i = 0; i < n; i++) s = s + f[i]; return s; } o3 fn acc3(fixed int[?] f) { int n = len(f), i = 0, s = 0; for (; i < n; i++) f[i] = i + 1; for (i = 0; i < n; i++) s += f[i]; return s; } o3 fn small(fixed int[?] f) { int n = len(f), c = 0, i, j; for (i = 2; i < n; i++) f[i] = 1; for (i = 2; i * i < n; i++) if (f[i]) for (j = i * i; j < n; j += i) f[j] = 0; for (i = 2; i < n; i++) c += f[i]; return c; } fn main() { fixed int[?] f = rt.new(fixed int[?], 10); fixed int[?] g = rt.new(fixed int[?], 20); rt.put_n(acc(f)); rt.put_c(32); rt.put_n(acc3(f)); rt.put_c(32); rt.put_n(small(g)); rt.put_c(10); rt.free(d*f); rt.free(d*g); return 0; }