QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#294369#4825. Even and Odd Combinationsucup-team159#AC ✓4ms3660kbC++2016.8kb2023-12-30 13:06:572023-12-30 13:06:58

Judging History

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

  • [2023-12-30 13:06:58]
  • 评测
  • 测评结果:AC
  • 用时:4ms
  • 内存:3660kb
  • [2023-12-30 13:06:57]
  • 提交

answer

#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
//#pragma GCC optimize("Ofast")
//#undef LOCAL


#include <unistd.h>
#include <algorithm>
#include <array>
#include <cassert>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <type_traits>
#include <vector>
#include <bit>
#include <cstdint>


#include <cassert>
#include <numeric>
#include <type_traits>

namespace yosupo {

namespace internal {

template <class T>
using is_signed_int128 =
    typename std::conditional<std::is_same<T, __int128_t>::value ||
                                  std::is_same<T, __int128>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using is_unsigned_int128 =
    typename std::conditional<std::is_same<T, __uint128_t>::value ||
                                  std::is_same<T, unsigned __int128>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using make_unsigned_int128 =
    typename std::conditional<std::is_same<T, __int128_t>::value,
                              __uint128_t,
                              unsigned __int128>;

template <class T>
using is_integral =
    typename std::conditional<std::is_integral<T>::value ||
                                  internal::is_signed_int128<T>::value ||
                                  internal::is_unsigned_int128<T>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using is_signed_int = typename std::conditional<(is_integral<T>::value &&
                                                 std::is_signed<T>::value) ||
                                                    is_signed_int128<T>::value,
                                                std::true_type,
                                                std::false_type>::type;

template <class T>
using is_unsigned_int =
    typename std::conditional<(is_integral<T>::value &&
                               std::is_unsigned<T>::value) ||
                                  is_unsigned_int128<T>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using to_unsigned = typename std::conditional<
    is_signed_int128<T>::value,
    make_unsigned_int128<T>,
    typename std::conditional<std::is_signed<T>::value,
                              std::make_unsigned<T>,
                              std::common_type<T>>::type>::type;

template <class T>
using is_integral_t = std::enable_if_t<is_integral<T>::value>;

template <class T>
using is_signed_int_t = std::enable_if_t<is_signed_int<T>::value>;

template <class T>
using is_unsigned_int_t = std::enable_if_t<is_unsigned_int<T>::value>;

template <class T> using to_unsigned_t = typename to_unsigned<T>::type;

}  // namespace internal

}  // namespace yosupo

namespace yosupo {

struct Scanner {
  public:
    Scanner(const Scanner&) = delete;
    Scanner& operator=(const Scanner&) = delete;

    Scanner(FILE* fp) : fd(fileno(fp)) { line[0] = 127; }

    void read() {}
    template <class H, class... T> void read(H& h, T&... t) {
        bool f = read_single(h);
        assert(f);
        read(t...);
    }

    int read_unsafe() { return 0; }
    template <class H, class... T> int read_unsafe(H& h, T&... t) {
        bool f = read_single(h);
        if (!f) return 0;
        return 1 + read_unsafe(t...);
    }

    int close() { return ::close(fd); }

  private:
    static constexpr int SIZE = 1 << 15;

    int fd = -1;
    std::array<char, SIZE + 1> line;
    int st = 0, ed = 0;
    bool eof = false;

    bool read_single(std::string& ref) {
        if (!skip_space()) return false;
        ref = "";
        while (true) {
            char c = top();
            if (c <= ' ') break;
            ref += c;
            st++;
        }
        return true;
    }
    bool read_single(double& ref) {
        std::string s;
        if (!read_single(s)) return false;
        ref = std::stod(s);
        return true;
    }

    template <class T,
              std::enable_if_t<std::is_same<T, char>::value>* = nullptr>
    bool read_single(T& ref) {
        if (!skip_space<50>()) return false;
        ref = top();
        st++;
        return true;
    }

    template <class T,
              internal::is_signed_int_t<T>* = nullptr,
              std::enable_if_t<!std::is_same<T, char>::value>* = nullptr>
    bool read_single(T& sref) {
        using U = internal::to_unsigned_t<T>;
        if (!skip_space<50>()) return false;
        bool neg = false;
        if (line[st] == '-') {
            neg = true;
            st++;
        }
        U ref = 0;
        do {
            ref = 10 * ref + (line[st++] & 0x0f);
        } while (line[st] >= '0');
        sref = neg ? -ref : ref;
        return true;
    }
    template <class U,
              internal::is_unsigned_int_t<U>* = nullptr,
              std::enable_if_t<!std::is_same<U, char>::value>* = nullptr>
    bool read_single(U& ref) {
        if (!skip_space<50>()) return false;
        ref = 0;
        do {
            ref = 10 * ref + (line[st++] & 0x0f);
        } while (line[st] >= '0');
        return true;
    }

    bool reread() {
        if (ed - st >= 50) return true;
        if (st > SIZE / 2) {
            std::memmove(line.data(), line.data() + st, ed - st);
            ed -= st;
            st = 0;
        }
        if (eof) return false;
        auto u = ::read(fd, line.data() + ed, SIZE - ed);
        if (u == 0) {
            eof = true;
            line[ed] = '\0';
            u = 1;
        }
        ed += int(u);
        line[ed] = char(127);
        return true;
    }

    char top() {
        if (st == ed) {
            bool f = reread();
            assert(f);
        }
        return line[st];
    }

    template <int TOKEN_LEN = 0> bool skip_space() {
        while (true) {
            while (line[st] <= ' ') st++;
            if (ed - st > TOKEN_LEN) return true;
            if (st > ed) st = ed;
            for (auto i = st; i < ed; i++) {
                if (line[i] <= ' ') return true;
            }
            if (!reread()) return false;
        }
    }
};

struct Printer {
  public:
    template <char sep = ' ', bool F = false> void write() {}
    template <char sep = ' ', bool F = false, class H, class... T>
    void write(const H& h, const T&... t) {
        if (F) write_single(sep);
        write_single(h);
        write<true>(t...);
    }
    template <char sep = ' ', class... T> void writeln(const T&... t) {
        write<sep>(t...);
        write_single('\n');
    }

    Printer(FILE* _fp) : fd(fileno(_fp)) {}
    ~Printer() { flush(); }

    int close() {
        flush();
        return ::close(fd);
    }

    void flush() {
        if (pos) {
            auto res = ::write(fd, line.data(), pos);
            assert(res != -1);
            pos = 0;
        }
    }

  private:
    static std::array<std::array<char, 2>, 100> small;
    static std::array<unsigned long long, 20> tens;

    static constexpr size_t SIZE = 1 << 15;
    int fd;
    std::array<char, SIZE> line;
    size_t pos = 0;
    std::stringstream ss;

    template <class T,
              std::enable_if_t<std::is_same<char, T>::value>* = nullptr>
    void write_single(const T& val) {
        if (pos == SIZE) flush();
        line[pos++] = val;
    }

    template <class T,
              internal::is_signed_int_t<T>* = nullptr,
              std::enable_if_t<!std::is_same<char, T>::value>* = nullptr>
    void write_single(const T& val) {
        using U = internal::to_unsigned_t<T>;
        if (val == 0) {
            write_single('0');
            return;
        }
        if (pos > SIZE - 50) flush();
        U uval = val;
        if (val < 0) {
            write_single('-');
            uval = -uval;
        }
        write_unsigned(uval);
    }

    template <class U, internal::is_unsigned_int_t<U>* = nullptr>
    void write_single(U uval) {
        if (uval == 0) {
            write_single('0');
            return;
        }
        if (pos > SIZE - 50) flush();

        write_unsigned(uval);
    }

    static int calc_len(uint64_t x) {
        int i = ((63 - std::countl_zero(x)) * 3 + 3) / 10;
        if (x < tens[i])
            return i;
        else
            return i + 1;
    }

    template <class U,
              internal::is_unsigned_int_t<U>* = nullptr,
              std::enable_if_t<2 >= sizeof(U)>* = nullptr>
    void write_unsigned(U uval) {
        size_t len = calc_len(uval);
        pos += len;

        char* ptr = line.data() + pos;
        while (uval >= 100) {
            ptr -= 2;
            memcpy(ptr, small[uval % 100].data(), 2);
            uval /= 100;
        }
        if (uval >= 10) {
            memcpy(ptr - 2, small[uval].data(), 2);
        } else {
            *(ptr - 1) = char('0' + uval);
        }
    }

    template <class U,
              internal::is_unsigned_int_t<U>* = nullptr,
              std::enable_if_t<4 == sizeof(U)>* = nullptr>
    void write_unsigned(U uval) {
        std::array<char, 8> buf;
        memcpy(buf.data() + 6, small[uval % 100].data(), 2);
        memcpy(buf.data() + 4, small[uval / 100 % 100].data(), 2);
        memcpy(buf.data() + 2, small[uval / 10000 % 100].data(), 2);
        memcpy(buf.data() + 0, small[uval / 1000000 % 100].data(), 2);

        if (uval >= 100000000) {
            if (uval >= 1000000000) {
                memcpy(line.data() + pos, small[uval / 100000000 % 100].data(),
                       2);
                pos += 2;
            } else {
                line[pos] = char('0' + uval / 100000000);
                pos++;
            }
            memcpy(line.data() + pos, buf.data(), 8);
            pos += 8;
        } else {
            size_t len = calc_len(uval);
            memcpy(line.data() + pos, buf.data() + (8 - len), len);
            pos += len;
        }
    }

    template <class U,
              internal::is_unsigned_int_t<U>* = nullptr,
              std::enable_if_t<8 == sizeof(U)>* = nullptr>
    void write_unsigned(U uval) {
        size_t len = calc_len(uval);
        pos += len;

        char* ptr = line.data() + pos;
        while (uval >= 100) {
            ptr -= 2;
            memcpy(ptr, small[uval % 100].data(), 2);
            uval /= 100;
        }
        if (uval >= 10) {
            memcpy(ptr - 2, small[uval].data(), 2);
        } else {
            *(ptr - 1) = char('0' + uval);
        }
    }

    template <
        class U,
        std::enable_if_t<internal::is_unsigned_int128<U>::value>* = nullptr>
    void write_unsigned(U uval) {
        static std::array<char, 50> buf;
        size_t len = 0;
        while (uval > 0) {
            buf[len++] = char((uval % 10) + '0');
            uval /= 10;
        }
        std::reverse(buf.begin(), buf.begin() + len);
        memcpy(line.data() + pos, buf.data(), len);
        pos += len;
    }

    void write_single(const std::string& s) {
        for (char c : s) write_single(c);
    }
    void write_single(const char* s) {
        size_t len = strlen(s);
        for (size_t i = 0; i < len; i++) write_single(s[i]);
    }
    template <class T> void write_single(const std::vector<T>& val) {
        auto n = val.size();
        for (size_t i = 0; i < n; i++) {
            if (i) write_single(' ');
            write_single(val[i]);
        }
    }
};

std::array<std::array<char, 2>, 100> Printer::small = [] {
    std::array<std::array<char, 2>, 100> table;
    for (int i = 0; i <= 99; i++) {
        table[i][1] = char('0' + (i % 10));
        table[i][0] = char('0' + (i / 10 % 10));
    }
    return table;
}();
std::array<unsigned long long, 20> Printer::tens = [] {
    std::array<unsigned long long, 20> table;
    for (int i = 0; i < 20; i++) {
        table[i] = 1;
        for (int j = 0; j < i; j++) {
            table[i] *= 10;
        }
    }
    return table;
}();

}  // namespace yosupo
using namespace yosupo;

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <utility>

using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#ifdef LOCAL

ostream& operator<<(ostream& os, __int128_t x) {
    if (x < 0) {
        os << "-";
        x *= -1;
    }
    if (x == 0) {
        return os << "0";
    }
    string s;
    while (x) {
        s += char(x % 10 + '0');
        x /= 10;
    }
    reverse(s.begin(), s.end());
    return os << s;
}
ostream& operator<<(ostream& os, __uint128_t x) {
    if (x == 0) {
        return os << "0";
    }
    string s;
    while (x) {
        s += char(x % 10 + '0');
        x /= 10;
    }
    reverse(s.begin(), s.end());
    return os << s;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p);
template <class T> ostream& operator<<(ostream& os, const V<T>& v);
template <class T> ostream& operator<<(ostream& os, const deque<T>& v);
template <class T, size_t N>
ostream& operator<<(ostream& os, const array<T, N>& a);
template <class T> ostream& operator<<(ostream& os, const set<T>& s);
template <class T, class U>
ostream& operator<<(ostream& os, const map<T, U>& m);

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    return os << "P(" << p.first << ", " << p.second << ")";
}

template <class T> ostream& operator<<(ostream& os, const V<T>& v) {
    os << "[";
    bool f = false;
    for (auto d : v) {
        if (f) os << ", ";
        f = true;
        os << d;
    }
    return os << "]";
}

template <class T> ostream& operator<<(ostream& os, const deque<T>& v) {
    os << "[";
    bool f = false;
    for (auto d : v) {
        if (f) os << ", ";
        f = true;
        os << d;
    }
    return os << "]";
}
template <class T, size_t N>
ostream& operator<<(ostream& os, const array<T, N>& a) {
    os << "[";
    bool f = false;
    for (auto d : a) {
        if (f) os << ", ";
        f = true;
        os << d;
    }
    return os << "]";
}

template <class T> ostream& operator<<(ostream& os, const set<T>& s) {
    os << "{";
    bool f = false;
    for (auto d : s) {
        if (f) os << ", ";
        f = true;
        os << d;
    }
    return os << "}";
}
template <class T> ostream& operator<<(ostream& os, const multiset<T>& s) {
    os << "{";
    bool f = false;
    for (auto d : s) {
        if (f) os << ", ";
        f = true;
        os << d;
    }
    return os << "}";
}

template <class T, class U>
ostream& operator<<(ostream& os, const map<T, U>& s) {
    os << "{";
    bool f = false;
    for (auto p : s) {
        if (f) os << ", ";
        f = true;
        os << p.first << ": " << p.second;
    }
    return os << "}";
}

struct PrettyOS {
    ostream& os;
    bool first;

    template <class T> auto operator<<(T&& x) {
        if (!first) os << ", ";
        first = false;
        os << x;
        return *this;
    }
};
template <class... T> void dbg0(T&&... t) {
    (PrettyOS{cerr, true} << ... << t);
}
#define dbg(...)                                            \
    do {                                                    \
        cerr << __LINE__ << " : " << #__VA_ARGS__ << " = "; \
        dbg0(__VA_ARGS__);                                  \
        cerr << endl;                                       \
    } while (false);
#else
#define dbg(...)
#endif

Scanner sc = Scanner(stdin);
Printer pr = Printer(stdout);

int main() {
    int t;
    sc.read(t);

    for (int i = 0; i < t; i++) {
        int n, k;
        sc.read(n, k);

        set<int> st;
        for (int j = 0; j < k; j++) {
            int x;
            sc.read(x);
            st.insert(x);
        }
        if (st.count(1)) {
            st.erase(1);
        } else {
            st.insert(1);
        }

        pr.writeln(n, ' ', st.size());
        bool fi = true;
        for (int x : st) {
            if (!fi) {
                pr.write(' ');
            }
            fi = false;
            pr.write(x);
        }
        pr.writeln();
    }
    return 0;
}

详细

Test #1:

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

input:

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

output:

3 1
1
2 0

3 2
2 3
3 0

3 2
1 2
3 2
1 3

input:

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

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: 3596kb

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: 1ms
memory: 3568kb

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: 1ms
memory: 3632kb

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
2 3 5 6 7 9
11 7
1 3 5 6 7 8 11
12 6
6 7 9 10 11 12
11 5
2 3 9 10 11
12 8
1 2 3 4 6 7 9 10
9 4
1 3 7 8
12 9
2 3 5 7 8 9 10 11 12
12 6
1 2 6 10 11 12
10 5
1 2 4 8 10
12 6
3 4 7 10 11 12
11 4
1 3 6 7
11 7
1 3 5 7 8 9 10
12 4
4 8 11 12
11 7
1 2 3 5 6 9 10
12 6
1 2 4 7 11 12
12 7
1 3 4 5 6 10 12
10...

input:

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

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: 3588kb

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
3 7 8 9 10 12
12 7
4 5 6 8 10 11 12
11 3
1 7 10
11 8
1 2 3 4 6 7 8 9
12 6
4 5 6 7 8 12
12 4
5 6 7 12
9 6
1 2 4 5 7 9
12 9
2 3 5 6 7 8 9 10 11
9 7
1 3 4 5 6 8 9
11 4
2 3 7 9
10 3
3 4 5
12 5
1 2 5 6 8
9 5
1 2 3 4 9
10 5
2 3 4 5 6
12 8
1 2 5 6 7 8 10 12
8 3
3 7 8
12 9
1 2 3 4 6 7 9 10 12
12 6
1 2 ...

