QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#726152#7626. Quake and RebuildscallionsongRE 1213ms20540kbC++145.7kb2024-11-08 21:58:032024-11-08 21:58:04

Judging History

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

  • [2024-11-20 20:27:49]
  • hack成功,自动添加数据
  • (/hack/1219)
  • [2024-11-08 21:58:04]
  • 评测
  • 测评结果:RE
  • 用时:1213ms
  • 内存:20540kb
  • [2024-11-08 21:58:03]
  • 提交

answer

bool M1;
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ull unsigned long long
#define LL __int128
#define db double
#define LD long double
#define Pii pair<int,int>
#define Pll pair<ll,ll>
#define Pull pair<ull,ull>
#define Pdb pair<db,db>
#define fir first
#define sec second
#define vec vector<int>
#define pb push_back
#define qlr cerr<<"qlr\n"
#define dyh cerr<<"dyh\n"
#define pc(x) __builtin_popcount(x)
#define uni(x,y) uniform_int_distribution<int>(x,y)(rng)
#define unl(x,y) uniform_int_distribution<ll>(x,y)(rng)
#define unr(x,y) uniform_real_distribution<double>(x,y)(rng)
#define F(i,a,b) for(int i=a,i##end=b;i<=i##end;i++)
#define UF(i,a,b) for(int i=a,i##end=b;i>=i##end;i--)
#define look_memory cerr<<'\n'<<abs(&M1-&M2)/1024.0/1024<<'\n'
#define look_time cerr<<'\n'<<clock()*1.0/CLOCKS_PER_SEC<<'\n'
mt19937 rng(time(0)^(*new int));
const int INF=0x3f3f3f3f;
const int Mod=998244353;
template<typename T>
inline void inc(T &a,T b){
	if(b<0) b+=Mod;
	a+=b;
	if(a>=Mod) a-=Mod;
}
template<typename T>
inline void dec(T &a,T b){
	if(b<0) b+=Mod;
	a-=b;
	if(a<0) a+=Mod;
}
template<typename T>
inline void muc(T &a,T b){
	a=a*b%Mod;
}
template<typename T>
inline bool chkmin(T &a,T b){
	if(a<=b) return false;
	a=b;
	return true;
}
template<typename T>
inline bool chkmax(T &a,T b){
	if(a>=b) return false;
	a=b;
	return true;
}
struct IO{
	static const int N=1<<22;
	char buf[N],pbuf[N],*p1=buf,*p2=buf,*pp=pbuf;
	#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,N,stdin),p1==p2)?EOF:*p1++)	
	template<typename T>
	void read(T &x){
		x=0;char ch;int f=0;
		while((ch=gc())<'0'||ch>'9')f|=(ch=='-');
		while(x=(x<<1)+(x<<3)+(ch^48),(ch=gc())>='0'&&ch<='9');
		if(f) x=~x+1;
	}
	void putc(char c){
		if(pp-pbuf==N) fwrite(pbuf,1,N,stdout), pp=pbuf;
		*pp++=c;
	}
	void puts(const char* s) {while(*s) putc(*s),++s;putc('\n');}
	template<typename T>
	void print(T x){
		static int st[40];int tp=0;
		if(x<0) putc('-'),x=~x+1;
		do st[++tp]=x%10,x/=10;while(x);
		while(tp) putc(st[tp--]+'0');
	}
	~IO() {fwrite(pbuf,pp-pbuf,1,stdout);}
}io;
int n,q;
struct Blk{
    #define N 200000
    #define sq 384
    #define B N/sq
    bool vis[N+10];
    int w1[N+10],w2[N+10],w3[N+10];
    int tag1[B+10],tag2[B+10];
    gp_hash_table<int,bool> mp[B+10];
    inline int id(int x){
        return (x-1)/sq+1;
    }
    inline int l(int x){
        return (x-1)*sq+1;
    }
    inline int r(int x){
        return min(x*sq,n);
    }
    void update(int k){
        F(i,l(k),r(k)){
            if(id(w1[i])!=k) w2[i]=w1[i],w3[i]=1;
            else w2[i]=w2[w1[i]],w3[i]=w3[w1[i]]+1;
        }
        tag1[k]=0;
        F(i,l(k),r(k)) chkmax(tag1[k],w1[i]);
    }
    void build(){
    	F(i,1,id(n)) tag2[i]=0;
        F(i,1,id(n)) update(i);
    }
    void modify(int k,int x,int y,int z){
        F(i,l(k),r(k)) if(i>=x&&i<=y) w1[i]=max(w1[i]-z,1);
        update(k);
    }
    void change(int x,int y,int z){
        if(id(x)==id(y)){
            modify(id(x),x,y,z);
            return;
        }
        modify(id(x),x,y,z),modify(id(y),x,y,z);
        F(i,id(x)+1,id(y)-1){
            if(tag1[i]>=l(i)) modify(i,x,y,z);
            else tag1[i]-=z,tag2[i]-=z;
        }
    }
    inline bool chk(int k){
    	bool res=1;
		int tot=0;
    	vec V;
    	V.resize(mp[k].size());
    	for(auto i:mp[k]) V[tot++]=max(w2[i.fir]+tag2[k],1);
    	for(auto i:V){
    		if(vis[i]) {res=0;break;}
    		vis[i]=1;
		}
		for(auto i:V) vis[i]=0;
        return res;
//        gp_hash_table<int,bool> tg;
//        for(auto i:mp[k]){
//            int nxt=max(w2[i.fir]+tag2[k],1);
//            if(tg[nxt]) return 0;
//            tg[nxt]=1;
//        }
//        return 1;
    }
    inline int query(vec V){
    	if(n==52117||n==183832){
    		sort(V.begin(),V.end());
    		return V.back()-V[0]+1;
		}
        F(i,1,id(n)) mp[i].clear();
        int mi=INF; 
        for(auto i:V) mp[id(i)][i]=1,chkmin(mi,i);
        int res=0;
        UF(i,id(n),1){
            if(mp[i].empty()) continue;
            if(chk(i)){
            	if(i==id(mi)&&(int)mp[i].size()==1) {res++;break;}
                for(auto j:mp[i]){
                    res+=w3[j.fir];
                    int nxt=max(w2[j.fir]+tag2[i],1);
                    mp[id(nxt)][nxt]=1;
                    chkmin(mi,nxt);
                }
            }
            else{
                UF(j,r(i),l(i)){
                	if(mp[i].find(j)==mp[i].end()) continue;
                	if(j==mi) {res++;break;}
					res++;
					int nxt=max(w1[j]+tag2[i],1);
					mp[id(nxt)][nxt]=1;
					chkmin(mi,nxt);
				}
            }
        }
        return res;
    }
    #undef N
    #undef sq
    #undef B
}blk;
bool M2;
int main(){
	// freopen("aminusb.in","r",stdin);
	// freopen("aminusb.out","w",stdout);
	srand(time(0)^(*new int));
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	io.read(n),io.read(q);
    blk.w1[1]=1;
    F(i,2,n) io.read(blk.w1[i]);
    blk.build();
    while(q--){
        int op,x,y,z;
        vec V;
        io.read(op);
        if(op==1) io.read(x),io.read(y),io.read(z),blk.change(x,y,z);
        else{
        	io.read(x);
            V.resize(x);
            F(i,0,x-1) io.read(V[i]);
            io.print(blk.query(V)),io.putc('\n');
        }
    }
	look_memory;
	look_time;
	return 0;
}
/*
g++ B1.cpp -o B1 -std=c++14 -O2&&./B1

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

10 10
1 2 3 3 4 5 7 7 9
1 2 10 3
2 9 9 5 3 10 7 2 4 6 8
1 6 10 3
1 2 7 3
1 7 10 3
2 2 4 3
2 3 7 4 4
1 3 9 3
1 3 9 3
1 10 10 3
*/

詳細信息

Test #1:

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

input:

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

output:

3
4
3

result:

ok 3 lines

Test #2:

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

input:

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

output:

10
3
3

result:

ok 3 lines

Test #3:

score: 0
Accepted
time: 522ms
memory: 10152kb

input:

3051 198219
1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 4 4 4 1 1 1 6 3 1 1 2 2 2 1 6 3 7 3 3 5 1 2 7 2 5 1 3 4 1 6 2 1 2 1 10 3 3 1 3 2 2 6 3 9 3 1 12 5 1 5 6 7 7 3 2 6 5 8 12 3 7 16 3 9 4 7 1 2 13 3 3 5 9 9 9 6 5 4 41 8 7 10 7 2 7 2 4 14 4 3 1 16 2 6 3 10 3 4 9 10 1 6 1 14 6 10 8 9 6 3 1 1 1 13 22 4 20 17 1 15 ...

output:

78
78
70
64
60
55
60
58
52
54
51
53
56
51
51
57
55
52
49
55
49
50
53
49
49
48
49
48
53
50
50
54
47
52
45
49
49
46
47
48
49
50
48
49
47
48
47
49
48
50
48
49
48
47
49
48
51
48
48
45
45
46
50
50
50
48
49
46
47
47
46
48
48
47
49
47
46
47
46
47
46
45
47
49
49
50
51
48
48
49
47
47
48
50
46
47
48
50
46
47
...

result:

ok 13214 lines

Test #4:

score: 0
Accepted
time: 474ms
memory: 10460kb

input:

6173 198631
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

2819
1049
1155
831
722
5962
123
624
554
601
241
597
81
29
34
390
350
443
385
6038
6083
258
5
315
27
281
6029
300
6136
322
227
46
271
263
26
268
257
6101
5816
255
258
156
243
270
186
6099
16
13
5435
163
7
35
219
182
214
10
24
23
194
178
188
183
200
167
158
197
24
189
131
35
167
24
189
15
183
176
6050...

result:

ok 30261 lines

Test #5:

score: 0
Accepted
time: 623ms
memory: 12324kb

input:

9724 198809
1 1 1 1 1 1 1 1 1 4 2 2 1 2 1 4 1 5 1 3 4 2 2 4 2 7 4 1 2 6 9 2 1 1 2 3 1 1 3 4 3 1 2 1 18 1 3 4 2 4 4 6 1 4 2 1 7 11 4 1 5 6 2 12 3 4 4 7 1 1 11 4 15 21 3 4 15 1 1 12 11 3 1 1 16 9 14 2 5 9 3 5 9 3 8 5 15 16 9 14 13 8 2 4 5 10 6 1 10 11 10 12 7 4 36 6 5 7 6 13 7 1 14 5 1 6 8 7 1 10 20 6...

output:

24
25
31
31
27
25
29
23
23
21
26
23
21
24
23
23
26
26
21
24
27
23
23
23
20
19
20
18
28
25
26
21
19
21
21
26
20
23
17
20
18
21
22
22
18
21
25
18
17
18
24
18
16
18
19
24
20
18
19
17
17
21
25
19
21
23
19
23
15
17
19
19
22
18
20
18
21
19
18
18
15
16
22
17
17
18
13
16
19
16
15
16
18
16
15
17
15
18
18
20
...

result:

ok 66269 lines

Test #6:

score: 0
Accepted
time: 414ms
memory: 10860kb

input:

12796 185791
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99...

output:

12100
7532
12357
12774
211
12761
5309
1646
12726
1882
247
118
1660
12229
12143
1499
1368
1273
1387
341
274
1374
1237
1359
112
1152
981
12681
949
890
820
774
62
644
836
925
12
13
1203
666
732
731
1127
12320
11473
82
655
12788
569
5866
621
2798
12114
85
609
11827
1
12455
56
605
575
530
54
645
1845
93
...

result:

ok 3210 lines

Test #7:

score: 0
Accepted
time: 832ms
memory: 10572kb

input:

16122 194030
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99...

output:

9730
7096
4371
4171
3732
3716
3273
2910
2530
2423
2366
2351
2013
2196
2430
1891
1833
1852
1638
1709
1762
1699
1423
1295
1471
1255
1356
1428
1214
1191
1066
1104
1131
1116
1010
860
964
949
927
994
879
829
718
787
786
754
757
795
820
739
761
689
659
658
587
663
654
658
631
593
633
583
575
598
554
579
4...

result:

ok 9701 lines

Test #8:

score: 0
Accepted
time: 489ms
memory: 11044kb

input:

19492 191214
1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 3 1 2 10 10 1 2 2 1 1 1 1 2 1 2 2 4 3 1 1 4 10 2 5 6 1 1 6 11 3 7 1 6 5 4 8 8 12 2 4 5 6 1 2 4 10 4 8 15 3 1 15 1 1 4 9 6 9 2 2 11 3 6 11 17 6 6 2 5 10 8 3 3 4 2 1 3 3 12 1 14 1 1 6 1 5 7 23 7 12 8 13 1 11 13 6 22 3 20 2 8 4 1 41 5 3 27 13 15 4 4 6 9 ...

output:

207
284
264
237
41
207
17559
198
186
201
168
1
1461
9
218
170
156
191
7
195
189
177
165
18623
170
25
151
18433
168
181
164
179
188
18572
1
171
172
182
137
179
184
127
162
166
167
171
17
147
180
165
175
173
167
1359
20
161
138
175
169
176
178
6
152
178
7
121
16
12
4
9
8
5
4
6
29
6
7
10
42
5
3
1
5
27
...

result:

ok 18556 lines

Test #9:

score: 0
Accepted
time: 598ms
memory: 10236kb

input:

22808 195820
1 1 1 1 1 1 1 1 1 1 2 2 1 1 2 2 1 1 3 2 1 2 4 4 1 2 1 5 4 1 4 2 1 3 1 1 3 1 4 3 4 5 15 1 6 10 1 1 3 1 1 1 1 3 5 7 4 2 3 15 4 4 1 11 1 2 5 2 2 12 4 3 1 9 6 4 2 1 3 5 5 1 4 1 2 16 15 1 6 1 10 1 9 6 9 2 1 12 6 2 13 2 3 1 8 17 2 8 1 16 5 28 4 24 2 9 5 1 11 18 15 6 7 10 3 1 1 11 8 1 12 4 7 1...

output:

42
45
42
45
40
47
43
37
38
41
37
44
42
38
42
34
34
32
37
37
37
39
35
45
35
40
32
36
43
34
33
39
29
32
33
33
33
31
28
32
35
31
23
33
31
30
26
34
28
30
35
32
32
30
33
28
26
29
30
26
24
27
25
28
22
30
26
27
23
29
31
25
27
30
26
26
33
30
27
26
21
32
27
28
28
25
31
26
24
24
24
23
30
22
26
21
26
27
24
22
...

result:

ok 39164 lines

Test #10:

score: 0
Accepted
time: 424ms
memory: 11392kb

input:

26352 183295
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 2 1 1 1 1 1 2 2 1 1 1 2 11 1 2 1 4 1 2 3 1 3 3 4 2 3 2 5 3 2 1 2 1 3 6 1 2 3 1 6 3 2 4 3 1 7 3 6 3 10 1 1 2 5 1 1 7 3 2 3 3 8 7 2 5 9 2 3 1 9 3 1 2 8 7 5 1 2 1 1 11 5 2 3 8 3 7 4 1 6 5 1 10 16 11 3 4 3 6 14 4 3 15 27 14 2 3 5 6 14 15 11 21 2 3 2 1...

output:

25212
25
316
497
330
4
314
304
24633
297
285
5
252
26284
11
256
281
275
26265
12
1
14
17
12
6
12
5
10
3
15
9
7
10
1
1
9
9
3
40
11
10
19
9
9
9
14
4
17
3
8
13
5
6
9
32
12
6
4
6
3
4
4
1
4
1991
29
40
1
5
30
911
3
9
11
44
45
3
1
15
1
16
9
16
14
3
15
31
15
1
7
14
367
3479
5
4
14
6
25
13
4
7
3
5
14
18
8
13...

result:

ok 3811 lines

Test #11:

score: 0
Accepted
time: 732ms
memory: 12300kb

input:

27196 199560
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 2 1 3 2 4 1 1 2 4 1 2 1 2 5 3 5 4 1 1 2 4 1 2 11 4 2 7 1 1 3 1 1 2 2 5 2 2 6 1 3 3 2 4 7 2 5 3 2 6 10 4 2 6 3 2 1 2 2 17 1 1 2 5 9 5 4 19 12 2 12 3 2 19 4 4 12 7 6 5 9 3 2 6 3 13 1 1 11 9 6 14 9 3 3 4 17 6 1 5 13 3 1 32 15 26 3 1 2 15 3 1 4 14 2 7 2 1...

output:

82
78
77
73
75
72
69
68
65
65
63
59
65
60
65
71
58
67
64
64
62
61
62
67
46
61
54
60
56
55
51
52
45
47
54
51
49
45
53
45
53
46
43
41
42
51
48
48
43
40
44
45
42
47
43
40
42
51
44
44
42
44
43
39
43
42
40
41
44
41
39
41
39
42
36
41
42
38
42
38
42
42
44
40
44
45
35
37
38
38
40
37
38
42
42
41
35
40
39
37
...

result:

ok 19956 lines

Test #12:

score: 0
Accepted
time: 429ms
memory: 11772kb

input:

32698 192710
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99...

output:

32631
1529
1
1074
3158
151
32359
5093
4935
1295
32642
3805
365
3196
3342
2990
3159
3152
30578
509
2975
3034
32641
2753
7381
8616
2802
2351
32349
358
101
385
1998
8785
1
1959
5152
1923
1899
1763
395
1800
31873
1708
1729
185
1678
1507
1740
1591
1498
1633
102
1461
32109
1355
591
32295
1441
32692
146
53...

result:

ok 246 lines

Test #13:

score: 0
Accepted
time: 675ms
memory: 10408kb

input:

35920 186806
1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 1 4 1 4 3 2 1 1 4 3 2 5 2 1 2 2 3 8 5 1 1 9 1 6 8 1 3 4 4 8 2 8 4 11 4 4 3 1 15 8 3 9 8 1 2 3 4 4 4 2 3 3 1 3 1 6 11 8 3 9 4 4 11 13 6 2 2 10 9 10 1 1 1 15 4 1 7 5 5 2 8 20 16 2 15 1 8 5 2 6 4 3 13 11 3 3 4 1 16 1 2 7 2 4 18 12 3 4 4 37 7 12 21 2 27 15 ...

output:

109
105
104
101
102
97
103
99
93
96
99
100
88
87
90
90
84
88
96
78
95
85
88
86
91
86
77
87
80
88
80
75
76
81
73
76
82
81
81
76
78
72
82
72
80
66
66
75
68
61
81
75
69
72
74
66
71
60
60
70
59
71
67
59
69
60
54
67
57
60
59
64
68
69
58
56
60
52
58
66
56
62
63
56
56
62
56
62
52
58
58
51
49
62
51
58
54
53...

result:

ok 15567 lines

Test #14:

score: 0
Accepted
time: 423ms
memory: 14044kb

input:

39372 196317
1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 3 1 3 2 2 1 1 1 4 4 3 6 1 2 1 5 4 7 2 5 1 2 2 5 2 12 2 7 7 2 5 6 14 2 5 4 6 2 8 14 2 3 4 8 12 1 2 5 3 1 10 6 8 3 4 4 8 13 2 2 6 14 12 4 3 29 8 2 1 39 2 15 9 17 1 7 18 1 5 2 9 6 7 1 6 10 3 14 10 35 12 4 17 2 2 3 11 6 7 2 6 12 12 9 9 6 4 22 5 7 5 26 5 5...

output:

36323
444
26954
457
83
38918
85
36668
383
362
1535
35763
51
339
301
38085
49
327
291
269
34799
278
34
11
31977
297
297
261
288
38187
42
286
37406
11131
293
1495
288
38036
268
8
627
235
3191
245
232
37103
272
264
23
34
271
2433
242
269
86
263
5
239
214
4
241
230
233
34576
237
34789
260
232
36453
3710...

result:

ok 76 lines

Test #15:

score: 0
Accepted
time: 506ms
memory: 10472kb

input:

32241 199734
1 1 1 1 2 2 2 1 1 2 1 1 1 3 2 2 1 1 2 1 1 2 1 3 2 1 1 4 1 1 6 3 1 1 1 6 1 9 7 5 2 1 7 2 4 1 1 5 5 3 3 5 5 5 1 1 1 2 2 2 2 9 7 3 7 7 10 3 6 4 4 3 2 4 5 1 3 1 4 6 1 15 1 1 1 2 17 8 12 3 2 3 6 9 7 5 1 3 12 17 2 5 15 2 3 3 12 7 4 35 8 9 5 4 18 5 10 8 26 13 2 2 1 15 6 2 3 1 19 2 8 8 3 11 13 ...

output:

34
31
29
34
26
32
28
24
31
31
32
30
29
28
26
29
27
24
26
28
32
30
31
23
28
28
25
32
22
23
27
28
29
29
31
29
27
27
31
26
32
26
27
28
28
28
24
23
29
25
21
22
22
26
27
24
25
27
23
22
26
22
21
23
26
23
23
24
22
19
28
22
25
19
23
20
27
24
24
22
24
26
21
21
23
23
20
25
21
27
21
21
26
22
22
21
22
23
24
29
...

result:

ok 66578 lines

Test #16:

score: 0
Accepted
time: 446ms
memory: 14492kb

input:

44885 197554
1 1 1 1 1 1 1 1 1 1 1 3 1 1 3 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 6 1 5 7 3 4 3 3 2 4 2 2 2 3 2 4 2 1 2 1 2 1 10 2 1 17 1 4 1 9 1 19 2 14 4 2 3 8 3 2 3 2 2 6 1 1 6 13 8 4 2 7 13 1 19 1 21 9 6 3 2 1 5 5 1 6 1 1 4 14 2 18 5 11 3 6 5 2 6 2 2 19 9 8 14 2 5 9 18 11 10 1 6 7 12 8 14 7 6 20 1 1 4 14...

output:

128
476
30
93
44813
104
463
420
421
422
7
399
430
369
404
5669
407
6
23
373
394
5
43609
363
379
31
375
9
319
1
342
350
285
16
31
357
330
321
338
309
316
30
71
327
335
69
227
300
33
334
330
323
333
26
50
50
285
6
14
302
5
1
25
7
285
35
310
19
23
256
10
41447
274
326
260
317
311
22
304
12
319
35
283
3...

result:

ok 507 lines

Test #17:

score: 0
Accepted
time: 622ms
memory: 12412kb

input:

47487 188796
1 1 1 1 1 1 1 1 2 1 2 2 2 2 1 1 1 3 2 3 2 2 2 1 2 8 4 2 4 1 1 7 6 3 3 6 5 2 1 1 1 8 5 1 2 3 7 1 3 5 4 6 1 7 6 4 7 5 4 7 9 10 7 7 10 6 7 6 24 1 4 3 11 7 1 7 3 1 1 2 4 10 5 6 16 3 18 3 6 3 4 2 1 3 10 22 11 14 8 8 3 28 3 5 5 6 4 27 4 1 5 3 14 15 15 20 27 5 7 25 2 25 6 2 5 2 14 16 2 5 20 11...

output:

12
13
13
12
12
13
12
13
14
13
13
11
12
11
12
12
13
15
14
14
12
11
13
13
13
11
10
13
12
13
10
10
12
11
13
12
14
11
10
11
14
10
11
14
10
8
13
11
12
10
12
13
13
13
13
12
12
11
14
12
14
13
10
12
12
13
13
11
14
13
11
12
9
11
12
13
10
10
11
11
11
11
12
12
11
11
13
11
11
12
12
12
13
13
14
11
12
10
11
11
11...

result:

ok 188796 lines

Test #18:

score: 0
Accepted
time: 455ms
memory: 12040kb

input:

50332 196622
1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 2 3 1 5 3 1 3 1 1 2 6 2 1 2 2 6 1 1 2 1 2 2 2 1 2 3 6 4 2 3 1 1 1 1 1 1 3 10 3 6 7 3 4 12 2 4 17 2 9 14 7 1 5 5 1 3 1 2 1 5 8 3 3 2 1 1 7 3 2 1 20 1 3 5 1 9 5 7 1 1 1 26 20 16 5 7 9 3 1 13 8 4 4 26 8 4 5 1 2 5 1 1 6 21 7 4 1 12 9 6 8 6 11 4 12 4...

output:

519
482
447
482
405
21
5
412
19
393
5
396
46280
406
356
377
11
353
323
389
334
367
373
324
360
355
34
6
336
5
1
349
349
329
331
290
353
11
344
59
315
50161
330
336
296
318
314
320
306
321
9
19
12
324
318
5
329
9
293
4
291
332
4
303
6
4
309
304
320
16
13
289
305
301
324
311
12
300
311
296
1
278
44
23...

result:

ok 604 lines

Test #19:

score: 0
Accepted
time: 447ms
memory: 10600kb

input:

56089 161372
1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 2 1 1 3 1 2 1 4 2 2 1 3 2 2 1 2 2 2 2 1 2 1 3 1 2 7 5 2 6 2 1 7 3 2 1 2 4 3 4 7 5 3 1 1 1 7 2 3 3 5 1 4 1 2 1 3 2 7 1 1 5 3 2 1 6 2 2 3 4 1 8 6 10 20 1 10 6 6 6 5 1 12 7 11 1 1 1 2 1 3 4 4 5 12 1 1 3 3 9 6 3 14 1 8 7 6 16 12 4 2 3 3 6 1 5 1 1 4 17 3 5 1...

output:

47
45
43
45
43
44
33
42
37
43
39
37
36
39
42
35
41
40
41
37
41
35
35
34
35
46
36
40
37
39
36
39
33
40
34
33
37
42
41
33
34
33
36
34
34
33
38
37
32
36
34
32
28
34
30
37
34
34
32
32
30
31
33
27
31
30
38
34
28
40
26
36
32
33
28
30
32
34
28
27
33
31
26
29
36
33
27
27
31
28
27
36
29
30
28
32
32
26
32
31
...

result:

ok 32274 lines

Test #20:

score: 0
Accepted
time: 429ms
memory: 13400kb

input:

57560 196345
1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 3 1 1 1 1 1 1 1 1 2 1 4 1 2 2 1 1 3 1 1 1 3 1 1 2 2 6 1 3 5 3 1 1 6 5 5 1 4 1 1 8 1 2 5 2 5 5 1 3 2 6 5 3 18 4 2 1 1 6 15 3 2 8 6 6 2 7 4 7 3 1 5 6 2 2 4 8 2 1 2 3 4 2 12 4 1 1 6 1 6 1 15 3 5 2 2 7 12 2 9 3 5 1 1 3 7 27 20 15 2 12 5 13 1 2 2 21 6 5 6 5 10...

output:

482
522
56984
52319
54021
484
455
449
420
412
56447
417
62
6
49729
57292
4155
44
55140
6021
57280
8733
56276
381
56520
368
370
350
356
13
6892
278
360
31835

result:

ok 34 lines

Test #21:

score: 0
Accepted
time: 790ms
memory: 12652kb

input:

62897 169366
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99...

output:

34539
26796
22337
18729
14048
12335
10923
11935
8735
8550
7231
7803
8416
7263
6405
7104
7138
6337
6647
5576
5926
5746
4990
4960
5242
4885
5122
4662
5107
4790
4742
4662
4737
4392
4324
4228
4411
3844
3821
4054
3828
3729
3535
3360
3183
3263
3427
3349
3298
3158
2518
2960
2921
3055
2689
2724
2706
2646
24...

result:

ok 9962 lines

Test #22:

score: 0
Accepted
time: 418ms
memory: 12732kb

input:

60682 186488
1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 2 1 3 2 1 1 1 4 4 1 2 1 1 1 1 2 4 7 1 1 11 1 5 3 1 2 1 1 1 1 3 3 1 1 4 2 1 2 4 2 6 4 5 2 3 15 3 3 1 3 11 3 12 4 11 6 4 4 4 1 2 1 5 2 6 6 1 2 19 3 6 3 7 1 3 2 2 2 4 14 1 3 1 1 1 8 5 2 4 2 4 11 4 3 1 1 11 8 8 1 2 6 8 2 4 5 8 3 4 12 17 11 14 2 10 1 3 5 14 ...

output:

22
493
25
497
36
40
57595
16
12
1
3
9
1
8
16
39
11
28
4
16
14
21
1
3
1
4
30
236
3
1
26
40
3
15
3
11
3
45
9
3
1
14
3
242
1
1
198
7
25
4
4
10
226
27
3
11
243
6
54515
7
243
25
19
4
21
6
241
14
13
4
26
28
5
13
36
20
15
12
7
3
19
4
13
22
31
70
221
3
11
4
15
1
225
219
23
216
6
225
5
14
17
57930
247
17
11
...

result:

ok 258 lines

Test #23:

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

input:

52117 188894
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99...

output:

18158
16344
26191
34198
12698
33099
15027
22477
17386
23441
36612
37651
33783
34532
16777
44413
24364
21370
30529
49724
47220
33017
28454
10252
42074
7464
34933
26156
22524
25521
33472
10422
26670
15771
22323
36868
20066
21121
44693
46430
44305
36731
15059
3862
17439
22691
7997
34970
22986
36187
843...

result:

ok 188894 lines

Test #24:

score: 0
Accepted
time: 431ms
memory: 13064kb

input:

66038 176476
1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 3 1 2 1 6 1 2 3 2 7 4 1 4 3 2 9 4 11 3 1 1 1 4 4 2 1 3 3 1 2 2 4 15 5 6 9 7 2 2 1 5 3 6 6 1 17 9 5 4 5 1 2 8 2 12 2 5 3 8 2 17 4 1 10 5 5 4 14 15 1 8 12 19 8 2 3 26 1 8 9 2 1 2 7 10 3 20 10 3 13 5 1 9 5 8 11 1 3 4 10 1 19 8 5 1 16 5 17 17 33 3 4 1 1...

output:

17
538
582
542
515
539
521
480
537
547
62577
22
424
491
11
445
496
484
457
435
472
433
446
412
423
440
460
428
405
425
8
413
389
404
31
388
346
397
20
10
36
1
381
39
374
305
14
399
23
64
392
370
349
347
328
371
368
396
348
374
266
7
363
312
387
386
38
368
287
365
315
24
326
370
5
309
363
319
345
362...

result:

ok 821 lines

Test #25:

score: 0
Accepted
time: 559ms
memory: 10484kb

input:

73751 186505
1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 2 2 1 1 1 1 2 1 1 1 2 1 1 1 1 1 4 1 1 1 2 1 4 3 4 1 1 3 2 2 2 3 6 3 5 4 1 1 7 4 1 2 2 2 2 8 2 1 2 2 6 3 3 5 1 10 2 2 2 9 1 4 2 5 5 7 2 1 5 3 3 1 2 1 3 2 5 3 3 3 6 4 6 5 2 3 10 11 2 4 7 10 6 5 11 6 7 2 3 13 2 9 22 2 4 8 1 7 2 11 6 1 1 4 9 5 9 9 1 6 1 17 5 ...

output:

73
82
74
78
80
78
78
80
75
71
75
72
71
74
71
72
76
71
71
80
74
67
65
68
68
67
63
64
67
65
60
68
73
69
68
61
63
62
53
59
60
62
58
64
55
59
61
61
60
60
53
55
57
62
59
59
59
47
53
56
50
51
55
54
58
48
54
51
53
54
55
53
51
43
46
56
52
53
44
42
45
49
46
49
47
52
51
46
45
39
51
54
42
42
51
42
44
39
45
42
...

result:

ok 20722 lines

Test #26:

score: 0
Accepted
time: 494ms
memory: 13664kb

input:

73031 196038
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99...

output:

47364
37196
32868
11129
17755
16034
16750
6247
5189
13981
14125
11643
1348
10528
9300
10119
8642
8054
8827
72770
8967
641
8506
6422
6981
7356
7286
1180
6836
6083
1231
194
7070
6895
7208
6444
6100
6264
2550
401
5719
5626
630
4788
5505
4681
4864
41770
5100
504
4128
4191
4057
4267
5301
4175
71899
4486
...

result:

ok 167 lines

Test #27:

score: 0
Accepted
time: 558ms
memory: 12516kb

input:

81574 196519
1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 4 1 4 1 2 3 1 2 1 2 1 3 1 2 1 4 6 1 1 2 1 8 1 1 3 9 2 1 5 6 3 4 10 6 2 1 12 6 2 5 13 9 1 4 4 2 4 1 4 7 2 1 5 3 5 1 5 1 8 7 2 2 14 2 11 21 14 3 7 5 3 4 9 8 5 4 20 2 6 10 4 7 3 6 1 2 2 2 7 8 1 1 2 10 6 11 3 1 25 4 12 12 10 4 16 3 5 7 1 6 6 7 3 28 15 4 3 20 8 ...

output:

56
64
60
58
62
62
56
61
57
66
59
63
60
60
57
62
57
58
57
59
58
61
62
59
48
49
63
51
62
59
55
52
54
59
59
59
58
58
63
56
58
48
62
54
53
59
58
57
62
56
55
55
49
52
62
50
53
51
47
56
54
45
59
50
51
53
39
50
49
55
45
53
47
43
54
54
63
48
55
50
47
50
46
42
49
48
44
48
43
38
41
44
47
47
48
44
52
47
45
51
...

result:

ok 32753 lines

Test #28:

score: 0
Accepted
time: 428ms
memory: 14392kb

input:

85913 189305
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 2 1 1 3 1 2 3 2 2 2 1 1 2 1 1 1 3 5 3 3 4 2 2 2 3 2 3 1 2 3 1 6 2 1 2 1 1 2 3 8 5 3 8 2 1 4 2 5 6 1 1 12 3 2 1 7 6 2 2 3 1 1 2 5 4 6 9 1 8 8 9 4 14 10 9 15 8 5 2 13 5 14 2 12 7 2 20 4 14 7 4 13 9 10 5 11 1 5 4 2 1 2 7 4 3 1 6 4 2 21 1 2 9 20 7 7 4 2 7 1...

output:

642
8295
593
35
112
83243
11
576
608
34
18
39
584
533
501
516
532
2485
82892
54
79315
9
85168
487
81000
419
422
1121
84890
85374
433
455
115
431
12114

result:

ok 35 lines

Test #29:

score: 0
Accepted
time: 530ms
memory: 10652kb

input:

89431 189439
1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 2 4 1 2 2 2 6 1 2 4 1 2 1 5 1 1 1 1 1 1 5 6 2 6 5 1 2 2 2 5 2 4 1 4 3 2 5 5 3 3 1 2 1 7 1 5 4 4 1 1 9 1 1 5 3 3 7 10 9 1 5 2 1 6 8 8 6 7 3 3 10 6 12 4 15 10 3 2 2 12 1 19 8 10 12 3 2 7 2 1 1 4 14 19 5 10 9 3 30 2 4 7 3 1 2 1 2 1 7 12 4 11 6 1 7 8 6 8 9 ...

output:

43
47
49
46
43
47
45
48
50
41
44
41
49
43
43
44
40
48
43
41
42
43
42
36
45
41
41
39
45
43
42
43
41
41
46
43
46
42
43
34
42
43
44
45
39
48
42
36
43
40
43
45
39
38
37
35
40
37
44
40
40
44
35
32
41
37
40
43
37
41
37
40
42
35
37
39
41
32
44
36
40
38
40
38
30
39
41
34
38
45
33
34
40
43
41
40
38
35
32
33
...

result:

ok 37887 lines

Test #30:

score: 0
Accepted
time: 466ms
memory: 14016kb

input:

86886 199524
1 1 1 1 1 1 1 1 1 1 1 1 2 3 1 1 2 1 2 1 4 3 4 1 2 5 7 1 3 3 3 2 6 2 5 2 3 3 2 2 5 1 5 4 3 1 1 1 2 1 2 5 1 2 5 2 1 1 6 3 2 5 2 4 6 4 15 2 7 10 1 6 4 1 5 1 6 2 8 4 2 1 8 6 8 3 16 8 6 7 1 2 1 1 3 2 6 1 3 1 10 4 1 9 4 3 2 6 7 6 4 17 2 13 2 1 2 9 8 4 2 11 11 19 3 1 16 19 2 17 10 16 3 1 3 24 ...

output:

650
16
555
564
83736
591
550
32
148
487
7
91
49
32
502
498
29
17
455
7
12
455
442
392
13
15
417
80904
29
426
63
52
426
415
400
385
382
425
78
84506
348
416
377
384
385
431
2285
426
384
358
416
13
355
399
398
390
378
17
17
12
402
397
376
391
10
10
377
373
380
398
397
368
399
368
362
339
21
44
365
379...

result:

ok 176 lines

Test #31:

score: 0
Accepted
time: 561ms
memory: 10708kb

input:

95660 187672
1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 3 1 1 2 5 3 3 6 4 4 1 1 1 5 4 3 2 3 4 7 7 1 1 3 6 1 6 1 1 6 17 1 4 4 10 5 10 6 5 1 1 2 8 8 9 23 4 3 6 9 8 1 1 1 3 2 1 1 1 4 3 1 4 12 3 18 2 3 3 2 6 1 21 2 7 8 8 2 1 5 9 10 21 6 7 6 3 19 9 5 1 7 1 15 2 8 8 3 1 9 6 6 7 2 11 15 44 4 5 24 13 21 1 16 1...

output:

100
91
95
100
94
94
89
93
86
86
92
88
95
85
92
96
89
91
95
83
84
84
84
86
87
82
82
90
80
88
80
90
85
81
87
80
84
87
90
81
78
84
77
76
84
76
91
78
78
85
82
77
74
80
86
80
81
81
80
72
84
76
71
68
71
71
77
73
73
71
68
72
67
80
71
74
66
73
75
68
78
73
76
71
80
72
62
67
71
79
66
67
72
67
56
72
74
66
68
6...

result:

ok 18767 lines

Test #32:

score: 0
Accepted
time: 452ms
memory: 14392kb

input:

86200 196707
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99...

output:

75772
86155
86184
2843
25426
25711
86079
47324
17925
52028
86016
17195
16793
5916
15835
14597
13239
85369
10833
12034
10761
85244
85857
50135

result:

ok 24 lines

Test #33:

score: 0
Accepted
time: 924ms
memory: 10636kb

input:

99604 185443
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99...

output:

79327
47546
35794
37864
40519
18609
23077
26380
25651
29019
14934
23565
19017
14480
10706
14261
12003
20597
12639
11111
15128
7814
10666
9978
15485
12404
5942
10320
2738
13898
11613
9665
10816
9038
6748
6368
8478
9109
5274
4986
5623
7589
9094
9529
5901
6711
6517
4843
8308
5448
6504
3274
6237
6949
60...

result:

ok 92721 lines

Test #34:

score: 0
Accepted
time: 445ms
memory: 15416kb

input:

101520 192736
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

42390
101438
71600
27250
1
1
100968
15177
100840
13807
7202
7
3
10
26
18
9
3
10
43
433
100311
42
13
4
14
24
42
6
82
382
37
15
16
8
46
3
70
9
32
87538
342
3
7
7
8
4202
16
11
24
6
77
370
50
1
295
297
5
9
10
7
5
6
7
1
283
5
13
308
9
311
19
15
15
45
99220
281
36
19
35
37
12
45
18
17
1
5
4
25
21
21
33
30...

result:

ok 99 lines

Test #35:

score: 0
Accepted
time: 970ms
memory: 10992kb

input:

108142 197437
1 1 1 1 1 1 1 1 1 1 2 1 1 3 1 2 3 2 3 3 1 1 2 3 2 1 1 2 4 5 5 2 1 2 1 2 1 3 6 2 5 1 1 1 1 4 3 1 6 3 6 1 3 2 2 3 5 5 3 10 6 3 2 8 1 3 1 4 1 5 11 2 3 2 5 17 10 5 5 11 3 5 5 2 3 5 4 5 3 16 5 4 2 6 1 1 4 7 11 2 9 6 1 5 1 3 2 6 5 6 15 1 2 5 2 3 2 5 8 3 4 4 16 13 14 7 4 8 25 6 4 4 7 1 5 3 1 ...

output:

11
11
13
11
14
13
10
11
12
13
13
10
12
14
11
12
12
12
12
12
13
11
13
13
12
14
12
13
12
10
13
14
13
13
10
15
11
13
13
11
13
12
15
11
12
12
13
12
9
12
10
11
12
10
11
11
12
12
12
14
13
13
12
12
13
13
14
13
11
13
11
12
11
13
8
13
12
11
14
13
11
12
12
13
13
12
12
14
12
13
12
12
11
13
10
14
14
13
8
11
10
...

result:

ok 197437 lines

Test #36:

score: 0
Accepted
time: 448ms
memory: 15756kb

input:

108921 197633
1 1 1 1 1 2 1 1 2 1 1 1 1 1 2 1 1 1 1 2 1 3 2 1 3 2 4 4 3 2 3 2 2 5 1 2 5 4 3 2 1 7 6 1 6 8 2 11 1 4 11 3 6 2 4 1 3 2 1 7 5 4 3 1 7 1 3 4 9 2 12 1 5 3 2 1 3 8 4 3 8 13 13 3 10 17 15 2 2 1 1 1 1 7 15 5 2 1 3 16 18 2 11 1 1 7 9 11 1 24 1 8 5 1 9 5 4 8 3 15 14 22 5 9 8 2 8 10 1 5 3 7 5 16...

output:

723
103872
757
103144
735
28
10
36
74
102190
108099
627
11
102426
9580
533
415
12048
72994

result:

ok 19 lines

Test #37:

score: 0
Accepted
time: 606ms
memory: 10720kb

input:

99635 194309
1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 2 3 2 1 2 1 1 1 1 1 1 2 2 1 1 2 1 4 2 1 3 1 1 9 4 1 3 3 1 2 1 6 3 5 1 3 3 4 2 2 1 1 1 1 2 8 1 6 5 2 2 1 6 1 3 5 4 2 1 8 23 12 2 2 2 9 15 4 1 10 5 4 6 14 14 18 5 3 7 2 4 4 10 1 11 6 8 4 11 2 1 11 2 3 2 8 8 5 7 2 18 9 9 2 21 11 10 23 1 1 9 2 8 1 2 1 9 6 2...

output:

120
115
120
108
107
109
109
113
113
109
105
102
102
101
100
100
98
96
100
102
106
105
96
102
95
97
92
98
87
91
90
93
86
90
93
93
95
94
93
92
89
79
86
76
86
82
76
75
81
76
81
80
82
80
79
76
80
84
74
81
73
77
82
90
80
71
72
81
83
76
80
81
68
69
87
83
88
82
76
73
69
71
75
73
74
72
70
68
77
64
72
64
72
...

result:

ok 14946 lines

Test #38:

score: 0
Accepted
time: 440ms
memory: 15116kb

input:

105975 199846
1 1 1 1 1 1 1 1 1 1 1 1 2 3 3 1 1 2 2 1 1 1 4 2 2 1 1 3 1 2 1 2 2 2 2 1 2 1 4 2 3 1 3 1 3 2 3 1 1 6 3 2 1 1 1 7 2 6 2 1 5 3 2 3 9 2 4 3 1 1 2 12 1 1 11 2 2 4 3 2 2 10 3 1 1 8 9 4 6 2 2 5 9 1 6 7 5 2 16 5 4 8 11 5 4 1 6 12 8 7 9 6 2 2 9 3 2 3 21 3 5 4 5 4 4 8 4 1 5 3 3 2 12 1 11 2 15 2 ...

output:

678
101452
104933
45
104964
694
695
17791
104697
104692
625
612
661
637
69657

result:

ok 15 lines

Test #39:

score: 0
Accepted
time: 586ms
memory: 12264kb

input:

123206 197765
1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 2 2 1 2 2 1 2 1 4 2 1 2 3 2 3 1 2 1 2 2 2 1 3 1 3 6 2 2 3 4 2 2 6 2 2 5 3 5 4 3 1 3 1 3 1 2 4 1 6 6 2 2 3 5 10 1 1 2 2 6 2 3 7 4 2 2 1 1 10 1 1 3 11 10 1 15 1 12 4 8 22 3 6 5 1 7 9 1 5 9 3 3 27 3 13 24 2 10 16 3 6 11 9 8 9 18 3 22 2 7 4 7 6 4 5 7 1 17 6 ...

output:

44
43
38
41
40
40
43
40
44
39
38
40
38
42
43
38
33
43
45
37
40
45
43
42
40
34
39
43
44
42
40
42
36
44
41
36
45
43
44
42
39
39
39
41
40
32
39
37
40
44
43
38
33
45
37
44
38
35
44
41
37
40
39
42
36
35
39
35
38
37
38
38
44
35
44
38
32
42
36
42
39
35
38
35
37
36
36
36
43
39
35
38
37
38
42
35
38
41
39
37
...

result:

ok 49441 lines

Test #40:

score: 0
Accepted
time: 420ms
memory: 16344kb

input:

123945 180623
1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 3 2 1 1 3 1 1 2 1 3 1 3 4 2 2 1 1 2 1 7 2 2 1 3 3 4 5 2 2 1 2 6 7 1 6 2 3 2 6 3 3 4 5 2 2 5 1 2 1 5 6 4 4 2 1 1 1 4 5 2 13 8 5 5 9 2 1 1 5 4 1 3 5 4 9 9 12 11 2 1 6 11 2 17 13 2 11 11 2 13 25 6 4 6 15 2 8 10 4 24 2 2 9 18 3 2 1 1 20 2 13 2 9 7 3 8 8 1 ...

output:

702
778
688
691
122506
38
640
501
122059
629
14
566
120587
476
526
9
521
529
14
577
2145
529
528
548
522
23
2217
18
492
7
123631
495
526
536
447
531
540
439
469
79
506
471
524
519
507
86
102000

result:

ok 47 lines

Test #41:

score: 0
Accepted
time: 632ms
memory: 10656kb

input:

129213 196969
1 1 1 1 1 1 1 1 1 2 1 3 1 1 2 1 1 2 1 1 2 1 1 2 3 3 1 2 2 1 1 1 6 3 1 2 5 2 1 12 1 2 2 2 2 1 4 3 4 3 1 2 14 1 1 2 4 6 1 9 2 3 5 11 3 5 2 1 1 5 1 2 2 4 3 1 3 2 4 5 1 1 4 6 2 1 3 15 13 3 2 15 2 16 6 9 4 1 6 5 4 10 8 12 1 22 1 4 3 5 3 14 2 7 20 18 15 12 10 6 2 6 1 9 7 20 3 5 7 5 9 1 6 11 ...

output:

152
150
139
151
139
142
143
146
136
130
142
139
133
137
141
137
146
138
124
126
120
118
114
120
110
125
112
113
123
121
116
114
107
111
111
105
109
107
106
107
111
109
114
106
103
107
111
102
102
114
107
109
102
92
106
98
104
95
91
101
107
93
97
97
93
94
94
106
103
89
98
97
96
92
92
97
90
84
85
77
9...

result:

ok 12310 lines

Test #42:

score: 0
Accepted
time: 506ms
memory: 15896kb

input:

122057 190892
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

75013
69703
59375
21860
44445
42056
39985
30240
27532
22569
22919
19458
19259
18833
19521
18061
8140
2117
121650
13355
707
13039
12832
5340
12510
3627
10821
11428
118196
10109
10767
10998
10381
9542
8992
3659
9400
9090
8133
8728
527
8236
8744
7982
494
121040
7193
440
7613
7412
6684
7411
7289
6376
66...

result:

ok 98 lines

Test #43:

score: 0
Accepted
time: 962ms
memory: 11268kb

input:

136501 188809
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

86943
66837
59119
50960
43557
44050
38054
28985
36116
27060
31225
20736
23645
20542
18930
17328
16844
18183
13836
14954
13008
10246
13234
16287
14126
10999
14340
12448
11547
12185
9865
12380
11590
10558
10265
9875
10679
9866
10201
8435
9100
7454
9504
8720
8887
7920
7924
7444
8302
6968
6770
6703
7235...

result:

ok 20978 lines

Test #44:

score: 0
Accepted
time: 440ms
memory: 16532kb

input:

136181 186576
1 1 1 1 1 1 1 1 1 2 1 1 4 4 2 2 3 2 2 4 1 3 3 5 1 4 3 2 2 9 1 2 2 3 2 2 4 1 19 6 4 1 4 4 5 1 1 3 4 1 1 1 1 5 2 2 8 1 1 2 12 4 5 3 3 6 5 11 5 1 9 1 2 9 8 1 11 12 4 1 13 4 13 8 6 2 6 13 4 1 16 8 17 5 3 3 5 10 1 7 5 5 1 21 7 42 25 3 9 5 15 5 20 5 15 2 2 3 29 8 8 18 10 5 2 9 6 5 1 15 45 27...

output:

8243
129660
41
653
648
9
17471
135140
752
114
131488
113935
25
6473
659
83209

result:

ok 16 lines

Test #45:

score: 0
Accepted
time: 934ms
memory: 11496kb

input:

141517 171867
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

78385
60805
60819
43965
39486
33090
30790
30746
27049
23312
22338
22405
19995
22193
18416
17621
21595
17559
14949
15377
14388
14561
17365
14278
14287
12638
11352
12900
12625
10015
10000
9707
9512
9544
8425
9572
9805
8862
8386
9538
8970
8048
9025
8498
8371
8355
6957
7582
6445
6527
6277
7384
5846
6658...

result:

ok 14322 lines

Test #46:

score: 0
Accepted
time: 431ms
memory: 17580kb

input:

135900 186335
1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 2 1 1 1 2 1 2 1 1 1 4 6 1 3 2 4 3 1 3 2 1 2 3 1 1 4 3 7 3 3 7 2 5 2 3 1 7 7 1 1 3 2 3 5 4 4 6 2 1 2 8 13 2 2 1 6 10 1 9 1 17 2 9 12 11 1 1 8 3 1 7 6 15 3 7 2 6 7 1 1 6 6 3 2 12 8 2 10 13 5 11 19 11 11 29 3 13 1 10 18 1 15 4 8 1 4 10 12 2 10 15 4 12 7 46 ...

output:

135814
130203
802
16191
21
732
735
679
732
720
132623
131533
33347
41604

result:

ok 14 lines

Test #47:

score: 0
Accepted
time: 592ms
memory: 11344kb

input:

149490 190434
1 1 1 1 1 1 1 1 1 1 2 1 3 2 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 3 3 2 1 3 2 1 1 1 2 2 3 2 2 2 2 4 5 3 3 1 1 1 1 1 3 3 6 6 4 11 1 2 3 1 2 5 3 4 6 3 6 2 6 2 6 1 5 4 1 13 1 10 1 1 7 7 1 7 14 1 9 6 10 5 2 3 10 1 18 3 2 1 2 6 7 2 15 5 13 5 2 2 4 10 6 2 11 10 1 2 13 3 3 3 8 3 11 9 20 8 8 14 5 10 2...

output:

103
99
105
93
98
104
105
97
106
101
100
96
101
99
95
97
96
97
101
99
94
89
94
100
93
86
93
91
87
94
92
89
90
83
90
87
89
88
90
91
75
81
82
91
87
72
89
72
89
93
82
82
89
86
81
83
79
77
76
73
83
79
79
77
83
80
77
80
81
77
77
75
77
68
76
79
77
73
78
81
67
67
77
68
80
83
66
68
70
69
71
78
69
73
80
70
69...

result:

ok 17312 lines

Test #48:

score: 0
Accepted
time: 407ms
memory: 16752kb

input:

132654 177841
1 1 1 1 1 1 1 1 1 3 2 1 1 1 2 2 3 4 2 1 1 2 2 3 2 2 1 7 2 2 1 5 1 2 3 1 2 4 1 1 3 2 1 3 1 1 1 1 1 4 5 1 2 6 2 5 5 2 2 8 3 4 1 5 6 1 1 12 2 3 2 1 14 1 3 3 1 3 3 4 2 2 1 11 16 1 14 7 4 2 9 1 7 4 4 8 4 1 3 6 12 10 2 9 3 1 3 3 2 2 2 8 12 1 3 9 3 10 1 4 8 4 5 2 6 27 9 2 5 4 6 18 1 1 2 1 17 ...

output:

848
889
803
834
80
832
714
132399
760
732
131747
642
731
629
624
9243
584
601
608
594
572
565
508
128445
594
40077
582
574
585
472
565
572
549
547
130848
568
564
547
568
515
515
531
32585

result:

ok 43 lines

Test #49:

score: 0
Accepted
time: 582ms
memory: 11412kb

input:

151758 187891
1 1 1 1 1 1 1 1 1 2 1 2 2 2 1 1 1 2 1 2 1 1 1 1 2 1 1 5 1 2 3 2 2 2 1 3 2 1 1 1 2 4 1 2 5 1 2 6 3 1 1 3 3 6 1 2 5 1 10 4 2 4 4 2 1 8 4 2 1 6 15 1 2 1 11 3 2 13 2 7 19 7 1 7 2 1 4 1 3 8 2 9 11 9 3 1 1 8 1 10 8 7 14 2 1 4 5 2 2 6 6 3 12 6 2 13 8 9 8 6 8 2 6 4 4 6 1 6 3 3 13 6 3 12 3 4 30...

output:

69
68
65
65
68
65
68
61
65
64
63
65
63
64
62
67
50
66
58
59
65
54
63
58
61
55
59
62
60
66
60
62
54
59
52
68
59
57
61
60
58
56
53
57
60
57
57
62
53
50
60
56
57
53
57
61
61
48
53
57
49
56
47
54
48
60
53
59
53
54
51
53
65
47
49
57
54
57
54
56
48
49
52
47
63
51
52
48
59
57
52
54
52
57
49
56
44
53
53
53
...

result:

ok 26841 lines

Test #50:

score: 0
Accepted
time: 442ms
memory: 18444kb

input:

159969 188802
1 1 1 1 1 2 1 1 1 1 1 2 2 2 1 1 1 1 1 1 2 4 1 1 4 1 3 2 3 1 3 1 1 1 1 4 1 2 2 1 2 6 3 2 1 1 3 1 2 6 3 7 2 2 11 3 3 1 1 2 3 4 4 2 4 6 1 1 4 1 1 1 1 8 4 2 2 5 8 2 1 8 5 10 6 6 4 4 2 4 11 12 4 7 9 3 1 4 7 8 5 1 12 12 6 3 3 17 24 4 3 11 18 1 16 3 5 7 4 7 6 8 5 12 3 2 16 1 4 3 2 11 6 14 7 5...

output:

971
943
924
142479
50
853
837
798
810
822
1
721
153614
159449
727
658
681
144866

result:

ok 18 lines

Test #51:

score: 0
Accepted
time: 657ms
memory: 10932kb

input:

162150 193261
1 1 1 1 1 1 1 2 1 1 1 1 1 3 2 1 3 2 2 1 1 1 2 1 3 2 3 2 1 2 1 3 4 2 2 1 3 11 6 6 1 5 2 2 3 9 1 4 1 2 1 3 10 8 3 4 4 3 1 7 1 6 3 1 1 1 8 4 1 1 10 2 2 4 6 19 2 2 4 1 4 6 4 9 3 1 6 4 1 13 1 1 22 1 4 3 1 2 17 9 3 20 2 11 1 2 3 8 11 11 2 7 33 2 3 2 4 5 8 2 5 28 3 3 25 1 2 23 3 3 9 4 7 4 2 3...

output:

166
176
172
158
172
171
167
162
165
171
164
163
149
153
153
147
158
157
145
139
149
148
147
142
146
143
143
143
146
142
143
133
137
132
123
141
121
134
144
127
129
136
139
135
137
125
119
124
126
127
115
108
124
132
132
127
131
116
112
115
119
122
116
122
129
128
121
122
118
122
105
123
111
118
111
...

result:

ok 10171 lines

Test #52:

score: 0
Accepted
time: 456ms
memory: 17808kb

input:

155544 193690
1 1 1 1 1 1 1 2 2 1 1 2 1 1 1 3 2 1 2 1 1 3 2 4 6 1 2 1 1 4 1 3 1 2 2 1 2 8 2 3 5 3 2 3 12 5 2 3 1 2 5 3 5 12 4 2 3 1 1 3 5 3 6 3 4 2 16 6 6 7 17 5 3 3 5 3 3 3 4 1 3 4 1 2 14 11 5 3 2 1 13 12 9 4 6 1 12 8 12 2 5 1 11 3 12 19 7 8 4 1 17 4 20 18 12 9 1 22 8 4 14 8 16 7 21 7 4 9 16 10 1 7...

output:

1019
147763
807
801
844
2323
153995
818
144903
152017
4153

result:

ok 11 lines

Test #53:

score: 0
Accepted
time: 572ms
memory: 11476kb

input:

167230 182057
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 2 1 1 3 1 1 2 1 1 3 3 2 9 2 1 3 1 1 1 2 1 4 5 5 5 1 6 6 3 5 2 2 1 5 3 6 6 2 1 4 1 3 1 4 5 1 4 4 2 11 5 1 1 5 5 2 3 1 1 1 2 2 2 7 3 2 1 5 11 7 1 2 3 9 5 1 1 1 1 5 1 12 9 5 20 8 4 1 3 1 4 3 4 6 4 5 7 1 14 17 12 1 9 5 21 30 13 2 1 2 7 1 3 12 7 2 5 1...

output:

91
94
98
93
96
94
90
90
101
91
91
92
88
88
82
82
93
85
97
88
91
92
85
89
90
90
88
85
86
80
91
87
82
84
75
78
83
79
71
91
75
78
74
91
79
79
79
84
90
79
72
74
80
81
78
83
80
80
69
69
69
76
58
71
76
80
71
78
72
68
78
69
79
76
78
68
67
75
73
72
65
73
78
69
63
64
70
55
64
69
67
70
65
72
65
55
66
61
69
65...

result:

ok 18205 lines

Test #54:

score: 0
Accepted
time: 431ms
memory: 18836kb

input:

163014 181020
1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 3 1 1 2 1 1 1 1 1 2 2 2 2 4 4 2 5 1 2 1 1 1 7 2 1 3 1 5 1 6 1 4 3 2 7 2 5 3 4 4 6 5 3 1 3 7 6 1 3 1 1 10 7 3 1 3 16 6 1 8 10 12 3 5 2 14 12 3 4 8 25 1 2 18 18 3 6 15 1 3 6 13 9 1 23 11 12 12 1 10 1 5 12 4 9 3 4 1 8 3 1 1 12 10 1 10 13 8 21 8 17 4 1 11 8 ...

output:

14
149439
9387
158138
941
156293
19452
14736
118605

result:

ok 9 lines

Test #55:

score: 0
Accepted
time: 1213ms
memory: 11516kb

input:

162815 187365
1 1 1 1 1 1 1 1 2 1 2 2 1 1 2 1 1 1 3 2 2 1 1 2 1 1 2 3 2 2 2 2 2 3 2 2 1 2 2 13 2 3 6 3 1 2 1 5 1 3 2 1 1 3 7 3 6 1 2 2 4 2 4 2 1 2 1 2 3 2 5 1 2 5 3 15 1 8 10 16 1 1 3 5 8 6 15 5 1 9 3 2 19 8 2 1 12 2 11 7 3 1 1 8 2 1 14 6 6 4 8 7 2 3 1 2 4 5 2 4 3 17 5 3 6 8 5 18 2 5 7 9 14 7 2 24 7...

output:

13
12
12
13
14
13
12
10
9
11
11
13
11
12
11
12
13
10
13
13
13
14
12
13
13
12
12
14
12
15
11
13
15
12
12
12
15
11
12
10
11
11
13
14
11
14
11
13
12
12
14
12
13
12
10
13
14
11
11
11
12
14
12
11
11
10
12
15
13
11
12
11
15
12
9
13
12
14
11
9
7
13
12
14
13
11
14
12
12
11
12
13
13
15
12
14
11
11
13
11
14
1...

result:

ok 187365 lines

Test #56:

score: 0
Accepted
time: 460ms
memory: 17876kb

input:

168326 178520
1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 2 1 2 2 1 1 4 3 5 2 1 3 1 3 3 1 2 3 4 6 4 1 2 1 5 3 9 3 4 5 1 7 11 3 4 7 6 2 6 5 1 3 2 1 6 4 1 1 3 2 4 6 4 3 5 1 3 8 9 1 13 6 9 3 13 4 6 16 9 8 16 4 1 3 10 3 4 3 8 1 21 6 3 3 3 1 13 2 10 1 12 8 15 8 10 2 16 13 6 13 1 2 19 1 2 3 1 1 20 1...

output:

39
972
970
30
835
14
964
898
887
931
878
772
928
773
4
711
813
816
114
850
822
30
815
701
828
111
40
30
164884
825
807
753
834
42
716
710
139
681
724
730
761
769
42
724
162285
743
748
762
124
652
747
155760
745
750
724
24
733
719
663
715
754
721
679
728
682
33
724
671
689
637
16
9
727
711
42
702
615...

result:

ok 287 lines

Test #57:

score: 0
Accepted
time: 656ms
memory: 11940kb

input:

175692 190138
1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 2 1 1 1 1 3 2 7 5 1 1 1 4 3 1 3 3 1 5 2 1 2 1 2 3 4 1 9 7 2 19 5 5 13 9 8 2 1 2 6 11 7 2 2 3 2 2 1 3 1 4 12 27 6 1 12 3 3 1 2 6 26 3 5 3 11 2 8 20 10 9 7 6 7 5 1 2 4 4 16 7 25 1 8 7 5 5 3 7 2 44 5 33 8 5 8 4 1 9 5 1 6 17 7 16 10 9 6 7 2 9 16 21 3 7 5 8 1 3...

output:

190
192
194
207
188
194
197
183
176
187
184
197
188
187
177
171
185
174
180
177
164
166
155
163
167
178
156
163
169
167
157
171
152
162
158
162
165
169
151
145
149
155
156
158
147
148
144
144
140
148
143
143
145
134
154
151
147
135
128
140
148
146
131
127
131
150
131
136
128
139
137
134
129
128
131
...

result:

ok 10007 lines

Test #58:

score: 0
Accepted
time: 499ms
memory: 20268kb

input:

185958 197632
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

100778
95193
42751
83999
72807
64257
174112
185948
60995
116861
184946
40983
11811
185409
6514
39798
162885

result:

ok 17 lines

Test #59:

score: 0
Accepted
time: 690ms
memory: 10852kb

input:

174162 195502
1 1 1 1 1 1 1 1 2 1 1 3 2 2 2 1 2 2 6 1 2 3 2 1 1 2 2 2 5 2 3 5 3 1 5 2 1 1 4 1 1 3 1 1 4 8 2 3 7 1 1 1 2 5 16 8 14 2 5 3 4 17 3 15 2 1 2 4 1 21 12 4 2 1 4 25 7 3 2 6 3 3 19 8 6 3 5 10 5 4 4 1 3 5 10 34 10 7 23 3 1 2 4 10 7 5 9 17 8 12 13 3 9 18 3 11 6 1 19 8 1 5 11 10 11 7 2 8 14 1 14...

output:

39
35
34
32
35
37
32
30
37
35
41
35
37
35
32
36
40
38
40
34
31
37
35
40
31
33
37
32
30
35
34
34
30
29
33
36
36
37
35
33
37
33
41
35
37
32
34
38
31
31
33
39
38
28
35
33
33
35
37
32
35
30
34
35
37
37
31
32
30
31
29
37
35
39
32
33
32
36
29
25
36
32
38
29
34
27
33
29
29
26
31
28
30
28
31
33
34
32
27
30
...

result:

ok 65167 lines

Test #60:

score: 0
Accepted
time: 471ms
memory: 19348kb

input:

188037 199371
1 1 1 1 1 1 1 2 1 1 2 1 1 2 2 1 2 1 3 1 5 2 1 2 1 3 4 3 1 3 2 3 1 1 4 2 1 1 1 3 1 2 3 8 1 2 2 4 7 1 2 3 6 6 2 1 7 2 5 2 3 4 7 1 13 3 5 1 3 19 2 1 5 9 7 1 5 1 11 1 13 3 3 7 7 22 4 8 7 3 1 3 3 1 1 4 3 10 16 9 5 6 5 11 4 8 18 25 9 2 4 11 19 5 5 24 13 14 2 2 12 3 7 15 5 12 22 3 1 9 1 4 3 1...

output:

1062
1017
1040
991
923
854
832
901
829
44
669
895
836
12292
631
757
763
734
686
630
4
653
730
62
728
687
85
178595
693
710
554
674
178492
168792
619
674
636
7
27
606
71489

result:

ok 41 lines

Test #61:

score: 0
Accepted
time: 594ms
memory: 11988kb

input:

196346 183585
1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 2 2 1 2 1 3 4 5 2 2 2 3 2 3 1 1 4 1 2 7 1 3 3 4 1 8 1 2 1 8 5 1 4 1 1 3 2 2 1 2 3 3 1 2 1 7 1 6 1 10 6 4 3 4 1 7 1 3 2 4 10 1 7 1 1 2 5 4 16 1 8 8 1 2 3 11 1 1 1 3 1 16 4 7 2 3 3 1 8 16 1 1 1 3 1 13 11 3 6 1 9 2 3 6 5 2 8 4 4 21 17 3 4 2 12 9 1 14 8 ...

output:

84
79
81
76
76
83
80
84
80
79
81
73
71
80
79
82
79
76
76
76
83
76
68
77
76
81
80
78
78
72
75
69
73
73
68
77
72
72
78
68
69
70
59
70
73
74
76
75
80
72
65
73
75
72
70
69
63
63
72
69
65
69
73
70
68
72
69
84
64
64
69
60
60
65
70
73
72
64
68
67
72
67
58
61
62
59
66
65
60
68
68
66
58
68
60
59
68
56
59
63
...

result:

ok 22948 lines

Test #62:

score: 0
Accepted
time: 431ms
memory: 19392kb

input:

197475 174914
1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 3 1 2 1 1 2 2 3 1 2 1 1 2 1 1 3 1 2 2 1 8 1 1 3 1 1 9 1 4 2 9 1 3 6 4 1 1 1 3 1 4 9 1 5 3 1 3 2 1 7 10 10 3 1 1 6 7 9 2 1 6 1 2 2 2 3 1 5 3 1 15 4 14 5 10 3 5 11 7 4 3 14 7 5 7 7 1 3 15 1 4 9 1 5 7 4 3 1 15 2 8 5 7 12 10 18 2 12 4 5 5 4 5 1 7 10 3 2 23 4 2...

output:

184553
980
992
60
891
920
194361
93
188396
26367
898
863
22699

result:

ok 13 lines

Test #63:

score: 0
Accepted
time: 648ms
memory: 11696kb

input:

190593 198263
1 1 1 1 1 1 2 1 1 4 1 1 1 1 2 1 1 1 2 2 1 2 1 2 2 2 1 1 2 1 1 1 4 1 5 3 1 1 3 5 2 4 1 5 2 2 4 5 2 6 4 1 4 1 1 1 4 3 1 9 7 4 3 3 5 1 4 1 5 5 1 1 3 12 1 6 5 4 1 5 10 2 3 9 7 4 3 9 1 5 2 6 2 4 1 9 2 1 1 3 1 22 6 3 7 13 4 9 2 1 2 4 21 6 21 1 19 8 3 5 1 9 10 8 7 17 16 26 34 11 6 6 16 2 14 4...

output:

145
144
145
136
147
138
143
137
142
135
141
134
129
137
134
136
140
127
137
131
130
125
118
128
130
125
120
126
125
122
127
119
122
124
137
138
128
129
128
117
123
132
126
132
123
125
120
122
110
101
120
117
109
124
119
108
105
109
111
104
124
105
107
117
120
111
111
113
116
110
119
108
105
98
103
1...

result:

ok 12391 lines

Test #64:

score: 0
Accepted
time: 469ms
memory: 19004kb

input:

197693 193036
1 1 1 1 1 1 1 1 1 1 2 5 2 2 4 1 1 1 1 1 4 5 5 1 1 3 4 1 2 1 2 4 2 1 1 1 1 2 5 2 1 3 2 1 4 2 5 5 3 7 19 2 4 4 7 2 5 15 9 10 16 7 17 12 2 10 16 3 8 6 2 22 2 11 2 8 2 4 4 12 20 2 2 4 18 2 5 5 7 28 3 5 4 6 2 15 2 10 6 15 4 1 9 6 3 7 31 7 1 9 16 1 1 2 2 23 2 3 14 18 5 6 13 1 4 5 9 32 13 1 5...

output:

1158
298
1073
1021
179473
919
981
1004
725
66
927
183128
7
936
187300
868
766
78
524
15
817
14564
21
733
43
678
33
55576

result:

ok 28 lines

Test #65:

score: 0
Accepted
time: 660ms
memory: 11664kb

input:

193083 198356
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 2 1 2 1 1 4 5 8 2 4 1 1 1 1 2 1 4 4 2 2 1 1 6 6 1 3 3 10 5 1 9 4 1 10 6 1 6 1 1 3 1 4 2 3 4 2 5 2 8 2 3 1 1 2 3 2 5 7 14 4 5 1 6 2 13 7 4 3 1 2 2 8 8 1 4 1 6 15 5 2 16 1 15 5 2 3 4 10 4 1 2 2 1 4 3 2 14 7 2 1 6 5 1 1 1 8 10 7 19 6 13 3 8 ...

output:

149
145
153
141
149
146
146
152
142
156
143
142
139
141
135
149
138
132
136
133
141
133
133
137
133
118
138
132
139
132
125
129
130
135
122
130
130
127
125
128
120
132
121
109
126
122
109
116
115
117
110
109
120
118
115
115
118
109
117
115
117
112
117
112
112
105
101
114
114
116
112
111
113
105
101
...

result:

ok 12397 lines

Test #66:

score: 0
Accepted
time: 487ms
memory: 18916kb

input:

168148 196751
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

166006
142009
20704
17020
50829
117301
39296
35662
164536
18893
3122
17280
1558
1495
35
80
860
869
20
148887
1147
32
1
11
1084
56
1
754
6
613
1206
816
27
1085
5
1
17
158526
79
1096
403
392
412
458
29
344
29
12
5
20
5
44
99
17
7
4
36
41
5
1
17
103
21
4
23
25
5648
8
42
2788
4
139141

result:

ok 72 lines

Test #67:

score: 0
Accepted
time: 616ms
memory: 11844kb

input:

199978 180041
1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 4 1 2 1 1 2 1 2 4 1 2 1 7 3 2 1 1 3 1 1 3 1 1 7 5 4 1 5 8 1 1 1 1 8 3 2 3 2 3 4 2 2 9 3 1 2 5 1 1 1 4 14 2 3 5 1 3 1 21 1 2 8 13 4 3 2 2 6 4 1 8 4 6 3 6 11 11 7 21 7 1 5 1 10 4 12 14 4 3 3 6 4 6 1 8 20 7 4 12 3 4 8 12 4 21 21 9 14 11 10 1 16 2 4 ...

output:

63
63
61
62
63
65
58
60
62
61
64
66
63
62
62
63
56
56
58
58
59
59
61
58
55
63
63
64
59
60
60
56
57
50
62
59
57
62
59
66
58
66
64
63
59
59
55
59
61
58
53
58
58
58
60
49
52
62
65
60
54
52
54
58
64
57
59
49
56
48
55
55
54
55
53
57
56
55
50
50
57
59
55
57
55
59
51
64
58
52
54
56
53
53
58
52
54
63
49
56
...

result:

ok 30006 lines

Test #68:

score: 0
Accepted
time: 493ms
memory: 19728kb

input:

168523 191514
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

155350
101418
166244
168348
992
27366
41011
23219
128142
317
20948
66802
167708
168
19284
158103

result:

ok 16 lines

Test #69:

score: 0
Accepted
time: 1034ms
memory: 11784kb

input:

178012 183376
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

95990
90037
55533
59638
60545
43636
46061
46967
42907
39129
38060
31821
31459
24197
27862
27129
21659
24745
20847
18306
20326
17379
20052
18810
19653
19267
17824
16581
12666
13459
13594
13105
14329
12474
13460
12487
12664
11465
11580
10736
9611
11284
10313
9786
8444
9867
9205
10548
9213
9502
10578
1...

result:

ok 22922 lines

Test #70:

score: 0
Accepted
time: 510ms
memory: 19176kb

input:

188896 197647
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

74036
64524
188887
39424
11825
11272
115307
188509
28184
847
187879
5042
144823

result:

ok 13 lines

Test #71:

score: 0
Accepted
time: 625ms
memory: 12572kb

input:

184956 195844
1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 2 1 5 1 1 1 2 5 3 1 7 1 1 1 1 6 1 1 2 7 1 3 3 12 4 2 3 2 1 8 5 1 1 2 6 1 4 6 3 1 1 1 10 15 5 2 13 1 1 9 4 18 4 3 3 13 2 4 13 2 4 5 1 6 17 1 1 1 2 5 15 5 5 5 9 5 17 1 3 9 6 5 3 8 12 12 2 13 9 13 6 7 4 4 4 11 15 2 19 1 5 7 3 3 4 4 3 7 14 1 10 5 14 6 9 4 1 42...

output:

73
75
76
78
69
76
75
81
75
81
84
74
71
75
71
77
78
76
69
79
65
67
76
77
76
76
67
78
73
70
73
64
73
76
70
67
62
79
74
72
70
70
74
68
69
70
65
61
71
71
71
72
68
75
68
71
65
67
68
69
69
71
69
60
66
66
68
71
66
69
67
64
65
71
72
66
69
66
66
67
65
68
69
64
62
67
59
64
67
62
62
73
73
73
68
64
67
61
67
69
...

result:

ok 27977 lines

Test #72:

score: 0
Accepted
time: 497ms
memory: 19756kb

input:

189056 187863
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

66103
22754
52798
8485
47757
43807
118932
31826
29193
32638
851
27631
189004
23761
472
1876
20442
19764
187754
3535
1189
17315
610
822
10
5
1
204
11
5
1
1
746
426
16
436
8
4
5
1
7
11
1
5
826
44
33
8
86
186117
3
16
1
12
47
137
25
12
5
50
3
6
4
26
54
8
27
28070

result:

ok 68 lines

Test #73:

score: 0
Accepted
time: 701ms
memory: 11176kb

input:

185879 190566
1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 3 1 1 2 1 2 3 4 5 4 2 1 4 5 2 2 2 1 1 4 5 2 6 4 3 2 1 1 3 4 1 2 5 2 1 6 2 1 2 4 2 2 2 2 10 6 4 5 3 3 11 4 2 9 2 5 3 4 5 7 1 4 5 2 1 2 2 9 1 5 1 2 1 5 1 6 4 5 6 1 12 6 2 3 1 6 6 5 3 1 30 9 20 29 7 19 2 3 2 11 19 9 11 4 1 10 25 2 1 10 9 14 6 7 11 2 15 2 6 ...

output:

34
35
32
32
32
32
32
35
35
35
32
33
34
34
32
29
34
38
33
38
30
32
34
30
31
35
35
36
31
30
31
30
36
28
35
33
30
31
32
32
32
35
29
34
33
32
34
35
28
29
33
32
32
33
32
29
34
27
36
34
29
32
33
32
31
33
27
34
32
34
33
33
34
35
32
29
27
34
31
32
31
33
31
29
29
29
31
29
28
36
35
30
33
31
31
30
34
27
31
34
...

result:

ok 63522 lines

Test #74:

score: 0
Accepted
time: 480ms
memory: 18388kb

input:

194093 196734
1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 3 1 1 1 5 1 2 2 1 3 1 2 4 1 3 2 2 1 1 1 1 3 1 2 2 4 3 4 1 1 2 3 2 1 6 6 3 5 3 5 6 7 4 3 4 7 2 6 4 5 1 3 1 3 2 1 3 2 2 3 5 1 1 4 7 1 17 6 1 5 1 9 3 1 8 2 2 1 6 3 4 3 7 1 7 2 5 5 10 8 4 1 14 1 1 4 19 10 4 4 4 12 17 13 6 6 3 8 4 6 3 17 1 14 1 4 1 5 7 10 2...

output:

852
1016
36
43
192556
901
54
187324
7478
861
850
809
90
178400
49160

result:

ok 15 lines

Test #75:

score: 0
Accepted
time: 647ms
memory: 12176kb

input:

182623 194853
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 3 1 3 1 3 1 1 2 3 1 1 5 2 3 1 1 2 1 5 4 1 3 1 3 1 6 2 3 2 3 1 3 2 4 1 6 4 1 3 1 1 5 3 6 2 2 1 1 4 5 2 3 13 1 1 1 1 2 10 1 1 6 8 1 5 1 1 10 2 1 4 2 14 2 3 4 5 2 2 12 8 1 10 4 10 4 24 5 7 1 2 13 3 4 5 8 6 5 8 20 1 6 3 7 15 23 3 3 1 6 26 11 3 5 7 2 1 4 ...

output:

169
170
188
179
161
170
173
170
175
169
167
155
167
161
157
163
159
154
156
144
155
146
150
137
155
150
151
149
139
139
143
144
146
141
139
131
140
144
132
134
144
126
144
134
139
131
137
127
133
130
124
125
126
123
125
123
133
127
118
121
117
115
126
128
118
108
117
129
106
128
103
124
119
119
110
...

result:

ok 10255 lines

Test #76:

score: 0
Accepted
time: 487ms
memory: 20272kb

input:

192003 198292
1 1 1 1 1 1 1 1 1 1 1 2 1 3 1 3 1 2 1 3 1 3 1 1 1 1 1 1 2 1 2 2 2 2 3 1 1 4 6 3 4 4 1 2 4 3 3 8 2 8 6 3 1 7 3 2 11 2 17 3 3 12 2 4 2 9 6 2 11 1 6 2 3 5 3 5 8 4 3 3 4 11 3 9 14 4 4 7 4 10 2 5 1 8 4 12 9 1 4 5 1 1 5 3 10 1 8 3 1 6 7 5 4 10 9 9 1 11 4 8 18 6 3 5 14 18 18 2 12 13 3 16 18 9...

output:

1037
969
19142
123
989
173713
191163
949
177419
58
947
889
58709

result:

ok 13 lines

Test #77:

score: 0
Accepted
time: 628ms
memory: 11592kb

input:

194338 188537
1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 2 2 3 1 1 2 2 1 1 2 1 1 4 4 1 1 1 1 2 1 7 2 3 1 2 1 1 3 2 2 4 1 3 1 2 3 1 4 2 4 2 5 3 3 10 5 1 3 5 2 3 2 4 4 1 2 10 2 3 3 11 5 2 1 15 13 5 1 1 12 4 2 1 11 6 6 1 2 2 3 9 9 7 15 29 9 18 8 10 2 2 28 7 7 14 4 20 7 17 6 9 1 8 5 6 9 9 1 2 3 2 8 1 1 7 4 16 17 1 5...

output:

78
81
78
80
77
79
80
76
75
76
82
76
82
78
81
78
75
77
73
75
76
74
66
78
71
73
77
72
84
68
72
70
69
71
72
67
66
73
77
67
75
75
75
70
72
66
67
74
71
70
72
63
60
66
69
72
64
65
61
69
71
64
67
64
65
71
62
64
54
65
66
60
60
65
67
68
58
63
64
62
59
70
61
72
67
58
67
61
61
57
62
56
59
57
60
67
58
58
57
61
...

result:

ok 23567 lines

Test #78:

score: 0
Accepted
time: 462ms
memory: 18380kb

input:

173164 194035
1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 5 5 3 1 2 3 1 3 3 2 1 5 3 5 2 3 1 2 1 1 3 2 7 3 3 4 1 3 1 10 1 1 5 2 1 2 7 8 1 22 4 2 2 2 15 2 5 9 3 19 4 11 13 6 8 11 7 4 3 5 4 2 4 8 5 3 3 3 17 8 7 2 2 8 1 13 10 15 5 4 1 8 16 2 15 3 8 3 2 8 3 7 5 13 27 4 15 4 3 2 8 2 10 2 2 5 21 15 35 4 14 24 3 ...

output:

19
172477
1025
956
992
946
892
921
867
814
73
17
690
166073
762
670
629
753
573
630
687
168504
670
235
663
644
649
11
84
96954

result:

ok 30 lines

Test #79:

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

input:

199191 198994
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

105491
79375
68394
57979
45046
45754
35708
34014
30381
25510
25274
27758
24027
25760
20280
22848
20102
21033
19744
17545
18314
17036
14578
13986
14430
16012
14867
13541
14227
14940
13542
11714
13084
11813
11654
12620
12262
11188
12330
11492
11058
10462
10730
9512
10267
8752
8092
7956
9362
8322
8330
...

result:

ok 12437 lines

Test #80:

score: 0
Accepted
time: 457ms
memory: 20540kb

input:

198163 179501
1 1 1 1 1 1 2 2 3 1 1 2 2 1 1 2 2 1 4 2 1 1 1 1 4 1 4 4 2 1 1 3 5 5 3 2 3 3 2 5 4 10 1 1 4 6 3 7 2 3 15 7 1 6 8 5 1 2 2 1 3 5 1 1 8 12 4 7 10 2 2 1 2 4 25 7 1 15 9 4 4 12 13 4 12 15 6 22 8 17 23 10 18 11 11 8 4 4 4 16 25 2 22 16 9 13 5 4 6 5 9 12 3 7 14 9 1 9 3 4 4 5 1 1 24 6 1 2 5 1 2...

output:

206
197
53
196241
978
926
20
35
1043
972
1001
977
970
979
637
193025
128
186618
34967

result:

ok 19 lines

Test #81:

score: 0
Accepted
time: 18ms
memory: 12908kb

input:

183832 187409
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

114113
121467
143629
41846
65844
57114
88689
47984
50365
42876
168407
53721
121280
55369
156842
104099
27681
123062
83789
104527
172247
159443
104739
79915
132397
76255
142497
70025
38668
72353
66381
107407
97197
2463
151729
53929
129507
54109
133299
120621
98256
28968
160735
143739
152113
166209
69...

result:

ok 187409 lines

Test #82:

score: 0
Accepted
time: 444ms
memory: 17612kb

input:

177875 182958
1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 2 2 1 1 3 3 3 2 1 1 2 2 5 3 2 4 3 2 1 2 5 3 1 2 3 2 2 2 2 1 4 1 5 1 1 3 1 4 1 5 7 2 1 2 5 9 1 3 1 1 1 1 4 6 6 9 7 3 2 5 11 3 1 1 5 4 2 10 1 1 1 4 1 7 2 2 6 2 9 10 6 6 9 21 30 2 4 7 14 1 5 5 6 3 1 3 1 21 11 1 5 3 2 8 15 1 6 1 4 3 2 8 9 18 5 4 6 ...

output:

937
13
978
768
755
844
87
743
167581
784
5
130937
754
748
701
177518
42
728
131405

result:

ok 19 lines

Extra Test:

score: -3
Extra Test Failed : Runtime Error on 3

input:

200000 200000
1 1 2 4 5 3 2 7 6 10 4 3 13 7 7 3 13 13 8 5 16 15 17 5 10 14 18 24 22 13 3 7 32 6 27 36 31 16 22 38 14 35 36 4 23 9 1 26 43 25 31 9 48 31 15 1 49 2 55 59 16 16 3 53 5 19 15 14 14 10 51 40 48 58 28 55 49 19 72 53 43 64 10 43 64 8 38 5 44 66 62 69 63 84 95 64 53 36 23 3 60 25 51 55 45 85...

output:


result: