QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#629129#4219. Insectsnhuang685TL 4786ms154412kbC++2310.5kb2024-10-11 05:32:242024-10-11 05:32:26

Judging History

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

  • [2024-10-11 05:32:26]
  • 评测
  • 测评结果:TL
  • 用时:4786ms
  • 内存:154412kb
  • [2024-10-11 05:32:24]
  • 提交

answer

/**
 * @author n685
 * @brief
 * @date 2024-10-09 17:44:17
 *
 *
 */
#include "bits/stdc++.h"

#ifdef LOCAL
#include "dd/debug.h"
#else
#define dbg(...) 42
#define dbg_proj(...) 420
#define dbg_rproj(...) 420420
void nline() {}
void bar() {}
void start_clock() {}
void end_clock() {}
#endif

namespace rs = std::ranges;
namespace rv = std::views;

template <class T> constexpr T INF = T{};
template <std::floating_point T>
constexpr T INF<T> = std::numeric_limits<T>::infinity();
template <> constexpr int INF<int> = 0x3f3f3f3f; // 1061109567
template <>
constexpr int64_t INF<int64_t> = 0x3f3f3f3f3f3f3f3f; // 4557430888798830399

template <class T> struct CC {
  std::vector<T> val;
  void insert(T a) { val.push_back(a); }
  void init() {
    std::sort(val.begin(), val.end());
    val.erase(std::unique(val.begin(), val.end()), val.end());
  }
  int operator[](T a) const {
    return static_cast<int>(
      std::distance(val.begin(), std::lower_bound(val.begin(), val.end(), a))
    );
  }
  int size() const { return static_cast<int>(val.size()); }
};

template <class Node>
concept PSegNode = requires(Node n, Node& node, int k) {
  requires std::same_as<std::decay_t<decltype(n.ch)>, std::array<int, 2>>;
  typename Node::Index;
  typename Node::Output;
  requires std::integral<typename Node::Index>;
  Node();
  requires std::
    same_as<std::decay_t<decltype(Node::ID)>, typename Node::Output>;
  {
    std::as_const(n).value()
  } -> std::same_as<typename Node::Output>;
  {
    Node::comb(Node::ID, Node::ID)
  } -> std::same_as<typename Node::Output>;
  Node();
  {
    n.reset_value()
  } -> std::same_as<void>;
  {
    n.pull(n)
  } -> std::same_as<void>;
  {
    n.need_push()
  } -> std::same_as<bool>;
  {
    n.push(node, node, k)
  } -> std::same_as<void>;
};
template <PSegNode Node> struct PSeg {
  using Index = Node::Index;
  using Output = Node::Output;
  std::vector<Node> data;
  int new_node() {
    data.emplace_back();
    return static_cast<int>(data.size()) - 1;
  }
  int copy_node(Node n) {
    data.push_back(std::move(n));
    return static_cast<int>(data.size()) - 1;
  }
  void copy_ch(int par, int ch) {
    int ind
      = data[par].ch[ch] == -1 ? new_node() : copy_node(data[data[par].ch[ch]]);
    data[par].ch[ch] = ind;
  }

  Index sz{};
  std::vector<int> rts;
  void new_rt(int rt) { rts[rt] = new_node(); }
  int new_rt() {
    rts.push_back(new_node());
    return static_cast<int>(rts.size()) - 1;
  }
  void copy_rt(int rt, int dest) { rts[dest] = copy_node(data[rts[rt]]); }
  int copy_rt(int rt) {
    rts.push_back(copy_node(data[rts[rt]]));
    return static_cast<int>(rts.size()) - 1;
  }
  int copy_rt() { return copy_rt(static_cast<int>(rts.size()) - 1); }

  PSeg() = default;
  explicit PSeg(Index sz_, int nrts = 0)
      : sz(static_cast<Index>(std::bit_ceil<std::make_unsigned_t<Index>>(sz_))),
        rts(nrts, -1) {}

  void pull(int node) {
    data[node].reset_value();
    if (data[node].ch[0] != -1) {
      data[node].pull(data[data[node].ch[0]]);
    }
    if (data[node].ch[1] != -1) {
      data[node].pull(data[data[node].ch[1]]);
    }
  }
  void push(int node, Index k) {
    data[node].push(data[data[node].ch[0]], data[data[node].ch[1]], k);
  }

  template <class F, class... Args>
    requires std::invocable<F, Node&, const Args&..., Index>
  void upd_i(
    const F& f,
    Index l,
    Index r,
    int node,
    Index ll,
    Index rr,
    const Args&... args
  ) {
    if (l <= ll && rr <= r) {
      std::invoke(f, data[node], args..., rr - ll + 1);
      return;
    }
    Index mid = (ll + rr) / 2;
    bool np = data[node].need_push();
    if (np || l <= mid) {
      copy_ch(node, 0);
    }
    if (np || r > mid) {
      copy_ch(node, 1);
    }
    if (np) {
      push(node, rr - ll + 1);
    }
    if (l <= mid) {
      upd_i(f, l, r, data[node].ch[0], ll, mid, args...);
    }
    if (r > mid) {
      upd_i(f, l, r, data[node].ch[1], mid + 1, rr, args...);
    }
    pull(node);
  }
  template <class F, class... Args>
  void upd(const F& f, int rt, Index l, Index r, const Args&... args) {
    upd_i(f, l, r, rts[rt], 0, sz - 1, args...);
  }
  template <class F, class... Args>
  void upd_r(const F& f, Index l, Index r, const Args&... args) {
    upd_i(f, l, r, rts.back(), 0, sz - 1, args...);
  }
  Output query_i(Index l, Index r, int node, Index ll, Index rr) {
    if (l <= ll && rr <= r) {
      return data[node].value();
    }
    Index mid = (ll + rr) / 2;
    if (data[node].need_push()) {
      copy_ch(node, 0);
      copy_ch(node, 1);
      push(node, rr - ll + 1);
    }
    Output ans = Node::ID;
    if (l <= mid && data[node].ch[0] != -1) {
      ans = Node::comb(ans, query_i(l, r, data[node].ch[0], ll, mid));
    }
    if (r > mid && data[node].ch[1] != -1) {
      ans = Node::comb(ans, query_i(l, r, data[node].ch[1], mid + 1, rr));
    }
    return ans;
  }
  Output query(int rt, Index l, Index r) {
    return query_i(l, r, rts[rt], 0, sz - 1);
  }
  Output query_r(Index l, Index r) {
    return query_i(l, r, rts.back(), 0, sz - 1);
  }

  Index last_true_i(
    const std::function<bool(Output)>& f,
    int node,
    Index l,
    Index r,
    bool id
  ) {
    if (l == r) {
      if (f(data[node].value())) {
        return l;
      }
      return -1;
    }
    const Index mid = (l + r) / 2;
    if (data[node].need_push()) {
      copy_ch(node, 0);
      copy_ch(node, 1);
      push(node, r - l + 1);
    }
    if (data[node].ch[1] == -1) {
      if (id) {
        return r;
      }
    } else if (f(data[data[node].ch[1]].value())) {
      return last_true_i(f, data[node].ch[1], mid + 1, r, id);
    }
    if (data[node].ch[0] == -1) {
      if (id) {
        return mid;
      }
    } else if (f(data[data[node].ch[0]].value())) {
      return last_true_i(f, data[node].ch[0], l, mid, id);
    }
    return -1;
  }
  Index first_true_i(
    const std::function<bool(Output)>& f,
    int node,
    Index l,
    Index r,
    bool id
  ) {
    if (l == r) {
      if (f(data[node].value())) {
        return l;
      }
      return -1;
    }
    const Index mid = (l + r) / 2;
    if (data[node].need_push()) {
      copy_ch(node, 0);
      copy_ch(node, 1);
      push(node, r - l + 1);
    }
    if (data[node].ch[0] == -1) {
      if (id) {
        return l;
      }
    } else if (f(data[data[node].ch[0]].value())) {
      return first_true_i(f, data[node].ch[0], l, mid);
    }
    if (data[node].ch[1] == -1) {
      if (id) {
        return mid + 1;
      }
    } else if (f(data[data[node].ch[1]].value())) {
      return first_true_i(f, data[node].ch[1], mid + 1, r);
    }
    return -1;
  }
  Index last_true(const std::function<bool(Output)>& f, int rt) {
    return last_true_i(f, rts[rt], 0, sz - 1, f(Node::ID));
  }
  Index first_true(const std::function<bool(Output)>& f, int rt) {
    return first_true_i(f, rts[rt], 0, sz - 1, f(Node::ID));
  }
};

