QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#852837#9738. Make It Divisibleucup-team5243#AC ✓149ms19256kbC++2320.2kb2025-01-11 14:20:392025-01-11 14:20:40

Judging History

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

  • [2025-01-11 14:20:40]
  • 评测
  • 测评结果:AC
  • 用时:149ms
  • 内存:19256kb
  • [2025-01-11 14:20:39]
  • 提交

answer

//line 1 "answer.cpp"
#if !__INCLUDE_LEVEL__
#include __FILE__
ll op(ll x, ll y) {return gcd(x, y);}
ll e() {return 0;}
int solve() {
    ll n,k; input(n, k);
    vl a(n); input(a);
    vl d(n-1);
    auto check_allsame = [&] (vl a) -> bool {
        sort(all(a));
        return a[0] == a[sz(a)-1];
    };
    if (check_allsame(a)) {
        ll total = k * (k + 1) / 2;
        return print(k, total);
    }
    rep(i, n-1) { d[i] = abs(a[i+1] - a[i]); }
    segtree<ll, op, e> seg(d);
    ll g = seg.all_prod();
    auto minseg = seg_min<ll>(a);
    auto maxseg = seg_max<ll>(a);
    ll cnt = 0;
    ll total = 0;
    vector<pair<ll, ll>> conditions;
    auto check = [&] (auto self, ll l, ll r) -> void {
        debug(l, r);
        if (r - l <= 1) return;
        if (minseg.prod(l, r) == maxseg.prod(l, r)) return;
        ll mn = minseg.prod(l, r);
        ll p = minseg.max_right(l, [&](ll x) -> bool { return x > mn;});
        ll g = seg.prod(l, r-1);
        conditions.emplace_back(g, mn);
        self(self, l, p);
        self(self, p+1, r);
        // if (g % (mn + x) != 0) return false;
        // if (!self(self, l, p)) return false;
        // if (!self(self, p+1, r)) return false;
        return;
    };
    check(check, 0, n);
    repe(dv, divisor(g)) {
        ll x = dv - minseg.all_prod();
        if (x < 1 || k < x) continue;
        bool ok = true;
        for (auto [g, mn] : conditions) {
            if (g % (mn + x)!= 0) {
                ok = false;
                break;
            }
        }
        if (ok) {
            cnt++;
            total += x;
        }
        // if (check(check, 0, n)) {
        //     cnt++;
        //     total += x;
        // }
    }
    print(cnt, total);
    return 0;
}
int main() {
    ll t; input(t);
    rep(t) solve();
}
#else
//line 2 "/home/seekworser/.cpp_lib/competitive_library/competitive/std/std.hpp"
#include <bits/stdc++.h>
#ifndef LOCAL_TEST
#pragma GCC target ("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif // LOCAL_TEST
using namespace std;
// 型名の短縮
using ll = long long;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using vi = vector<int>;  using vvi = vector<vi>; using vvvi = vector<vvi>;
using vl = vector<ll>;  using vvl = vector<vl>; using vvvl = vector<vvl>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vc = vector<char>; using vvc = vector<vc>; using vvvc = vector<vvc>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using vs = vector<string>; using vvs = vector<vector<string>>; using vvvs = vector<vector<vector<string>>>;
template<typename T> vector<vector<T>> vv(int h, int w, T val = T()) { return vector(h, vector<T>(w, val)); }
template<typename T> vector<vector<vector<T>>> vvv(int h1, int h2, int h3, T val = T()) { return vector(h1, vector(h2, vector<T>(h3, val))); }
template<typename T> vector<vector<vector<vector<T>>>> vvvv(int h1, int h2, int h3, int h4, T val = T()) { return vector(h1, vector(h2, vector(h3, vector<T>(h4, val)))); }
template <class T> using priority_queue_min = priority_queue<T, vector<T>, greater<T>>;
// 定数の定義
constexpr double PI = 3.14159265358979323;
constexpr int INF = 100100111; constexpr ll INFL = 3300300300300300491LL;
float EPS = 1e-8; double EPSL = 1e-16;
template<typename T> bool eq(const T x, const T y) { return x == y; }
template<> bool eq<double>(const double x, const double y) { return abs(x - y) < EPSL; }
template<> bool eq<float>(const float x, const float y) { return abs(x - y) < EPS; }
template<typename T> bool neq(const T x, const T y) { return !(eq<T>(x, y)); }
template<typename T> bool ge(const T x, const T y) { return (eq<T>(x, y) || (x > y)); }
template<typename T> bool le(const T x, const T y) { return (eq<T>(x, y) || (x < y)); }
template<typename T> bool gt(const T x, const T y) { return !(le<T>(x, y)); }
template<typename T> bool lt(const T x, const T y) { return !(ge<T>(x, y)); }
constexpr int MODINT998244353 = 998244353;
constexpr int MODINT1000000007 = 1000000007;
// 入出力高速化
struct Nyan { Nyan() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(18); } } nyan;
// 汎用マクロの定義
#define all(a) (a).begin(), (a).end()
#define sz(x) ((ll)(x).size())
#define rep1(n) for(ll dummy_iter = 0LL; dummy_iter < n; ++dummy_iter) // 0 から n-1 まで昇順
#define rep2(i, n) for(ll i = 0LL, i##_counter = 0LL; i##_counter < ll(n); ++(i##_counter), (i) = i##_counter) // 0 から n-1 まで昇順
#define rep3(i, s, t) for(ll i = ll(s), i##_counter = ll(s); i##_counter < ll(t); ++(i##_counter), (i) = (i##_counter)) // s から t まで昇順
#define rep4(i, s, t, step) for(ll i##_counter = step > 0 ? ll(s) : -ll(s), i##_end = step > 0 ? ll(t) : -ll(t), i##_step = abs(step), i = ll(s); i##_counter < i##_end; i##_counter += i##_step, i = step > 0 ? i##_counter : -i##_counter) // s から t まで stepずつ
#define overload4(a, b, c, d, e, ...) e
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define repe(a, v) for(auto& a : (v)) // v の全要素(変更可能)
#define smod(n, m) ((((n) % (m)) + (m)) % (m)) // 非負mod
#define sdiv(n, m) (((n) - smod(n, m)) / (m)) // 非負div
#define uniq(a) {sort(all(a)); (a).erase(unique(all(a)), (a).end());} // 重複除去
int Yes(bool b=true) { cout << (b ? "Yes\n" : "No\n"); return 0; };
int YES(bool b=true) { cout << (b ? "YES\n" : "NO\n"); return 0; };
int No(bool b=true) {return Yes(!b);};
int NO(bool b=true) {return YES(!b);};
template<typename T, size_t N> T max(array<T, N>& a) { return *max_element(all(a)); };
template<typename T, size_t N> T min(array<T, N>& a) { return *min_element(all(a)); };
template<typename T> T max(vector<T>& a) { return *max_element(all(a)); };
template<typename T> T min(vector<T>& a) { return *min_element(all(a)); };
template<typename T> vector<T> accum(const vector<T>& a) { vector<T> rev(sz(a)+1, 0); rep(i, sz(a)) rev[i+1] = rev[i] + a[i]; return rev; };
template<typename T> vector<T> vec_slice(const vector<T>& a, int l, int r) { vector<T> rev; rep(i, l, r) rev.push_back(a[i]); return rev; };
template<typename T> T sum(vector<T>& a, T zero = T(0)) { T rev = zero; rep(i, sz(a)) rev += a[i]; return rev; };
template<typename T> bool in_range(const T& val, const T& s, const T& t) { return s <= val && val < t; };

template <class T> inline vector<T>& operator--(vector<T>& v) { repe(x, v) --x; return v; }
template <class T> inline vector<T>& operator++(vector<T>& v) { repe(x, v) ++x; return v; }

// modでのpow
ll powm(ll a, ll n, ll mod=INFL) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * a) % mod;
        if (n > 1) a = (a * a) % mod;
        n >>= 1;
    }
    return res;
}
// 整数Sqrt
ll sqrtll(ll x) {
    assert(x >= 0);
    ll rev = sqrt(x);
    while(rev * rev > x) --rev;
    while((rev+1) * (rev+1)<=x) ++rev;
    return rev;
}
template <class T> inline bool chmax(T& M, const T& x) { if (M < x) { M = x; return true; } return false; } // 最大値を更新(更新されたら true を返す)
template <class T> inline bool chmin(T& m, const T& x) { if (m > x) { m = x; return true; } return false; } // 最小値を更新(更新されたら true を返す)
int digit(ll x, int d=10) { int rev=0; while (x > 0) { rev++; x /= d;}; return rev; } // xのd進数桁数
/**
 * @brief std.hpp
 * @docs docs/std/std.md
 */
//line 3 "/home/seekworser/.cpp_lib/competitive_library/competitive/math/prime.hpp"
template <class T> bool is_prime(T n) {
    if (n == 1) return false;
    for (T i=2; i <= (T)std::sqrt(n); i++) {
        if (n % i == 0) return false;
    }
    return true;
};
//return all devisor
template <class T> vector<T> divisor(T n, bool sorted=true) {
    vector<T> ans(0);
    for (T i = 1; i <= (T)std::sqrt(n); i++) {
        if (n % i == 0) {
            ans.push_back(i);
            if (i * i != n) ans.push_back(n / i);
        }
    }
    if (sorted) sort(ans.begin(), ans.end());
    return ans;
};
template <class T> vector<T> prime_factor(T n) {
    vector<T> ans(0);
    for (T i = 2; i <= (T)std::sqrt(n); i++) {
        while (n % i == 0) {
            ans.push_back(i);
            n /= i;
        }
    }
    if (n != 1) ans.push_back(n);
    return ans;
};
template <class T> map<T, T> prime_factor_c(T n) {
    map<T, T> ans;
    for (T i = 2; i <= (T)std::sqrt(n); i++) {
        while (n % i == 0) {
            ans[i] += 1;
            n /= i;
        }
    }
    if (n != 1) ans[n] += 1;
    return ans;
};
template <class T> vector<T> primes(T n) {
    vector<T> ans(0);
    if (n < 2) return ans;
    vector<bool> is_primev(n+1, true);
    is_primev.at(0) = is_primev.at(1) = false;
    for (T i = 2; i <= (T)std::sqrt(n); i++) {
        if (!is_primev.at(i)) continue;
        for (T j = i*2; j <= n; j+=i) is_primev.at(j) = false;
    }
    for (T i = 2; i <= n; i++) {
        if (is_primev.at(i)) ans.push_back(i);
    }
    return ans;
};
template <class T> vector<T> segment_seive(T s, T t) {
    vector<T> ans(0);
    if (t < 2 || s < 0 || s >= t) return ans;
    vector<bool> is_prime_small((T)std::sqrt(t)+1, true);
    vector<bool> is_prime_large(t-s, true);
    for (T i = 2; i <= (T)std::sqrt(t); i++) {
        if (!is_prime_small.at(i)) continue;
        for (T j = i*2; j*j < t; j+=i) is_prime_small.at(j) = false;
        for (T j = max(2*i, ((s+i-1)/i)*i); j < t; j+=i) is_prime_large.at(j-s) = false;
    }
    for (T i=0; i < t-s; i++) {
        if (is_prime_large.at(i) && s+i != 1) ans.push_back(s+i);
    }
    return ans;
};
/**
 * @brief prime.hpp
 * @docs docs/math/prime.md
 */
//line 5 "/home/seekworser/.cpp_lib/competitive_library/atcoder/segtree.hpp"

//line 2 "/home/seekworser/.cpp_lib/competitive_library/atcoder/internal_bit.hpp"
#ifdef _MSC_VER
#include <intrin.h>
#endif

namespace atcoder {

namespace internal {

// @param n `0 <= n`
// @return minimum non-negative `x` s.t. `n <= 2**x`
int ceil_pow2(int n) {
    int x = 0;
    while ((1U << x) < (unsigned int)(n)) x++;
    return x;
}

// @param n `1 <= n`
// @return minimum non-negative `x` s.t. `(n & (1 << x)) != 0`
constexpr int bsf_constexpr(unsigned int n) {
    int x = 0;
    while (!(n & (1 << x))) x++;
    return x;
}

// @param n `1 <= n`
// @return minimum non-negative `x` s.t. `(n & (1 << x)) != 0`
int bsf(unsigned int n) {
#ifdef _MSC_VER
    unsigned long index;
    _BitScanForward(&index, n);
    return index;
#else
    return __builtin_ctz(n);
#endif
}

}  // namespace internal

}  // namespace atcoder
//line 7 "/home/seekworser/.cpp_lib/competitive_library/atcoder/segtree.hpp"

namespace atcoder {

template <class S, S (*_op)(S, S), S (*_e)()> struct segtree {
  public:
    S (*op)(S, S) = _op;
    S (*e)() = _e;
    segtree() : segtree(0) {}
    explicit segtree(const std::vector<S>& v) : _n(int(v.size())) {
        log = internal::ceil_pow2(_n);
        size = 1 << log;
        d = std::vector<S>(2 * size, e());
        for (int i = 0; i < _n; i++) d[size + i] = v[i];
        for (int i = size - 1; i >= 1; i--) {
            update(i);
        }
    }
    explicit segtree(int n) : segtree(std::vector<S>(n, _e())) {}

    void set(int p, S x) {
        assert(0 <= p && p < _n);
        p += size;
        d[p] = x;
        for (int i = 1; i <= log; i++) update(p >> i);
    }

    void add(int p, S x) {
        assert(0 <= p && p < _n);
        (*this).set(p, (*this).get(p) + x);
    }

    S get(int p) const {
        assert(0 <= p && p < _n);
        return d[p + size];
    }

    S prod(int l, int r) const {
        assert(0 <= l && l <= r && r <= _n);
        S sml = e(), smr = e();
        l += size;
        r += size;

        while (l < r) {
            if (l & 1) sml = op(sml, d[l++]);
            if (r & 1) smr = op(d[--r], smr);
            l >>= 1;
            r >>= 1;
        }
        return op(sml, smr);
    }

    S all_prod() const { return d[1]; }

    template <bool (*f)(S)> int max_right(int l) const {
        return max_right(l, [](S x) { return f(x); });
    }
    template <class F> int max_right(int l, F f) const {
        assert(0 <= l && l <= _n);
        assert(f(e()));
        if (l == _n) return _n;
        l += size;
        S sm = e();
        do {
            while (l % 2 == 0) l >>= 1;
            if (!f(op(sm, d[l]))) {
                while (l < size) {
                    l = (2 * l);
                    if (f(op(sm, d[l]))) {
                        sm = op(sm, d[l]);
                        l++;
                    }
                }
                return l - size;
            }
            sm = op(sm, d[l]);
            l++;
        } while ((l & -l) != l);
        return _n;
    }

    template <bool (*f)(S)> int min_left(int r) const {
        return min_left(r, [](S x) { return f(x); });
    }
    template <class F> int min_left(int r, F f) const {
        assert(0 <= r && r <= _n);
        assert(f(e()));
        if (r == 0) return 0;
        r += size;
        S sm = e();
        do {
            r--;
            while (r > 1 && (r % 2)) r >>= 1;
            if (!f(op(d[r], sm))) {
                while (r < size) {
                    r = (2 * r + 1);
                    if (f(op(d[r], sm))) {
                        sm = op(d[r], sm);
                        r--;
                    }
                }
                return r + 1 - size;
            }
            sm = op(d[r], sm);
        } while ((r & -r) != r);
        return 0;
    }

    int n() const {return (*this)._n;}

  private:
    int _n, size, log;
    std::vector<S> d;

    void update(int k) { d[k] = op(d[2 * k], d[2 * k + 1]); }
};

}  // namespace atcoder
//line 4 "/home/seekworser/.cpp_lib/competitive_library/competitive/data_structure/segtree.hpp"
template <typename S, S (*op)(S, S), S (*e)()> std::ostream& operator<<(std::ostream& os, const atcoder::segtree<S, op, e> seg) {
    int n = seg.n();
    rep(i, n) { os << seg.get(i); if (i != n-1) os << " "; }
    return os;
};
namespace segtree_internal {
    template<typename T> T op_max(T x, T y) { return x > y? x : y; }
    template<typename T> T op_min(T x, T y) { return x < y? x : y; }
    template<typename T> T op_add(T x, T y) { return x + y; }

    template<typename T> T e_max() { return -INFL; }
    template<> int e_max() { return -INF; }
    template<typename T> T e_min() { return INFL; }
    template<> int e_min() { return INF; }
    template<typename T> T e_add() { return 0; }
}
template<class S, S (*op)(S,S), S(*e)()> using segtree = atcoder::segtree<S, op, e>;
template<typename T> using seg_add = segtree<T, segtree_internal::op_add<T>, segtree_internal::e_add<T>>;
template<typename T> using seg_max = segtree<T, segtree_internal::op_max<T>, segtree_internal::e_max<T>>;
template<typename T> using seg_min = segtree<T, segtree_internal::op_min<T>, segtree_internal::e_min<T>>;
/**
 * @brief セグメント木(ラッパー)
 * @docs docs/data_structure/segtree.md
 */
//line 3 "/home/seekworser/.cpp_lib/competitive_library/competitive/std/io.hpp"
// 演算子オーバーロード(プロトタイプ宣言)
template <class T, class U> inline istream& operator>>(istream& is, pair<T, U>& p);
template <class T> inline istream& operator>>(istream& is, vector<T>& v);
template <class T, class U> inline ostream& operator<<(ostream& os, const pair<T, U>& p);
template <class T> inline ostream& operator<<(ostream& os, const vector<T>& v);
template <typename T, typename S> ostream &operator<<(ostream &os, const map<T, S> &mp);
template <typename T> ostream &operator<<(ostream &os, const set<T> &st);
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &st);
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T> &st);
template <typename T> ostream &operator<<(ostream &os, queue<T> q);
template <typename T> ostream &operator<<(ostream &os, deque<T> q);
template <typename T> ostream &operator<<(ostream &os, stack<T> st);
template <class T, class Container, class Compare> ostream &operator<<(ostream &os, priority_queue<T, Container, Compare> pq);

// 演算子オーバーロード
template <class T, class U> inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template <class T> inline istream& operator>>(istream& is, vector<T>& v) { repe(x, v) is >> x; return is; }
template <class T, class U> inline ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.first << " " << p.second; return os; }
template <class T> inline ostream& operator<<(ostream& os, const vector<T>& v) { rep(i, sz(v)) { os << v.at(i); if (i != sz(v) - 1) os << " "; } return os; }
template <typename T, typename S> ostream &operator<<(ostream &os, const map<T, S> &mp) { for (auto &[key, val] : mp) { os << key << ":" << val << " "; } return os; }
template <typename T> ostream &operator<<(ostream &os, const set<T> &st) { auto itr = st.begin(); for (int i = 0; i < (int)st.size(); i++) { os << *itr << (i + 1 != (int)st.size() ? " " : ""); itr++; } return os; }
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &st) { auto itr = st.begin(); for (int i = 0; i < (int)st.size(); i++) { os << *itr << (i + 1 != (int)st.size() ? " " : ""); itr++; } return os; }
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T> &st) { ll cnt = 0; for (auto &e : st) { os << e << (++cnt != (int)st.size() ? " " : ""); } return os; }
template <typename T> ostream &operator<<(ostream &os, queue<T> q) { while (q.size()) { os << q.front() << " "; q.pop(); } return os; }
template <typename T> ostream &operator<<(ostream &os, deque<T> q) { while (q.size()) { os << q.front() << " "; q.pop_front(); } return os; }
template <typename T> ostream &operator<<(ostream &os, stack<T> st) { while (st.size()) { os << st.top() << " "; st.pop(); } return os; }
template <class T, class Container, class Compare> ostream &operator<<(ostream &os, priority_queue<T, Container, Compare> pq) { while (pq.size()) { os << pq.top() << " "; pq.pop(); } return os; }

template <typename T> int print_sep_end(string sep, string end, const T& val) { (void)sep; cout << val << end; return 0; };
template <typename T1, typename... T2> int print_sep_end(string sep, string end, const T1 &val, const T2 &...remain) {
    cout << val << sep;
    print_sep_end(sep, end, remain...);
    return 0;
};
template <typename... T> int print(const T &...args) { print_sep_end(" ", "\n", args...); return 0; };
template <typename... T> void flush() { cout << flush; };
template <typename... T> int print_and_flush(const T &...args) { print(args...); flush(); return 0; };
#define debug(...) debug_func(0, #__VA_ARGS__, __VA_ARGS__) // debug print
template <typename T> void input(T &a) { cin >> a; };
template <typename T1, typename... T2> void input(T1&a, T2 &...b) { cin >> a; input(b...); };
#ifdef LOCAL_TEST
template <typename T> void debug_func(int i, const T name) { (void)i; (void)name; cerr << endl; }
template <typename T1, typename T2, typename... T3> void debug_func(int i, const T1 &name, const T2 &a, const T3 &...b) {
    int scope = 0;
    for ( ; (scope != 0 || name[i] != ',') && name[i] != '\0'; i++ ) {
        cerr << name[i];
        if (name[i] == '(' || name[i] == '{') scope++;
        if (name[i] == ')' || name[i] == '}') scope--;
    }
    cerr << ":" << a << " ";
    debug_func(i + 1, name, b...);
}
template <typename T1, typename T2, typename... T3> void debug_func(int i, const T1 &name, T2 &a, T3 &...b) {
    int scope = 0;
    for ( ; (scope != 0 || name[i] != ',') && name[i] != '\0'; i++ ) {
        cerr << name[i];
        if (name[i] == '(' || name[i] == '{') scope++;
        if (name[i] == ')' || name[i] == '}') scope--;
    }
    cerr << ":" << a << " ";
    debug_func(i + 1, name, b...);
}
#endif
#ifndef LOCAL_TEST
template <typename... T>
void debug_func(T &...) {}
template <typename... T>
void debug_func(const T &...) {}
#endif
/**
 * @brief io.hpp
 * @docs docs/std/io.md
 */
//line 72 "answer.cpp"
#endif


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

詳細信息

Test #1:

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

input:

3
5 10
7 79 1 7 1
2 1000000000
1 2
1 100
1000000000

output:

3 8
0 0
100 5050

result:

ok 3 lines

Test #2:

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

input:

4
201 1000000000
1 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5...

output:

0 0
0 0
0 0
0 0

result:

ok 4 lines

Test #3:

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

input:

500
4 1000000000
8 14 24 18
4 1000000000
17 10 18 14
4 1000000000
6 17 19 19
4 1000000000
15 14 15 25
4 1000000000
16 16 5 25
4 1000000000
4 30 20 5
4 1000000000
11 4 23 9
4 1000000000
14 25 13 2
4 1000000000
18 18 1 15
4 1000000000
22 22 22 28
4 1000000000
15 17 17 10
4 1000000000
22 14 13 25
4 100...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #4:

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

input:

1
50000 1000000000
230 286458 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 41263680 ...

output:

0 0

result:

ok single line: '0 0'

Test #5:

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

input:

1
50000 1000000000
12087 1196491 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 55314643 553146...

output:

0 0

result:

ok single line: '0 0'

Test #6:

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

input:

1
50000 1000000000
2138984 42249920 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 358123541 3581...

output:

0 0

result:

ok single line: '0 0'

Test #7:

score: 0
Accepted
time: 8ms
memory: 3740kb

input:

500
39 1000000000
75 7 7 381 41 1197 177 177 41 109 109 16 1197 177 41 381 1605 381 381 7 177 177 177 177 177 177 177 177 7 7 143 143 143 143 143 653 143 823 7
61 1000000000
327 327 327 327 405153474 327 405153474 327 810306621 810306621 810306621 810306621 810306621 810306621 810306621 810306621 81...

output:

0 0
25 631568356
13 18925862
1 1
2 6878
1 2
1 1
2 10
1 1
1 110
0 0
1 36
11 4796
1 29
1 4
6 2209209
0 0
3 8
1 2
9 30770061
1000000000 500000000500000000
1 3
1000000000 500000000500000000
0 0
1 5
1 1
6 6615501
3 8233825
2 1035
2 4
7 1288
0 0
1 3
16 1617883221
2 10
0 0
1 5739
15 102584
3 1100
100000000...

result:

ok 500 lines

Test #8:

score: 0
Accepted
time: 8ms
memory: 3836kb

input:

50
794 1000000000
32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 32994 ...

output:

4 13399
1 488
0 0
1 1
2 764
1 3762
2 3
1 4
3 704189325
1 1
7 226705168
7 2992
1 10
2 14
0 0
2 4136
1 1
5 1503264540
1 6
1 9
2 178
12 1965492
3 8622003
1 1
1 10
0 0
0 0
1 316605749
1 4
2 8
1 22
2 1452
0 0
1 47
1 1
3 11
7 709953544
20 10709552
3 8
1 3
19 84763135
2 1256
3 1268
29 1652299260
1 1
3 1124...

result:

ok 50 lines

Test #9:

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

input:

5
8181 1000000000
846711550 846711550 846711550 846711550 31870 169367806 169367806 169367806 169367806 169367806 169367806 169367806 169367806 169367806 169367806 169367806 31870 338703742 338703742 190 14224510 14224510 6526 6526 190 190 190 10 190 10 21214 21214 154 154 8578 10 190 10 10 82 3862 ...

output:

2 10
1 8
26 3610753
1 3
2 4

result:

ok 5 lines

Test #10:

score: 0
Accepted
time: 11ms
memory: 7972kb

input:

1
50000 1000000000
8376 1656 5016 20136 5016 1656 1656 1656 1656 1656 1656 1656 1656 1656 1656 16776 8376 50376 251976 1656 1656 10056 1656 1656 1656 1656 1656 1656 1656 1656 1656 1656 1656 5016 1656 3336 3336 3336 3336 3336 83976 16776 16776 16776 1656 536 1096 2216 1096 1096 67176 33576 5576 1096 ...

output:

1 24

result:

ok single line: '1 24'

Test #11:

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

input:

1
50000 1000000000
91892194 394 137838094 394 137838094 137838094 394 183783994 394 183783994 183783994 183783994 183783994 394 45946294 45946294 45946294 45946294 45946294 45946294 45946294 45946294 45946294 45946294 45946294 45946294 45946294 45946294 394 137838094 137838094 137838094 394 91892194...

output:

468 209787236

result:

ok single line: '468 209787236'

Test #12:

score: 0
Accepted
time: 56ms
memory: 3860kb

input:

500
100 1000000000
776155459 776155459 776155459 776155459 41021059 776155459 41021059 776155459 776155459 41021059 41021059 776155459 776155459 41021059 776155459 41021059 776155459 776155459 41021059 41021059 776155459 776155459 776155459 41021059 41021059 41021059 41021059 41021059 776155459 7761...

output:

17 1831175377
2 609757842
3 743304987
25 2121624176
3 790868079
5 1008821895
7 1202438586
151 3383012928
9 1359636987
84 3044672451
3 640906041
2 612154014
7 1176943151
4 813243996
3 707197023
3 683983701
2 602690182
21 1974972192
12 1549491756
35 2391432666
3 794002920
3 764129706
3 748141920
14 16...

result:

ok 500 lines

Test #13:

score: 0
Accepted
time: 16ms
memory: 8056kb

input:

1
50000 1000000000
955233187 955233187 955233187 955233187 955233187 955233187 220098787 955233187 220098787 220098787 955233187 955233187 955233187 955233187 220098787 220098787 220098787 955233187 955233187 955233187 955233187 220098787 220098787 955233187 955233187 955233187 955233187 220098787 2...

output:

3 687450039

result:

ok single line: '3 687450039'

Test #14:

score: 0
Accepted
time: 15ms
memory: 8136kb

input:

1
50000 1000000000
134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 134310915 1...

output:

5 1007002305

result:

ok single line: '5 1007002305'

Test #15:

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

input:

500
97 1000000000
25042703 12459791 12459791 25042703 1449743 270095 50208527 3022607 6168335 50208527 663311 25042703 12459791 6168335 270095 12459791 6168335 25042703 663311 25042703 663311 50208527 1449743 663311 3022607 25042703 663311 3022607 3022607 25042703 3022607 6168335 50208527 12459791 5...

output:

1 123121
1 887
1 58
1 250
1 11942
1 14
1 3847396
1 5
1 205464
1 3614
1 24
1 1
1 1502
1 192
1 82260
1 123682
1 8870816
1 98
1 8282
3 14951299
1 390417
1000000000 500000000500000000
1 47039
1000000000 500000000500000000
1000000000 500000000500000000
1 430
1 1291110
1 3198662
1 266092
1 634777
1 514615...

result:

ok 500 lines

Test #16:

score: 0
Accepted
time: 13ms
memory: 8152kb

input:

1
50000 1000000000
180207 22511 360431 5 11247 23068655 5 2799 159 335 90095 5615 1391 360431 1391 5767151 90095 180207 5 46137327 687 360431 180207 720879 159 720879 1441775 90095 687 5 2799 5767151 5767151 687 687 687 159 90095 45039 335 46137327 1441775 5767151 71 180207 11534319 1441775 11247 14...

output:

1 17

result:

ok single line: '1 17'

Test #17:

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

input:

1
50000 1000000000
13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13...

output:

1 9

result:

ok single line: '1 9'

Test #18:

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

input:

500
74 1000000000
505612400 46447376 46447376 46447376 46447376 505612400 161238632 161238632 161238632 46447376 46447376 161238632 161238632 46447376 161238632 46447376 46447376 46447376 46447376 161238632 46447376 161238632 161238632 46447376 505612400 505612400 161238632 161238632 46447376 464473...

output:

1 10948252
2 290995083
1 12227
1 62646
1 456148
1 1606838
1 69009237
1 76066538
1 3945
1 10354
1 20996041
1 12594
1000000000 500000000500000000
1 1774442
1 230803
1 52
1 4
1 400
1 20840838
1 3155890
56 48210675
1 293
1 485
1 148108
1 947844
1 22565
1 15551
1 2058649
1 17
1 6744213
1 1961476
1 16914
...

result:

ok 500 lines

Test #19:

score: 0
Accepted
time: 4ms
memory: 8180kb

input:

1
50000 1000000000
28697812 9565936 4372 52 86093440 86093440 16 774840976 13120 39364 3188644 118096 39364 774840976 1062880 13120 484 86093440 258280324 1062880 484 774840976 118096 52 484 1062880 28697812 16 258280324 39364 774840976 258280324 28697812 4372 484 774840976 9565936 4372 1062880 16 2...

output:

1 2

result:

ok single line: '1 2'

Test #20:

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

input:

1
50000 1000000000
12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12...

output:

1 6

result:

ok single line: '1 6'

Test #21:

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

input:

1
50000 1000000000
278 20278 40278 60278 80278 100278 120278 140278 160278 180278 200278 220278 240278 260278 280278 300278 320278 340278 360278 380278 400278 420278 440278 460278 480278 500278 520278 540278 560278 580278 600278 620278 640278 660278 680278 700278 720278 740278 760278 780278 800278 8...

output:

0 0

result:

ok single line: '0 0'

Test #22:

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

input:

1
50000 1000000000
999994293 999974293 999954293 999934293 999914293 999894293 999874293 999854293 999834293 999814293 999794293 999774293 999754293 999734293 999714293 999694293 999674293 999654293 999634293 999614293 999594293 999574293 999554293 999534293 999514293 999494293 999474293 999454293 9...

output:

0 0

result:

ok single line: '0 0'

Test #23:

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

input:

1
50000 1000000000
2 735134402 2 735134402 2 735134402 2 2 735134402 2 2 735134402 2 735134402 2 735134402 735134402 2 735134402 735134402 735134402 735134402 735134402 2 735134402 735134402 2 735134402 735134402 735134402 735134402 2 2 2 735134402 2 735134402 735134402 735134402 735134402 2 2 73513...

output:

1342 3809753473

result:

ok single line: '1342 3809753473'

Test #24:

score: 0
Accepted
time: 106ms
memory: 8076kb

input:

1
50000 1000000000
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4...

output:

1340 3809750790

result:

ok single line: '1340 3809750790'

Test #25:

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

input:

500
100 1000000000
735134405 735134405 735134405 5 5 5 5 735134405 735134405 735134405 735134405 5 735134405 735134405 5 5 5 5 5 5 5 5 5 5 735134405 735134405 5 735134405 735134405 735134405 5 5 735134405 5 735134405 735134405 735134405 5 735134405 735134405 735134405 5 5 5 5 735134405 5 735134405 5...

output:

1339 3809749450
1343 3809754816
1340 3809750790
1341 3809752131
1340 3809750790
1341 3809752131
1343 3809754816
1342 3809753473
1343 3809754816
1342 3809753473
1341 3809752131
1341 3809752131
1343 3809754816
1339 3809749450
1340 3809750790
1339 3809749450
1340 3809750790
1343 3809754816
1340 3809750...

result:

ok 500 lines

Test #26:

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

input:

500
100 1000000000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 735134401 735134401 735134401 735134401 735134401 735134401 735134401 735134401 735134401 735134401 735134401 735134401 735134401 735134401 735134401 735134401 735134401 735134401 735...

output:

1343 3809754816
1339 3809749450
1343 3809754816
1343 3809754816
1343 3809754816
1342 3809753473
1342 3809753473
1339 3809749450
1340 3809750790
1341 3809752131
1343 3809754816
1340 3809750790
1341 3809752131
1343 3809754816
1343 3809754816
1342 3809753473
1341 3809752131
1343 3809754816
1340 3809750...

result:

ok 500 lines

Test #27:

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

input:

500
100 1000000000
2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735134402 2 735...

output:

1342 3809753473
1341 3809752131
1342 3809753473
1342 3809753473
1341 3809752131
1339 3809749450
1341 3809752131
1341 3809752131
1341 3809752131
1340 3809750790
1339 3809749450
1343 3809754816
1343 3809754816
1339 3809749450
1340 3809750790
1343 3809754816
1339 3809749450
1341 3809752131
1342 3809753...

result:

ok 500 lines

Test #28:

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

input:

500
89 733686393
546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546879484 546...

output:

733686393 269147862003518421
974814317 475131476801495403
314673126 49509588270642501
261604100 34218352699207050
250972352 31493560859692128
58642240 1719456185429920
26403492 348572208098778
789669437 311788910260783203
795057458 316058181158239611
765142258 292721337871240411
292428558 4275723091...

result:

ok 500 lines

Test #29:

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

input:

500
2 1000000000
3 2
2 1000000000
3 2
2 1000000000
1 3
2 1000000000
3 1
2 1000000000
3 1
2 1000000000
2 3
2 1000000000
1 1
2 1000000000
3 1
2 1000000000
2 2
2 1000000000
3 3
2 1000000000
1 3
2 1000000000
3 2
2 1000000000
2 3
2 1000000000
3 3
2 1000000000
2 1
2 1000000000
3 3
2 1000000000
3 3
2 10000...

output:

0 0
0 0
1 1
1 1
1 1
0 0
1000000000 500000000500000000
1 1
1000000000 500000000500000000
1000000000 500000000500000000
1 1
0 0
0 0
1000000000 500000000500000000
0 0
1000000000 500000000500000000
1000000000 500000000500000000
1000000000 500000000500000000
1 1
1000000000 500000000500000000
1 1
0 0
1000...

result:

ok 500 lines

Test #30:

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

input:

500
2 1000000000
3 3
2 1000000000
4 5
2 1000000000
1 3
2 1000000000
3 1
2 1000000000
2 4
2 1000000000
4 5
2 1000000000
4 3
2 1000000000
2 5
2 1000000000
2 5
2 1000000000
5 4
2 1000000000
4 1
2 1000000000
4 2
2 1000000000
4 4
2 1000000000
3 1
2 1000000000
1 4
2 1000000000
1 4
2 1000000000
4 5
2 10000...

output:

1000000000 500000000500000000
0 0
1 1
1 1
0 0
0 0
0 0
1 1
1 1
0 0
1 2
0 0
1000000000 500000000500000000
1 1
1 2
1 2
0 0
0 0
0 0
1000000000 500000000500000000
0 0
1 2
0 0
2 4
1 1
1000000000 500000000500000000
1000000000 500000000500000000
1000000000 500000000500000000
0 0
2 4
2 4
0 0
0 0
0 0
10000000...

result:

ok 500 lines

Test #31:

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

input:

500
2 1000000000
4 1
2 1000000000
10 9
2 1000000000
10 7
2 1000000000
4 10
2 1000000000
2 7
2 1000000000
2 5
2 1000000000
4 5
2 1000000000
4 6
2 1000000000
1 8
2 1000000000
8 5
2 1000000000
4 7
2 1000000000
7 5
2 1000000000
6 3
2 1000000000
6 5
2 1000000000
10 7
2 1000000000
8 9
2 1000000000
2 2
2 1...

output:

1 2
0 0
0 0
1 2
1 3
1 1
0 0
0 0
1 6
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1000000000 500000000500000000
0 0
0 0
0 0
0 0
0 0
1 1
1 1
1 2
1 3
0 0
0 0
1 6
1000000000 500000000500000000
1000000000 500000000500000000
0 0
0 0
0 0
1 1
0 0
0 0
1000000000 500000000500000000
0 0
0 0
1 3
0 0
1000000000 50000000050000000...

result:

ok 500 lines

Test #32:

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

input:

500
2 1000000000
19 13
2 1000000000
8 14
2 1000000000
3 15
2 1000000000
16 13
2 1000000000
3 6
2 1000000000
15 15
2 1000000000
17 6
2 1000000000
16 12
2 1000000000
3 12
2 1000000000
11 5
2 1000000000
6 1
2 1000000000
3 2
2 1000000000
7 9
2 1000000000
4 13
2 1000000000
13 9
2 1000000000
18 17
2 10000...

output:

0 0
0 0
3 13
0 0
0 0
1000000000 500000000500000000
1 5
0 0
1 6
1 1
1 4
0 0
0 0
1 5
0 0
0 0
2 4
0 0
1 10
0 0
0 0
5 33
2 10
0 0
1 14
1 10
1 10
1 1
0 0
1 10
1000000000 500000000500000000
0 0
1000000000 500000000500000000
0 0
2 8
0 0
2 9
0 0
0 0
1 1
1 1
1 8
0 0
0 0
0 0
1 1
1 4
0 0
0 0
1 1
0 0
0 0
1 15
1...

result:

ok 500 lines

Test #33:

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

input:

500
3 1000000000
1 1 2
3 1000000000
2 3 1
3 1000000000
2 1 2
3 1000000000
1 2 2
3 1000000000
1 3 2
3 1000000000
1 1 3
3 1000000000
3 2 1
3 1000000000
3 2 2
3 1000000000
3 2 3
3 1000000000
2 1 1
3 1000000000
3 2 2
3 1000000000
1 1 2
3 1000000000
2 3 3
3 1000000000
2 3 1
3 1000000000
3 1 1
3 100000000...

output:

0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
1000000000 500000000500000000
1000000000 500000000500000000
0 0
0 0
0 0
1000000000 500000000500000000
0 0
0 0
1000000000 500000000500000000
1000000000 500000000500000000
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
1 1
0 0
1 1
1 1
0 0
0 0
0 0
0 ...

result:

ok 500 lines

Test #34:

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

input:

500
3 1000000000
4 5 4
3 1000000000
2 1 3
3 1000000000
1 2 1
3 1000000000
1 2 3
3 1000000000
2 1 1
3 1000000000
3 5 4
3 1000000000
2 5 1
3 1000000000
1 1 2
3 1000000000
2 1 3
3 1000000000
4 5 4
3 1000000000
3 3 2
3 1000000000
1 3 5
3 1000000000
5 2 3
3 1000000000
3 3 1
3 1000000000
2 5 2
3 100000000...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
1 1
0 0
0 0
0 0
0 0
2 4
0 0
0 0
0 0
1 1
0 0
0 0
2 4
1 1
1 1
0 0
0 0
1 2
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
1000000000 500000000500000000
2 4
0 0
1 1
0 0
0 0
1 2
0 0
0 0
0 0
1000000000 500000000500000000
0 0
0 0
1 1
1 1
1 1
1 1
0 0
1 2
2 4
...

result:

ok 500 lines

Test #35:

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

input:

500
3 1000000000
1 6 1
3 1000000000
10 3 7
3 1000000000
9 9 8
3 1000000000
3 10 8
3 1000000000
10 5 10
3 1000000000
7 3 2
3 1000000000
3 5 3
3 1000000000
6 2 1
3 1000000000
9 1 5
3 1000000000
4 4 3
3 1000000000
4 6 8
3 1000000000
1 9 9
3 1000000000
10 1 1
3 1000000000
6 4 8
3 1000000000
5 4 9
3 1000...

output:

1 4
0 0
0 0
0 0
0 0
0 0
0 0
0 0
2 4
0 0
0 0
3 11
2 10
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
1 1
1 2
0 0
2 5
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 2
0 0
0 0
0 0
1 1
0 0
0 0
2 5
0 0
0 0
0 0
1 1
3 8
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 ...

result:

ok 500 lines

Test #36:

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

input:

500
3 1000000000
5 16 9
3 1000000000
4 2 20
3 1000000000
15 2 9
3 1000000000
11 11 19
3 1000000000
3 16 4
3 1000000000
16 19 4
3 1000000000
18 11 2
3 1000000000
7 17 9
3 1000000000
1 2 11
3 1000000000
5 10 16
3 1000000000
14 4 15
3 1000000000
20 7 4
3 1000000000
7 13 5
3 1000000000
7 15 14
3 1000000...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
4 17
1 2
0 0
0 0
0 0
0 0
0 0
1 3
0 0
0 0
0 0
0 0
0 0
0 0
2 4
1 1
1 4
0 0
1 1
0 0
1 15
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
2 5
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
2 13
0 0
1 2
0 0
0 0
0 0
0 0
1...

result:

ok 500 lines

Test #37:

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

input:

500
4 1000000000
1 2 2 1
4 1000000000
3 3 2 2
4 1000000000
3 2 3 3
4 1000000000
3 2 2 2
4 1000000000
2 2 2 3
4 1000000000
3 1 1 1
4 1000000000
2 2 3 1
4 1000000000
2 3 1 2
4 1000000000
2 3 2 1
4 1000000000
2 2 2 2
4 1000000000
1 3 3 1
4 1000000000
2 3 3 3
4 1000000000
1 2 1 1
4 1000000000
3 3 3 2
4 ...

output:

0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
1000000000 500000000500000000
1 1
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
1 1
0 0
0 0
0 0
1 1
1 1
0 0
0 0
1 1
0 0
0 0
1 1
0 0
1000000000 500000000500000000
1 1
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
1000000000 500000000500000000
0 0
0 0
1000000000 50000000050...

result:

ok 500 lines

Test #38:

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

input:

500
4 1000000000
1 3 4 3
4 1000000000
4 1 1 1
4 1000000000
5 5 5 2
4 1000000000
4 1 1 5
4 1000000000
4 2 3 3
4 1000000000
2 2 3 2
4 1000000000
3 1 5 5
4 1000000000
3 2 3 5
4 1000000000
3 2 1 4
4 1000000000
3 2 5 2
4 1000000000
5 1 5 1
4 1000000000
1 1 3 5
4 1000000000
4 3 2 5
4 1000000000
4 4 5 4
4 ...

output:

0 0
1 2
1 1
0 0
0 0
0 0
1 1
0 0
0 0
0 0
2 4
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 2
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 2
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 2
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #39:

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

input:

500
4 1000000000
3 10 3 8
4 1000000000
4 1 6 10
4 1000000000
9 7 3 10
4 1000000000
3 1 6 1
4 1000000000
5 8 5 1
4 1000000000
9 4 8 3
4 1000000000
9 4 2 3
4 1000000000
7 8 6 6
4 1000000000
4 3 4 1
4 1000000000
7 5 2 7
4 1000000000
5 9 4 7
4 1000000000
6 6 1 10
4 1000000000
1 3 4 6
4 1000000000
7 4 9 ...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 2
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
1 3
2 8
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #40:

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

input:

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

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 3
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 3
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 5
0 0
0 0
0 0
...

result:

ok 500 lines

Test #41:

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

input:

500
5 1000000000
1 3 1 3 1
5 1000000000
3 3 1 3 2
5 1000000000
3 2 2 1 2
5 1000000000
3 2 2 1 1
5 1000000000
3 1 1 3 2
5 1000000000
3 2 3 1 2
5 1000000000
1 2 2 3 2
5 1000000000
3 2 3 3 1
5 1000000000
3 1 3 2 2
5 1000000000
1 3 3 1 2
5 1000000000
2 1 2 3 3
5 1000000000
1 2 2 2 1
5 1000000000
3 1 1 3...

output:

1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
1 1
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1000000000 500000000500000000
1 1
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 ...

result:

ok 500 lines

Test #42:

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

input:

500
5 1000000000
5 2 5 5 4
5 1000000000
1 2 3 4 3
5 1000000000
3 1 2 2 5
5 1000000000
2 4 3 2 1
5 1000000000
3 5 3 3 1
5 1000000000
4 1 2 3 2
5 1000000000
3 1 1 2 4
5 1000000000
2 4 2 4 4
5 1000000000
1 5 5 5 2
5 1000000000
4 3 5 1 5
5 1000000000
5 1 5 3 4
5 1000000000
2 2 5 5 5
5 1000000000
1 5 4 2...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
2 4
0 0
0 0
0 0
0 0
2 4
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
1 1
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 2
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #43:

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

input:

500
5 1000000000
10 5 8 4 5
5 1000000000
5 9 1 7 2
5 1000000000
5 4 8 5 7
5 1000000000
4 5 1 2 2
5 1000000000
6 3 2 6 2
5 1000000000
6 5 3 10 5
5 1000000000
3 3 1 8 9
5 1000000000
8 8 3 3 8
5 1000000000
7 8 9 9 5
5 1000000000
5 4 4 3 1
5 1000000000
7 1 2 1 2
5 1000000000
1 6 10 2 7
5 1000000000
3 9 ...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 2
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #44:

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

input:

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

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #45:

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

input:

500
6 1000000000
3 1 1 3 2 3
6 1000000000
1 2 2 1 1 3
6 1000000000
2 2 2 3 2 3
6 1000000000
3 3 2 3 3 3
6 1000000000
2 2 3 2 2 3
6 1000000000
1 3 2 1 1 2
6 1000000000
3 2 3 3 2 3
6 1000000000
1 2 3 1 3 1
6 1000000000
3 1 2 3 3 1
6 1000000000
2 1 3 1 1 1
6 1000000000
2 1 3 2 1 1
6 1000000000
1 3 3 3 ...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #46:

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

input:

500
6 1000000000
5 4 4 4 2 4
6 1000000000
1 1 3 5 2 1
6 1000000000
5 5 2 4 3 1
6 1000000000
4 2 5 1 1 4
6 1000000000
4 5 1 4 1 5
6 1000000000
2 1 4 4 5 2
6 1000000000
5 1 1 5 3 5
6 1000000000
1 2 1 2 1 4
6 1000000000
2 5 1 1 5 2
6 1000000000
4 1 1 2 1 1
6 1000000000
1 2 2 1 5 5
6 1000000000
3 2 4 3 ...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
2 4
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #47:

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

input:

500
6 1000000000
9 8 9 4 4 2
6 1000000000
8 10 9 6 7 1
6 1000000000
9 5 3 8 8 3
6 1000000000
2 8 4 1 9 2
6 1000000000
6 3 2 2 2 10
6 1000000000
9 4 1 9 6 4
6 1000000000
4 1 4 1 8 8
6 1000000000
8 8 3 8 9 5
6 1000000000
7 3 2 3 2 9
6 1000000000
9 8 5 3 4 2
6 1000000000
6 10 1 5 10 5
6 1000000000
3 5 ...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #48:

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

input:

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

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #49:

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

input:

500
7 1000000000
2 2 1 2 3 3 2
7 1000000000
2 1 1 1 1 1 2
7 1000000000
1 3 1 2 2 3 1
7 1000000000
1 2 2 3 2 1 3
7 1000000000
1 1 3 3 1 3 1
7 1000000000
1 3 3 3 1 2 3
7 1000000000
1 2 3 3 3 3 3
7 1000000000
2 3 2 3 2 2 3
7 1000000000
2 3 3 2 1 3 3
7 1000000000
3 1 1 3 1 2 3
7 1000000000
1 3 3 1 1 2 2...

output:

0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
...

result:

ok 500 lines

Test #50:

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

input:

500
7 1000000000
3 3 5 5 1 1 2
7 1000000000
2 5 2 4 4 2 5
7 1000000000
3 2 5 5 4 5 1
7 1000000000
2 3 4 5 3 2 1
7 1000000000
5 1 2 2 1 3 2
7 1000000000
5 5 4 3 2 5 5
7 1000000000
5 2 5 4 1 3 3
7 1000000000
4 3 2 2 4 2 4
7 1000000000
1 1 1 3 3 2 3
7 1000000000
4 4 4 5 4 3 3
7 1000000000
2 5 1 2 3 5 3...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #51:

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

input:

500
7 1000000000
10 4 3 9 9 10 5
7 1000000000
1 6 2 4 5 6 1
7 1000000000
2 8 4 1 9 4 5
7 1000000000
2 5 5 5 1 3 7
7 1000000000
5 6 7 10 2 9 9
7 1000000000
7 9 1 1 2 6 9
7 1000000000
3 5 10 7 2 1 9
7 1000000000
5 2 8 5 6 6 3
7 1000000000
8 8 1 9 3 8 5
7 1000000000
2 3 7 2 3 6 9
7 1000000000
9 8 2 10 ...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #52:

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

input:

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

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #53:

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

input:

500
8 1000000000
3 3 3 1 2 2 2 2
8 1000000000
2 1 2 3 3 1 1 3
8 1000000000
2 3 1 1 1 2 1 1
8 1000000000
3 2 3 3 3 2 3 2
8 1000000000
3 2 1 2 2 3 1 1
8 1000000000
1 1 1 3 1 2 2 1
8 1000000000
1 3 1 3 3 2 2 3
8 1000000000
2 1 1 3 2 3 3 3
8 1000000000
2 2 1 3 3 1 1 2
8 1000000000
1 1 2 1 1 1 1 3
8 1000...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #54:

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

input:

500
8 1000000000
3 5 5 2 1 5 2 1
8 1000000000
1 3 1 3 5 5 1 2
8 1000000000
1 3 1 3 2 5 4 5
8 1000000000
1 4 4 2 1 4 1 2
8 1000000000
4 4 2 5 4 3 2 2
8 1000000000
4 4 3 2 3 1 4 2
8 1000000000
2 3 1 3 1 3 3 2
8 1000000000
5 3 2 3 3 1 2 3
8 1000000000
2 1 5 3 1 3 2 2
8 1000000000
4 5 5 2 3 3 2 5
8 1000...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #55:

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

input:

500
8 1000000000
8 7 4 9 2 4 4 2
8 1000000000
2 5 8 7 1 3 8 3
8 1000000000
6 5 1 2 7 1 6 1
8 1000000000
9 3 2 6 8 5 2 1
8 1000000000
8 6 6 10 6 9 2 3
8 1000000000
5 4 2 8 3 3 7 4
8 1000000000
9 10 5 6 5 8 9 10
8 1000000000
5 8 3 7 7 10 2 9
8 1000000000
4 1 2 6 6 5 9 6
8 1000000000
3 1 8 10 8 2 2 4
8...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #56:

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

input:

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

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #57:

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

input:

500
9 1000000000
1 3 1 1 1 2 1 3 3
9 1000000000
2 2 1 1 2 1 3 2 2
9 1000000000
3 2 3 3 2 3 3 3 2
9 1000000000
1 2 3 3 2 1 2 1 3
9 1000000000
1 2 1 1 2 3 1 3 2
9 1000000000
3 3 1 1 2 3 3 1 2
9 1000000000
3 3 3 2 1 3 2 2 3
9 1000000000
2 1 1 2 3 1 1 1 1
9 1000000000
2 3 1 2 2 1 1 2 2
9 1000000000
2 2 ...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #58:

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

input:

500
9 1000000000
2 3 1 5 4 5 1 3 5
9 1000000000
2 5 1 2 3 5 5 5 2
9 1000000000
3 5 4 1 1 5 5 2 4
9 1000000000
1 3 3 2 1 1 1 1 5
9 1000000000
4 3 4 1 1 3 2 2 1
9 1000000000
4 4 2 4 2 2 3 2 2
9 1000000000
2 4 5 3 3 4 2 4 1
9 1000000000
2 5 3 5 4 1 2 2 5
9 1000000000
4 3 5 3 4 2 2 3 1
9 1000000000
2 4 ...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #59:

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

input:

500
9 1000000000
9 1 9 9 3 5 3 4 10
9 1000000000
1 4 10 2 3 4 7 8 10
9 1000000000
10 8 4 9 8 10 8 6 3
9 1000000000
9 1 2 4 10 10 5 1 6
9 1000000000
6 7 7 4 10 5 7 5 1
9 1000000000
8 10 10 1 8 3 5 10 5
9 1000000000
8 3 8 1 9 6 6 6 8
9 1000000000
2 1 1 7 4 1 6 1 8
9 1000000000
1 6 1 6 6 1 4 6 5
9 1000...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #60:

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

input:

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

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #61:

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

input:

500
10 1000000000
2 1 3 2 3 1 2 2 1 2
10 1000000000
2 1 1 3 1 2 3 3 3 3
10 1000000000
1 1 3 3 1 1 3 1 3 1
10 1000000000
1 1 1 2 3 2 1 1 2 1
10 1000000000
3 2 2 3 3 2 3 1 2 3
10 1000000000
1 2 1 2 2 3 3 1 1 2
10 1000000000
2 2 1 2 3 1 2 3 3 3
10 1000000000
1 1 2 3 3 1 3 3 2 3
10 1000000000
1 3 3 2 1 ...

output:

0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #62:

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

input:

500
10 1000000000
2 4 5 3 5 2 1 1 3 5
10 1000000000
5 3 3 3 5 5 4 1 5 5
10 1000000000
1 3 3 3 3 1 1 3 4 3
10 1000000000
1 5 3 1 5 4 4 1 5 5
10 1000000000
5 1 4 1 2 3 3 1 3 3
10 1000000000
2 4 4 3 2 3 1 3 2 5
10 1000000000
1 5 5 3 3 4 2 4 1 2
10 1000000000
4 5 4 5 5 3 3 1 4 2
10 1000000000
4 2 5 4 1 ...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #63:

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

input:

500
10 1000000000
9 2 6 5 5 2 7 3 4 7
10 1000000000
5 4 2 10 7 9 5 4 8 1
10 1000000000
6 5 4 6 1 1 7 8 1 9
10 1000000000
7 4 6 7 2 1 8 10 8 9
10 1000000000
7 6 6 3 10 2 6 9 5 9
10 1000000000
7 5 8 3 10 8 9 7 7 8
10 1000000000
7 1 6 9 10 2 5 9 10 3
10 1000000000
1 7 4 7 7 1 4 10 8 8
10 1000000000
6 2...

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Test #64:

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

input:

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

output:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
...

result:

ok 500 lines

Extra Test:

score: 0
Extra Test Passed