QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#611441#4825. Even and Odd CombinationsmaspyAC ✓1ms4152kbC++2013.5kb2024-10-04 21:02:322024-10-04 21:02:35

Judging History

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

  • [2024-10-04 21:02:35]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:4152kb
  • [2024-10-04 21:02:32]
  • 提交

answer

#line 1 "library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else

// https://codeforces.com/blog/entry/96344
#pragma GCC optimize("Ofast,unroll-loops")
// いまの CF だとこれ入れると動かない?
// #pragma GCC target("avx2,popcnt")

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i128 = __int128;
using u128 = unsigned __int128;
using f128 = __float128;

template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'010'000'000;
template <>
constexpr ll infty<ll> = 2'020'000'000'000'000'000;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * 2'000'000'000'000'000'000;
template <>
constexpr double infty<double> = infty<ll>;
template <>
constexpr long double infty<long double> = infty<ll>;

using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vc<T>>;
template <class T>
using vvvc = vector<vvc<T>>;
template <class T>
using vvvvc = vector<vvvc<T>>;
template <class T>
using vvvvvc = vector<vvvvc<T>>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;

#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...) \
  vector<vector<vector<vector<type>>>> name(a, vector<vector<vector<type>>>(b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))

// https://trap.jp/post/1224/
#define FOR1(a) for (ll _ = 0; _ < ll(a); ++_)
#define FOR2(i, a) for (ll i = 0; i < ll(a); ++i)
#define FOR3(i, a, b) for (ll i = a; i < ll(b); ++i)
#define FOR4(i, a, b, c) for (ll i = a; i < ll(b); i += (c))
#define FOR1_R(a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR2_R(i, a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR3_R(i, a, b) for (ll i = (b)-1; i >= ll(a); --i)
#define overload4(a, b, c, d, e, ...) e
#define overload3(a, b, c, d, ...) d
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FOR_R(...) overload3(__VA_ARGS__, FOR3_R, FOR2_R, FOR1_R)(__VA_ARGS__)

#define FOR_subset(t, s) for (ll t = (s); t >= 0; t = (t == 0 ? -1 : (t - 1) & (s)))
#define all(x) x.begin(), x.end()
#define len(x) ll(x.size())
#define elif else if

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second

#define stoi stoll

int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(u32 x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int popcnt(u64 x) { return __builtin_popcountll(x); }
int popcnt_mod_2(int x) { return __builtin_parity(x); }
int popcnt_mod_2(u32 x) { return __builtin_parity(x); }
int popcnt_mod_2(ll x) { return __builtin_parityll(x); }
int popcnt_mod_2(u64 x) { return __builtin_parityll(x); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }

template <typename T>
T floor(T a, T b) {
  return a / b - (a % b && (a ^ b) < 0);
}
template <typename T>
T ceil(T x, T y) {
  return floor(x + y - 1, y);
}
template <typename T>
T bmod(T x, T y) {
  return x - y * floor(x, y);
}
template <typename T>
pair<T, T> divmod(T x, T y) {
  T q = floor(x, y);
  return {q, x - q * y};
}

template <typename T, typename U>
T SUM(const vector<U> &A) {
  T sm = 0;
  for (auto &&a: A) sm += a;
  return sm;
}

#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()

template <typename T>
T POP(deque<T> &que) {
  T a = que.front();
  que.pop_front();
  return a;
}
template <typename T>
T POP(pq<T> &que) {
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(pqg<T> &que) {
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(vc<T> &que) {
  T a = que.back();
  que.pop_back();
  return a;
}

template <typename F>
ll binary_search(F check, ll ok, ll ng, bool check_ok = true) {
  if (check_ok) assert(check(ok));
  while (abs(ok - ng) > 1) {
    auto x = (ng + ok) / 2;
    (check(x) ? ok : ng) = x;
  }
  return ok;
}
template <typename F>
double binary_search_real(F check, double ok, double ng, int iter = 100) {
  FOR(iter) {
    double x = (ok + ng) / 2;
    (check(x) ? ok : ng) = x;
  }
  return (ok + ng) / 2;
}

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);
}

// ? は -1
vc<int> s_to_vi(const string &S, char first_char) {
  vc<int> A(S.size());
  FOR(i, S.size()) { A[i] = (S[i] != '?' ? S[i] - first_char : -1); }
  return A;
}

template <typename T, typename U>
vector<T> cumsum(vector<U> &A, int off = 1) {
  int N = A.size();
  vector<T> B(N + 1);
  FOR(i, N) { B[i + 1] = B[i] + A[i]; }
  if (off == 0) B.erase(B.begin());
  return B;
}

// stable sort
template <typename T>
vector<int> argsort(const vector<T> &A) {
  vector<int> ids(len(A));
  iota(all(ids), 0);
  sort(all(ids), [&](int i, int j) { return (A[i] == A[j] ? i < j : A[i] < A[j]); });
  return ids;
}

// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vc<int> &I) {
  vc<T> B(len(I));
  FOR(i, len(I)) B[i] = A[I[i]];
  return B;
}

template <typename T, typename... Vectors>
void concat(vc<T> &first, const Vectors &... others) {
  vc<T> &res = first;
  (res.insert(res.end(), others.begin(), others.end()), ...);
}
#endif
#line 1 "library/other/io.hpp"
#define FASTIO
#include <unistd.h>

// https://judge.yosupo.jp/submission/21623
namespace fastio {
static constexpr uint32_t SZ = 1 << 17;
char ibuf[SZ];
char obuf[SZ];
char out[100];
// pointer of ibuf, obuf
uint32_t pil = 0, pir = 0, por = 0;

struct Pre {
  char num[10000][4];
  constexpr Pre() : num() {
    for (int i = 0; i < 10000; i++) {
      int n = i;
      for (int j = 3; j >= 0; j--) {
        num[i][j] = n % 10 | '0';
        n /= 10;
      }
    }
  }
} constexpr pre;

inline void load() {
  memcpy(ibuf, ibuf + pil, pir - pil);
  pir = pir - pil + fread(ibuf + pir - pil, 1, SZ - pir + pil, stdin);
  pil = 0;
  if (pir < SZ) ibuf[pir++] = '\n';
}

inline void flush() {
  fwrite(obuf, 1, por, stdout);
  por = 0;
}

void rd(char &c) {
  do {
    if (pil + 1 > pir) load();
    c = ibuf[pil++];
  } while (isspace(c));
}

void rd(string &x) {
  x.clear();
  char c;
  do {
    if (pil + 1 > pir) load();
    c = ibuf[pil++];
  } while (isspace(c));
  do {
    x += c;
    if (pil == pir) load();
    c = ibuf[pil++];
  } while (!isspace(c));
}

template <typename T>
void rd_real(T &x) {
  string s;
  rd(s);
  x = stod(s);
}

template <typename T>
void rd_integer(T &x) {
  if (pil + 100 > pir) load();
  char c;
  do
    c = ibuf[pil++];
  while (c < '-');
  bool minus = 0;
  if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
    if (c == '-') { minus = 1, c = ibuf[pil++]; }
  }
  x = 0;
  while ('0' <= c) { x = x * 10 + (c & 15), c = ibuf[pil++]; }
  if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
    if (minus) x = -x;
  }
}

void rd(int &x) { rd_integer(x); }
void rd(ll &x) { rd_integer(x); }
void rd(i128 &x) { rd_integer(x); }
void rd(u32 &x) { rd_integer(x); }
void rd(u64 &x) { rd_integer(x); }
void rd(u128 &x) { rd_integer(x); }
void rd(double &x) { rd_real(x); }
void rd(long double &x) { rd_real(x); }
void rd(f128 &x) { rd_real(x); }

template <class T, class U>
void rd(pair<T, U> &p) {
  return rd(p.first), rd(p.second);
}
template <size_t N = 0, typename T>
void rd_tuple(T &t) {
  if constexpr (N < std::tuple_size<T>::value) {
    auto &x = std::get<N>(t);
    rd(x);
    rd_tuple<N + 1>(t);
  }
}
template <class... T>
void rd(tuple<T...> &tpl) {
  rd_tuple(tpl);
}

template <size_t N = 0, typename T>
void rd(array<T, N> &x) {
  for (auto &d: x) rd(d);
}
template <class T>
void rd(vc<T> &x) {
  for (auto &d: x) rd(d);
}

void read() {}
template <class H, class... T>
void read(H &h, T &... t) {
  rd(h), read(t...);
}

void wt(const char c) {
  if (por == SZ) flush();
  obuf[por++] = c;
}
void wt(const string s) {
  for (char c: s) wt(c);
}
void wt(const char *s) {
  size_t len = strlen(s);
  for (size_t i = 0; i < len; i++) wt(s[i]);
}

template <typename T>
void wt_integer(T x) {
  if (por > SZ - 100) flush();
  if (x < 0) { obuf[por++] = '-', x = -x; }
  int outi;
  for (outi = 96; x >= 10000; outi -= 4) {
    memcpy(out + outi, pre.num[x % 10000], 4);
    x /= 10000;
  }
  if (x >= 1000) {
    memcpy(obuf + por, pre.num[x], 4);
    por += 4;
  } else if (x >= 100) {
    memcpy(obuf + por, pre.num[x] + 1, 3);
    por += 3;
  } else if (x >= 10) {
    int q = (x * 103) >> 10;
    obuf[por] = q | '0';
    obuf[por + 1] = (x - q * 10) | '0';
    por += 2;
  } else
    obuf[por++] = x | '0';
  memcpy(obuf + por, out + outi + 4, 96 - outi);
  por += 96 - outi;
}

template <typename T>
void wt_real(T x) {
  ostringstream oss;
  oss << fixed << setprecision(15) << double(x);
  string s = oss.str();
  wt(s);
}

void wt(int x) { wt_integer(x); }
void wt(ll x) { wt_integer(x); }
void wt(i128 x) { wt_integer(x); }
void wt(u32 x) { wt_integer(x); }
void wt(u64 x) { wt_integer(x); }
void wt(u128 x) { wt_integer(x); }
void wt(double x) { wt_real(x); }
void wt(long double x) { wt_real(x); }
void wt(f128 x) { wt_real(x); }

template <class T, class U>
void wt(const pair<T, U> val) {
  wt(val.first);
  wt(' ');
  wt(val.second);
}
template <size_t N = 0, typename T>
void wt_tuple(const T t) {
  if constexpr (N < std::tuple_size<T>::value) {
    if constexpr (N > 0) { wt(' '); }
    const auto x = std::get<N>(t);
    wt(x);
    wt_tuple<N + 1>(t);
  }
}
template <class... T>
void wt(tuple<T...> tpl) {
  wt_tuple(tpl);
}
template <class T, size_t S>
void wt(const array<T, S> val) {
  auto n = val.size();
  for (size_t i = 0; i < n; i++) {
    if (i) wt(' ');
    wt(val[i]);
  }
}
template <class T>
void wt(const vector<T> val) {
  auto n = val.size();
  for (size_t i = 0; i < n; i++) {
    if (i) wt(' ');
    wt(val[i]);
  }
}

void print() { wt('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
  wt(head);
  if (sizeof...(Tail)) wt(' ');
  print(forward<Tail>(tail)...);
}

// gcc expansion. called automaticall after main.
void __attribute__((destructor)) _d() { flush(); }
} // namespace fastio
using fastio::read;
using fastio::print;
using fastio::flush;

#if defined(LOCAL)
#define SHOW(...) SHOW_IMPL(__VA_ARGS__, SHOW6, SHOW5, SHOW4, SHOW3, SHOW2, SHOW1)(__VA_ARGS__)
#define SHOW_IMPL(_1, _2, _3, _4, _5, _6, NAME, ...) NAME
#define SHOW1(x) print(#x, "=", (x)), flush()
#define SHOW2(x, y) print(#x, "=", (x), #y, "=", (y)), flush()
#define SHOW3(x, y, z) print(#x, "=", (x), #y, "=", (y), #z, "=", (z)), flush()
#define SHOW4(x, y, z, w) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w)), flush()
#define SHOW5(x, y, z, w, v) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w), #v, "=", (v)), flush()
#define SHOW6(x, y, z, w, v, u) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w), #v, "=", (v), #u, "=", (u)), flush()
#else
#define SHOW(...)
#endif

#define INT(...)   \
  int __VA_ARGS__; \
  read(__VA_ARGS__)
#define LL(...)   \
  ll __VA_ARGS__; \
  read(__VA_ARGS__)
#define U32(...)   \
  u32 __VA_ARGS__; \
  read(__VA_ARGS__)
#define U64(...)   \
  u64 __VA_ARGS__; \
  read(__VA_ARGS__)
#define STR(...)      \
  string __VA_ARGS__; \
  read(__VA_ARGS__)
#define CHAR(...)   \
  char __VA_ARGS__; \
  read(__VA_ARGS__)
#define DBL(...)      \
  double __VA_ARGS__; \
  read(__VA_ARGS__)

#define VEC(type, name, size) \
  vector<type> name(size);    \
  read(name)
#define VV(type, name, h, w)                     \
  vector<vector<type>> name(h, vector<type>(w)); \
  read(name)

void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
#line 3 "main.cpp"

void solve() {
  LL(N, K);
  VEC(int, A, K);
  if (len(A) && A.back() == N) {
    POP(A);
  } else {
    A.eb(N);
  }
  print(N, len(A));
  print(A);
}

signed main() {
  INT(T);
  FOR(T) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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


input:

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

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

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

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

input:

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

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

input:

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

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

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

input:

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

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

input:

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

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

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

input:

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

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

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

input:

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

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

input:

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

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

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

input:

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

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

input:

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

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

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

input:

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

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

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

input:

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

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

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

input:

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

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

input:

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

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

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

input:

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

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

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

input:

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

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

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

input:

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

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

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
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 25
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
49 29
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 6
4 8 20 23 3...

input:

1000
49 40
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 25
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
49 29
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 6
4 8 20...

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

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

input:

1000
50 31
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
50 17
3 4 8 9 11 17 20 22 26 33 35 38 39 45 47 48 50
50 2
36 50
50 40
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 25
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: 3688kb

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

input:

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

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

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

input:

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

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

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

input:

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

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

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
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
49 27
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
45 31
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 45
46 14
5 6 10 ...

input:

1000
41 38
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
49 27
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
45 31
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 45
46 14
5 ...

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

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

input:

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

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

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

input:

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

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

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

input:

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

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

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

input:

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

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

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

input:

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

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

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

input:

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

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

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

input:

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

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

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

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 37 38 39 40 41 42 43 44 45 46 47 48
49 45
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
50 49
1 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: 1ms
memory: 4108kb

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

input:

1000
50 46
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 47
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
49 48
1 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: 1ms
memory: 3860kb

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
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
49 43
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 43
1 2 3 4 5 7 8 10 11 12 13 ...

input:

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

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

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

input:

1000
49 44
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 45
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
50 45
1 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: 1ms
memory: 4112kb

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

input:

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

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

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

input:

1000
49 46
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 45
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 47
1 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: 1ms
memory: 3860kb

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

input:

1000
49 45
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 47
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
50 43
1 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: 1ms
memory: 4152kb

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
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 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 41 42 43 44 45 46 47 48 49
49 45
1 2 4 5 6 7 9 10 11 12...

input:

1000
50 44
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 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 41 42 43 44 45 46 47 48 49
49 45
1 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: 1ms
memory: 3936kb

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

input:

1000
49 47
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 45
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
50 49
1 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: 1ms
memory: 3936kb

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

input:

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

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