QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#410675#6665. 팀 만들기thenymphsofdelphi100 ✓3186ms38160kbC++175.5kb2024-05-14 11:17:032024-05-14 11:17:03

Judging History

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

  • [2024-05-14 11:17:03]
  • 评测
  • 测评结果:100
  • 用时:3186ms
  • 内存:38160kb
  • [2024-05-14 11:17:03]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#if __cplusplus < 202002L
template <class T> int ssize(const T& a){ return a.size(); }
#endif
template <class T1, class T2> istream& operator>> (istream& in, pair <T1, T2>& a){ in >> a.first >> a.second; return in; }
template <class T> istream& operator>> (istream& in, vector <T>& a){ for (auto &x: a){ in >> x; } return in; }
 
using ll = long long;
using ld = long double;

template<class T, class F>
struct sparse_table{
#ifdef LOCAL
	#define ASSERT(x) assert(x)
#else
	#define ASSERT(x) 42
#endif
	int n;
	vector<vector<T>> data;
	F TT;
	T T_id;
	sparse_table(F TT, T T_id): TT(TT), T_id(T_id){ }
	sparse_table &operator=(const sparse_table &st){
		n = st.n;
		data = st.data;
		return *this;
	}
	friend void swap(sparse_table &stl, sparse_table &str){
		swap(stl.n, str.n);
		swap(stl.data, str.data);
	}
	// O(n * log(n))
	void build(const vector<T> &a){
		n = (int)a.size();
		if (ssize(data) < 1){
			data.resize(1);
		}
		data[0] = a;
		for(auto p = 1, i = 1; p << 1 <= n; p <<= 1, ++ i){
			if (ssize(data) <= i){
				data.resize(i + 1);
			}
			data[i].resize(n - (p << 1) + 1);
			for(auto j = 0; j < (int)data[i].size(); ++ j) data[i][j] = TT(data[i - 1][j], data[i - 1][j + p]);
		}
	}
	// O(1)
	T query(int l, int r) const{
		ASSERT(0 <= l && l <= r && r <= n);
		if(l == r) return T_id;
		int d = __lg(r - l);
		return TT(data[d][l], data[d][r - (1 << d)]);
	}
#undef ASSERT
};
template<class T, class F>
auto make_sparse_table(F TT, T T_id){
	return sparse_table(TT, T_id);
}
template<class T>
auto make_rminq(T inf = numeric_limits<T>::max()){
	return sparse_table([&](const T &x, const T &y){ return min(x, y); }, inf);
}
template<class T>
auto make_rmaxq(T minf = numeric_limits<T>::min()){
	return sparse_table([&](const T &x, const T &y){ return max(x, y); }, minf);
}

vector <ll> build_teams(vector <int> A1, vector <int> B1, vector <int> A2, vector <int> B2, vector <int> L1, vector <int> R1, vector <int> L2, vector <int> R2){
	auto n = ssize(A1), m = ssize(A2), q = ssize(L1);

	vector <ll> ans(q);

	vector <pair <ll, int>> opt(max(n, m));
	auto sptb = make_rmaxq(numeric_limits <pair <ll, int>>::min());
	auto dnc1 = [&](auto&& self, int l1, int r1, int l2, int r2)->void{
		auto m1 = (l1 + r1) >> 1;
		opt[m1] = {numeric_limits <ll>::min(), -1};
		for (auto j = l2; j <= r2; j++){
			opt[m1] = max(opt[m1], pair <ll, int>{ll(A1[m1] + A2[j]) * (B1[m1] + B2[j]), j});
		}
		auto m2 = opt[m1].second;
		if (l1 <= m1 - 1){
			self(self, l1, m1 - 1, m2, r2);
		}
		if (m1 + 1 <= r1){
			self(self, m1 + 1, r1, l2, m2);
		}
	};
	auto dnc2 = [&](auto&& self, int l1, int r1, int l2, int r2)->void{
		auto m2 = (l2 + r2) >> 1;
		opt[m2] = {numeric_limits <ll>::min(), -1};
		for (auto i = l1; i <= r1; i++){
			opt[m2] = max(opt[m2], pair <ll, int>{ll(A1[i] + A2[m2]) * (B1[i] + B2[m2]), i});
		}
		auto m1 = opt[m2].second;
		if (l2 <= m2 - 1){
			self(self, m1, r1, l2, m2 - 1);
		}
		if (m2 + 1 <= r2){
			self(self, l1, m1, m2 + 1, r2);
		}
	};

	vector <pair <int, int>> block_range_1(q, pair{n, -1});
	const auto S1 = int(sqrt(n));
	for (auto l = 0, r = min(S1 - 1, n - 1); l < n; l = r + 1, r = min(r + S1, n - 1)){
		dnc2(dnc2, l, r, 0, m - 1);
		sptb.build(opt);

		for (auto iq = 0; iq < q; iq++){
			if (L1[iq] <= l and r <= R1[iq]){
				block_range_1[iq].first = min(block_range_1[iq].first, l);
				block_range_1[iq].second = max(block_range_1[iq].second, r);

				ans[iq] = max(ans[iq], sptb.query(L2[iq], R2[iq] + 1).first);
			}
		}
	}

	vector <pair <int, int>> block_range_2(q, pair{m, -1});
	const auto S2 = int(sqrt(m));
	for (auto l = 0, r = min(S2 - 1, m - 1); l < m; l = r + 1, r = min(r + S2, m - 1)){
		dnc1(dnc1, 0, n - 1, l, r);
		sptb.build(opt);

		for (auto iq = 0; iq < q; iq++){
			if (L2[iq] <= l and r <= R2[iq]){
				block_range_2[iq].first = min(block_range_2[iq].first, l);
				block_range_2[iq].second = max(block_range_2[iq].second, r);

				ans[iq] = max(ans[iq], sptb.query(L1[iq], R1[iq] + 1).first);
			}
		}
	}

	for (auto iq = 0; iq < q; iq++){
		vector <pair <int, int>> range_1, range_2;
		if (block_range_1[iq].second == -1){
			range_1.emplace_back(L1[iq], R1[iq]);
		}
		else{
			if (L1[iq] < block_range_1[iq].first){
				range_1.emplace_back(L1[iq], block_range_1[iq].first - 1);
			}
			if (block_range_1[iq].second < R1[iq]){
				range_1.emplace_back(block_range_1[iq].second + 1, R1[iq]);
			}
		}
		if (block_range_2[iq].second == -1){
			range_2.emplace_back(L2[iq], R2[iq]);
		}
		else{
			if (L2[iq] < block_range_2[iq].first){
				range_2.emplace_back(L2[iq], block_range_2[iq].first - 1);
			}
			if (block_range_2[iq].second < R2[iq]){
				range_2.emplace_back(block_range_2[iq].second + 1, R2[iq]);
			}
		}

		for (auto &[l1, r1]: range_1){
			for (auto &[l2, r2]: range_2){
				dnc2(dnc2, l1, r1, l2, r2);
				for (auto j = l2; j <= r2; j++){
					ans[iq] = max(ans[iq], opt[j].first);
				}
			}
		}
	}

	return ans;
}

#ifndef ONLINE_JUDGE
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	int n, m, q;
	cin >> n >> m >> q;
	vector <int> A1(n), B1(n), A2(m), B2(m), L1(q), R1(q), L2(q), R2(q);
	cin >> A1 >> B1 >> A2 >> B2;
	for (auto iq = 0; iq < q; iq++){
		cin >> L1[iq] >> R1[iq] >> L2[iq] >> R2[iq];
	}

	vector <ll> ans = build_teams(A1, B1, A2, B2, L1, R1, L2, R2);
	for (auto iq = 0; iq < q; iq++){
		cout << ans[iq] << "\n";
	}
}
#endif

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms
memory: 3936kb

input:

500 499
7 4997
13 4988
20 4983
28 4969
44 4963
49 4922
54 4919
58 4897
71 4893
72 4886
85 4883
102 4879
107 4876
113 4868
128 4845
133 4839
135 4831
138 4821
140 4809
156 4793
178 4780
181 4776
190 4760
196 4756
203 4752
209 4736
225 4728
228 4723
232 4720
235 4709
253 4676
258 4660
260 4645
266 463...

output:

25745327
24221652
25260576
25444230
25944610
26027379
25944610
21794500
25502475
19748843
25944610
25269202
25294500
24084151
25944610
25944610
25923420
25745327
24097815
21842574

result:

ok 20 lines

Test #2:

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

input:

500 499
3 4994
6 4989
12 4978
20 4972
22 4965
32 4949
48 4914
52 4893
56 4875
62 4867
66 4860
80 4840
98 4828
106 4814
108 4788
127 4785
142 4783
177 4775
181 4770
182 4766
191 4764
201 4757
205 4753
235 4743
298 4740
300 4725
326 4720
346 4714
350 4709
373 4703
379 4680
390 4674
391 4643
393 4640
3...

output:

22404249
24625440
24983847
24994621
26178282
25385964
25028495
18972628
24778368
24808000
25212965
24604640
23302608
24979302
22241460
25385964
24155109
26178282
25137864
25619090

result:

ok 20 lines

Test #3:

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

input:

500 499
3 4988
4 4967
8 4953
10 4942
11 4936
13 4930
20 4927
40 4904
43 4897
61 4892
65 4852
70 4849
74 4815
78 4812
90 4801
91 4792
107 4783
116 4781
121 4770
123 4747
125 4738
129 4706
132 4700
134 4698
139 4684
145 4680
148 4667
155 4665
164 4652
181 4651
188 4649
191 4648
199 4646
202 4628
209 4...

output:

25458244
17507070
23722057
23685867
24493896
26156980
21925946
26222616
25564880
25172184
24611064
17491437
25418853
25931580
25669456
25144644
26156980
25931580
17224980
25581918

result:

ok 20 lines

Test #4:

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

input:

500 499
22 5000
23 4994
33 4971
34 4960
35 4949
36 4943
37 4930
66 4891
112 4879
118 4863
132 4859
136 4854
152 4851
153 4848
154 4845
164 4842
180 4814
184 4801
197 4798
211 4794
214 4789
221 4773
226 4770
250 4768
256 4760
265 4728
267 4727
272 4718
288 4693
313 4691
318 4683
340 4676
352 4662
355...

output:

25267216
25648854
24950190
25648854
25648854
25192470
25648854
25267216
25267216
25022088
25648854
25267216
24968784
24378216
25648854
25840997
25648854
25648854
25648854
25822235
25648854
24947710
25822235
25822235
25822235
25267216
25648854
25022088
25509360
25840997
25648854
25648854
25648854
252...

result:

ok 500 lines

Test #5:

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

input:

500 499
4 4995
10 4970
25 4967
29 4960
32 4958
39 4954
44 4937
45 4930
52 4927
64 4912
66 4910
67 4901
69 4897
71 4875
79 4863
81 4852
82 4831
89 4816
98 4805
106 4800
116 4794
121 4785
136 4765
137 4756
144 4743
156 4736
157 4724
159 4721
160 4720
163 4715
166 4707
180 4704
185 4701
197 4697
224 46...

output:

26806923
25439158
26931420
26192385
26651388
26651388
25061382
26931420
26453167
25395564
26931420
26453167
26931420
26453167
26931420
26513175
26931420
26453167
26603521
26931420
26453167
26931420
26263972
26931420
26931420
26453167
26931420
26192385
26931420
26931420
26931420
26931420
26931420
269...

result:

ok 500 lines

Test #6:

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

input:

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

output:

128
126
85
117
156

result:

ok 5 lines

Test #7:

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

input:

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

output:

70
110
60
70
110

result:

ok 5 lines

Test #8:

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

input:

500 499
9 4994
14 4980
28 4978
29 4952
34 4940
62 4930
70 4917
74 4910
82 4901
106 4890
107 4883
110 4872
113 4871
119 4857
128 4853
131 4848
140 4839
144 4828
148 4816
153 4796
156 4786
159 4781
168 4770
181 4730
188 4727
193 4722
194 4721
215 4708
217 4707
232 4691
245 4690
258 4680
260 4667
261 4...

output:

20531749
16972104
21053425
23103696
25098804
25340760
25341680
21832928
21858600
25179924
23973411
21140084
21751158
14683410
23024292
14844505
25260348
18876924
24160328
21938755
24261405
24268965
23674320
23894930
22236925
24992050
5970151
20907068
23901372
24515392
24392200
21902265
24623903
2158...

result:

ok 500 lines

Test #9:

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

input:

500 499
5 4995
36 4981
46 4980
57 4979
71 4978
73 4972
76 4971
78 4959
79 4943
88 4923
95 4913
104 4908
113 4905
126 4897
129 4885
130 4874
173 4857
175 4825
178 4807
184 4804
187 4800
199 4784
202 4773
245 4772
250 4767
251 4766
281 4725
286 4720
287 4699
347 4698
349 4696
362 4693
372 4687
376 468...

output:

24953172
24794000
25335478
24556337
24128202
21977650
20408654
24631050
24409540
23185940
24632584
24312130
23457312
18707214
24737080
24174850
21375835
24631050
24378705
24621552
24900019
20720233
25734498
24871728
23796768
15357936
18732816
24483622
25789992
25660096
25742340
22546506
22812636
242...

result:

ok 500 lines

Test #10:

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

input:

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

output:

112
144
143
135

result:

ok 4 lines

Test #11:

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

input:

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

output:

224
195
152
170

result:

ok 4 lines

Test #12:

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

input:

1 1
9 5
4 7
1
0 0 0 0

output:

156

result:

ok single line: '156'

Test #13:

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

input:

2 2
3 10
6 2
4 7
6 2
10
0 1 0 0
1 1 0 0
0 0 0 0
0 1 0 1
0 1 0 0
0 1 0 0
1 1 1 1
1 1 1 1
0 1 1 1
0 1 0 0

output:

119
90
119
119
119
119
48
48
108
119

result:

ok 10 lines

Test #14:

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

input:

3 3
1 14
3 8
11 3
1 9
10 8
12 5
10
0 0 0 0
2 2 0 2
0 0 0 2
0 2 1 1
1 2 0 1
0 1 1 1
1 1 2 2
1 2 1 2
0 2 0 0
0 0 1 2

output:

46
231
247
242
231
242
195
231
144
247

result:

ok 10 lines

Test #15:

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

input:

5 5
4 19
10 14
15 11
17 3
19 2
2 19
10 7
14 3
15 2
17 1
10
3 4 2 3
0 1 2 3
3 3 1 1
1 4 0 3
3 4 3 3
4 4 3 4
3 4 3 4
0 3 3 4
2 3 0 3
3 3 0 3

output:

186
408
270
510
160
136
160
420
510
418

result:

ok 10 lines

Test #16:

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

input:

7 7
2 19
4 13
5 10
6 6
7 5
10 4
12 3
2 20
6 15
8 12
11 9
14 7
15 6
17 1
10
0 4 0 3
2 3 2 5
2 3 1 3
5 5 2 5
3 5 4 5
1 6 3 4
2 4 2 5
2 6 0 5
1 5 0 1
1 6 0 4

output:

364
323
304
288
264
360
323
324
304
360

result:

ok 10 lines

Test #17:

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

input:

10 10
3 19
5 18
8 17
10 13
12 10
13 9
15 8
16 6
17 5
18 1
1 19
6 15
7 14
9 13
10 12
13 10
14 7
16 5
17 2
18 1
10
0 1 5 5
5 6 0 6
0 5 1 7
5 8 3 7
3 5 1 8
3 5 0 7
0 4 8 8
6 7 0 2
3 4 1 7
6 9 1 7

output:

504
504
567
504
529
529
475
484
529
504

result:

ok 10 lines

Test #18:

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

input:

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

output:

500
484
378
500
460
484
500
378
392
414

result:

ok 10 lines

Test #19:

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

input:

498 499
27 4991
37 4989
49 4978
54 4967
65 4964
70 4963
76 4943
77 4935
110 4903
112 4883
116 4882
118 4871
123 4870
126 4868
130 4860
136 4855
139 4840
146 4817
159 4816
203 4811
235 4810
249 4806
257 4798
259 4795
272 4786
283 4783
288 4781
289 4771
301 4764
302 4745
333 4730
335 4719
345 4713
350...

output:

25059100
26443626
24701330
25664187
24972456
26443626
23704800
24849946
24730376
24024673
25410691
25196431
25882857
20204998
26443626
17370044
26443626
26443626
23404703
25209247
24488802
24843336
25441668
24956295
25078491
25664187
20478964
25459972
25145413
23747913
25078491
25910042
25051490
223...

result:

ok 500 lines

Test #20:

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

input:

423 400
2 4968
60 4946
72 4938
91 4910
95 4899
98 4869
110 4832
116 4827
119 4804
121 4797
122 4795
124 4782
129 4776
131 4774
151 4763
162 4745
163 4722
182 4713
196 4683
200 4679
207 4676
210 4664
223 4621
249 4619
265 4617
275 4615
281 4612
293 4598
301 4597
333 4578
343 4557
346 4547
380 4529
39...

output:

25653405
26650000
6823686
26446696
16542394
25074350
22265488
27134380
26779122
27260832
25686258
23517530
23330238
23661300
22902808
27134380
24632011
25848669
20042100
24981181
26779122
26560890
20610852
25638726
27260832
25973892
26571468
24161598
27167912
26286516
27167912
26944533
25444281
2648...

result:

ok 500 lines

Test #21:

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

input:

500 500
12 4998
18 4994
32 4990
55 4970
57 4961
74 4950
91 4939
96 4937
122 4931
124 4921
127 4881
130 4877
138 4857
159 4846
160 4844
165 4843
166 4836
181 4831
199 4818
212 4809
253 4786
254 4783
272 4755
273 4739
275 4736
298 4734
307 4733
318 4728
321 4719
322 4714
351 4686
353 4681
357 4678
366...

output:

24251001
24408876
25954800
23803350
25912414
24408876
25731552
20675986
25879501
25464547
23738916
25492509
25954800
23163164
24524286
25005420
24258960
19881316
23864274
24884695
25492509
25119900
25452315
24408876
24900444
24991520
24533130
25492509
24649056
24041177
25141164
25194085
25954800
233...

result:

ok 500 lines

Test #22:

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

input:

499 500
241 1998397
2131 1996036
3317 1995104
8667 1992186
10801 1984868
14767 1982136
18355 1981825
18693 1978196
23272 1974799
28185 1974598
29185 1958817
31885 1951969
32657 1949913
36165 1943326
46509 1933617
47554 1932321
48342 1926639
49847 1923024
52698 1920254
55874 1918534
56057 1909221
568...

output:

2543777519646
4037188018786
3407335675545
3875689202860
2620922683140
3925852451433
3993113413520
3986304993216
3879082786800
3952072159232
3916650082440
3813851134401
3990873744520
3699222517536
3990873744520
3305639186176
3521012638454
3903445453051
3699222517536
4037188018786
3889885749401
399675...

result:

ok 500 lines

Test #23:

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

input:

500 498
2298345 998507729
2980882 997472093
8130269 996977292
8487157 995654073
14390861 995619536
18122495 994460979
19697981 987703132
19837504 987502413
19921980 986628758
25501848 984640139
27075607 983516527
27423861 982737873
28099456 981421946
28201694 980745740
29106533 980422598
30799056 97...

output:

763926714192407777
1044720464742592412
1015220808619437216
931240983517370836
1015220808619437216
917072956824113430
1009040844804436710
1015220808619437216
1015220808619437216
1044720464742592412
1014453565559038869
1044720464742592412
883457923860732978
1003474459434227132
987969664308050613
92893...

result:

ok 500 lines

Test #24:

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

input:

500 500
2699813 989376403
5210072 988161802
5996514 985305479
8901886 983612242
9335327 982575905
11148119 981065921
14147246 980967389
15394408 980468514
17583866 973997988
18992711 971195390
19250151 970064522
19997279 969120188
20356773 968865361
20446900 968392035
29650530 967683859
32916008 965...

output:

1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
...

result:

ok 500 lines

Test #25:

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

input:

500 500
154 17029
246 16987
264 16971
304 16935
351 16862
460 16837
539 16809
593 16758
735 16722
887 16666
948 16644
997 16580
1005 16525
1136 16480
1305 16451
1331 16424
1339 16404
1499 16345
1635 16324
1698 16310
1859 16296
1960 16275
2110 16264
2139 16255
2173 16225
2328 16184
2355 16144
2362 16...

output:

340200441
270557712
390514904
452277904
345539660
320962581
657633802
411252480
390514904
407284122
844100824
284064927
324615477
325281888
261481296
624764765
463794570
228042534
271199396
371805498
448966035
327866460
517235688
359863526
540863862
871066218
505082130
367192616
411754774
355316016
...

result:

ok 500 lines

Test #26:

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

input:

500 500
96 20674
191 20658
205 20651
283 20617
288 20595
394 20575
543 20569
672 20555
749 20543
839 20536
867 20532
1012 20527
1043 20503
1078 20486
1103 20474
1190 20471
1267 20461
1411 20444
1449 20422
1530 20400
1644 20389
1744 20379
1845 20356
1933 20354
1949 20338
2032 20323
2062 20301
2121 20...

output:

692042312
656063629
734811375
672218001
693207504
709392384
678704540
705901786
704157450
685078240
686927748
705139464
705901786
709392384
701244978
577498376
710981415
662738874
674512392
691136384
676178594
610701430
696083955
708290616
709063596
714256368
689820285
609506640
705973124
705901786
...

result:

ok 500 lines

Test #27:

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

input:

500 500
2 11519
3 11491
4 11358
5 11280
6 11191
7 11074
8 10986
11 10890
14 10785
19 10703
20 10632
21 10589
28 10554
33 10513
40 10496
48 10446
58 10430
68 10386
77 10262
86 10156
89 10154
94 10105
107 10033
120 9975
139 9912
149 9823
171 9743
189 9733
198 9693
200 9604
215 9514
240 9427
260 9329
2...

output:

93907900
183309770
176254892
108691000
183309770
183309770
158131876
118001161
151050345
161351700
168859584
90309926
103956000
183309770
168158676
183309770
172107607
137538063
125402058
107710368
173733536
174576024
183309770
40267975
107704540
162981700
183309770
162981700
178922436
180563555
165...

result:

ok 500 lines

Test #28:

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

input:

500 500
1 5989
12 5977
23 5965
34 5953
45 5941
56 5929
67 5917
78 5905
89 5893
100 5881
111 5869
122 5857
133 5845
144 5833
155 5821
166 5809
177 5797
188 5785
199 5773
210 5761
221 5749
232 5737
243 5725
254 5713
265 5701
276 5689
287 5677
298 5665
309 5653
320 5641
331 5629
342 5617
353 5605
364 5...

output:

32891090
24773058
31623166
32891090
32891090
32891090
32891090
32087846
32891090
31597556
32889896
29921390
32891090
32880416
32891090
29881056
32891090
32877910
31773658
32891090
28802610
32891090
32891090
32891090
32891090
32891090
32891090
32891090
30728146
32891090
31322580
32891090
32891090
328...

result:

ok 500 lines

Test #29:

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

input:

500 500
1 11977
12 11953
23 11929
34 11905
45 11881
56 11857
67 11833
78 11809
89 11785
100 11761
111 11737
122 11713
133 11689
144 11665
155 11641
166 11617
177 11593
188 11569
199 11545
210 11521
221 11497
232 11473
243 11449
254 11425
265 11401
276 11377
287 11353
298 11329
309 11305
320 11281
33...

output:

65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65161694
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
36135088
65771198
65771198
65771198
65771198
65771198
657...

result:

ok 500 lines

Test #30:

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

input:

500 500
1 11977
23 11953
45 11929
67 11905
89 11881
111 11857
133 11833
155 11809
177 11785
199 11761
221 11737
243 11713
265 11689
287 11665
309 11641
331 11617
353 11593
375 11569
397 11545
419 11521
441 11497
463 11473
485 11449
507 11425
529 11401
551 11377
573 11353
595 11329
617 11305
639 1128...

output:

131518440
131518440
131043120
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
99043336
131518440
131518440
131518440
131518440
131518440
131518440
1...

result:

ok 500 lines

Test #31:

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

input:

500 500
1 1498
3 1495
5 1492
7 1489
9 1486
11 1483
13 1480
15 1477
17 1474
19 1471
21 1468
23 1465
25 1462
27 1459
29 1456
31 1453
33 1450
35 1447
37 1444
39 1441
41 1438
43 1435
45 1432
47 1429
49 1426
51 1423
53 1420
55 1417
57 1414
59 1411
61 1408
63 1405
65 1402
67 1399
69 1396
71 1393
73 1390
7...

output:

1499000
1501500
1499000
1352672
1501500
1499000
1499000
1501500
1501500
1501500
1499000
1499000
1499000
1229760
1198392
1333332
1501500
637912
991496
1499000
1501500
1501500
1498632
1499000
1201072
1499000
1429232
869792
1501500
1499000
1499000
1499000
1499000
1499000
1109360
525352
1499000
1490860
...

result:

ok 500 lines

Subtask #2:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #32:

score: 10
Accepted
time: 750ms
memory: 30860kb

input:

200 100000
5503165 995149221
8266588 995002422
21946668 992986739
25413933 990349572
28299421 973255250
37124968 968549011
43496864 968064488
55669193 966554644
76135027 965428022
85004974 962069232
87848601 955359834
91164522 943903417
91874732 940891045
92514264 939556809
102898246 938039042
10439...

output:

984901378753241934
991771176978169000
1001388688412349108
1045816375530230055
1045816375530230055
1001388688412349108
1045816375530230055
1001111379309445404
989722299319675666
1045816375530230055
994277172837228768
844214663291817384
972575401903380860
1001111379309445404
929212486916356202
1001388...

result:

ok 20 lines

Test #33:

score: 0
Accepted
time: 696ms
memory: 30860kb

input:

100000 200
4381 999898116
4642 999870491
6788 999837291
7640 999824569
8942 999817070
12171 999796839
14138 999793946
19714 999787588
19720 999778196
19950 999767606
20957 999761218
36427 999750312
39438 999724948
41147 999719544
60336 999715615
67904 999676786
76975 999666529
77633 999630166
80014 ...

output:

972922785920335364
973292937431081800
1020129627203740746
981300244010962594
1013382901189535670
997734182839373548
1012907209033479786
1019951489100610396
1005023212057601920
952534824803283498
961216592333078709
997329502619588000
980588205097742808
1011686446212516312
991044636259077695
101622047...

result:

ok 20 lines

Test #34:

score: 0
Accepted
time: 1166ms
memory: 26372kb

input:

81626 67941
3 2000000
10 1999995
29 1999993
33 1999982
35 1999960
62 1999945
96 1999940
100 1999891
160 1999877
306 1999868
331 1999865
388 1999778
405 1999769
417 1999750
426 1999740
438 1999734
453 1999696
458 1999664
491 1999641
493 1999638
552 1999626
566 1999612
638 1999611
673 1999579
776 1999...

output:

3389474188389
4023113289546
4016393921280
3673258316973
4016393921280
4020951015432
4023113289546
4013776547098
4011904593460
3055004543682
4023113289546
3208503726296
4012488512396
4016393921280
4003303180996
4021258165294
4005405402716
3842970979921
4003303180996
4016393921280

result:

ok 20 lines

Test #35:

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

input:

81626 100000
5399 999990669
96324 999971745
96993 999954768
106720 999952952
108939 999939455
109813 999922583
126656 999903931
128948 999902269
170381 999884921
187121 999869110
214350 999837474
229020 999827086
235716 999819053
241851 999794823
252580 999772956
270642 999770499
288359 999722965
29...

output:

903108598547671208
1002634594653434411
1004601743491279500
1001868403335646122
1002739453996283250
1004601743491279500
1004601743491279500
1004601743491279500
636311421875743440
999898291538688648
999667458181327214
1001875047768207390
978209659102529196
1003221739208140634
1002345761350212096
10046...

result:

ok 20 lines

Test #36:

score: 0
Accepted
time: 1514ms
memory: 32084kb

input:

100000 67941
4 1999994
21 1999952
41 1999930
53 1999885
75 1999840
146 1999831
189 1999828
228 1999827
231 1999812
233 1999790
247 1999751
284 1999723
296 1999699
305 1999683
369 1999662
370 1999630
374 1999621
381 1999594
382 1999584
386 1999574
389 1999572
431 1999570
448 1999560
464 1999559
497 1...

output:

3997314319382
3997314319382
3993761598453
3998998529526
3994845973568
3989601535320
3849466699716
3944841227901
3671728704729
1662421048083
3984962287368
3990621378400
3992670680496
3997314319382
3997314319382
3875577051930
3997314319382
3990574490210
3989109415590
2954756765100

result:

ok 20 lines

Test #37:

score: 0
Accepted
time: 1742ms
memory: 32604kb

input:

100000 100000
4371 999987471
37236 999963414
38713 999960227
44711 999959877
46552 999959222
73127 999948956
82476 999947357
87744 999944733
120147 999942860
128282 999927313
156267 999919286
157111 999871877
173126 999852047
189523 999847951
234059 999847746
241862 999802488
246431 999788979
260129...

output:

1000398904726452971
1004269420399756875
993853905876814276
1002718505553710701
968959097049944061
999287650459493850
771757398632894232
948954651239462985
893625506586294768
1000964197567275950
999456583592277776
1006739001352496880
1003966458748593152
1004473478973149636
1003135670033135940
1006749...

result:

ok 20 lines

Test #38:

score: 0
Accepted
time: 1467ms
memory: 32444kb

input:

100000 100000
1 1099990
13 1099979
25 1099968
37 1099957
49 1099946
61 1099935
73 1099924
85 1099913
97 1099902
109 1099891
121 1099880
133 1099869
145 1099858
157 1099847
169 1099836
181 1099825
193 1099814
205 1099803
217 1099792
229 1099781
241 1099770
253 1099759
265 1099748
277 1099737
289 1099...

output:

1319978200090
1319978200090
1319978200090
1319978200090
1319978200090
1319978200090
1319978200090
1319978200090
1319978200090
1319978200090
1319978200090
1319978200090
1319978200090
1319978200090
1319978200090
1319978200090
1319978200090
1319978200090
1319978200090
1319978200090

result:

ok 20 lines

Test #39:

score: 0
Accepted
time: 1470ms
memory: 32556kb

input:

100000 100000
1 2499976
13 2499951
25 2499926
37 2499901
49 2499876
61 2499851
73 2499826
85 2499801
97 2499776
109 2499751
121 2499726
133 2499701
145 2499676
157 2499651
169 2499626
181 2499601
193 2499576
205 2499551
217 2499526
229 2499501
241 2499476
253 2499451
265 2499426
277 2499401
289 2499...

output:

2992832203610
2494910197010
2999947400230
2999947400230
2999947400230
2974550119156
2999947400230
2999947400230
2999947400230
2976445109804
2999947400230
2874486118530
2991934798662
2999947400230
2553745490714
2999947400230
2999947400230
2999947400230
2984644765338
2999947400230

result:

ok 20 lines

Test #40:

score: 0
Accepted
time: 1484ms
memory: 32444kb

input:

100000 100000
1 1099990
25 1099979
49 1099968
73 1099957
97 1099946
121 1099935
145 1099924
169 1099913
193 1099902
217 1099891
241 1099880
265 1099869
289 1099858
313 1099847
337 1099836
361 1099825
385 1099814
409 1099803
433 1099792
457 1099781
481 1099770
505 1099759
529 1099748
553 1099737
577 ...

output:

2639954200198
2639954200198
2639954200198
2639954200198
2639954200198
2639954200198
2639954200198
2639954200198
2639954200198
2639954200198
2639954200198
2639954200198
2639954200198
2639954200198
2639954200198
2639954200198
2639954200198
2639954200198
2639954200198
2639954200198

result:

ok 20 lines

Test #41:

score: 0
Accepted
time: 1485ms
memory: 32432kb

input:

100000 100000
1 2499976
25 2499951
49 2499926
73 2499901
97 2499876
121 2499851
145 2499826
169 2499801
193 2499776
217 2499751
241 2499726
265 2499701
289 2499676
313 2499651
337 2499626
361 2499601
385 2499576
409 2499551
433 2499526
457 2499501
481 2499476
505 2499451
529 2499426
553 2499401
577 ...

output:

5160633725706
5966489872984
5959141335424
5999889800506
5987960182988
5999889800506
5999889800506
5999889800506
5999889800506
5977055851568
5999301742486
5999889800506
5999889800506
5009411579246
5999889800506
5999889800506
5098254743036
4992568676854
5999889800506
5974959263798

result:

ok 20 lines

Test #42:

score: 0
Accepted
time: 1618ms
memory: 32460kb

input:

100000 100000
369 351827235
1741 351825896
7513 351825597
14429 351819997
22989 351819963
24186 351818631
28823 351817781
38344 351812331
46681 351811227
53697 351803461
57469 351797570
61003 351788054
66702 351782360
73075 351774686
81655 351773631
84356 351769031
90429 351760319
100400 351755569
1...

output:

144120754196775377
91131403015473023
112452211184582172
143286756577031600
122396131454462814
143423223403120726
114771173250055218
142965356878992840
143916028345377531
124196379963213092
109147029685404970
144151797523263400
127599819692475544
144338818043006315
140547522167138046
1347086233623347...

result:

ok 20 lines

Test #43:

score: 0
Accepted
time: 1625ms
memory: 32396kb

input:

100000 100000
6435 390740643
8628 390734334
12451 390730143
21143 390724172
30794 390722523
32673 390722340
37988 390714143
46120 390711188
48278 390706268
56062 390696585
61071 390690615
70359 390689394
78739 390679800
82156 390677007
90929 390675031
95548 390669859
103000 390662058
109102 39065380...

output:

137163856881202605
137163856881202605
137163856881202605
137163856881202605
137163856881202605
137163856881202605
137163856881202605
137163856881202605
137163856881202605
102776739058446768
137163856881202605
137163856881202605
137163856881202605
96363164695694520
137163856881202605
1371638568812026...

result:

ok 20 lines

Test #44:

score: 0
Accepted
time: 1588ms
memory: 32544kb

input:

100000 100000
83 57529363
233 57528153
311 57528128
428 57526889
441 57525159
513 57525024
647 57523400
802 57522672
837 57521126
905 57519817
936 57519487
1057 57518841
1074 57518088
1193 57516737
1261 57515867
1296 57514393
1404 57514278
1471 57512745
1481 57511069
1568 57510206
1634 57509617
1690...

output:

772433378786392
439637960338304
423078640517504
435893426920816
766465102968696
430764067439781
615541318754576
708817620954032
439637960338304
612199230939450
614112229887742
581972871364236
431370348013920
423075540741440
419653539772300
421107843209529
708817620954032
400282465266167
583487356615...

result:

ok 20 lines

Test #45:

score: 0
Accepted
time: 1459ms
memory: 32388kb

input:

100000 100000
1 199999
4 199997
7 199995
10 199993
13 199991
16 199989
19 199987
22 199985
25 199983
28 199981
31 199979
34 199977
37 199975
40 199973
43 199971
46 199969
49 199967
52 199965
55 199963
58 199961
61 199959
64 199957
67 199955
70 199953
73 199951
76 199949
79 199947
82 199945
85 199943...

output:

59999800000
40472155496
55389354160
59999800000
60000300000
59443051132
60000300000
28466504860
60000300000
59999800000
32623271080
59999800000
46036539032
59999800000
59999800000
59999800000
59999800000
58993610900
60000300000
59999800000

result:

ok 20 lines

Test #46:

score: 0
Accepted
time: 1498ms
memory: 32440kb

input:

100000 100000
1 273097270
5215 273094539
10429 273091808
15643 273089077
20857 273086346
26071 273083615
31285 273080884
36499 273078153
41713 273075422
46927 273072691
52141 273069960
57355 273067229
62569 273064498
67783 273061767
72997 273059036
78211 273056305
83425 273053574
88639 273050843
938...

output:

142391493716423548
142391493716423548
142391493716423548
142391493716423548
142391493716423548
142391493716423548
142391493716423548
142391493716423548
142391493716423548
142391493716423548
72308928947831968
142391493716423548
142391493716423548
142391493716423548
139353304654403320
1423914945109156...

result:

ok 20 lines

Subtask #3:

score: 10
Accepted

Test #47:

score: 10
Accepted
time: 920ms
memory: 36328kb

input:

200 100000
335635 996427627
4368692 990235584
10335314 971208588
11639195 971143844
23801483 970115479
31489602 959110431
31544396 956821351
48348198 954187112
48509739 953684848
51173262 952420589
53207608 941523603
62582103 940608015
65545228 932323862
73708623 932037283
80559453 929148992
9033280...

output:

993958698780308505
1059275121529352398
1059275121529352398
1059275121529352398
979409542016948625
1059275121529352398
1059275121529352398
1059275121529352398
1059275121529352398
972560707248716820
1011171607306697480
1043073690916288143
1059275121529352398
1059275121529352398
1059275121529352398
976...

result:

ok 100000 lines

Test #48:

score: 0
Accepted
time: 903ms
memory: 36316kb

input:

100000 200
7562 999982578
14646 999979176
17023 999979047
34088 999949939
37355 999947606
40085 999942853
40792 999940456
72137 999934048
72263 999925995
79201 999923265
87366 999919444
97276 999912192
103443 999911341
120687 999891503
146435 999889738
164344 999872694
172096 999863794
178303 999858...

output:

1069902366797007919
1069902366797007919
1069902366797007919
1069254556645554928
1063111838684534044
1069902366797007919
1068412512308048640
1069902366797007919
1056708009742831080
1067211552446582418
1069902366797007919
1069902366797007919
1069902366797007919
1068460792490386888
1069753760449784022
...

result:

ok 100000 lines

Test #49:

score: 0
Accepted
time: 2210ms
memory: 37872kb

input:

98789 99793
35 1999975
55 1999937
66 1999922
67 1999867
72 1999865
122 1999863
162 1999854
248 1999847
262 1999832
292 1999826
294 1999818
306 1999816
309 1999804
310 1999802
328 1999765
329 1999742
361 1999740
369 1999710
375 1999650
406 1999648
425 1999630
439 1999595
447 1999555
482 1999538
490 1...

output:

4012824131136
4001757949106
4010298254544
4008730710900
4010035262788
4002137227950
4006896391645
4031949411396
4002137227950
4031949411396
4032240593001
4030485471355
4026788313484
4032240593001
4030149206642
4030801525394
4002137227950
4032240593001
4031949411396
4028880682610
4019635580893
400689...

result:

ok 99999 lines

Test #50:

score: 0
Accepted
time: 2117ms
memory: 38144kb

input:

98789 100000
4076 999975218
26154 999973862
55680 999966500
57738 999963674
67001 999960970
69097 999934828
73606 999900945
81941 999891106
92817 999866052
92907 999839529
94140 999824967
100557 999819292
114266 999812477
114483 999807552
121649 999807152
141904 999786637
149766 999781048
181288 999...

output:

1003965970917682420
1003965970917682420
1003965970917682420
1003965970917682420
1003965970917682420
1003965970917682420
1003965970917682420
1003965970917682420
1003965970917682420
1003965970917682420
1002590546600391228
1003965970917682420
1003841501934961518
1001899815905131520
1003965970917682420
...

result:

ok 99999 lines

Test #51:

score: 0
Accepted
time: 2280ms
memory: 37956kb

input:

100000 99793
5 1999985
16 1999942
44 1999922
57 1999912
61 1999909
78 1999878
81 1999875
93 1999865
121 1999845
128 1999839
131 1999836
154 1999830
168 1999826
170 1999823
186 1999797
195 1999788
214 1999771
229 1999730
231 1999710
259 1999706
268 1999703
269 1999669
300 1999633
316 1999617
340 1999...

output:

4008160829581
3992310227788
4008160829581
4006875947973
4008160829581
4008160829581
3991389370092
4003235111092
4002457451370
3992172136113
4006875947973
4008160829581
4003235111092
4002457451370
4007893180672
3992172136113
4002457451370
3995045497096
3990980087865
3995045497096
4008160829581
400245...

result:

ok 99999 lines

Test #52:

score: 0
Accepted
time: 2224ms
memory: 37988kb

input:

100000 99999
28 1999977
125 1999948
134 1999910
153 1999895
172 1999874
191 1999866
202 1999861
205 1999821
233 1999801
248 1999757
275 1999747
325 1999745
430 1999727
436 1999703
457 1999684
469 1999680
474 1999643
501 1999636
508 1999626
599 1999601
636 1999597
641 1999519
657 1999512
669 1999505
...

output:

4012897019829
4006387348128
4003310331640
4012897019829
4007571411624
4012897019829
4012897019829
4013532935280
4013532935280
4012897019829
4012897019829
4007571411624
4007774342745
4012897019829
4005941765606
4013532935280
4005212993100
4013532935280
4012897019829
4000965234310
4013532935280
401353...

result:

ok 99999 lines

Test #53:

score: 0
Accepted
time: 2235ms
memory: 37984kb

input:

100000 100000
3082 999997232
17241 999988770
21287 999983397
22453 999980469
26999 999971002
53048 999967543
58812 999961887
71407 999959414
74918 999950522
90203 999943505
99785 999929362
106646 999904057
114474 999903106
116778 999900566
119744 999870595
134181 999847273
140114 999808039
149620 99...

output:

998784411056729601
1002312056479256300
1000813258376503440
1002312056479256300
1002312056479256300
1002312056479256300
1002834788680426296
1000047922256042033
1002312056479256300
1002312056479256300
1002834788680426296
1002777061715905704
1000047922256042033
1002644578556115040
1002644578556115040
1...

result:

ok 99999 lines

Test #54:

score: 0
Accepted
time: 2234ms
memory: 37916kb

input:

100000 100000
10 1999990
11 1999976
59 1999966
84 1999950
87 1999892
109 1999891
128 1999850
141 1999848
186 1999831
236 1999825
246 1999821
254 1999802
272 1999789
285 1999764
319 1999757
326 1999671
334 1999654
363 1999608
366 1999606
382 1999589
422 1999532
481 1999491
487 1999475
493 1999472
521...

output:

4005049448500
4018253411536
4011362642320
4018253411536
4003498802862
4013059882532
4004403154069
4005938324201
4005049448500
4007205774657
4009090733445
4005049448500
4018253411536
4007395351168
4005049448500
3995559195768
4005049448500
4001055367958
4005049448500
4004411297340
4005049448500
401825...

result:

ok 99999 lines

Test #55:

score: 0
Accepted
time: 2155ms
memory: 37956kb

input:

100000 100000
10437 999995374
22392 999991665
25777 999962694
33329 999941432
42929 999928254
56167 999924028
59300 999901598
60214 999840742
61577 999827846
90352 999823787
97993 999823563
105186 999819350
106270 999819255
131840 999812201
132550 999799755
133187 999773901
134220 999757870
148966 9...

output:

998141986473126540
1002280636462099418
1002280636462099418
1002280636462099418
997044797765599128
1002022299674458348
1002022299674458348
1002280636462099418
1002280636462099418
1002280636462099418
1002280636462099418
1002280636462099418
1002280636462099418
1002280636462099418
1002280636462099418
10...

result:

ok 99999 lines

Test #56:

score: 0
Accepted
time: 1882ms
memory: 38096kb

input:

100000 100000
1 1599985
14 1599969
27 1599953
40 1599937
53 1599921
66 1599905
79 1599889
92 1599873
105 1599857
118 1599841
131 1599825
144 1599809
157 1599793
170 1599777
183 1599761
196 1599745
209 1599729
222 1599713
235 1599697
248 1599681
261 1599665
274 1599649
287 1599633
300 1599617
313 159...

output:

2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
207996...

result:

ok 100000 lines

Test #57:

score: 0
Accepted
time: 1850ms
memory: 38136kb

input:

100000 100000
1 3199969
14 3199937
27 3199905
40 3199873
53 3199841
66 3199809
79 3199777
92 3199745
105 3199713
118 3199681
131 3199649
144 3199617
157 3199585
170 3199553
183 3199521
196 3199489
209 3199457
222 3199425
235 3199393
248 3199361
261 3199329
274 3199297
287 3199265
300 3199233
313 319...

output:

4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
415992...

result:

ok 100000 lines

Test #58:

score: 0
Accepted
time: 1999ms
memory: 37936kb

input:

100000 100000
1 3199969
27 3199937
53 3199905
79 3199873
105 3199841
131 3199809
157 3199777
183 3199745
209 3199713
235 3199681
261 3199649
287 3199617
313 3199585
339 3199553
365 3199521
391 3199489
417 3199457
443 3199425
469 3199393
495 3199361
521 3199329
547 3199297
573 3199265
599 3199233
625...

output:

8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
831984...

result:

ok 100000 lines

Test #59:

score: 0
Accepted
time: 2004ms
memory: 38004kb

input:

100000 100000
1 715092850
9272 715085699
18543 715078548
27814 715071397
37085 715064246
46356 715057095
55627 715049944
64898 715042793
74169 715035642
83440 715028491
92711 715021340
101982 715014189
111253 715007038
120524 714999887
129795 714992736
139066 714985585
148337 714978434
157608 714971...

output:

662955953966464081
662955953966464081
662955953966464081
662955953966464081
662955953966464081
662955955608647664
662955955608647664
662955955608647664
662955955608647664
662955953966464081
662955955608647664
662955955608647664
662955953966464081
662955953966464081
662955955608647664
662955955608647...

result:

ok 100000 lines

Test #60:

score: 0
Accepted
time: 1973ms
memory: 38140kb

input:

100000 100000
1 211297888
1173 211295775
2345 211293662
3517 211291549
4689 211289436
5861 211287323
7033 211285210
8205 211283097
9377 211280984
10549 211278871
11721 211276758
12893 211274645
14065 211272532
15237 211270419
16409 211268306
17581 211266193
18753 211264080
19925 211261967
21097 2112...

output:

24763865700766590
24763865372269870
24763865372269870
24763865700766590
24763865372269870
24763865372269870
24763865700766590
24763865700766590
24763865700766590
24763865700766590
24763865372269870
24763865372269870
24763865372269870
24763865372269870
24763865372269870
24763865372269870
247638653722...

result:

ok 100000 lines

Test #61:

score: 0
Accepted
time: 2180ms
memory: 38088kb

input:

100000 100000
9101 410508609
12444 410503952
14708 410501333
23815 410495283
31966 410492662
33809 410487701
39620 410484687
47262 410482212
48807 410473605
54936 410465123
64335 410458798
71431 410456582
79242 410448919
84291 410441792
89905 410437918
97403 410429611
100484 410419880
102182 4104166...

output:

171614682779638629
165001801893608298
165792155122292985
171162071882531446
170915943402020740
165001801893608298
165455199578549160
171614682779638629
171614682779638629
171614682779638629
169694727412496916
171614682779638629
163502727776033967
165713659712341765
170521333115860440
164315459161179...

result:

ok 100000 lines

Test #62:

score: 0
Accepted
time: 2144ms
memory: 37936kb

input:

100000 100000
1179 403868768
2121 403861247
8416 403851845
13120 403843212
16941 403842981
17956 403838607
21697 403832716
26855 403827263
33729 403819447
37998 403810496
38612 403806361
40275 403802664
42672 403796825
45327 403796754
46029 403792435
50990 403785046
51048 403775870
55051 403769967
5...

output:

122597128639185508
122597128639185508
139785367512920096
125434687907823564
136383898876992360
123657103257503349
123487393481542496
147732193760272433
141817575125298642
141817575125298642
122597128639185508
141817575125298642
121468455962306886
156078388086892080
123142186577202224
129347424832750...

result:

ok 100000 lines

Test #63:

score: 0
Accepted
time: 2073ms
memory: 37884kb

input:

100000 100000
317 369909977
429 369909160
846 369907352
1145 369904071
1364 369903991
1572 369901131
1977 369900666
2403 369897648
2757 369896884
3149 369895385
3540 369894260
4010 369891257
4127 369888641
4165 369886788
4598 369884140
4759 369881167
5144 369878813
5314 369876411
5681 369874656
6130...

output:

69136009232373936
63467962975099215
69161655616087590
69183612617987456
68862580549709325
67515087233213895
65035555686719568
64868897737213440
64911476855648117
66750986191780740
69183612617987456
65035555686719568
65035555686719568
68869341715065955
67532828230993226
65035555686719568
619016154389...

result:

ok 100000 lines

Test #64:

score: 0
Accepted
time: 2107ms
memory: 38136kb

input:

100000 100000
803 13953708
1520 13953405
2085 13953121
2377 13953090
2444 13952841
3028 13952801
3981 13952497
4113 13952345
4171 13952316
4419 13952239
5008 13951963
5267 13951853
6164 13951632
6816 13951504
7083 13951355
7727 13951101
8193 13951025
8742 13950991
9291 13950699
9667 13950430
9714 13...

output:

337882653291160
374421115534744
317601827719769
374421115534744
286768359462231
374421115534744
374421115534744
374421115534744
322683855081910
374421115534744
337882653291160
294061771691192
324207651985506
306321311078848
374421115534744
337882653291160
337882653291160
207171245400435
283942706188...

result:

ok 100000 lines

Subtask #4:

score: 35
Accepted

Test #65:

score: 35
Accepted
time: 907ms
memory: 36404kb

input:

200 100000
2904660 993940483
16886371 993289642
17317405 990982034
18403947 976774733
18849359 973351068
19183185 970254940
19306003 966229683
21192298 964806508
23734314 964320708
23888967 955733824
27113148 951453312
37031360 944529530
39266197 937051115
40090929 928931574
59651306 922916360
69712...

output:

1016308928382908236
998776313884663776
1004320593689684616
933903565326321240
978390546778315197
1039650121469876757
987990669763090785
1042865155786780773
1051441808434023804
971637196420999780
1065416677472286269
1012697889755804003
905550355710151258
1060082943529963956
1013827359119034944
104933...

result:

ok 100000 lines

Test #66:

score: 0
Accepted
time: 973ms
memory: 36480kb

input:

100000 200
1940 999994594
10389 999989035
28503 999981667
30870 999980471
42230 999972276
52125 999971275
53379 999956174
55518 999955459
64639 999955412
65268 999904054
67682 999885452
77130 999857307
93130 999831628
108438 999823346
126919 999823214
134181 999822103
143172 999812542
147613 9998090...

output:

996157338533370640
969910467114454830
919033115031420852
1007516186713478702
962916440953422100
962471973287936504
972319486384869810
934783008648683200
951496772109547560
706137145445760420
1007389400623713408
922982135677214509
949242387888579640
994933150384658286
956985211239863942
8954485248407...

result:

ok 100000 lines

Test #67:

score: 0
Accepted
time: 1551ms
memory: 32408kb

input:

83655 67941
7 1999962
11 1999959
52 1999912
114 1999905
141 1999893
148 1999886
166 1999882
190 1999863
255 1999839
285 1999833
334 1999812
355 1999799
364 1999781
380 1999767
383 1999754
386 1999730
408 1999605
412 1999562
422 1999560
440 1999542
450 1999503
459 1999492
475 1999455
480 1999427
501 ...

output:

3999222907200
4001983880076
3990553194405
3984364771144
3993622565344
3979750168368
3970350645352
3977481088735
4000283761242
4003533367722
3964048832904
3983619288906
3968751744960
3989628017544
3993891796440
3999919280896
3977177641920
3975851409101
3970293405862
3999692385936
3970269025863
398116...

result:

ok 100000 lines

Test #68:

score: 0
Accepted
time: 1983ms
memory: 37728kb

input:

83655 100000
2744 999958137
5472 999951851
26111 999947393
38192 999946937
58183 999894788
68110 999893744
79945 999882940
83120 999879883
90133 999874493
96315 999861970
118429 999861459
121710 999860574
123096 999860348
128209 999857742
142703 999856987
149105 999852071
170573 999833691
191854 999...

output:

983924467131171374
1000094487222197304
962556865281586408
998619076099805400
974602612077840540
999508325895969694
984190464018162586
546226782131837140
966044532732941088
996631173521174944
1000485293063806440
1000429350728955099
976028077060336554
963738447278590916
998457316618862640
641775578224...

result:

ok 100000 lines

Test #69:

score: 0
Accepted
time: 1710ms
memory: 34804kb

input:

91626 67941
17 1999958
68 1999937
112 1999919
116 1999913
131 1999906
148 1999871
184 1999840
190 1999832
236 1999816
242 1999795
262 1999758
294 1999755
318 1999753
349 1999746
364 1999714
420 1999698
492 1999697
493 1999678
579 1999565
582 1999529
603 1999513
611 1999490
620 1999416
640 1999407
66...

output:

4011919825620
4001294172906
3964878372962
4017434856827
4008507902740
4008312506900
4001256029952
4001894004672
4009195628158
4021016366089
4000770309822
4011465875937
4021945456923
4000697833850
4017353967220
4019056127198
4007233081082
3925623205440
4006707591072
3997721673061
4005828702960
400325...

result:

ok 100000 lines

Test #70:

score: 0
Accepted
time: 2094ms
memory: 38160kb

input:

100000 98765
17 1999942
40 1999911
50 1999868
57 1999849
116 1999847
132 1999843
133 1999811
145 1999777
216 1999773
228 1999765
231 1999754
344 1999736
384 1999728
395 1999715
443 1999713
446 1999710
525 1999706
526 1999684
559 1999662
573 1999651
610 1999641
613 1999616
615 1999614
618 1999613
645...

output:

4001728269760
3004157173204
3999871214640
3996456603782
1645288748784
4007523592317
3892631840586
3350605144002
3942260877940
4002077716268
4002239149902
3721895839536
3994066622592
2259164158392
3908362692048
4008552682820
2164282382796
4004692146375
4004336956025
3971477175429
4002058531104
402046...

result:

ok 100000 lines

Test #71:

score: 0
Accepted
time: 2115ms
memory: 37932kb

input:

100000 100000
4162 999990442
10078 999953844
35182 999949615
36566 999921246
39144 999905128
41451 999894903
62296 999886097
66032 999876871
71400 999852131
72429 999836760
72607 999823527
73724 999818025
83996 999795621
96017 999775325
103111 999768841
111921 999764163
116304 999763402
119468 99975...

output:

945709894092043080
919435268123238809
998446187867165815
1001947154674498626
1000177067408407812
1002326745726847246
903614354345641050
936434101846321770
999894397668913922
926088059227658012
749603264343542400
995900139199788292
1002901875888448800
999400791146328225
999539890246704412
88173530970...

result:

ok 100000 lines

Test #72:

score: 0
Accepted
time: 2137ms
memory: 37972kb

input:

100000 100000
3 2000000
23 1999986
59 1999937
70 1999908
75 1999904
117 1999838
124 1999826
130 1999811
141 1999787
147 1999746
188 1999735
193 1999731
197 1999724
232 1999690
258 1999667
272 1999658
278 1999648
283 1999639
286 1999611
300 1999578
304 1999556
349 1999535
356 1999525
380 1999520
381 ...

output:

3943543720635
3982077966375
3981345522315
3997980258968
4010814112464
4000937430880
3994782297417
3980769105375
3999328369326
4000122509700
3974210352936
3567937385466
3996055495160
4003016470760
3994109612328
4011047218176
3988095683915
3996114235406
3987640308000
4008705284285
3969876302582
332324...

result:

ok 100000 lines

Test #73:

score: 0
Accepted
time: 1835ms
memory: 38060kb

input:

100000 100000
1 1499986
15 1499971
29 1499956
43 1499941
57 1499926
71 1499911
85 1499896
99 1499881
113 1499866
127 1499851
141 1499836
155 1499821
169 1499806
183 1499791
197 1499776
211 1499761
225 1499746
239 1499731
253 1499716
267 1499701
281 1499686
295 1499671
309 1499656
323 1499641
337 149...

output:

2099963800156
2099963800156
2099963800156
2099963800156
2099963800156
2099963800156
2099963800156
2099963800156
2099963800156
2099963800156
2099963800156
2099963800156
2099963800156
2099963800156
2099963800156
943031491644
2099963800156
2099963800156
2099963800156
1123231907548
2099963800156
2099963...

result:

ok 100000 lines

Test #74:

score: 0
Accepted
time: 1836ms
memory: 38064kb

input:

100000 100000
1 1499986
30 1499971
59 1499956
88 1499941
117 1499926
146 1499911
175 1499896
204 1499881
233 1499866
262 1499851
291 1499836
320 1499821
349 1499806
378 1499791
407 1499776
436 1499761
465 1499746
494 1499731
523 1499716
552 1499701
581 1499686
610 1499671
639 1499656
668 1499641
697...

output:

4332187443696
3928616190128
4216520778047
3776127471248
3794432053056
4091895261416
3813967895744
3449285152667
4085926907696
4348160801375
4235012651520
4104720549787
3977243808411
4349921800351
4268193579832
4249260223775
4120127492543
4349921800351
4324716580575
4349921800351
4167541413119
434992...

result:

ok 100000 lines

Test #75:

score: 0
Accepted
time: 1920ms
memory: 38092kb

input:

100000 100000
1 4299958
43 4299915
85 4299872
127 4299829
169 4299786
211 4299743
253 4299700
295 4299657
337 4299614
379 4299571
421 4299528
463 4299485
505 4299442
547 4299399
589 4299356
631 4299313
673 4299270
715 4299227
757 4299184
799 4299141
841 4299098
883 4299055
925 4299012
967 4298969
10...

output:

18059655801640
18059655801640
14997798475240
18058097147736
18059655801640
18059655801640
18059655801640
18059655801640
18059655801640
18059655801640
18059655801640
18059655801640
18059655801640
18059655801640
18059655801640
18059655801640
18059655801640
18059655801640
18059655801640
18059655801640
...

result:

ok 100000 lines

Test #76:

score: 0
Accepted
time: 1810ms
memory: 38136kb

input:

100000 100000
1 543194569
1235 543189137
2469 543183705
3703 543178273
4937 543172841
6171 543167409
7405 543161977
8639 543156545
9873 543151113
11107 543145681
12341 543140249
13575 543134817
14809 543129385
16043 543123953
17277 543118521
18511 543113089
19745 543107657
20979 543102225
22213 5430...

output:

31694305396352980
67029540722289760
46892552540197720
49750347821772880
66543303556174060
67029540722289760
67029540722289760
60089004921320056
67029540722289760
55456756156916068
49618047822614568
66993368634621900
65598556763944468
67029540722289760
63195220758501396
67029540722289760
668796366489...

result:

ok 100000 lines

Test #77:

score: 0
Accepted
time: 1842ms
memory: 38144kb

input:

100000 100000
1 123398767
5433 123397533
10865 123396299
16297 123395065
21729 123393831
27161 123392597
32593 123391363
38025 123390129
43457 123388895
48889 123387661
54321 123386427
59753 123385193
65185 123383959
70617 123382725
76049 123381491
81481 123380257
86913 123379023
92345 123377789
977...

output:

67029540722289760
57170643925662076
59247917640565056
62696459143551460
65436324827581660
66794065688858716
67029540722289760
57067030921105216
66413456009660236
52813103814888556
65837940327604396
57476715606400068
62392023755115580
67029540722289760
67029540722289760
67029540722289760
670295407222...

result:

ok 100000 lines

Test #78:

score: 0
Accepted
time: 2000ms
memory: 38004kb

input:

100000 100000
2011 439611441
9819 439602235
12251 439597274
14412 439594648
22454 439589669
27321 439586063
36882 439576574
41078 439571160
48382 439563367
54747 439557385
62466 439555018
68177 439545707
74920 439543759
76675 439538403
77355 439529163
81603 439519750
86515 439510104
87490 439509606
...

output:

184495651787973988
181923629414795060
174191819705369520
156559517280177440
188163564167420644
208821606541187600
208574976963218814
186924179541744366
182722169646833756
186778086203271124
202318663166065395
208811819127046119
179967603904841865
164425677085464220
189205284988814347
131016833293158...

result:

ok 100000 lines

Test #79:

score: 0
Accepted
time: 1966ms
memory: 37932kb

input:

100000 100000
1662 307365647
6858 307363904
12229 307362357
18693 307358535
19263 307353644
26363 307349898
28864 307343564
38858 307341119
43334 307340389
47884 307337268
57019 307334878
60444 307331401
70215 307328031
73360 307320414
81715 307314209
87273 307307290
92252 307303024
94195 307297517
...

output:

99008644183118800
93659573411886419
95056264538369225
97058244783565110
63491657537138223
97172672594929546
104705689314887375
82253041043727008
104842856410367820
63574123954375732
98689757613368769
91225920823333524
98436284154367131
80872246618988544
89959457952269725
101238902174218368
998486969...

result:

ok 100000 lines

Test #80:

score: 0
Accepted
time: 1939ms
memory: 38060kb

input:

100000 100000
5287 162137536
6725 162135907
9983 162133314
18267 162133268
26084 162130692
33269 162129105
36867 162126180
43454 162125830
45833 162125320
48324 162124911
57558 162124298
57746 162122753
67096 162119868
68667 162119132
75820 162117933
78531 162117228
82394 162114547
84733 162111893
8...

output:

110684473714716132
86989046243985093
73863963014354520
115887519803433734
60341204407168320
107684609098476886
106022266068565728
110028525616500904
50094793291128201
41375610080618850
62136938682377802
118420997665582722
68542758602020299
90180058985637768
80752950656281728
70950332567807472
416454...

result:

ok 100000 lines

Test #81:

score: 0
Accepted
time: 1952ms
memory: 37936kb

input:

100000 100000
205 7833516
677 7833225
970 7833222
1497 7832812
1540 7832400
1767 7832185
2215 7831940
2366 7831722
2458 7831608
2738 7831135
2838 7830972
3100 7830781
3294 7830615
3537 7830523
3958 7830013
4442 7829640
4973 7829549
5227 7829158
5753 7829089
6141 7828931
6511 7828758
6914 7828704
703...

output:

42951073529650
106288606017620
163258603593432
164961511164726
164495932098531
131262741249926
121257283855860
148303142782340
114574440538392
181578771085038
168958722274359
145186185721600
103243832760677
90272441086675
138806259562475
162527994392120
120633708038328
162737535948624
13811321690714...

result:

ok 100000 lines

Subtask #5:

score: 40
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #82:

score: 40
Accepted
time: 1246ms
memory: 36480kb

input:

200 100000
39849 994550065
1087323 992164680
3913489 982522112
11139341 974604107
11901357 959675555
21398410 953741203
27108637 952590602
33075671 951102421
40081340 949901947
40108403 940974975
50081215 925154113
58510471 922011972
66038241 919111614
71939358 903331803
80158434 901694775
82240463 ...

output:

1008455870592688815
968883114274198560
823936334410432650
797299479618249456
990213240193446576
990652725461574120
985656024516173088
966505433225484929
968883114274198560
925005198233012544
942567924807919353
990518710493791388
968375210636701815
968883114274198560
987057752824373937
93530071637057...

result:

ok 100000 lines

Test #83:

score: 0
Accepted
time: 1231ms
memory: 36376kb

input:

100000 200
7 1999964
21 1999962
22 1999947
32 1999940
39 1999919
76 1999917
82 1999850
92 1999807
102 1999803
108 1999799
120 1999798
133 1999775
138 1999771
149 1999768
166 1999752
185 1999747
190 1999728
211 1999714
247 1999704
252 1999686
273 1999684
299 1999624
336 1999618
428 1999554
476 199953...

output:

4002768324366
3916194374741
2260845822521
4025811718782
2969693352560
4246184268394
3892114045547
4253191565406
4253191565406
3474561097232
4253191565406
3795785237830
4151271349335
4201530447569
4226026998588
4161979934020
4158336922560
4123382632260
4253191565406
4253191565406
4253191565406
425319...

result:

ok 100000 lines

Test #84:

score: 0
Accepted
time: 2421ms
memory: 37300kb

input:

49999 99999
69 1999965
82 1999941
113 1999929
199 1999870
233 1999824
418 1999782
494 1999771
546 1999763
570 1999740
588 1999696
596 1999685
634 1999681
667 1999667
683 1999658
698 1999551
720 1999442
745 1999387
813 1999355
887 1999297
888 1999285
900 1999267
955 1999226
966 1999215
1004 1999206
1...

output:

4023066214158
4023066214158
4023066214158
4023066214158
4023066214158
4023066214158
4023066214158
4005658201410
4023066214158
4023066214158
4023066214158
4023066214158
4023066214158
4023066214158
4023066214158
4023066214158
4023066214158
4023066214158
4012356422340
4023066214158
4023066214158
402306...

result:

ok 100000 lines

Test #85:

score: 0
Accepted
time: 2506ms
memory: 37348kb

input:

49999 100000
5773 999956029
11106 999873601
19556 999862051
21245 999853213
25746 999825330
34368 999815948
40208 999782418
41935 999739161
47563 999722709
67505 999719771
68909 999719510
89614 999675226
89885 999664998
121747 999654066
141309 999616446
157625 999613825
165445 999585873
192426 99958...

output:

1007861602300349160
996146451144941681
1002986338014530408
1007861602300349160
882965574420079556
1007861602300349160
1007861602300349160
952143685305838837
1007397841810430639
879405286616718966
1007861602300349160
1005854923431881900
873807695266197429
1006929058436251456
1001981633754929050
10026...

result:

ok 100000 lines

Test #86:

score: 0
Accepted
time: 2711ms
memory: 35880kb

input:

93762 86263
35 1999977
56 1999969
69 1999968
78 1999956
94 1999929
100 1999923
131 1999908
142 1999901
158 1999885
173 1999874
184 1999850
224 1999842
255 1999837
268 1999817
301 1999810
310 1999802
315 1999800
430 1999799
432 1999762
447 1999753
456 1999716
480 1999712
504 1999671
555 1999657
556 1...

output:

4011711374090
4010140007100
3314555615470
4011711374090
4011711374090
4011711374090
4011711374090
4011711374090
4011711374090
4011711374090
4011711374090
4011711374090
4011711374090
4011711374090
4011711374090
4011711374090
4011711374090
4011711374090
4011711374090
4011711374090
4011711374090
401171...

result:

ok 100000 lines

Test #87:

score: 0
Accepted
time: 3082ms
memory: 37740kb

input:

93762 99999
29429 999994322
41901 999977429
48208 999959785
65449 999949885
87629 999929549
101970 999917887
105832 999916996
108061 999912915
129655 999889578
142064 999883690
143883 999871237
146444 999860569
172104 999848786
180449 999839611
181401 999832670
191116 999821551
197231 999819838
2004...

output:

970436922318741405
1006412019471880638
1005774117882926001
997428301233386976
1001092785939148320
940179203448724344
1003849405349837795
1006049437379565045
917770197437000624
975503519622567378
1003089856214448951
999884849740811964
1006412019471880638
1006049437379565045
987622623516077160
9801265...

result:

ok 100000 lines

Test #88:

score: 0
Accepted
time: 3031ms
memory: 38148kb

input:

100000 99999
2 1999930
29 1999914
85 1999912
97 1999900
106 1999867
146 1999831
179 1999815
201 1999726
206 1999712
210 1999682
235 1999646
252 1999548
256 1999504
266 1999482
272 1999443
309 1999438
314 1999432
326 1999398
353 1999385
361 1999381
479 1999353
487 1999341
517 1999309
556 1999308
561 ...

output:

4030918335873
4030918335873
4030918335873
4030918335873
4009742169237
4004230357161
4030918335873
4030918335873
3487823738259
4030918335873
4030918335873
4030918335873
4030918335873
4030918335873
4030918335873
4030918335873
4030918335873
4030918335873
4030918335873
4030918335873
4030918335873
403091...

result:

ok 100000 lines

Test #89:

score: 0
Accepted
time: 3186ms
memory: 38060kb

input:

100000 100000
7156 999998503
10616 999992610
15693 999982422
32403 999970454
45395 999961873
49369 999956720
57425 999948257
58591 999946397
63613 999943270
76131 999929157
77285 999926958
77743 999921813
85271 999876744
92524 999870252
105061 999865755
105124 999861118
118722 999860997
119470 99985...

output:

1003483152008738730
1002728857674928756
989249704156365696
1001988620841150150
693928697293338573
1001484661301841927
1000800993364509792
1004156484194204308
1004156484194204308
1003321021171556668
898709187535685000
908020664960145516
999789609835646034
990860973168511447
950737404621684617
9701869...

result:

ok 100000 lines

Test #90:

score: 0
Accepted
time: 2988ms
memory: 38000kb

input:

100000 100000
6830 999995838
13269 999989771
43503 999970297
53194 999960858
78977 999957864
89604 999951559
91056 999926903
93090 999905427
94883 999896373
95046 999861324
110715 999858383
125514 999854694
131819 999852284
150569 999820632
153296 999807888
161777 999790712
163693 999780194
167984 9...

output:

1000949768405857536
943293977779512628
1003772160397359120
1003772160397359120
994938719705910210
1003772160397359120
1003772160397359120
1003772160397359120
1003772160397359120
1003772160397359120
1003772160397359120
1000822355557759276
1003772160397359120
1003772160397359120
1003772160397359120
10...

result:

ok 100000 lines

Test #91:

score: 0
Accepted
time: 2667ms
memory: 37896kb

input:

100000 100000
1 11099890
152 11099779
303 11099668
454 11099557
605 11099446
756 11099335
907 11099224
1058 11099113
1209 11099002
1360 11098891
1511 11098780
1662 11098669
1813 11098558
1964 11098447
2115 11098336
2266 11098225
2417 11098114
2568 11098003
2719 11097892
2870 11097781
3021 11097670
3...

output:

137016466539560
167514373585232
167606700216241
162121089829680
167291432683272
167606700216241
167606700216241
167606700216241
167606700216241
167606700216241
167606700216241
167606700216241
167606700216241
161930863851757
167606700216241
166979541841552
167606700216241
167606700216241
167606700216...

result:

ok 100000 lines

Test #92:

score: 0
Accepted
time: 2668ms
memory: 38004kb

input:

100000 100000
1 3299968
152 3299935
303 3299902
454 3299869
605 3299836
756 3299803
907 3299770
1058 3299737
1209 3299704
1360 3299671
1511 3299638
1662 3299605
1813 3299572
1964 3299539
2115 3299506
2266 3299473
2417 3299440
2568 3299407
2719 3299374
2870 3299341
3021 3299308
3172 3299275
3323 3299...

output:

49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
49829040204619
...

result:

ok 100000 lines

Test #93:

score: 0
Accepted
time: 2658ms
memory: 38108kb

input:

100000 100000
1 23299768
304 23299535
607 23299302
910 23299069
1213 23298836
1516 23298603
1819 23298370
2122 23298137
2425 23297904
2728 23297671
3031 23297438
3334 23297205
3637 23296972
3940 23296739
4243 23296506
4546 23296273
4849 23296040
5152 23295807
5455 23295574
5758 23295341
6061 2329510...

output:

705975987469531
705975987469531
705975987469531
633736816856955
705975987469531
705975987469531
705975987469531
680717270513656
705975987469531
705975987469531
705975987469531
705975987469531
705975987469531
705975987469531
705975987469531
705975987469531
705975987469531
705975987469531
588661373942...

result:

ok 100000 lines

Test #94:

score: 0
Accepted
time: 2654ms
memory: 37972kb

input:

100000 100000
1 3299968
304 3299935
607 3299902
910 3299869
1213 3299836
1516 3299803
1819 3299770
2122 3299737
2425 3299704
2728 3299671
3031 3299638
3334 3299605
3637 3299572
3940 3299539
4243 3299506
4546 3299473
4849 3299440
5152 3299407
5455 3299374
5758 3299341
6061 3299308
6364 3299275
6667 3...

output:

99988067409331
99988067409331
99988067409331
99988067409331
99988067409331
99988067409331
99988067409331
99988067409331
99988067409331
99988067409331
99988067409331
99988067409331
99988067409331
99988067409331
79408454185840
99988067409331
99988067409331
99988067409331
99988067409331
99988067409331
...

result:

ok 100000 lines

Test #95:

score: 0
Accepted
time: 2719ms
memory: 37980kb

input:

100000 100000
1 111098890
1112 111097779
2223 111096668
3334 111095557
4445 111094446
5556 111093335
6667 111092224
7778 111091113
8889 111090002
10000 111088891
11111 111087780
12222 111086669
13333 111085558
14444 111084447
15555 111083336
16666 111082225
17777 111081114
18888 111080003
19999 1110...

output:

12342963803627664
12342963803627664
12342963581429881
12342963581429881
12342963581429881
12342963581429881
9945273467936085
12342963581429881
4047639634618320
12342963581429881
12342963581429881
12342963581429881
12342963581429881
12342963581429881
12342963803627664
6705249455137512
123429638036276...

result:

ok 100000 lines

Test #96:

score: 0
Accepted
time: 2662ms
memory: 37888kb

input:

100000 100000
1 243097570
2714 243095139
5427 243092708
8140 243090277
10853 243087846
13566 243085415
16279 243082984
18992 243080553
21705 243078122
24418 243075691
27131 243073260
29844 243070829
32557 243068398
35270 243065967
37983 243063536
40696 243061105
43409 243058674
46122 243056243
48835...

output:

63229835549502504
65951711974785019
65951711974785019
65951712489179880
65951711974785019
65951711974785019
32894633930292184
60064906902876027
63534581322768795
53999110006497552
55754961967701339
59408769008179984
45582319942970055
57474334351815579
63411075086564304
65951711974785019
659517119747...

result:

ok 100000 lines

Test #97:

score: 0
Accepted
time: 2991ms
memory: 38088kb

input:

100000 100000
2634 401473069
4919 401469777
6346 401462609
9697 401458798
12294 401452044
13897 401451491
15549 401445251
17352 401435877
17741 401432315
18539 401425693
19840 401416485
20199 401415964
24743 401407009
29100 401398763
30720 401389499
31093 401387393
31365 401379708
35958 401374263
39...

output:

172270021049748140
188665166287628733
176020218998172996
181861957563236664
172245652966205179
193206914897180880
164852001048145850
159692063672310250
109514425770337185
173529206433813002
193206914897180880
129259488067205778
187066230082257922
149359804181872862
172270021049748140
138814649852683...

result:

ok 100000 lines

Test #98:

score: 0
Accepted
time: 2837ms
memory: 37904kb

input:

100000 100000
8348 346970417
16092 346970376
24072 346970290
27718 346970242
34092 346970211
40266 346970157
46606 346970148
53529 346970072
61738 346970049
70517 346970008
72886 346969930
78844 346969856
80141 346969777
87894 346969718
95410 346969669
101032 346969591
104551 346969539
113142 346969...

output:

93734078949574338
169194495213855591
161557442608671412
169194495213855591
169194495213855591
161116546345050825
169194495213855591
169194495213855591
169194495213855591
169194495213855591
169194495213855591
169194495213855591
169194495213855591
169194495213855591
169194495213855591
1691944952138555...

result:

ok 100000 lines

Test #99:

score: 0
Accepted
time: 2881ms
memory: 38132kb

input:

100000 100000
3377 193922068
6890 193921483
11545 193919942
15744 193919507
21040 193917755
25710 193917333
26035 193917125
33871 193916261
37233 193915561
44762 193915426
51529 193913771
52980 193912885
57203 193911360
62282 193909416
70039 193908485
75055 193908421
77010 193907680
81071 193907169
...

output:

49366590189165453
50164902639784873
45389856023536896
42500705198752836
50164902639784873
37005820163874393
38334744530940264
44323834971686535
45215956518750341
41573916332366880
50141468428007640
50164902639784873
45940339806119510
40691088885453104
49830434197483390
50164902639784873
461571030153...

result:

ok 100000 lines

Test #100:

score: 0
Accepted
time: 2865ms
memory: 38044kb

input:

100000 100000
438 20299981
846 20299960
1092 20299650
1485 20299500
1711 20299242
2156 20298929
2403 20298729
2462 20298397
2706 20298312
2961 20298043
3176 20297750
3659 20297518
3683 20297404
3939 20297216
3994 20296922
4110 20296748
4354 20296549
4677 20296304
5072 20296164
5410 20295831
5548 202...

output:

491368132712533
448629546797888
572943628864496
540715906237280
463936235539172
198656588339325
437753255663936
417649489436104
400788123896832
474426457589300
543017749516900
382796147959992
441938742361920
513950348176650
381830146703171
574962228892576
574565035955360
266011673231715
532478711446...

result:

ok 100000 lines