QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#125610#6735. TreeecnerwalaAC ✓1705ms338368kbC++2315.7kb2023-07-17 01:42:132023-07-19 19:59:39

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-19 19:59:39]
  • 评测
  • 测评结果:AC
  • 用时:1705ms
  • 内存:338368kb
  • [2023-07-17 01:42:13]
  • 提交

answer

#include <bits/stdc++.h>

namespace seg_tree {

// Floor of log_2(a); index of highest 1-bit
inline int log_2(int a) {
	return a ? (8 * sizeof(a)) - 1 - __builtin_clz(a) : -1;
}

inline int next_pow_2(int a) {
	assert(a > 0);
	return 1 << log_2(2*a-1);
}

struct point {
	int a;
	point() : a(0) {}
	explicit point(int a_) : a(a_) { assert(a >= -1); }

	explicit operator bool () { return bool(a); }

	// This is useful so you can directly do array indices
	/* implicit */ operator int() const { return a; }

	point c(bool z) const {
		return point((a<<1)|z);
	}

	point operator [] (bool z) const {
		return c(z);
	}

	point p() const {
		return point(a>>1);
	}

	friend std::ostream& operator << (std::ostream& o, const point& p) { return o << int(p); }

	template <typename F> void for_each(F f) const {
		for (int v = a; v > 0; v >>= 1) {
			f(point(v));
		}
	}

	template <typename F> void for_parents_down(F f) const {
		// strictly greater than 0
		for (int L = log_2(a); L > 0; L--) {
			f(point(a >> L));
		}
	}

	template <typename F> void for_parents_up(F f) const {
		for (int v = a >> 1; v > 0; v >>= 1) {
			f(point(v));
		}
	}

	point& operator ++ () { ++a; return *this; }
	point operator ++ (int) { return point(a++); }
	point& operator -- () { --a; return *this; }
	point operator -- (int) { return point(a--); }
};

struct range {
	int a, b;
	range() : a(1), b(1) {}
	range(int a_, int b_) : a(a_), b(b_) {
		assert(1 <= a && a <= b && b <= 2 * a);
	}
	explicit range(std::array<int, 2> r) : range(r[0], r[1]) {}

	explicit operator std::array<int, 2>() const {
		return {a,b};
	}

	const int& operator[] (bool z) const {
		return z ? b : a;
	}

	friend std::ostream& operator << (std::ostream& o, const range& r) { return o << "[" << r.a << ".." << r.b << ")"; }

	// Iterate over the range from outside-in.
	//   Calls f(point a)
	template <typename F> void for_each(F f) const {
		for (int x = a, y = b; x < y; x >>= 1, y >>= 1) {
			if (x & 1) f(point(x++));
			if (y & 1) f(point(--y));
		}
	}

	// Iterate over the range from outside-in.
	//   Calls f(point a, bool is_right)
	template <typename F> void for_each_with_side(F f) const {
		for (int x = a, y = b; x < y; x >>= 1, y >>= 1) {
			if (x & 1) f(point(x++), false);
			if (y & 1) f(point(--y), true);
		}
	}

	// Iterate over the range from left to right.
	//    Calls f(point)
	template <typename F> void for_each_l_to_r(F f) const {
		int anc_depth = log_2((a-1) ^ b);
		int anc_msk = (1 << anc_depth) - 1;
		for (int v = (-a) & anc_msk; v; v &= v-1) {
			int i = __builtin_ctz(v);
			f(point(((a-1) >> i) + 1));
		}
		for (int v = b & anc_msk; v; ) {
			int i = log_2(v);
			f(point((b >> i) - 1));
			v ^= (1 << i);
		}
	}

	// Iterate over the range from right to left.
	//    Calls f(point)
	template <typename F> void for_each_r_to_l(F f) const {
		int anc_depth = log_2((a-1) ^ b);
		int anc_msk = (1 << anc_depth) - 1;
		for (int v = b & anc_msk; v; v &= v-1) {
			int i = __builtin_ctz(v);
			f(point((b >> i) - 1));
		}
		for (int v = (-a) & anc_msk; v; ) {
			int i = log_2(v);
			f(point(((a-1) >> i) + 1));
			v ^= (1 << i);
		}
	}

	template <typename F> void for_parents_down(F f) const {
		int x = a, y = b;
		if ((x ^ y) > x) { x <<= 1, std::swap(x, y); }
		int dx = __builtin_ctz(x);
		int dy = __builtin_ctz(y);
		int anc_depth = log_2((x-1) ^ y);
		for (int i = log_2(x); i > dx; i--) {
			f(point(x >> i));
		}
		for (int i = anc_depth; i > dy; i--) {
			f(point(y >> i));
		}
	}

	template <typename F> void for_parents_up(F f) const {
		int x = a, y = b;
		if ((x ^ y) > x) { x <<= 1, std::swap(x, y); }
		int dx = __builtin_ctz(x);
		int dy = __builtin_ctz(y);
		int anc_depth = log_2((x-1) ^ y);
		for (int i = dx+1; i <= anc_depth; i++) {
			f(point(x >> i));
		}
		for (int v = y >> (dy+1); v; v >>= 1) {
			f(point(v));
		}
	}
};

struct in_order_layout {
	// Alias them in for convenience
	using point = seg_tree::point;
	using range = seg_tree::range;

	int N, S;
	in_order_layout() : N(0), S(0) {}
	in_order_layout(int N_) : N(N_), S(N ? next_pow_2(N) : 0) {}

	point get_point(int a) const {
		assert(0 <= a && a < N);
		a += S;
		return point(a >= 2 * N ? a - N : a);
	}

	range get_range(int a, int b) const {
		assert(0 <= a && a <= b && b <= N);
		if (N == 0) return range();
		a += S, b += S;
		return range((a >= 2 * N ? 2*(a-N) : a), (b >= 2 * N ? 2*(b-N) : b));
	}

	range get_range(std::array<int, 2> p) const {
		return get_range(p[0], p[1]);
	}

	int get_leaf_index(point pt) const {
		int a = int(pt);
		assert(N <= a && a < 2 * N);
		return (a < S ? a + N : a) - S;
	}

	std::array<int, 2> get_node_bounds(point pt) const {
		int a = int(pt);
		assert(1 <= a && a < 2 * N);
		int l = __builtin_clz(a) - __builtin_clz(2*N-1);
		int x = a << l, y = (a+1) << l;
		assert(S <= x && x < y && y <= 2*S);
		return {(x >= 2 * N ? (x>>1) + N : x) - S, (y >= 2 * N ? (y>>1) + N : y) - S};
	}

	int get_node_split(point pt) const {
		int a = int(pt);
		assert(1 <= a && a < N);
		int l = __builtin_clz(2*a+1) - __builtin_clz(2*N-1);
		int x = (2*a+1) << l;
		assert(S <= x && x < 2*S);
		return (x >= 2 * N ? (x>>1) + N : x) - S;
	}

	int get_node_size(point pt) const {
		auto bounds = get_node_bounds(pt);
		return bounds[1] - bounds[0];
	}
};

struct circular_layout {
	// Alias them in for convenience
	using point = seg_tree::point;
	using range = seg_tree::range;

	int N;
	circular_layout() : N(0) {}
	circular_layout(int N_) : N(N_) {}

	point get_point(int a) const {
		assert(0 <= a && a < N);
		return point(N + a);
	}

	range get_range(int a, int b) const {
		assert(0 <= a && a <= b && b <= N);
		if (N == 0) return range();
		return range(N + a, N + b);
	}

	range get_range(std::array<int, 2> p) const {
		return get_range(p[0], p[1]);
	}

	int get_leaf_index(point pt) const {
		int a = int(pt);
		assert(N <= a && a < 2 * N);
		return a - N;
	}

	// Returns {x,y} so that 0 <= x < N and 1 <= y <= N
	// If the point is non-wrapping, then 0 <= x < y <= N
	std::array<int, 2> get_node_bounds(point pt) const {
		int a = int(pt);
		assert(1 <= a && a < 2 * N);
		int l = __builtin_clz(a) - __builtin_clz(2*N-1);
		int S = next_pow_2(N);
		int x = a << l, y = (a+1) << l;
		assert(S <= x && x < y && y <= 2*S);
		return {(x >= 2 * N ? x >> 1 : x) - N, (y > 2 * N ? y >> 1 : y) - N};
	}

	// Returns the split point of the node, such that 1 <= s <= N.
	int get_node_split(point pt) const {
		int a = int(pt);
		assert(1 <= a && a < N);
		return get_node_bounds(pt.c(0))[1];
	}

	int get_node_size(point pt) const {
		auto bounds = get_node_bounds(pt);
		int r = bounds[1] - bounds[0];
		return r > 0 ? r : r + N;
	}
};

} // namespace seg_tree

template <typename T> void setmax(T& a, T b) { if (b > a) a = b; }

constexpr bool TEST = false;

int main() {
	using namespace std;
	ios_base::sync_with_stdio(false), cin.tie(nullptr);

	for (int case_num = 0; TEST || case_num == 0; case_num++) {
		std::mt19937_64 mt(48 + case_num);
		cerr << "running case " << case_num << '\n';

	int N, Q;
	if constexpr (TEST) {
		N = 500;
		Q = 2000;
		//cerr << N << ' ' << Q << '\n';
	} else {
		cin >> N >> Q;
	}

	struct vert_t {
		int par;
		int v_color;
		int e_color;
		int64_t weight;
	};
	std::vector<vert_t> verts(N);
	for (int i = 0; i < N; i++) {
		if constexpr (TEST) {
			verts[i].v_color = std::uniform_int_distribution<int>(1, 2)(mt);
			//cerr << verts[i].v_color << " \n"[i+1==N];
		} else {
			cin >> verts[i].v_color;
		}
	}
	verts[0].par = -1;
	for (int i = 1; i < N; i++) {
		if constexpr (TEST) {
			verts[i].par = std::uniform_int_distribution<int>(0, i-1)(mt);
			//cerr << verts[i].par+1 << " \n"[i+1==N];
		} else {
			cin >> verts[i].par;
			verts[i].par--;
		}
	}
	verts[0].e_color = -1;
	for (int i = 1; i < N; i++) {
		if constexpr (TEST) {
			verts[i].e_color = std::uniform_int_distribution<int>(1, 2)(mt);
			//cerr << verts[i].e_color << " \n"[i+1==N];
		} else {
			cin >> verts[i].e_color;
		}
	}
	verts[0].weight = 0;
	for (int i = 1; i < N; i++) {
		if constexpr (TEST) {
			verts[i].weight = std::uniform_int_distribution<int>(1, 5)(mt);
			//cerr << verts[i].weight << " \n"[i+1==N];
		} else {
			cin >> verts[i].weight;
		}
	}

	std::vector<vert_t> slow_verts = verts;
	auto solve_slow = [&]() -> int64_t {
		std::vector<int64_t> dp_up(N, 0);
		std::vector<std::map<int, int64_t>> dp_any(N);
		int64_t ans = 0;
		for (int i = N-1; i >= 0; i--) {
			int p = slow_verts[i].par;
			if (p == -1) break;
			int64_t w = dp_up[i] + slow_verts[i].weight;
			if (slow_verts[i].v_color == slow_verts[p].v_color) {
				auto& ov = dp_any[p][slow_verts[i].e_color];
				setmax(ans, ov + w);
				setmax(ov, w);
				if (slow_verts[i].e_color == slow_verts[p].e_color) {
					setmax(dp_up[p], w);
				}
			}
		}
		return ans;
	};
	auto update_slow = [&](int v, int c) -> void {
		slow_verts[v].v_color = c;
	};

	std::vector<bool> is_good_ch(N);
	std::vector<std::vector<int>> good_ch(N);
	std::vector<int> good_sz(N, 1);
	for (int i = N-1; i >= 1; i--) {
		int p = verts[i].par;
		assert(0 <= p && p < i);
		is_good_ch[i] = (verts[i].e_color == verts[p].e_color);
		if (is_good_ch[i]) {
			good_ch[p].push_back(i);
			good_sz[p] += good_sz[i];
		}
	}
	std::vector<bool> is_heavy(N);
	for (int i = 0; i < N; i++) {
		if (good_ch[i].empty()) continue;
		int j = *std::max_element(good_ch[i].begin(), good_ch[i].end(), [&](auto a, auto b) { return good_sz[a] < good_sz[b]; });
		is_heavy[j] = true;
	}
	std::vector<int> heavy_root(N, -1);
	std::vector<int> heavy_sz(N);
	std::vector<int> heavy_ch(N, -1);
	std::vector<int> heavy_idx(N, -1);
	for (int i = 0; i < N; i++) {
		int p = verts[i].par;
		if (!is_heavy[i]) {
			heavy_root[i] = i;
			heavy_idx[i] = 0;
		} else {
			heavy_ch[p] = i;
			heavy_root[i] = heavy_root[p];
			heavy_idx[i] = heavy_idx[p] + 1;
		}
		int rt = heavy_root[i];
		heavy_sz[rt] += 1;
	}

	auto maybe_biggest = [&](const std::set<std::pair<int64_t, int>>& a) -> int64_t {
		if (a.empty()) return 0;
		auto it = a.rbegin();
		return it->first;
	};
	auto maybe_biggest_2 = [&](const std::set<std::pair<int64_t, int>>& a) -> int64_t {
		auto it = a.rbegin();
		int64_t ans = 0;
		for (int z = 0; z < 2 && it != a.rend(); z++, ++it) {
			ans += it->first;
		}
		return ans;
	};

	std::vector<std::map<int, std::map<int, std::set<std::pair<int64_t, int>>>>> ch_v_e(N);
	std::vector<std::map<int, std::set<std::pair<int64_t, int>>>> best_ch2(N);

	std::set<std::pair<int64_t, int>> heavy_bests;

	struct seg_t {
		int c_pref, c_suff;
		int64_t w_pref, w_suff, w_mid, w_through;
	};
	/*
	auto dump = [&](const seg_t& a) -> void {
		cerr << a.c_pref << '-' << a.w_pref << '-' << a.w_through << "(" << a.w_mid << ")" << '-' << a.w_suff << '-' << a.c_suff << '\n';
	};
	*/
	auto merge = [&](const seg_t& a, const seg_t& b) -> seg_t {
		//cerr << "merge" << '\n';
		//dump(a);
		//dump(b);
		seg_t r;
		r.c_pref = a.c_pref;
		r.w_pref = a.w_pref;
		if (a.w_through >= 0 && a.c_suff == b.c_pref) {
			setmax(r.w_pref, a.w_through + b.w_pref);
		}
		r.c_suff = b.c_suff;
		r.w_suff = b.w_suff;
		if (b.w_through >= 0 && b.c_pref == a.c_suff) {
			setmax(r.w_suff, b.w_through + a.w_suff);
		}
		r.w_mid = std::max(a.w_mid, b.w_mid);
		if (a.c_suff == b.c_pref) {
			setmax(r.w_mid, a.w_suff + b.w_pref);
		}
		if (a.w_through >= 0 && b.w_through >= 0 && a.c_suff == b.c_pref) {
			r.w_through = a.w_through + b.w_through;
		} else {
			r.w_through = -1;
		}
		//dump(r);
		return r;
	};
	std::vector<std::vector<seg_t>> segs(N);
	for (int i = 0; i < N; i++) {
		if (is_heavy[i]) continue;
		segs[i].resize(2*heavy_sz[i]);
	}

	// Now, let's go initialize everything
	for (int i = N-1; i >= 0; i--) {
		int rt = heavy_root[i];
		seg_tree::in_order_layout layout(heavy_sz[rt]);
		auto& seg = segs[rt];
		{
			seg_tree::point a = layout.get_point(heavy_idx[i]);
			seg[a].c_pref = seg[a].c_suff = verts[i].v_color;
			seg[a].w_through = verts[i].weight;
			seg[a].w_mid = maybe_biggest(best_ch2[i][verts[i].v_color]);
			seg[a].w_suff = maybe_biggest(ch_v_e[i][verts[i].v_color][verts[i].e_color]);
			seg[a].w_pref = seg[a].w_through + seg[a].w_suff;
		}
		//cerr << "set " << i << '\n';

		if (rt == i) {
			for (seg_tree::point a(layout.N - 1); a > 0; a--) {
				seg[a] = merge(seg[a.c(0)], seg[a.c(1)]);
			}

			//cerr << "root " << rt << ' ' << heavy_sz[rt] << '\n';
			//cerr << seg[1].w_mid << ' ' << seg[1].w_pref << '\n';
			heavy_bests.insert({seg[1].w_mid, i});

			if (verts[rt].par != -1) {
				auto& s2 = best_ch2[verts[rt].par][verts[rt].v_color];
				auto& s = ch_v_e[verts[rt].par][verts[rt].v_color][verts[rt].e_color];
				s2.erase({maybe_biggest_2(s), verts[rt].e_color});
				s.insert({seg[1].w_pref, rt});
				s2.insert({maybe_biggest_2(s), verts[rt].e_color});
			}
		}
	}

	auto get_ans = [&]() -> int64_t {
		auto it = heavy_bests.rbegin();
		assert(it != heavy_bests.rend());
		//cerr << "ans " << it->first << ' ' << it->second << '\n';
		return it->first;
	};

	auto do_update = [&](int v, int c) -> void {
		//cerr << '\n';
		//cerr << "do update " << v << ' ' << verts[v].v_color << "->" << c << '\n';
		// go update each guy one at a time
		for (int i = v; true; ) {
			int rt = heavy_root[i];
			seg_tree::in_order_layout layout(heavy_sz[rt]);
			auto& seg = segs[rt];
			{
				heavy_bests.erase({seg[1].w_mid, rt});

				if (verts[rt].par != -1) {
					auto& s2 = best_ch2[verts[rt].par][verts[rt].v_color];
					auto& s = ch_v_e[verts[rt].par][verts[rt].v_color][verts[rt].e_color];
					s2.erase({maybe_biggest_2(s), verts[rt].e_color});
					s.erase({seg[1].w_pref, rt});
					s2.insert({maybe_biggest_2(s), verts[rt].e_color});
				}
			}

			if (i == v) {
				verts[i].v_color = c;
			}

			{
				seg_tree::point a = layout.get_point(heavy_idx[i]);
				seg[a].c_pref = seg[a].c_suff = verts[i].v_color;
				seg[a].w_through = verts[i].weight;
				seg[a].w_mid = maybe_biggest(best_ch2[i][verts[i].v_color]);
				seg[a].w_suff = maybe_biggest(ch_v_e[i][verts[i].v_color][verts[i].e_color]);
				seg[a].w_pref = seg[a].w_through + seg[a].w_suff;
				a.for_parents_up([&](auto p) -> void {
					seg[p] = merge(seg[p.c(0)], seg[p.c(1)]);
				});
			}

			//cerr << "updating " << i << '\n';
			//cerr << "root " << rt << ' ' << heavy_sz[rt] << '\n';
			//cerr << seg[1].c_pref << ' ' << seg[1].c_suff << '\n';
			//cerr << seg[1].w_through << '\n';
			//cerr << seg[1].w_mid << ' ' << seg[1].w_pref << '\n';

			{
				heavy_bests.insert({seg[1].w_mid, rt});

				if (verts[rt].par != -1) {
					auto& s2 = best_ch2[verts[rt].par][verts[rt].v_color];
					auto& s = ch_v_e[verts[rt].par][verts[rt].v_color][verts[rt].e_color];
					s2.erase({maybe_biggest_2(s), verts[rt].e_color});
					s.insert({seg[1].w_pref, rt});
					s2.insert({maybe_biggest_2(s), verts[rt].e_color});
				}
			}

			if (verts[i].e_color != verts[v].e_color) break;
			i = verts[rt].par;
			if (i == -1) break;
		}
	};

	if constexpr (TEST) {
		assert(get_ans() == solve_slow());
	}
	cout << get_ans() << '\n';
	for (int q = 0; q < Q; q++) {
		int x, c;
		if constexpr (TEST) {
			x = std::uniform_int_distribution<int>(0, N-1)(mt);
			c = std::uniform_int_distribution<int>(1, 2)(mt);
			//cerr << x+1 << ' ' << c << '\n';
		} else {
			cin >> x >> c; x--;
		}
		do_update(x, c);
		update_slow(x, c);
		if constexpr (TEST) {
			//cerr << "ans " << get_ans() << '\n';
			//cerr << "slow " << solve_slow() << '\n';
			assert(get_ans() == solve_slow());
		}
		cout << get_ans() << '\n';
	}
	}

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

6
10
10
4
15
2

result:

ok 6 numbers

Test #2:

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

input:

13 21
1 2 1 2 4 4 2 1 4 2 3 6 1
1 1 2 3 2 6 7 8 9 10 8 8
2 13 1 1 1 2 2 1 2 1 2 1
472868230 94771637 209247951 483753517 822923242 938504499 413445582 328056598 487969741 355938152 902390974 28610378
2 4
7 4
10 1
8 4
2 3
5 2
11 4
9 3
6 2
6 1
4 1
6 1
2 3
8 2
5 2
6 2
8 4
8 2
1 4
11 4
12 2

output:

209247951
822923242
938504499
938504499
1351950081
1351950081
1351950081
1351950081
1351950081
413445582
413445582
413445582
413445582
413445582
94771637
94771637
94771637
413445582
94771637
0
0
902390974

result:

ok 22 numbers

Test #3:

score: 0
Accepted
time: 1705ms
memory: 221696kb

input:

200000 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
1999164873
199...

result:

ok 200000 numbers

Test #4:

score: 0
Accepted
time: 1120ms
memory: 190316kb

input:

199999 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
1999993380
199...

result:

ok 199999 numbers

Test #5:

score: 0
Accepted
time: 1615ms
memory: 225356kb

input:

200000 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
1997943637
199...

result:

ok 200000 numbers

Test #6:

score: 0
Accepted
time: 1123ms
memory: 187772kb

input:

199999 200000
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
1999990769
199...

result:

ok 200001 numbers

Test #7:

score: 0
Accepted
time: 1243ms
memory: 208984kb

input:

199999 200000
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
1999694869
199...

result:

ok 200001 numbers

Test #8:

score: 0
Accepted
time: 1128ms
memory: 189788kb

input:

200000 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
1999975784
199...

result:

ok 199999 numbers

Test #9:

score: 0
Accepted
time: 1154ms
memory: 190884kb

input:

200000 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
1999979021
199...

result:

ok 200000 numbers

Test #10:

score: 0
Accepted
time: 1463ms
memory: 208448kb

input:

199998 200000
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
1999727070
199...

result:

ok 200001 numbers

Test #11:

score: 0
Accepted
time: 1107ms
memory: 193560kb

input:

199999 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
1999998737
199...

result:

ok 199999 numbers

Test #12:

score: 0
Accepted
time: 1640ms
memory: 218676kb

input:

199999 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
1998690305
199...

result:

ok 199999 numbers

Test #13:

score: 0
Accepted
time: 1142ms
memory: 205248kb

input:

200000 200000
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
10779640138
...

result:

ok 200001 numbers

Test #14:

score: 0
Accepted
time: 1199ms
memory: 210996kb

input:

199999 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
10233934986
...

result:

ok 199999 numbers

Test #15:

score: 0
Accepted
time: 1133ms
memory: 199036kb

input:

199999 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
10888368837
...

result:

ok 200000 numbers

Test #16:

score: 0
Accepted
time: 1108ms
memory: 198708kb

input:

200000 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
10145392799
...

result:

ok 199999 numbers

Test #17:

score: 0
Accepted
time: 1162ms
memory: 205272kb

input:

199998 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
12633249112
...

result:

ok 199999 numbers

Test #18:

score: 0
Accepted
time: 1129ms
memory: 205028kb

input:

199998 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
9731835557
973...

result:

ok 199999 numbers

Test #19:

score: 0
Accepted
time: 1208ms
memory: 202620kb

input:

199998 200000
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
12966559168
...

result:

ok 200001 numbers

Test #20:

score: 0
Accepted
time: 1220ms
memory: 198852kb

input:

200000 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
10903605928
...

result:

ok 199999 numbers

Test #21:

score: 0
Accepted
time: 1156ms
memory: 211296kb

input:

199999 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
12327114808
...

result:

ok 199999 numbers

Test #22:

score: 0
Accepted
time: 1191ms
memory: 208648kb

input:

199999 200000
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
10794900302
...

result:

ok 200001 numbers

Test #23:

score: 0
Accepted
time: 825ms
memory: 182084kb

input:

199998 200000
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

6694759253332
6694759253332
6694759253332
6694759253332
6694759253332
6694759253332
6694759253332
6694759253332
6694759253332
6694759253332
5604670721548
5604670721548
5604670721548
5604670721548
5604670721548
5604670721548
5604670721548
5604670721548
5604670721548
5604670721548
5604670721548
560467...

result:

ok 200001 numbers

Test #24:

score: 0
Accepted
time: 777ms
memory: 175188kb

input:

199999 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

8730169189068
8730169189068
8730169189068
8730169189068
6879673837193
6879673837193
6879673837193
6879673837193
6879673837193
6879673837193
6879673837193
6879673837193
6879673837193
6879673837193
6879673837193
6879673837193
6879673837193
6879673837193
6879673837193
6498003008733
6498003008733
649800...

result:

ok 199999 numbers

Test #25:

score: 0
Accepted
time: 820ms
memory: 180412kb

input:

199999 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

16964972670721
16390048684544
16390048684544
9913582115275
9913582115275
9913582115275
9913582115275
9913582115275
9913582115275
9913582115275
9913582115275
9913582115275
9913582115275
9913582115275
9913582115275
9913582115275
9913582115275
9913582115275
7849037632647
7849037632647
7849037632647
784...

result:

ok 200000 numbers

Test #26:

score: 0
Accepted
time: 861ms
memory: 184720kb

input:

200000 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

10119248263503
10119248263503
10119248263503
10119248263503
10119248263503
8542130343519
8542130343519
8542130343519
8542130343519
6842138653779
6842138653779
6842138653779
6842138653779
6842138653779
6842138653779
6842138653779
6842138653779
6842138653779
6842138653779
6842138653779
6842138653779
6...

result:

ok 200000 numbers

Test #27:

score: 0
Accepted
time: 778ms
memory: 180476kb

input:

199998 200000
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

16872130560892
16872130560892
16872130560892
15104243748166
15104243748166
15104243748166
15104243748166
15104243748166
15104243748166
15104243748166
15104243748166
15104243748166
15104243748166
15104243748166
15104243748166
15104243748166
15104243748166
15104243748166
15104243748166
15104243748166
...

result:

ok 200001 numbers

Test #28:

score: 0
Accepted
time: 840ms
memory: 180396kb

input:

199999 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

8838414514239
8838414514239
8838414514239
8373720423412
8373720423412
8373720423412
8373720423412
8373720423412
8373720423412
8373720423412
8373720423412
8373720423412
8373720423412
8373720423412
8373720423412
8373720423412
8373720423412
6995924779246
6995924779246
6995924779246
6995924779246
699592...

result:

ok 200000 numbers

Test #29:

score: 0
Accepted
time: 833ms
memory: 180392kb

input:

200000 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

7701141318718
7701141318718
7701141318718
7701141318718
4418870471250
4418870471250
4418870471250
4418870471250
4418870471250
4418870471250
4418870471250
4418870471250
4418870471250
4418870471250
4418870471250
4418870471250
4418870471250
4418870471250
4418870471250
4418870471250
4418870471250
441887...

result:

ok 199999 numbers

Test #30:

score: 0
Accepted
time: 809ms
memory: 175272kb

input:

199999 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

17022193248209
17022193248209
17022193248209
17022193248209
17022193248209
10792831394227
10792831394227
10792831394227
10792831394227
10792831394227
10792831394227
10792831394227
10792831394227
10792831394227
10792831394227
6123864764662
6123864764662
6123864764662
6123864764662
6123864764662
61238...

result:

ok 200000 numbers

Test #31:

score: 0
Accepted
time: 783ms
memory: 175420kb

input:

199999 200000
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

15888329431172
15888329431172
15888329431172
15888329431172
15888329431172
15888329431172
15888329431172
15888329431172
15888329431172
15888329431172
15888329431172
15888329431172
15888329431172
15888329431172
15888329431172
11083692627808
11083692627808
11083692627808
11083692627808
11083692627808
...

result:

ok 200001 numbers

Test #32:

score: 0
Accepted
time: 731ms
memory: 175396kb

input:

199999 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

8839751622015
8839751622015
8839751622015
8839751622015
8839751622015
8839751622015
8839751622015
8127355953055
8127355953055
8127355953055
8127355953055
8127355953055
8127355953055
8127355953055
8127355953055
8127355953055
6876528315124
6876528315124
6876528315124
6876528315124
6876528315124
687652...

result:

ok 199999 numbers

Test #33:

score: 0
Accepted
time: 986ms
memory: 214976kb

input:

200000 200000
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
9725472699
972...

result:

ok 200001 numbers

Test #34:

score: 0
Accepted
time: 1024ms
memory: 217452kb

input:

199998 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
10876048367
...

result:

ok 200000 numbers

Test #35:

score: 0
Accepted
time: 1094ms
memory: 233304kb

input:

199998 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
4757124594
475...

result:

ok 199999 numbers

Test #36:

score: 0
Accepted
time: 1037ms
memory: 206548kb

input:

199999 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
10754456505
...

result:

ok 200000 numbers

Test #37:

score: 0
Accepted
time: 1085ms
memory: 206652kb

input:

199999 200000
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
10586909197
...

result:

ok 200001 numbers

Test #38:

score: 0
Accepted
time: 1458ms
memory: 185700kb

input:

200000 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
15202297780
...

result:

ok 200000 numbers

Test #39:

score: 0
Accepted
time: 1437ms
memory: 197884kb

input:

200000 200000
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
14045671356
...

result:

ok 200001 numbers

Test #40:

score: 0
Accepted
time: 1482ms
memory: 191284kb

input:

199998 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
13920420868
...

result:

ok 199999 numbers

Test #41:

score: 0
Accepted
time: 1435ms
memory: 194972kb

input:

199999 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
13749433620
...

result:

ok 200000 numbers

Test #42:

score: 0
Accepted
time: 1404ms
memory: 197972kb

input:

200000 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
13903763549
...

result:

ok 199999 numbers

Test #43:

score: 0
Accepted
time: 1411ms
memory: 185684kb

input:

200000 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
13828228862
...

result:

ok 200000 numbers

Test #44:

score: 0
Accepted
time: 1102ms
memory: 231344kb

input:

199999 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
5890088235
589...

result:

ok 200000 numbers

Test #45:

score: 0
Accepted
time: 1091ms
memory: 229056kb

input:

200000 200000
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
4585029213
458...

result:

ok 200001 numbers

Test #46:

score: 0
Accepted
time: 1112ms
memory: 215880kb

input:

200000 200000
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
5828176817
582...

result:

ok 200001 numbers

Test #47:

score: 0
Accepted
time: 1262ms
memory: 214760kb

input:

199998 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
10818152720
...

result:

ok 200000 numbers

Test #48:

score: 0
Accepted
time: 1026ms
memory: 196512kb

input:

200000 199999
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
11176355739
...

result:

ok 200000 numbers

Test #49:

score: 0
Accepted
time: 1097ms
memory: 226408kb

input:

199998 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
6951297596
695...

result:

ok 199999 numbers

Test #50:

score: 0
Accepted
time: 1108ms
memory: 216348kb

input:

199998 200000
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
12892129784
...

result:

ok 200001 numbers

Test #51:

score: 0
Accepted
time: 1061ms
memory: 209016kb

input:

199999 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
8893665873
889...

result:

ok 199999 numbers

Test #52:

score: 0
Accepted
time: 1436ms
memory: 194660kb

input:

199998 199998
1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1064 1...

output:

13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
13933086708
...

result:

ok 199999 numbers

Test #53:

score: 0
Accepted
time: 1294ms
memory: 338368kb

input:

200000 199998
49441 37885 24128 648 776 55 32583 34146 15473 59281 3478 8998 15132 88193 8815 94360 22342 8413 19377 16187 38814 15720 33706 48309 1393 4424 10729 4675 4420 33459 15552 29757 32030 4361 16053 18663 22470 13941 7275 2255 8 47975 18888 38456 23806 80532 2893 1446 3890 34427 68534 32984...

output:

669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
669645996
...

result:

ok 199999 numbers

Test #54:

score: 0
Accepted
time: 1327ms
memory: 338308kb

input:

199999 199999
40518 8211 65911 33288 105868 65619 149729 113811 189467 173883 29621 110825 179103 93030 187332 14245 190242 111183 145983 140740 140034 61807 7766 78468 143624 135365 60429 62403 69629 35943 74390 120590 170604 115104 195260 45050 138351 67444 16049 79825 114806 27255 139603 49410 16...

output:

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

result:

ok 200000 numbers

Test #55:

score: 0
Accepted
time: 1052ms
memory: 336156kb

input:

199998 200000
229 32 1283 61 797 225 5 1812 209 48 79 1 13 754 9 15 21 15 377 330 4 212 66 40 1899 20 3 1707 789 744 7 1812 355 6 85 285 1 4 664 442 2589 90 29 1574 855 83 26 160 601 973 3 136 100 51 989 7667 1361 790 21 13 72 3 263 1354 3749 32 248 64 9 11 2932 54 125 18 11 1480 12 540 11 195 239 2...

output:

999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
999197103
...

result:

ok 200001 numbers

Test #56:

score: 0
Accepted
time: 1037ms
memory: 334404kb

input:

199999 199999
139 512 1541 6 409 3761 9 2 1607 38 1 17 64 245 1458 1 261 19 4 123 1276 870 97 1 206 142 31 6 312 4 41 92 21 376 40 2 10 946 26 16 96 4 405 1 3 21 1489 104 91 53 10 14 233 2062 3255 15 1 1939 483 81 8 6 100 283 676 30 864 58 117 19 12 84 98 11 162 1334 28 1 3 397 14 196 192 5332 23 8 ...

output:

999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
999889285
...

result:

ok 200000 numbers

Test #57:

score: 0
Accepted
time: 1087ms
memory: 244388kb

input:

200000 199998
1 2 1 1 1 2 4 1 1 2 1 1 1 1 2 4 2 1 1 3 3 1 3 1 1 2 2 1 1 1 2 1 2 2 1 1 1 1 4 3 1 3 3 3 2 1 3 2 1 1 1 4 1 2 1 2 4 2 1 1 3 2 2 1 1 1 1 1 2 2 1 1 1 2 1 4 2 1 2 1 4 1 1 3 3 3 1 4 1 3 1 2 2 1 3 1 3 1 3 2 1 2 2 2 1 1 3 1 1 2 1 3 1 1 2 2 1 4 2 2 1 1 2 1 2 2 1 3 3 3 1 3 2 1 1 1 1 3 2 1 1 3 1 ...

output:

4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
4869794433
486...

result:

ok 199999 numbers

Test #58:

score: 0
Accepted
time: 1212ms
memory: 216932kb

input:

200000 199998
1 1 1 1 3 2 1 1 1 1 2 2 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 2 2 2 1 1 1 1 1 3 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 ...

output:

12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
12350643166
...

result:

ok 199999 numbers

Test #59:

score: 0
Accepted
time: 929ms
memory: 156528kb

input:

199999 199999
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
11584589800
...

result:

ok 200000 numbers

Test #60:

score: 0
Accepted
time: 989ms
memory: 146184kb

input:

200000 200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
14807286806
...

result:

ok 200001 numbers