QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#687735#6469. Harry Potter and The Vector SpellLaVuna47#AC ✓16ms4788kbC++201.9kb2024-10-29 20:55:212024-10-29 20:55:22

Judging History

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

  • [2024-10-29 20:55:22]
  • 评测
  • 测评结果:AC
  • 用时:16ms
  • 内存:4788kb
  • [2024-10-29 20:55:21]
  • 提交

answer

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

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define x first
#define y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)

typedef long long ll;
typedef double db;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<db, db> pdd;

#ifdef ONPC
mt19937 rnd(228);
#endif


struct DSU
{
	vector<int> p;
	vector<int> S;

	DSU(int n)
	{
		p = vector<int>(n);
		iota(all(p),0);
		S = vector<int>(n, 1);
	}
	
	int find(int v)
	{
		if(v==p[v])
			return v;
		return p[v] = find(p[v]);
	}
	int get_sz(int v)
	{
		v = find(v);
		return S[v];
	}
	void unite(int a, int b)
	{
		a = find(a);
		b = find(b);
		if(a != b)
		{
			S[b] += S[a];
			p[a] = b;
			S[a] = 0;
		}
	}
};

int solve()
{
	int m, n;
	if (!(cin >> m >> n))
		return 1;
	
	vector<pii> ps(n, {-1, -1});
	// m - len of vector
	FOR(i,0,m)
	{
		int k;
		cin >> k;
		
		FOR(_,0,k)
		{
			int el;
			cin >> el;
			--el;
			if(ps[el].x == -1)
				ps[el].x = i;
			else
				ps[el].y = i;
		}
	}

	auto dsu = DSU(m);
	for(auto [x, y]: ps)
	{
		assert(!(x == -1 || y == -1));
		if(dsu.find(x) != dsu.find(y))
		{
			dsu.unite(x, y);
		}
	}
	vector<bool> vis(m, false);
	int res = 0;
	FOR(i,0,m)
	{
		int a = dsu.find(i);
		if(!vis[a])
		{
			res += dsu.get_sz(a)-1;
			vis[a] = true;
		}
	}
	cout << res << '\n';
	return 0;	
}

int32_t main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int TET = 1e9;
	//cin >> TET;
	for (int i = 1; i <= TET; i++)
	{
		if (solve())
			break;
			
		#ifdef ONPC
			cerr << "_________________________________\n";
		#endif
	}
	#ifdef ONPC
		cerr << "\nfinished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec\n";
	#endif
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 3
2 1 3
2 1 2
2 2 3

output:

2

result:

ok single line: '2'

Test #2:

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

input:

93 92
1 49
3 14 37 65
2 78 16
1 6
1 35
3 52 69 28
2 40 38
5 58 91 80 41 19
1 68
1 13
1 52
2 45 50
1 89
4 29 62 2 15
2 73 85
3 74 88 3
1 21
2 7 12
1 51
1 7
1 24
1 9
2 30 59
2 54 79
2 47 25
2 75 63
2 8 20
1 87
3 72 57 83
3 20 81 5
2 5 77
1 92
2 67 45
2 46 15
2 27 63
5 51 12 42 81 37
3 72 56 84
2 2 68
...

output:

92

result:

ok single line: '92'

Test #3:

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

input:

838 837
1 214
3 386 757 400
3 239 578 785
2 792 833
2 384 610
2 670 507
1 499
3 812 270 704
4 225 392 529 350
2 719 227
3 173 714 352
5 558 110 290 645 746
4 365 333 155 660
2 241 776
4 773 451 687 811
2 491 120
2 783 626
2 358 191
1 127
3 728 259 323
2 559 769
1 833
1 544
1 166
2 318 59
3 151 824 3...

output:

837

result:

ok single line: '837'

Test #4:

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

input:

994 993
19 746 22 109 352 76 609 144 18 697 141 224 547 801 761 687 528 559 829 415
3 753 882 336
1 153
1 36
1 287
1 328
1 467
2 429 237
1 77
1 342
1 307
2 106 279
1 19
1 770
9 623 293 368 571 644 745 394 457 89
5 77 604 350 850 839
1 505
1 102
3 285 97 515
1 877
1 6
1 523
1 777
1 868
7 38 546 936 4...

output:

993

result:

ok single line: '993'

Test #5:

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

input:

268 267
8 96 51 230 246 240 127 140 1
5 224 101 106 231 136
4 159 187 150 51
5 21 98 217 214 84
1 196
2 21 75
1 33
1 54
1 250
1 218
1 108
1 161
3 100 128 97
1 78
4 267 8 49 148
2 266 173
1 179
1 170
1 3
1 20
1 219
1 181
2 86 31
2 137 50
1 27
1 244
1 168
1 166
2 182 20
4 131 162 260 121
4 184 138 96 ...

output:

267

result:

ok single line: '267'

Test #6:

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

input:

626 625
181 507 560 294 589 492 5 537 511 553 75 16 287 392 493 79 515 306 484 563 98 393 377 557 205 504 341 352 231 66 204 81 69 353 40 80 374 252 78 106 21 581 343 412 128 278 27 595 308 437 386 11 261 337 293 358 213 324 387 624 428 229 369 299 607 339 372 483 618 211 303 541 260 24 70 115 620 6...

output:

625

result:

ok single line: '625'

Test #7:

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

input:

2833 2832
332 1623 742 606 1166 240 2106 169 1141 2391 655 1624 949 2113 350 1376 2096 764 733 1737 2067 1629 1942 2807 920 1481 1362 373 434 1397 2223 1107 2157 1235 873 1285 1204 2725 1447 2713 513 147 1434 1086 1311 1480 1931 621 2340 913 1675 2128 975 1366 347 1577 6 2083 993 1863 667 1279 1722 ...

output:

2832

result:

ok single line: '2832'

Test #8:

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

input:

4339 4338
297 2260 3611 618 1116 204 3295 1579 3762 2599 673 400 2182 2192 876 3056 3793 3754 2814 2482 1640 4218 3378 1672 1130 670 2856 4125 3087 1562 1175 3985 983 4292 4190 2830 3778 1648 3979 1443 2586 1635 4236 4290 610 2034 1528 144 3281 2826 45 2221 2805 1468 1964 47 586 373 1475 3824 1619 3...

output:

4338

result:

ok single line: '4338'

Test #9:

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

input:

4998 4997
1 3146
2 3906 4083
2 1860 851
1 1748
2 3394 3741
2 4349 3066
1 2322
1 3934
1 3422
2 2904 1029
2 3362 1470
1 3606
2 689 2655
2 1730 2296
2 1817 495
2 4508 3044
3 526 3974 1218
1 3096
1 2112
1 1029
1 4052
2 1555 139
1 1998
1 1103
1 4122
1 4168
1 3070
1 3744
3 1253 4918 4139
2 4483 2764
1 194...

output:

4997

result:

ok single line: '4997'

Test #10:

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

input:

7970 7969
179 141 6744 6542 6875 4535 1817 2763 6800 7520 4874 404 5565 3172 4914 94 1652 7647 7350 3089 4469 6602 745 3277 2978 3269 7821 2153 2847 274 3261 6097 3017 844 3931 5474 5361 4447 176 6972 331 4517 4215 4652 821 720 4365 7758 12 7922 491 3670 2511 6089 4351 4018 1272 1979 7346 4589 2923 ...

output:

7969

result:

ok single line: '7969'

Test #11:

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

input:

7343 7342
307 941 4678 6425 4180 7239 1228 427 438 4110 63 5513 3830 751 6883 1665 4295 788 2931 1853 3000 6132 1586 1488 1739 4494 2357 2195 3546 6961 1150 3680 120 1606 6005 2014 5871 3547 57 779 3887 1834 389 3309 761 1750 224 3030 4744 5443 741 914 659 3186 6193 2585 6038 1246 2244 3936 5743 725...

output:

7342

result:

ok single line: '7342'

Test #12:

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

input:

4 3
3 1 2 3
1 1
1 2
1 3

output:

3

result:

ok single line: '3'

Test #13:

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

input:

9587 9586
1 7699
2 5815 7162
2 424 972
1 8886
1 7334
2 3144 7255
2 4620 123
1 8306
1 1444
2 7927 7198
2 5947 8798
1 5066
1 262
2 8578 7711
2 3671 4551
2 5582 8307
2 7054 611
2 1593 2357
1 460
1 4314
2 5894 7828
3 4295 6058 9167
3 2928 8220 3228
2 4226 389
1 1354
2 2965 7006
1 5556
1 1852
2 5204 6217...

output:

9586

result:

ok single line: '9586'

Test #14:

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

input:

7510 7509
1 6247
3 5730 6203 1137
3 656 4782 3874
1 1256
1 7476
3 1332 232 1480
1 7348
1 788
1 5013
1 762
1 7128
2 6143 1712
1 5928
2 6859 221
2 5107 1330
3 284 5129 2198
2 3183 2503
4 2984 558 1708 6156
1 5872
2 533 5213
2 182 5225
2 5701 741
2 5071 4675
3 7069 1464 1650
2 1592 4382
1 7149
2 5139 4...

output:

7509

result:

ok single line: '7509'

Test #15:

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

input:

42120 42119
1 22335
4 22957 26766 18486 18281
1 25854
1 95
2 16012 34089
1 35588
1 5121
6 28095 5203 15501 27417 40407 41212
1 26486
2 27503 8298
3 29243 15917 2668
2 11198 21899
5 13868 5215 32915 15950 1532
2 11224 17030
1 29364
1 4912
2 1885 23772
2 6772 10543
2 5933 25243
2 24549 27121
2 1400 20...

output:

42119

result:

ok single line: '42119'

Test #16:

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

input:

17899 17898
417 9634 10218 17823 11516 1217 7262 14641 7130 5637 15080 13743 4457 6134 9305 1423 16503 15864 15098 1850 13512 17668 11796 3341 4218 1924 4169 880 11024 14607 4852 7929 6455 3922 15516 8456 12240 12747 10972 10966 5674 1352 2497 12468 17366 6625 11960 15195 17709 13963 3607 415 4578 1...

output:

17898

result:

ok single line: '17898'

Test #17:

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

input:

51035 51034
33 32218 34317 35882 6301 46366 47476 30286 24415 18911 38902 46203 39054 29708 8359 17963 9400 26209 40542 21457 9298 21860 15839 5637 25043 48607 42605 9579 49853 4470 36438 35506 34257 41985
2 48781 48780
3 29738 35968 35593
2 8439 3148
1 39380
2 30706 6641
1 12810
1 16167
1 43904
1 3...

output:

51034

result:

ok single line: '51034'

Test #18:

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

input:

27181 27180
163 6089 1555 12762 12576 24944 23562 14781 17434 21846 9099 18814 5537 12478 11830 19407 409 24817 13648 9728 24151 11448 12711 769 6972 4844 9829 10257 11396 14225 4483 1870 25923 17080 4044 5210 10578 20498 20459 18698 13627 22058 21856 234 17459 17466 23320 24760 24017 18314 22483 16...

output:

27180

result:

ok single line: '27180'

Test #19:

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

input:

45544 45543
1 2416
2 19562 4955
4 8603 6271 15156 40076
2 21733 13938
3 40213 6130 35092
2 38538 17900
3 12411 44567 36242
1 3422
1 19530
4 39302 44412 30975 39419
1 14391
2 44077 29365
2 42839 35935
2 24492 27921
2 31077 22225
1 31878
1 35098
2 41412 33350
2 4601 45342
4 29563 44163 12245 16627
2 1...

output:

45543

result:

ok single line: '45543'

Test #20:

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

input:

50563 50562
417 11644 388 3658 6036 46824 42539 10701 37994 19428 18635 28222 40025 42247 4677 41111 36417 22487 932 39478 9510 2804 30444 37580 28954 47958 20473 8712 25257 27276 15320 42176 38114 23030 27232 42047 2040 14810 17390 37275 2914 14384 44772 49238 15156 42673 15555 46651 42281 24916 25...

output:

50562

result:

ok single line: '50562'

Test #21:

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

input:

94794 94793
680 36480 47350 37214 39404 22280 9080 57158 89690 90289 28491 59303 19184 56413 65216 35696 63076 85422 28452 114 84470 79694 7083 65794 33803 80830 76036 3341 24321 15780 52134 11875 78200 3782 48427 89404 84051 47939 66827 79301 76024 79658 2358 9862 89138 63959 23573 85248 8827 63969...

output:

94793

result:

ok single line: '94793'

Test #22:

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

input:

96047 96046
1 14111
3 24941 35985 84071
2 40759 32722
1 23360
4 49364 88265 93042 76183
2 46931 22643
2 70816 74680
3 51609 90971 87746
1 20950
3 45517 40647 29069
1 79880
4 45835 86650 41883 94896
5 48178 21313 14788 44382 27571
1 1709
2 93257 2793
4 35967 18166 24220 37610
2 75869 81257
2 67464 72...

output:

96046

result:

ok single line: '96046'

Test #23:

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

input:

8 7
1 6
2 1 4
2 7 6
2 3 2
1 5
2 7 1
2 5 2
2 3 4

output:

7

result:

ok single line: '7'

Test #24:

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

input:

82764 82763
1 17011
3 79926 29762 55974
2 67069 79765
2 18101 63553
3 21707 73335 10561
1 66744
2 74350 24814
2 31581 51501
2 62947 66402
1 69879
2 32246 20161
2 56139 40227
2 28750 53758
2 24533 19810
5 17490 1788 63191 13348 43922
3 17951 24093 42911
2 1920 75215
4 31753 48786 55523 5562
2 43438 1...

output:

82763

result:

ok single line: '82763'

Test #25:

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

input:

99892 99891
637 75130 43738 62977 21748 10059 67687 40790 37333 78688 99250 25357 35743 76903 8113 28490 30122 86953 14076 58739 22434 4487 6730 4561 63571 47102 25208 56685 67546 64197 76772 39877 24642 39463 55774 79408 29324 7403 93069 91890 71989 98 72789 86197 28512 32789 28143 20255 83491 6118...

output:

99891

result:

ok single line: '99891'

Test #26:

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

input:

99632 99631
494 60417 36862 62558 64885 12736 74011 79944 68219 84968 69314 62716 63674 27008 72210 43898 37520 65042 72065 30362 58981 88111 73428 77803 71833 33524 34634 43401 50602 47989 96139 47617 58811 69435 85106 30995 66410 7554 64997 82308 48985 45990 3781 7153 7469 26949 58035 23956 57311 ...

output:

99631

result:

ok single line: '99631'

Test #27:

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

input:

99809 99808
1 4279
1 76039
2 81884 81093
1 39571
2 52590 19299
3 83432 19379 83817
1 71043
2 27962 36680
1 53663
1 61885
1 17912
1 68526
1 46122
3 43972 74288 9688
2 94854 34593
2 23027 68226
1 43730
1 25269
2 7860 15170
2 2440 4719
1 90047
1 26885
1 37162
2 62980 4882
4 67801 26903 62858 38101
1 12...

output:

99808

result:

ok single line: '99808'

Test #28:

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

input:

10 3
0
1 1
2 2 3
0
1 3
0
0
1 1
0
1 2

output:

3

result:

ok single line: '3'

Test #29:

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

input:

8 1
0
0
0
1 1
0
1 1
0
0

output:

1

result:

ok single line: '1'

Test #30:

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

input:

52 25
0
1 5
2 18 17
1 6
0
0
2 3 19
0
0
0
1 2
2 2 22
0
0
1 25
1 20
2 14 21
1 3
0
1 7
1 23
1 10
1 9
1 15
1 12
2 8 1
0
2 10 17
1 24
1 12
1 1
2 19 13
0
1 5
0
1 8
1 7
2 16 25
2 23 20
1 13
3 11 24 21
1 14
0
0
1 15
2 18 11
1 9
0
1 16
1 6
1 4
2 22 4

output:

25

result:

ok single line: '25'

Test #31:

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

input:

67 40
15 35 22 15 17 39 6 29 40 8 37 30 1 25 12 36
1 1
0
2 11 22
0
6 21 7 28 39 33 4
1 23
0
1 31
1 26
1 33
1 21
1 2
3 32 25 14
0
1 10
1 6
0
1 3
4 31 17 2 13
1 32
1 20
1 28
1 8
1 40
1 7
0
1 9
1 15
1 38
1 24
1 29
0
0
1 3
0
2 24 26
0
1 30
1 34
1 5
0
5 10 36 27 20 23
1 14
1 37
1 16
0
2 19 27
0
3 18 16 5...

output:

40

result:

ok single line: '40'

Test #32:

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

input:

260 160
41 112 12 147 136 83 146 3 152 63 9 36 14 101 120 4 132 67 93 157 73 76 89 46 64 39 7 97 59 99 115 110 102 149 90 75 41 18 105 74 26 133
5 121 127 43 65 91
0
0
0
1 129
1 30
1 158
1 107
1 39
1 15
2 133 49
1 54
6 23 27 64 103 143 6
0
4 99 69 10 145
0
0
1 32
1 117
0
0
1 98
0
1 73
1 139
0
0
1 61...

output:

160

result:

ok single line: '160'

Test #33:

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

input:

935 728
1 6
1 322
3 627 655 301
2 232 452
2 572 394
2 33 262
1 627
2 392 259
2 708 66
1 56
1 471
2 71 315
4 465 155 42 331
1 368
1 507
1 668
1 195
3 193 580 662
1 343
2 520 106
1 107
1 407
1 612
3 76 599 353
1 493
2 163 525
1 114
1 712
2 317 200
1 260
1 372
3 652 93 142
1 209
1 524
2 386 7
1 584
1 3...

output:

728

result:

ok single line: '728'

Test #34:

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

input:

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

output:

5

result:

ok single line: '5'

Test #35:

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

input:

8988 6138
9 2826 2123 2372 4597 4086 5528 3013 40 3482
0
0
2 4961 5422
3 1028 4841 5721
1 683
0
0
1 1899
1 4730
4 2006 784 1864 3092
5 3568 5724 289 3508 330
1 4498
2 5897 2393
1 2983
1 65
1 5901
1 5535
2 1720 1631
1 3417
1 5275
0
1 3143
3 855 2459 2430
2 3815 5074
5 4260 2542 1076 1040 1371
1 1713
...

output:

6138

result:

ok single line: '6138'

Test #36:

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

input:

6572 1740
22 609 1503 314 1132 687 1009 200 1222 162 272 1274 606 614 1419 1720 1233 647 1724 642 595 772 347
0
1 218
0
1 1227
0
0
1 542
0
1 134
0
1 1329
1 453
0
0
1 1003
1 1144
0
1 1715
1 1731
0
0
1 1520
2 1486 1632
0
0
0
1 1704
0
0
0
1 1498
0
0
0
0
0
0
0
0
0
0
3 227 950 59
0
0
0
1 1638
14 1331 150...

output:

1740

result:

ok single line: '1740'

Test #37:

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

input:

55834 46664
87 8683 17286 42999 4592 21908 2558 38838 19975 42540 5991 8186 1047 23713 16274 23373 3826 32622 14721 11016 43220 11365 3698 37623 7212 8525 16492 42500 12136 19281 33654 46608 29372 8501 189 10360 31048 4243 7827 28978 994 1667 22911 21036 43697 18243 43389 34094 45893 20825 30128 253...

output:

46664

result:

ok single line: '46664'

Test #38:

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

input:

38926 31796
57 2468 30506 16439 9824 31168 19024 16936 11036 20419 25705 27906 2914 26729 29327 17856 14564 22051 18829 22993 30412 7885 16525 12837 22583 25285 14600 8255 1118 7309 19454 5422 18716 20813 16250 25582 3545 20228 20795 18535 31142 18588 10002 4250 2656 19555 15706 27347 17578 31237 20...

output:

31796

result:

ok single line: '31796'

Test #39:

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

input:

52244 24141
8 15321 19523 22847 17857 1979 22360 2183 2879
2 11186 23443
1 17174
1 15491
0
1 6615
1 8178
0
0
1 13773
3 4042 13169 22263
2 17255 20179
1 2132
1 19425
1 16108
2 7115 13397
2 17340 13987
1 8205
2 14487 13368
0
1 3047
1 10188
1 12297
1 4863
0
1 6045
0
1 11089
1 4520
1 2544
3 24140 22790 ...

output:

24141

result:

ok single line: '24141'

Test #40:

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

input:

46614 15666
0
0
1 13539
1 15039
0
0
0
0
0
1 7053
2 12123 12138
1 7749
2 9503 1151
1 2030
0
0
0
2 3405 2917
1 3210
0
1 10587
1 11947
1 8689
1 6699
0
1 15552
0
2 3888 1538
2 10255 13682
0
1 14637
0
0
1 4338
1 9505
0
1 4693
1 14983
1 4061
0
1 8509
1 7599
1 5442
0
0
0
2 316 8882
0
2 333 15505
0
1 13583
...

output:

15666

result:

ok single line: '15666'

Test #41:

score: 0
Accepted
time: 10ms
memory: 4500kb

input:

93437 76625
1 13723
0
1 42683
2 58690 46289
2 66994 71018
1 61950
4 58165 29443 38346 7785
2 6273 75545
2 3047 10502
1 34021
2 45827 34078
1 68681
2 43403 37681
2 44298 73496
1 8961
3 19814 21679 42968
2 66455 10704
2 47895 3627
3 63748 59991 45970
2 28730 57998
1 355
1 4434
1 75710
2 32540 70189
4 ...

output:

76625

result:

ok single line: '76625'

Test #42:

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

input:

91928 63767
0
1 37818
1 49449
1 25722
1 49996
1 28830
1 60940
2 46445 29006
2 8486 61076
1 59830
2 56662 62675
3 16746 22565 19331
3 54025 36627 54208
0
0
0
3 34855 53437 55152
1 44523
1 51573
2 44643 36715
1 62292
1 10652
1 20886
1 20209
3 39852 52849 47061
4 32577 41059 3874 9912
2 38099 36111
3 3...

output:

63767

result:

ok single line: '63767'

Test #43:

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

input:

92451 83489
49 14639 82032 51634 77930 37191 55225 67583 61105 10025 79337 75099 65854 27183 32890 7419 50139 8559 8070 40516 52723 28292 57894 54768 39847 38490 35367 74563 20370 81410 27435 59215 79119 43274 63080 39416 18213 7876 688 483 62351 77177 55876 63752 20052 63430 25207 59941 17738 4304
...

output:

83489

result:

ok single line: '83489'

Test #44:

score: 0
Accepted
time: 12ms
memory: 4496kb

input:

94090 60936
76 8408 30422 34081 4338 3044 13709 34510 50926 12150 49593 16350 53534 15584 59947 37069 43434 57890 23474 26686 39136 18721 50671 38592 11514 53547 9850 60669 35542 9484 19544 7761 54496 19291 33825 54076 28658 6216 45620 5531 36902 37533 48441 16114 55388 58270 4609 28986 16067 23904 ...

output:

60936

result:

ok single line: '60936'

Test #45:

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

input:

3 2
2 1 2
1 1
1 2

output:

2

result:

ok single line: '2'

Test #46:

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

input:

80983 21319
35 8663 927 13931 7160 11515 17343 12503 19735 11269 9501 17714 7880 497 7586 11400 13108 12048 16730 10459 6357 14136 1080 581 20879 7090 4461 18888 14145 19769 11530 14388 8356 9110 5905 14711
1 4779
0
1 16308
0
0
1 20883
0
0
0
2 9723 10186
0
1 1951
0
1 11255
0
0
1 852
0
0
0
1 11679
0
...

output:

21319

result:

ok single line: '21319'

Test #47:

score: 0
Accepted
time: 12ms
memory: 4392kb

input:

86272 60681
241 35834 21414 52118 43949 36142 38207 28185 22050 33511 10970 43876 36224 10572 40516 12734 10777 19647 4012 45413 33371 31775 31134 4442 13192 54662 32702 51743 14424 16290 54295 48808 58584 1513 31404 23080 43757 15236 10060 17383 14737 33236 44303 16019 1987 20715 18036 52195 11955 ...

output:

60681

result:

ok single line: '60681'

Test #48:

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

input:

99891 83914
0
3 10694 44104 20386
1 39896
2 40364 16465
1 48517
3 292 46042 55727
2 76699 38545
1 34068
0
1 26507
1 60178
3 51882 69460 51423
2 52059 7682
2 61868 68273
1 47555
2 249 81237
2 21695 51614
0
2 79292 79153
1 8202
0
0
1 55138
3 17758 17817 40897
2 36694 40264
2 6810 11884
3 35710 34468 7...

output:

83914

result:

ok single line: '83914'

Test #49:

score: 0
Accepted
time: 10ms
memory: 4632kb

input:

99043 81193
0
3 79516 38190 6273
1 29076
1 2726
1 41805
2 21946 26583
1 23765
1 26319
1 81030
2 11067 30653
1 6243
0
2 69311 8445
2 22162 27888
1 80313
2 58860 9315
1 66002
1 10042
1 10767
1 34191
2 78117 19235
2 8020 75718
1 12215
1 35660
1 38799
1 13019
1 25373
1 40293
1 52287
1 49285
4 10494 6287...

output:

81193

result:

ok single line: '81193'

Test #50:

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

input:

99853 11069
6 4942 7934 4661 3099 94 9033
0
0
0
0
0
1 4677
0
0
0
0
0
0
0
0
0
0
0
0
1 9683
1 6231
0
0
0
0
0
0
0
1 4368
0
0
0
0
0
0
1 4148
0
0
0
0
0
0
0
1 2355
0
0
0
0
0
0
1 154
0
0
0
0
0
0
0
0
0
0
0
1 2767
0
0
0
0
0
0
0
0
0
0
0
0
0
1 10384
0
0
1 7433
0
0
0
0
0
1 2309
0
0
0
0
0
0
0
2 3207 9576
0
0
0
0...

output:

11069

result:

ok single line: '11069'

Test #51:

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

input:

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

output:

4

result:

ok single line: '4'

Test #52:

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

input:

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

output:

3

result:

ok single line: '3'

Test #53:

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

input:

54 811
595 750 315 35 122 316 89 148 422 321 399 807 285 688 572 641 419 770 132 762 645 340 597 70 366 28 682 633 11 249 237 679 217 699 257 61 40 224 554 603 692 662 619 779 737 744 676 183 507 308 306 239 479 16 170 20 279 680 598 263 475 524 468 416 529 56 487 368 721 736 767 451 342 621 709 685...

output:

8

result:

ok single line: '8'

Test #54:

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

input:

60 796
7 677 679 741 583 387 760 484
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1 556
0
2 450 104
1 7
1 116
3 363 376 649
6 602 675 692 657 406 625
5 369 582 497 672 97
3 227 96 404
3 410 221 282
6 50 65 399 102 421 347
11 745 155 596 9 99 759 351 457 422 705 357
10 701 325 795 38 472 653 1...

output:

32

result:

ok single line: '32'

Test #55:

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

input:

923 8368
907 6318 3897 6891 7735 175 3173 3839 3642 4438 7010 4045 5077 6433 4279 1251 6010 852 5038 951 5489 1902 6136 3441 3698 1747 1243 534 2936 3977 8039 29 7706 7077 351 7253 6308 4800 5227 3183 931 7625 6767 3862 7339 3229 3910 6710 8347 1629 5742 1 7609 7191 6832 1224 2452 7223 4077 4706 311...

output:

24

result:

ok single line: '24'

Test #56:

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

input:

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

output:

6

result:

ok single line: '6'

Test #57:

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

input:

942 2353
689 529 753 162 255 1965 2089 409 136 739 985 2017 2274 195 1379 604 2335 1396 1261 1675 1742 639 1424 1648 1313 1545 1833 1243 886 2139 1239 1022 1959 2000 600 1226 1398 1073 1718 9 2352 2322 2162 358 2072 2224 229 124 611 1047 476 1855 683 1906 786 1088 293 103 741 1921 645 811 1349 55 18...

output:

40

result:

ok single line: '40'

Test #58:

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

input:

902 7454
742 7083 4975 7245 6851 6878 4214 1964 1170 3726 2141 2713 457 6849 4533 1528 5170 2984 7219 1580 5253 5212 5319 7350 652 5914 1776 3331 3645 583 1001 6863 6755 2301 3032 7019 943 3385 2025 3821 3698 1360 6641 4746 2638 4586 3421 4560 7391 5531 606 6730 2840 6645 3888 3221 2255 6783 1649 15...

output:

22

result:

ok single line: '22'

Test #59:

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

input:

427 3623
140 3055 2999 688 663 1413 1481 2311 1580 2584 2256 1581 753 2446 2667 293 2331 360 3043 1492 2246 3426 30 583 2541 2008 2157 3274 587 1036 1741 1541 1570 3401 3237 1484 2820 2592 2664 48 1246 873 389 3209 60 1344 2400 845 2830 1619 3468 3605 2872 1718 493 2984 3419 2884 2293 1983 3037 3278...

output:

34

result:

ok single line: '34'

Test #60:

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

input:

653 7284
2135 1573 5939 5067 4522 3177 1585 1319 5608 4949 6149 5289 4624 1390 894 3982 606 1497 5148 5981 6005 3964 6589 3929 2384 1866 4322 3486 4253 4927 2280 2862 903 725 343 2757 615 1699 918 2864 5369 6038 5128 5047 3693 3665 6305 3507 2455 5042 120 6154 3822 562 7272 5821 5804 4559 2080 5845 ...

output:

14

result:

ok single line: '14'

Test #61:

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

input:

139 6256
888 3157 5924 1845 4152 1195 21 1430 4874 6084 1064 5824 4546 720 5523 2270 6079 638 137 6046 43 785 4566 4500 507 4205 2969 3051 4418 4342 1837 3849 4178 1414 389 3651 2000 4943 4752 2847 5173 2605 6049 5861 1810 1657 3794 873 4666 1061 2222 4298 1931 1035 4365 3882 378 2522 564 4828 121 4...

output:

19

result:

ok single line: '19'

Test #62:

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

input:

2415 18655
12851 6139 13885 6180 6858 5499 4664 2743 17011 16356 5164 17122 9795 3493 10004 10126 9944 8858 12475 13856 12021 4621 18013 2042 15925 11298 17636 4526 15626 14205 6685 383 14390 5493 5931 14044 2442 10216 15912 12059 13031 11022 7034 16204 17403 10824 295 10628 7160 8717 16830 5565 754...

output:

18

result:

ok single line: '18'

Test #63:

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

input:

3831 39282
31753 2000 26864 1982 25390 18610 32488 517 20632 3635 32694 11626 8152 13063 17613 14366 22507 37837 31344 20086 12660 22684 28114 7133 29145 29520 20222 23010 28698 38859 33831 38661 20070 3052 8387 21876 2416 505 22292 31001 37965 21074 17861 36667 18571 8802 16755 20011 6415 5209 3213...

output:

13

result:

ok single line: '13'

Test #64:

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

input:

3262 41577
290 32610 20533 25558 39288 8141 35539 32402 5727 4614 19919 27088 23588 26273 9448 39481 4018 37903 12775 18409 35831 69 25295 24231 38246 34701 27137 38620 2654 1633 27841 22517 17059 854 34227 21349 4970 9641 12042 5054 8339 41552 39173 37235 23461 10842 40701 31875 24593 36646 32814 1...

output:

109

result:

ok single line: '109'

Test #65:

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

input:

4902 20875
4231 2692 3499 5274 16526 20339 13135 14152 3561 5465 8199 1338 10194 2396 13807 20829 11696 5382 7721 2121 5221 335 12407 6748 9872 5762 2998 19452 1643 14280 2079 8495 5580 11032 7765 19504 1709 3678 9025 15082 12595 8738 13670 858 14962 9779 10466 7190 916 16009 13128 7066 19617 10784 ...

output:

18

result:

ok single line: '18'

Test #66:

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

input:

4702 40873
174 9594 4010 22538 31045 32651 10468 24900 16967 22180 1416 10488 23371 35741 32249 1581 24514 34059 25785 24097 20517 25301 13036 15407 10110 31814 23717 33596 27518 23509 5808 35642 22137 24938 32189 15091 17504 37717 12716 7774 35070 24246 1944 14201 37349 21808 18178 33063 34933 1169...

output:

133

result:

ok single line: '133'

Test #67:

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

input:

87 86
75 20 41 69 22 11 3 15 19 13 78 43 30 49 33 70 47 58 48 60 37 61 66 71 73 75 16 5 65 54 64 31 83 80 1 55 42 21 72 36 74 45 32 63 56 86 8 52 50 26 40 29 7 85 18 46 67 12 39 51 77 24 14 35 23 17 76 57 81 6 68 25 9 34 53 59
1 2
1 57
1 48
1 86
1 77
2 32 10
1 33
1 3
1 49
1 7
1 62
1 60
1 74
1 23
1 1...

output:

86

result:

ok single line: '86'

Test #68:

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

input:

3335 11640
3994 11082 10198 1891 4467 947 1164 661 10536 3090 1786 5794 3615 4732 9994 6438 8462 9338 6102 3184 589 3356 2324 3316 6814 9363 4795 7421 9226 6247 6689 11395 2476 8474 10576 9855 2737 1552 10364 10611 8103 9006 11044 4892 4829 11510 7229 9324 1340 6664 5529 10950 3543 10428 4361 6500 6...

output:

43

result:

ok single line: '43'

Test #69:

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

input:

38124 63192
5840 3261 14738 41071 13598 28035 42917 36495 911 32210 26776 61978 6167 22327 58408 46987 59148 20005 71 22853 37290 8284 48137 38761 22257 53527 53258 62476 26744 56689 7819 15114 34385 6873 18798 60060 51373 44717 61136 59794 47859 44093 2025 39170 39040 24368 25056 13935 8653 32374 2...

output:

30

result:

ok single line: '30'

Test #70:

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

input:

21486 81857
24165 21374 44003 67028 18736 65932 28983 33895 62750 46097 36955 8717 21942 18402 61693 11245 1804 37667 72813 18991 52054 34543 46689 19659 7385 1166 29499 6860 76266 41828 25089 21688 69497 13733 62578 67948 23384 43213 67413 45027 12609 58222 20201 80703 34729 50051 12598 18987 62515...

output:

16

result:

ok single line: '16'

Test #71:

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

input:

21206 46016
16385 13720 27580 23898 42380 26596 32821 12794 9411 43254 43414 39078 1905 44968 35777 32002 33103 32952 8339 34778 12572 44508 13161 34904 5124 40078 1383 3746 23175 26330 43393 3472 36609 20262 113 3748 21575 3583 29462 4837 29579 24798 37698 44831 18335 21010 1310 45186 31872 18357 3...

output:

48

result:

ok single line: '48'

Test #72:

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

input:

12406 81977
61435 67211 71749 29828 28029 540 32036 13593 34635 35975 27264 46397 59548 69584 72289 27325 51227 74509 57799 27305 49440 70407 20426 35798 65694 42734 21498 77690 60901 21268 18110 36988 39865 64727 67880 74697 51650 43625 69273 17341 39963 10513 41360 65102 72016 37445 75165 2802 581...

output:

18

result:

ok single line: '18'

Test #73:

score: 0
Accepted
time: 10ms
memory: 4304kb

input:

39990 81805
4198 62727 69883 37906 48016 1086 45375 43593 74388 59919 71058 15558 14337 61935 81647 10204 16723 53566 29395 17152 33684 11052 71826 40333 22441 26087 38159 21896 42993 61701 21534 79397 45787 64643 20719 29511 28259 4210 16685 76981 72217 23673 11337 64358 54347 72647 38018 9117 7896...

output:

46

result:

ok single line: '46'

Test #74:

score: 0
Accepted
time: 10ms
memory: 4172kb

input:

15904 89814
2290 32926 78841 16850 80727 52305 38767 61925 75091 83183 18823 45340 50631 4221 77321 84992 77448 37497 44810 38712 35424 20315 5785 83509 31844 21601 33423 68636 77610 70251 2440 52723 14452 14794 29461 85883 26644 84386 76049 74162 68798 40425 8580 81884 71077 47885 75992 33865 52630...

output:

65

result:

ok single line: '65'

Test #75:

score: 0
Accepted
time: 10ms
memory: 4368kb

input:

99996 67929
1681 20738 6435 9742 27216 51021 13358 4686 8875 62563 20203 43354 9425 29085 59135 37286 25770 40418 49111 47491 48608 13351 8819 3111 26908 7531 46854 47893 7879 8471 804 26443 54810 23109 3112 9938 34825 43977 24974 12096 23570 18166 67804 63488 11033 5987 24934 24830 54191 29646 4204...

output:

58

result:

ok single line: '58'

Test #76:

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

input:

60451 49699
42141 34728 43275 28064 20966 18183 36074 11356 8188 13060 25731 41834 36216 35584 47610 46156 26698 17303 24364 44378 2321 14500 45989 12058 49130 46769 26803 30380 25899 6434 14348 8098 33579 22625 8280 44915 1077 19244 37354 1582 32214 12064 42151 25259 17124 23523 20482 17625 170 933...

output:

11

result:

ok single line: '11'

Test #77:

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

input:

81148 49315
41644 3169 32187 18243 5173 13881 19956 11862 566 15601 32052 533 12612 23241 21783 32558 25739 42445 39395 22591 1534 31862 34972 47347 17698 36134 37493 29446 41207 48053 48487 10388 42297 7969 38566 37127 22774 41137 33738 16246 40724 20002 20372 7190 12040 343 15786 41010 26405 25882...

output:

12

result:

ok single line: '12'

Test #78:

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

input:

35 34
27 14 8 2 15 11 12 18 19 29 31 9 6 3 30 32 5 34 7 10 24 16 27 22 1 26 20 23
1 9
1 22
1 34
1 12
2 27 13
1 3
1 33
5 28 33 21 11 17
1 20
1 5
1 30
1 2
1 13
1 10
1 24
1 4
1 25
2 29 4
1 14
1 15
1 8
1 26
1 17
1 21
1 32
2 25 18
1 19
1 6
1 28
1 31
1 23
1 16
1 1
1 7

output:

34

result:

ok single line: '34'

Test #79:

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

input:

85696 61542
43916 31414 41438 26629 17563 48155 51665 12683 60968 33132 22451 59777 3061 56898 18071 54268 9149 5109 26636 2109 4646 44791 45388 36031 54082 8973 3288 24604 27705 10594 21332 32351 50244 45537 37761 12042 45797 20619 7085 5036 55463 59048 40720 56738 58273 38297 49502 25994 32348 411...

output:

18

result:

ok single line: '18'

Test #80:

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

input:

81971 92318
54485 51919 8410 73977 20634 25527 44299 22242 22640 34875 60398 9839 56647 24857 91373 49272 25003 85847 26825 32283 6829 90305 85462 66025 15573 80266 50852 62585 46774 51940 33719 76655 80883 48432 16768 14151 91863 36151 43826 64780 37936 30783 59741 15127 14922 18891 92178 38471 481...

output:

29

result:

ok single line: '29'

Test #81:

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

input:

91836 96413
14514 47242 54116 83608 72020 25886 2807 13040 3663 51357 92374 25644 84595 57046 17840 48405 31409 77402 36392 58960 70545 78009 58118 93026 92400 7397 19828 23399 54402 50152 42071 27714 51291 38689 19089 23828 89885 51743 83362 36289 52284 60012 58780 35142 44869 95283 93040 49609 733...

output:

24

result:

ok single line: '24'

Test #82:

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

input:

99838 99503
19735 11957 75930 57145 56303 32475 51204 73732 99412 6837 60810 61954 49174 62674 50660 77843 26305 31726 54892 93094 34420 69966 67872 47469 24834 86113 48016 56757 55339 25400 17222 51576 93599 38710 17540 67574 94008 50304 94910 71416 68305 73582 21239 39787 67387 54990 66544 98945 8...

output:

22

result:

ok single line: '22'

Test #83:

score: 0
Accepted
time: 10ms
memory: 4644kb

input:

99085 99572
14175 41234 77165 91361 17408 19506 17623 23019 27055 88064 14555 35732 73061 88341 20592 71888 72257 50190 33111 86336 1239 34388 30220 24470 41483 50369 21793 95615 54154 68216 51390 30291 43249 57310 19684 28283 82530 78136 14580 86675 21133 86423 60033 72942 35723 55028 29825 97518 4...

output:

130

result:

ok single line: '130'

Test #84:

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

input:

99927 99552
9553 7396 6541 10395 73588 51151 1425 70885 66871 60860 90999 97842 36934 2809 19490 4917 6397 73069 16228 64672 56957 53934 77180 17885 54877 15028 42096 98202 9684 79130 86528 39099 35663 75696 61465 23373 56770 67436 74103 68982 74831 16920 67721 57145 79948 29981 73114 96666 22141 32...

output:

34

result:

ok single line: '34'

Test #85:

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

input:

99965 99659
19445 81440 55302 13122 31184 3351 95060 51348 20747 55415 19616 71991 36559 15377 5372 32210 98101 71191 23172 81390 34692 29909 63483 60398 32087 17179 46328 48629 13393 43818 26193 50047 94952 28090 58190 67894 53446 19697 6331 40064 34555 5137 39394 70058 96254 56471 95525 7205 24083...

output:

22

result:

ok single line: '22'

Test #86:

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

input:

10 45
9 2 36 24 10 9 28 37 33 4
9 25 43 42 37 11 45 39 22 8
9 30 45 15 34 16 5 36 21 23
9 5 28 38 35 20 8 44 41 32
9 40 6 4 14 31 38 3 43 34
9 7 44 31 16 18 11 1 27 2
9 10 21 17 13 39 6 32 27 19
9 19 22 29 26 3 1 23 24 41
9 33 14 30 35 12 25 29 18 13
9 15 20 12 9 26 42 40 7 17

output:

9

result:

ok single line: '9'

Test #87:

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

input:

15 105
14 24 64 65 2 80 45 84 39 25 82 5 26 42 93
14 10 88 100 51 91 19 18 98 8 14 84 33 46 23
14 71 12 99 102 47 7 21 31 80 95 18 67 1 48
14 74 32 22 29 104 26 21 91 44 60 78 55 20 87
14 20 51 4 102 64 54 81 27 105 61 36 50 59 103
14 38 65 27 56 31 6 104 46 70 66 85 52 41 28
14 54 89 56 68 92 17 19...

output:

14

result:

ok single line: '14'

Test #88:

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

input:

57 1596
56 62 906 356 124 1313 471 1337 993 198 773 923 527 789 837 1199 1023 294 1546 1279 694 1286 662 210 720 1572 508 350 389 1577 462 196 917 1195 358 1152 771 80 951 1085 1075 1485 884 1382 1544 1175 1305 492 1095 1317 1480 1159 956 1111 292 1178 1437
56 1119 576 913 953 204 96 1153 747 263 34...

output:

56

result:

ok single line: '56'

Test #89:

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

input:

61 60
1 1
2 36 34
2 32 25
1 21
2 4 40
2 55 10
2 8 5
2 35 36
1 16
2 40 12
2 2 45
2 23 58
2 42 30
2 49 15
3 44 50 38
2 52 12
2 27 59
2 45 5
2 26 18
2 50 14
1 6
2 11 31
2 58 46
1 38
2 41 4
3 22 21 3
2 52 54
2 15 59
2 56 33
2 17 10
3 19 3 57
1 19
3 13 16 51
2 34 54
2 28 2
2 47 25
2 26 47
2 1 39
2 7 20
2...

output:

60

result:

ok single line: '60'

Test #90:

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

input:

59 1711
58 1689 243 260 431 1324 627 780 1036 891 148 769 44 1576 186 1111 438 1092 55 620 1286 838 822 1366 294 1063 632 764 950 733 119 795 832 1349 830 1211 474 1162 56 744 1704 159 309 595 930 998 949 785 1407 868 300 1563 1638 90 450 1247 1626 460 1144
58 783 884 1286 1606 217 15 766 978 359 11...

output:

58

result:

ok single line: '58'

Test #91:

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

input:

100 4950
99 1974 4166 2014 1293 2908 2279 4183 3868 2453 2596 4011 2481 2133 433 2629 2175 3139 612 4602 553 120 1309 996 475 1292 668 3374 2570 2306 1961 1085 883 3261 2339 1321 2961 508 4658 3730 4440 4242 1281 4767 4945 2664 2471 1164 245 4510 2806 3671 445 340 2681 106 4477 3566 3129 835 2926 30...

output:

99

result:

ok single line: '99'

Test #92:

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

input:

130 8385
129 2650 6789 5230 5291 8335 5109 6797 1701 1264 1211 2040 5912 4714 7747 7564 1522 3950 6890 7341 6708 7672 4867 3081 6350 6845 5117 4360 2412 3659 2157 2894 5931 1680 3732 960 321 7738 2281 274 6326 1440 3349 1619 5979 2404 296 4304 2409 3177 1271 1582 7553 5715 5491 5893 6641 1198 1315 5...

output:

129

result:

ok single line: '129'

Test #93:

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

input:

335 55945
334 5222 1321 43205 30780 49741 38804 22136 34912 16736 38610 29433 12572 25456 54187 52772 23871 8060 24195 18871 41412 32111 38634 18194 39697 35003 3623 33848 11527 28856 37908 51214 54917 19510 27815 24144 37299 49685 20430 28264 24768 35512 28742 50905 19551 16105 43212 34264 35753 28...

output:

334

result:

ok single line: '334'

Test #94:

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

input:

397 78606
396 55848 61183 33562 29983 32311 48345 55857 3966 44339 76916 72561 28265 13067 78093 69396 49154 39513 3927 45134 62583 47937 47763 1250 74846 73586 71840 77252 28284 9059 68428 3263 34442 37805 47786 44195 67300 2288 59026 51446 3648 22882 59611 26340 76807 7842 44999 22473 70277 24378 ...

output:

396

result:

ok single line: '396'

Test #95:

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

input:

418 87153
417 39488 12136 80873 65341 75232 8986 72555 46197 43658 34426 52290 44141 84723 23466 30586 6753 59871 4213 13182 23023 64330 17430 75250 86380 66262 16962 52869 84994 72313 15440 31747 9710 54195 23114 81213 47357 79513 72797 22178 53976 76633 59604 45556 13353 12636 70192 39470 7254 403...

output:

417

result:

ok single line: '417'

Test #96:

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

input:

424 89676
423 41766 53298 20153 67266 45393 2724 38795 3955 60181 32658 81707 23762 41162 53625 41566 4276 77284 10741 52978 52277 40900 19310 61119 69697 70262 58510 14014 52121 46660 34174 14439 57053 55949 1498 40661 81856 74782 30171 54108 13173 39885 43111 8639 41827 11418 80690 20790 64922 738...

output:

423

result:

ok single line: '423'

Test #97:

score: 0
Accepted
time: 10ms
memory: 3780kb

input:

443 97903
442 2922 85153 14221 25212 76590 69442 2841 75495 81099 42459 62051 87158 21053 41340 79676 81365 11322 37728 30935 6252 84869 10536 95537 23637 65183 71095 67438 27418 90780 65876 1831 14664 47246 84625 39473 58518 7833 52481 6592 42541 541 76011 59702 83018 24885 90513 44584 26968 39528 ...

output:

442

result:

ok single line: '442'

Test #98:

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

input:

445 98790
444 36398 28215 1416 22848 50770 51053 35833 73827 88469 67647 92398 58616 74893 75226 79716 49495 42573 87767 8475 80918 27416 79431 16411 28043 34306 91345 30534 9153 77399 9109 94653 17190 49622 72462 39720 6696 18148 41920 42066 79753 12837 42017 48981 5666 28767 34966 31331 16903 8686...

output:

444

result:

ok single line: '444'