template <class T> struct Node {
  std::array<int, 2> ch{-1, -1};
  using Index = int;
  using Output = T;
  static constexpr Output ID{0};

  T val{Node::ID};
  T la{0};
  Output value() const { return val; }
  static Output comb(Output lhs, Output rhs) { return std::max(lhs, rhs); }
  Node() = default;

  void reset_value() { val = T{0}; }
  void pull(Node& node) { val = std::max(val, node.val); }
  bool need_push() { return la != T{0}; }
  void push(Node& lch, Node& rch, Index k) {
    lch.add(la, k);
    rch.add(la, k);
    la = T{0};
  }

  void add(T v, Index /*k*/) {
    val += v;
    la += v;
  }
};

struct Point {
  int a, b;
};

int main() {
#ifndef LOCAL
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
#endif

  int n;
  std::cin >> n;
  CC<int> cx, cy;
  std::array<std::vector<Point>, 2> p;
  p[0].reserve(n);
  for (int i = 0; i < n; ++i) {
    int a, b;
    std::cin >> a >> b;
    cx.insert(a);
    cy.insert(b);
    p[0].emplace_back(a, b);
  }
  int m;
  std::cin >> m;
  for (int i = 0; i < m; ++i) {
    int x, y;
    std::cin >> x >> y;
    cx.insert(x);
    cy.insert(y);
    p[1].emplace_back(x, y);
  }
  cx.init();
  cy.init();
  int sx = cx.size();
  int sy = cy.size();
  for (const int i : {0, 1}) {
    for (auto& [a, b] : p[i]) {
      a = cx[a];
      b = cy[b];
    }
  }
  auto dq = [&](
              auto& self,
              int l,
              int r,
              std::array<std::vector<int>, 2>& cur,
              int add = 0
            ) -> void {
    int mid = (l + r) / 2;
    std::array<std::array<std::vector<int>, 2>, 2> gr;
    for (int i : cur[1]) {
      if (i > mid) {
        gr[1][1].push_back(i);
      }
    }
    std::erase_if(cur[1], [mid](int i) { return i > mid; });
    std::vector<std::vector<std::pair<int, int>>> loc(sx);
    for (int i : {0, 1}) {
      for (int j : cur[i]) {
        loc[p[i][j].a].emplace_back(j, i);
      }
    }

    PSeg<Node<int64_t>> dp(sy + 1);
    for (int i = 0; i < sx; ++i) {
      if (i == 0) {
        dp.new_rt();
      } else {
        dp.copy_rt(i - 1);
      }
      for (auto [j, t] : loc[i]) {
        if (t == 1) {
          int64_t cv = dp.query(i, p[t][j].b + 1, p[t][j].b + 1);
          int ind = dp.last_true([&](int64_t val) { return val > cv; }, i) + 1;
          dp.upd(&Node<int64_t>::add, i, ind, sy, 1);
        } else {
          dp.upd(&Node<int64_t>::add, i, 0, p[t][j].b, 1);
        }
      }
    }
    std::vector<int> seq(sx + 1);
    seq[sx] = 0;
    for (int i = sx - 1; i >= 0; --i) {
      int64_t cv = dp.query(i, seq[i + 1], seq[i + 1]);
      int fi = dp.last_true([&](int64_t val) { return val >= cv; }, i);
      seq[i] = fi;
    }
    int al = 0, ar = 0;
    for (int i : cur[0]) {
      if (p[0][i].b >= seq[p[0][i].a]) {
        ++al;
        gr[1][0].push_back(i);
      } else {
        gr[0][0].push_back(i);
      }
    }
    for (int i : cur[1]) {
      if (p[1][i].b >= seq[p[1][i].a]) {
        gr[1][1].push_back(i);
      } else {
        ++ar;
        if (i <= mid) {
          gr[0][1].push_back(i);
        }
      }
    }
    if (l == r) {
      std::cout << (n + l + 1) - (add + al + ar) << '\n';
      return;
    }
    self(self, l, mid, gr[0], add + al);
    self(self, mid + 1, r, gr[1], add + ar);
  };

  std::array<std::vector<int>, 2> a;
  a[0].resize(n);
  a[1].resize(m);
  std::iota(a[0].begin(), a[0].end(), 0);
  std::iota(a[1].begin(), a[1].end(), 0);
  dq(dq, 0, m - 1, a);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

1
2
2
3

result:

ok 4 number(s): "1 2 2 3"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

9
22 44
7 6
10 48
46 20
21 35
33 16
36 41
29 4
45 22
7
46 39
44 32
1 48
43 19
28 34
8 48
15 18

output:

1
2
2
3
4
4
4

result:

ok 7 numbers

Test #3:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

7
25 13
38 45
30 28
28 29
16 34
45 4
47 13
8
24 16
10 18
8 28
40 47
28 35
5 25
29 0
41 17

output:

0
0
0
1
2
2
2
3

result:

ok 8 numbers

Test #4:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

10
47 32
0 16
18 11
17 19
40 49
36 24
3 26
15 45
23 29
42 3
5
42 18
22 3
30 13
35 19
43 29

output:

1
1
2
3
4

result:

ok 5 number(s): "1 1 2 3 4"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

6
2 5
22 3
28 41
41 36
9 8
8 17
2
24 7
49 35

output:

1
2

result:

ok 2 number(s): "1 2"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

2
27 36
5 39
6
47 22
45 4
44 2
24 2
29 11
21 37

output:

0
0
0
0
0
0

result:

ok 6 numbers

Test #7:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

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

output:

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

result:

ok 48 numbers

Test #8:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

38
13 24
34 6
36 39
31 36
25 23
32 37
20 37
34 18
38 22
37 11
42 50
30 44
1 2
7 41
17 14
31 25
31 37
7 32
46 12
18 46
22 36
18 20
21 9
46 44
39 26
24 34
42 17
38 22
16 35
0 50
24 28
8 45
44 40
2 46
37 35
28 20
22 29
31 32
2
45 4
27 6

output:

1
1

result:

ok 2 number(s): "1 1"

Test #9:

score: 0
Accepted
time: 1ms
memory: 3676kb

input:

8
20 46
34 26
11 23
40 29
21 9
48 13
10 47
4 28
30
22 34
8 23
21 9
31 1
44 27
9 12
48 17
43 24
17 15
48 8
22 5
27 26
46 27
42 0
14 28
9 34
5 2
8 29
26 7
13 3
44 19
50 7
40 29
43 31
49 31
50 26
20 19
2 10
39 25
41 0

output:

1
1
2
2
3
3
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
6
6
6
6
6
6
6
6

result:

ok 30 numbers

Test #10:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

14
47 8
17 15
15 9
0 17
12 27
44 31
42 44
16 11
22 1
12 49
31 24
0 6
41 24
46 12
11
48 10
20 23
39 6
39 34
31 44
16 49
50 8
48 22
22 29
36 22
12 20

output:

1
2
3
4
5
6
7
8
9
10
11

result:

ok 11 numbers

Test #11:

score: 0
Accepted
time: 1ms
memory: 3656kb

input:

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

output:

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

result:

ok 24 numbers

Test #12:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

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

output:

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

result:

ok 30 numbers

Test #13:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

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

output:

1
2
3
4

result:

ok 4 number(s): "1 2 3 4"

Test #14:

score: 0
Accepted
time: 1ms
memory: 3896kb

input:

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

output:

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

result:

ok 31 numbers

Test #15:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

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

output:

1
2
3
4
5
6
7
8
8
8
8
8
8
9
9
9
9
9
9
9
9
9
10
10
10
10
10
10
10

result:

ok 29 numbers

Test #16:

score: 0
Accepted
time: 2ms
memory: 3804kb

input:

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

output:

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

result:

ok 164 numbers

Test #17:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

2
1 19
16 29
1
23 41

output:

1

result:

ok 1 number(s): "1"

Test #18:

score: 0
Accepted
time: 2ms
memory: 4248kb

input:

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

output:

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
49
50
51
51
52
53
54
55
56
57
58
58
59
60
60
60
61
61
62
63
64
65
66
67
68
69
70
70
71
72
73
74
75
76
77
78
79
80
81
81
82
83
84
85
86
86
87
87
88
89
90
90
91
...

result:

ok 157 numbers

Test #19:

score: 0
Accepted
time: 2ms
memory: 3748kb

input:

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

output:

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
32
33
34
35
36
37
38
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
58
59
60
61
62
62
63
63
63
63
63
63
64
65
66
66
66
66
66
67
68
68
68
68
68
68
68
69
70
70
71
71
71
72
72
72
73
73
73
73
73
73
73
...

result:

ok 170 numbers

Test #20:

score: 0
Accepted
time: 2ms
memory: 3984kb

input:

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

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
21
22
23
24
25
26
27
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
47
48
49
49
50
51
51
52
53
54
55
56
56
57
57
58
59
60
61
62
63
64
65
66
67
67
68
68
68
68
69
70
71
71
71
72
72
73
73
73
74
75
76
77
77
77
78
78
79
80
81
82
83
84
...

result:

ok 143 numbers

Test #21:

score: 0
Accepted
time: 1ms
memory: 3732kb

input:

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

output:

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

result:

ok 45 numbers

Test #22:

score: 0
Accepted
time: 2ms
memory: 3824kb

input:

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

output:

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
47
48
48
49
50
51
51
52
53
54
55
56
56
56
56
56
56
56
56
56
56
57
58
58
58
58
58
58
58
58
58
59
59
59
59
59
59
59
59
59
59
60
60
61
61
61
61
61
62
62
62
62
62
62
62
...

result:

ok 134 numbers

Test #23:

score: 0
Accepted
time: 1ms
memory: 3840kb

input:

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

output:

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
47
48
49
50
51
52
53
54
55
56

result:

ok 56 numbers

Test #24:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

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

output:

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

result:

ok 67 numbers

Test #25:

score: 0
Accepted
time: 1ms
memory: 3764kb

input:

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

output:

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

result:

ok 43 numbers

Test #26:

score: 0
Accepted
time: 6ms
memory: 4136kb

input:

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

output:

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

result:

ok 625 numbers

Test #27:

score: 0
Accepted
time: 7ms
memory: 5148kb

input:

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

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 687 numbers

Test #28:

score: 0
Accepted
time: 280ms
memory: 71880kb

input:

4368
717 418
977 829
894 787
929 904
812 463
581 626
606 476
308 620
253 749
826 558
110 125
323 161
546 702
197 147
608 460
391 66
998 696
635 531
634 992
697 795
633 38
408 505
465 251
397 958
43 836
282 407
834 837
828 815
888 395
153 722
85 280
38 650
558 387
162 752
818 28
734 412
33 261
386 71...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 4516 numbers

Test #29:

score: 0
Accepted
time: 198ms
memory: 11216kb

input:

487
548 161
465 882
435 350
568 355
398 654
684 698
1000 412
601 551
273 226
8 602
641 399
479 666
736 190
197 828
273 54
977 881
331 309
725 871
653 466
976 57
259 886
685 382
830 622
640 932
717 131
617 198
77 603
347 660
574 382
877 717
97 447
988 164
593 167
678 648
778 678
900 257
382 426
214 9...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
10...

result:

ok 1855 numbers

Test #30:

score: 0
Accepted
time: 33ms
memory: 31572kb

input:

4915
761 983
953 412
277 154
649 698
259 795
266 815
260 507
887 637
532 313
645 514
782 861
500 248
428 713
700 105
35 667
856 686
843 179
416 668
474 247
258 116
630 182
943 316
651 485
882 198
281 822
226 752
539 345
825 732
106 711
626 306
549 373
343 503
629 493
407 648
935 132
814 940
339 29
2...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 412 numbers

Test #31:

score: 0
Accepted
time: 18ms
memory: 21684kb

input:

3526
452 728
261 347
748 390
138 763
825 512
998 254
1 612
677 527
907 672
624 8
915 299
220 878
254 928
937 21
966 826
89 787
284 69
709 646
414 566
145 237
250 100
108 472
604 166
139 860
490 20
574 248
225 43
736 817
289 707
265 392
653 125
950 257
534 67
492 660
407 653
890 814
714 441
111 563
5...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

result:

ok 74 numbers

Test #32:

score: 0
Accepted
time: 102ms
memory: 53520kb

input:

4373
116 42
728 54
681 481
583 614
48 309
251 129
43 140
85 934
650 139
966 117
543 214
936 187
979 590
398 933
751 867
561 314
267 853
3 958
433 679
523 867
224 17
763 46
73 554
116 723
574 143
658 757
217 669
903 401
633 849
829 996
260 69
279 7
85 366
360 265
620 106
356 837
540 766
250 710
2 983...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 1842 numbers

Test #33:

score: 0
Accepted
time: 31ms
memory: 32864kb

input:

3944
596 69
69 734
801 975
747 265
401 20
122 357
18 306
15 847
312 83
328 685
369 738
184 353
721 274
367 835
633 456
465 978
28 521
722 851
682 468
594 12
377 870
728 408
924 976
514 563
145 223
503 307
206 585
957 207
655 135
984 417
934 537
867 141
231 180
688 998
507 613
489 221
532 328
916 154...

output:

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
1...

result:

ok 519 numbers

Test #34:

score: 0
Accepted
time: 215ms
memory: 76428kb

input:

3480
87 464
880 926
433 958
676 382
306 109
646 955
748 890
849 983
295 831
783 102
30 55
121 12
910 398
585 839
640 273
703 459
885 828
538 712
384 552
290 485
573 282
664 645
470 850
44 233
202 970
342 379
449 838
890 366
65 345
717 128
377 785
29 149
272 272
59 524
896 785
916 58
391 778
897 967
...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 3496 numbers

Test #35:

score: 0
Accepted
time: 18ms
memory: 28680kb

input:

4636
485 821
827 757
617 117
103 896
607 520
303 55
62 118
895 877
279 561
730 7
760 393
39 18
908 636
549 667
954 738
577 705
298 404
639 864
770 420
754 168
175 876
235 765
68 914
631 326
678 186
266 175
885 829
269 816
658 976
449 332
311 547
504 128
873 295
826 542
474 967
476 794
758 63
784 441...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 262 numbers

Test #36:

score: 0
Accepted
time: 259ms
memory: 66780kb

input:

4054
55288 82954
45357 68585
2302 19260
75555 99657
5263 37499
96993 58347
72813 27164
91991 78754
50235 58021
88973 45763
48270 71487
58989 61391
23265 69608
56599 18413
55818 38271
32617 52745
12702 83149
39937 77252
53460 11455
22044 55880
58013 87888
32579 71224
41809 37987
60389 52779
26953 892...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
1...

result:

ok 987 numbers

Test #37:

score: 0
Accepted
time: 349ms
memory: 71332kb

input:

2051
9447 42347
79693 2250
55431 40079
28371 66204
69266 65186
28163 82135
4239 19637
86894 59828
22330 42630
3529 39661
18687 56596
38164 45851
90073 77486
89997 71562
96753 4396
2754 99966
38839 33098
99842 80630
99332 95744
90979 45931
27978 43189
13777 27897
75750 50575
85351 21849
16826 25232
4...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 1700 numbers

Test #38:

score: 0
Accepted
time: 4786ms
memory: 41644kb

input:

1246
60695 75683
17361 42987
17640 21750
43578 22045
93263 5075
68309 80859
46354 89762
82588 62024
80522 91704
91103 98384
93627 40256
4755 84955
48827 8301
11914 53965
20990 34957
81117 96932
38875 40636
92106 35838
94032 67525
91806 52196
4462 12844
36868 12497
79511 40544
13310 32636
50685 45481...

output:

1
2
3
4
5
6
7
8
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
...

result:

ok 5419 numbers

Test #39:

score: 0
Accepted
time: 3195ms
memory: 33676kb

input:

1537
34786 15444
38758 78801
34109 98713
11165 22763
67965 48571
2832 33266
1662 58526
68077 72887
7365 75049
29191 84243
45190 35123
49484 90741
93943 70547
22479 85691
83034 71701
57431 27887
94688 46629
84673 62768
77317 33013
942 85466
65783 45302
36162 93485
33650 42975
58049 33316
77063 95904
...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 4423 numbers

Test #40:

score: 0
Accepted
time: 1911ms
memory: 140692kb

input:

4451
53500 66505
23841 13791
77172 31706
90739 11880
70177 26224
59625 58845
80123 26022
13311 30840
2786 99713
69548 60410
68760 57002
44185 20717
97337 39633
41077 39633
75426 18643
71202 34338
85485 7628
12300 58552
68944 83625
28799 99583
94159 42565
60220 19401
35402 38192
72973 42524
34047 952...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
89
90
91
92
93
94
95
96
97
98
99
100
10...

result:

ok 4083 numbers

Test #41:

score: 0
Accepted
time: 796ms
memory: 72900kb

input:

2387
48016 6600
85596 49286
77710 81925
63091 55035
30184 88413
24858 42457
58636 87114
89950 36358
53606 57921
59738 78185
15357 86776
31995 30603
72384 92485
14281 48035
48393 30410
5673 27722
45877 61418
21664 20922
76527 74824
63832 10797
44323 50703
6477 30740
78884 60792
37480 60071
89206 5382...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
1...

result:

ok 2490 numbers

Test #42:

score: 0
Accepted
time: 665ms
memory: 117628kb

input:

3984
73752 87458
1186 84870
22875 11306
28832 71958
30460 49060
80048 18991
82003 39596
42903 82397
19372 64030
51921 50020
54441 6838
12548 63767
67477 38759
38156 14807
53802 96794
14907 43065
79244 27339
23151 34983
88107 55641
5216 74349
43882 87274
76983 99074
51397 85970
92776 57295
16909 5064...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 2335 numbers

Test #43:

score: 0
Accepted
time: 2497ms
memory: 70248kb

input:

2949
50501 585
80969 80119
72623 80575
89988 50551
68203 11396
1199 92078
24026 67627
52746 47255
54740 11729
68067 70977
99141 84530
5219 91794
70648 57085
52435 20631
20266 40796
4512 76096
99658 70494
29658 41674
86630 83997
47635 9006
59024 43187
16921 80290
77087 41705
22597 91019
13177 542
757...

output:

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
47
48
49
50
51
52
53
54
54
55
56
57
58
59
60
61
62
63
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
10...

result:

ok 4195 numbers

Test #44:

score: 0
Accepted
time: 2159ms
memory: 22432kb

input:

731
79649 55337
71037 22839
89030 49770
42383 46246
31449 50408
57832 88865
45440 29689
80527 62339
57769 84555
31330 21158
9565 54470
65275 65014
26928 16490
48044 66093
47881 78397
75560 63994
15078 56449
62567 45610
52358 2113
89867 61135
66000 53649
74298 88
99511 5712
23713 54968
27909 64259
85...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
23
24
25
26
27
28
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
59
60
61
62
63
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...

result:

ok 3594 numbers

Test #45:

score: 0
Accepted
time: 1876ms
memory: 154412kb

input:

5301
38543 95341
34907 31079
37837 55001
2401 41398
36949 23463
48102 53486
35484 26492
43615 52167
91130 94867
54230 90567
11733 8400
84247 54848
77461 55338
31429 23257
1226 42958
51498 4284
89106 47779
15663 85533
1628 4722
42947 27905
10045 45733
33263 98921
49596 75693
89827 20979
27680 90271
4...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 4082 numbers

Test #46:

score: 0
Accepted
time: 949ms
memory: 142192kb

input:

5117
72724 17756
2364 27660
35530 42610
98148 91787
80050 9925
7544 2257
92161 7315
82628 4387
47130 95795
21719 46402
7104 59045
59934 48227
28878 73570
14633 71905
16956 10603
34282 75287
11043 46466
31486 22878
30269 62201
13191 36663
43377 99578
7481 7240
50764 67821
66335 57172
67295 30821
6564...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 2954 numbers

Test #47:

score: 0
Accepted
time: 1628ms
memory: 52404kb

input:

2303
13715 23879
40116 96407
51235 61591
24226 52022
14760 16438
64533 74300
38950 87835
48174 11996
14721 22652
2793 48355
83992 34187
46355 95343
1356 3628
29769 48177
17428 42531
13775 26911
1530 10853
96133 37727
93674 26884
39262 94775
84164 20869
80890 94280
2136 87694
64891 25657
93603 5117
3...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
1...

result:

ok 3310 numbers

Test #48:

score: -100
Time Limit Exceeded

input:

3161
70680 11510
32448 88474
41634 76084
20497 90390
13617 79512
41974 72540
96251 41865
9407 76055
82213 15598
31745 40919
54917 30077
7457 83184
34255 50235
58373 48657
29322 43648
34011 88142
87052 43664
84778 13760
96087 34355
30685 86401
25519 29447
33019 25658
56398 43491
14838 91523
30888 117...

output:

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result: