QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#59626#5007. InvitationcaobaoAC ✓107ms9772kbC++1728.5kb2022-10-31 11:04:572022-10-31 11:04:58

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-31 11:04:58]
  • 评测
  • 测评结果:AC
  • 用时:107ms
  • 内存:9772kb
  • [2022-10-31 11:04:57]
  • 提交

answer

#include <bits/stdc++.h>
#include <type_traits>
#define pb push_back
#define mp make_pair
#define bg begin
#define ed end
#define all(x) (x).bg(),(x).ed()
#define x first
#define y second
#define next nxt
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef __int128 xl;

typedef pair<int,int> pii;
typedef pair<int,pii> piii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<ll> vl;

template<typename Ta, typename Tb>
std::ostream & operator << (std::ostream & o, const std::pair<Ta, Tb> &p)
{
    o << p.first << " " << p.second << ";";
    return o;
}

std::ostream & operator << (std::ostream & o, xl v)
{
    if(v < 0)o << '-', v *= -1;
    if(v >= 10)o << v / 10;
    o << (int)(v % 10);
    return o;
}

template<typename T>
struct is_string : public std::false_type { };

template <>
struct is_string<std::string> : public std::true_type {};

template<typename T, template<class, class...> typename C, class... Args>
typename std::enable_if<!is_string<C<T, Args...>>::value, std::ostream&>::type
        operator << (std::ostream & o, const C<T, Args...> &obj)
{
    for(const auto & x : obj)
    {
        o << x << " ";
    }
    return o;
}

#ifdef local
#include "mydebug.h"
#define de(...) pretty_dbg(cerr,__LINE__,__func__,##__VA_ARGS__);
#else
#define de(...) void(0);
#endif


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>
T rnd(T a, T b)
{
    return uniform_int_distribution<T>(a, b)(rng);
}
template<class T>
T rnd()
{
    return uniform_int_distribution<T>()(rng);
}

const int N = 2e5 + 8;
const int M = 1e6 + 8;


const int inf = 1e9 + 1;
const ll INF = 1ll<<61;
const int mod = 998244353;


#include <cassert>
#include <numeric>
#include <type_traits>

#ifdef _MSC_VER
#include <intrin.h>
#endif


#include <utility>

#ifdef _MSC_VER
#include <intrin.h>
#endif

namespace atcoder {

namespace internal {

constexpr long long safe_mod(long long x, long long m) {
    x %= m;
    if (x < 0) x += m;
    return x;
}

struct barrett {
    unsigned int _m;
    unsigned long long im;

    explicit barrett(unsigned int m) : _m(m), im((unsigned long long)(-1) / m + 1) {}

    unsigned int umod() const { return _m; }

    unsigned int mul(unsigned int a, unsigned int b) const {

        unsigned long long z = a;
        z *= b;
#ifdef _MSC_VER
        unsigned long long x;
        _umul128(z, im, &x);
#else
        unsigned long long x =
            (unsigned long long)(((unsigned __int128)(z)*im) >> 64);
#endif
        unsigned int v = (unsigned int)(z - x * _m);
        if (_m <= v) v += _m;
        return v;
    }
};

constexpr long long pow_mod_constexpr(long long x, long long n, int m) {
    if (m == 1) return 0;
    unsigned int _m = (unsigned int)(m);
    unsigned long long r = 1;
    unsigned long long y = safe_mod(x, m);
    while (n) {
        if (n & 1) r = (r * y) % _m;
        y = (y * y) % _m;
        n >>= 1;
    }
    return r;
}

constexpr bool is_prime_constexpr(int n) {
    if (n <= 1) return false;
    if (n == 2 || n == 7 || n == 61) return true;
    if (n % 2 == 0) return false;
    long long d = n - 1;
    while (d % 2 == 0) d /= 2;
    constexpr long long bases[3] = {2, 7, 61};
    for (long long a : bases) {
        long long t = d;
        long long y = pow_mod_constexpr(a, t, n);
        while (t != n - 1 && y != 1 && y != n - 1) {
            y = y * y % n;
            t <<= 1;
        }
        if (y != n - 1 && t % 2 == 0) {
            return false;
        }
    }
    return true;
}
template <int n> constexpr bool is_prime = is_prime_constexpr(n);

constexpr std::pair<long long, long long> inv_gcd(long long a, long long b) {
    a = safe_mod(a, b);
    if (a == 0) return {b, 0};

    long long s = b, t = a;
    long long m0 = 0, m1 = 1;

    while (t) {
        long long u = s / t;
        s -= t * u;
        m0 -= m1 * u;  // |m1 * u| <= |m1| * s <= b


        auto tmp = s;
        s = t;
        t = tmp;
        tmp = m0;
        m0 = m1;
        m1 = tmp;
    }
    if (m0 < 0) m0 += b / s;
    return {s, m0};
}

constexpr int primitive_root_constexpr(int m) {
    if (m == 2) return 1;
    if (m == 167772161) return 3;
    if (m == 469762049) return 3;
    if (m == 754974721) return 11;
    if (m == 998244353) return 3;
    int divs[20] = {};
    divs[0] = 2;
    int cnt = 1;
    int x = (m - 1) / 2;
    while (x % 2 == 0) x /= 2;
    for (int i = 3; (long long)(i)*i <= x; i += 2) {
        if (x % i == 0) {
            divs[cnt++] = i;
            while (x % i == 0) {
                x /= i;
            }
        }
    }
    if (x > 1) {
        divs[cnt++] = x;
    }
    for (int g = 2;; g++) {
        bool ok = true;
        for (int i = 0; i < cnt; i++) {
            if (pow_mod_constexpr(g, (m - 1) / divs[i], m) == 1) {
                ok = false;
                break;
            }
        }
        if (ok) return g;
    }
}
template <int m> constexpr int primitive_root = primitive_root_constexpr(m);

unsigned long long floor_sum_unsigned(unsigned long long n,
                                      unsigned long long m,
                                      unsigned long long a,
                                      unsigned long long b) {
    unsigned long long ans = 0;
    while (true) {
        if (a >= m) {
            ans += n * (n - 1) / 2 * (a / m);
            a %= m;
        }
        if (b >= m) {
            ans += n * (b / m);
            b %= m;
        }

        unsigned long long y_max = a * n + b;
        if (y_max < m) break;
        n = (unsigned long long)(y_max / m);
        b = (unsigned long long)(y_max % m);
        std::swap(m, a);
    }
    return ans;
}

}  // namespace internal

}  // namespace atcoder


#include <cassert>
#include <numeric>
#include <type_traits>

namespace atcoder {

namespace internal {

#ifndef _MSC_VER
template <class T>
using is_signed_int128 =
    typename std::conditional<std::is_same<T, __int128_t>::value ||
                                  std::is_same<T, __int128>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using is_unsigned_int128 =
    typename std::conditional<std::is_same<T, __uint128_t>::value ||
                                  std::is_same<T, unsigned __int128>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using make_unsigned_int128 =
    typename std::conditional<std::is_same<T, __int128_t>::value,
                              __uint128_t,
                              unsigned __int128>;

template <class T>
using is_integral = typename std::conditional<std::is_integral<T>::value ||
                                                  is_signed_int128<T>::value ||
                                                  is_unsigned_int128<T>::value,
                                              std::true_type,
                                              std::false_type>::type;

template <class T>
using is_signed_int = typename std::conditional<(is_integral<T>::value &&
                                                 std::is_signed<T>::value) ||
                                                    is_signed_int128<T>::value,
                                                std::true_type,
                                                std::false_type>::type;

template <class T>
using is_unsigned_int =
    typename std::conditional<(is_integral<T>::value &&
                               std::is_unsigned<T>::value) ||
                                  is_unsigned_int128<T>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using to_unsigned = typename std::conditional<
    is_signed_int128<T>::value,
    make_unsigned_int128<T>,
    typename std::conditional<std::is_signed<T>::value,
                              std::make_unsigned<T>,
                              std::common_type<T>>::type>::type;

#else

template <class T> using is_integral = typename std::is_integral<T>;

template <class T>
using is_signed_int =
    typename std::conditional<is_integral<T>::value && std::is_signed<T>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using is_unsigned_int =
    typename std::conditional<is_integral<T>::value &&
                                  std::is_unsigned<T>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using to_unsigned = typename std::conditional<is_signed_int<T>::value,
                                              std::make_unsigned<T>,
                                              std::common_type<T>>::type;

#endif

template <class T>
using is_signed_int_t = std::enable_if_t<is_signed_int<T>::value>;

template <class T>
using is_unsigned_int_t = std::enable_if_t<is_unsigned_int<T>::value>;

template <class T> using to_unsigned_t = typename to_unsigned<T>::type;

}  // namespace internal

}  // namespace atcoder


namespace atcoder {

namespace internal {

struct modint_base {};
struct static_modint_base : modint_base {};

template <class T> using is_modint = std::is_base_of<modint_base, T>;
template <class T> using is_modint_t = std::enable_if_t<is_modint<T>::value>;

}  // namespace internal

template <int m, std::enable_if_t<(1 <= m)>* = nullptr>
struct static_modint : internal::static_modint_base {
    using mint = static_modint;

  public:
    static constexpr int mod() { return m; }
    static mint raw(int v) {
        mint x;
        x._v = v;
        return x;
    }

    static_modint() : _v(0) {}
    template <class T, internal::is_signed_int_t<T>* = nullptr>
    static_modint(T v) {
        long long x = (long long)(v % (long long)(umod()));
        if (x < 0) x += umod();
        _v = (unsigned int)(x);
    }
    template <class T, internal::is_unsigned_int_t<T>* = nullptr>
    static_modint(T v) {
        _v = (unsigned int)(v % umod());
    }

    unsigned int val() const { return _v; }

    mint& operator++() {
        _v++;
        if (_v == umod()) _v = 0;
        return *this;
    }
    mint& operator--() {
        if (_v == 0) _v = umod();
        _v--;
        return *this;
    }
    mint operator++(int) {
        mint result = *this;
        ++*this;
        return result;
    }
    mint operator--(int) {
        mint result = *this;
        --*this;
        return result;
    }

    mint& operator+=(const mint& rhs) {
        _v += rhs._v;
        if (_v >= umod()) _v -= umod();
        return *this;
    }
    mint& operator-=(const mint& rhs) {
        _v -= rhs._v;
        if (_v >= umod()) _v += umod();
        return *this;
    }
    mint& operator*=(const mint& rhs) {
        unsigned long long z = _v;
        z *= rhs._v;
        _v = (unsigned int)(z % umod());
        return *this;
    }
    mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); }

    mint operator+() const { return *this; }
    mint operator-() const { return mint() - *this; }

    mint pow(long long n) const {
        assert(0 <= n);
        mint x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    mint inv() const {
        if (prime) {
            assert(_v);
            return pow(umod() - 2);
        } else {
            auto eg = internal::inv_gcd(_v, m);
            assert(eg.first == 1);
            return eg.second;
        }
    }

    friend mint operator+(const mint& lhs, const mint& rhs) {
        return mint(lhs) += rhs;
    }
    friend mint operator-(const mint& lhs, const mint& rhs) {
        return mint(lhs) -= rhs;
    }
    friend mint operator*(const mint& lhs, const mint& rhs) {
        return mint(lhs) *= rhs;
    }
    friend mint operator/(const mint& lhs, const mint& rhs) {
        return mint(lhs) /= rhs;
    }
    friend bool operator==(const mint& lhs, const mint& rhs) {
        return lhs._v == rhs._v;
    }
    friend bool operator!=(const mint& lhs, const mint& rhs) {
        return lhs._v != rhs._v;
    }

  private:
    unsigned int _v;
    static constexpr unsigned int umod() { return m; }
    static constexpr bool prime = internal::is_prime<m>;
};

template <int id> struct dynamic_modint : internal::modint_base {
    using mint = dynamic_modint;

  public:
    static int mod() { return (int)(bt.umod()); }
    static void set_mod(int m) {
        assert(1 <= m);
        bt = internal::barrett(m);
    }
    static mint raw(int v) {
        mint x;
        x._v = v;
        return x;
    }

    dynamic_modint() : _v(0) {}
    template <class T, internal::is_signed_int_t<T>* = nullptr>
    dynamic_modint(T v) {
        long long x = (long long)(v % (long long)(mod()));
        if (x < 0) x += mod();
        _v = (unsigned int)(x);
    }
    template <class T, internal::is_unsigned_int_t<T>* = nullptr>
    dynamic_modint(T v) {
        _v = (unsigned int)(v % mod());
    }

    unsigned int val() const { return _v; }

    mint& operator++() {
        _v++;
        if (_v == umod()) _v = 0;
        return *this;
    }
    mint& operator--() {
        if (_v == 0) _v = umod();
        _v--;
        return *this;
    }
    mint operator++(int) {
        mint result = *this;
        ++*this;
        return result;
    }
    mint operator--(int) {
        mint result = *this;
        --*this;
        return result;
    }

    mint& operator+=(const mint& rhs) {
        _v += rhs._v;
        if (_v >= umod()) _v -= umod();
        return *this;
    }
    mint& operator-=(const mint& rhs) {
        _v += mod() - rhs._v;
        if (_v >= umod()) _v -= umod();
        return *this;
    }
    mint& operator*=(const mint& rhs) {
        _v = bt.mul(_v, rhs._v);
        return *this;
    }
    mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); }

    mint operator+() const { return *this; }
    mint operator-() const { return mint() - *this; }

    mint pow(long long n) const {
        assert(0 <= n);
        mint x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    mint inv() const {
        auto eg = internal::inv_gcd(_v, mod());
        assert(eg.first == 1);
        return eg.second;
    }

    friend mint operator+(const mint& lhs, const mint& rhs) {
        return mint(lhs) += rhs;
    }
    friend mint operator-(const mint& lhs, const mint& rhs) {
        return mint(lhs) -= rhs;
    }
    friend mint operator*(const mint& lhs, const mint& rhs) {
        return mint(lhs) *= rhs;
    }
    friend mint operator/(const mint& lhs, const mint& rhs) {
        return mint(lhs) /= rhs;
    }
    friend bool operator==(const mint& lhs, const mint& rhs) {
        return lhs._v == rhs._v;
    }
    friend bool operator!=(const mint& lhs, const mint& rhs) {
        return lhs._v != rhs._v;
    }

  private:
    unsigned int _v;
    static internal::barrett bt;
    static unsigned int umod() { return bt.umod(); }
};
template <int id> internal::barrett dynamic_modint<id>::bt(998244353);

using modint998244353 = static_modint<998244353>;
using modint1000000007 = static_modint<1000000007>;
using modint = dynamic_modint<-1>;

namespace internal {

template <class T>
using is_static_modint = std::is_base_of<internal::static_modint_base, T>;

template <class T>
using is_static_modint_t = std::enable_if_t<is_static_modint<T>::value>;

template <class> struct is_dynamic_modint : public std::false_type {};
template <int id>
struct is_dynamic_modint<dynamic_modint<id>> : public std::true_type {};

template <class T>
using is_dynamic_modint_t = std::enable_if_t<is_dynamic_modint<T>::value>;

}  // namespace internal

}  // namespace atcoder


#include <algorithm>
#include <array>
#include <cassert>
#include <type_traits>
#include <vector>


#ifdef _MSC_VER
#include <intrin.h>
#endif

namespace atcoder {

namespace internal {

int ceil_pow2(int n) {
    int x = 0;
    while ((1U << x) < (unsigned int)(n)) x++;
    return x;
}

constexpr int bsf_constexpr(unsigned int n) {
    int x = 0;
    while (!(n & (1 << x))) x++;
    return x;
}

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


namespace atcoder {

namespace internal {

template <class mint,
          int g = internal::primitive_root<mint::mod()>,
          internal::is_static_modint_t<mint>* = nullptr>
struct fft_info {
    static constexpr int rank2 = bsf_constexpr(mint::mod() - 1);
    std::array<mint, rank2 + 1> root;   // root[i]^(2^i) == 1
    std::array<mint, rank2 + 1> iroot;  // root[i] * iroot[i] == 1

    std::array<mint, std::max(0, rank2 - 2 + 1)> rate2;
    std::array<mint, std::max(0, rank2 - 2 + 1)> irate2;

    std::array<mint, std::max(0, rank2 - 3 + 1)> rate3;
    std::array<mint, std::max(0, rank2 - 3 + 1)> irate3;

    fft_info() {
        root[rank2] = mint(g).pow((mint::mod() - 1) >> rank2);
        iroot[rank2] = root[rank2].inv();
        for (int i = rank2 - 1; i >= 0; i--) {
            root[i] = root[i + 1] * root[i + 1];
            iroot[i] = iroot[i + 1] * iroot[i + 1];
        }

        {
            mint prod = 1, iprod = 1;
            for (int i = 0; i <= rank2 - 2; i++) {
                rate2[i] = root[i + 2] * prod;
                irate2[i] = iroot[i + 2] * iprod;
                prod *= iroot[i + 2];
                iprod *= root[i + 2];
            }
        }
        {
            mint prod = 1, iprod = 1;
            for (int i = 0; i <= rank2 - 3; i++) {
                rate3[i] = root[i + 3] * prod;
                irate3[i] = iroot[i + 3] * iprod;
                prod *= iroot[i + 3];
                iprod *= root[i + 3];
            }
        }
    }
};

template <class mint, internal::is_static_modint_t<mint>* = nullptr>
void butterfly(std::vector<mint>& a) {
    int n = int(a.size());
    int h = internal::ceil_pow2(n);

    static const fft_info<mint> info;

    int len = 0;  // a[i, i+(n>>len), i+2*(n>>len), ..] is transformed
    while (len < h) {
        if (h - len == 1) {
            int p = 1 << (h - len - 1);
            mint rot = 1;
            for (int s = 0; s < (1 << len); s++) {
                int offset = s << (h - len);
                for (int i = 0; i < p; i++) {
                    auto l = a[i + offset];
                    auto r = a[i + offset + p] * rot;
                    a[i + offset] = l + r;
                    a[i + offset + p] = l - r;
                }
                if (s + 1 != (1 << len))
                    rot *= info.rate2[bsf(~(unsigned int)(s))];
            }
            len++;
        } else {
            int p = 1 << (h - len - 2);
            mint rot = 1, imag = info.root[2];
            for (int s = 0; s < (1 << len); s++) {
                mint rot2 = rot * rot;
                mint rot3 = rot2 * rot;
                int offset = s << (h - len);
                for (int i = 0; i < p; i++) {
                    auto mod2 = 1ULL * mint::mod() * mint::mod();
                    auto a0 = 1ULL * a[i + offset].val();
                    auto a1 = 1ULL * a[i + offset + p].val() * rot.val();
                    auto a2 = 1ULL * a[i + offset + 2 * p].val() * rot2.val();
                    auto a3 = 1ULL * a[i + offset + 3 * p].val() * rot3.val();
                    auto a1na3imag =
                        1ULL * mint(a1 + mod2 - a3).val() * imag.val();
                    auto na2 = mod2 - a2;
                    a[i + offset] = a0 + a2 + a1 + a3;
                    a[i + offset + 1 * p] = a0 + a2 + (2 * mod2 - (a1 + a3));
                    a[i + offset + 2 * p] = a0 + na2 + a1na3imag;
                    a[i + offset + 3 * p] = a0 + na2 + (mod2 - a1na3imag);
                }
                if (s + 1 != (1 << len))
                    rot *= info.rate3[bsf(~(unsigned int)(s))];
            }
            len += 2;
        }
    }
}

template <class mint, internal::is_static_modint_t<mint>* = nullptr>
void butterfly_inv(std::vector<mint>& a) {
    int n = int(a.size());
    int h = internal::ceil_pow2(n);

    static const fft_info<mint> info;

    int len = h;  // a[i, i+(n>>len), i+2*(n>>len), ..] is transformed
    while (len) {
        if (len == 1) {
            int p = 1 << (h - len);
            mint irot = 1;
            for (int s = 0; s < (1 << (len - 1)); s++) {
                int offset = s << (h - len + 1);
                for (int i = 0; i < p; i++) {
                    auto l = a[i + offset];
                    auto r = a[i + offset + p];
                    a[i + offset] = l + r;
                    a[i + offset + p] =
                        (unsigned long long)(mint::mod() + l.val() - r.val()) *
                        irot.val();
                    ;
                }
                if (s + 1 != (1 << (len - 1)))
                    irot *= info.irate2[bsf(~(unsigned int)(s))];
            }
            len--;
        } else {
            int p = 1 << (h - len);
            mint irot = 1, iimag = info.iroot[2];
            for (int s = 0; s < (1 << (len - 2)); s++) {
                mint irot2 = irot * irot;
                mint irot3 = irot2 * irot;
                int offset = s << (h - len + 2);
                for (int i = 0; i < p; i++) {
                    auto a0 = 1ULL * a[i + offset + 0 * p].val();
                    auto a1 = 1ULL * a[i + offset + 1 * p].val();
                    auto a2 = 1ULL * a[i + offset + 2 * p].val();
                    auto a3 = 1ULL * a[i + offset + 3 * p].val();

                    auto a2na3iimag =
                        1ULL *
                        mint((mint::mod() + a2 - a3) * iimag.val()).val();

                    a[i + offset] = a0 + a1 + a2 + a3;
                    a[i + offset + 1 * p] =
                        (a0 + (mint::mod() - a1) + a2na3iimag) * irot.val();
                    a[i + offset + 2 * p] =
                        (a0 + a1 + (mint::mod() - a2) + (mint::mod() - a3)) *
                        irot2.val();
                    a[i + offset + 3 * p] =
                        (a0 + (mint::mod() - a1) + (mint::mod() - a2na3iimag)) *
                        irot3.val();
                }
                if (s + 1 != (1 << (len - 2)))
                    irot *= info.irate3[bsf(~(unsigned int)(s))];
            }
            len -= 2;
        }
    }
}

template <class mint, internal::is_static_modint_t<mint>* = nullptr>
std::vector<mint> convolution_naive(const std::vector<mint>& a,
                                    const std::vector<mint>& b) {
    int n = int(a.size()), m = int(b.size());
    std::vector<mint> ans(n + m - 1);
    if (n < m) {
        for (int j = 0; j < m; j++) {
            for (int i = 0; i < n; i++) {
                ans[i + j] += a[i] * b[j];
            }
        }
    } else {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                ans[i + j] += a[i] * b[j];
            }
        }
    }
    return ans;
}

template <class mint, internal::is_static_modint_t<mint>* = nullptr>
std::vector<mint> convolution_fft(std::vector<mint> a, std::vector<mint> b) {
    int n = int(a.size()), m = int(b.size());
    int z = 1 << internal::ceil_pow2(n + m - 1);
    a.resize(z);
    internal::butterfly(a);
    b.resize(z);
    internal::butterfly(b);
    for (int i = 0; i < z; i++) {
        a[i] *= b[i];
    }
    internal::butterfly_inv(a);
    a.resize(n + m - 1);
    mint iz = mint(z).inv();
    for (int i = 0; i < n + m - 1; i++) a[i] *= iz;
    return a;
}

}  // namespace internal

template <class mint, internal::is_static_modint_t<mint>* = nullptr>
std::vector<mint> convolution(std::vector<mint>&& a, std::vector<mint>&& b) {
    int n = int(a.size()), m = int(b.size());
    if (!n || !m) return {};
    if (std::min(n, m) <= 60) return convolution_naive(a, b);
    return internal::convolution_fft(a, b);
}

template <class mint, internal::is_static_modint_t<mint>* = nullptr>
std::vector<mint> convolution(const std::vector<mint>& a,
                              const std::vector<mint>& b) {
    int n = int(a.size()), m = int(b.size());
    if (!n || !m) return {};
    if (std::min(n, m) <= 60) return convolution_naive(a, b);
    return internal::convolution_fft(a, b);
}

template <unsigned int mod = 998244353,
          class T,
          std::enable_if_t<internal::is_integral<T>::value>* = nullptr>
std::vector<T> convolution(const std::vector<T>& a, const std::vector<T>& b) {
    int n = int(a.size()), m = int(b.size());
    if (!n || !m) return {};

    using mint = static_modint<mod>;
    std::vector<mint> a2(n), b2(m);
    for (int i = 0; i < n; i++) {
        a2[i] = mint(a[i]);
    }
    for (int i = 0; i < m; i++) {
        b2[i] = mint(b[i]);
    }
    auto c2 = convolution(move(a2), move(b2));
    std::vector<T> c(n + m - 1);
    for (int i = 0; i < n + m - 1; i++) {
        c[i] = c2[i].val();
    }
    return c;
}

std::vector<long long> convolution_ll(const std::vector<long long>& a,
                                      const std::vector<long long>& b) {
    int n = int(a.size()), m = int(b.size());
    if (!n || !m) return {};

    static constexpr unsigned long long MOD1 = 754974721;  // 2^24
    static constexpr unsigned long long MOD2 = 167772161;  // 2^25
    static constexpr unsigned long long MOD3 = 469762049;  // 2^26
    static constexpr unsigned long long M2M3 = MOD2 * MOD3;
    static constexpr unsigned long long M1M3 = MOD1 * MOD3;
    static constexpr unsigned long long M1M2 = MOD1 * MOD2;
    static constexpr unsigned long long M1M2M3 = MOD1 * MOD2 * MOD3;

    static constexpr unsigned long long i1 =
        internal::inv_gcd(MOD2 * MOD3, MOD1).second;
    static constexpr unsigned long long i2 =
        internal::inv_gcd(MOD1 * MOD3, MOD2).second;
    static constexpr unsigned long long i3 =
        internal::inv_gcd(MOD1 * MOD2, MOD3).second;

    auto c1 = convolution<MOD1>(a, b);
    auto c2 = convolution<MOD2>(a, b);
    auto c3 = convolution<MOD3>(a, b);

    std::vector<long long> c(n + m - 1);
    for (int i = 0; i < n + m - 1; i++) {
        unsigned long long x = 0;
        x += (c1[i] * i1) % MOD1 * M2M3;
        x += (c2[i] * i2) % MOD2 * M1M3;
        x += (c3[i] * i3) % MOD3 * M1M2;
        long long diff =
            c1[i] - internal::safe_mod((long long)(x), (long long)(MOD1));
        if (diff < 0) diff += MOD1;
        static constexpr unsigned long long offset[5] = {
            0, 0, M1M2M3, 2 * M1M2M3, 3 * M1M2M3};
        x -= offset[diff % 5];
        c[i] = x;
    }

    return c;
}

}  // namespace atcoder


using namespace atcoder;
using namespace atcoder::internal;

using mint = modint998244353;

mint fac[N];

void solve()
{
    int n;
    cin >> n;
    vi cnt(n + 1);
    vii seg;
    fac[0] = 1;
    for(int i = 1; i <= n; i++)
    {
        fac[i] = fac[i - 1] * i;
    }
    for(int i = 0; i < n; i++)
    {
        int l, r;
        cin >> l >> r;
        seg.pb({l, 1});
        seg.pb({r + 1, -1});
    }
    sort(all(seg));
    int now = 0;
    for(const auto& [x, y] : seg)
    {
        if(y == 1)
        {
            cnt[now]++;
        }
        now += y;
    }
    vector<mint> a(n + 1);
    vector<mint> b(n + 1);
    for(int i = 0; i <= n; i++)
    {
        a[i] = fac[i] * cnt[i];
        b[i] = fac[n - i].inv();
    }
    auto c = atcoder::convolution(a, b);
    for(int i = 1; i <= n; i++)
    {
        a[i] = c[i + n - 1] * fac[i - 1].inv();
        cout << a[i].val() << " ";
    }
    cout << endl;
}



int main()
{
#ifdef local
    freopen("in.txt", "r", stdin);
#endif // local
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int T = 1;
#define mulcases

#ifdef mulcase
    cin >> T;
#endif // mulcase
    while(T--)
    {
        solve();
    }

    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 3ms
memory: 4400kb

input:

3
1 2
2 3
3 4

output:

3 2 0 

result:

ok single line: '3 2 0 '

Test #2:

score: 0
Accepted
time: 81ms
memory: 9620kb

input:

100000
409388656 937517906
343707646 671717369
267577096 454947505
131801525 644635117
135225038 752169719
274138236 295311970
656230828 837788292
305041114 474506750
221620846 718341838
175227303 804888155
428754818 444737074
344227688 480955108
363083828 703234068
78877878 391228695
332534176 7428...

output:

100000 342923697 109105781 908915610 288635918 229494649 225188466 812981070 430547615 479972673 190826836 829527167 766456427 634801820 304059158 432575585 809180850 592825536 356821840 618410475 934967555 680471240 980820690 416768886 713503853 293100700 183860616 37480292 534387333 122973995 6803...

result:

ok single line: '100000 342923697 109105781 908... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #3:

score: 0
Accepted
time: 77ms
memory: 9616kb

input:

100000
464920152 531033126
342757104 813213167
39567904 996113513
233820884 664587138
446678256 826274261
25157320 543180073
357815596 667708433
33360894 801561937
559980082 801014148
413210532 994968283
874163468 875886352
10414688 153375013
73140895 784703772
53832446 592143287
349258475 611491360...

output:

100000 330637918 740383130 819514012 13667688 966367802 921723745 537283925 409216230 37993802 59356047 569147041 946575936 186608496 85348901 284457217 766657464 594628060 990948916 828098105 594636797 589374136 125023923 483165630 283445873 846564477 532782283 518229467 871903801 689296504 9033574...

result:

ok single line: '100000 330637918 740383130 819... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #4:

score: 0
Accepted
time: 75ms
memory: 9704kb

input:

100000
314770954 677240474
406673621 467902497
141754241 874849971
327181937 794948713
61736262 556653266
142046210 268579172
763541598 906345427
476367249 559588379
417472324 475730794
126651674 203182259
448421788 793742160
642958022 800464932
402155876 851012130
439928129 483782870
16479024 71226...

output:

100000 14174256 887701404 17573332 618578182 664076841 189904740 558891923 752394446 72462071 452160096 427897068 465975566 977659633 166040553 858189561 687882354 109214016 64737080 583375919 291302967 510489928 743339459 223260479 392980387 322581736 708767817 289764329 255372148 392027496 2570748...

result:

ok single line: '100000 14174256 887701404 1757... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #5:

score: 0
Accepted
time: 68ms
memory: 9620kb

input:

100000
5145006 981052767
125562874 438620461
221576100 266978740
214589868 890663580
400831968 758766418
32704241 938005630
64834002 951026213
380677850 750672082
321369157 959422340
109417129 526757940
178006260 571909453
266915975 325333191
621814334 755195159
740691375 876622727
63951612 88350323...

output:

100000 13509596 629608499 946767184 71602232 332868655 91526911 303457392 6020021 663376629 646548442 128642414 23784925 156982857 539929782 34478213 719465834 955944987 835889366 982783316 390226857 268813109 381962973 271752402 332302498 382988741 922289365 635490093 573471449 177204710 806417639 ...

result:

ok single line: '100000 13509596 629608499 9467... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #6:

score: 0
Accepted
time: 77ms
memory: 9680kb

input:

100000
432085503 919748549
34230288 732636803
185258360 467895352
419625842 530642355
613855189 901104419
47621752 775208130
385403975 552639874
377402107 407621244
533962022 685161332
6005363 939134580
443341078 855513544
210680755 970994700
4941280 410580478
689821553 714011294
287694932 979549958...

output:

100000 2280724 760209635 197236752 307492994 400012793 945324849 881911301 832559131 957374322 396807962 576694094 712719093 478298909 152301906 154876204 400073937 92965000 103345019 79106998 380010476 309358932 289421805 695560884 205000300 49293804 432117498 788576778 134245389 675895787 54757688...

result:

ok single line: '100000 2280724 760209635 19723... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #7:

score: 0
Accepted
time: 81ms
memory: 9628kb

input:

100000
371171011 478242619
372610454 834921810
474023219 777507052
330714853 886376461
80570612 904833826
320875530 901075514
56443899 868872357
799779227 867874243
624066200 822356582
175589582 236431185
281700896 954182013
374671035 616049367
503149718 940886203
320816716 576565479
61934006 539965...

output:

100000 5579682 725255885 850373829 774449268 224315302 14662477 39012825 945744813 921109737 639553737 372333080 726155934 156468687 974409880 140637750 497376290 58254667 988246660 560517316 567926170 622772442 33904076 380264143 315867821 813328533 746442202 425336130 588896697 997853890 491326751...

result:

ok single line: '100000 5579682 725255885 85037... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #8:

score: 0
Accepted
time: 69ms
memory: 9624kb

input:

100000
228720344 680209678
326534233 457699176
115907386 720173323
193566125 210341793
82728668 433647474
369021230 881951185
263611279 836234571
398965982 435447462
381677258 701036636
240139524 867054989
559457901 940221033
479832421 737885883
96926269 570497936
505173790 787577424
4327075 7702548...

output:

100000 2931449 501009082 138717960 515388037 23037338 209284221 673158807 518351118 718461934 273074047 406947416 296939583 396557019 148051507 573670090 496042281 39756540 482332484 631566456 768192469 168133056 906095440 488254709 149936052 426745414 866307740 726374507 736303049 528256828 2776034...

result:

ok single line: '100000 2931449 501009082 13871... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #9:

score: 0
Accepted
time: 81ms
memory: 9700kb

input:

100000
45430384 824595849
37689310 752569570
868968227 994485303
389973032 419084126
266690196 451039180
132690376 916742256
779097421 812803443
25536142 961457853
246792340 962530480
465504013 730104580
287942457 672720418
116633096 942102836
535255430 731555646
66486615 852421776
380034247 5878484...

output:

100000 6947965 329018690 502104119 687539342 950491156 651791954 89327410 267718473 671247836 770789917 182634729 518535981 852023929 107121277 80890559 953064344 718852252 257440343 394521158 994969721 912185403 797799430 987825182 233240045 365967756 120876149 544254200 32970396 857271204 24303404...

result:

ok single line: '100000 6947965 329018690 50210... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #10:

score: 0
Accepted
time: 70ms
memory: 9748kb

input:

100000
564751401 986939450
281331779 291331683
589986620 765717791
241285011 242049224
372768240 606476983
641829774 962333415
15156600 680524396
348124461 423601028
159816516 960636381
210697455 262630331
179485259 953375406
794201973 973156189
605795014 769285338
189890395 814855215
430744755 5543...

output:

100000 5620316 829539321 890464889 700102939 672876769 666826512 488957183 724328781 329810415 521893577 155238835 950190673 275879507 175805017 186664868 355332407 539411972 812635610 857454141 139628566 198325529 77087723 591649596 831452375 662259483 515520065 219632204 702490894 687640129 742903...

result:

ok single line: '100000 5620316 829539321 89046... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #11:

score: 0
Accepted
time: 76ms
memory: 9740kb

input:

100000
382984885 449468372
539339216 988523644
420556444 758654216
220578418 756394720
339710244 648935044
61723477 482266174
702789557 914440787
197471936 439299992
140323656 980194426
131687138 652271077
17695179 679248872
750021900 855635704
823019800 952099379
331104394 933378748
143626417 62949...

output:

100000 995741645 862249299 785253888 907792075 963956858 850670105 532011469 365498115 196418968 876197370 468464482 196857876 931662095 864397440 262468448 969014797 123338514 311132478 728313547 760155247 112406843 230059203 92352433 594796744 134402608 611595511 572182600 744438403 837588384 9816...

result:

ok single line: '100000 995741645 862249299 785... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #12:

score: 0
Accepted
time: 68ms
memory: 9520kb

input:

100000
257876994 834482092
263064440 390183411
500766945 813479591
59322372 944991141
184177337 936059686
486266151 822889992
82382593 329411076
6232054 745615129
171757378 868319630
284311630 579441100
170834497 383793763
267216939 454282695
314067792 544021428
102209935 526271580
99215474 85816178...

output:

100000 5566930 318650358 738263775 448482621 105474933 609629134 469392995 72131287 982563644 246958667 42851254 567833395 889728976 651202438 486086904 697731762 989296472 993146598 931036438 412030424 443825251 777566695 859480918 78883673 670310068 96107238 251437973 553756559 806939701 185757652...

result:

ok single line: '100000 5566930 318650358 73826... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #13:

score: 0
Accepted
time: 67ms
memory: 9700kb

input:

100000
178123064 724723296
37233701 115008570
244717396 432728834
508306159 923873405
116977358 786569865
322704835 448315226
357566204 750643405
158467415 662894648
248362122 507824326
396774223 545567231
320477912 819624040
536978908 611052925
406597778 836688348
72529858 967338616
411548380 62366...

output:

100000 12476864 329328304 72534966 987985464 325260114 725050729 743415911 543329067 678983699 421946978 501856851 858487276 801633263 916059285 696618250 781698219 370876379 69179793 452000912 38558650 18627233 996385033 933352745 537714653 622775180 964280977 189756495 623022972 887995638 15568046...

result:

ok single line: '100000 12476864 329328304 7253... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #14:

score: 0
Accepted
time: 79ms
memory: 9760kb

input:

100000
547516667 756592953
64763126 361954298
229124821 258658631
224677290 871774447
382624614 905093147
56971707 984479047
28496555 243562594
215191865 910283985
128891499 486763006
324395124 730054445
177634908 724047671
352503295 972133813
471805378 641589158
103859175 489320816
471351542 705390...

output:

100000 341814073 595567510 978096370 940308232 7597991 555282556 510436152 683863271 327421063 957509176 424959928 258548218 431811925 167811557 654990607 68648834 518054031 422044161 984752206 242730570 46458491 525200782 729560934 841195332 333120123 381221821 265262667 9706128 784394901 966192367...

result:

ok single line: '100000 341814073 595567510 978... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #15:

score: 0
Accepted
time: 107ms
memory: 9744kb

input:

100000
186605069 621310284
68127550 496687220
393014658 473195109
677445353 763430965
191026950 971035237
28566571 718359072
52372495 443658183
18097377 345871155
305288056 854878312
272969216 542429240
71028241 888705083
123004680 761151282
221272246 503754989
233303909 960703104
279844056 95904759...

output:

100000 631705420 655214622 293552359 740033925 769018396 503719061 746626723 385152193 885406632 572504408 189263680 483551123 56316186 994940878 759503013 197784569 884673513 635337881 818774929 249171927 145884949 478714119 382960758 705849750 730544014 983410143 799037819 871515798 404741387 7340...

result:

ok single line: '100000 631705420 655214622 293... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #16:

score: 0
Accepted
time: 82ms
memory: 9620kb

input:

100000
276484004 344465333
165032032 811200602
12731137 936883703
304430526 864908611
495108654 648027237
36377042 935864133
29213286 780632543
65351686 832440746
17754049 725145363
355657801 713821855
143142917 802907150
594944642 596811778
43956539 853551691
162907439 374346380
411134783 965209800...

output:

100000 626855048 814591677 72135039 292498286 983981235 472313256 157138074 356277473 485107331 41646243 856946070 735325994 433051732 351205339 404374345 798991781 772263810 874473092 847787632 107591283 785110850 582673521 482025827 498383544 42194992 567003473 355508532 646563584 209629030 318432...

result:

ok single line: '100000 626855048 814591677 721... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #17:

score: 0
Accepted
time: 76ms
memory: 9712kb

input:

100000
321613448 957420662
338113521 556781154
600661089 855500805
211683901 557033539
282703334 814061387
223615813 822702438
657644005 808804220
176611051 610793587
222169353 552847600
67446610 923987822
220241511 262850823
360597733 617383469
36617518 304369899
35989308 461682818
58473149 7471770...

output:

100000 628175288 201719883 871137921 506093518 515433866 303767063 745899774 802684479 841029862 689083716 936730976 731182240 558388906 90682578 159760885 586137906 671874605 584952184 758781525 105341957 930812211 124439780 682714334 586256542 782606074 571765463 660027038 533690131 764860588 5755...

result:

ok single line: '100000 628175288 201719883 871... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #18:

score: 0
Accepted
time: 69ms
memory: 9672kb

input:

100000
216004943 247983861
34117997 954301452
106024013 431912096
406128392 929829548
209338864 943234665
68982890 603507817
22981566 935825335
396870149 845885452
19238154 860199410
362494751 918808158
146625320 944830864
196468202 799566474
496833338 922665089
292317890 848984159
216960345 9162587...

output:

100000 627827015 235250095 36165636 844093129 772981323 144076048 884876255 430909374 546202550 47628561 5893497 964059278 778527414 675880679 322070067 701564915 374589216 253519564 400007593 693376313 407218140 543533202 521687302 282283647 866886061 597787669 838318979 345837377 913602853 5784246...

result:

ok single line: '100000 627827015 235250095 361... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #19:

score: 0
Accepted
time: 71ms
memory: 9552kb

input:

100000
228892572 770429892
5227458 469554396
134730629 554353111
614093293 721626945
260441221 954988949
189197187 983213036
280541007 527663896
152143256 924763269
427353844 521730706
304529364 833581047
51780670 512910528
156727157 920946585
62759429 986386653
4287724 798835085
143851200 597699857...

output:

100000 633752385 814169342 934392364 416003065 336640359 638273843 429949710 502873157 457132431 788127411 422380995 110997198 411302077 691539889 725760754 982105466 26805883 329287842 484664686 900674980 808198142 178533327 158275980 445738921 55978910 65271483 835262209 381710521 383318823 246856...

result:

ok single line: '100000 633752385 814169342 934... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #20:

score: 0
Accepted
time: 69ms
memory: 9628kb

input:

100000
118257577 836922464
395345095 723907111
116444660 966450076
303475727 776177491
82258744 917686509
90761418 293647469
607105087 613827192
100147616 748549952
773527321 775199280
314535113 894579816
77867335 652928533
546141712 645069654
465175862 841600051
14801999 775606604
181656818 4985516...

output:

100000 624377815 185058131 818894826 813312586 903643811 503031240 88200277 559865497 298750582 121254188 290773330 908334531 967770537 868177076 197625102 591443130 235949083 649051305 517859424 732308445 794008132 786554339 120810139 698591010 293893989 92122001 695839305 544751256 100542063 84917...

result:

ok single line: '100000 624377815 185058131 818... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #21:

score: 0
Accepted
time: 76ms
memory: 9624kb

input:

100000
450609877 916028165
340358124 450043841
212381980 443362083
135548915 972536251
243782047 983598361
131403749 804629658
329404184 637982481
88396043 722191189
55058582 798484947
312731820 654242840
164402 330489466
225815779 746610679
237352901 424060598
417177578 890817557
459304754 59610767...

output:

100000 625163557 577067530 769410662 893005385 76096651 885084109 632824500 792356827 450671647 994226359 723663471 59636662 562730924 680688472 210312642 905423003 834475358 524872265 272699481 761313954 149856178 980042781 820455284 261408691 719443377 68653780 482286085 657806375 88778594 3542515...

result:

ok single line: '100000 625163557 577067530 769... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #22:

score: 0
Accepted
time: 72ms
memory: 9656kb

input:

100000
352214257 708190347
18557531 970650312
255336995 318117929
645861434 692979462
274543899 921048196
317414051 446857717
174565476 804325072
346047821 673931023
430657337 795032931
265505696 761015160
347827236 503604682
573568587 731084978
273230482 967727314
108121809 806649534
436880221 4595...

output:

100000 627852891 13101811 221099807 101055692 802140956 925427972 156804014 49202416 283855160 975529791 228370154 485871103 880006554 107928084 660803305 955588203 724573862 196699444 940186079 795002244 408183623 983858547 539909260 958314891 180921069 891949735 727006400 740266251 636439900 36703...

result:

ok single line: '100000 627852891 13101811 2210... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #23:

score: 0
Accepted
time: 72ms
memory: 9740kb

input:

100000
696890214 816272780
244133952 975103941
446863465 534187759
202483361 466212556
526899620 856774156
55657072 976233007
132519226 950274501
521345438 867979666
110304528 781344336
314755107 993190938
12825229 255500063
109878128 473216619
293861187 978364570
550937398 787422731
27966379 756461...

output:

100000 626750192 722790812 989863765 353110729 684911421 562690755 617916901 66368944 263821215 222173207 149094002 653177005 766961735 350203695 73121291 282625206 635582960 454838003 109621919 403819134 444386505 789995872 254006793 156977888 427586817 952753013 444531686 441953600 458925965 91057...

result:

ok single line: '100000 626750192 722790812 989... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #24:

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

input:

100000
331446700 608053187
375750019 662684584
232245411 763580787
265552171 937702983
193443791 674387314
202463487 939538657
196992613 509335917
365968219 585012540
204961343 697817441
251449770 858583635
29404307 479033867
155272733 982484530
314463023 692629604
174697707 723433341
56738996 95768...

output:

100000 625830791 861649379 827645132 484082138 723702737 376564763 103698415 153920698 330617499 215835454 664512997 594613227 274398752 990433327 33240140 797172429 660632145 329588175 318593173 762397582 102917827 391799011 464375256 478231360 812673931 463613957 134574397 585067616 548258874 2597...

result:

ok single line: '100000 625830791 861649379 827... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #25:

score: 0
Accepted
time: 72ms
memory: 9756kb

input:

100000
107926787 557994217
343784779 906611751
69947829 588542527
867827770 990922448
177597241 593872289
30858563 42310875
34598604 280219725
205851193 785866376
343592467 359104682
83345587 442112332
98874133 757671943
609841021 718288334
46863691 932664037
131826171 946650812
318904130 926458282
...

output:

100000 344276529 578169828 427845206 27266112 192659460 543834093 952582249 619372082 382232412 839155309 322685392 324987626 202673973 563717670 751976251 644389053 480992326 748826244 892055154 614366584 971458673 191680515 389440411 962102104 777439084 485060239 948566903 97034789 583934528 50604...

result:

ok single line: '100000 344276529 578169828 427... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #26:

score: 0
Accepted
time: 76ms
memory: 9700kb

input:

100000
200998305 681953305
71844078 659158148
257942175 931125260
9595164 789286056
47863042 918640976
24146865 434049755
56187893 701785947
63965622 793534802
99852247 589115312
358328965 844988099
185356957 900891175
361824021 672587278
105895048 815372162
666230306 989379861
246828525 502001948
5...

output:

100000 882732988 535387466 947592521 487665369 415088553 760056233 114222234 930115236 589218242 544454909 889415365 268474722 660190295 52686598 68012300 239320917 133396591 454831602 724894043 99138740 889026767 130976075 449385079 618560510 221198552 231329710 971549101 700693073 617476916 250686...

result:

ok single line: '100000 882732988 535387466 947... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #27:

score: 0
Accepted
time: 69ms
memory: 9748kb

input:

100000
28076938 968143340
339015259 645117005
519063680 566254218
246661330 916306945
88685743 951531133
131504610 772780711
27625043 674457328
253745504 406915895
233048773 902014829
181500770 996768288
379152517 795941986
35924434 500298349
152938687 689175855
403552750 554414526
455197719 6345301...

output:

100000 883874030 511383830 599898752 554093292 441207470 984610160 897068438 790909306 756422048 96469116 477183690 840922348 315808837 543432834 810324045 893999400 434381077 647031174 257699778 895109039 252007372 849808139 590194249 345367117 696608549 807937258 281914543 711950992 17915353 67130...

result:

ok single line: '100000 883874030 511383830 599... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #28:

score: 0
Accepted
time: 82ms
memory: 9516kb

input:

100000
30678479 854180418
7777489 959841326
213009421 956159286
144969432 886991315
28929178 884107989
1687621 895855635
288669187 947013500
134630970 667675683
25881368 968188142
40860576 957570142
208022076 720275161
104583557 971120659
66762920 928002712
333854253 393865401
72524456 747947521
183...

output:

100000 881748247 218562370 203940395 913114562 797423405 396266273 297942651 171722731 597550416 396259641 386612531 853558888 190055613 339764050 774424380 229528966 128485644 914253265 986599522 744522143 85273058 796695326 412796468 517556478 436474485 776247842 114895908 578839186 613408371 8616...

result:

ok single line: '100000 881748247 218562370 203... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #29:

score: 0
Accepted
time: 77ms
memory: 9672kb

input:

100000
470903431 683182544
39183514 872004089
76537202 719368139
74937856 478338451
282120348 705596195
405001940 950381615
106490516 826388509
103290283 934957457
294608811 966623835
368131143 853701980
86373789 942709137
176680802 791322439
318987262 850058682
25399948 991088824
439730734 50430418...

output:

100000 884520966 707235859 591813615 763146850 5728133 488150364 454772664 513806765 753485712 366937365 703249479 565487736 299046356 242879789 121324848 107812173 394881156 334402372 380853731 213559763 785353112 997414260 125554516 42044615 118607309 861049488 165802110 884558576 476912180 917149...

result:

ok single line: '100000 884520966 707235859 591... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #30:

score: 0
Accepted
time: 71ms
memory: 9672kb

input:

100000
209762346 936886760
85955227 900500253
35192835 739165806
335227085 698944971
72330130 957208629
796201040 914922303
194839087 680360294
215475123 238734999
89219171 962172317
126954023 640320159
353943293 900288080
229288225 975472238
187973837 571107812
15980790 942002532
60852585 997936552...

output:

100000 882481310 452179860 670381041 337955927 903455644 709857626 591379884 44978508 512823682 487754662 168408577 542955013 521212610 62041184 970550728 9456886 150348495 738067369 338239041 578991958 227885829 148774208 195325577 694637855 335371420 719085896 862462117 702500037 921355843 8926601...

result:

ok single line: '100000 882481310 452179860 670... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #31:

score: 0
Accepted
time: 76ms
memory: 9744kb

input:

100000
108514025 812749366
195437778 897384109
97730646 818891576
321830959 979155733
652148459 653168559
29699068 925527589
172484400 981377403
104224450 849537056
97418240 930859307
176509605 944317097
157363928 931919424
452746111 669195314
466000124 572132569
19908575 912588142
82875688 38476787...

output:

100000 883599354 200910922 451872045 202349829 924854934 623891157 143089548 907611275 973409484 483467656 197312576 996352947 924098179 994756012 236801809 697432588 603073412 300125349 976421600 925705606 412970176 183149501 749855802 837542805 531935584 146789797 325265460 667230514 43718151 4068...

result:

ok single line: '100000 883599354 200910922 451... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #32:

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

input:

100000
25339521 961168802
191240483 848628229
186408045 901659698
184722528 921299990
266735477 487086157
272562320 811225641
309868339 874287105
88506931 912101978
267291675 987374719
288489702 832831664
55419135 813134529
361866096 977289154
97427144 802227050
27845908 981825015
148331040 88860160...

output:

100000 884227752 696476388 850818463 309488059 41607557 611320070 536998505 167920058 801411094 544474594 759711761 586550092 73174575 699028165 638157243 67329562 27280122 352774982 79296610 284271135 13504542 690485006 935501639 206938683 218069905 925298114 242221961 216608030 806368494 580298399...

result:

ok single line: '100000 884227752 696476388 850... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #33:

score: 0
Accepted
time: 71ms
memory: 9744kb

input:

100000
11324725 586394512
71803233 626065100
174351659 963399536
87170637 892485534
435053907 760192787
167036953 966656254
15193457 693237547
152511610 681733283
166880868 880762561
544964079 995659678
48311356 592363750
221196937 999972612
106584508 223940993
160907697 949655405
289873768 82608467...

output:

100000 884901412 432317896 230036823 65823141 694953253 169063593 871656018 813377771 309158202 484052857 965466586 587028174 49019309 838885020 377577837 379367532 806902034 194482716 332848730 338625665 731678275 63252100 705252965 355271965 812977436 324832458 725514815 894407702 376979368 828461...

result:

ok single line: '100000 884901412 432317896 230... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #34:

score: 0
Accepted
time: 84ms
memory: 9520kb

input:

100000
283915096 836574785
302437155 578486803
361608696 659005179
24829777 562205950
146437164 910619349
41458428 655554841
58101329 652459383
224537041 659426299
313140910 921161051
411312339 795706643
511849857 711125458
153726789 869075358
218553395 908709971
428636504 815491129
514344460 759251...

output:

100000 880716321 460773330 688421794 198251011 828535954 67638701 907343390 695275657 869114609 296508724 388186882 931400939 776889329 683645032 882167836 460935302 955881911 850634958 764389145 794331550 636846754 287499077 909076781 794382485 752360180 572064803 294994246 671913519 412222548 6794...

result:

ok single line: '100000 880716321 460773330 688... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #35:

score: 0
Accepted
time: 66ms
memory: 9684kb

input:

100000
16845311 710163012
87383029 624314052
354344093 900780536
386359949 855304843
530655760 886758978
412537762 782472256
388680342 942319630
245364394 621912781
54439071 855435382
229990681 921191053
217043362 726009683
360972843 803555978
495360406 904382744
206778215 650488548
374898054 728747...

output:

100000 883676414 515936503 21602948 834368445 280689336 903342009 720091172 296835474 740213930 151645844 945636239 234378314 733156589 252048361 722266666 835243512 945638980 588884007 91915866 382745414 801987052 356645021 428025465 104276749 887268621 396887096 932126355 441758442 482884170 89969...

result:

ok single line: '100000 883676414 515936503 216... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #36:

score: 0
Accepted
time: 72ms
memory: 9656kb

input:

100000
235306063 966697968
6184360 95521005
89644320 935905519
630590435 971109540
836855482 926602671
136614561 532657591
476825170 550789969
137765128 865919980
271957641 675534935
530141131 739283040
390047002 924486296
790222380 904339442
2460841 696272492
195944814 457890437
339012344 895357437...

output:

100000 329057280 37117338 375515334 517963648 637533727 288125079 609530496 500307648 983595876 648197000 561266654 244265137 905113687 818104219 185664268 124557917 886584227 960455165 473215686 581868072 311619423 439957861 901311918 408553870 763946791 516693749 674849366 212788653 288756385 4479...

result:

ok single line: '100000 329057280 37117338 3755... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #37:

score: 0
Accepted
time: 75ms
memory: 9672kb

input:

100000
364004144 909533853
563351693 857033944
516916585 922531187
415868804 760136280
430650154 971098585
562698063 698323137
391388597 805652330
82762286 964573042
348658000 902580986
74537627 900307872
275907186 911866108
180984786 833546405
534282666 803033684
81891404 874058817
216334638 929037...

output:

100000 970028211 352137991 377231986 708471057 925134062 171382665 504864262 697320472 250022195 59290437 950544025 911413647 635541776 948660674 373209217 163483970 747144887 503806893 861475216 204738574 723876323 202883490 735846840 363596848 23311976 464174890 852294726 660110407 543122031 16389...

result:

ok single line: '100000 970028211 352137991 377... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #38:

score: 0
Accepted
time: 81ms
memory: 9704kb

input:

100000
14592891 997288674
35711201 613592198
224647869 989251087
144378900 802170073
258427818 843782885
223930297 597380315
109726409 962174559
94507501 788429084
50581160 928216759
179203248 649235498
361382412 842636157
142333306 960468837
21542138 710785896
193017262 878370625
72891976 828965164...

output:

100000 972214258 420555331 981413635 550622773 730166951 990725241 616063809 188611243 104192920 75670868 237645733 49189724 616586624 315417172 39401881 525707917 887928165 712163065 154401889 209482384 10788374 86258581 687409475 9698788 82222188 53004142 850577733 583482521 871173572 537203155 88...

result:

ok single line: '100000 972214258 420555331 981... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #39:

score: 0
Accepted
time: 86ms
memory: 9552kb

input:

100000
178272143 967437587
204608061 852021685
372318101 781759662
326167288 937291367
36677148 845060217
72648467 938064381
9429754 696154526
108030949 965052486
62158131 634236796
211759019 927744806
558992487 864119959
372668672 392206991
309487249 919178974
317809188 849535970
385089536 43619330...

output:

100000 970269802 775343341 698155120 64509636 800295599 7522182 840592116 916817349 195665776 871300242 47753357 722147286 330263872 986097222 8325443 519572866 916551844 738022942 428880228 182948037 449666289 975066927 584702859 197502622 809778505 304405649 672659976 298667646 514569754 610483584...

result:

ok single line: '100000 970269802 775343341 698... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #40:

score: 0
Accepted
time: 69ms
memory: 9652kb

input:

100000
27915402 971473638
115426180 975991775
34561585 735103202
404716067 990682824
38847703 982297504
146272375 760743465
69974737 921605888
91373610 855115046
150998297 898243620
324531283 698214255
135067218 925557296
179314087 514777502
19446910 983958384
154974614 854193572
65580886 917539574
...

output:

100000 970811244 309893744 304726363 334733271 665360703 651575029 707425950 342956569 337954003 571408219 411959869 665089957 706305625 984029724 808710560 915352693 181973716 674229488 593934431 676305431 701421212 484566667 820789934 306373926 665161626 99597395 799009577 617556404 339713304 3170...

result:

ok single line: '100000 970811244 309893744 304... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #41:

score: 0
Accepted
time: 77ms
memory: 9756kb

input:

100000
2173944 839315902
4581751 881105300
454307654 642672980
40275842 926252876
31858994 871339718
349399233 712678366
126893231 463764199
140003993 848408238
153959287 969120380
123394407 899883178
77688676 863453842
369720416 983893769
101836950 905279138
73907724 946498438
293921349 661131194
9...

output:

100000 969708067 761803836 932502767 492690075 947101009 683892489 531546040 926632760 539602910 291625538 753940271 48063840 378714877 676307071 98045309 724395319 147272364 211878052 945013987 167667431 862118713 485309983 399372730 686921679 791468226 285542105 72190322 613028380 475394927 205136...

result:

ok single line: '100000 969708067 761803836 932... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #42:

score: 0
Accepted
time: 70ms
memory: 9656kb

input:

100000
66128048 949517079
222752600 487739800
119253869 851507953
243153226 876706067
76284286 782126394
137915716 924905313
131201184 975429704
72115980 964268925
79155823 955414981
132889180 817005784
202496175 977263344
68816505 899192672
78763772 926202869
314449968 931232947
106467038 638063291...

output:

100000 970277870 573944942 593905934 262618015 581947769 998201146 805556026 782304804 611820404 670699841 895983143 38359810 903422072 312721186 53360347 480354752 719580407 442639150 78012426 459191383 39885820 547557532 648049929 816851196 113173544 883671207 834308002 491377761 10003610 33158304...

result:

ok single line: '100000 970277870 573944942 593... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #43:

score: 0
Accepted
time: 86ms
memory: 9652kb

input:

100000
26844230 786681997
24987501 913067472
442888310 706625846
13922223 897951625
161316383 967329890
431961978 674377926
46289798 769446828
412040466 740836181
377785259 549358863
228251662 988907541
180375168 835314594
16303944 637727711
251408584 762915031
363531458 894835053
172679700 97370904...

output:

100000 971247538 912693033 897521519 110370862 714583012 137044707 437744488 287397232 256113218 124531269 59572634 814749514 230081040 89994663 504900596 177142273 577194172 899115889 149971385 423616676 393718381 228102912 856961684 658248495 708765255 865107505 150009691 733638501 615257129 95615...

result:

ok single line: '100000 971247538 912693033 897... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #44:

score: 0
Accepted
time: 77ms
memory: 9700kb

input:

100000
82838712 799923962
145689868 868369987
88208349 993894431
168707262 896867000
232782203 731770478
284014854 381862067
408977070 915779934
26104489 994088633
134922475 995055304
440555180 885675540
357985943 700969037
382295251 918765370
115299169 895393353
41129840 926702943
150249799 9097126...

output:

100000 970215148 737628673 418353651 393623947 255037579 135073171 641432882 298213438 698177882 560825986 214360972 423350090 243036905 210410477 483818154 916204162 379209267 425986107 582626758 584792483 542921398 512421245 923143876 479512542 211934158 939804185 485751989 725226499 297938541 393...

result:

ok single line: '100000 970215148 737628673 418... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #45:

score: 0
Accepted
time: 73ms
memory: 9620kb

input:

100000
68586293 731730611
88338623 915696221
164890572 705808621
186549892 469133012
105667804 766737812
269733826 386185560
31855586 816718882
494566568 915399279
243994900 790486966
335473174 887368563
392197221 957739085
179955279 917641104
24202489 548619401
284001689 950143999
41222085 98763774...

output:

100000 970246097 48902438 645361306 997597451 481990276 185475813 728820910 39495966 200762698 45816413 253722014 500807988 459856615 938059213 948279587 205644915 890331523 358398168 718815313 372302164 491114082 453237110 483722509 293200565 399896126 432085259 412726384 399085482 786769849 412169...

result:

ok single line: '100000 970246097 48902438 6453... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #46:

score: 0
Accepted
time: 68ms
memory: 9752kb

input:

100000
219650605 801986413
431586230 949154684
139716709 993777570
212597134 789986786
192176714 913821514
23146365 689475197
2615800 978326676
389541570 923383348
11772997 793755082
112174681 816709295
252491706 839701628
25378041 920132224
13091122 653084553
462149716 936764930
203521448 911254618...

output:

100000 970924645 538205982 275212104 798020475 596264794 302253921 11818158 790738817 869894204 21074804 772233076 826914305 980598710 293254604 820711930 253915925 31296009 279564743 605541604 5112556 926718297 304406304 612691102 452086743 85766531 778142021 907260690 833144490 80554720 969095391 ...

result:

ok single line: '100000 970924645 538205982 275... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #47:

score: 0
Accepted
time: 76ms
memory: 9680kb

input:

100000
14234434 924367756
207887236 949312589
451722656 701250761
662907822 969170168
166418234 276919486
551832612 613634562
305354722 588325335
25394292 79835368
587961403 780059988
98362840 845305326
775780034 840935079
316977128 437647763
99602665 540402264
427932328 722301197
164685334 80172747...

output:

100000 348835674 243403315 898443386 477385481 319402052 360972585 218939870 405382286 974374951 550307765 45443132 212889435 655968895 606233753 162128926 874210566 724606327 197535667 161932090 334366812 630808111 306679318 218805531 910370258 708635823 709729182 809126655 861697344 340123651 1145...

result:

ok single line: '100000 348835674 243403315 898... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #48:

score: 0
Accepted
time: 78ms
memory: 9652kb

input:

100000
76925497 997464775
29010850 719075295
19210795 882160593
94611580 949856201
170259337 997955104
36985655 786039319
230003247 931521433
30782355 976825339
101838397 794757723
48555033 858561556
98664982 971955224
422687615 827400543
61052919 979116850
269282365 984057679
294182660 874702857
26...

output:

100000 996877185 214053209 928995906 469291030 950531243 222797815 88746331 834718365 883219989 767435240 799942956 874829950 344912932 114553662 175185195 733816870 3420308 615256624 266885736 490702759 957876150 432902503 759579689 658175128 565004605 611915271 850961433 913074096 176184014 506253...

result:

ok single line: '100000 996877185 214053209 928... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #49:

score: 0
Accepted
time: 77ms
memory: 9620kb

input:

100000
31943178 956840259
330876235 543814025
137050473 824729930
364570784 810327546
156235315 989416032
40233553 979193564
95930105 983977328
169919458 455249936
95687140 569084446
182088035 809913360
139153180 709583805
66134917 722423902
56444644 819349009
65894159 639276234
60487510 986632717
6...

output:

100000 997101177 117273716 231894188 219517252 869610005 704084141 193210939 288763764 638481319 561398912 110086726 983405006 377941355 492213852 196828193 597036276 135300647 101471416 654663284 105827016 165944187 263032072 706579839 312756267 769153148 603120005 820067073 364199418 880753745 981...

result:

ok single line: '100000 997101177 117273716 231... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #50:

score: 0
Accepted
time: 66ms
memory: 9616kb

input:

100000
23554543 946915104
10717996 957818584
101778529 800398971
221361492 976806898
36977602 974389116
163613363 813811717
27272437 732695643
67302771 973676393
227125210 861020533
26284116 896892309
161404447 942865072
198742180 952540602
124943697 799404959
551512741 922875612
437005860 889471052...

output:

100000 996456506 942134747 445407488 443475778 454916233 606138160 316945129 893864400 609921339 846212482 263466671 15392674 560372220 485368759 850979434 535688524 397134809 83537818 39067046 244906334 550558081 615696300 598252811 405575252 795528507 17434992 981744235 961140511 699049018 6149121...

result:

ok single line: '100000 996456506 942134747 445... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #51:

score: 0
Accepted
time: 65ms
memory: 9556kb

input:

100000
38235470 671429390
341717218 925102625
60460683 988963959
310600871 568500200
113877560 926855694
254093602 779016136
19383166 641443562
145658398 730773916
83059711 701161978
715777154 800666308
260844065 902463955
7366912 914191372
185449840 982051140
248737665 634067527
368372838 814763426...

output:

100000 996906138 264316600 960855128 633791664 162363476 916877530 184168004 629749526 174448758 832738625 447464097 36752965 606832848 268704811 113864281 864570346 964669197 62178948 466661925 811903235 713536549 422302366 881848310 193039030 771037421 159976038 200637583 524496508 771487610 16110...

result:

ok single line: '100000 996906138 264316600 960... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #52:

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

input:

100000
76103218 906178201
45192484 950530573
206394981 968425654
175695748 887036653
398088693 965084178
14393503 966443115
168429302 709342289
53740805 475063892
179315994 996411609
133056773 999677617
157985309 904727152
1852132 971096967
84286146 846936433
20727706 875881638
67698443 818379684
12...

output:

100000 996704898 74922657 597715817 830746226 48410636 44960118 595211973 806374264 809929315 571325539 446727059 361039508 458048440 273290442 898798207 961240760 3682699 190162469 800980853 852725855 990934656 340698585 326113454 493311950 210161546 269872935 967974590 480262032 340980645 20725052...

result:

ok single line: '100000 996704898 74922657 5977... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #53:

score: 0
Accepted
time: 81ms
memory: 9772kb

input:

100000
24295207 937394441
188611333 787686000
150270365 756814114
3072598 966486599
115002890 312191033
70379769 929512817
87707730 929547506
232644602 532502577
76187820 971432794
20424032 924484084
64632055 966763019
189027456 846296583
276007161 937257832
411950022 986186474
5429473 859678352
151...

output:

100000 996090522 747433108 676985930 928268627 609650515 758087130 895280364 630642110 376227422 329259894 860116752 616076275 805106743 865772915 314250734 418672479 990537624 555825813 934900184 887229228 884060129 659391625 6979176 793423409 371731538 323848427 797283793 526513422 455059857 74663...

result:

ok single line: '100000 996090522 747433108 676... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #54:

score: 0
Accepted
time: 70ms
memory: 9552kb

input:

100000
4384615 874822050
280475240 916936889
70437266 683412428
405986348 889357331
15609499 968023494
20297156 802797867
79509959 850541532
253671902 870373183
236101552 962465833
81692245 912952400
53348707 589945217
48290305 939386954
132267876 748719810
270745235 849533193
367749851 928512933
12...

output:

100000 996238608 732067455 494233296 156471855 989714089 207994996 662001500 377308521 739771088 146007957 932059886 957974767 432081706 592869809 870766933 823929951 104170308 770907764 673284728 357572274 471053572 393655013 9630393 507531356 943378236 875854841 240961943 49098269 961947531 554788...

result:

ok single line: '100000 996238608 732067455 494... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #55:

score: 0
Accepted
time: 79ms
memory: 9652kb

input:

100000
11119613 984536451
151227311 950923132
45062731 846950120
90335478 796405707
106111417 886132728
23207542 584562605
156436773 936848538
148513393 560944837
300357260 999065206
155955603 940788280
44024845 977223593
105266046 984217898
2553557 997611468
213254252 895711941
147946229 976662317
...

output:

100000 997063405 745175445 670666614 579748987 360040005 553261827 179903172 746158968 196311183 584162148 633061884 813412306 415056665 302339528 853919347 211758858 985622238 431990861 82951262 19276260 829476379 555680524 732284090 911896044 231301981 928833319 232044913 854112468 751020355 90651...

result:

ok single line: '100000 997063405 745175445 670... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #56:

score: 0
Accepted
time: 75ms
memory: 9556kb

input:

100000
118837393 761625652
137952537 516386105
35574902 835257944
26810546 810720428
85683898 918379307
140705412 960728596
23080253 929788577
16522365 811334840
48858661 922411027
88001779 837418100
38584389 880341535
145477834 975648074
85393350 885776771
221880394 958787891
221241338 892175779
48...

output:

100000 996821263 260154775 370226125 482997160 265049046 97023898 201588949 47738988 984408862 937769793 660253954 578344391 278020225 763169210 771262435 402465120 991756340 135734423 810158934 764557569 474012015 187991066 205578677 458081078 72297325 400863864 810513365 757848448 633192421 350238...

result:

ok single line: '100000 996821263 260154775 370... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #57:

score: 0
Accepted
time: 68ms
memory: 9672kb

input:

100000
89894172 751715503
270954798 480874890
197358544 711468649
83623095 823952416
1824401 931800562
62911801 682504526
241907532 881436180
36571506 712374175
86773948 976041805
98925484 964748085
28786211 955682932
71529186 745696433
75624632 914644386
325638872 948676728
3902722 888959653
150740...

output:

100000 997501046 983651730 411232513 853793895 205624881 453486903 787206382 64399560 394062998 586532358 681774125 349217271 623577468 329710582 435825727 991528081 563367860 126940530 529245279 665519697 678179893 955335809 77308391 381984565 447661446 947083299 323677357 311216933 864718694 54307...

result:

ok single line: '100000 997501046 983651730 411... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #58:

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

input:

100000
877297402 899283283
133234268 436887755
863872141 934317021
478994659 704311981
668658080 874288247
748833351 896885118
540383859 738221403
118355484 134049404
254958475 341930536
421010357 855474484
220763282 717269965
762582473 985901849
106930454 541157128
524284274 608354024
133222100 255...

output:

100000 324602396 150307311 903353912 711794651 549876128 463810255 293217157 860083043 154309585 708290568 973725317 405782900 593087756 59163395 447663491 194996570 218126619 681268309 430966117 161467309 988508992 317079885 4555799 588082064 596031982 59981735 863703697 336874387 96777958 24455459...

result:

ok single line: '100000 324602396 150307311 903... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #59:

score: 0
Accepted
time: 79ms
memory: 9556kb

input:

100000
73329728 621174016
4435089 683854290
269183107 827052351
261867828 789693479
153268039 939383112
23892108 753156928
250026687 826152112
493075122 795990127
6023630 919699001
78033920 797067143
109536870 938179776
141460572 993760865
116488892 442908041
95768988 913416378
166496118 899454847
1...

output:

100000 5870352 257790681 607972025 676911940 910492240 707103388 121919990 707889488 62891978 899866202 112847988 201805638 795547260 424338608 36651703 269128592 195496584 826690883 446533503 41379884 853785185 389958337 253572516 989658517 254860409 77847126 854198219 66901060 716652636 284507154 ...

result:

ok single line: '100000 5870352 257790681 60797... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #60:

score: 0
Accepted
time: 62ms
memory: 9744kb

input:

100000
204933422 787717937
3593577 960234423
344984968 869746333
233785783 856880237
31013926 984506898
266413475 967550085
102814982 935598195
98479523 761690258
87077235 903416948
66015279 907875652
70331736 838138971
312853657 971124603
194641729 800956339
17322555 685872383
88468152 918798691
10...

output:

100000 5940663 800688744 577683038 734200577 129142365 510875260 369080557 242149637 166187140 514012447 543323149 431705173 931394125 818914368 394994005 237420277 364082276 393469720 726608889 210399073 106147905 100712823 539445671 269296159 956801335 913558155 406454485 465913621 700939999 70777...

result:

ok single line: '100000 5940663 800688744 57768... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #61:

score: 0
Accepted
time: 78ms
memory: 9652kb

input:

100000
36348307 927655073
49386284 752595953
244304084 920252245
103158625 841853502
337510770 997418393
3129800 978633082
20528769 905760944
136286296 702846756
528066190 948461730
131195773 787571241
65949335 890631810
370692541 934399532
303686754 853282689
169091392 763349622
260826666 941224281...

output:

100000 5952961 208433526 60473289 436086210 552190211 592128139 462096734 160260911 884084188 893916992 685366376 932762755 175923812 484504148 898918197 6754042 336842794 942141877 231903416 172017933 464246168 80335722 832871633 729234479 567994483 34039768 281170952 421374611 942262686 302442522 ...

result:

ok single line: '100000 5952961 208433526 60473... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #62:

score: 0
Accepted
time: 75ms
memory: 9748kb

input:

100000
16623334 973574851
235608205 991856019
392623474 883824460
78188053 889638376
344181750 727609520
164668176 932189015
190176789 868262155
31534425 966233311
197882740 891708587
80890633 925468658
339321182 962414220
41989671 884150410
97133500 955481860
44912566 916205879
27057336 999450582
1...

output:

100000 5936205 328355634 652521019 567064767 909441873 237850829 296474072 797912597 497377471 683173949 689216640 380238075 297503930 910898963 988603375 475710209 564560455 275190446 594023382 563985871 804630494 398813217 55347924 576560680 134352154 439881408 181340551 473316299 115932507 164981...

result:

ok single line: '100000 5936205 328355634 65252... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #63:

score: 0
Accepted
time: 74ms
memory: 9556kb

input:

100000
194092709 974646477
115732045 881567204
226681421 786599736
209063347 874658913
10028677 810812996
147135182 952942558
311912784 941651501
115584557 738560995
184443403 927697718
264647259 726530787
202285001 764330473
179047233 960392409
154331393 724271863
18137950 821912258
55271483 996459...

output:

100000 5707848 649129825 425983158 78953559 66564918 126523768 337438203 15217808 774762219 672248929 298648655 236318556 213364795 793191947 722201823 84460119 789532008 896676560 47740873 637181063 294587324 824857713 400636403 63268059 500145001 904682226 248731900 847951074 236870140 406332727 5...

result:

ok single line: '100000 5707848 649129825 42598... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #64:

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

input:

100000
65255587 691151450
2884398 898860081
43083303 899414269
135770718 854770546
101110586 879450451
268748377 942495401
171512099 652399317
31924761 917738401
5217685 946118268
57695528 864180796
163420202 941282695
59806938 764326348
64703305 939931259
14171781 825432346
1948890 985412837
511376...

output:

100000 5900732 330913688 13713740 204260582 885062397 709230098 898616215 772709885 195935749 997630027 930054088 522183316 89159295 454505918 394557506 932162006 954857301 441994466 494522663 32686691 226677168 7158736 835947811 495041992 253256345 991241051 48805513 838028965 366466272 20712848 93...

result:

ok single line: '100000 5900732 330913688 13713... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #65:

score: 0
Accepted
time: 73ms
memory: 9700kb

input:

100000
9842368 898066794
128805291 889630141
100028142 801666975
27480462 978897404
173357391 660752489
35443302 992304344
119400340 791904674
49685684 980043578
487666 984028548
118163678 744140686
111715199 729856492
184863586 895754013
38232233 592423155
239180362 906123420
1345471 980053804
2105...

output:

100000 6096591 11168727 547598172 906202289 361905442 897070644 863988244 179343920 683805004 7882699 708836019 889402316 454613569 261744847 938374318 514530666 780882684 28132213 341402053 685218957 439397038 78131165 653806146 567451182 324272782 808454129 272323392 964234118 16124176 536732761 3...

result:

ok single line: '100000 6096591 11168727 547598... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #66:

score: 0
Accepted
time: 86ms
memory: 9748kb

input:

100000
169852260 980070890
148660508 705710139
217203552 954677993
75243814 588215940
113681187 895626711
95065174 879326923
40604105 938479289
123397284 993467394
51424392 896330296
143735342 993934115
234487090 973159230
80234440 982665071
244333228 627029344
79815424 956156135
349309298 851140031...

output:

100000 5972210 589021700 667894147 467632007 280167341 748308864 853938872 705871082 225234804 570018724 804020842 38113234 777333427 606629618 60457404 14165527 835214569 236229818 754069143 183119517 653668030 753175160 65759503 277397110 432459850 798610497 597702576 581899811 434358298 734808408...

result:

ok single line: '100000 5972210 589021700 66789... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #67:

score: 0
Accepted
time: 70ms
memory: 9520kb

input:

100000
24289035 929557315
137063759 754991474
72433440 950955240
188966635 868681056
59544845 950914762
149972331 642295125
49827163 940693675
369037106 998516507
329982035 537187955
287232803 964140828
310531706 908137757
49107948 758636721
120284746 942297327
74926241 853550500
148626371 860867374...

output:

100000 5868796 211565094 378632843 119344104 486457823 67906209 599084240 795233193 296475775 689081885 665607751 426009496 98603711 916335774 543874526 410948204 923615053 939496385 868262178 375257963 365456053 612330048 487241024 37427873 452308366 189107397 466111900 272852290 782810033 47110383...

result:

ok single line: '100000 5868796 211565094 37863... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #68:

score: 0
Accepted
time: 78ms
memory: 9624kb

input:

100000
82061738 950803682
27981353 881073281
112497144 912305571
491057963 852700166
264780118 871793400
221928847 829138774
95860761 876504037
18978940 995766700
547139749 976546585
94110076 999221336
172070197 764444617
177033589 995670976
50199054 895239296
9235091 911993223
70203938 866674693
32...

output:

100000 5833190 569522014 293872176 662056016 583444784 423336103 381907382 92469833 540594497 930123820 872297349 891463858 490350814 6736366 756358629 347210829 426287465 285960389 661387899 815788654 866310794 996767503 819100537 127880294 459955378 641222165 66185997 670898451 592796320 620376756...

result:

ok single line: '100000 5833190 569522014 29387... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #69:

score: 0
Accepted
time: 70ms
memory: 9668kb

input:

100000
239713154 707773443
321221931 743232686
50962558 521591584
298235073 461839384
45298347 298664323
594804948 736720245
363089307 946812487
314942771 438039067
870260456 875056673
470675605 998476714
327516332 560469578
547793129 741360352
278698883 745476262
223983062 704474973
111906638 52997...

output:

100000 332026817 594529229 348330929 917778641 836465288 108520446 807719782 612001240 93388546 942430267 53823951 633112019 650210395 12988780 403800052 158879827 820332241 773114286 115798667 709651258 195795740 510780136 22372100 511331288 194226207 548755440 794685896 982587932 728501960 7688024...

result:

ok single line: '100000 332026817 594529229 348... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #70:

score: 0
Accepted
time: 61ms
memory: 9556kb

input:

100000
9772703 933595339
200092266 993418527
38176074 833911419
287093081 701875666
37326805 914749327
11077875 938475798
125675667 946177622
2975431 672449415
238402209 730732249
273147518 571114124
55038879 911434419
220481003 880245424
46313761 944458719
65534489 983257016
135844712 844479758
110...

output:

100000 8023157 200346484 491563274 457330784 525151285 626967886 224762536 647649501 438079004 911988058 946858886 898028839 407370549 521385522 337707587 822016075 271492596 671133918 56425084 728683932 81158716 651319150 447203237 858842138 847482953 340894183 313868907 986799122 163770911 7437139...

result:

ok single line: '100000 8023157 200346484 49156... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #71:

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

input:

100000
131393627 809373747
34797136 931656816
4974689 841867854
67234245 954330414
5492436 691876113
304928803 779356257
132052928 967673854
106188676 946382164
36514431 858683472
237416846 971993898
133238330 937642267
46175333 956775172
49357719 836493265
6665433 986558579
29656296 942738450
98012...

output:

100000 7979436 56346397 220639169 213754563 110524606 38594631 404449517 366969525 73790988 698194119 344572188 393026889 532073697 298892189 987740249 144941806 632687815 691692956 393839577 421715452 756180803 19012418 43687325 979775178 171774852 840499425 423726429 669391635 294605249 763550738 ...

result:

ok single line: '100000 7979436 56346397 220639... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #72:

score: 0
Accepted
time: 77ms
memory: 9624kb

input:

100000
86053773 797561340
24169418 992199459
55226693 943781686
196397868 919396135
126062800 992291090
1410095 739294431
2789770 720774586
324838978 824777207
85513020 821751465
38622652 884262989
102129762 985967646
32649234 944492068
49389958 974941181
11915088 981582910
163056709 966473185
14880...

output:

100000 8014775 360962684 938226081 957492608 485040507 929815850 452080119 298233711 153456782 897003275 797423983 113937542 706337415 929669514 582848859 637118730 614084509 101633263 754911141 522980799 936987203 894603639 932080501 577390957 794618410 576684703 583014531 449693408 772854256 29309...

result:

ok single line: '100000 8014775 360962684 93822... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #73:

score: 0
Accepted
time: 71ms
memory: 9664kb

input:

100000
6763230 979409776
496280003 946470804
15269301 995262009
37149385 935334805
234107315 756161125
46300475 829581144
43956039 933503673
26227093 968429210
249211291 942543499
22676998 849035248
117930024 947689342
91211653 844049091
19506895 987541256
110709882 945397898
240560258 930133283
238...

output:

100000 7983181 266616958 934410852 902565586 545830668 557154881 690206655 127660192 171097786 538896350 694608917 128370059 627684889 408535578 638768702 185265553 77848009 291014456 260531563 260427382 289383370 132463058 511219560 279773390 428037634 694406904 474320498 165763481 633818801 248966...

result:

ok single line: '100000 7983181 266616958 93441... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #74:

score: 0
Accepted
time: 72ms
memory: 9552kb

input:

100000
391578920 906946096
183160920 823212757
291296642 799391581
68982804 953338734
189277840 476534788
86527975 759316306
234534951 822168453
294693125 976550817
59277122 752735439
49109160 993501038
267429579 658117036
170829130 992560447
76627411 845807384
36594959 961826530
111351924 897163810...

output:

100000 7856793 420246475 792908853 149651187 385341070 747337907 701379610 49461438 547699597 967810580 718856397 291781317 319997623 735955455 914748217 283604612 614247427 328258395 546059202 820970148 448915227 930010408 668352120 404960869 450806834 640360122 657121911 986798287 368241474 608678...

result:

ok single line: '100000 7856793 420246475 79290... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #75:

score: 0
Accepted
time: 79ms
memory: 9620kb

input:

100000
17649213 911149935
257469673 960397025
113701619 954706785
317902842 723147649
28373037 975688529
25750761 961384136
287997674 899709387
105091620 945358964
102364035 972269652
215841808 867078799
47347431 997833527
8712298 930789207
60636041 784941263
167908226 856539129
261033839 871451178
...

output:

100000 7978823 868822604 114993749 622130270 910055965 128710130 223861271 379877346 441935952 744557431 68224448 22842754 178388416 279482505 924662882 179928452 734208959 476074031 436060926 370336873 605826866 648249580 547454574 56300095 532961098 193564917 170752606 661654473 694505490 25660561...

result:

ok single line: '100000 7978823 868822604 11499... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #76:

score: 0
Accepted
time: 70ms
memory: 9752kb

input:

100000
43534704 983202573
166226427 960106120
194717297 996314963
108694713 907058145
8085700 941874765
48854063 573957981
5223390 985597875
4310813 867807553
19948735 924853515
361319760 838935902
100194295 921020858
13745612 903282582
120075476 958861505
29631876 951532050
195846603 984790167
6120...

output:

100000 7931945 453999712 350946420 964487650 814926163 228229890 978201242 748374528 647531482 392076859 123771999 434010661 317978728 356915574 710994967 229524723 369150543 214073214 573705916 613951811 489397002 309582416 531167035 248348834 653874179 265850078 298917729 630110486 594307858 58138...

result:

ok single line: '100000 7931945 453999712 35094... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #77:

score: 0
Accepted
time: 68ms
memory: 9744kb

input:

100000
266487799 924895893
128156639 901772394
43357683 944988909
8342968 944827445
204883186 727652748
42903749 669701722
4505946 937728012
93332866 741185849
15796473 936952260
65707987 518146081
173067883 913901287
18791941 953684509
142849188 915721258
19112650 977428174
63743408 971066270
31808...

output:

100000 8043045 65329508 409061383 570586330 490126422 675276842 648525691 882889227 191493679 661849078 983109060 233224556 894402413 452059870 877251507 160673784 104713207 749676142 787046657 519250397 418740232 738097187 865560333 470870593 791458285 129421085 878337889 231687832 984247441 314354...

result:

ok single line: '100000 8043045 65329508 409061... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #78:

score: 0
Accepted
time: 74ms
memory: 9656kb

input:

100000
180720717 963553336
238488405 850038264
115529517 984882755
59298771 888481157
48428720 954903160
172233157 914599337
32214228 783268860
80936947 998632646
13362650 927025002
85353832 937488110
197562182 822735902
24385941 962372766
70992745 884508236
284606763 990996589
22725043 978071977
50...

output:

100000 8014781 458422465 494357137 125337869 935716942 5207268 240561823 291905082 740936598 112670340 311010719 19680956 52766835 361701594 741844770 946593599 124909828 823933411 423163405 106210946 375577726 587951548 42137224 934204406 513702785 249146804 703924898 393936107 760821718 464032491 ...

result:

ok single line: '100000 8014781 458422465 49435... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #79:

score: 0
Accepted
time: 63ms
memory: 9624kb

input:

100000
544697732 842382684
45311555 945348212
75270447 946416118
67440254 951886346
191805778 961658142
278311970 924785320
56067811 890712616
21186329 949853772
45919950 879029442
102965615 946912369
227973707 970359474
214657853 918117552
234229830 832360085
87927488 906869118
292773654 675529900
...

output:

100000 7952391 450008593 244060275 798649784 416146966 282439628 735851022 804205815 555659665 855971466 657869477 684362051 388246095 117877283 548445035 742036415 31159924 741401354 415016661 832500156 890386365 276885341 463881834 478973207 332454884 881793142 124927008 493122051 736817788 232423...

result:

ok single line: '100000 7952391 450008593 24406... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #80:

score: 0
Accepted
time: 75ms
memory: 9656kb

input:

100000
414823705 734943691
80735328 304631629
270475046 674840867
469886646 650339586
215079050 440492439
301442007 934977539
221071329 868942199
280022797 526702851
75545882 738203988
381136815 753183056
11145047 367255653
319070261 587150203
66839274 502548376
71530501 699142004
309183542 41662016...

output:

100000 348833392 647024193 273377502 790967409 4964643 902757900 400679870 783983022 443963208 300775444 404828579 691274188 149229850 209788896 380933242 843904518 719401336 651067953 871696459 731027275 76627570 667633437 676021056 958758379 831379474 460778194 425529258 397873562 35685073 6019410...

result:

ok single line: '100000 348833392 647024193 273... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #81:

score: 0
Accepted
time: 76ms
memory: 9616kb

input:

100000
163411826 973973102
9919768 949736313
136368143 970159399
82114569 946694017
19849684 940812401
55921105 991455257
5161967 996598087
48134526 967396696
86464143 969206252
38871008 999875831
53568099 965911459
17157827 941433891
16869385 924860548
36361342 990964019
19453837 967502964
57659339...

output:

100000 8728235 778989238 894991924 2290559 407163179 924064277 682083680 872039485 444713185 551466353 710983190 523331792 456632662 876569744 372350954 740695070 397171015 724604228 901902170 511856840 224066890 267281255 414891217 523685261 941163506 715889290 195082950 452066532 300362546 5813543...

result:

ok single line: '100000 8728235 778989238 89499...924 778989238 8728235 100000 1 '

Test #82:

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

input:

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

output:

20 138 512 1198 1905 2135 1709 972 383 99 15 1 0 0 0 0 0 0 0 0 

result:

ok single line: '20 138 512 1198 1905 2135 1709 972 383 99 15 1 0 0 0 0 0 0 0 0 '

Test #83:

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

input:

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

output:

20 144 627 1902 4233 7091 9076 8943 6787 3938 1717 545 119 16 1 0 0 0 0 0 

result:

ok single line: '20 144 627 1902 4233 7091 9076...38 1717 545 119 16 1 0 0 0 0 0 '

Test #84:

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

input:

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

output:

20 124 437 1012 1663 2032 1891 1348 727 287 78 13 1 0 0 0 0 0 0 0 

result:

ok single line: '20 124 437 1012 1663 2032 1891... 727 287 78 13 1 0 0 0 0 0 0 0 '

Test #85:

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

input:

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

output:

20 154 677 1979 4154 6538 7912 7462 5509 3169 1398 458 105 15 1 0 0 0 0 0 

result:

ok single line: '20 154 677 1979 4154 6538 7912...69 1398 458 105 15 1 0 0 0 0 0 '

Test #86:

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

input:

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

output:

20 105 297 551 719 673 450 210 65 12 1 0 0 0 0 0 0 0 0 0 

result:

ok single line: '20 105 297 551 719 673 450 210 65 12 1 0 0 0 0 0 0 0 0 0 '

Test #87:

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

input:

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

output:

20 157 696 2011 4072 6015 6624 5487 3412 1571 520 117 16 1 0 0 0 0 0 0 

result:

ok single line: '20 157 696 2011 4072 6015 6624... 1571 520 117 16 1 0 0 0 0 0 0 '

Test #88:

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

input:

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

output:

20 146 595 1593 3043 4341 4734 3975 2554 1232 431 103 15 1 0 0 0 0 0 0 

result:

ok single line: '20 146 595 1593 3043 4341 4734... 1232 431 103 15 1 0 0 0 0 0 0 '

Test #89:

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

input:

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

output:

20 114 335 613 762 671 424 190 58 11 1 0 0 0 0 0 0 0 0 0 

result:

ok single line: '20 114 335 613 762 671 424 190 58 11 1 0 0 0 0 0 0 0 0 0 '

Test #90:

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

input:

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

output:

20 152 647 1792 3482 4949 5266 4241 2588 1186 399 94 14 1 0 0 0 0 0 0 

result:

ok single line: '20 152 647 1792 3482 4949 5266...8 1186 399 94 14 1 0 0 0 0 0 0 '

Test #91:

score: 0
Accepted
time: 71ms
memory: 9620kb

input:

100000
123938256 863835618
33265628 588026264
763442659 933233065
348391493 376702350
16297348 192377395
98336127 937593648
492986733 936061787
344313154 976551831
710348153 806787988
638966387 988067958
378996256 563758316
15380936 855166328
728393683 937255052
122926377 917194036
77213231 10018323...

output:

100000 349349522 596659076 927809560 219192999 616697139 985691585 757692807 956062091 664599644 621997202 459274481 837673161 682926341 293317089 4793481 476353195 143309063 448136722 965723270 199725968 739730166 217913197 938659015 906070211 117215496 536263244 295577862 400164447 441077326 36546...

result:

ok single line: '100000 349349522 596659076 927... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #92:

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

input:

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

output:

20 114 332 590 689 544 290 101 21 2 0 0 0 0 0 0 0 0 0 0 

result:

ok single line: '20 114 332 590 689 544 290 101 21 2 0 0 0 0 0 0 0 0 0 0 '

Test #93:

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

input:

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

output:

20 139 559 1537 3087 4651 5309 4595 2993 1441 496 115 16 1 0 0 0 0 0 0 

result:

ok single line: '20 139 559 1537 3087 4651 5309... 1441 496 115 16 1 0 0 0 0 0 0 '

Test #94:

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

input:

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

output:

20 143 628 1949 4534 8156 11531 12907 11449 8009 4368 1820 560 120 16 1 0 0 0 0 

result:

ok single line: '20 143 628 1949 4534 8156 1153...4368 1820 560 120 16 1 0 0 0 0 '

Test #95:

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

input:

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

output:

20 138 531 1339 2385 3124 3074 2287 1275 518 145 25 2 0 0 0 0 0 0 0 

result:

ok single line: '20 138 531 1339 2385 3124 3074...275 518 145 25 2 0 0 0 0 0 0 0 '

Test #96:

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

input:

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

output:

20 126 443 993 1520 1652 1296 733 293 79 13 1 0 0 0 0 0 0 0 0 

result:

ok single line: '20 126 443 993 1520 1652 1296 733 293 79 13 1 0 0 0 0 0 0 0 0 '

Test #97:

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

input:

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

output:

20 140 533 1298 2190 2675 2423 1644 833 309 80 13 1 0 0 0 0 0 0 0 

result:

ok single line: '20 140 533 1298 2190 2675 2423... 833 309 80 13 1 0 0 0 0 0 0 0 '

Test #98:

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

input:

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

output:

20 137 538 1419 2673 3691 3775 2859 1585 626 167 27 2 0 0 0 0 0 0 0 

result:

ok single line: '20 137 538 1419 2673 3691 3775...585 626 167 27 2 0 0 0 0 0 0 0 '

Test #99:

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

input:

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

output:

20 164 787 2547 5978 10605 14570 15716 13388 8998 4731 1911 574 121 16 1 0 0 0 0 

result:

ok single line: '20 164 787 2547 5978 10605 145...4731 1911 574 121 16 1 0 0 0 0 '

Test #100:

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

input:

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

output:

20 100 257 410 432 302 135 35 4 0 0 0 0 0 0 0 0 0 0 0 

result:

ok single line: '20 100 257 410 432 302 135 35 4 0 0 0 0 0 0 0 0 0 0 0 '

Test #101:

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

input:

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

output:

20 136 525 1371 2612 3751 4113 3454 2212 1066 376 92 14 1 0 0 0 0 0 0 

result:

ok single line: '20 136 525 1371 2612 3751 4113...2 1066 376 92 14 1 0 0 0 0 0 0 '