QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#189169#2722. Marshmallow Moleculeslmeowdn25 ✓60ms14632kbC++141.8kb2023-09-26 22:57:572023-09-26 22:57:58

Judging History

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

  • [2023-09-26 22:57:58]
  • 评测
  • 测评结果:25
  • 用时:60ms
  • 内存:14632kb
  • [2023-09-26 22:57:57]
  • 提交

answer

#include<bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 i128; 
template<typename T,typename U>
T ceil(T x, U y) {return (x>0?(x+y-1)/y:x/y);}
template<typename T,typename U>
T floor(T x, U y) {return (x>0?x/y:(x-y+1)/y);}
template<class T,class S>
bool chmax(T &a,const S b) {return (a<b?a=b,1:0);}
template<class T,class S>
bool chmin(T &a,const S b) {return (a>b?a=b,1:0);}
int popcnt(int x) {return __builtin_popcount(x);}
int popcnt(ll x)  {return __builtin_popcountll(x);}
int topbit(int x) {return (x==0?-1:31-__builtin_clz(x));}
int topbit(ll x)  {return (x==0?-1:63-__builtin_clzll(x));}
int lowbit(int x) {return (x==0?-1:__builtin_ctz(x));}
int lowbit(ll x)  {return (x==0?-1:__builtin_ctzll(x));}

#define int long long
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
typedef pair<int,int> pii; 
typedef vector<int> vi;
typedef vector<pii> vp;
typedef tuple<int,int,int> tiii;
int read() {
  int x=0,w=1; char c=getchar(); 
  while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
  while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();}
  return x*w;
}

const int N=1e5+5;
int n,m,id[N],ans;
set<int> s[N];

signed main() {
  n=read(), m=read();
  rep(i,1,m) {
    int u=read(), v=read();
    s[u].insert(v);
  }
  rep(i,1,n) id[i]=i;
  rep(i,1,n) {
    if(s[id[i]].find(i)!=s[id[i]].end()) s[id[i]].erase(i);
    if(!s[id[i]].size()) continue;
    int j=*s[id[i]].begin(); ans+=s[id[i]].size();
    if(s[id[i]].size()>s[id[j]].size()) swap(id[i],id[j]);
    for(int x:s[id[i]]) s[id[j]].insert(x);
    s[id[i]].clear();
  }
  printf("%lld\n",ans);
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 3ms
memory: 9140kb

input:

100 4900
15 25
10 36
87 93
60 75
43 62
12 16
53 62
5 32
15 87
20 96
84 89
58 91
12 49
66 91
6 17
56 85
11 72
44 82
25 69
1 42
40 62
5 83
39 99
52 92
28 47
34 72
33 62
4 84
34 52
55 62
38 69
36 69
82 91
40 50
69 85
33 66
41 44
28 60
96 100
41 74
42 50
28 36
61 89
54 99
44 86
45 61
24 75
20 31
23 29
6...

output:

4948

result:

ok single line: '4948'

Test #2:

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

input:

100 2000
30 54
4 27
67 70
75 88
94 96
37 56
6 19
29 59
31 70
34 99
18 69
39 79
47 63
14 90
37 45
50 94
36 41
80 100
68 71
10 92
37 75
34 91
69 91
59 63
53 85
54 86
64 79
57 96
66 96
31 38
27 80
12 25
35 63
5 99
28 61
57 71
10 81
21 43
44 49
37 52
35 100
64 94
67 90
35 46
54 91
38 77
25 40
6 80
6 60
...

output:

4721

result:

ok single line: '4721'

Test #3:

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

input:

100 2000
67 95
44 100
58 94
18 24
72 88
64 66
27 87
84 96
3 4
13 45
54 74
54 86
10 46
5 32
37 93
70 86
46 95
16 34
25 85
63 92
32 95
21 62
30 50
8 12
53 97
28 85
46 69
36 73
26 93
59 93
16 33
22 72
43 54
4 13
40 57
5 29
37 58
10 38
65 98
18 47
51 65
17 81
44 46
25 42
8 58
7 39
23 89
2 33
81 90
35 86...

output:

4802

result:

ok single line: '4802'

Test #4:

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

input:

100 3000
1 45
21 41
28 39
35 93
1 100
49 52
66 93
30 74
9 29
9 20
50 87
5 72
68 100
62 73
32 95
12 18
6 24
36 74
38 60
27 31
58 90
21 75
8 22
49 85
2 92
14 59
6 67
1 9
26 27
67 99
1 5
65 98
16 53
19 45
69 72
53 59
19 93
20 79
23 71
4 91
12 20
50 91
42 59
9 45
61 100
4 30
14 21
14 52
44 71
25 32
16 2...

output:

4950

result:

ok single line: '4950'

Test #5:

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

input:

100 3000
36 67
46 82
28 64
1 70
2 34
74 97
34 62
24 72
70 79
86 98
84 98
59 62
20 60
52 77
72 94
25 66
1 27
25 69
39 95
34 65
17 88
92 93
3 34
14 25
53 80
51 60
28 32
37 80
24 38
70 98
17 100
42 84
11 39
28 55
48 71
8 58
27 57
45 97
94 96
19 36
11 99
31 73
15 92
15 52
27 72
3 64
73 91
95 97
21 36
7 ...

output:

4950

result:

ok single line: '4950'

Test #6:

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

input:

100 3000
50 98
50 51
33 46
46 67
60 62
51 87
8 50
9 63
1 54
24 92
28 55
24 40
49 71
61 69
2 83
38 70
44 84
43 76
4 50
9 91
26 56
50 53
1 36
65 82
36 97
51 94
72 82
54 95
27 56
49 78
49 60
14 43
50 88
83 87
34 81
54 90
28 61
34 80
5 19
38 69
41 100
33 75
42 77
29 53
17 68
19 84
45 96
14 78
15 33
61 9...

output:

4950

result:

ok single line: '4950'

Test #7:

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

input:

100 99
7 100
17 99
20 57
2 21
13 68
3 27
2 46
8 17
40 90
8 88
2 33
1 6
1 9
22 75
1 13
16 73
1 3
1 2
13 93
1 24
20 52
2 34
3 8
23 85
15 79
7 42
32 65
17 61
2 18
1 12
1 4
1 92
2 80
4 37
7 70
7 54
6 94
3 67
14 97
1 15
6 45
11 71
16 63
2 28
30 96
4 19
5 81
39 86
2 43
1 44
24 84
2 7
9 83
2 22
1 29
1 10
1...

output:

4198

result:

ok single line: '4198'

Test #8:

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

input:

100 2000
65 98
1 81
28 79
19 63
27 96
18 66
97 100
8 55
46 91
60 82
30 84
5 29
28 32
33 39
40 80
20 70
77 83
11 36
59 70
45 75
48 56
6 48
48 73
28 76
63 98
41 53
9 55
25 28
34 43
7 38
26 66
38 64
9 19
20 95
12 23
3 49
13 43
90 98
41 69
4 88
34 66
6 38
31 60
59 62
16 55
2 48
25 58
81 82
6 41
45 79
43...

output:

4760

result:

ok single line: '4760'

Test #9:

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

input:

100 2000
43 81
87 97
78 80
25 84
17 98
32 88
21 26
65 93
54 75
24 57
11 76
40 49
30 89
50 75
22 25
43 54
44 86
30 66
82 94
1 23
6 70
10 17
36 91
12 79
17 30
57 60
52 74
36 94
25 28
17 82
22 84
59 75
14 75
7 16
24 28
76 81
61 88
39 51
58 62
55 59
15 38
18 91
3 9
21 83
78 99
19 69
12 41
43 79
37 44
8 ...

output:

4853

result:

ok single line: '4853'

Test #10:

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

input:

100 3000
17 18
31 90
26 94
3 99
9 29
4 19
47 82
9 94
70 86
69 95
3 24
71 85
19 58
1 13
12 99
5 84
81 97
66 94
21 99
6 15
14 44
59 66
18 70
76 85
20 38
4 88
2 80
69 94
50 86
26 90
3 15
39 90
11 74
26 62
24 77
4 74
5 83
41 56
11 54
13 66
34 93
5 94
30 60
37 96
36 83
1 30
1 27
77 78
39 100
25 94
35 64
...

output:

4950

result:

ok single line: '4950'

Test #11:

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

input:

100 3000
58 97
6 39
34 80
16 55
16 35
31 73
20 62
1 13
22 84
39 65
10 92
70 78
39 64
93 97
15 65
9 70
1 92
23 78
13 99
19 41
41 50
33 43
47 74
20 71
15 59
13 16
48 85
19 53
26 63
10 64
69 95
40 48
4 78
14 45
7 8
6 23
7 53
11 65
1 44
1 96
15 42
40 81
9 28
1 29
35 52
28 84
52 72
34 87
6 94
25 51
12 84...

output:

4950

result:

ok single line: '4950'

Test #12:

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

input:

100 3000
46 79
44 61
12 100
24 93
78 95
52 81
25 53
3 35
10 99
56 93
20 82
33 41
65 89
83 91
31 68
67 86
58 70
30 60
38 66
17 49
52 86
28 36
11 28
11 24
65 76
22 90
15 99
46 67
80 95
53 73
1 12
45 96
18 97
67 74
28 67
84 100
11 17
27 59
43 75
19 54
23 76
71 92
15 69
54 100
36 87
67 97
2 76
50 63
27 ...

output:

4950

result:

ok single line: '4950'

Test #13:

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

input:

100 99
10 65
6 77
1 30
24 55
11 87
1 14
1 36
20 66
10 88
12 49
1 15
14 59
7 29
5 35
2 38
3 56
1 28
4 76
2 21
18 78
5 98
13 52
11 64
23 92
7 43
4 70
1 11
4 16
1 2
13 24
3 97
8 40
1 17
13 72
6 90
9 60
4 82
26 80
14 94
21 79
1 3
10 63
27 100
1 13
2 69
5 22
4 62
28 75
1 4
4 47
14 44
3 86
3 32
1 19
11 61...

output:

4276

result:

ok single line: '4276'

Subtask #2:

score: 5
Accepted

Test #14:

score: 5
Accepted
time: 25ms
memory: 13112kb

input:

5000 100000
1007 2107
610 4713
352 2900
1869 2260
3688 4056
1528 4136
1021 4034
1654 2324
799 3245
4575 4615
3552 4045
2322 3284
2287 3417
1619 4398
901 1538
2545 4698
3300 4618
2273 4855
1890 2475
2433 3158
653 2221
284 1845
3225 3573
1451 3707
1074 4210
284 3646
729 3732
2554 3901
3232 3513
2649 3...

output:

11309962

result:

ok single line: '11309962'

Test #15:

score: 0
Accepted
time: 29ms
memory: 13032kb

input:

5000 100000
1567 3391
669 790
1675 4889
1916 4571
163 4916
2483 3033
1119 1632
967 1868
3043 3089
23 1098
103 3228
2456 3148
1892 2693
909 3297
1387 4952
1242 2144
290 2030
1263 1487
2872 4209
942 3543
323 2142
120 328
559 872
1048 1890
3425 4474
597 2440
1627 2308
859 2291
1895 3706
791 2364
858 21...

output:

11766640

result:

ok single line: '11766640'

Test #16:

score: 0
Accepted
time: 21ms
memory: 13584kb

input:

5000 100000
309 2824
1337 4614
186 3311
2 3469
1198 3225
3498 4630
942 2765
2330 3412
1503 2982
810 4780
2765 4759
4 676
175 4522
2181 3766
3314 3412
4 555
1533 2270
3068 4373
834 3640
182 2033
2027 3680
3892 4167
760 1044
1506 3625
552 764
4 3468
590 1736
2129 3937
1841 2619
4100 4657
589 3843
2 42...

output:

12497500

result:

ok single line: '12497500'

Test #17:

score: 0
Accepted
time: 32ms
memory: 13024kb

input:

5000 100000
1330 1428
2752 4156
1014 1620
1838 3447
3592 4623
1 2010
3464 3465
1974 3842
2853 4828
94 2511
827 1018
242 2201
1503 3815
783 3562
2176 3933
1550 4121
864 1293
63 742
1729 3793
338 1722
3908 4548
2135 4837
4378 4723
2311 2595
2324 4046
666 682
997 4949
536 2912
2739 3273
514 1629
1096 4...

output:

12497500

result:

ok single line: '12497500'

Test #18:

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

input:

5000 100000
1396 4979
480 2252
1209 4734
507 2645
2986 4802
211 328
152 4709
3324 4516
3153 4142
2533 3083
2432 3819
2893 3202
2842 3923
44 1012
565 4431
1762 2275
321 3929
945 4271
2489 3164
4214 4880
605 3827
4204 4589
2405 2575
213 2982
4361 4571
1757 1842
203 3189
2533 4115
594 2464
2932 4586
84...

output:

12497500

result:

ok single line: '12497500'

Test #19:

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

input:

5000 4956
107 823
43 102
481 3096
417 2227
138 3616
30 2440
33 4918
66 1620
63 1495
60 2078
1365 3465
297 4032
142 2339
194 2973
1168 4551
33 1088
174 1305
68 731
11 209
408 1842
717 2212
16 71
22 727
39 775
427 3692
13 668
295 2614
415 3606
697 3151
4 355
758 1825
291 2577
43 2468
22 1966
22 1834
2...

output:

10305699

result:

ok single line: '10305699'

Test #20:

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

input:

5000 100000
1247 2071
3942 4950
4444 4730
970 1174
93 3937
290 2502
547 1115
1590 1833
216 1452
2604 3018
2548 2929
3433 4511
874 1688
27 772
1656 1998
1837 3328
2458 3288
2050 2489
2657 4880
1394 3423
1013 2172
1449 2768
708 2292
2859 2905
3139 4356
2319 3017
1706 3640
497 1872
1558 4618
329 592
11...

output:

11327063

result:

ok single line: '11327063'

Test #21:

score: 0
Accepted
time: 31ms
memory: 13028kb

input:

5000 100000
1286 3107
984 4053
776 1045
1120 3998
229 3042
871 1558
236 1705
2597 4607
2705 2803
405 3028
2226 3534
629 1253
491 2787
422 4162
233 2831
895 3614
321 678
3275 4405
2125 4904
15 904
141 4054
3066 3098
1797 1998
2332 4333
203 3136
1768 4675
2073 4906
1794 2565
453 3579
214 2304
322 2144...

output:

11784692

result:

ok single line: '11784692'

Test #22:

score: 0
Accepted
time: 32ms
memory: 13048kb

input:

5000 100000
495 4954
4347 4670
3 2880
2366 4610
4243 4281
2 2478
679 1948
1673 2278
1 16
2383 3058
3579 3899
1022 3989
1733 2092
1972 3769
1191 1666
492 3863
2625 3281
922 2983
4 2350
380 3134
667 1407
1859 1958
578 3672
3756 4484
2 178
3010 4032
2035 4217
3419 4225
3436 4140
1249 1659
318 819
354 3...

output:

12497500

result:

ok single line: '12497500'

Test #23:

score: 0
Accepted
time: 28ms
memory: 13032kb

input:

5000 100000
727 2582
280 3116
936 2594
1010 1587
2185 4847
2386 4307
1349 2516
2229 2436
3511 3814
1 4213
4531 4584
1 2423
4573 4793
543 3105
2659 4776
2083 4962
1152 1653
2213 2608
1905 2516
1039 1321
1 2315
2191 3542
886 2950
2 4367
2 808
3256 3329
719 3533
2778 3828
2 168
2910 3318
1 1715
2258 49...

output:

12497500

result:

ok single line: '12497500'

Test #24:

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

input:

5000 100000
19 4186
3972 4481
2944 4677
43 2702
1502 4646
2495 3750
610 2722
1908 4908
1090 3854
632 982
826 2030
1806 4338
133 3478
896 4487
3373 3632
2917 4089
3442 4232
2810 4811
1644 2911
1917 3090
615 2354
1313 2710
1049 2875
1221 2753
1493 4045
1 1737
3596 3995
2622 3760
4115 4255
680 3920
312...

output:

12497500

result:

ok single line: '12497500'

Test #25:

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

input:

5000 4940
27 417
305 2332
13 98
7 511
203 1751
725 2033
735 3151
623 2933
954 3891
479 3286
461 4108
12 282
136 957
41 117
582 2218
424 2246
7 1883
16 3789
137 1586
596 4450
1 32
38 1964
228 1750
353 2920
398 1525
4 408
9 628
139 1846
181 4892
149 3521
293 1536
1095 2501
25 2094
734 3749
20 3743
513...

output:

9403127

result:

ok single line: '9403127'

Subtask #3:

score: 5
Accepted

Test #26:

score: 5
Accepted
time: 45ms
memory: 13836kb

input:

100000 99020
2976 97036
5108 36137
82 903
11925 33740
30856 70930
4105 43498
5500 66211
13684 81739
3416 70119
5792 89390
23098 83444
5033 27428
24910 64719
1714 51173
13329 34411
3859 33637
4127 33246
181 46040
8259 93728
1881 32818
604 47012
12645 65438
8226 19448
7637 87170
2828 70329
243 7934
44...

output:

3851818389

result:

ok single line: '3851818389'

Test #27:

score: 0
Accepted
time: 45ms
memory: 13756kb

input:

100000 99893
1719 75153
237 35956
16388 19581
14378 78657
69903 84628
58266 58297
320 45250
2164 94317
13451 17062
73014 98393
5041 5082
15462 21916
38735 80715
7245 21268
33986 98231
2245 28788
31001 73166
74515 94536
66148 72235
800 2507
45065 46517
15955 64664
4758 51907
18105 22123
17499 74852
3...

output:

2462112722

result:

ok single line: '2462112722'

Test #28:

score: 0
Accepted
time: 42ms
memory: 13832kb

input:

100000 99900
3215 11099
41057 60010
30319 66637
42476 84769
66980 68240
84489 96888
30255 36867
15772 18310
37275 47722
35210 39664
36975 43180
52829 86179
69326 95686
6352 14441
45670 51396
50368 51411
1817 3167
38972 45081
21316 33467
79960 85622
89183 91753
6661 10531
52574 70802
24353 27151
7889...

output:

1230469117

result:

ok single line: '1230469117'

Test #29:

score: 0
Accepted
time: 44ms
memory: 13716kb

input:

100000 98979
6146 34482
5140 86086
15474 73948
97 16533
9889 61282
1880 75753
4975 96342
59 3976
201 45655
8672 86427
2312 24929
24243 86289
692 30146
717 47964
20606 73190
12483 73291
21841 95121
6529 46724
1170 24787
974 14021
13242 35132
133 2714
12539 71980
26588 85706
1252 9415
2417 27116
1301 ...

output:

3232411268

result:

ok single line: '3232411268'

Test #30:

score: 0
Accepted
time: 38ms
memory: 13880kb

input:

100000 99910
363 1509
46092 55973
1282 4663
66733 99422
4471 7278
46679 73220
8724 88050
36959 76558
32919 92312
2201 4437
1633 11029
50837 89041
12188 81117
27592 57859
232 811
21537 72260
133 140
7744 19173
39664 55781
67413 71464
56750 99720
20401 61461
32373 76547
23791 56062
13778 19928
45972 7...

output:

2481369952

result:

ok single line: '2481369952'

Test #31:

score: 0
Accepted
time: 38ms
memory: 13836kb

input:

100000 99894
20586 22241
83458 92563
4793 4876
15416 17413
77379 86271
49068 72690
5554 8984
67850 79522
57928 65580
3202 3529
7253 10135
53243 55945
55563 68379
26173 29069
32887 39945
30809 49823
95154 99866
61659 71168
26549 60990
26015 32060
48853 84428
3340 8574
58338 61441
38161 73381
3676 603...

output:

1219197484

result:

ok single line: '1219197484'

Test #32:

score: 0
Accepted
time: 45ms
memory: 13728kb

input:

100000 98974
5738 64383
8540 93600
19635 52609
25378 65021
201 6811
5663 63923
5533 59688
1474 33612
5573 55949
1570 5494
24037 91262
983 50443
3081 76641
830 21043
18059 89653
17033 78741
13668 46052
155 953
1943 53063
26763 76507
1394 88357
10513 91646
5612 88789
7319 68247
22305 69952
13238 54515...

output:

4037175909

result:

ok single line: '4037175909'

Test #33:

score: 0
Accepted
time: 47ms
memory: 13872kb

input:

100000 99920
15367 29210
38519 69788
8567 28914
2382 38225
21008 60979
94538 97337
1845 6708
33576 45151
34386 91697
1765 3925
29178 83337
24962 29739
2106 2447
12232 14923
15690 83453
6179 25460
45939 87298
928 2928
21451 90309
18722 23982
4147 21506
39014 53802
8209 10244
17174 32060
1855 3740
268...

output:

2481130031

result:

ok single line: '2481130031'

Test #34:

score: 0
Accepted
time: 45ms
memory: 13860kb

input:

100000 99904
44171 49968
58010 87940
18741 35900
25812 56653
15973 18946
7421 11516
26622 48349
10351 18213
40578 44743
18453 22132
42593 58917
49709 57808
59175 70545
24896 25874
47624 84036
40647 42405
69770 75103
19126 29273
56799 58873
3002 3253
7618 10423
40215 40351
25280 44598
49417 74247
493...

output:

1164946111

result:

ok single line: '1164946111'

Test #35:

score: 0
Accepted
time: 45ms
memory: 13820kb

input:

100000 98998
5034 37396
7531 76242
907 22776
1136 17936
5499 31369
11567 73607
2646 82050
5328 25550
19206 89978
4805 26562
298 6341
6038 38219
2572 31407
2646 11809
7625 32723
15561 96975
814 18391
2989 34013
850 8155
11060 86255
124 1832
68 18979
17362 57933
4273 83311
15846 56183
18375 85415
1207...

output:

4016504110

result:

ok single line: '4016504110'

Test #36:

score: 0
Accepted
time: 43ms
memory: 13708kb

input:

100000 99904
34 28894
14959 24183
74569 80751
13227 21322
76772 94480
2024 2382
11039 51608
2065 31148
19164 72488
5984 54363
11319 14262
3786 35337
54105 92939
15970 85191
33625 38563
9021 96191
75727 81703
14217 82816
43198 82609
18276 64739
2509 27281
5267 9618
30926 75962
33583 68063
82270 94683...

output:

2483186538

result:

ok single line: '2483186538'

Test #37:

score: 0
Accepted
time: 35ms
memory: 13832kb

input:

100000 99886
50108 53909
17497 32406
30592 34527
35107 36052
27363 44558
8815 13175
59334 59827
13576 13676
43324 57846
13469 14695
55393 64420
28240 30872
44504 58694
84869 86404
80988 93101
9694 19133
13191 21837
13030 14270
4651 5410
19915 20438
38755 43997
68228 95508
80645 85558
39218 50624
129...

output:

1114405226

result:

ok single line: '1114405226'

Subtask #4:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #38:

score: 10
Accepted
time: 60ms
memory: 13064kb

input:

10000 100000
3199 9325
4630 8947
8130 9650
3595 8242
6687 9423
1679 4936
8110 8455
1886 8623
2055 8875
499 9111
5812 9915
306 8932
4689 9819
112 9760
2793 8917
4293 9303
2908 8962
853 4523
5601 8533
867 8894
8098 9894
4534 8988
1427 8852
6633 8578
3483 8913
1330 9490
2309 5251
793 9405
1178 8471
512...

output:

2239903

result:

ok single line: '2239903'

Test #39:

score: 0
Accepted
time: 53ms
memory: 13248kb

input:

10000 100000
4599 9768
859 8757
1145 9968
2529 8213
3742 9271
3116 8868
865 9201
2040 5116
2104 8537
2784 8687
2981 5587
6181 9536
110 8656
3888 8305
3471 8769
1841 8726
1201 8620
7758 8588
1661 8983
1256 8938
4203 9358
8054 9945
6023 7108
7925 9375
6199 9315
5636 8433
5824 9283
5381 8456
6864 7528
...

output:

2238607

result:

ok single line: '2238607'

Test #40:

score: 0
Accepted
time: 60ms
memory: 13336kb

input:

40000 100000
15722 24245
7581 35022
26513 39608
21220 38658
11345 38231
31151 31960
30156 31462
5715 19242
14531 36540
5403 19086
2370 38818
15896 35019
10524 37355
22390 36368
22415 35983
22169 32867
28564 39739
23392 28080
17619 25194
11578 22173
31444 39205
14007 38032
8151 36126
736 16752
18193 ...

output:

26905710

result:

ok single line: '26905710'

Test #41:

score: 0
Accepted
time: 60ms
memory: 13360kb

input:

40000 100000
28210 32957
14640 39798
2012 17390
17260 38844
9574 35624
19739 26254
4679 18724
24819 36573
25298 36896
32007 32388
15468 36831
24918 32865
4045 36827
20763 26766
26358 33542
19350 38340
24457 28613
9948 21358
9933 32903
23316 28042
8492 36155
28562 35432
28895 37916
1413 17091
1128 16...

output:

26898632

result:

ok single line: '26898632'

Test #42:

score: 0
Accepted
time: 41ms
memory: 13688kb

input:

90000 100000
26300 68982
60137 62837
27693 46615
15265 40401
31170 48353
1141 33339
34129 86551
22139 43838
6988 36262
29024 47280
44396 54966
45767 55652
33662 49599
48059 56798
1468 33502
8588 37062
57180 84719
26904 46220
38647 69583
8647 37092
65391 65464
52184 58860
18123 69598
51841 58689
4258...

output:

171402492

result:

ok single line: '171402492'

Test #43:

score: 0
Accepted
time: 51ms
memory: 13680kb

input:

90000 100000
1096 33316
15037 40287
32339 48938
32225 78029
13535 39536
15294 40415
63130 64333
13906 78130
4040 89406
3827 84988
47105 56321
39752 52644
22648 44092
10655 74563
47734 56635
35988 50762
55489 60513
29459 47498
1917 84333
49878 69268
10380 37958
18566 82412
20291 42914
49247 57392
579...

output:

170811308

result:

ok single line: '170811308'

Test #44:

score: 0
Accepted
time: 30ms
memory: 13376kb

input:

50000 100000
15982 49424
24006 29649
22035 31291
1 31074
21191 25257
341 25696
14750 43335
9237 48041
15979 28165
6607 25001
12196 30161
12978 35969
5514 30129
19873 46719
9640 34760
4183 30736
21061 40402
11866 27804
16864 25001
4841 44930
20790 33393
20540 45362
18016 25988
17725 35014
6182 45475
...

output:

272078178

result:

ok single line: '272078178'

Test #45:

score: 0
Accepted
time: 32ms
memory: 13376kb

input:

50000 100000
13732 27837
1 41532
6317 29015
3377 47976
14417 46562
4179 27025
7193 25001
17488 48368
20619 32851
12684 48126
6050 43599
10891 34611
15203 28494
15377 43675
16980 31016
24153 47674
11052 35703
16330 46190
23242 39551
2288 40990
15184 25001
8010 28908
4831 25001
19739 28852
11575 29143...

output:

271954085

result:

ok single line: '271954085'

Test #46:

score: 0
Accepted
time: 28ms
memory: 13864kb

input:

100000 100000
6389 93533
1 86475
17870 59859
37846 98755
21520 50001
13063 69729
1617 50001
33839 84962
3163 79641
1 86124
23565 80794
1 68280
42267 50001
1 64768
48181 52613
7270 50001
1 71387
25345 50001
31875 50001
1323 50001
1 54921
4876 51616
1 96706
1 61358
10751 60422
19953 61139
6940 73783
2...

output:

580379733

result:

ok single line: '580379733'

Test #47:

score: 0
Accepted
time: 34ms
memory: 13756kb

input:

100000 100000
49086 58594
28027 50001
16878 97285
18350 60078
13478 54421
22712 50001
2267 63491
1 80645
1 77994
27487 70177
27530 92776
1 89914
5543 58466
1 69028
33637 54128
1 62592
34960 83240
10263 50001
13789 55206
4226 64287
3875 50001
7387 97684
2083 53259
19001 60791
18134 72965
43244 50001
...

output:

579641344

result:

ok single line: '579641344'

Test #48:

score: 0
Accepted
time: 48ms
memory: 13828kb

input:

100000 99020
2976 97036
5108 36137
82 903
11925 33740
30856 70930
4105 43498
5500 66211
13684 81739
3416 70119
5792 89390
23098 83444
5033 27428
24910 64719
1714 51173
13329 34411
3859 33637
4127 33246
181 46040
8259 93728
1881 32818
604 47012
12645 65438
8226 19448
7637 87170
2828 70329
243 7934
44...

output:

3851818389

result:

ok single line: '3851818389'

Test #49:

score: 0
Accepted
time: 46ms
memory: 13836kb

input:

100000 99893
1719 75153
237 35956
16388 19581
14378 78657
69903 84628
58266 58297
320 45250
2164 94317
13451 17062
73014 98393
5041 5082
15462 21916
38735 80715
7245 21268
33986 98231
2245 28788
31001 73166
74515 94536
66148 72235
800 2507
45065 46517
15955 64664
4758 51907
18105 22123
17499 74852
3...

output:

2462112722

result:

ok single line: '2462112722'

Test #50:

score: 0
Accepted
time: 40ms
memory: 13760kb

input:

100000 99900
3215 11099
41057 60010
30319 66637
42476 84769
66980 68240
84489 96888
30255 36867
15772 18310
37275 47722
35210 39664
36975 43180
52829 86179
69326 95686
6352 14441
45670 51396
50368 51411
1817 3167
38972 45081
21316 33467
79960 85622
89183 91753
6661 10531
52574 70802
24353 27151
7889...

output:

1230469117

result:

ok single line: '1230469117'

Test #51:

score: 0
Accepted
time: 43ms
memory: 13836kb

input:

100000 100000
41722 60146
42206 44078
8585 37365
14410 69408
24999 29505
91653 93736
54842 73781
983 4653
47458 75374
14672 53582
49332 89600
9589 31635
21863 24322
13426 15749
52013 91698
11946 13805
33807 87005
56143 93128
22626 90001
87222 95127
3860 40121
2675 29328
4786 34135
44032 45273
6190 7...

output:

256995118

result:

ok single line: '256995118'

Test #52:

score: 0
Accepted
time: 48ms
memory: 13768kb

input:

100000 100000
27748 63524
12534 14790
2559 7376
18925 39339
24262 71665
4253 55449
4175 24700
16623 16669
55179 80828
296 56071
8966 52342
47573 57376
28800 28845
43453 56671
6291 34268
21566 28252
19669 73550
46019 49168
4745 40602
29780 36570
13870 27117
14175 41852
21789 39991
59243 65404
15610 3...

output:

1225598738

result:

ok single line: '1225598738'

Test #53:

score: 0
Accepted
time: 52ms
memory: 14104kb

input:

100000 100000
83 9168
22 42233
50 76196
4 72990
42 20576
12 69704
77 49600
40 69276
46 66491
15 97124
55 90573
60 71811
47 80312
100 52099
60 75322
15 94811
31 25567
57 81103
39 8492
54 49848
9 81643
62 39510
5 6867
4 63111
58 24895
3 82293
38 92074
22 74892
46 39947
29 53931
60 59042
70 44341
86 16...

output:

1992699976

result:

ok single line: '1992699976'

Test #54:

score: 0
Accepted
time: 37ms
memory: 14632kb

input:

100000 100000
3 13108
4 53544
4 17358
4 14843
3 73674
4 39633
2 86693
2 1509
4 80019
2 72240
1 56967
2 8917
30851 97839
73092 76037
1 63458
1 98750
2 38793
2 21729
3 26802
3 54210
2 22519
2 731
3 82597
2 42226
1 20997
4 80915
574 10303
11528 49853
2 67025
2 90828
4 97078
3 58793
4 11499
2 45000
2 84...

output:

2146303581

result:

ok single line: '2146303581'

Test #55:

score: 0
Accepted
time: 28ms
memory: 13768kb

input:

100000 100000
1 23743
1 10432
1 70892
1 14877
1 25113
1 25677
1 24916
1 48322
1 29144
1 8588
1 34872
1 71623
1 84642
1 99202
1 20153
1 4903
1 81617
1 68225
1 11179
1 26666
1 23936
1 30540
1 64114
1 65036
1 48731
1 14634
1 8850
1 64753
1 11519
1 13157
1 65468
1 27452
1 14316
1 83880
14675 51788
1 305...

output:

4900118703

result:

ok single line: '4900118703'

Extra Test:

score: 0
Extra Test Passed