#include <stdio.h> #include <string.h> #define MAX 100000 bool skipped[MAX]; // forbidden values for x void skip(int v) { if (v<MAX) { skipped[v] = true; } } #define N 10001 int a[N]; // A167209 int main() { memset(skipped, 0, sizeof(skipped)); memset(a, 0, sizeof(a)); int x = 0; for (int n=0; n<N; n++) { if (n==0) { a[n] = 0; } else { while (skipped[x]) { x++; if (x==MAX) { fprintf(stderr, "# ouch\n"); return 1; } } a[n] = a[n-1] + x; } printf("%d %d\n", n, a[n]); fflush(stdout); for (int i=0; i<=n; i++) { skip(a[n]+a[i]); skip(a[n]-a[i]); } if (a[n]%2==0) { skip(a[n]/2); } } return 0; }