QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#103708#6406. Stage ClearmaspyAC ✓1844ms265440kbC++2018.4kb2023-05-07 12:18:092024-08-15 21:05:19

Judging History

This is the latest submission verdict.

  • [2024-08-15 21:05:19]
  • 自动重测本题所有获得100分的提交记录
  • Verdict: AC
  • Time: 1844ms
  • Memory: 265440kb
  • [2024-08-15 21:05:17]
  • hack成功,自动添加数据
  • (/hack/778)
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-07 12:18:13]
  • Judged
  • Verdict: 100
  • Time: 2088ms
  • Memory: 265356kb
  • [2023-05-07 12:18:09]
  • Submitted

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 1 "library/enumerate/product.hpp"
// [0, A0) x [0, A1) x ...
template <typename F>
void enumerate_product(vc<int> A, F query) {
  int N = len(A);
  auto dfs = [&](auto& dfs, vc<int>& p) -> void {
    int n = len(p);
    if (n == N) return query(p);
    FOR(x, A[n]) {
      p.eb(x);
      dfs(dfs, p);
      p.pop_back();
    }
  };
  vc<int> p;
  dfs(dfs, p);
}
#line 1 "library/enumerate/bits.hpp"
template <typename F>
void enumerate_bits_32(u32 s, F f) {
  while (s) {
    int i = __builtin_ctz(s);
    f(i);
    s ^= 1 << i;
  }
}

template <typename F>
void enumerate_bits_64(u64 s, F f) {
  while (s) {
    int i = __builtin_ctzll(s);
    f(i);
    s ^= u64(1) << i;
  }
}

template <typename BS, typename F>
void enumerate_bits_bitset(BS& b, int L, int R, F f) {
  int p = (b[L] ? L : b._Find_next(L));
  while (p < R) {
    f(p);
    p = b._Find_next(p);
  }
}
#line 2 "library/ds/unionfind/unionfind.hpp"

struct UnionFind {
  int n, n_comp;
  vc<int> dat; // par or (-size)
  UnionFind(int n = 0) { build(n); }

  void build(int m) {
    n = m, n_comp = m;
    dat.assign(n, -1);
  }

  void reset() { build(n); }

  int operator[](int x) {
    while (dat[x] >= 0) {
      int pp = dat[dat[x]];
      if (pp < 0) { return dat[x]; }
      x = dat[x] = pp;
    }
    return x;
  }

  ll size(int x) {
    assert(dat[x] < 0);
    return -dat[x];
  }

  bool merge(int x, int y) {
    x = (*this)[x], y = (*this)[y];
    if (x == y) return false;
    if (-dat[x] < -dat[y]) swap(x, y);
    dat[x] += dat[y], dat[y] = x, n_comp--;
    return true;
  }
};
#line 2 "library/random/base.hpp"

u64 RNG_64() {
  static uint64_t x_
      = uint64_t(chrono::duration_cast<chrono::nanoseconds>(
                     chrono::high_resolution_clock::now().time_since_epoch())
                     .count())
        * 10150724397891781847ULL;
  x_ ^= x_ << 7;
  return x_ ^= x_ >> 9;
}

u64 RNG(u64 lim) { return RNG_64() % lim; }

ll RNG(ll l, ll r) { return l + RNG_64() % (r - l); }
#line 7 "main.cpp"

const int THRESH = 26;

template <typename COMP, typename GEN>
void check_compare_function(COMP comp, GEN gen, int iter) {
  FOR(iter) {
    auto x = gen(), y = gen(), z = gen();
    if (comp(x, x)) { print("comp(x,x)", x); }
    if (comp(x, y) && comp(y, x)) { print("comp(x,y) && comp(y,x)", x, y); }
    if (comp(x, y) && comp(y, z) && !comp(x, z)) {
      print("comp(x,y) && comp(y,z) && !comp(x,z)", x, y, z);
    }
  }
}

void solve() {
  LL(N, M);
  VEC(pi, AB, N - 1);
  AB.insert(AB.begin(), pi{0, 0});
  vvc<int> FRM(N);
  FOR(M) {
    INT(a, b);
    FRM[--b].eb(--a);
  }
  FRM[0].eb(-1);

  if (N <= THRESH) {
    vc<u32> nxt(N);
    FOR(v, 1, N) for (auto&& frm: FRM[v]) nxt[frm] |= u32(1) << v;
    u32 full = 0;
    FOR(i, N) full |= u32(1) << i;
    vi dp(1 << (N - 1), infty<ll>);
    dp[0] = 0;
    FOR(s, 1 << (N - 1)) {
      ll sm = 0;
      u32 can = 0;
      enumerate_bits_32(2 * s | 1, [&](int i) -> void {
        auto [a, b] = AB[i];
        sm += -a + b;
        can |= nxt[i];
      });
      enumerate_bits_32(can & (full - 2 * s), [&](int to) -> void {
        u32 t = s | u32(1) << (to - 1);
        assert(s < t);
        ll x = dp[s];
        auto [a, b] = AB[to];
        x += max<ll>(a - sm - x, 0);
        chmin(dp[t], x);
      });
    }
    return print(dp.back());
  }

  assert(N > THRESH);

  vc<int> cnt(N);
  FOR(i, N) cnt[i] = len(FRM[i]);
  ll ANS = infty<ll>;

  auto merge = [&](pi p, pi q) -> pi {
    auto [a, b] = p;
    auto [c, d] = q;
    ll sm = b + d - a - c;
    ll x = max(a, a - b + c);
    return {x, sm + x};
  };
  auto comp = [&](pi a, pi b) -> bool {
    bool pa = a.fi <= a.se, pb = b.fi <= b.se;
    if (pa && pb) return (a.fi != b.fi ? a.fi < b.fi : a.se < b.se);
    if (pa && !pb) return true;
    if (!pa && pb) return false;
    return (a.se != b.se ? a.se > b.se : a.fi < b.fi);
  };

  enumerate_product(cnt, [&](vc<int> ord) -> void {
    vc<int> par(N);
    FOR(v, N) par[v] = FRM[v][ord[v]];

    using T = pair<pi, int>;
    auto comp3 = [&](T a, T b) -> bool {
      if (a.fi == b.fi) return a.se < b.se;
      return !comp(a.fi, b.fi);
    };

    vc<pi> dat = AB;

    priority_queue<T, vc<T>, decltype(comp3)> que(comp3);
    priority_queue<T, vc<T>, decltype(comp3)> rm_que(comp3);
    FOR(v, 1, N) que.emplace(dat[v], v);
    UnionFind uf(N);
    vc<int> root(N);
    FOR(v, N) root[v] = v;
    while (len(que)) {
      auto [x, v] = que.top();
      que.pop();
      assert(root[v] == v);
      int p = root[uf[par[v]]];
      if (p > 0) rm_que.emplace(dat[p], p);
      dat[p] = merge(dat[p], dat[v]);
      if (p > 0) que.emplace(dat[p], p);
      uf.merge(v, p);
      root[uf[v]] = p;
      while (len(rm_que) && que.top() == rm_que.top()) rm_que.pop(), que.pop();
    }
    chmin(ANS, dat[0].fi);
  });

  print(ANS);
}

signed main() {
  solve();
  return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

4

result:

ok 1 number(s): "4"

Test #2:

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

input:

15 14
254040392438309 117083115436273
500005748229691 557255157630172
821034233718230 865199673774998
659892147898798 987564141425694
81172575487567 811635577877255
751768357864605 341103322647288
454926350150218 140191090713900
921608121471585 659295670987251
223751724062143 505619245326640
8907765...

output:

1665396301509143

result:

ok 1 number(s): "1665396301509143"

Test #3:

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

input:

18 17
636830992776530 847574431876821
330869946457865 78274534165482
450581372553540 11565219334965
8736347226844 17186323694285
870805093198860 559070167736042
674369178493171 930151818400874
641605209598997 222521062460239
450936030349531 469197172169023
831295459816974 626096008793091
53095460351...

output:

2375957544280218

result:

ok 1 number(s): "2375957544280218"

Test #4:

score: 0
Accepted
time: 19ms
memory: 7396kb

input:

20 19
539893468691183 767805205447882
240338186903141 960937349402327
942645580569365 896509929612645
542601575005817 191461109090531
540992546866047 765080044816119
904535155855114 858111921213175
452499200048240 115895143306864
983856946412026 838504718536099
586421298181479 265212699386882
677124...

output:

800919806038419

result:

ok 1 number(s): "800919806038419"

Test #5:

score: 0
Accepted
time: 325ms
memory: 68632kb

input:

24 23
114281007218527 308690671179962
145951034437731 718976086594208
709172151907814 926071954787084
224496444610281 498657753059525
874422017133378 857676356343078
532175866197017 818525693672607
303837639402605 374469705563954
512244364294540 952911486867703
748959419417502 249992707230361
512696...

output:

114281007218527

result:

ok 1 number(s): "114281007218527"

Test #6:

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

input:

36 35
389328367777319 678636570542258
32216944647452 612585362150577
891592845704885 596030605892036
688825276167602 461516360471825
916552899998310 106733202183953
400050408958777 670724326933521
995792861502757 894514508573875
14511185222713 612305257166443
175168368096281 508263855969282
85578802...

output:

171942144116875

result:

ok 1 number(s): "171942144116875"

Test #7:

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

input:

36 35
759037289890767 849577210686635
16379509883489 441829377955433
589378488455351 990818352083122
871208015900506 727359003875494
207852561142533 28766987248469
81321183353129 892618157632070
198487099788393 519364502513651
83942803274015 988821788304459
868185445880277 269956013388079
3834515054...

output:

759037289890767

result:

ok 1 number(s): "759037289890767"

Test #8:

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

input:

36 35
100792831728257 823656493168793
866936535786311 187861146327778
132998929717538 605906559206892
3319598846477 393401056223733
964444786730964 932398059281618
925176496607384 148825907337833
985037559482190 646827297289525
469876125353024 641923164294854
453796287874442 291205025001534
72806942...

output:

1397699717661157

result:

ok 1 number(s): "1397699717661157"

Test #9:

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

input:

36 36
245996406159980 462974248377488
839352152971124 40282565369163
572695144110271 507726167903341
671102350267895 18090181781241
643724978558334 551787913319524
936340565446887 517649577919257
158127116487034 175750969611510
396852573858996 670814068366285
534702788102341 124550558279140
69441153...

output:

2508008255775889

result:

ok 1 number(s): "2508008255775889"

Test #10:

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

input:

34 38
656738239290510 319959252044415
760511943177376 828562698756504
470087249708484 441916827764162
105399930988058 761192720347117
81742549616394 195819875734286
782982110569406 72384154665629
647269989285797 720280547207448
531182311814386 160821851115134
292963780645658 871789628567253
74499577...

output:

656738239290510

result:

ok 1 number(s): "656738239290510"

Test #11:

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

input:

32 40
818105834607446 689904077664886
717146597564762 686987602224041
538827104521875 147060924732538
604913134601443 802546720879673
45376965619246 480061093729529
686039951678173 889398415870480
374408509732957 354006189233817
103818950629279 863526642478066
719174876808085 130061851080766
9744074...

output:

2289520618562758

result:

ok 1 number(s): "2289520618562758"

Test #12:

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

input:

30 42
730678486091139 762413502107242
564137648972911 492217680357057
677122869459914 634406715345550
766223620461328 750896882727596
34139073751269 875301336250330
948602995486093 589201509496124
333847023521138 673322700954330
774661538057122 360743409997856
301647343463502 78371781314140
44979585...

output:

2296677982487339

result:

ok 1 number(s): "2296677982487339"

Test #13:

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

input:

28 44
996216744822715 15265122654307
591377215147374 392892022614182
134817686923570 666778840251745
603108267679560 939679039946396
792878600465606 943254465658609
705582931165204 626247204621328
833947774992752 802610518921019
60510220659563 935537906466250
900509663884138 957082020010408
38517385...

output:

1021065751521024

result:

ok 1 number(s): "1021065751521024"

Test #14:

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

input:

27 45
271265179156100 385209948242010
548010795825703 286502371912374
203557541769729 336737491323929
32253800857105 902537647325928
835008409588714 227495683621084
573457473959732 478446911624066
447407603972649 401150715116732
597962487418392 594931676764990
326718612562917 293848561935121
6497688...

output:

271265179156100

result:

ok 1 number(s): "271265179156100"

Test #15:

score: 0
Accepted
time: 1839ms
memory: 265276kb

input:

26 46
511128167626061 755154773895250
469460004382432 144928349121735
272299544034000 41881588292305
453271611317466 830211882616629
877138218711823 441367083696839
476515315035731 252150151731957
174547198161633 921197665643069
56919360991429 297636468095153
717743189152864 552120784448634
95767590...

output:

511128167626061

result:

ok 1 number(s): "511128167626061"

Test #16:

score: 0
Accepted
time: 919ms
memory: 134384kb

input:

25 47
483175861091928 628662160345159
414348784525954 991346283769736
118134342611258 254055400216860
367817156249062 195226919472367
228751017881407 501458690109441
595787759089619 364958390117603
758404493344385 423811540220990
373421064986368 503851495028044
645521325517401 846860937023068
696132...

output:

433844295661451

result:

ok 1 number(s): "433844295661451"

Test #17:

score: 0
Accepted
time: 442ms
memory: 68548kb

input:

24 48
585069488201283 197610097667134
308270082266799 808583330722288
557830556971222 120690636824478
35599907670481 819914971288051
829534742813930 120848544147347
606952901638178 768967506529684
782628839276718 874238745648127
300397513492341 497558026945107
804922145123731 680206470300674
6976592...

output:

308270082266799

result:

ok 1 number(s): "308270082266799"

Test #18:

score: 0
Accepted
time: 95ms
memory: 19660kb

input:

22 50
263626616368674 621403432100399
205992448402675 530375039808909
713311017185345 512666135865696
98177241911216 239357547305336
958069323825513 67526585039598
167011099703449 27907032353436
450240530654192 706870876965792
690862186234915 405560181003741
18305076367979 434288631592058
2040128611...

output:

205992448402675

result:

ok 1 number(s): "205992448402675"

Test #19:

score: 0
Accepted
time: 21ms
memory: 7280kb

input:

20 52
975090006577788 801607726815766
84021986863902 176019568163775
33212494351022 557726461236616
412670490881035 171242243090013
5963358074583 814694975209648
727321559408120 470824240668916
517979548077593 380688272528419
111042754309162 470362460253753
261749697831900 173917705785526
7629533862...

output:

84021986863902

result:

ok 1 number(s): "84021986863902"

Test #20:

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

input:

18 54
189279872302549 253462459097101
970052803238801 70690425994748
748182832410340 900454936920101
461133559455077 21855992163077
331483449573694 323350930734446
706088561801647 138174738356485
393662591863692 483667366492868
786416692433338 336160844825462
593801741696439 741382094229566
74860376...

output:

3169539405883373

result:

ok 1 number(s): "3169539405883373"

Test #21:

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

input:

16 56
395342015310127 775685935556101
934577939024901 965361283792952
576834009420570 129503647328961
544782073827006 837284295438253
727371211508645 718326047275565
641544543098215 727030916600087
304530007771390 508152141046117
496976076388171 88278390380724
847359466084241 230351089520581
3857288...

output:

1347938772919751

result:

ok 1 number(s): "1347938772919751"

Test #22:

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

input:

13 59
462049122847001 379819318643195
906994629984306 817782702834337
16530223780534 109817575436611
212564825248425 461973420995760
441834701715792 337715901313471
617525313590710 209535426197959
442435192654635 37074739626278
388768152805311 117169294452155
41944657812171 28512250709355
3872542920...

output:

119277473592348

result:

ok 1 number(s): "119277473592348"

Test #23:

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

input:

32 40
378399574707502 124158745794613
757495231509323 219929822776362
23848097920043 150433648754718
89027690774330 779645256050635
561907039859750 609241299826157
763643565846881 888507632657093
676333558739618 640176398893719
71406433730404 424845408152620
798830911154534 473380124569425
633777571...

output:

822140162613756

result:

ok 1 number(s): "822140162613756"

Test #24:

score: 0
Accepted
time: 9ms
memory: 3644kb

input:

30 42
727583199647302 899249515493018
824090068816978 76007172563392
363024240077233 850438221628153
116359591692923 853281819729394
30058530056444 451301982541902
257660265949748 13377896646178
663971991464535 131134512531065
157395062362446 37580106788817
319094964254516 820617709636764
1504315319...

output:

501974519873235

result:

ok 1 number(s): "501974519873235"

Test #25:

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

input:

30 42
369260360694270 102056318890914
748491825980791 78813132950858
954070327995137 432356970729848
350635553708712 691146527864719
294293282115372 475494513261924
888038522270337 103810618966978
113783109472848 809679509781223
837753634194548 568343084457732
919145501514622 341839377646785
5331973...

output:

1549961271972830

result:

ok 1 number(s): "1549961271972830"

Test #26:

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

input:

27 45
819114038925000 120254131272485
104179695468842 921918040684848
746447605230839 27295948036099
986064794301025 488949445854444
234655178368316 80833846135201
919985230880643 628120598515383
196387855735763 424772227837484
131469466148846 89448230360542
403974409238330 13826215541265
6944769649...

output:

819114038925000

result:

ok 1 number(s): "819114038925000"

Test #27:

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

input:

27 45
486496070101292 615597109349036
242572807341486 639449514382537
377052935256294 551281267552890
40515117640598 407260163013031
405708189500053 766515180186126
483209839402832 362312036386239
532925852053573 493806909782433
696724944982406 733419216410091
60505679723836 533368236070572
11723652...

output:

242572807341486

result:

ok 1 number(s): "242572807341486"

Test #28:

score: 0
Accepted
time: 1760ms
memory: 265304kb

input:

26 46
453718434413073 553397640961890
150619756399004 630260113021239
420562810047600 640552759162041
13296127747875 632471460306683
77074282416426 729821456755890
716966018482019 933374142866615
788537379821196 337442301680265
592445203074505 472078597445832
688056655927586 685777876573115
93009595...

output:

150619756399004

result:

ok 1 number(s): "150619756399004"

Test #29:

score: 0
Accepted
time: 1658ms
memory: 265256kb

input:

26 46
58175650161464 42271857470481
470798493732803 957941605443488
422744095940059 108786907923757
956120077112935 880056937358567
141334402731044 765692212925074
281492906357796 931625701488132
873804234821197 229067678553001
381876791746006 492332722216193
812525232730573 209319517737245
13596589...

output:

58175650161464

result:

ok 1 number(s): "58175650161464"

Test #30:

score: 0
Accepted
time: 822ms
memory: 134344kb

input:

25 47
828420043451914 23238564513072
697852262104269 282962592679943
11641622610262 875935569794851
700951527948597 388158600069851
670930822274257 412137048360986
620516084451297 398117269577950
141395806409204 787408902235324
486108629647082 495272150546778
600334776708984 977561962353395
20865789...

output:

1237959652558927

result:

ok 1 number(s): "1237959652558927"

Test #31:

score: 0
Accepted
time: 848ms
memory: 134224kb

input:

25 47
899428122989338 145899041295597
222881474387355 567396721892960
575835915985374 936155770553948
827654190821346 987307978499644
718341345091272 127093962829633
986836218775381 333226666595599
304220802797171 857497097818156
808973011582896 646782097895557
468853452093373 995220967981033
673952...

output:

222881474387355

result:

ok 1 number(s): "222881474387355"

Test #32:

score: 0
Accepted
time: 21ms
memory: 7176kb

input:

20 52
632260641570555 458297297435212
811156594450074 396457920718786
828263304935855 598595529361630
494991655931244 565522700362647
637615228409302 53103708098168
282478952695367 559572457996575
283996296745450 136755148534977
311987900253249 916264279266468
127568654657954 419757804830372
1708998...

output:

1857245089696723

result:

ok 1 number(s): "1857245089696723"

Test #33:

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

input:

15 57
246045112915803 655156218208647
705418683694813 693501915791545
566584169060430 510070696716134
250578771535460 225895985907743
333447992843769 890301019152478
84932311613578 109581086444286
661795095725753 737789845693119
701638652385996 314265702790340
193866121765676 448306478072597
9012598...

output:

605304227530846

result:

ok 1 number(s): "605304227530846"

Test #34:

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

input:

13 59
693204042546316 810185778594521
577525994704226 715733166899945
143330503316974 422966459358241
971725930037503 176570841054548
86003143095734 958285835119465
1598110351366 843161843630556
864558845987130 616058236912443
616184515207279 183019603196329
538466547766038 827543523288927
308731090...

output:

1598110351366

result:

ok 1 number(s): "1598110351366"

Test #35:

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

input:

12 60
686900984655521 360414706539893
564707323239259 156422972125429
177275901374697 340280191229025
353147113772471 696217870144290
232816449731091 475738298171206
379431990659762 331837831277566
271071520158508 717200993828896
442174414532731 64467307038885
556024119489408 326171436618540
9234337...

output:

303548940354760

result:

ok 1 number(s): "303548940354760"

Test #36:

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

input:

29 42
775040437393962 341248169572722
986673473366420 634123558200586
924986853178078 748471027022825
220163146224574 731581874814033
385709535495598 952817310574349
68544084339822 938274652091880
915849278438528 969841130480180
882948261552555 194219121621828
680383071366521 407035944045810
1242317...

output:

1613126307696715

result:

ok 1 number(s): "1613126307696715"

Test #37:

score: 0
Accepted
time: 25ms
memory: 3856kb

input:

29 42
280442758337323 964044615740258
856866854977356 428408249755903
451422599196949 450802876808564
486192252911295 812853895201934
151394499276980 305012731719696
693398562780693 713840288945199
994225486768439 619173751456789
662938189816865 358038644211298
670267820893456 657698170464678
255707...

output:

98218787477468

result:

ok 1 number(s): "98218787477468"

Test #38:

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

input:

29 42
813796312105760 783703493344605
825483551250787 411458305042996
210518939857124 940960914571445
802491442577588 721287110936336
486970196961161 597114398936025
277475990353469 455092006856839
602426312673869 922882210485238
91242041997403 429325052593381
732377655248557 535122703672441
7524076...

output:

91242041997403

result:

ok 1 number(s): "91242041997403"

Test #39:

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

input:

18 45
594247067382505 846814583019333
695621534604244 985672506912825
805694540689387 313251415429368
532850454497918 765416664994713
181104130849203 198365592245958
805389383644932 82856277036608
443127561088956 170757175173976
408684236987774 331033738634615
183655725543102 44056078830231
37396744...

output:

1854803359120378

result:

ok 1 number(s): "1854803359120378"

Test #40:

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

input:

18 45
869295501683122 216758334865213
652256188991629 879281782469194
909620915108026 939897971728304
918684966644039 728275272407013
223235013714136 447422438119601
673262852664867 935054910264754
91771762124917 725987424014553
867640036818987 955242063037163
609865747963705 267141781771265
6033780...

output:

652256188991629

result:

ok 1 number(s): "652256188991629"

Test #41:

score: 0
Accepted
time: 19ms
memory: 7160kb

input:

20 51
850852297008974 136990182210865
526540057315305 726761299391799
366501824744074 789658309917152
531044513801444 902550057803260
928606839470155 618247943078078
824933436873786 898200458907711
902665752574159 654544803208186
400560952881482 438229374678863
364992660102802 906259546106881
635869...

output:

366501824744074

result:

ok 1 number(s): "366501824744074"

Test #42:

score: 0
Accepted
time: 19ms
memory: 7372kb

input:

20 51
211052117262437 190837617314603
502812141185395 554944806663875
418056984281381 590171624682730
50795475880954 359132952666421
944642867180966 351052436410927
473807144822162 226445958317525
843137849729881 853450218823195
253573358897996 686837758438758
116981196837615 323575165473552
9128115...

output:

211052117262437

result:

ok 1 number(s): "211052117262437"

Test #43:

score: 0
Accepted
time: 23ms
memory: 7328kb

input:

20 51
813390888614857 858217844080423
463537282351056 536934353385419
452427448575373 442742062537798
782961502239583 379809952932699
961644984109369 418741513614116
982175411110178 152546885544335
189114387054517 652721927501019
543955539680419 481350808402976
386925553797932 48798319024068
8029399...

output:

2241571410196649

result:

ok 1 number(s): "2241571410196649"

Test #44:

score: 0
Accepted
time: 85ms
memory: 19532kb

input:

22 40
155146430452348 867481498618645
357403181834422 212596303838277
996047889870328 14520322339199
915073085218322 2540984216747
683052837608968 322371511905442
826030724364433 452064582572466
940480474692250 701690402865693
929888861726660 99266738529946
937352023768802 105230629017299
3897264743...

output:

2165047081298470

result:

ok 1 number(s): "2165047081298470"

Test #45:

score: 0
Accepted
time: 180ms
memory: 35924kb

input:

23 42
231364787300087 588708086746379
294400406804638 101263677243097
195653278943483 553925383492581
245485466842253 479800879411722
716090982280949 166176103505671
912905028197752 671225563411201
297297853350273 656556506061566
994788055405340 212755842689899
959285991205755 169274008814231
720471...

output:

3777510754010355

result:

ok 1 number(s): "3777510754010355"

Test #46:

score: 0
Accepted
time: 383ms
memory: 68648kb

input:

24 44
175460174231822 265351968083189
184176893317089 758915174417499
773645258241486 978274081149051
31266609284773 52841240526208
419317654329174 137495179000186
221816512966775 888716464916189
429825924110530 618474307895041
671101410750355 738865661732000
736345797039982 802066408769115
16220258...

output:

175460174231822

result:

ok 1 number(s): "175460174231822"

Test #47:

score: 0
Accepted
time: 369ms
memory: 68620kb

input:

24 44
708813727967491 85010845687536
74298196437495 741966303446415
454245132006813 468431045202875
461244490451098 847592543502338
754893352013355 429597919991107
727398547353759 629968182860597
38025676306904 808503001648865
134589635019726 696470157388579
833638929774859 714676387807533
737397350...

output:

1215929729344722

result:

ok 1 number(s): "1215929729344722"

Test #48:

score: 0
Accepted
time: 781ms
memory: 134196kb

input:

25 46
60080519148615 176183333177565
46425468980888 410563187165748
722591449635183 677793683719385
177491384188382 287711046044077
830061305841213 557642655811988
603652000795814 701327796960247
51614978750839 361911448556867
736941095358931 477479680757096
246597473801760 80300863698523
3408635072...

output:

46425468980888

result:

ok 1 number(s): "46425468980888"

Test #49:

score: 0
Accepted
time: 773ms
memory: 134196kb

input:

25 46
593434072884284 995843284523737
936545698359470 358428870364009
438376769198397 167951721515034
458605128056788 196143188036655
130452631436562 920114140947805
222913800457421 442579514839119
581320411503245 551940142310691
200429319628301 470270696018923
343890606536637 957726470648109
916059...

output:

593434072884284

result:

ok 1 number(s): "593434072884284"

Test #50:

score: 0
Accepted
time: 784ms
memory: 134276kb

input:

25 46
101113430165697 897410995047123
948236174411391 299230560603337
843701445588082 252383116961599
394224000570457 800155313295116
863099450513195 358135152606202
760893975064973 34168543008071
373247985320029 360086425366052
837024661093675 669465251779129
347026834424506 144344243528222
7852878...

output:

2429245279767893

result:

ok 1 number(s): "2429245279767893"

Test #51:

score: 0
Accepted
time: 1759ms
memory: 265432kb

input:

26 46
330402009473496 249937889483976
61345132871274 379275200647275
938773345466421 696022292976167
159071519490956 519691077593980
527933372379465 137900164414770
690922430113097 244064388967891
266265544121578 721196095531055
930237124789652 487808342452694
749990226125613 129921843192225
1973741...

output:

2738903040336365

result:

ok 1 number(s): "2738903040336365"

Test #52:

score: 0
Accepted
time: 1840ms
memory: 265396kb

input:

26 46
975158292178504 790824428990648
966960127856744 137312864097332
783795309925126 760768690239438
727287697628157 713206882579293
975042607921420 265679774255969
318564214196824 204477087685499
117603983443175 901275264569584
423440170583334 567030738695466
834031880466788 114700777261112
872728...

output:

2460098374349460

result:

ok 1 number(s): "2460098374349460"

Test #53:

score: 0
Accepted
time: 1844ms
memory: 265440kb

input:

26 46
508511845946941 610483306562228
935575750388351 85179621037417
578073875157716 250925654326030
43586887261682 543144705160671
275435007258593 557782515279658
824146248616575 980913177718739
690620437292541 204983723565265
922112766908768 559819606440878
931325013168897 956942012089098
41274014...

output:

179586106473921

result:

ok 1 number(s): "179586106473921"

Test #54:

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

input:

36 36
265390324840522 981391526521679
59755335485787 560614258236702
858771905281187 586301373791191
525390894918919 834201926923069
963139736974738 740621823191032
145220624780272 422821531879956
793054482737908 853608109520767
582304204524819 112786292125327
398947287545574 784658996613241
5868615...

output:

59755335485787

result:

ok 1 number(s): "59755335485787"

Test #55:

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

input:

36 36
306423235824837 702619188424004
961567114658114 449281631641523
979882974943142 239386200186429
812492255445890 311462895794333
996177881646719 505929947896414
267279300702424 641981438976867
114687489339866 773288766918752
725698791356523 191091024163679
385696882926464 848701302701117
882420...

output:

583687022343975

result:

ok 1 number(s): "583687022343975"

Test #56:

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

input:

36 36
770792645783883 604187972689215
973259738160915 390083321880851
385207651300059 288633223544162
791420001572872 993970414205818
693639254892696 14320777441531
883754868462999 198386095056986
906616136898475 502941804271969
440788452233097 425469952012716
345522089750140 35320149257518
75165011...

output:

4007685041883699

result:

ok 1 number(s): "4007685041883699"

Test #57:

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

input:

36 36
3 4
7 7
9 6
876680932998017 897839560302902
572881571507850 577202589448494
953856943022759 989765778855270
897839560302902 904375790039373
848880482878050 876680932998017
577202589448494 641067493891000
117146848445101 124202533407936
989765778855270 996863378865083
998633100404696 1000000000...

output:

23645423995458

result:

ok 1 number(s): "23645423995458"

Test #58:

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

input:

36 36
2 9
1 5
6 1
801137072250929 836419312424703
345010389109738 369836736859468
836419312424703 883576736875016
972460325208472 978666882290059
560164931958050 586449345931697
208328815630156 232085702062050
681084334607525 688831143202755
883576736875016 972460325208472
674810708829848 6810843346...

output:

86345315185140

result:

ok 1 number(s): "86345315185140"

Test #59:

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

input:

36 36
1 1
6 8
4 10
844012573893511 871007285165176
727058509559764 740386302772830
357811504028775 368530736787568
690925176024113 704962935895143
464227592193233 529475640438910
459408820770528 464227592193233
894442534808484 903989836254421
276998730370972 357811504028775
983030074666336 985685416...

output:

5365160898014

result:

ok 1 number(s): "5365160898014"

Test #60:

score: 0
Accepted
time: 23ms
memory: 7140kb

input:

20 51
357451582777216 997904818117754
140470316932369 162838043478121
74603851558269 115270511619778
149935332201362 357451582777216
183342126309039 242992837079353
162838043478121 170973778094011
432963271512564 507260347364889
170973778094011 183342126309039
518466337486082 551651707458793
9979048...

output:

99803656870860

result:

ok 1 number(s): "99803656870860"

Test #61:

score: 0
Accepted
time: 22ms
memory: 7160kb

input:

20 51
193405974300400 51677996520731
96899418770542 106986733377212
193658078621940 256887288792041
256887288792041 261971698431788
261971698431788 342655415551794
438650290771626 474222355458260
625414187061339 673806165892941
474222355458260 575781664430106
342655415551794 438650290771626
72703695...

output:

235164852769746

result:

ok 1 number(s): "235164852769746"

Test #62:

score: 0
Accepted
time: 23ms
memory: 7304kb

input:

20 51
147628302403879 188126787409101
188126787409101 28301431814293
110934405626363 124182236868774
28301431814293 39235483361939
322823841461225 358796731942554
289624984221841 322823841461225
358796731942554 382683283696034
722607278447022 802144279574888
802144279574888 821414098447368
903080364...

output:

224944616426562

result:

ok 1 number(s): "224944616426562"

Test #63:

score: 0
Accepted
time: 178ms
memory: 35924kb

input:

23 42
452820142154732 502106831971632
502106831971632 102491707512693
102491707512693 111451875792058
462017547243623 452820142154732
111451875792058 191780217291648
267235792647203 273048719461706
373756303379246 467800594958165
203457139684630 267235792647203
191780217291648 203457139684630
273048...

output:

452820142154732

result:

ok 1 number(s): "452820142154732"

Test #64:

score: 0
Accepted
time: 183ms
memory: 36076kb

input:

23 42
686911003534861 556257620660154
55329199661291 178769883663780
556257620660154 55329199661291
204364844436002 225238303156938
110892328966590 686911003534861
225238303156938 237753318502064
178769883663780 204364844436002
299305015208078 301122210165749
237753318502064 299305015208078
63005506...

output:

80924160433513

result:

ok 1 number(s): "80924160433513"

Test #65:

score: 0
Accepted
time: 377ms
memory: 68652kb

input:

24 44
113958433735448 156041739334674
91963777859270 115638289342413
115638289342413 150208369484374
150208369484374 188513767651778
211772940362015 240291595560574
244778960583906 296304051428844
296304051428844 387782675836989
387782675836989 430562871290388
430562871290388 437440035945106
2402915...

output:

116505852413860

result:

ok 1 number(s): "116505852413860"

Test #66:

score: 0
Accepted
time: 372ms
memory: 68644kb

input:

24 44
991334731479676 740178845280853
48625596663952 73187661695119
76254041735907 197078280440967
197078280440967 205360210401866
192702187136272 991334731479676
205360210401866 288991289989795
740178845280853 48625596663952
349393343527515 364167433669972
288991289989795 349393343527515
3641674336...

output:

51691976704740

result:

ok 1 number(s): "51691976704740"

Test #67:

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

input:

25 46
648223131466768 794894168464622
968146390830673 648223131466768
794894168464622 2277682231567
2277682231567 21495088710685
21495088710685 86793450376374
86793450376374 127349301410574
197810132795110 301470225685954
301470225685954 351109775443404
351109775443404 355015492984716
35501549298471...

output:

648223131466768

result:

ok 1 number(s): "648223131466768"

Test #68:

score: 0
Accepted
time: 779ms
memory: 134256kb

input:

25 46
983753369813681 148323882938382
291193271779992 16956197044704
148323882938382 291193271779992
70502444501445 144378890334606
242310457337899 269128037045913
269128037045913 329331111947391
144378890334606 242310457337899
58810868773094 70502444501445
467812526809518 527222944638238
5272229446...

output:

348684511840509

result:

ok 1 number(s): "348684511840509"

Extra Test:

score: 0
Extra Test Passed