input:

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

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: 3520kb

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
2 3 5 6 7 9
11 7
1 3 5 6 7 8 11
12 6
6 7 9 10 11 12
11 5
2 3 9 10 11
12 8
1 2 3 4 6 7 9 10
9 4
1 3 7 8
12 9
2 3 5 7 8 9 10 11 12
12 6
1 2 6 10 11 12
10 5
1 2 4 8 10
12 6
3 4 7 10 11 12
11 4
1 3 6 7
11 7
1 3 5 7 8 9 10
12 4
4 8 11 12
11 7
1 2 3 5 6 9 10
12 6
1 2 4 7 11 12
12 7
1 3 4 5 6 10 12
10...

input:

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

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: 1ms
memory: 3528kb

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 7
1 4 6 7 8 9 11
11 4
1 5 8 9
12 5
1 2 3 6 7
11 5
1 4 7 10 11
12 7
1 2 3 6 7 9 12
11 6
1 2 5 6 9 11
10 3
1 3 9
12 6
1 3 5 6 10 12
12 8
2 4 6 7 8 9 11 12
8 4
1 2 4 8
8 6
1 2 3 4 5 8
10 7
2 4 5 6 7 8 10
12 6
2 3 4 6 7 11
11 6
4 5 6 7 9 10
12 7
2 3 4 8 9 10 12
12 7
2 5 6 7 8 9 12
11 5
2 4 7 9 11
12 ...

input:

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

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: 0ms
memory: 3592kb

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
4 7 8 9 11
12 6
2 4 8 9 11 12
10 5
1 2 4 8 9
12 5
2 3 6 7 11
8 4
1 4 5 8
11 4
2 5 7 11
12 8
1 2 3 4 6 10 11 12
10 4
4 5 6 10
12 4
1 7 8 9
12 5
1 5 9 10 11
12 8
1 4 5 6 7 8 10 12
12 7
1 3 5 7 8 9 12
12 5
3 4 7 8 11
12 6
2 3 7 8 10 12
12 8
1 2 4 5 6 7 9 10
10 5
3 4 5 6 9
11 7
1 3 5 6 7 9 11
12 6
...

input:

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

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: 3512kb

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 7
1 2 5 8 9 11 12
12 8
1 2 3 4 6 9 10 11
10 7
1 3 5 6 8 9 10
12 5
2 4 8 10 12
8 2
2 5
12 8
1 2 5 7 8 10 11 12
11 5
2 3 4 7 8
12 7
4 5 6 7 9 11 12
12 5
2 3 6 8 12
12 6
1 4 5 6 9 10
12 10
1 3 4 6 7 8 9 10 11 12
10 7
1 3 5 7 8 9 10
12 6
2 4 5 7 8 9
10 3
4 6 9
11 9
1 2 3 4 5 6 7 9 10
6 4
1 3 5 6
11 5...

input:

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

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: 1ms
memory: 3532kb

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
2 4 7
12 9
1 2 3 4 5 6 8 10 11
11 7
2 4 6 7 8 9 11
11 6
1 2 3 5 7 9
12 4
1 4 7 8
11 5
1 6 8 10 11
12 6
3 6 7 8 9 12
11 7
1 4 5 6 8 9 11
8 1
4
10 3
3 4 10
12 6
2 3 5 8 11 12
12 6
1 2 3 5 8 9
10 4
2 4 5 7
12 5
1 3 8 9 10
12 7
1 4 5 6 8 9 12
8 3
4 5 6
12 4
1 5 6 11
6 3
3 5 6
12 7
3 4 5 6 7 8 10
12 ...

input:

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

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: 3512kb

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 4
2 3 4 5
12 4
5 6 10 12
12 6
2 7 8 9 11 12
12 6
1 6 7 8 9 10
12 7
1 2 3 4 5 9 12
11 3
3 6 10
10 2
5 6
12 6
1 2 3 4 9 11
12 4
3 7 10 12
12 7
2 3 4 6 7 9 10
10 3
2 8 9
12 6
2 5 7 8 9 10
11 4
8 9 10 11
11 6
1 3 4 7 8 10
12 8
1 3 5 6 7 10 11 12
9 4
1 3 4 6
12 5
1 4 5 8 9
12 7
3 4 6 8 9 11 12
12 4
2 ...

input:

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

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: 1ms
memory: 3600kb

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 7
1 3 5 6 10 11 12
8 4
3 5 7 8
12 4
1 5 8 11
12 5
5 8 10 11 12
12 9
3 5 6 7 8 9 10 11 12
12 4
6 8 10 11
12 10
1 3 4 5 6 7 9 10 11 12
12 5
3 4 8 10 11
8 2
1 6
12 8
1 2 3 5 8 10 11 12
11 5
1 4 8 9 10
10 5
3 4 5 8 10
12 4
1 3 11 12
12 6
1 2 5 6 7 10
11 5
3 5 6 9 11
8 4
1 3 7 8
9 4
1 2 4 5
8 6
1 3 5 ...

input:

1000
12 7
1 3 5 6 10 11 12
8 4
3 5 7 8
12 4
1 5 8 11
12 5
5 8 10 11 12
12 9
3 5 6 7 8 9 10 11 12
12 4
6 8 10 11
12 10
1 3 4 5 6 7 9 10 11 12
12 5
3 4 8 10 11
8 2
1 6
12 8
1 2 3 5 8 10 11 12
11 5
1 4 8 9 10
10 5
3 4 5 8 10
12 4
1 3 11 12
12 6
1 2 5 6 7 10
11 5
3 5 6 9 11
8 4
1 3 7 8
9 4
1 2 4 5
8 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: 3512kb

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 2 3 4 10 11
6 1
6
12 8
1 2 3 4 7 8 10 12
11 6
1 2 4 6 8 9
6 3
3 4 6
10 6
1 4 6 7 8 10
11 4
1 6 7 9
12 5
1 3 6 9 11
11 6
3 4 5 6 10 11
12 8
1 2 3 5 9 10 11 12
10 6
2 3 4 5 8 10
11 3
1 2 3
11 5
1 5 6 8 10
10 3
1 6 7
11 6
1 2 6 8 10 11
10 5
1 2 3 7 9
12 4
5 7 9 11
12 5
1 3 5 6 7
12 8
1 2 3 5 7 8...

input:

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

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: 3472kb

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
1 2 3 5 6 12
8 5
1 3 4 6 7
11 5
3 4 9 10 11
10 4
1 6 9 10
12 3
7 8 10
7 4
1 5 6 7
12 3
2 6 9
9 2
3 5
12 7
1 2 5 8 9 10 12
9 4
2 4 6 7
12 5
1 3 7 9 12
11 6
3 4 6 7 10 11
10 6
2 3 4 7 9 10
12 4
1 5 7 12
11 8
1 3 5 6 7 8 9 10
10 4
1 3 4 6
11 4
2 8 10 11
11 7
5 6 7 8 9 10 11
12 8
2 3 6 7 8 9 11 12
...

input:

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

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: 1ms
memory: 3516kb

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 5
1 5 6 8 9
12 5
5 6 7 9 10
12 11
2 3 4 5 6 7 8 9 10 11 12
12 11
2 3 4 5 6 7 8 9 10 11 12
12 8
2 4 5 6 8 9 10 11
12 8
1 2 6 7 8 9 10 11
12 10
2 3 5 6 7 8 9 10 11 12
12 0

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

input:

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

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: 3520kb

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 10
1 2 3 4 5 7 10 12 13 14
15 3
7 8 11
15 6
1 5 6 7 11 15
15 1
1
15 10
4 6 7 8 9 10 12 13 14 15
15 5
1 4 5 13 14
15 11
2 3 4 6 7 9 11 12 13 14 15
15 11
2 3 4 5 8 9 10 11 12 13 15
15 2
1 13
15 12
3 4 5 6 7 8 9 10 12 13 14 15
15 8
1 2 4 8 9 10 12 14
15 5
9 11 12 13 15
15 2
1 11
15 3
6 11 14
15 3
1 ...

input:

1000
15 10
1 2 3 4 5 7 10 12 13 14
15 3
7 8 11
15 6
1 5 6 7 11 15
15 1
1
15 10
4 6 7 8 9 10 12 13 14 15
15 5
1 4 5 13 14
15 11
2 3 4 6 7 9 11 12 13 14 15
15 11
2 3 4 5 8 9 10 11 12 13 15
15 2
1 13
15 12
3 4 5 6 7 8 9 10 12 13 14 15
15 8
1 2 4 8 9 10 12 14
15 5
9 11 12 13 15
15 2
1 11
15 3
6 11 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: 1ms
memory: 3556kb

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 16
1 2 3 4 6 7 8 9 10 11 13 14 15 18 19 20
20 12
2 4 8 9 10 11 12 13 14 15 17 19
20 10
2 3 5 7 9 10 11 14 16 18
20 3
1 9 15
20 4
1 10 13 17
20 13
2 3 4 6 10 12 13 14 15 16 17 19 20
20 12
3 4 6 7 8 9 10 13 15 16 19 20
20 13
3 4 5 6 7 9 10 13 15 16 17 19 20
20 5
1 2 11 14 16
20 3
1 6 9
20 10
1 3 4 ...

input:

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

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: 1ms
memory: 3656kb

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 2
1 22
30 11
4 6 7 11 13 19 20 22 25 26 29
30 12
1 2 11 12 15 17 19 22 24 26 28 30
30 1
1
30 3
1 7 25
30 25
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 25
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 26
2 3 4 6 7 8 9 11 12 13 14 15 16 17 18 1...

input:

1000
30 2
1 22
30 11
4 6 7 11 13 19 20 22 25 26 29
30 12
1 2 11 12 15 17 19 22 24 26 28 30
30 1
1
30 3
1 7 25
30 25
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 25
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 26
2 3 4 6 7 8 9 11 12 13 14 15 16 17...

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: 2ms
memory: 3592kb

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 5
1 3 18 23 36
40 27
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 35
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 19
1 2 4 5 10 13 15 16 21 23 24 26 27 29 32 34 37 38 39
40 32
2 3 4 5 6 8 9 10 12 13 16 17 19 ...

input:

1000
40 5
1 3 18 23 36
40 27
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 35
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 19
1 2 4 5 10 13 15 16 21 23 24 26 27 29 32 34 37 38 39
40 32
2 3 4 5 6 8 9 10 12 13 16 1...

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: 2ms
memory: 3536kb

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 40
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 25
1 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 31
1 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 6
1 4 8 ...

input:

1000
49 40
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 25
1 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 31
1 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 6
1...

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: 2ms
memory: 3524kb

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 31
1 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 17
1 3 4 8 9 11 17 20 22 26 33 35 38 39 45 47 48
50 2
1 36
50 40
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 27
1 2 8 10 11 14 17 1...

input:

1000
50 31
1 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 17
1 3 4 8 9 11 17 20 22 26 33 35 38 39 45 47 48
50 2
1 36
50 40
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 27
1 2 8 10 11 14...

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: 1ms
memory: 3556kb

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 7
2 5 7 8 10 11 12
27 23
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25 26 27
13 7
2 3 4 5 8 10 12
18 13
1 2 3 4 5 6 9 10 12 13 14 15 16
26 8
2 3 8 10 15 21 24 26
20 4
1 6 8 15
39 15
1 2 4 5 11 13 16 19 22 23 25 26 30 31 34
46 42
2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24...

input:

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

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: 2ms
memory: 3600kb

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 32
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 36
1 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 5
1 7 36 42 45
49 1
1
44 32
2 3 5 6 8 9 11 12 13 14 15 16 17 18 19 20 21 22 26 27 31 32 33 34 3...

input:

1000
50 32
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 36
1 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 5
1 7 36 42 45
49 1
1
44 32
2 3 5 6 8 9 11 12 13 14 15 16 17 18 19 20 21 22 26 27 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: 2ms
memory: 3556kb

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

input:

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

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: 2ms
memory: 3660kb

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 38
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 27
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 29
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 16
1 5 6 10 1...

input:

1000
41 38
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 27
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 29
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 16
1 5 6...

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: 2ms
memory: 3544kb

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 32
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 29
1 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 13
6 7 9 10 20 21 23 24 26 29 30 36 40
41 20
4 8 9 10 11 12 14 17 19 20 21 22 28 29 30 32 37 38 40 41
50 30
2 4 5 ...

input:

1000
50 32
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 29
1 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 13
6 7 9 10 20 21 23 24 26 29 30 36 40
41 20
4 8 9 10 11 12 14 17 19 20 21 22 28 29 30 32 37 38 40 41
50 30
2...

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: 2ms
memory: 3560kb

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 39
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 15
4 6 9 13 18 19 24 25 28 31 32 33 35 44 45
46 12
1 2 3 5 8 12 17 25 26 32 41 43
43 16
1 3 4 7 8 9 12 14 16 18 21 23 24 26 31 41
44 11
1 9 11 17 18 20 26 30 32 33 44
43 20
1 2 3 5...

input:

1000
50 39
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 15
4 6 9 13 18 19 24 25 28 31 32 33 35 44 45
46 12
1 2 3 5 8 12 17 25 26 32 41 43
43 16
1 3 4 7 8 9 12 14 16 18 21 23 24 26 31 41
44 11
1 9 11 17 18 20 26 30 32 33 44
43 20
1 ...

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: 1ms
memory: 3524kb

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 2
1 22
50 3
1 11 29
49 5
1 16 26 34 45
49 5
1 5 12 30 32
49 1
1
50 6
1 3 9 16 25 32
50 3
1 7 50
49 1
1
49 2
3 48
50 5
1 7 15 31 40
50 5
3 16 31 34 36
49 1
1
50 3
1 24 32
49 4
1 3 12 25
50 1
1
49 6
1 6 16 17 24 32
50 6
1 2 5 23 42 49
50 1
1
49 1
1
49 4
1 14 31 45
49 2
1 32
49 1
1
50 5
1 3 5 6 16
5...

input:

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

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: 1ms
memory: 3516kb

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

input:

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

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: 1ms
memory: 3448kb

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

input:

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

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: 1ms
memory: 3488kb

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

input:

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

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: 1ms
memory: 3620kb

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 7
1 18 25 28 29 33 49
50 4
1 12 40 44
49 1
1
49 5
7 14 22 27 43
49 4
1 22 23 40
49 3
1 22 29
50 1
1
49 7
1 8 9 30 39 44 46
49 6
1 2 7 21 24 42
50 4
1 4 37 42
49 1
1
49 1
1
49 7
1 6 11 17 28 37 42
49 7
1 2 4 5 7 16 37
49 7
1 5 12 17 25 37 47
50 3
1 12 22
50 6
1 10 24 36 39 40
49 1
1
50 1
1
49 3
26...

input:

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

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: 3596kb

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 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 37 38 39 40 41 42 43 44 45 46 47 48 49
49 45
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 49
2 3 4 5 6 7 8 9 10 11 ...

input:

1000
49 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 37 38 39 40 41 42 43 44 45 46 47 48 49
49 45
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 49
2 3 4 5 6 7 8 9 1...

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: 3556kb

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 46
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 47
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 48
2 3 4 5 6 7 8 9 10 ...

input:

1000
50 46
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 47
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 48
2 3 4 5 6 7 8 ...

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: 4ms
memory: 3624kb

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 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 36 37 38 39 40 41 43 44 45 46 47 48 49 50
49 45
1 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 43
2 3 4 5 7 8 10 11 12...

input:

1000
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 36 37 38 39 40 41 43 44 45 46 47 48 49 50
49 45
1 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 43
2 3 4 5 7 8 10 ...

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: 3544kb

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 44
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 45
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 45
2 3 4 5 6 7 8 9 10 11 13 14 15...

input:

1000
49 44
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 45
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 45
2 3 4 5 6 7 8 9 10 11 13 ...

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: 2ms
memory: 3548kb

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 48
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 45
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 49
1 2 3 4 5 6 7 8 9 1...

input:

1000
50 48
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 45
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 49
1 2 3 4 5 6 7 ...

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: 2ms
memory: 3596kb

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 46
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 45
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 47
2 3 4 5 6 7 8 9 10 11 12 ...

input:

1000
49 46
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 45
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 47
2 3 4 5 6 7 8 9 10 1...

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: 3624kb

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 45
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 47
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 43
2 3 5 6 7 8 9 10 11 13...

input:

1000
49 45
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 47
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 43
2 3 5 6 7 8 9 10 ...

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: 2ms
memory: 3600kb

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 44
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 48
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 45
2 4 5 6 7 9 10 11 12...

input:

1000
50 44
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 48
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 45
2 4 5 6 7 9 10 ...

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: 3604kb

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 47
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 45
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 49
2 3 4 5 6 7 8 9 10 11...

input:

1000
49 47
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 45
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 49
2 3 4 5 6 7 8 9 ...

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: 2ms
memory: 3552kb

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 47
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 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 36 37 38 39 40 41 42 43 44 45 46 48 49 50
49 46
1 2 3 4 5 6 ...

input:

1000
50 47
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 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 36 37 38 39 40 41 42 43 44 45 46 48 49 50
49 46
1 2 3 4...

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