QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294378#4825. Even and Odd Combinationsucup-team112#AC ✓3ms3568kbC++209.4kb2023-12-30 13:12:542023-12-30 13:12:55

Judging History

你现在查看的是最新测评结果

  • [2023-12-30 13:12:55]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3568kb
  • [2023-12-30 13:12:54]
  • 提交

answer

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

namespace templates {
// type
using ll  = long long;
using ull = unsigned long long;
template <class T>
using pq = priority_queue<T>;
template <class T>
using qp = priority_queue<T, vector<T>, greater<T>>;
#define vec(T, A, ...) vector<T> A(__VA_ARGS__);
#define vvec(T, A, h, ...) vector<vector<T>> A(h, vector<T>(__VA_ARGS__));
#define vvvec(T, A, h1, h2, ...)                                                                   \
    vector<vector<vector<T>>> A(h1, vector<vector<T>>(h2, vector<T>(__VA_ARGS__)));

// for loop
#define fori1(a) for (ll _ = 0; _ < (a); _++)
#define fori2(i, a) for (ll i = 0; i < (a); i++)
#define fori3(i, a, b) for (ll i = (a); i < (b); i++)
#define fori4(i, a, b, c) for (ll i = (a); ((c) > 0 || i > (b)) && ((c) < 0 || i < (b)); i += (c))
#define overload4(a, b, c, d, e, ...) e
#define fori(...) overload4(__VA_ARGS__, fori4, fori3, fori2, fori1)(__VA_ARGS__)

// declare and input
// clang-format off
#define INT(...) int __VA_ARGS__; inp(__VA_ARGS__);
#define LL(...) ll __VA_ARGS__; inp(__VA_ARGS__);
#define STRING(...) string __VA_ARGS__; inp(__VA_ARGS__);
#define CHAR(...) char __VA_ARGS__; inp(__VA_ARGS__);
#define DOUBLE(...) double __VA_ARGS__; STRING(str___); __VA_ARGS__ = stod(str___);
#define VEC(T, A, n) vector<T> A(n); inp(A);
#define VVEC(T, A, n, m) vector<vector<T>> A(n, vector<T>(m)); inp(A);
// clang-format on

// const value
const ll MOD1   = 1000000007;
const ll MOD9   = 998244353;
const double PI = acos(-1);

// other macro
#ifndef RIN__LOCAL
#define endl "\n"
#endif
#define spa ' '
#define len(A) ll(A.size())
#define all(A) begin(A), end(A)

// function
vector<char> stoc(string &S) {
    int n = S.size();
    vector<char> ret(n);
    for (int i = 0; i < n; i++) ret[i] = S[i];
    return ret;
}
string ctos(vector<char> &S) {
    int n      = S.size();
    string ret = "";
    for (int i = 0; i < n; i++) ret += S[i];
    return ret;
}

template <class T>
auto min(const T &a) {
    return *min_element(all(a));
}
template <class T>
auto max(const T &a) {
    return *max_element(all(a));
}
template <class T, class S>
auto clamp(T &a, const S &l, const S &r) {
    return (a > r ? r : a < l ? l : a);
}
template <class T, class S>
inline bool chmax(T &a, const S &b) {
    return (a < b ? a = b, 1 : 0);
}
template <class T, class S>
inline bool chmin(T &a, const S &b) {
    return (a > b ? a = b, 1 : 0);
}
template <class T, class S>
inline bool chclamp(T &a, const S &l, const S &r) {
    auto b = clamp(a, l, r);
    return (a != b ? a = b, 1 : 0);
}

template <typename T>
T sum(vector<T> &A) {
    T tot = 0;
    for (auto a : A) tot += a;
    return tot;
}

template <typename T>
vector<T> compression(vector<T> X) {
    sort(all(X));
    X.erase(unique(all(X)), X.end());
    return X;
}

// input and output
namespace io {

// vector<T>
template <typename T>
istream &operator>>(istream &is, vector<T> &A) {
    for (auto &a : A) is >> a;
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &A) {
    for (size_t i = 0; i < A.size(); i++) {
        os << A[i];
        if (i != A.size() - 1) os << ' ';
    }
    return os;
}

// vector<vector<T>>
template <typename T>
istream &operator>>(istream &is, vector<vector<T>> &A) {
    for (auto &a : A) is >> a;
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, vector<vector<T>> &A) {
    for (size_t i = 0; i < A.size(); i++) {
        os << A[i];
        if (i != A.size() - 1) os << endl;
    }
    return os;
}

// pair<S, T>
template <typename S, typename T>
istream &operator>>(istream &is, pair<S, T> &A) {
    is >> A.first >> A.second;
    return is;
}
template <typename S, typename T>
ostream &operator<<(ostream &os, pair<S, T> &A) {
    os << A.first << ' ' << A.second;
    return os;
}

// vector<pair<S, T>>
template <typename S, typename T>
istream &operator>>(istream &is, vector<pair<S, T>> &A) {
    for (size_t i = 0; i < A.size(); i++) {
        is >> A[i];
    }
    return is;
}
template <typename S, typename T>
ostream &operator<<(ostream &os, vector<pair<S, T>> &A) {
    for (size_t i = 0; i < A.size(); i++) {
        os << A[i];
        if (i != A.size() - 1) os << endl;
    }
    return os;
}

// tuple
template <typename T, size_t N>
struct TuplePrint {
    static ostream &print(ostream &os, const T &t) {
        TuplePrint<T, N - 1>::print(os, t);
        os << ' ' << get<N - 1>(t);
        return os;
    }
};
template <typename T>
struct TuplePrint<T, 1> {
    static ostream &print(ostream &os, const T &t) {
        os << get<0>(t);
        return os;
    }
};
template <typename... Args>
ostream &operator<<(ostream &os, const tuple<Args...> &t) {
    TuplePrint<decltype(t), sizeof...(Args)>::print(os, t);
    return os;
}

// io functions
void FLUSH() {
    cout << flush;
}

void print() {
    cout << endl;
}
template <class Head, class... Tail>
void print(Head &&head, Tail &&...tail) {
    cout << head;
    if (sizeof...(Tail)) cout << spa;
    print(std::forward<Tail>(tail)...);
}

template <typename T, typename S>
void prisep(vector<T> &A, S sep) {
    int n = A.size();
    for (int i = 0; i < n; i++) {
        cout << A[i];
        if (i != n - 1) cout << sep;
    }
    cout << endl;
}
template <typename T, typename S>
void priend(T A, S end) {
    cout << A << end;
}
template <typename T>
void prispa(T A) {
    priend(A, spa);
}
template <typename T, typename S>
bool printif(bool f, T A, S B) {
    if (f)
        print(A);
    else
        print(B);
    return f;
}

template <class... T>
void inp(T &...a) {
    (cin >> ... >> a);
}

} // namespace io
using namespace io;

// read graph
vector<vector<int>> read_edges(int n, int m, bool direct = false, int indexed = 1) {
    vector<vector<int>> edges(n, vector<int>());
    for (int i = 0; i < m; i++) {
        INT(u, v);
        u -= indexed;
        v -= indexed;
        edges[u].push_back(v);
        if (!direct) edges[v].push_back(u);
    }
    return edges;
}
vector<vector<int>> read_tree(int n, int indexed = 1) {
    return read_edges(n, n - 1, false, indexed);
}

template <typename T = long long>
vector<vector<pair<int, T>>> read_wedges(int n, int m, bool direct = false, int indexed = 1) {
    vector<vector<pair<int, T>>> edges(n, vector<pair<int, T>>());
    for (int i = 0; i < m; i++) {
        INT(u, v);
        T w;
        inp(w);
        u -= indexed;
        v -= indexed;
        edges[u].push_back({v, w});
        if (!direct) edges[v].push_back({u, w});
    }
    return edges;
}
template <typename T = long long>
vector<vector<pair<int, T>>> read_wtree(int n, int indexed = 1) {
    return read_wedges<T>(n, n - 1, false, indexed);
}

// yes / no
namespace yesno {

// yes
inline bool yes(bool f = true) {
    cout << (f ? "yes" : "no") << endl;
    return f;
}
inline bool Yes(bool f = true) {
    cout << (f ? "Yes" : "No") << endl;
    return f;
}
inline bool YES(bool f = true) {
    cout << (f ? "YES" : "NO") << endl;
    return f;
}

// no
inline bool no(bool f = true) {
    cout << (!f ? "yes" : "no") << endl;
    return f;
}
inline bool No(bool f = true) {
    cout << (!f ? "Yes" : "No") << endl;
    return f;
}
inline bool NO(bool f = true) {
    cout << (!f ? "YES" : "NO") << endl;
    return f;
}

// possible
inline bool possible(bool f = true) {
    cout << (f ? "possible" : "impossible") << endl;
    return f;
}
inline bool Possible(bool f = true) {
    cout << (f ? "Possible" : "Impossible") << endl;
    return f;
}
inline bool POSSIBLE(bool f = true) {
    cout << (f ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    return f;
}

// impossible
inline bool impossible(bool f = true) {
    cout << (!f ? "possible" : "impossible") << endl;
    return f;
}
inline bool Impossible(bool f = true) {
    cout << (!f ? "Possible" : "Impossible") << endl;
    return f;
}
inline bool IMPOSSIBLE(bool f = true) {
    cout << (!f ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    return f;
}

// Alice Bob
inline bool Alice(bool f = true) {
    cout << (f ? "Alice" : "Bob") << endl;
    return f;
}
inline bool Bob(bool f = true) {
    cout << (f ? "Bob" : "Alice") << endl;
    return f;
}

// Takahashi Aoki
inline bool Takahashi(bool f = true) {
    cout << (f ? "Takahashi" : "Aoki") << endl;
    return f;
}
inline bool Aoki(bool f = true) {
    cout << (f ? "Aoki" : "Takahashi") << endl;
    return f;
}

} // namespace yesno
using namespace yesno;

} // namespace templates
using namespace templates;

void solve() {
    LL(n, k);
    VEC(int, A, k);
    vec(bool, tf, n, false);
    for (auto a : A) tf[a - 1] = true;
    vec(int, B, 0);
    if (n & 1) {
        fori(i, n) {
            if (!tf[i]) {
                B.push_back(i + 1);
            }
        }
    } else {
        if (tf[0]) {
            B.push_back(1);
        }
        fori(i, 1, n) {
            if (!tf[i]) {
                B.push_back(i + 1);
            }
        }
    }
    print(n, len(B));
    print(B);
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    // cout << fixed << setprecision(12);
    int t;
    t = 1;
    cin >> t;
    while (t--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3508kb

input:

6
3 0
2 1
1
3 3
1 2 3
3 1
1
3 1
2
3 1
3

output:

3 3
1 2 3
2 2
1 2
3 0

3 2
2 3
3 2
1 3
3 2
1 2

input:

6
3 3
1 2 3
2 2
1 2
3 0
3 2
2 3
3 2
1 3
3 2
1 2

output:

3 0

2 1
1
3 3
1 2 3
3 1
1
3 1
2
3 1
3

result:

ok 12 lines

Test #2:

score: 100
Accepted
time: 1ms
memory: 3532kb

input:

1
1 0

output:

1 1
1

input:

1
1 1
1

output:

1 0


result:

ok single line: '1 0'

Test #3:

score: 100
Accepted
time: 0ms
memory: 3484kb

input:

3
1 1
1
1 0
1 1
1

output:

1 0

1 1
1
1 0


input:

3
1 0
1 1
1
1 0

output:

1 1
1
1 0

1 1
1

result:

ok 6 lines

Test #4:

score: 100
Accepted
time: 2ms
memory: 3568kb

input:

1000
12 7
1 2 3 5 6 7 9
11 6
3 5 6 7 8 11
12 7
1 6 7 9 10 11 12
11 6
1 2 3 9 10 11
12 7
2 3 4 6 7 9 10
9 3
3 7 8
12 10
1 2 3 5 7 8 9 10 11 12
12 5
2 6 10 11 12
10 4
2 4 8 10
12 7
1 3 4 7 10 11 12
11 3
3 6 7
11 6
3 5 7 8 9 10
12 5
1 4 8 11 12
11 6
2 3 5 6 9 10
12 5
2 4 7 11 12
12 6
3 4 5 6 10 12
10 6...

output:

12 6
1 4 8 10 11 12
11 5
1 2 4 9 10
12 6
1 2 3 4 5 8
11 5
4 5 6 7 8
12 4
5 8 11 12
9 6
1 2 4 5 6 9
12 3
1 4 6
12 6
3 4 5 7 8 9
10 5
3 5 6 7 9
12 6
1 2 5 6 8 9
11 8
1 2 4 5 8 9 10 11
11 5
1 2 4 6 11
12 8
1 2 3 5 6 7 9 10
11 5
1 4 7 8 11
12 6
3 5 6 8 9 10
12 5
2 7 8 9 11
10 3
4 6 7
10 3
2 8 10
9 3
3 4...

input:

1000
12 6
1 4 8 10 11 12
11 5
1 2 4 9 10
12 6
1 2 3 4 5 8
11 5
4 5 6 7 8
12 4
5 8 11 12
9 6
1 2 4 5 6 9
12 3
1 4 6
12 6
3 4 5 7 8 9
10 5
3 5 6 7 9
12 6
1 2 5 6 8 9
11 8
1 2 4 5 8 9 10 11
11 5
1 2 4 6 11
12 8
1 2 3 5 6 7 9 10
11 5
1 4 7 8 11
12 6
3 5 6 8 9 10
12 5
2 7 8 9 11
10 3
4 6 7
10 3
2 8 10
9 ...

output:

12 7
1 2 3 5 6 7 9
11 6
3 5 6 7 8 11
12 7
1 6 7 9 10 11 12
11 6
1 2 3 9 10 11
12 7
2 3 4 6 7 9 10
9 3
3 7 8
12 10
1 2 3 5 7 8 9 10 11 12
12 5
2 6 10 11 12
10 4
2 4 8 10
12 7
1 3 4 7 10 11 12
11 3
3 6 7
11 6
3 5 7 8 9 10
12 5
1 4 8 11 12
11 6
2 3 5 6 9 10
12 5
2 4 7 11 12
12 6
3 4 5 6 10 12
10 6
2 3 ...

result:

ok 2000 lines

Test #5:

score: 100
Accepted
time: 1ms
memory: 3504kb

input:

1000
12 7
1 3 7 8 9 10 12
12 8
1 4 5 6 8 10 11 12
11 2
7 10
11 7
2 3 4 6 7 8 9
12 7
1 4 5 6 7 8 12
12 5
1 5 6 7 12
9 5
2 4 5 7 9
12 10
1 2 3 5 6 7 8 9 10 11
9 6
3 4 5 6 8 9
11 5
1 2 3 7 9
10 4
1 3 4 5
12 4
2 5 6 8
9 4
2 3 4 9
10 6
1 2 3 4 5 6
12 7
2 5 6 7 8 10 12
8 4
1 3 7 8
12 8
2 3 4 6 7 9 10 12
1...

output:

12 6
1 2 4 5 6 11
12 5
1 2 3 7 9
11 9
1 2 3 4 5 6 8 9 11
11 4
1 5 10 11
12 6
1 2 3 9 10 11
12 8
1 2 3 4 8 9 10 11
9 4
1 3 6 8
12 3
1 4 12
9 3
1 2 7
11 6
4 5 6 8 10 11
10 7
1 2 6 7 8 9 10
12 7
3 4 7 9 10 11 12
9 5
1 5 6 7 8
10 5
1 7 8 9 10
12 4
3 4 9 11
8 5
1 2 4 5 6
12 3
5 8 11
12 6
3 6 7 10 11 12
1...

input:

1000
12 6
1 2 4 5 6 11
12 5
1 2 3 7 9
11 9
1 2 3 4 5 6 8 9 11
11 4
1 5 10 11
12 6
1 2 3 9 10 11
12 8
1 2 3 4 8 9 10 11
9 4
1 3 6 8
12 3
1 4 12
9 3
1 2 7
11 6
4 5 6 8 10 11
10 7
1 2 6 7 8 9 10
12 7
3 4 7 9 10 11 12
9 5
1 5 6 7 8
10 5
1 7 8 9 10
12 4
3 4 9 11
8 5
1 2 4 5 6
12 3
5 8 11
12 6
3 6 7 10 11...

output:

12 7
1 3 7 8 9 10 12
12 8
1 4 5 6 8 10 11 12
11 2
7 10
11 7
2 3 4 6 7 8 9
12 7
1 4 5 6 7 8 12
12 5
1 5 6 7 12
9 5
2 4 5 7 9
12 10
1 2 3 5 6 7 8 9 10 11
9 6
3 4 5 6 8 9
11 5
1 2 3 7 9
10 4
1 3 4 5
12 4
2 5 6 8
9 4
2 3 4 9
10 6
1 2 3 4 5 6
12 7
2 5 6 7 8 10 12
8 4
1 3 7 8
12 8
2 3 4 6 7 9 10 12
12 5
2...

result:

ok 2000 lines

Test #6:

score: 100
Accepted
time: 1ms
memory: 3448kb

input:

1000
12 7
1 2 3 5 6 7 9
11 6
3 5 6 7 8 11
12 7
1 6 7 9 10 11 12
11 6
1 2 3 9 10 11
12 7
2 3 4 6 7 9 10
9 3
3 7 8
12 10
1 2 3 5 7 8 9 10 11 12
12 5
2 6 10 11 12
10 4
2 4 8 10
12 7
1 3 4 7 10 11 12
11 3
3 6 7
11 6
3 5 7 8 9 10
12 5
1 4 8 11 12
11 6
2 3 5 6 9 10
12 5
2 4 7 11 12
12 6
3 4 5 6 10 12
10 6...

output:

12 6
1 4 8 10 11 12
11 5
1 2 4 9 10
12 6
1 2 3 4 5 8
11 5
4 5 6 7 8
12 4
5 8 11 12
9 6
1 2 4 5 6 9
12 3
1 4 6
12 6
3 4 5 7 8 9
10 5
3 5 6 7 9
12 6
1 2 5 6 8 9
11 8
1 2 4 5 8 9 10 11
11 5
1 2 4 6 11
12 8
1 2 3 5 6 7 9 10
11 5
1 4 7 8 11
12 6
3 5 6 8 9 10
12 5
2 7 8 9 11
10 3
4 6 7
10 3
2 8 10
9 3
3 4...

input:

1000
12 6
1 4 8 10 11 12
11 5
1 2 4 9 10
12 6
1 2 3 4 5 8
11 5
4 5 6 7 8
12 4
5 8 11 12
9 6
1 2 4 5 6 9
12 3
1 4 6
12 6
3 4 5 7 8 9
10 5
3 5 6 7 9
12 6
1 2 5 6 8 9
11 8
1 2 4 5 8 9 10 11
11 5
1 2 4 6 11
12 8
1 2 3 5 6 7 9 10
11 5
1 4 7 8 11
12 6
3 5 6 8 9 10
12 5
2 7 8 9 11
10 3
4 6 7
10 3
2 8 10
9 ...

output:

12 7
1 2 3 5 6 7 9
11 6
3 5 6 7 8 11
12 7
1 6 7 9 10 11 12
11 6
1 2 3 9 10 11
12 7
2 3 4 6 7 9 10
9 3
3 7 8
12 10
1 2 3 5 7 8 9 10 11 12
12 5
2 6 10 11 12
10 4
2 4 8 10
12 7
1 3 4 7 10 11 12
11 3
3 6 7
11 6
3 5 7 8 9 10
12 5
1 4 8 11 12
11 6
2 3 5 6 9 10
12 5
2 4 7 11 12
12 6
3 4 5 6 10 12
10 6
2 3 ...

result:

ok 2000 lines

Test #7:

score: 100
Accepted
time: 2ms
memory: 3444kb

input:

1000
12 6
4 6 7 8 9 11
11 3
5 8 9
12 4
2 3 6 7
11 4
4 7 10 11
12 6
2 3 6 7 9 12
11 5
2 5 6 9 11
10 2
3 9
12 5
3 5 6 10 12
12 9
1 2 4 6 7 8 9 11 12
8 3
2 4 8
8 5
2 3 4 5 8
10 8
1 2 4 5 6 7 8 10
12 7
1 2 3 4 6 7 11
11 7
1 4 5 6 7 9 10
12 8
1 2 3 4 8 9 10 12
12 8
1 2 5 6 7 8 9 12
11 6
1 2 4 7 9 11
12 7...

output:

12 5
2 3 5 10 12
11 8
1 2 3 4 6 7 10 11
12 7
4 5 8 9 10 11 12
11 7
1 2 3 5 6 8 9
12 5
4 5 8 10 11
11 6
1 3 4 7 8 10
10 7
2 4 5 6 7 8 10
12 6
2 4 7 8 9 11
12 4
1 3 5 10
8 4
3 5 6 7
8 2
6 7
10 3
1 3 9
12 6
1 5 8 9 10 12
11 4
2 3 8 11
12 5
1 5 6 7 11
12 5
1 3 4 10 11
11 5
3 5 6 8 10
12 4
5 6 9 10
12 4
...

input:

1000
12 5
2 3 5 10 12
11 8
1 2 3 4 6 7 10 11
12 7
4 5 8 9 10 11 12
11 7
1 2 3 5 6 8 9
12 5
4 5 8 10 11
11 6
1 3 4 7 8 10
10 7
2 4 5 6 7 8 10
12 6
2 4 7 8 9 11
12 4
1 3 5 10
8 4
3 5 6 7
8 2
6 7
10 3
1 3 9
12 6
1 5 8 9 10 12
11 4
2 3 8 11
12 5
1 5 6 7 11
12 5
1 3 4 10 11
11 5
3 5 6 8 10
12 4
5 6 9 10
...

output:

12 6
4 6 7 8 9 11
11 3
5 8 9
12 4
2 3 6 7
11 4
4 7 10 11
12 6
2 3 6 7 9 12
11 5
2 5 6 9 11
10 2
3 9
12 5
3 5 6 10 12
12 9
1 2 4 6 7 8 9 11 12
8 3
2 4 8
8 5
2 3 4 5 8
10 8
1 2 4 5 6 7 8 10
12 7
1 2 3 4 6 7 11
11 7
1 4 5 6 7 9 10
12 8
1 2 3 4 8 9 10 12
12 8
1 2 5 6 7 8 9 12
11 6
1 2 4 7 9 11
12 7
2 3 ...

result:

ok 2000 lines

Test #8:

score: 100
Accepted
time: 1ms
memory: 3496kb

input:

1000
11 6
1 4 7 8 9 11
12 7
1 2 4 8 9 11 12
10 4
2 4 8 9
12 6
1 2 3 6 7 11
8 3
4 5 8
11 5
1 2 5 7 11
12 7
2 3 4 6 10 11 12
10 5
1 4 5 6 10
12 3
7 8 9
12 4
5 9 10 11
12 7
4 5 6 7 8 10 12
12 6
3 5 7 8 9 12
12 6
1 3 4 7 8 11
12 7
1 2 3 7 8 10 12
12 7
2 4 5 6 7 9 10
10 6
1 3 4 5 6 9
11 6
3 5 6 7 9 11
12...

output:

11 5
2 3 5 6 10
12 6
1 3 5 6 7 10
10 5
3 5 6 7 10
12 7
1 4 5 8 9 10 12
8 4
2 3 6 7
11 6
3 4 6 8 9 10
12 4
5 7 8 9
10 6
1 2 3 7 8 9
12 8
2 3 4 5 6 10 11 12
12 7
2 3 4 6 7 8 12
12 4
2 3 9 11
12 5
2 4 6 10 11
12 7
1 2 5 6 9 10 12
12 6
1 4 5 6 9 11
12 4
3 8 11 12
10 5
1 2 7 8 10
11 5
1 2 4 8 10
12 6
1 2...

input:

1000
11 5
2 3 5 6 10
12 6
1 3 5 6 7 10
10 5
3 5 6 7 10
12 7
1 4 5 8 9 10 12
8 4
2 3 6 7
11 6
3 4 6 8 9 10
12 4
5 7 8 9
10 6
1 2 3 7 8 9
12 8
2 3 4 5 6 10 11 12
12 7
2 3 4 6 7 8 12
12 4
2 3 9 11
12 5
2 4 6 10 11
12 7
1 2 5 6 9 10 12
12 6
1 4 5 6 9 11
12 4
3 8 11 12
10 5
1 2 7 8 10
11 5
1 2 4 8 10
12 ...

output:

11 6
1 4 7 8 9 11
12 7
1 2 4 8 9 11 12
10 4
2 4 8 9
12 6
1 2 3 6 7 11
8 3
4 5 8
11 5
1 2 5 7 11
12 7
2 3 4 6 10 11 12
10 5
1 4 5 6 10
12 3
7 8 9
12 4
5 9 10 11
12 7
4 5 6 7 8 10 12
12 6
3 5 7 8 9 12
12 6
1 3 4 7 8 11
12 7
1 2 3 7 8 10 12
12 7
2 4 5 6 7 9 10
10 6
1 3 4 5 6 9
11 6
3 5 6 7 9 11
12 7
1 ...

result:

ok 2000 lines

Test #9:

score: 100
Accepted
time: 1ms
memory: 3492kb

input:

1000
12 6
2 5 8 9 11 12
12 7
2 3 4 6 9 10 11
10 6
3 5 6 8 9 10
12 6
1 2 4 8 10 12
8 3
1 2 5
12 7
2 5 7 8 10 11 12
11 6
1 2 3 4 7 8
12 8
1 4 5 6 7 9 11 12
12 6
1 2 3 6 8 12
12 5
4 5 6 9 10
12 9
3 4 6 7 8 9 10 11 12
10 6
3 5 7 8 9 10
12 7
1 2 4 5 7 8 9
10 4
1 4 6 9
11 8
2 3 4 5 6 7 9 10
6 3
3 5 6
11 4...

output:

12 5
3 4 6 7 10
12 4
5 7 8 12
10 3
2 4 7
12 7
1 3 5 6 7 9 11
8 6
1 3 4 6 7 8
12 4
3 4 6 9
11 5
5 6 9 10 11
12 5
1 2 3 8 10
12 7
1 4 5 7 9 10 11
12 6
2 3 7 8 11 12
12 2
2 5
10 3
2 4 6
12 6
1 3 6 10 11 12
10 7
1 2 3 5 7 8 10
11 3
1 8 11
6 2
2 4
11 7
1 4 5 7 8 9 11
12 8
1 2 3 5 7 8 10 11
8 3
1 2 5
12 5...

input:

1000
12 5
3 4 6 7 10
12 4
5 7 8 12
10 3
2 4 7
12 7
1 3 5 6 7 9 11
8 6
1 3 4 6 7 8
12 4
3 4 6 9
11 5
5 6 9 10 11
12 5
1 2 3 8 10
12 7
1 4 5 7 9 10 11
12 6
2 3 7 8 11 12
12 2
2 5
10 3
2 4 6
12 6
1 3 6 10 11 12
10 7
1 2 3 5 7 8 10
11 3
1 8 11
6 2
2 4
11 7
1 4 5 7 8 9 11
12 8
1 2 3 5 7 8 10 11
8 3
1 2 5...

output:

12 6
2 5 8 9 11 12
12 7
2 3 4 6 9 10 11
10 6
3 5 6 8 9 10
12 6
1 2 4 8 10 12
8 3
1 2 5
12 7
2 5 7 8 10 11 12
11 6
1 2 3 4 7 8
12 8
1 4 5 6 7 9 11 12
12 6
1 2 3 6 8 12
12 5
4 5 6 9 10
12 9
3 4 6 7 8 9 10 11 12
10 6
3 5 7 8 9 10
12 7
1 2 4 5 7 8 9
10 4
1 4 6 9
11 8
2 3 4 5 6 7 9 10
6 3
3 5 6
11 4
2 3 ...

result:

ok 2000 lines

Test #10:

score: 100
Accepted
time: 2ms
memory: 3488kb

input:

1000
7 4
1 2 4 7
12 8
2 3 4 5 6 8 10 11
11 8
1 2 4 6 7 8 9 11
11 5
2 3 5 7 9
12 3
4 7 8
11 4
6 8 10 11
12 7
1 3 6 7 8 9 12
11 6
4 5 6 8 9 11
8 2
1 4
10 4
1 3 4 10
12 7
1 2 3 5 8 11 12
12 5
2 3 5 8 9
10 5
1 2 4 5 7
12 4
3 8 9 10
12 6
4 5 6 8 9 12
8 4
1 4 5 6
12 3
5 6 11
6 4
1 3 5 6
12 8
1 3 4 5 6 7 8...

output:

7 3
3 5 6
12 3
7 9 12
11 3
3 5 10
11 6
1 4 6 8 10 11
12 8
2 3 5 6 9 10 11 12
11 7
1 2 3 4 5 7 9
12 6
1 2 4 5 10 11
11 5
1 2 3 7 10
8 7
1 2 3 5 6 7 8
10 7
1 2 5 6 7 8 9
12 6
1 4 6 7 9 10
12 6
4 6 7 10 11 12
10 6
1 3 6 8 9 10
12 7
2 4 5 6 7 11 12
12 5
2 3 7 10 11
8 5
1 2 3 7 8
12 8
2 3 4 7 8 9 10 12
6...

input:

1000
7 3
3 5 6
12 3
7 9 12
11 3
3 5 10
11 6
1 4 6 8 10 11
12 8
2 3 5 6 9 10 11 12
11 7
1 2 3 4 5 7 9
12 6
1 2 4 5 10 11
11 5
1 2 3 7 10
8 7
1 2 3 5 6 7 8
10 7
1 2 5 6 7 8 9
12 6
1 4 6 7 9 10
12 6
4 6 7 10 11 12
10 6
1 3 6 8 9 10
12 7
2 4 5 6 7 11 12
12 5
2 3 7 10 11
8 5
1 2 3 7 8
12 8
2 3 4 7 8 9 10...

output:

7 4
1 2 4 7
12 8
2 3 4 5 6 8 10 11
11 8
1 2 4 6 7 8 9 11
11 5
2 3 5 7 9
12 3
4 7 8
11 4
6 8 10 11
12 7
1 3 6 7 8 9 12
11 6
4 5 6 8 9 11
8 2
1 4
10 4
1 3 4 10
12 7
1 2 3 5 8 11 12
12 5
2 3 5 8 9
10 5
1 2 4 5 7
12 4
3 8 9 10
12 6
4 5 6 8 9 12
8 4
1 4 5 6
12 3
5 6 11
6 4
1 3 5 6
12 8
1 3 4 5 6 7 8 10
1...

result:

ok 2000 lines

Test #11:

score: 100
Accepted
time: 1ms
memory: 3500kb

input:

1000
10 5
1 2 3 4 5
12 5
1 5 6 10 12
12 7
1 2 7 8 9 11 12
12 5
6 7 8 9 10
12 6
2 3 4 5 9 12
11 4
1 3 6 10
10 3
1 5 6
12 5
2 3 4 9 11
12 5
1 3 7 10 12
12 8
1 2 3 4 6 7 9 10
10 4
1 2 8 9
12 7
1 2 5 7 8 9 10
11 5
1 8 9 10 11
11 5
3 4 7 8 10
12 7
3 5 6 7 10 11 12
9 3
3 4 6
12 4
4 5 8 9
12 8
1 3 4 6 8 9 ...

output:

10 6
1 6 7 8 9 10
12 8
1 2 3 4 7 8 9 11
12 6
1 3 4 5 6 10
12 6
2 3 4 5 11 12
12 5
6 7 8 10 11
11 7
2 4 5 7 8 9 11
10 8
1 2 3 4 7 8 9 10
12 6
5 6 7 8 10 12
12 8
1 2 4 5 6 8 9 11
12 5
1 5 8 11 12
10 7
1 3 4 5 6 7 10
12 6
1 3 4 6 11 12
11 6
2 3 4 5 6 7
11 6
1 2 5 6 9 11
12 4
2 4 8 9
9 6
1 2 5 7 8 9
12 ...

input:

1000
10 6
1 6 7 8 9 10
12 8
1 2 3 4 7 8 9 11
12 6
1 3 4 5 6 10
12 6
2 3 4 5 11 12
12 5
6 7 8 10 11
11 7
2 4 5 7 8 9 11
10 8
1 2 3 4 7 8 9 10
12 6
5 6 7 8 10 12
12 8
1 2 4 5 6 8 9 11
12 5
1 5 8 11 12
10 7
1 3 4 5 6 7 10
12 6
1 3 4 6 11 12
11 6
2 3 4 5 6 7
11 6
1 2 5 6 9 11
12 4
2 4 8 9
9 6
1 2 5 7 8 ...

output:

10 5
1 2 3 4 5
12 5
1 5 6 10 12
12 7
1 2 7 8 9 11 12
12 5
6 7 8 9 10
12 6
2 3 4 5 9 12
11 4
1 3 6 10
10 3
1 5 6
12 5
2 3 4 9 11
12 5
1 3 7 10 12
12 8
1 2 3 4 6 7 9 10
10 4
1 2 8 9
12 7
1 2 5 7 8 9 10
11 5
1 8 9 10 11
11 5
3 4 7 8 10
12 7
3 5 6 7 10 11 12
9 3
3 4 6
12 4
4 5 8 9
12 8
1 3 4 6 8 9 11 12...

result:

ok 2000 lines

Test #12:

score: 100
Accepted
time: 2ms
memory: 3556kb

input:

1000
12 6
3 5 6 10 11 12
8 5
1 3 5 7 8
12 3
5 8 11
12 6
1 5 8 10 11 12
12 10
1 3 5 6 7 8 9 10 11 12
12 5
1 6 8 10 11
12 9
3 4 5 6 7 9 10 11 12
12 6
1 3 4 8 10 11
8 1
6
12 7
2 3 5 8 10 11 12
11 4
4 8 9 10
10 6
1 3 4 5 8 10
12 3
3 11 12
12 5
2 5 6 7 10
11 6
1 3 5 6 9 11
8 3
3 7 8
9 3
2 4 5
8 5
3 5 6 7...

output:

12 5
2 4 7 8 9
8 4
1 2 4 6
12 8
2 3 4 6 7 9 10 12
12 7
1 2 3 4 6 7 9
12 3
1 2 4
12 8
1 2 3 4 5 7 9 12
12 2
2 8
12 7
1 2 5 6 7 9 12
8 6
2 3 4 5 7 8
12 4
4 6 7 9
11 7
1 2 3 5 6 7 11
10 5
1 2 6 7 9
12 8
2 4 5 6 7 8 9 10
12 6
3 4 8 9 11 12
11 5
2 4 7 8 10
8 4
2 4 5 6
9 6
1 3 6 7 8 9
8 2
2 4
11 6
1 3 5 6...

input:

1000
12 5
2 4 7 8 9
8 4
1 2 4 6
12 8
2 3 4 6 7 9 10 12
12 7
1 2 3 4 6 7 9
12 3
1 2 4
12 8
1 2 3 4 5 7 9 12
12 2
2 8
12 7
1 2 5 6 7 9 12
8 6
2 3 4 5 7 8
12 4
4 6 7 9
11 7
1 2 3 5 6 7 11
10 5
1 2 6 7 9
12 8
2 4 5 6 7 8 9 10
12 6
3 4 8 9 11 12
11 5
2 4 7 8 10
8 4
2 4 5 6
9 6
1 3 6 7 8 9
8 2
2 4
11 6
1 ...

output:

12 6
3 5 6 10 11 12
8 5
1 3 5 7 8
12 3
5 8 11
12 6
1 5 8 10 11 12
12 10
1 3 5 6 7 8 9 10 11 12
12 5
1 6 8 10 11
12 9
3 4 5 6 7 9 10 11 12
12 6
1 3 4 8 10 11
8 1
6
12 7
2 3 5 8 10 11 12
11 4
4 8 9 10
10 6
1 3 4 5 8 10
12 3
3 11 12
12 5
2 5 6 7 10
11 6
1 3 5 6 9 11
8 3
3 7 8
9 3
2 4 5
8 5
3 5 6 7 8
11...

result:

ok 2000 lines

Test #13:

score: 100
Accepted
time: 1ms
memory: 3524kb

input:

1000
11 5
2 3 4 10 11
6 2
1 6
12 7
2 3 4 7 8 10 12
11 5
2 4 6 8 9
6 4
1 3 4 6
10 5
4 6 7 8 10
11 3
6 7 9
12 4
3 6 9 11
11 7
1 3 4 5 6 10 11
12 7
2 3 5 9 10 11 12
10 7
1 2 3 4 5 8 10
11 2
2 3
11 4
5 6 8 10
10 2
6 7
11 5
2 6 8 10 11
10 4
2 3 7 9
12 5
1 5 7 9 11
12 4
3 5 6 7
12 7
2 3 5 7 8 11 12
12 9
1...

output:

11 6
1 5 6 7 8 9
6 5
1 2 3 4 5
12 4
5 6 9 11
11 6
1 3 5 7 10 11
6 3
1 2 5
10 4
2 3 5 9
11 8
1 2 3 4 5 8 10 11
12 7
2 4 5 7 8 10 12
11 4
2 7 8 9
12 4
4 6 7 8
10 4
1 6 7 9
11 9
1 4 5 6 7 8 9 10 11
11 7
1 2 3 4 7 9 11
10 7
2 3 4 5 8 9 10
11 6
1 3 4 5 7 9
10 5
4 5 6 8 10
12 8
1 2 3 4 6 8 10 12
12 7
2 4 ...

input:

1000
11 6
1 5 6 7 8 9
6 5
1 2 3 4 5
12 4
5 6 9 11
11 6
1 3 5 7 10 11
6 3
1 2 5
10 4
2 3 5 9
11 8
1 2 3 4 5 8 10 11
12 7
2 4 5 7 8 10 12
11 4
2 7 8 9
12 4
4 6 7 8
10 4
1 6 7 9
11 9
1 4 5 6 7 8 9 10 11
11 7
1 2 3 4 7 9 11
10 7
2 3 4 5 8 9 10
11 6
1 3 4 5 7 9
10 5
4 5 6 8 10
12 8
1 2 3 4 6 8 10 12
12 7...

output:

11 5
2 3 4 10 11
6 2
1 6
12 7
2 3 4 7 8 10 12
11 5
2 4 6 8 9
6 4
1 3 4 6
10 5
4 6 7 8 10
11 3
6 7 9
12 4
3 6 9 11
11 7
1 3 4 5 6 10 11
12 7
2 3 5 9 10 11 12
10 7
1 2 3 4 5 8 10
11 2
2 3
11 4
5 6 8 10
10 2
6 7
11 5
2 6 8 10 11
10 4
2 3 7 9
12 5
1 5 7 9 11
12 4
3 5 6 7
12 7
2 3 5 7 8 11 12
12 9
1 2 4 ...

result:

ok 2000 lines

Test #14:

score: 100
Accepted
time: 1ms
memory: 3548kb

input:

190
12 5
2 3 5 6 12
8 4
3 4 6 7
11 6
1 3 4 9 10 11
10 3
6 9 10
12 4
1 7 8 10
7 3
5 6 7
12 4
1 2 6 9
9 3
1 3 5
12 6
2 5 8 9 10 12
9 5
1 2 4 6 7
12 4
3 7 9 12
11 7
1 3 4 6 7 10 11
10 7
1 2 3 4 7 9 10
12 3
5 7 12
11 7
3 5 6 7 8 9 10
10 3
3 4 6
11 5
1 2 8 10 11
11 8
1 5 6 7 8 9 10 11
12 9
1 2 3 6 7 8 9 ...

output:

12 6
4 7 8 9 10 11
8 3
2 5 8
11 5
2 5 6 7 8
10 6
2 3 4 5 7 8
12 9
1 2 3 4 5 6 9 11 12
7 4
1 2 3 4
12 9
1 3 4 5 7 8 10 11 12
9 6
2 4 6 7 8 9
12 5
3 4 6 7 11
9 4
3 5 8 9
12 7
2 4 5 6 8 10 11
11 4
2 5 8 9
10 4
1 5 6 8
12 8
2 3 4 6 8 9 10 11
11 4
1 2 4 11
10 6
2 5 7 8 9 10
11 6
3 4 5 6 7 9
11 3
2 3 4
12...

input:

190
12 6
4 7 8 9 10 11
8 3
2 5 8
11 5
2 5 6 7 8
10 6
2 3 4 5 7 8
12 9
1 2 3 4 5 6 9 11 12
7 4
1 2 3 4
12 9
1 3 4 5 7 8 10 11 12
9 6
2 4 6 7 8 9
12 5
3 4 6 7 11
9 4
3 5 8 9
12 7
2 4 5 6 8 10 11
11 4
2 5 8 9
10 4
1 5 6 8
12 8
2 3 4 6 8 9 10 11
11 4
1 2 4 11
10 6
2 5 7 8 9 10
11 6
3 4 5 6 7 9
11 3
2 3 ...

output:

12 5
2 3 5 6 12
8 4
3 4 6 7
11 6
1 3 4 9 10 11
10 3
6 9 10
12 4
1 7 8 10
7 3
5 6 7
12 4
1 2 6 9
9 3
1 3 5
12 6
2 5 8 9 10 12
9 5
1 2 4 6 7
12 4
3 7 9 12
11 7
1 3 4 6 7 10 11
10 7
1 2 3 4 7 9 10
12 3
5 7 12
11 7
3 5 6 7 8 9 10
10 3
3 4 6
11 5
1 2 8 10 11
11 8
1 5 6 7 8 9 10 11
12 9
1 2 3 6 7 8 9 11 1...

result:

ok 380 lines

Test #15:

score: 100
Accepted
time: 2ms
memory: 3492kb

input:

1000
12 4
5 6 8 9
12 6
1 5 6 7 9 10
12 12
1 2 3 4 5 6 7 8 9 10 11 12
12 12
1 2 3 4 5 6 7 8 9 10 11 12
12 9
1 2 4 5 6 8 9 10 11
12 7
2 6 7 8 9 10 11
12 11
1 2 3 5 6 7 8 9 10 11 12
12 1
1
12 8
1 3 4 8 9 10 11 12
12 8
1 2 3 4 5 8 9 11
12 4
3 4 7 10
12 8
1 2 4 6 8 9 10 11
12 3
1 5 6
12 6
2 3 4 6 8 10
12...

output:

12 7
2 3 4 7 10 11 12
12 7
1 2 3 4 8 11 12
12 1
1
12 1
1
12 4
1 3 7 12
12 4
3 4 5 12
12 2
1 4
12 12
1 2 3 4 5 6 7 8 9 10 11 12
12 5
1 2 5 6 7
12 5
1 6 7 10 12
12 7
2 5 6 8 9 11 12
12 5
1 3 5 7 12
12 10
1 2 3 4 7 8 9 10 11 12
12 5
5 7 9 11 12
12 3
5 6 12
12 9
1 2 4 5 8 9 10 11 12
12 4
1 3 5 12
12 5
2...

input:

1000
12 7
2 3 4 7 10 11 12
12 7
1 2 3 4 8 11 12
12 1
1
12 1
1
12 4
1 3 7 12
12 4
3 4 5 12
12 2
1 4
12 12
1 2 3 4 5 6 7 8 9 10 11 12
12 5
1 2 5 6 7
12 5
1 6 7 10 12
12 7
2 5 6 8 9 11 12
12 5
1 3 5 7 12
12 10
1 2 3 4 7 8 9 10 11 12
12 5
5 7 9 11 12
12 3
5 6 12
12 9
1 2 4 5 8 9 10 11 12
12 4
1 3 5 12
1...

output:

12 4
5 6 8 9
12 6
1 5 6 7 9 10
12 12
1 2 3 4 5 6 7 8 9 10 11 12
12 12
1 2 3 4 5 6 7 8 9 10 11 12
12 9
1 2 4 5 6 8 9 10 11
12 7
2 6 7 8 9 10 11
12 11
1 2 3 5 6 7 8 9 10 11 12
12 1
1
12 8
1 3 4 8 9 10 11 12
12 8
1 2 3 4 5 8 9 11
12 4
3 4 7 10
12 8
1 2 4 6 8 9 10 11
12 3
1 5 6
12 6
2 3 4 6 8 10
12 8
2 ...

result:

ok 2000 lines

Test #16:

score: 100
Accepted
time: 1ms
memory: 3568kb

input:

1000
15 9
2 3 4 5 7 10 12 13 14
15 4
1 7 8 11
15 5
5 6 7 11 15
15 0
15 11
1 4 6 7 8 9 10 12 13 14 15
15 4
4 5 13 14
15 12
1 2 3 4 6 7 9 11 12 13 14 15
15 12
1 2 3 4 5 8 9 10 11 12 13 15
15 1
13
15 13
1 3 4 5 6 7 8 9 10 12 13 14 15
15 7
2 4 8 9 10 12 14
15 6
1 9 11 12 13 15
15 1
11
15 4
1 6 11 14
15 ...

output:

15 6
1 6 8 9 11 15
15 11
2 3 4 5 6 9 10 12 13 14 15
15 10
1 2 3 4 8 9 10 12 13 14
15 15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
15 4
2 3 5 11
15 11
1 2 3 6 7 8 9 10 11 12 15
15 3
5 8 10
15 3
6 7 14
15 14
1 2 3 4 5 6 7 8 9 10 11 12 14 15
15 2
2 11
15 8
1 3 5 6 7 11 13 15
15 9
2 3 4 5 6 7 8 10 14
15 14
1 ...

input:

1000
15 6
1 6 8 9 11 15
15 11
2 3 4 5 6 9 10 12 13 14 15
15 10
1 2 3 4 8 9 10 12 13 14
15 15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
15 4
2 3 5 11
15 11
1 2 3 6 7 8 9 10 11 12 15
15 3
5 8 10
15 3
6 7 14
15 14
1 2 3 4 5 6 7 8 9 10 11 12 14 15
15 2
2 11
15 8
1 3 5 6 7 11 13 15
15 9
2 3 4 5 6 7 8 10 14
15 ...

output:

15 9
2 3 4 5 7 10 12 13 14
15 4
1 7 8 11
15 5
5 6 7 11 15
15 0

15 11
1 4 6 7 8 9 10 12 13 14 15
15 4
4 5 13 14
15 12
1 2 3 4 6 7 9 11 12 13 14 15
15 12
1 2 3 4 5 8 9 10 11 12 13 15
15 1
13
15 13
1 3 4 5 6 7 8 9 10 12 13 14 15
15 7
2 4 8 9 10 12 14
15 6
1 9 11 12 13 15
15 1
11
15 4
1 6 11 14
15 2
5 ...

result:

ok 1999 lines

Test #17:

score: 100
Accepted
time: 2ms
memory: 3568kb

input:

1000
20 15
2 3 4 6 7 8 9 10 11 13 14 15 18 19 20
20 13
1 2 4 8 9 10 11 12 13 14 15 17 19
20 11
1 2 3 5 7 9 10 11 14 16 18
20 2
9 15
20 3
10 13 17
20 14
1 2 3 4 6 10 12 13 14 15 16 17 19 20
20 13
1 3 4 6 7 8 9 10 13 15 16 19 20
20 14
1 3 4 5 6 7 9 10 13 15 16 17 19 20
20 4
2 11 14 16
20 2
6 9
20 9
3 ...

output:

20 4
5 12 16 17
20 8
1 3 5 6 7 16 18 20
20 10
1 4 6 8 12 13 15 17 19 20
20 17
2 3 4 5 6 7 8 10 11 12 13 14 16 17 18 19 20
20 16
2 3 4 5 6 7 8 9 11 12 14 15 16 18 19 20
20 7
1 5 7 8 9 11 18
20 8
1 2 5 11 12 14 17 18
20 7
1 2 8 11 12 14 18
20 15
3 4 5 6 7 8 9 10 12 13 15 17 18 19 20
20 17
2 3 4 5 7 8 ...

input:

1000
20 4
5 12 16 17
20 8
1 3 5 6 7 16 18 20
20 10
1 4 6 8 12 13 15 17 19 20
20 17
2 3 4 5 6 7 8 10 11 12 13 14 16 17 18 19 20
20 16
2 3 4 5 6 7 8 9 11 12 14 15 16 18 19 20
20 7
1 5 7 8 9 11 18
20 8
1 2 5 11 12 14 17 18
20 7
1 2 8 11 12 14 18
20 15
3 4 5 6 7 8 9 10 12 13 15 17 18 19 20
20 17
2 3 4 5...

output:

20 15
2 3 4 6 7 8 9 10 11 13 14 15 18 19 20
20 13
1 2 4 8 9 10 11 12 13 14 15 17 19
20 11
1 2 3 5 7 9 10 11 14 16 18
20 2
9 15
20 3
10 13 17
20 14
1 2 3 4 6 10 12 13 14 15 16 17 19 20
20 13
1 3 4 6 7 8 9 10 13 15 16 19 20
20 14
1 3 4 5 6 7 9 10 13 15 16 17 19 20
20 4
2 11 14 16
20 2
6 9
20 9
3 4 6 8...

result:

ok 1999 lines

Test #18:

score: 100
Accepted
time: 2ms
memory: 3448kb

input:

1000
30 1
22
30 12
1 4 6 7 11 13 19 20 22 25 26 29
30 11
2 11 12 15 17 19 22 24 26 28 30
30 0
30 2
7 25
30 26
1 2 3 4 6 8 9 10 11 12 13 14 15 17 18 19 20 21 22 23 24 25 26 27 28 30
30 26
1 2 3 4 5 7 9 10 11 12 13 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
30 27
1 2 3 4 6 7 8 9 11 12 13 14 15 16 17...

output:

30 28
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 24 25 26 27 28 29 30
30 19
1 2 3 5 8 9 10 12 14 15 16 17 18 21 23 24 27 28 30
30 18
3 4 5 6 7 8 9 10 13 14 16 18 20 21 23 25 27 29
30 29
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
30 27
2 3 4 5 6 8 9 10 ...

input:

1000
30 28
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 24 25 26 27 28 29 30
30 19
1 2 3 5 8 9 10 12 14 15 16 17 18 21 23 24 27 28 30
30 18
3 4 5 6 7 8 9 10 13 14 16 18 20 21 23 25 27 29
30 29
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
30 27
2 3 4 5 6 8 ...

output:

30 1
22
30 12
1 4 6 7 11 13 19 20 22 25 26 29
30 11
2 11 12 15 17 19 22 24 26 28 30
30 0

30 2
7 25
30 26
1 2 3 4 6 8 9 10 11 12 13 14 15 17 18 19 20 21 22 23 24 25 26 27 28 30
30 26
1 2 3 4 5 7 9 10 11 12 13 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
30 27
1 2 3 4 6 7 8 9 11 12 13 14 15 16 17 18 ...

result:

ok 2000 lines

Test #19:

score: 100
Accepted
time: 3ms
memory: 3492kb

input:

1000
40 4
3 18 23 36
40 28
1 2 3 4 6 8 9 10 12 13 14 18 19 20 21 22 24 26 28 29 31 32 34 35 36 37 38 39
40 36
1 2 3 4 6 7 8 9 10 11 12 13 15 16 17 18 19 20 21 22 23 25 27 28 29 30 31 32 33 34 35 36 37 38 39 40
40 18
2 4 5 10 13 15 16 21 23 24 26 27 29 32 34 37 38 39
40 33
1 2 3 4 5 6 8 9 10 12 13 16...

output:

40 35
2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20 21 22 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40
40 13
1 5 7 11 15 16 17 23 25 27 30 33 40
40 5
1 5 14 24 26
40 21
3 6 7 8 9 11 12 14 17 18 19 20 22 25 28 30 31 33 35 36 40
40 8
1 7 11 14 15 18 29 40
40 4
1 15 19 28
40 19
1 3 7 10 12 13 16 17 18...

input:

1000
40 35
2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20 21 22 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40
40 13
1 5 7 11 15 16 17 23 25 27 30 33 40
40 5
1 5 14 24 26
40 21
3 6 7 8 9 11 12 14 17 18 19 20 22 25 28 30 31 33 35 36 40
40 8
1 7 11 14 15 18 29 40
40 4
1 15 19 28
40 19
1 3 7 10 12 13 16 ...

output:

40 4
3 18 23 36
40 28
1 2 3 4 6 8 9 10 12 13 14 18 19 20 21 22 24 26 28 29 31 32 34 35 36 37 38 39
40 36
1 2 3 4 6 7 8 9 10 11 12 13 15 16 17 18 19 20 21 22 23 25 27 28 29 30 31 32 33 34 35 36 37 38 39 40
40 18
2 4 5 10 13 15 16 21 23 24 26 27 29 32 34 37 38 39
40 33
1 2 3 4 5 6 8 9 10 12 13 16 17 1...

result:

ok 2000 lines

Test #20:

score: 100
Accepted
time: 3ms
memory: 3452kb

input:

1000
49 41
1 2 3 4 7 8 9 10 12 13 14 15 16 17 18 19 20 22 24 25 26 27 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 48 49
49 24
2 3 8 12 14 15 16 21 23 25 27 29 30 31 32 33 35 36 37 38 39 42 45 46
49 30
2 4 5 6 7 8 10 11 16 18 19 24 25 27 29 30 31 32 34 35 37 38 39 41 42 44 45 47 48 49
49 5
4 8...

output:

49 8
5 6 11 21 23 28 29 47
49 25
1 4 5 6 7 9 10 11 13 17 18 19 20 22 24 26 28 34 40 41 43 44 47 48 49
49 19
1 3 9 12 13 14 15 17 20 21 22 23 26 28 33 36 40 43 46
49 44
1 2 3 5 6 7 9 10 11 12 13 14 15 16 17 18 19 21 22 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
49 23
1...

input:

1000
49 8
5 6 11 21 23 28 29 47
49 25
1 4 5 6 7 9 10 11 13 17 18 19 20 22 24 26 28 34 40 41 43 44 47 48 49
49 19
1 3 9 12 13 14 15 17 20 21 22 23 26 28 33 36 40 43 46
49 44
1 2 3 5 6 7 9 10 11 12 13 14 15 16 17 18 19 21 22 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
49...

output:

49 41
1 2 3 4 7 8 9 10 12 13 14 15 16 17 18 19 20 22 24 25 26 27 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 48 49
49 24
2 3 8 12 14 15 16 21 23 25 27 29 30 31 32 33 35 36 37 38 39 42 45 46
49 30
2 4 5 6 7 8 10 11 16 18 19 24 25 27 29 30 31 32 34 35 37 38 39 41 42 44 45 47 48 49
49 5
4 8 20 2...

result:

ok 2000 lines

Test #21:

score: 100
Accepted
time: 3ms
memory: 3556kb

input:

1000
50 30
2 3 4 7 10 11 12 15 16 18 19 22 24 25 26 27 28 30 31 34 36 37 38 39 40 42 43 44 47 48
50 16
3 4 8 9 11 17 20 22 26 33 35 38 39 45 47 48
50 1
36
50 41
1 2 3 4 5 6 7 8 10 13 14 15 17 18 20 21 23 24 25 26 27 28 29 30 31 33 34 35 36 37 38 39 40 41 42 43 45 46 48 49 50
50 26
2 8 10 11 14 17 19...

output:

50 19
5 6 8 9 13 14 17 20 21 23 29 32 33 35 41 45 46 49 50
50 33
2 5 6 7 10 12 13 14 15 16 18 19 21 23 24 25 27 28 29 30 31 32 34 36 37 40 41 42 43 44 46 49 50
50 48
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 46 47 48 49 5...

input:

1000
50 19
5 6 8 9 13 14 17 20 21 23 29 32 33 35 41 45 46 49 50
50 33
2 5 6 7 10 12 13 14 15 16 18 19 21 23 24 25 27 28 29 30 31 32 34 36 37 40 41 42 43 44 46 49 50
50 48
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 46 47 48...

output:

50 30
2 3 4 7 10 11 12 15 16 18 19 22 24 25 26 27 28 30 31 34 36 37 38 39 40 42 43 44 47 48
50 16
3 4 8 9 11 17 20 22 26 33 35 38 39 45 47 48
50 1
36
50 41
1 2 3 4 5 6 7 8 10 13 14 15 17 18 20 21 23 24 25 26 27 28 29 30 31 33 34 35 36 37 38 39 40 41 42 43 45 46 48 49 50
50 26
2 8 10 11 14 17 19 20 2...

result:

ok 2000 lines

Test #22:

score: 100
Accepted
time: 2ms
memory: 3520kb

input:

997
13 8
1 2 5 7 8 10 11 12
27 24
1 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25 26 27
13 8
1 2 3 4 5 8 10 12
18 12
2 3 4 5 6 9 10 12 13 14 15 16
26 9
1 2 3 8 10 15 21 24 26
20 3
6 8 15
39 14
2 4 5 11 13 16 19 22 23 25 26 30 31 34
46 43
1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 ...

output:

13 5
3 4 6 9 13
27 3
2 3 24
13 5
6 7 9 11 13
18 5
7 8 11 17 18
26 18
1 4 5 6 7 9 11 12 13 14 16 17 18 19 20 22 23 25
20 16
2 3 4 5 7 9 10 11 12 13 14 16 17 18 19 20
39 25
1 3 6 7 8 9 10 12 14 15 17 18 20 21 24 27 28 29 32 33 35 36 37 38 39
46 4
1 10 30 40
26 9
8 10 11 15 17 18 19 25 26
13 5
1 4 7 9 ...

input:

997
13 5
3 4 6 9 13
27 3
2 3 24
13 5
6 7 9 11 13
18 5
7 8 11 17 18
26 18
1 4 5 6 7 9 11 12 13 14 16 17 18 19 20 22 23 25
20 16
2 3 4 5 7 9 10 11 12 13 14 16 17 18 19 20
39 25
1 3 6 7 8 9 10 12 14 15 17 18 20 21 24 27 28 29 32 33 35 36 37 38 39
46 4
1 10 30 40
26 9
8 10 11 15 17 18 19 25 26
13 5
1 4 ...

output:

13 8
1 2 5 7 8 10 11 12
27 24
1 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25 26 27
13 8
1 2 3 4 5 8 10 12
18 12
2 3 4 5 6 9 10 12 13 14 15 16
26 9
1 2 3 8 10 15 21 24 26
20 3
6 8 15
39 14
2 4 5 11 13 16 19 22 23 25 26 30 31 34
46 43
1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 2...

result:

ok 1994 lines

Test #23:

score: 100
Accepted
time: 3ms
memory: 3492kb

input:

1000
50 33
1 2 3 4 6 7 8 10 11 12 13 15 16 17 19 20 21 22 23 24 26 27 29 31 33 35 36 37 38 40 44 48 49
40 35
2 3 4 5 6 7 8 10 11 12 13 14 15 16 18 19 20 21 23 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
47 4
7 36 42 45
49 0
44 33
1 2 3 5 6 8 9 11 12 13 14 15 16 17 18 19 20 21 22 26 27 31 32 33 3...

output:

50 18
1 5 9 14 18 25 28 30 32 34 39 41 42 43 45 46 47 50
40 4
9 17 22 24
47 43
1 2 3 4 5 6 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 43 44 46 47
49 49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 3...

input:

1000
50 18
1 5 9 14 18 25 28 30 32 34 39 41 42 43 45 46 47 50
40 4
9 17 22 24
47 43
1 2 3 4 5 6 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 43 44 46 47
49 49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33...

output:

50 33
1 2 3 4 6 7 8 10 11 12 13 15 16 17 19 20 21 22 23 24 26 27 29 31 33 35 36 37 38 40 44 48 49
40 35
2 3 4 5 6 7 8 10 11 12 13 14 15 16 18 19 20 21 23 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
47 4
7 36 42 45
49 0

44 33
1 2 3 5 6 8 9 11 12 13 14 15 16 17 18 19 20 21 22 26 27 31 32 33 34 35...

result:

ok 2000 lines

Test #24:

score: 100
Accepted
time: 3ms
memory: 3520kb

input:

1000
49 21
1 6 10 13 14 15 18 20 21 24 28 29 32 34 36 38 39 40 41 45 46
43 4
1 10 24 41
40 21
1 2 3 4 6 8 9 12 16 17 20 22 24 25 26 27 28 30 32 36 40
40 19
5 6 8 9 11 13 14 17 18 19 22 24 25 28 31 32 35 37 39
48 10
2 7 10 18 23 24 26 32 34 45
46 9
1 2 11 14 23 26 35 42 45
44 43
1 2 3 4 5 6 7 8 9 10 ...

output:

49 28
2 3 4 5 7 8 9 11 12 16 17 19 22 23 25 26 27 30 31 33 35 37 42 43 44 47 48 49
43 39
2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 42 43
40 20
1 5 7 10 11 13 14 15 18 19 21 23 29 31 33 34 35 37 38 39
40 20
2 3 4 7 10 12 15 16 20 21 23 26 2...

input:

1000
49 28
2 3 4 5 7 8 9 11 12 16 17 19 22 23 25 26 27 30 31 33 35 37 42 43 44 47 48 49
43 39
2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 42 43
40 20
1 5 7 10 11 13 14 15 18 19 21 23 29 31 33 34 35 37 38 39
40 20
2 3 4 7 10 12 15 16 20 21 23...

output:

49 21
1 6 10 13 14 15 18 20 21 24 28 29 32 34 36 38 39 40 41 45 46
43 4
1 10 24 41
40 21
1 2 3 4 6 8 9 12 16 17 20 22 24 25 26 27 28 30 32 36 40
40 19
5 6 8 9 11 13 14 17 18 19 22 24 25 28 31 32 35 37 39
48 10
2 7 10 18 23 24 26 32 34 45
46 9
1 2 11 14 23 26 35 42 45
44 43
1 2 3 4 5 6 7 8 9 10 11 12...

result:

ok 2000 lines

Test #25:

score: 100
Accepted
time: 3ms
memory: 3524kb

input:

1000
41 39
1 2 3 4 5 6 7 8 9 10 12 13 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
49 28
1 2 3 5 7 9 11 14 15 16 18 20 22 23 24 25 27 29 30 32 33 34 36 37 38 45 46 49
45 30
1 2 4 5 10 11 12 15 16 17 18 19 20 22 24 25 26 27 28 30 31 33 35 36 37 39 40 41 42 43
46 15...

output:

41 2
11 14
49 21
4 6 8 10 12 13 17 19 21 26 28 31 35 39 40 41 42 43 44 47 48
45 15
3 6 7 8 9 13 14 21 23 29 32 34 38 44 45
46 30
2 3 4 7 8 9 11 12 13 15 16 17 18 19 21 24 25 27 29 30 31 32 33 35 37 38 40 41 43 44
44 12
1 9 19 20 21 22 23 28 30 36 37 43
45 14
1 4 5 6 11 16 25 26 31 32 33 34 39 41
46 ...

input:

1000
41 2
11 14
49 21
4 6 8 10 12 13 17 19 21 26 28 31 35 39 40 41 42 43 44 47 48
45 15
3 6 7 8 9 13 14 21 23 29 32 34 38 44 45
46 30
2 3 4 7 8 9 11 12 13 15 16 17 18 19 21 24 25 27 29 30 31 32 33 35 37 38 40 41 43 44
44 12
1 9 19 20 21 22 23 28 30 36 37 43
45 14
1 4 5 6 11 16 25 26 31 32 33 34 39 4...

output:

41 39
1 2 3 4 5 6 7 8 9 10 12 13 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
49 28
1 2 3 5 7 9 11 14 15 16 18 20 22 23 24 25 27 29 30 32 33 34 36 37 38 45 46 49
45 30
1 2 4 5 10 11 12 15 16 17 18 19 20 22 24 25 26 27 28 30 31 33 35 36 37 39 40 41 42 43
46 15
5 6 ...

result:

ok 2000 lines

Test #26:

score: 100
Accepted
time: 3ms
memory: 3500kb

input:

1000
50 33
1 2 3 5 6 10 11 13 14 15 16 17 19 20 21 22 23 25 27 28 29 30 32 33 37 39 40 42 43 44 47 49 50
40 28
3 4 5 6 7 8 9 10 12 14 15 16 18 20 21 23 24 25 26 27 28 31 32 33 34 36 37 39
41 14
1 6 7 9 10 20 21 23 24 26 29 30 36 40
41 21
1 4 8 9 10 11 12 14 17 19 20 21 22 28 29 30 32 37 38 40 41
50 ...

output:

50 18
1 4 7 8 9 12 18 24 26 31 34 35 36 38 41 45 46 48
40 11
2 11 13 17 19 22 29 30 35 38 40
41 27
2 3 4 5 8 11 12 13 14 15 16 17 18 19 22 25 27 28 31 32 33 34 35 37 38 39 41
41 20
2 3 5 6 7 13 15 16 18 23 24 25 26 27 31 33 34 35 36 39
50 20
1 3 6 8 14 16 19 20 22 23 25 26 27 29 30 38 39 44 45 46
46...

input:

1000
50 18
1 4 7 8 9 12 18 24 26 31 34 35 36 38 41 45 46 48
40 11
2 11 13 17 19 22 29 30 35 38 40
41 27
2 3 4 5 8 11 12 13 14 15 16 17 18 19 22 25 27 28 31 32 33 34 35 37 38 39 41
41 20
2 3 5 6 7 13 15 16 18 23 24 25 26 27 31 33 34 35 36 39
50 20
1 3 6 8 14 16 19 20 22 23 25 26 27 29 30 38 39 44 45 ...

output:

50 33
1 2 3 5 6 10 11 13 14 15 16 17 19 20 21 22 23 25 27 28 29 30 32 33 37 39 40 42 43 44 47 49 50
40 28
3 4 5 6 7 8 9 10 12 14 15 16 18 20 21 23 24 25 26 27 28 31 32 33 34 36 37 39
41 14
1 6 7 9 10 20 21 23 24 26 29 30 36 40
41 21
1 4 8 9 10 11 12 14 17 19 20 21 22 28 29 30 32 37 38 40 41
50 31
1 ...

result:

ok 2000 lines

Test #27:

score: 100
Accepted
time: 3ms
memory: 3496kb

input:

1000
50 40
1 2 3 4 7 8 9 10 12 13 14 16 17 18 20 21 22 23 25 26 27 28 29 32 33 34 35 36 37 38 39 40 41 43 44 45 46 47 48 50
47 16
1 4 6 9 13 18 19 24 25 28 31 32 33 35 44 45
46 11
2 3 5 8 12 17 25 26 32 41 43
43 15
3 4 7 8 9 12 14 16 18 21 23 24 26 31 41
44 10
9 11 17 18 20 26 30 32 33 44
43 19
2 3 ...

output:

50 11
1 5 6 11 15 19 24 30 31 42 49
47 31
2 3 5 7 8 10 11 12 14 15 16 17 20 21 22 23 26 27 29 30 34 36 37 38 39 40 41 42 43 46 47
46 34
4 6 7 9 10 11 13 14 15 16 18 19 20 21 22 23 24 27 28 29 30 31 33 34 35 36 37 38 39 40 42 44 45 46
43 28
1 2 5 6 10 11 13 15 17 19 20 22 25 27 28 29 30 32 33 34 35 3...

input:

1000
50 11
1 5 6 11 15 19 24 30 31 42 49
47 31
2 3 5 7 8 10 11 12 14 15 16 17 20 21 22 23 26 27 29 30 34 36 37 38 39 40 41 42 43 46 47
46 34
4 6 7 9 10 11 13 14 15 16 18 19 20 21 22 23 24 27 28 29 30 31 33 34 35 36 37 38 39 40 42 44 45 46
43 28
1 2 5 6 10 11 13 15 17 19 20 22 25 27 28 29 30 32 33 34...

output:

50 40
1 2 3 4 7 8 9 10 12 13 14 16 17 18 20 21 22 23 25 26 27 28 29 32 33 34 35 36 37 38 39 40 41 43 44 45 46 47 48 50
47 16
1 4 6 9 13 18 19 24 25 28 31 32 33 35 44 45
46 11
2 3 5 8 12 17 25 26 32 41 43
43 15
3 4 7 8 9 12 14 16 18 21 23 24 26 31 41
44 10
9 11 17 18 20 26 30 32 33 44
43 19
2 3 5 8 1...

result:

ok 2000 lines

Test #28:

score: 100
Accepted
time: 3ms
memory: 3568kb

input:

1000
50 1
22
50 2
11 29
49 4
16 26 34 45
49 4
5 12 30 32
49 0
50 5
3 9 16 25 32
50 2
7 50
49 0
49 3
1 3 48
50 4
7 15 31 40
50 6
1 3 16 31 34 36
49 0
50 2
24 32
49 3
3 12 25
50 0
49 5
6 16 17 24 32
50 5
2 5 23 42 49
50 0
49 0
49 3
14 31 45
49 1
32
49 0
50 4
3 5 6 16
50 5
11 12 18 26 38
49 1
42
50 5
1...

output:

50 48
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
50 47
2 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
49 45
1 2 3 4 5 6 7...

input:

1000
50 48
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
50 47
2 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
49 45
1 2 3 4 ...

output:

50 1
22
50 2
11 29
49 4
16 26 34 45
49 4
5 12 30 32
49 0

50 5
3 9 16 25 32
50 2
7 50
49 0

49 3
1 3 48
50 4
7 15 31 40
50 6
1 3 16 31 34 36
49 0

50 2
24 32
49 3
3 12 25
50 0

49 5
6 16 17 24 32
50 5
2 5 23 42 49
50 0

49 0

49 3
14 31 45
49 1
32
49 0

50 4
3 5 6 16
50 5
11 12 18 26 38
49 1
42
50 5...

result:

ok 2000 lines

Test #29:

score: 100
Accepted
time: 3ms
memory: 3504kb

input:

1000
50 4
26 29 46 50
50 2
38 49
49 6
4 5 19 29 44 48
49 3
4 13 23
49 2
17 33
49 5
9 13 20 28 43
49 3
37 40 48
50 0
49 0
50 3
23 29 50
50 4
6 16 20 23
50 3
7 24 46
50 4
11 42 46 49
49 6
9 16 24 36 43 48
50 6
28 30 31 37 45 50
49 6
1 17 31 36 41 48
49 0
49 1
11
49 5
19 22 24 42 43
50 1
4
49 3
17 28 3...

output:

50 45
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 27 28 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 47 48 49
50 47
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 39 40 41 42 43 44 45 46 47 48 50
49 43
1 2 3 6 7 8 9 10 11 12...

input:

1000
50 45
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 27 28 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 47 48 49
50 47
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 39 40 41 42 43 44 45 46 47 48 50
49 43
1 2 3 6 7 8 9 10 ...

output:

50 4
26 29 46 50
50 2
38 49
49 6
4 5 19 29 44 48
49 3
4 13 23
49 2
17 33
49 5
9 13 20 28 43
49 3
37 40 48
50 0

49 0

50 3
23 29 50
50 4
6 16 20 23
50 3
7 24 46
50 4
11 42 46 49
49 6
9 16 24 36 43 48
50 6
28 30 31 37 45 50
49 6
1 17 31 36 41 48
49 0

49 1
11
49 5
19 22 24 42 43
50 1
4
49 3
17 28 30
...

result:

ok 2000 lines

Test #30:

score: 100
Accepted
time: 3ms
memory: 3568kb

input:

1000
49 6
4 5 8 34 42 45
49 4
5 8 24 25
50 3
9 37 39
50 6
5 15 39 41 42 43
49 3
5 12 14
49 4
5 15 28 49
50 3
16 33 42
49 6
18 24 26 30 43 46
49 1
5
50 2
32 41
50 2
31 39
49 3
13 16 47
50 1
41
50 2
10 28
50 3
8 19 48
50 5
1 12 13 46 50
49 1
34
49 2
2 39
49 5
11 18 33 40 47
49 1
46
49 4
5 15 36 41
50 ...

output:

49 43
1 2 3 6 7 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 35 36 37 38 39 40 41 43 44 46 47 48 49
49 45
1 2 3 4 6 7 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
50 46
2 3 4 5 6 7 8 10 11 12 13 14 15...

input:

1000
49 43
1 2 3 6 7 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 35 36 37 38 39 40 41 43 44 46 47 48 49
49 45
1 2 3 4 6 7 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
50 46
2 3 4 5 6 7 8 10 11 12 13 ...

output:

49 6
4 5 8 34 42 45
49 4
5 8 24 25
50 3
9 37 39
50 6
5 15 39 41 42 43
49 3
5 12 14
49 4
5 15 28 49
50 3
16 33 42
49 6
18 24 26 30 43 46
49 1
5
50 2
32 41
50 2
31 39
49 3
13 16 47
50 1
41
50 2
10 28
50 3
8 19 48
50 5
1 12 13 46 50
49 1
34
49 2
2 39
49 5
11 18 33 40 47
49 1
46
49 4
5 15 36 41
50 4
5 2...

result:

ok 1999 lines

Test #31:

score: 100
Accepted
time: 3ms
memory: 3524kb

input:

1000
49 3
2 8 36
50 3
2 7 48
49 6
8 9 12 14 15 48
49 4
12 16 34 44
50 3
14 41 45
49 4
23 29 35 40
50 2
44 48
49 3
19 24 35
50 4
6 23 28 31
50 2
25 33
49 6
2 15 26 28 34 42
49 1
45
49 6
11 28 33 34 44 48
49 6
12 13 31 33 35 45
49 6
5 15 18 21 24 48
49 3
2 15 20
50 0
49 6
4 7 25 38 39 42
49 3
24 43 49...

output:

49 46
1 3 4 5 6 7 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 46 47 48 49
50 46
3 4 5 6 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 49 50
49 43
1 2 3 4 5 6 7 10 11...

input:

1000
49 46
1 3 4 5 6 7 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 46 47 48 49
50 46
3 4 5 6 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 49 50
49 43
1 2 3 4 5 6 7 ...

output:

49 3
2 8 36
50 3
2 7 48
49 6
8 9 12 14 15 48
49 4
12 16 34 44
50 3
14 41 45
49 4
23 29 35 40
50 2
44 48
49 3
19 24 35
50 4
6 23 28 31
50 2
25 33
49 6
2 15 26 28 34 42
49 1
45
49 6
11 28 33 34 44 48
49 6
12 13 31 33 35 45
49 6
5 15 18 21 24 48
49 3
2 15 20
50 0

49 6
4 7 25 38 39 42
49 3
24 43 49
49 ...

result:

ok 2000 lines

Test #32:

score: 100
Accepted
time: 3ms
memory: 3440kb

input:

1000
50 6
18 25 28 29 33 49
50 3
12 40 44
49 0
49 6
1 7 14 22 27 43
49 3
22 23 40
49 2
22 29
50 0
49 6
8 9 30 39 44 46
49 5
2 7 21 24 42
50 3
4 37 42
49 0
49 0
49 6
6 11 17 28 37 42
49 6
2 4 5 7 16 37
49 6
5 12 17 25 37 47
50 2
12 22
50 5
10 24 36 39 40
49 0
50 0
49 4
1 26 40 45
49 1
43
49 2
17 43
5...

output:

50 43
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20 21 22 23 24 26 27 30 31 32 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50
50 46
2 3 4 5 6 7 8 9 10 11 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 41 42 43 45 46 47 48 49 50
49 49
1 2 3 4 5 6 7 8 9 10 11 12 13 1...

input:

1000
50 43
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20 21 22 23 24 26 27 30 31 32 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50
50 46
2 3 4 5 6 7 8 9 10 11 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 41 42 43 45 46 47 48 49 50
49 49
1 2 3 4 5 6 7 8 9 10 11 12...

output:

50 6
18 25 28 29 33 49
50 3
12 40 44
49 0

49 6
1 7 14 22 27 43
49 3
22 23 40
49 2
22 29
50 0

49 6
8 9 30 39 44 46
49 5
2 7 21 24 42
50 3
4 37 42
49 0

49 0

49 6
6 11 17 28 37 42
49 6
2 4 5 7 16 37
49 6
5 12 17 25 37 47
50 2
12 22
50 5
10 24 36 39 40
49 0

50 0

49 4
1 26 40 45
49 1
43
49 2
17 43
...

result:

ok 2000 lines

Test #33:

score: 100
Accepted
time: 3ms
memory: 3484kb

input:

1000
49 48
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 46 47 48 49
49 46
1 2 3 4 5 6 7 8 9 10 11 12 13 15 16 17 18 19 20 21 22 23 24 25 27 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 44 45 46 47 48 49
50 50
1 2 3 4 5 6 7...

output:

49 1
36
49 3
14 26 37
50 1
1
50 1
1
50 7
1 18 24 29 33 40 50
49 0

49 3
40 41 42
50 7
1 2 9 11 12 14 32
49 3
1 5 42
49 3
28 42 48
49 2
21 41
50 1
1
49 0

50 1
1
50 4
1 15 19 38
49 4
8 11 18 19
49 2
21 49
49 1
16
49 3
7 39 40
49 2
1 14
49 2
5 22
49 2
22 29
50 7
1 7 16 30 31 44 48
50 5
1 20 23 25 43
4...

input:

1000
49 1
36
49 3
14 26 37
50 1
1
50 1
1
50 7
1 18 24 29 33 40 50
49 0
49 3
40 41 42
50 7
1 2 9 11 12 14 32
49 3
1 5 42
49 3
28 42 48
49 2
21 41
50 1
1
49 0
50 1
1
50 4
1 15 19 38
49 4
8 11 18 19
49 2
21 49
49 1
16
49 3
7 39 40
49 2
1 14
49 2
5 22
49 2
22 29
50 7
1 7 16 30 31 44 48
50 5
1 20 23 25 4...

output:

49 48
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 46 47 48 49
49 46
1 2 3 4 5 6 7 8 9 10 11 12 13 15 16 17 18 19 20 21 22 23 24 25 27 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 44 45 46 47 48 49
50 50
1 2 3 4 5 6 7 8 9 ...

result:

ok 2000 lines

Test #34:

score: 100
Accepted
time: 3ms
memory: 3496kb

input:

1000
50 47
1 2 3 4 5 6 7 8 9 10 12 13 14 16 17 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
50 48
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 42 43 44 45 46 47 48 49 50
49 49
1 2 3 4 5 ...

output:

50 4
1 11 15 28
50 3
1 23 41
49 0

49 4
17 18 26 28
49 0

50 4
1 4 8 14
50 5
1 22 31 42 46
49 5
7 17 20 23 33
50 1
1
50 1
1
49 3
7 29 34
50 4
2 19 20 48
49 5
13 19 23 32 46
50 7
1 6 27 29 33 38 45
49 1
12
49 1
7
50 6
1 9 10 11 13 36
50 2
1 15
50 6
1 7 19 26 38 39
49 0

50 3
1 10 45
50 1
1
49 3
4 7 2...

input:

1000
50 4
1 11 15 28
50 3
1 23 41
49 0
49 4
17 18 26 28
49 0
50 4
1 4 8 14
50 5
1 22 31 42 46
49 5
7 17 20 23 33
50 1
1
50 1
1
49 3
7 29 34
50 4
2 19 20 48
49 5
13 19 23 32 46
50 7
1 6 27 29 33 38 45
49 1
12
49 1
7
50 6
1 9 10 11 13 36
50 2
1 15
50 6
1 7 19 26 38 39
49 0
50 3
1 10 45
50 1
1
49 3
4 7...

output:

50 47
1 2 3 4 5 6 7 8 9 10 12 13 14 16 17 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
50 48
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 42 43 44 45 46 47 48 49 50
49 49
1 2 3 4 5 6 7 8...

result:

ok 2000 lines

Test #35:

score: 100
Accepted
time: 3ms
memory: 3508kb

input:

1000
50 49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 43 44 45 46 47 48 49 50
49 44
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25 26 27 29 30 31 32 33 34 36 37 38 39 40 41 42 43 44 46 47 48 49
49 44
1 2 3 4 5 7 8 1...

output:

50 2
1 42
49 5
1 24 28 35 45
49 5
6 9 18 29 39
50 2
30 34
50 3
1 6 34
50 7
1 10 16 23 25 31 45
49 2
21 32
50 5
1 22 25 27 44
50 7
1 8 24 30 39 45 47
49 2
20 35
49 0

50 3
1 13 25
50 4
1 6 8 43
50 2
1 38
49 4
2 3 22 48
49 1
25
49 3
7 26 38
49 0

49 1
37
50 7
1 16 17 24 26 28 31
50 7
1 3 22 31 32 39 4...

input:

1000
50 2
1 42
49 5
1 24 28 35 45
49 5
6 9 18 29 39
50 2
30 34
50 3
1 6 34
50 7
1 10 16 23 25 31 45
49 2
21 32
50 5
1 22 25 27 44
50 7
1 8 24 30 39 45 47
49 2
20 35
49 0
50 3
1 13 25
50 4
1 6 8 43
50 2
1 38
49 4
2 3 22 48
49 1
25
49 3
7 26 38
49 0
49 1
37
50 7
1 16 17 24 26 28 31
50 7
1 3 22 31 32 3...

output:

50 49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 43 44 45 46 47 48 49 50
49 44
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25 26 27 29 30 31 32 33 34 36 37 38 39 40 41 42 43 44 46 47 48 49
49 44
1 2 3 4 5 7 8 10 11 ...

result:

ok 2000 lines

Test #36:

score: 100
Accepted
time: 3ms
memory: 3444kb

input:

1000
49 45
1 2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 22 23 24 25 27 28 29 30 31 32 33 35 36 37 38 39 40 41 42 43 44 45 46 47 49
49 46
1 2 3 4 5 6 7 8 10 11 13 14 15 16 17 18 19 20 21 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
50 46
1 2 3 4 5 6 7 8 9 10 ...

output:

49 4
13 26 34 48
49 3
9 12 22
50 5
1 12 30 40 44
49 0

50 3
1 23 38
49 4
4 29 39 40
49 3
28 35 44
50 5
5 17 25 38 40
50 2
1 14
49 3
1 9 39
50 1
1
50 5
10 21 29 38 50
50 3
1 26 46
50 4
1 10 22 35
49 3
1 14 47
49 3
11 31 41
49 4
30 38 42 43
50 1
1
49 2
1 35
49 1
43
50 3
1 12 47
50 4
1 6 35 48
50 6
1 2...

input:

1000
49 4
13 26 34 48
49 3
9 12 22
50 5
1 12 30 40 44
49 0
50 3
1 23 38
49 4
4 29 39 40
49 3
28 35 44
50 5
5 17 25 38 40
50 2
1 14
49 3
1 9 39
50 1
1
50 5
10 21 29 38 50
50 3
1 26 46
50 4
1 10 22 35
49 3
1 14 47
49 3
11 31 41
49 4
30 38 42 43
50 1
1
49 2
1 35
49 1
43
50 3
1 12 47
50 4
1 6 35 48
50 6...

output:

49 45
1 2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 22 23 24 25 27 28 29 30 31 32 33 35 36 37 38 39 40 41 42 43 44 45 46 47 49
49 46
1 2 3 4 5 6 7 8 10 11 13 14 15 16 17 18 19 20 21 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
50 46
1 2 3 4 5 6 7 8 9 10 11 13...

result:

ok 2000 lines

Test #37:

score: 100
Accepted
time: 3ms
memory: 3556kb

input:

1000
50 49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
50 46
1 2 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27 28 29 30 31 33 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
50 48
2 3 4 5 6 ...

output:

50 2
1 23
50 5
1 11 23 32 34
50 1
37
50 7
1 5 14 29 31 37 47
50 3
1 18 46
50 7
1 5 33 37 44 45 49
49 2
36 41
50 5
1 12 18 24 49
49 3
8 25 40
49 5
22 25 30 32 46
50 5
1 26 37 43 47
50 2
1 23
50 6
1 5 17 24 26 42
50 2
1 23
50 7
1 9 11 16 33 39 44
49 5
1 13 29 43 44
50 4
1 29 41 47
50 4
1 11 20 27
50 1...

input:

1000
50 2
1 23
50 5
1 11 23 32 34
50 1
37
50 7
1 5 14 29 31 37 47
50 3
1 18 46
50 7
1 5 33 37 44 45 49
49 2
36 41
50 5
1 12 18 24 49
49 3
8 25 40
49 5
22 25 30 32 46
50 5
1 26 37 43 47
50 2
1 23
50 6
1 5 17 24 26 42
50 2
1 23
50 7
1 9 11 16 33 39 44
49 5
1 13 29 43 44
50 4
1 29 41 47
50 4
1 11 20 27...

output:

50 49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
50 46
1 2 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27 28 29 30 31 33 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
50 48
2 3 4 5 6 7 8 9...

result:

ok 2000 lines

Test #38:

score: 100
Accepted
time: 3ms
memory: 3436kb

input:

1000
49 47
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 44 45 47 48 49
49 46
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 22 24 25 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
49 48
1 2 3 4 5 6 7 8 ...

output:

49 2
37 46
49 3
21 23 26
49 1
44
50 2
1 13
50 3
1 2 31
50 6
1 8 10 13 17 48
49 1
11
50 4
1 23 35 37
49 5
3 7 23 30 44
49 1
5
50 3
1 45 48
50 6
1 9 20 32 39 49
49 0

49 3
37 39 42
49 1
19
49 3
3 32 38
49 5
15 30 38 39 46
50 4
1 8 12 34
49 0

50 6
1 7 12 15 39 40
49 5
1 10 26 44 47
49 5
8 26 32 36 38
...

input:

1000
49 2
37 46
49 3
21 23 26
49 1
44
50 2
1 13
50 3
1 2 31
50 6
1 8 10 13 17 48
49 1
11
50 4
1 23 35 37
49 5
3 7 23 30 44
49 1
5
50 3
1 45 48
50 6
1 9 20 32 39 49
49 0
49 3
37 39 42
49 1
19
49 3
3 32 38
49 5
15 30 38 39 46
50 4
1 8 12 34
49 0
50 6
1 7 12 15 39 40
49 5
1 10 26 44 47
49 5
8 26 32 36 ...

output:

49 47
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 44 45 47 48 49
49 46
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 22 24 25 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
49 48
1 2 3 4 5 6 7 8 9 10 ...

result:

ok 2000 lines

Test #39:

score: 100
Accepted
time: 3ms
memory: 3504kb

input:

1000
49 46
1 2 3 4 5 6 7 8 9 10 11 13 14 15 16 18 19 20 21 22 23 24 25 26 27 28 29 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
49 48
1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
50 44
1 2 3 5 6 7 8...

output:

49 3
12 17 30
49 1
10
50 7
1 4 12 17 19 21 38
50 2
1 35
49 5
1 12 19 40 46
49 0

49 2
14 16
49 1
4
50 4
1 23 37 49
49 2
5 19
49 3
19 28 43
49 1
29
50 1
1
50 5
1 2 12 19 39
49 5
6 17 21 28 39
50 3
1 7 44
49 2
2 27
50 5
1 19 35 43 49
50 6
1 3 21 22 27 49
49 5
11 16 20 38 41
49 3
6 28 40
50 5
1 15 28 4...

input:

1000
49 3
12 17 30
49 1
10
50 7
1 4 12 17 19 21 38
50 2
1 35
49 5
1 12 19 40 46
49 0
49 2
14 16
49 1
4
50 4
1 23 37 49
49 2
5 19
49 3
19 28 43
49 1
29
50 1
1
50 5
1 2 12 19 39
49 5
6 17 21 28 39
50 3
1 7 44
49 2
2 27
50 5
1 19 35 43 49
50 6
1 3 21 22 27 49
49 5
11 16 20 38 41
49 3
6 28 40
50 5
1 15 ...

output:

49 46
1 2 3 4 5 6 7 8 9 10 11 13 14 15 16 18 19 20 21 22 23 24 25 26 27 28 29 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
49 48
1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
50 44
1 2 3 5 6 7 8 9 10...

result:

ok 2000 lines

Test #40:

score: 100
Accepted
time: 0ms
memory: 3488kb

input:

1000
50 45
1 2 3 4 5 6 8 10 11 12 13 14 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
50 49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
49 46
1 2 4 5 6 7...

output:

50 6
1 7 9 15 16 21
50 2
1 23
49 3
3 8 23
50 2
1 42
50 7
1 7 12 18 22 31 47
49 0

50 2
1 14
50 4
1 40 43 48
49 5
3 9 41 45 47
50 4
1 4 13 34
50 2
1 25
50 7
1 5 10 15 19 41 43
50 5
1 2 3 4 25
50 6
1 7 10 22 32 41
49 0

50 6
1 14 17 19 22 25
50 7
1 2 20 28 37 45 48
50 7
1 10 12 14 15 35 48
49 2
7 14
5...

input:

1000
50 6
1 7 9 15 16 21
50 2
1 23
49 3
3 8 23
50 2
1 42
50 7
1 7 12 18 22 31 47
49 0
50 2
1 14
50 4
1 40 43 48
49 5
3 9 41 45 47
50 4
1 4 13 34
50 2
1 25
50 7
1 5 10 15 19 41 43
50 5
1 2 3 4 25
50 6
1 7 10 22 32 41
49 0
50 6
1 14 17 19 22 25
50 7
1 2 20 28 37 45 48
50 7
1 10 12 14 15 35 48
49 2
7 1...

output:

50 45
1 2 3 4 5 6 8 10 11 12 13 14 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
50 49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
49 46
1 2 4 5 6 7 9 10...

result:

ok 2000 lines

Test #41:

score: 100
Accepted
time: 3ms
memory: 3556kb

input:

1000
49 48
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
49 46
1 2 4 5 6 7 8 9 10 11 12 13 14 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 42 43 44 45 46 47 48 49
50 50
1 2 3 4 5 6 ...

output:

49 1
19
49 3
3 15 41
50 1
1
50 4
1 24 25 46
49 1
18
49 4
10 18 32 39
49 3
11 15 44
49 3
12 35 44
50 1
1
49 5
6 14 21 32 42
50 4
4 5 33 43
50 6
1 6 28 30 33 41
49 0

49 5
4 6 17 19 29
50 3
1 26 35
50 5
1 19 23 29 38
49 4
29 40 42 47
49 4
15 39 42 48
49 4
2 7 28 29
50 5
1 21 35 44 45
50 7
1 3 5 19 28 ...

input:

1000
49 1
19
49 3
3 15 41
50 1
1
50 4
1 24 25 46
49 1
18
49 4
10 18 32 39
49 3
11 15 44
49 3
12 35 44
50 1
1
49 5
6 14 21 32 42
50 4
4 5 33 43
50 6
1 6 28 30 33 41
49 0
49 5
4 6 17 19 29
50 3
1 26 35
50 5
1 19 23 29 38
49 4
29 40 42 47
49 4
15 39 42 48
49 4
2 7 28 29
50 5
1 21 35 44 45
50 7
1 3 5 19...

output:

49 48
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
49 46
1 2 4 5 6 7 8 9 10 11 12 13 14 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 42 43 44 45 46 47 48 49
50 50
1 2 3 4 5 6 7 8 9...

result:

ok 2000 lines

Test #42:

score: 100
Accepted
time: 3ms
memory: 3500kb

input:

1000
50 48
1 2 3 4 5 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
50 49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 48 49 50
49 45
2 3...

output:

50 3
1 6 10
50 2
1 47
49 4
1 7 36 40
50 4
1 23 27 36
49 2
14 23
49 3
14 17 31
50 3
1 27 31
50 1
1
49 3
2 24 34
49 2
35 47
50 1
1
50 4
1 11 14 26
49 1
23
49 1
49
50 6
1 13 19 31 34 44
50 7
1 7 24 36 38 40 49
50 1
1
49 2
1 20
49 3
12 28 46
50 2
1 13
49 5
4 23 30 32 33
49 1
36
49 5
3 4 6 17 26
50 4
1 2...

input:

1000
50 3
1 6 10
50 2
1 47
49 4
1 7 36 40
50 4
1 23 27 36
49 2
14 23
49 3
14 17 31
50 3
1 27 31
50 1
1
49 3
2 24 34
49 2
35 47
50 1
1
50 4
1 11 14 26
49 1
23
49 1
49
50 6
1 13 19 31 34 44
50 7
1 7 24 36 38 40 49
50 1
1
49 2
1 20
49 3
12 28 46
50 2
1 13
49 5
4 23 30 32 33
49 1
36
49 5
3 4 6 17 26
50 ...

output:

50 48
1 2 3 4 5 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
50 49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 48 49 50
49 45
2 3 4 5 ...

result:

ok 2000 lines