private static void generate() {
        for (int i = 0; i < ROW; i++)
            Arrays.fill(C[i], -1);
        for (int i = 0; i < MAX; i++)
            BEST[i] = i;
        
        for (int i = 1; i < COLUMN; i++)
            C[0][i] = 1;
        for (int i = 1; i < ROW; i++)
            C[i][0] = 1;
        
        for (int i = 1; i < ROW; i++)
            for (int j = 1; j < COLUMN; j++) {
                C[i][j] = C[i-1][j] + C[i][j-1];
                if (C[i][j] > MAX) C[i][j] = MAX;
                if (C[i][j] > 0 && C[i][j] < MAX) {
                    BEST[(int) C[i][j]] = Math.min((int) C[i][j], BEST[(int) C[i][j]]);
                }
            }
    }