QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#113016#6558. Allergen TestingmaspyAC ✓3ms3672kbC++2313.6kb2023-06-15 21:24:112023-06-15 21:24:13

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-15 21:24:13]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3672kb
  • [2023-06-15 21:24:11]
  • 提交

answer

#line 1 "library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;

template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'000'000'000;
template <>
constexpr ll infty<ll> = ll(infty<int>) * infty<int> * 2;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * infty<ll>;
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); }
// (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, typename U>
T ceil(T x, U y) {
  return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U>
T floor(T x, U y) {
  return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T, typename U>
pair<T, T> divmod(T x, U y) {
  T q = floor(x, y);
  return {q, x - q * y};
}

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

#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) {
  assert(!que.empty());
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(vc<T> &que) {
  assert(!que.empty());
  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;
    tie(ok, ng) = (check(x) ? mp(x, ng) : mp(ok, 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;
    tie(ok, ng) = (check(x) ? mp(x, ng) : mp(ok, 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;
}
#endif
#line 1 "library/other/io.hpp"
// based on yosupo's fastio
#include <unistd.h>

namespace fastio {
#define FASTIO
// クラスが read(), print() を持っているかを判定するメタ関数
struct has_write_impl {
  template <class T>
  static auto check(T &&x) -> decltype(x.write(), std::true_type{});

  template <class T>
  static auto check(...) -> std::false_type;
};

template <class T>
class has_write : public decltype(has_write_impl::check<T>(std::declval<T>())) {
};

struct has_read_impl {
  template <class T>
  static auto check(T &&x) -> decltype(x.read(), std::true_type{});

  template <class T>
  static auto check(...) -> std::false_type;
};

template <class T>
class has_read : public decltype(has_read_impl::check<T>(std::declval<T>())) {};

struct Scanner {
  FILE *fp;
  char line[(1 << 15) + 1];
  size_t st = 0, ed = 0;
  void reread() {
    memmove(line, line + st, ed - st);
    ed -= st;
    st = 0;
    ed += fread(line + ed, 1, (1 << 15) - ed, fp);
    line[ed] = '\0';
  }
  bool succ() {
    while (true) {
      if (st == ed) {
        reread();
        if (st == ed) return false;
      }
      while (st != ed && isspace(line[st])) st++;
      if (st != ed) break;
    }
    if (ed - st <= 50) {
      bool sep = false;
      for (size_t i = st; i < ed; i++) {
        if (isspace(line[i])) {
          sep = true;
          break;
        }
      }
      if (!sep) reread();
    }
    return true;
  }
  template <class T, enable_if_t<is_same<T, string>::value, int> = 0>
  bool read_single(T &ref) {
    if (!succ()) return false;
    while (true) {
      size_t sz = 0;
      while (st + sz < ed && !isspace(line[st + sz])) sz++;
      ref.append(line + st, sz);
      st += sz;
      if (!sz || st != ed) break;
      reread();
    }
    return true;
  }
  template <class T, enable_if_t<is_integral<T>::value, int> = 0>
  bool read_single(T &ref) {
    if (!succ()) return false;
    bool neg = false;
    if (line[st] == '-') {
      neg = true;
      st++;
    }
    ref = T(0);
    while (isdigit(line[st])) { ref = 10 * ref + (line[st++] & 0xf); }
    if (neg) ref = -ref;
    return true;
  }
  template <typename T,
            typename enable_if<has_read<T>::value>::type * = nullptr>
  inline bool read_single(T &x) {
    x.read();
    return true;
  }
  bool read_single(double &ref) {
    string s;
    if (!read_single(s)) return false;
    ref = std::stod(s);
    return true;
  }
  bool read_single(char &ref) {
    string s;
    if (!read_single(s) || s.size() != 1) return false;
    ref = s[0];
    return true;
  }
  template <class T>
  bool read_single(vector<T> &ref) {
    for (auto &d: ref) {
      if (!read_single(d)) return false;
    }
    return true;
  }
  template <class T, class U>
  bool read_single(pair<T, U> &p) {
    return (read_single(p.first) && read_single(p.second));
  }
  template <size_t N = 0, typename T>
  void read_single_tuple(T &t) {
    if constexpr (N < std::tuple_size<T>::value) {
      auto &x = std::get<N>(t);
      read_single(x);
      read_single_tuple<N + 1>(t);
    }
  }
  template <class... T>
  bool read_single(tuple<T...> &tpl) {
    read_single_tuple(tpl);
    return true;
  }
  void read() {}
  template <class H, class... T>
  void read(H &h, T &... t) {
    bool f = read_single(h);
    assert(f);
    read(t...);
  }
  Scanner(FILE *fp) : fp(fp) {}
};

struct Printer {
  Printer(FILE *_fp) : fp(_fp) {}
  ~Printer() { flush(); }

  static constexpr size_t SIZE = 1 << 15;
  FILE *fp;
  char line[SIZE], small[50];
  size_t pos = 0;
  void flush() {
    fwrite(line, 1, pos, fp);
    pos = 0;
  }
  void write(const char val) {
    if (pos == SIZE) flush();
    line[pos++] = val;
  }
  template <class T, enable_if_t<is_integral<T>::value, int> = 0>
  void write(T val) {
    if (pos > (1 << 15) - 50) flush();
    if (val == 0) {
      write('0');
      return;
    }
    if (val < 0) {
      write('-');
      val = -val; // todo min
    }
    size_t len = 0;
    while (val) {
      small[len++] = char(0x30 | (val % 10));
      val /= 10;
    }
    for (size_t i = 0; i < len; i++) { line[pos + i] = small[len - 1 - i]; }
    pos += len;
  }
  void write(const string s) {
    for (char c: s) write(c);
  }
  void write(const char *s) {
    size_t len = strlen(s);
    for (size_t i = 0; i < len; i++) write(s[i]);
  }
  void write(const double x) {
    ostringstream oss;
    oss << fixed << setprecision(15) << x;
    string s = oss.str();
    write(s);
  }
  void write(const long double x) {
    ostringstream oss;
    oss << fixed << setprecision(15) << x;
    string s = oss.str();
    write(s);
  }
  template <typename T,
            typename enable_if<has_write<T>::value>::type * = nullptr>
  inline void write(T x) {
    x.write();
  }
  template <class T>
  void write(const vector<T> val) {
    auto n = val.size();
    for (size_t i = 0; i < n; i++) {
      if (i) write(' ');
      write(val[i]);
    }
  }
  template <class T, class U>
  void write(const pair<T, U> val) {
    write(val.first);
    write(' ');
    write(val.second);
  }
  template <size_t N = 0, typename T>
  void write_tuple(const T t) {
    if constexpr (N < std::tuple_size<T>::value) {
      if constexpr (N > 0) { write(' '); }
      const auto x = std::get<N>(t);
      write(x);
      write_tuple<N + 1>(t);
    }
  }
  template <class... T>
  bool write(tuple<T...> tpl) {
    write_tuple(tpl);
    return true;
  }
  template <class T, size_t S>
  void write(const array<T, S> val) {
    auto n = val.size();
    for (size_t i = 0; i < n; i++) {
      if (i) write(' ');
      write(val[i]);
    }
  }
  void write(i128 val) {
    string s;
    bool negative = 0;
    if (val < 0) {
      negative = 1;
      val = -val;
    }
    while (val) {
      s += '0' + int(val % 10);
      val /= 10;
    }
    if (negative) s += "-";
    reverse(all(s));
    if (len(s) == 0) s = "0";
    write(s);
  }
};
Scanner scanner = Scanner(stdin);
Printer printer = Printer(stdout);
void flush() { printer.flush(); }
void print() { printer.write('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
  printer.write(head);
  if (sizeof...(Tail)) printer.write(' ');
  print(forward<Tail>(tail)...);
}

void read() {}
template <class Head, class... Tail>
void read(Head &head, Tail &... tail) {
  scanner.read(head);
  read(tail...);
}
} // namespace fastio
using fastio::print;
using fastio::flush;
using fastio::read;

#define INT(...)   \
  int __VA_ARGS__; \
  read(__VA_ARGS__)
#define LL(...)   \
  ll __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, D);
  ll ANS = 0;
  ++D;
  // N <= D^k
  while (N > 1) {
    ++ANS;
    N = ceil(N, D);
  }
  print(ANS);
}

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

详细

Test #1:

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

input:

1
4 1

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 3ms
memory: 3424kb

input:

10000
1 1
1000000000000000000 1
1 1000000000000000000
1000000000000000000 1000000000000000000
26615519354743225 163142634
26615519354743225 163142634
26615519354743224 163142634
26615519354743226 163142634
847997831064072529 920867976
847997831064072529 920867976
847997831064072528 920867976
8479978...

output:

0
60
0
1
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5...

result:

ok 10000 lines

Test #3:

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

input:

10000
823527803750642929 907484326
823527803750642929 907484326
823527803750642928 907484326
823527803750642930 907484326
280206224307108100 529345089
280206224307108100 529345089
280206224307108099 529345089
280206224307108101 529345089
797436035478693081 892992740
797436035478693081 892992740
7974...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #4:

score: 0
Accepted
time: 3ms
memory: 3480kb

input:

10000
78980847153007969 281035312
78980847153007969 281035312
78980847153007968 281035312
78980847153007970 281035312
658663429015034041 811580820
658663429015034041 811580820
658663429015034040 811580820
658663429015034042 811580820
178145888299969041 422073320
178145888299969041 422073320
17814588...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #5:

score: 0
Accepted
time: 3ms
memory: 3548kb

input:

10000
15666898550220324 125167481
15666898550220324 125167481
15666898550220323 125167481
15666898550220325 125167481
346219528467425284 588404221
346219528467425284 588404221
346219528467425283 588404221
346219528467425285 588404221
465072590896611481 681962308
465072590896611481 681962308
46507259...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #6:

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

input:

10000
73110991665736249 270390442
73110991665736249 270390442
73110991665736248 270390442
73110991665736250 270390442
42861161698831876 207029373
42861161698831876 207029373
42861161698831875 207029373
42861161698831877 207029373
69197990371001881 263055108
69197990371001881 263055108
69197990371001...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #7:

score: 0
Accepted
time: 3ms
memory: 3672kb

input:

10000
75972055111702369 275630286
75972055111702369 275630286
75972055111702368 275630286
75972055111702370 275630286
517337177308402500 719261549
517337177308402500 719261549
517337177308402499 719261549
517337177308402501 719261549
456041060989783129 675308122
456041060989783129 675308122
45604106...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #8:

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

input:

10000
48348651546359824 219883267
48348651546359824 219883267
48348651546359823 219883267
48348651546359825 219883267
12200681691236416 110456695
12200681691236416 110456695
12200681691236415 110456695
12200681691236417 110456695
131110166021938884 362091377
131110166021938884 362091377
131110166021...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #9:

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

input:

10000
80745852506473609 284158146
80745852506473609 284158146
80745852506473608 284158146
80745852506473610 284158146
600675369855990016 775032495
600675369855990016 775032495
600675369855990015 775032495
600675369855990017 775032495
812382510389796025 901322644
812382510389796025 901322644
81238251...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #10:

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

input:

10000
972673379794944 31187711
972673379794944 31187711
972673379794943 31187711
972673379794945 31187711
313451016258843369 559866962
313451016258843369 559866962
313451016258843368 559866962
313451016258843370 559866962
95666517218401936 309300043
95666517218401936 309300043
95666517218401935 3093...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #11:

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

input:

10000
804285751878400401 896819798
804285751878400401 896819798
804285751878400400 896819798
804285751878400402 896819798
17583384551546025 132602354
17583384551546025 132602354
17583384551546024 132602354
17583384551546026 132602354
573807765001000000 757500999
573807765001000000 757500999
57380776...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #12:

score: 0
Accepted
time: 3ms
memory: 3632kb

input:

10000
887843309091149376 942254375
887843309091149376 942254375
887843309091149375 942254375
887843309091149377 942254375
32719007347049521 180883960
32719007347049521 180883960
32719007347049520 180883960
32719007347049522 180883960
112560576777237169 335500486
112560576777237169 335500486
11256057...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #13:

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

input:

10000
48683163112752996 220642613
48683163112752996 220642613
48683163112752995 220642613
48683163112752997 220642613
25063250404867984 158313771
25063250404867984 158313771
25063250404867983 158313771
25063250404867985 158313771
34256750770438849 185085792
34256750770438849 185085792
34256750770438...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #14:

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

input:

10000
724464359080587841 851154720
724464359080587841 851154720
724464359080587840 851154720
724464359080587842 851154720
268340970984337161 518016380
268340970984337161 518016380
268340970984337160 518016380
268340970984337162 518016380
124844129742420544 353332887
124844129742420544 353332887
1248...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #15:

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

input:

10000
757861616951940484 870552477
757861616951940484 870552477
757861616951940483 870552477
757861616951940485 870552477
347168009296283904 589209647
347168009296283904 589209647
347168009296283903 589209647
347168009296283905 589209647
39898238004357489 199745432
39898238004357489 199745432
398982...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #16:

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

input:

10000
348382826724933225 590239634
348382826724933225 590239634
348382826724933224 590239634
348382826724933226 590239634
9585283875318369 97904462
9585283875318369 97904462
9585283875318368 97904462
9585283875318370 97904462
896903846451605776 947050075
896903846451605776 947050075
8969038464516057...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #17:

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

input:

10000
807590102941749241 898660170
807590102941749241 898660170
807590102941749240 898660170
807590102941749242 898660170
613209342042846649 783076842
613209342042846649 783076842
613209342042846648 783076842
613209342042846650 783076842
122989867858986769 350699112
122989867858986769 350699112
1229...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #18:

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

input:

10000
90063764290125025 300106254
90063764290125025 300106254
90063764290125024 300106254
90063764290125026 300106254
25144495008144964 158570157
25144495008144964 158570157
25144495008144963 158570157
25144495008144965 158570157
27517529656287225 165884084
27517529656287225 165884084
27517529656287...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #19:

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

input:

10000
11992765784951169 109511486
11992765784951169 109511486
11992765784951168 109511486
11992765784951170 109511486
199717083235391929 446897172
199717083235391929 446897172
199717083235391928 446897172
199717083235391930 446897172
1952709991236 1397393
1952709991236 1397393
1952709991235 1397393
...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #20:

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

input:

10000
140181659725178569 374408412
140181659725178569 374408412
140181659725178568 374408412
140181659725178570 374408412
3910499029844289 62533982
3910499029844289 62533982
3910499029844288 62533982
3910499029844290 62533982
200031067793292241 447248328
200031067793292241 447248328
2000310677932922...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #21:

score: 0
Accepted
time: 3ms
memory: 3536kb

input:

10000
901070041670456464 949247091
901070041670456464 949247091
901070041670456463 949247091
901070041670456465 949247091
140499500512716900 374832629
140499500512716900 374832629
140499500512716899 374832629
140499500512716901 374832629
840452830505001025 916762144
840452830505001025 916762144
8404...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #22:

score: 0
Accepted
time: 3ms
memory: 3448kb

input:

10000
802483663200975625 895814524
802483663200975625 895814524
802483663200975624 895814524
802483663200975626 895814524
947834837549065216 973568095
947834837549065216 973568095
947834837549065215 973568095
947834837549065217 973568095
6751387459247929 82166826
6751387459247929 82166826
6751387459...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #23:

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

input:

10000
202588535475083044 450098361
202588535475083044 450098361
202588535475083043 450098361
202588535475083045 450098361
509730134199607876 713953873
509730134199607876 713953873
509730134199607875 713953873
509730134199607877 713953873
436158857252944081 660423240
436158857252944081 660423240
4361...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #24:

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

input:

10000
327874773938285025 572603504
327874773938285025 572603504
327874773938285024 572603504
327874773938285026 572603504
694814098067569216 833555095
694814098067569216 833555095
694814098067569215 833555095
694814098067569217 833555095
417580099438775641 646204378
417580099438775641 646204378
4175...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #25:

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

input:

10000
98621312536412416 314040303
98621312536412416 314040303
98621312536412415 314040303
98621312536412417 314040303
104735316690803044 323628361
104735316690803044 323628361
104735316690803043 323628361
104735316690803045 323628361
11060583555537481 105169308
11060583555537481 105169308
1106058355...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #26:

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

input:

10000
169052242164056161 411159630
169052242164056161 411159630
169052242164056160 411159630
169052242164056162 411159630
36458785116934569 190941836
36458785116934569 190941836
36458785116934568 190941836
36458785116934570 190941836
916564941410536324 957373981
916564941410536324 957373981
91656494...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #27:

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

input:

10000
23320700831924224 152711167
23320700831924224 152711167
23320700831924223 152711167
23320700831924225 152711167
760421119749008656 872021283
760421119749008656 872021283
760421119749008655 872021283
760421119749008657 872021283
59958088087647649 244863406
59958088087647649 244863406
5995808808...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #28:

score: 0
Accepted
time: 3ms
memory: 3548kb

input:

10000
807411168046450881 898560608
807411168046450881 898560608
807411168046450880 898560608
807411168046450882 898560608
402492522627464256 634422983
402492522627464256 634422983
402492522627464255 634422983
402492522627464257 634422983
38237019874123225 195542884
38237019874123225 195542884
382370...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #29:

score: 0
Accepted
time: 3ms
memory: 3624kb

input:

10000
206155389105650884 454043377
206155389105650884 454043377
206155389105650883 454043377
206155389105650885 454043377
7957814985775396 89206585
7957814985775396 89206585
7957814985775395 89206585
7957814985775397 89206585
110131844782159489 331861182
110131844782159489 331861182
1101318447821594...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #30:

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

input:

10000
780020513431290000 883187699
780020513431290000 883187699
780020513431289999 883187699
780020513431290001 883187699
557937583109222416 746952195
557937583109222416 746952195
557937583109222415 746952195
557937583109222417 746952195
705396378532348944 839878787
705396378532348944 839878787
7053...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #31:

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

input:

10000
487620431987097600 698298239
487620431987097600 698298239
487620431987097599 698298239
487620431987097601 698298239
47693357417071921 218388088
47693357417071921 218388088
47693357417071920 218388088
47693357417071922 218388088
693874124365727041 832991070
693874124365727041 832991070
69387412...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #32:

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

input:

10000
859862039036976369 927287462
859862039036976369 927287462
859862039036976368 927287462
859862039036976370 927287462
237372310534768249 487208692
237372310534768249 487208692
237372310534768248 487208692
237372310534768250 487208692
3460997373778564 58830241
3460997373778564 58830241
3460997373...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #33:

score: 0
Accepted
time: 3ms
memory: 3624kb

input:

10000
416606181424037641 645450370
416606181424037641 645450370
416606181424037640 645450370
416606181424037642 645450370
44523302039757025 211005454
44523302039757025 211005454
44523302039757024 211005454
44523302039757026 211005454
4531094088813604 67313401
4531094088813604 67313401
45310940888136...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #34:

score: 0
Accepted
time: 3ms
memory: 3628kb

input:

10000
280462782463516900 529587369
280462782463516900 529587369
280462782463516899 529587369
280462782463516901 529587369
888085368122558596 942382813
888085368122558596 942382813
888085368122558595 942382813
888085368122558597 942382813
20041835557256100 141569189
20041835557256100 141569189
200418...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #35:

score: 0
Accepted
time: 3ms
memory: 3548kb

input:

10000
691683718135861504 831675247
691683718135861504 831675247
691683718135861503 831675247
691683718135861505 831675247
168021029336964489 409903682
168021029336964489 409903682
168021029336964488 409903682
168021029336964490 409903682
793267410280538449 890655606
793267410280538449 890655606
7932...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #36:

score: 0
Accepted
time: 3ms
memory: 3632kb

input:

10000
769298340479971600 877096539
769298340479971600 877096539
769298340479971599 877096539
769298340479971601 877096539
126077821013574544 355074387
126077821013574544 355074387
126077821013574543 355074387
126077821013574545 355074387
158476359885719236 398090893
158476359885719236 398090893
1584...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #37:

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

input:

10000
433160634036658801 658149400
433160634036658801 658149400
433160634036658800 658149400
433160634036658802 658149400
493411862398555489 702432816
493411862398555489 702432816
493411862398555488 702432816
493411862398555490 702432816
339298266301963609 582493146
339298266301963609 582493146
3392...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #38:

score: 0
Accepted
time: 3ms
memory: 3420kb

input:

10000
236298646573670464 486105591
236298646573670464 486105591
236298646573670463 486105591
236298646573670465 486105591
983383788113896464 991657091
983383788113896464 991657091
983383788113896463 991657091
983383788113896465 991657091
490113433164078361 700081018
490113433164078361 700081018
4901...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #39:

score: 0
Accepted
time: 3ms
memory: 3544kb

input:

10000
697986201598819225 835455684
697986201598819225 835455684
697986201598819224 835455684
697986201598819226 835455684
20391074027993124 142797317
20391074027993124 142797317
20391074027993123 142797317
20391074027993125 142797317
530655966125354161 728461368
530655966125354161 728461368
53065596...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #40:

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

input:

10000
395888941571037721 629197060
395888941571037721 629197060
395888941571037720 629197060
395888941571037722 629197060
541081549574991936 735582455
541081549574991936 735582455
541081549574991935 735582455
541081549574991937 735582455
265109996489295556 514888333
265109996489295556 514888333
2651...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #41:

score: 0
Accepted
time: 3ms
memory: 3548kb

input:

10000
195562167887533225 442224114
195562167887533225 442224114
195562167887533224 442224114
195562167887533226 442224114
221441587310246416 470575803
221441587310246416 470575803
221441587310246415 470575803
221441587310246417 470575803
296397154233216100 544423689
296397154233216100 544423689
2963...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #42:

score: 0
Accepted
time: 3ms
memory: 3420kb

input:

10000
211871413377806400 460294919
211871413377806400 460294919
211871413377806399 460294919
211871413377806401 460294919
30911923762972641 175817870
30911923762972641 175817870
30911923762972640 175817870
30911923762972642 175817870
344434995061364025 586885844
344434995061364025 586885844
34443499...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #43:

score: 0
Accepted
time: 3ms
memory: 3540kb

input:

10000
197649104602728025 444577444
197649104602728025 444577444
197649104602728024 444577444
197649104602728026 444577444
257886932439627481 507825690
257886932439627481 507825690
257886932439627480 507825690
257886932439627482 507825690
251641241145616 15863203
251641241145616 15863203
251641241145...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #44:

score: 0
Accepted
time: 3ms
memory: 3420kb

input:

10000
10178546938776225 100888784
10178546938776225 100888784
10178546938776224 100888784
10178546938776226 100888784
1041607590410916 32273945
1041607590410916 32273945
1041607590410915 32273945
1041607590410917 32273945
631293644746611025 794539894
631293644746611025 794539894
631293644746611024 7...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #45:

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

input:

10000
348121160081556624 590017931
348121160081556624 590017931
348121160081556623 590017931
348121160081556625 590017931
578754674498525625 760759274
578754674498525625 760759274
578754674498525624 760759274
578754674498525626 760759274
65243744665959601 255428550
65243744665959601 255428550
652437...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #46:

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

input:

10000
532655108761069009 729832246
532655108761069009 729832246
532655108761069008 729832246
532655108761069010 729832246
279028310525540416 528231303
279028310525540416 528231303
279028310525540415 528231303
279028310525540417 528231303
487911161503691641 698506378
487911161503691641 698506378
4879...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #47:

score: 0
Accepted
time: 3ms
memory: 3592kb

input:

10000
121534951274788689 348618632
121534951274788689 348618632
121534951274788688 348618632
121534951274788690 348618632
516263108265685225 718514514
516263108265685225 718514514
516263108265685224 718514514
516263108265685226 718514514
105761790609323641 325210378
105761790609323641 325210378
1057...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #48:

score: 0
Accepted
time: 3ms
memory: 3528kb

input:

10000
24433944045977664 156313607
24433944045977664 156313607
24433944045977663 156313607
24433944045977665 156313607
645825678843105601 803632800
645825678843105601 803632800
645825678843105600 803632800
645825678843105602 803632800
492773061941585296 701977963
492773061941585296 701977963
49277306...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #49:

score: 0
Accepted
time: 3ms
memory: 3632kb

input:

10000
4143960119465604 64373597
4143960119465604 64373597
4143960119465603 64373597
4143960119465605 64373597
56040968853548644 236729737
56040968853548644 236729737
56040968853548643 236729737
56040968853548645 236729737
628452741661512769 792750112
628452741661512769 792750112
628452741661512768 7...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #50:

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

input:

10000
421620703768906756 649323265
421620703768906756 649323265
421620703768906755 649323265
421620703768906757 649323265
218886940504774116 467853545
218886940504774116 467853545
218886940504774115 467853545
218886940504774117 467853545
99144710778345961 314872530
99144710778345961 314872530
991447...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines

Test #51:

score: 0
Accepted
time: 3ms
memory: 3420kb

input:

10000
966000623080836249 982853306
966000623080836249 982853306
966000623080836248 982853306
966000623080836250 982853306
37869835265010225 194601734
37869835265010225 194601734
37869835265010224 194601734
37869835265010226 194601734
316166718725683849 562287042
316166718725683849 562287042
31616671...

output:

2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
...

result:

ok 10000 lines