QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#629138#4219. Insectsnhuang685TL 981ms95716kbC++2310.9kb2024-10-11 05:56:132024-10-11 05:56:14

Judging History

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

  • [2024-10-11 05:56:14]
  • 评测
  • 测评结果:TL
  • 用时:981ms
  • 内存:95716kb
  • [2024-10-11 05:56:13]
  • 提交

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 ia, ib;
  int a, b;
};

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

  int n;
  std::cin >> n;
  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;
    p[0].emplace_back(a, b, -1, -1);
  }
  int m;
  std::cin >> m;
  for (int i = 0; i < m; ++i) {
    int x, y;
    std::cin >> x >> y;
    p[1].emplace_back(x, y, -1, -1);
  }
  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;
    int sx, sy;
    {
      CC<int> cx, cy;
      cx.val.reserve(cur[0].size() + cur[1].size());
      cy.val.reserve(cur[0].size() + cur[1].size());
      for (int i : {0, 1}) {
        for (int j : cur[i]) {
          cx.insert(p[i][j].ia);
          cy.insert(p[i][j].ib);
        }
      }
      cx.init();
      cy.init();
      sx = cx.size(), sy = cy.size();
      loc.resize(sx);
      for (int i : {0, 1}) {
        for (int j : cur[i]) {
          p[i][j].a = cx[p[i][j].ia];
          p[i][j].b = cy[p[i][j].ib];
          loc[p[i][j].a].emplace_back(j, i);
        }
      }
    }

    int al = 0, ar = 0;
    {
      PSeg<Node<int64_t>> dp(sy + 1);
      dp.data.reserve(80 * (std::ssize(cur[0]) + std::ssize(cur[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;
      }
      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: 1ms
memory: 3580kb

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

input:

2
1 19
16 29
1
23 41

output:

1

result:

ok 1 number(s): "1"

Test #18:

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

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

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

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

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

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

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

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

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

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: 5ms
memory: 4200kb

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: 70ms
memory: 20072kb

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: 9ms
memory: 5340kb

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: 21ms
memory: 9724kb

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: 8ms
memory: 8716kb

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: 38ms
memory: 9748kb

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: 28ms
memory: 7452kb

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: 50ms
memory: 11048kb

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: 20ms
memory: 13540kb

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: 51ms
memory: 13180kb

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: 38ms
memory: 16196kb

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: 40ms
memory: 11536kb

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: 41ms
memory: 13380kb

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: 95ms
memory: 27164kb

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: 54ms
memory: 15552kb

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: 78ms
memory: 25180kb

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: 63ms
memory: 19176kb

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: 17ms
memory: 7860kb

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: 135ms
memory: 22884kb

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: 112ms
memory: 30336kb

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: 53ms
memory: 12024kb

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: 0
Accepted
time: 82ms
memory: 15808kb

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:

ok 5781 numbers

Test #49:

score: 0
Accepted
time: 90ms
memory: 19792kb

input:

3234
82397 13338
88333 51781
62598 37980
40369 4062
13614 81543
19288 83008
42188 90342
33797 1278
70431 61474
41161 41971
24211 69829
32494 81541
14053 8595
16618 98988
72025 43379
48142 59848
17366 96403
3465 41312
68942 77377
33541 87371
61856 9437
63039 71886
63200 83027
50799 33885
13732 36738
...

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 5195 numbers

Test #50:

score: 0
Accepted
time: 80ms
memory: 16548kb

input:

3476
54062 89871
84834 82645
69359 37165
95033 52926
71612 5044
69461 79830
31369 32989
71187 8887
48547 85540
95253 14505
61706 68774
97238 64663
22106 68697
44451 65705
28916 31342
55844 4123
79420 88218
32103 10206
30043 38567
72742 41632
69529 86910
31451 8369
87067 17556
79647 87545
96587 94577...

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 3315 numbers

Test #51:

score: 0
Accepted
time: 28ms
memory: 11896kb

input:

2474
80715 85028
34089 87898
82447 82446
4677 30434
62441 80332
58449 29311
47379 44235
76735 44124
81920 45250
32175 23476
57848 58704
61657 58489
41795 98577
6932 89609
39428 53902
78749 19255
75550 81548
35257 43099
79413 98578
72339 71684
62317 84324
99717 15606
1736 29917
11435 76365
48879 9167...

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
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 1404 numbers

Test #52:

score: 0
Accepted
time: 28ms
memory: 9064kb

input:

1832
86726 88182
85771 17424
91381 96935
69412 17992
81231 95551
56782 60716
47545 26470
74093 22799
69282 94508
68162 72536
65830 54597
54780 93515
92226 79540
87722 29792
99726 63826
34781 60616
11218 66670
93425 5776
45860 46942
69388 40191
24252 38687
48144 21283
69140 84747
64720 62049
36200 96...

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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
96
97
98
99
100
10...

result:

ok 989 numbers

Test #53:

score: 0
Accepted
time: 29ms
memory: 13724kb

input:

2862
41292 17338
40882 59607
81635 98160
3974 31145
72348 32604
43930 89606
37103 99012
47269 27321
99295 36821
12042 71200
36594 16539
99601 96016
65137 31008
50463 97881
43236 279
42356 77238
39044 28808
482 78556
5121 20668
98852 87818
65030 72533
44008 73148
9281 29501
62595 88307
49472 68637
50...

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
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 529 numbers

Test #54:

score: 0
Accepted
time: 90ms
memory: 17308kb

input:

4234
73522 73740
5324 16123
77257 71418
98336 21212
92093 42791
85075 78462
38356 91551
90138 81147
84141 81253
88040 19299
71744 5069
86884 70739
93472 40758
23376 72863
91962 90781
69378 2958
26133 77085
74546 39117
60191 84067
41257 39354
28053 69550
78182 94196
14658 44744
35354 85783
76400 7645...

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 2068 numbers

Test #55:

score: 0
Accepted
time: 87ms
memory: 14896kb

input:

3481
88096 79019
20555 38513
26336 85586
65878 25052
49388 15357
56012 41035
71726 75037
73854 90610
36437 50432
17116 48893
33045 82953
37472 69106
49367 57019
81637 35433
74794 38855
14637 40511
59423 57678
31889 25470
88076 19171
32749 57152
22174 97746
78145 24975
85543 22422
96387 53997
22069 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 4880 numbers

Test #56:

score: 0
Accepted
time: 14ms
memory: 8032kb

input:

2305
12333 72845
46055 23804
24012 17647
92211 47605
78145 29284
36125 40337
81628 2546
37754 88538
55417 53871
70887 16312
89292 57888
19544 41801
45406 90505
93622 96380
18636 29887
47640 66487
12701 94811
30800 36879
5758 7292
67911 67534
91650 32968
48996 18470
69497 32688
80247 4790
56529 45665...

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 385 numbers

Test #57:

score: 0
Accepted
time: 83ms
memory: 27548kb

input:

4398
41840 72080
6006 6155
96540 33753
9286 55215
50651 67456
53763 1625
93659 39675
42259 69385
21102 44044
59122 75139
15606 8995
58391 13334
70870 15737
74686 31480
79538 40988
40839 67854
5194 30920
97849 48106
38354 91043
43532 87742
33467 56757
66034 17394
22595 46669
12640 41524
62506 56196
6...

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 2734 numbers

Test #58:

score: 0
Accepted
time: 5ms
memory: 5044kb

input:

473
15908 46201
52694 74996
81868 60013
11769 79896
65609 55314
6230 71047
88508 74267
44924 97061
25457 34212
88576 11774
69060 4108
75529 69754
9276 85058
7640 45520
77326 91127
42289 78212
61355 44138
4834 2729
69674 94185
86749 33923
23582 78692
8521 25824
34248 25647
44011 2683
75573 30597
5622...

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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
88
89
90
91
92
93
94
95
96
97
98
99
100
10...

result:

ok 1159 numbers

Test #59:

score: 0
Accepted
time: 981ms
memory: 95716kb

input:

22351
31325 99209
81459 92496
78330 10183
37387 8981
2864 91855
86698 85745
70770 58627
39392 83313
19599 19577
79658 77505
75615 50797
26322 61900
91771 45141
35361 64923
58151 67678
69902 7587
1125 25323
88901 1542
10970 13462
28621 37831
44856 14627
60030 84502
14430 53759
57774 81835
969 92336
7...

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 18780 numbers

Test #60:

score: 0
Accepted
time: 849ms
memory: 92452kb

input:

29290
66587 7039
69239 48584
72153 58806
50643 57017
83883 97029
76662 9102
25019 13335
27933 86655
57865 40779
53117 39541
66351 57589
75981 9953
95689 64817
26429 21316
97860 53941
38564 9635
54600 70319
89245 29974
83967 26896
17615 29488
44729 36679
70974 3169
27848 63573
17376 40763
98258 84941...

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 13658 numbers

Test #61:

score: 0
Accepted
time: 140ms
memory: 25512kb

input:

9895
46915 31855
85865 14623
32003 31804
14985 12311
93885 90040
53526 66044
83915 44736
1486 6757
6529 62773
39228 89990
14521 30589
4621 512
34525 58504
5615 61494
24238 41598
40640 74576
27580 51974
78929 4549
77297 99848
19679 94003
66560 30296
81240 58375
14227 17785
12313 84931
17669 14686
332...

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 1775 numbers

Test #62:

score: 0
Accepted
time: 139ms
memory: 26916kb

input:

1309
68441 10397
17817 27674
60534 28797
32314 54867
98625 65781
6326 94268
53184 30617
80566 67568
15330 17024
77140 77278
30786 60591
6011 53904
93043 71030
65460 61902
47994 59427
13120 39166
55581 48983
50248 85591
58635 62961
46871 43819
54364 8771
15120 85888
95826 95727
53751 62646
79680 7458...

output:

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

result:

ok 24555 numbers

Test #63:

score: 0
Accepted
time: 701ms
memory: 77396kb

input:

26605
90486 75958
64962 78951
84633 35520
32753 38371
20687 27645
26627 59356
73754 13871
97553 63285
91867 20571
92626 35187
93480 48907
99893 60445
12887 52825
70639 85260
79624 49514
27345 14718
93040 75718
65196 13265
43907 67254
57821 76268
49183 46363
10752 80607
15441 73709
47158 66192
97391 ...

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 9201 numbers

Test #64:

score: 0
Accepted
time: 782ms
memory: 82468kb

input:

26401
44545 62572
60117 64053
39293 20538
13004 49991
67245 96551
94669 29833
7883 28878
21752 47391
4289 21128
55300 39850
25321 19756
78587 49740
72473 43643
57817 8572
1139 2672
91065 22709
75862 75393
5426 44758
26707 51033
94823 9024
88767 80097
33295 31058
51119 95672
57280 84516
49228 23384
7...

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
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 12108 numbers

Test #65:

score: 0
Accepted
time: 394ms
memory: 48388kb

input:

14698
6156 41007
82598 46675
98665 27376
33184 42833
99429 91278
6057 26053
97807 29722
24088 19701
64252 59043
55444 10587
76859 83423
26324 9769
45011 61599
49800 90511
54025 47587
82708 69881
62751 29155
21020 56048
58478 78908
80274 20544
81151 58581
55286 78792
10711 31044
62315 49230
37793 210...

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 6995 numbers

Test #66:

score: 0
Accepted
time: 381ms
memory: 51944kb

input:

25206
11901 31447
72163 52887
20230 89718
20657 81031
43309 94611
31001 23475
80619 39465
55734 67282
8667 80475
55009 81302
98449 71206
47790 15117
63535 91705
32209 75687
74876 8259
19053 76625
52594 72621
61543 18465
1896 33028
67441 12153
15417 50226
7161 46555
18413 37056
58672 26688
75830 3253...

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 1418 numbers

Test #67:

score: 0
Accepted
time: 248ms
memory: 41792kb

input:

6384
12404 78507
25114 53455
34515 54671
38261 67415
84517 47666
48772 5011
61653 41102
62169 18062
6595 97197
82147 16536
18352 53537
15959 98921
33410 85851
81999 25269
81777 98412
99458 49763
505 96039
41266 9471
25255 89983
10840 16837
89691 65107
95599 79182
47559 59223
12975 23008
34268 49638
...

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 17557 numbers

Test #68:

score: -100
Time Limit Exceeded

input:

100000
27437 64264
86586 31205
10363 16447
65902 94753
78943 40272
92313 76585
26635 24972
74179 49731
90339 81928
10728 56753
46949 80718
69821 8714
84817 26724
91646 61787
87089 89067
59527 46295
72917 24643
57579 19524
14558 35121
51104 15200
73684 41484
62593 63393
76106 23627
8497 742
49709 518...

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: