QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#447769#8630. 字符树zyz07100 ✓1079ms894868kbC++174.9kb2024-06-18 19:45:202024-06-18 19:45:21

Judging History

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

  • [2024-06-18 19:45:21]
  • 评测
  • 测评结果:100
  • 用时:1079ms
  • 内存:894868kb
  • [2024-06-18 19:45:20]
  • 提交

answer

#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
#define For(Ti,Ta,Tb) for(auto Ti=(Ta);Ti<=(Tb);++Ti)
#define Dec(Ti,Ta,Tb) for(auto Ti=(Ta);Ti>=(Tb);--Ti)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define range(Tx) begin(Tx),end(Tx)
using ll=long long;
using ull=unsigned long long;
const int N=5e5+5,Base=13331;
struct HashSeq{
	vector<ull> pw,hsh;
	HashSeq(const vector<int>& a):pw(a.size()+1),hsh(a.size()+1){
		pw[0]=1;
		For(i,1,int(a.size())){
			pw[i]=pw[i-1]*Base;
		}
		For(i,0,int(a.size())-1){
			hsh[i+1]=hsh[i]*Base+a[i]+1;
		}
	}
	ull substr(int l,int r){
		return hsh[r+1]-hsh[l]*pw[r-l+1];
	}
};
int n,m,len,fa[N],faw[N],dep[N],siz[N],hson[N];
vector<int> e[N];
void dfs(int u){
	siz[u]=1;
	for(int v:e[u]){
		dep[v]=dep[u]+1;
		dfs(v);
		siz[u]+=siz[v];
		if(siz[v]>siz[hson[u]]){
			hson[u]=v;
		}
	}
}
int rk[N],dfn[N],dfx,top[N],down[N];
void dfs2(int u,int t){
	rk[dfn[u]=++dfx]=u;
	top[u]=t;
	down[t]=u;
	if(hson[u]){
		dfs2(hson[u],t);
	}
	for(int v:e[u]){
		if(v!=hson[u]){
			dfs2(v,v);
		}
	}
}
int lca(int u,int v){
	while(top[u]!=top[v]){
		if(dep[top[u]]<dep[top[v]]){
			swap(u,v);
		}
		u=fa[top[u]];
	}
	return dep[u]<dep[v]?u:v;
}
int kth_anc(int u,int k){
	while(1){
		int x=dep[u]-dep[top[u]]+1;
		if(k>=x){
			k-=x;
			u=fa[top[u]];
		}else{
			return rk[dfn[u]-k];
		}
	}
}
int match(const vector<int>& vec,ull x){
	HashSeq hsh(vec);
	int ans=0;
	For(i,0,int(vec.size())-len){
		ans+=(hsh.substr(i,i+len-1)==x);
	}
	return ans;
}
ull get_hash(const string& s){
	ull x=0;
	For(i,0,len-1){
		x=x*Base+s[i]-'0'+1;
	}
	return x;
}
struct BIT{
	__gnu_pbds::gp_hash_table<ull,int> t[N];
	void add(int p,ull x,int w){
		for(;p<=n;p+=p&-p){
			t[p][x]+=w;
		}
	}
	int query(int p,ull x){
		int res=0;
		for(;p;p&=p-1){
			auto it=t[p].find(x);
			res+=(it!=t[p].end()?it->second:0);
		}
		return res;
	}
}bit;
int solve(int u,int lca,const string& s){
	if(dep[u]-dep[lca]<len){
		return 0;
	}
	int ans=0;
	ull x=get_hash(s);
	vector<pair<int,int>> vec;
	{
		int x=u;
		while(top[x]!=top[lca]){
			vec.emplace_back(dfn[top[x]],dfn[x]);
			x=fa[top[x]];
		}
		if(x!=lca){
			vec.emplace_back(dfn[lca]+1,dfn[x]);
		}
	}
	For(i,0,int(vec.size())-2){
		auto [l,r]=vec[i];
		vector<int> a;
		Dec(j,min(r,l+len-2),l){
			a.push_back(faw[rk[j]]);
		}
		for(int v=fa[rk[l]];dep[v]>max(dep[lca],dep[rk[l]]-len);v=fa[v]){
			a.push_back(faw[v]);
		}
		ans+=match(a,x);
	}
	ans+=bit.query(dfn[u],x)-bit.query(dfn[kth_anc(u,dep[u]-dep[lca]-len+1)],x);
	return ans;
}
ull val[N];
void modify(int u,int lca,const string& s){
	for(int v=u,i=0;v!=lca;v=fa[v],++i){
		faw[v]=s[i]-'0';
	}
	auto update=[&](int l,int r){
		int L=max(l,dfn[top[rk[l]]]+len-1),R=min(r+len-1,dfn[down[rk[l]]]);
		vector<int> a;
		Dec(i,R,L-len+1){
			a.push_back(faw[rk[i]]);
		}
		HashSeq hsh(a);
		For(i,L,R){
			int u=rk[i];
			bit.add(i,val[u],-1);
			bit.add(i+siz[u],val[u],1);
			val[u]=hsh.substr(R-i,R-i+len-1);
			bit.add(i,val[u],1);
			bit.add(i+siz[u],val[u],-1);
		}
	};
	while(top[u]!=top[lca]){
		update(dfn[top[u]],dfn[u]);
		u=fa[top[u]];
	}
	if(u!=lca){
		update(dfn[lca]+1,dfn[u]);
	}
}
int main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	// assert(freopen("data.in","r",stdin));
	// assert(freopen("data.out","w",stdout));
	cin>>n>>m>>len;
	For(i,2,n){
		cin>>fa[i];
		e[fa[i]].push_back(i);
	}
	{
		string s;
		cin>>s;
		For(i,2,n){
			faw[i]=s[i-2]-'0';
			// debug("%d %d %d\n",i,fa[i],faw[i]);
		}
	}
	dfs(1);
	dfs2(1,1);
	For(u,1,n){
		down[u]=down[top[u]];
		if(down[u]==u){
			// debug("down=%d,top=%d\n",u,top[u]);
			vector<int> a;
			for(int v=0;v!=top[u];){
				v=(v?fa[v]:u);
				a.push_back(faw[v]);
			}
			HashSeq hsh(a);
			for(int v=u;v&&dep[v]-dep[top[u]]+1>=len;v=fa[v]){
				val[v]=hsh.substr(dep[u]-dep[v],dep[u]-dep[v]+len-1);
				// debug("%d %llu\n",v,val);
				bit.add(dfn[v],val[v],1);
				bit.add(dfn[v]+siz[v],val[v],-1);
			}
		}
	}
	// debug("done\n");
	For($,1,m){
		int op,u,v;
		string s;
		cin>>op>>u>>v>>s;
		if(op==1){
			int lca=::lca(u,v);
			modify(u,lca,s.substr(0,dep[u]-dep[lca]));
			modify(v,lca,string(s.rbegin(),s.rbegin()+(dep[v]-dep[lca])));
		}else{
			if(dep[u]<dep[v]){
				reverse(range(s));
				swap(u,v);
			}
			int lca=::lca(u,v);
			if(dep[u]+dep[v]-2*dep[lca]<len){
				cout<<"0\n";
				continue;
			}
			int ans=solve(u,lca,s);
			if(lca!=v){
				ans+=solve(v,lca,string(s.rbegin(),s.rend()));
				int u_=kth_anc(u,max(0,dep[u]-dep[lca]-(len-1)));
				int v_=kth_anc(v,max(0,dep[v]-dep[lca]-(len-1)));
				vector<int> vec,vec_;
				for(;u_!=lca;u_=fa[u_]){
					vec.push_back(faw[u_]);
				}
				for(;v_!=lca;v_=fa[v_]){
					vec_.push_back(faw[v_]);
				}
				reverse(range(vec_));
				vec.insert(vec.end(),range(vec_));
				ans+=match(vec,get_hash(s));
			}
			cout<<ans<<'\n';
		}
	}
	return 0;
}

详细

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 44ms
memory: 181188kb

input:

250 250 62
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 30 67 68 8 70 16 72 3 74 75 32 77 75 31 80 81 65 83 30 19 49 4 1 89 57 91 92 43 94 95 96 85 51 32 100 8...

output:

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

result:

ok 118 numbers

Test #2:

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

input:

250 250 6
1 1 1 4 1 1 1 1 1 1 1 1 1 14 1 1 1 1 19 1 1 1 1 24 1 26 27 28 1 30 1 32 1 1 35 1 37 1 1 1 1 1 43 44 45 1 47 1 1 1 1 1 53 54 1 56 57 58 1 60 1 62 63 64 65 1 1 68 69 70 71 1 1 1 1 76 77 78 79 1 81 1 83 84 1 1 1 88 89 1 91 1 93 94 1 96 97 98 99 1 1 102 103 1 105 106 107 108 1 110 111 112 113 ...

output:

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

result:

ok 118 numbers

Test #3:

score: 0
Accepted
time: 54ms
memory: 183104kb

input:

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

output:

0
1
1
1
2
1
0
0
8
1
1
0
0
1
1
2
3
1
1
1
1
3
1
0
1
2
0
2
0
8
1
0
2
1
0
2
1
1
3
0
0
1
0
1
0
1
0
0
1
0
2
0
0
3
0
0
0
3
2
0
3
0
5
0
13
5
0
0
7
4
1
0
0
0
1
0
3
0
0
7
0
0
6
0
9
3
8
0
3
7
7
0
15
1
0
8
0
1
6
10
10
0
2
1
0
0
0
3
0
2
6
3
0
3
0
0
2
7
2
0
2
6
17
2
0
0
0
0
0

result:

ok 129 numbers

Test #4:

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

input:

246 250 113
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:

1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
6
1
0
1
0
2
0
2
1
1
0
0
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
1
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 128 numbers

Test #5:

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

input:

249 250 47
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 1 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 1 1 70 71 1 73 74 75 76 1 78 1 80 1 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 1 99 1 101 1 1...

output:

1
1
1
1
0
1
0
1
0
0
0
1
1
0
1
1
0
1
1
1
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
9
0
0
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 118 numbers

Test #6:

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

input:

250 250 95
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 14 5 98 99 5 ...

output:

1
1
1
1
0
1
1
0
0
1
0
0
0
1
1
0
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
0
0
0

result:

ok 121 numbers

Test #7:

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

input:

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

output:

1
0
1
1
0
1
1
1
1
0
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
13
4
0
4
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
9
0
0
1
0
0
1
4
0
0
4
0
1
0
0
0
0
2
1
9
0
0
0
7
0
0
2
0
0
0
0
0
0
4
11
0
0
0
0
11
19
1
2
0
0
0
0
0
4
0
0

result:

ok 123 numbers

Test #8:

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

input:

250 250 82
1 1 1 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 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 10...

output:

1
1
1
1
0
1
1
0
1
1
1
1
0
1
1
1
1
1
0
1
1
1
0
0
1
1
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
49
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
22
0
0
0
0
0
0
0
0
0
0
0
0
36
0
0
18
0
1
1
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

result:

ok 118 numbers

Test #9:

score: 0
Accepted
time: 54ms
memory: 181476kb

input:

250 250 7
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 33 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 26 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...

output:

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

result:

ok 123 numbers

Test #10:

score: 0
Accepted
time: 39ms
memory: 181044kb

input:

249 246 2
1 2 2 2 5 4 7 1 2 2 11 3 2 3 15 11 7 13 9 20 6 6 13 8 13 26 27 6 5 30 31 32 33 34 35 2 29 38 39 40 21 30 37 44 45 14 25 32 49 50 51 52 15 5 14 37 23 27 59 60 61 51 63 47 12 34 57 34 69 70 49 60 25 3 75 72 51 78 78 80 81 78 83 84 85 86 62 88 89 90 2 92 93 94 95 96 97 41 89 81 87 102 45 14 3...

output:

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

result:

ok 125 numbers

Subtask #2:

score: 10
Accepted

Test #11:

score: 10
Accepted
time: 166ms
memory: 260172kb

input:

500000 650 769
1 2 3 4 5 6 7 8 9 10 11 12 7 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:

1
1
1
1
1
1
0
0
1
1
1
1
1
0
1
0
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
1
0
0
1
1
0
0
1
0
1
1
1
0
0
1
1
1
1
1
1
0
0
1
1
0
1
1
1
0
1
1
0
1
1
0
1
1
1
1
1
0
0
1
0
0
1
1
0
1
1
0
0
1
0
0
1
1
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 650 numbers

Test #12:

score: 0
Accepted
time: 997ms
memory: 219736kb

input:

500000 499995 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 12 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 55 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...

output:

113
133
1
134
138
143
35
117
79
1
55
26
98
190
53
82
1
190
141
4
161
4
82
328
193
160
189
124
32
293
133
133
41
119
50
110
194
67
107
30
131
111
24
91
168
139
0
3
162
70
108
140
72
174
60
1
184
157
184
13
138
52
212
193
172
132
147
200
143
51
179
33
184
104
129
71
58
59
6
86
139
79
159
94
0
56
36
55...

result:

ok 499995 numbers

Test #13:

score: 0
Accepted
time: 451ms
memory: 357296kb

input:

500000 100000 5
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 5 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 ...

output:

648
90
150
309
2
0
23
5
227
190
52
6
0
14
381
1
177
73
11
1
345
191
3
16
246
0
1
828
11
87
9
1
52
260
5
819
3
55
451
138
3
6
94
45
96
8
1
109
692
285
1
328
1
599
6
0
364
190
1
151
132
13
3
19
32
36
0
263
14
3
199
0
487
0
371
0
345
6
111
85
159
17
422
2
343
218
320
801
183
34
3
968
1
93
164
2
32
119
...

result:

ok 100000 numbers

Test #14:

score: 0
Accepted
time: 116ms
memory: 203312kb

input:

500000 8 56878
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 ...

output:

1
1
0
0
1
0
1
1

result:

ok 8 numbers

Test #15:

score: 0
Accepted
time: 532ms
memory: 297560kb

input:

499995 62500 8
1 2 3 4 5 6 7 8 2 10 11 12 13 14 15 12 17 18 19 20 21 6 23 24 25 26 27 28 14 30 31 23 33 34 13 36 37 12 39 30 41 15 43 44 20 46 47 48 1 32 51 52 17 54 55 11 57 58 59 60 61 62 63 30 65 66 67 68 69 70 71 72 73 24 75 76 77 1 79 80 81 82 18 73 85 86 87 88 89 90 91 92 93 94 95 54 97 98 99 ...

output:

1
1
0
1
1
0
5
1
1
2
1
0
1
1
1
1
1
1
1
1
2
1
1
1
1
0
1
1
9
1
0
1
1
0
1
1
1
0
0
1
1
0
0
2
1
2
0
0
0
3
7
1
2
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
0
1
4
1
1
1
0
1
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
0
1
1
1
1
1
0
2
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
5
0
6
0
0
2
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
4
0
0
0
0
1
0
0
0
...

result:

ok 62500 numbers

Test #16:

score: 0
Accepted
time: 1007ms
memory: 242448kb

input:

500000 499999 1
1 2 3 4 5 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 3 20 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 32 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 27 90 91 92 93 94 95 96 97 98 ...

output:

7
207
7
66
49
163
53
104
45
266
7
17
95
20
112
181
146
1
0
102
157
97
56
76
53
227
124
20
177
11
33
282
208
63
251
198
3
46
91
29
63
78
93
2
69
95
36
95
10
63
245
61
7
5
12
267
0
18
9
10
190
177
135
138
99
10
12
16
14
18
132
13
16
9
3
303
4
9
201
50
184
134
95
11
130
148
111
124
205
103
141
13
252
1...

result:

ok 499999 numbers

Test #17:

score: 0
Accepted
time: 568ms
memory: 517588kb

input:

500000 55552 9
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 ...

output:

18
1
2
1
3
3
1
50
0
59
1
1
17
1
0
1
0
17
8
2
1
9
0
0
1
2
8
8
6
2
56
0
6
0
2
4
87
2
2
0
0
14
2
1
45
1
2
17
50
58
38
1
3
9
0
0
0
46
1
9
0
3
12
12
0
51
40
1
1
1
0
15
0
4
59
3
0
1
10
0
7
5
1
1
0
57
131
17
56
0
57
1
7
60
11
87
1
4
1
37
19
57
76
3
0
137
62
0
36
22
0
0
69
0
0
0
0
2
26
16
122
69
35
0
4
0
0
...

result:

ok 55552 numbers

Test #18:

score: 0
Accepted
time: 467ms
memory: 239856kb

input:

500000 250000 2
1 2 3 4 5 6 1 1 1 10 11 1 1 14 15 16 17 1 1 1 1 1 1 24 1 26 27 1 29 30 31 1 1 34 1 36 37 1 1 1 41 1 1 44 45 1 1 1 1 1 1 1 53 54 1 56 1 1 59 60 1 62 63 1 1 1 1 1 69 70 71 1 1 74 75 76 77 78 1 80 81 1 1 84 85 86 87 88 1 1 1 1 1 94 1 96 1 98 1 1 1 1 1 104 105 1 107 108 109 110 111 1 113...

output:

1
1
0
1
1
0
1
0
1
3
2
1
0
0
0
0
0
0
0
1
1
1
0
1
0
1
1
0
1
0
1
1
1
1
1
1
1
1
1
0
1
0
1
2
0
1
1
4
0
1
1
0
1
1
2
1
1
0
1
0
0
1
1
0
1
1
1
1
1
1
1
1
1
1
0
2
1
0
1
0
0
1
1
0
2
1
0
1
1
0
1
1
0
0
0
1
2
1
2
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
...

result:

ok 250000 numbers

Test #19:

score: 0
Accepted
time: 545ms
memory: 215308kb

input:

499996 500000 1
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...

output:

997
577
24
996
4
1
1786
1286
603
11
240
809
929
968
4184
272
27
819
92
718
395
371
181
1344
301
957
472
518
1712
174
2419
933
88
379
2
215
18
975
363
96
125
1643
2
44
1126
214
849
0
205
1524
1183
1797
755
121
1742
473
160
170
34
568
518
938
794
1189
9
2257
302
182
124
81
781
1355
146
110
3741
1250
1...

result:

ok 500000 numbers

Test #20:

score: 0
Accepted
time: 759ms
memory: 827992kb

input:

499999 101 4859
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...

output:

1
0
0
0
0
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
0
1
1
0
1
0
1
0
1
1
1
1
1
1
1
1
0
1
0
0
0
1
0
0
1
1
0
0
1
0
1
1
1
0
0
1
0
1
1
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
1
0

result:

ok 101 numbers

Subtask #3:

score: 10
Accepted

Test #21:

score: 10
Accepted
time: 768ms
memory: 257400kb

input:

500000 499998 1
1 2 3 4 5 6 7 8 1 1 11 12 13 14 15 16 1 1 19 20 21 22 23 24 1 26 1 28 29 30 1 32 33 34 35 1 37 38 39 40 41 42 43 1 45 46 47 48 49 50 1 52 53 54 55 56 57 1 1 60 61 62 63 64 65 66 67 68 69 1 71 1 73 1 75 76 77 78 79 80 81 82 83 1 1 86 87 88 89 1 91 92 93 94 95 96 97 98 99 100 101 102 1...

output:

2
0
6
4
8
1
3
6
5
1
8
3
11
4
6
1
3
0
2
0
2
0
1
1
3
1
1
3
1
2
1
3
4
5
4
4
5
0
0
4
1
1
5
5
0
0
1
0
1
5
0
0
4
0
0
2
3
5
13
3
3
6
0
9
0
5
1
5
0
0
4
2
4
0
0
4
0
2
6
1
4
1
3
0
1
3
7
1
0
1
5
0
0
0
3
0
0
3
1
7
1
1
0
10
0
5
7
1
0
0
2
0
0
0
0
4
0
3
0
1
5
1
1
0
0
2
0
2
8
4
4
2
4
1
3
14
6
2
5
16
0
0
10
5
0
0
5
...

result:

ok 250246 numbers

Test #22:

score: 0
Accepted
time: 883ms
memory: 245440kb

input:

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

output:

25
119
1
38
5
27
42
23
4
28
29
3
21
23
63
21
34
9
5
56
4
11
56
3
4
32
48
4
39
6
75
44
4
3
52
7
3
71
84
78
10
6
59
25
4
70
90
9
5
52
10
59
3
24
48
28
15
63
76
43
67
1
24
6
29
37
29
50
4
28
47
14
1
4
58
43
34
2
1
23
2
3
35
57
0
52
24
3
22
34
32
2
17
13
38
5
36
0
3
115
61
36
50
61
50
52
11
3
48
4
88
18...

result:

ok 249848 numbers

Test #23:

score: 0
Accepted
time: 752ms
memory: 253024kb

input:

500000 500000 1
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 1 61 62 63 1 1 66 67 68 69 70 71 72 73 74 75 76 1 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

9
8
11
36
5
1
6
18
25
1
7
20
23
6
2
10
1
4
1
6
3
5
1
2
21
1
2
17
1
0
27
3
36
3
6
8
3
5
3
1
10
21
26
19
0
7
5
14
37
18
31
27
18
18
3
0
1
30
0
36
9
3
5
1
0
12
2
1
0
53
1
7
0
9
7
11
0
18
34
1
18
22
19
7
1
4
8
1
4
4
3
8
1
6
0
0
16
15
12
6
10
4
16
0
10
4
0
17
2
0
37
3
12
2
6
43
3
17
32
5
5
6
19
0
5
3
4
2...

result:

ok 249445 numbers

Test #24:

score: 0
Accepted
time: 488ms
memory: 220764kb

input:

500000 500000 1
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...

output:

17672
25594
24568
36011
16778
68155
51386
2299
1
727
27893
112385
59514
9221
87735
5482
7401
5909
66693
15958
8958
8439
18126
16553
7925
22449
38
35874
4427
140733
9113
2
49766
31636
11655
58122
49282
14144
27748
3741
26121
38539
125007
30785
3224
12580
11780
80245
82717
21451
11646
14234
13585
1832...

result:

ok 250336 numbers

Test #25:

score: 0
Accepted
time: 960ms
memory: 215036kb

input:

500000 500000 1
1 2 1 2 5 6 7 6 9 10 3 6 13 14 15 16 17 18 19 20 21 5 23 24 25 26 18 12 29 30 31 16 11 34 11 36 8 38 28 20 41 18 4 44 45 46 28 30 49 50 51 52 53 54 10 49 57 58 59 39 45 34 63 3 65 66 67 6 69 66 71 72 73 74 75 76 77 78 79 70 76 82 83 56 85 34 87 33 75 90 91 92 93 92 76 23 91 98 82 100...

output:

24
18
43
14
1
0
22
19
11
15
19
23
9
40
15
12
23
1
32
10
13
17
11
4
22
0
43
25
30
19
9
0
45
48
19
22
6
13
29
27
23
29
21
13
19
10
22
31
35
34
23
34
5
26
40
40
12
38
10
11
40
23
0
8
8
31
66
10
27
1
21
1
14
0
38
56
8
10
15
26
5
0
11
16
20
21
14
2
5
2
38
29
7
0
32
0
8
34
46
41
9
8
17
24
22
13
55
1
0
10
...

result:

ok 249887 numbers

Test #26:

score: 0
Accepted
time: 758ms
memory: 220504kb

input:

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

output:

28
90
40
24
60
164
136
127
24
90
29
46
95
154
18
101
65
54
36
33
18
91
106
128
54
125
51
39
50
70
174
76
37
72
0
18
128
58
213
89
178
225
32
57
34
100
1
64
76
16
89
173
1
44
64
47
0
71
51
74
38
109
46
47
42
105
2
105
185
213
168
99
139
29
137
46
44
170
147
49
12
74
35
1
5
26
194
40
104
108
47
52
0
1...

result:

ok 250234 numbers

Test #27:

score: 0
Accepted
time: 799ms
memory: 257516kb

input:

500000 500000 1
1 2 3 4 5 6 7 8 9 10 1 12 13 14 15 16 1 18 19 1 21 1 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 1 1 40 41 42 43 44 1 46 1 48 49 50 51 1 53 54 1 56 57 58 1 60 61 62 63 64 65 66 67 1 69 70 71 1 1 74 75 76 1 1 79 80 1 82 83 84 85 1 87 88 89 1 91 92 93 94 1 96 97 98 99 100 1 102 1 104 ...

output:

6
1
1
2
0
1
1
5
6
1
1
2
7
2
1
1
1
1
1
1
2
1
5
0
8
5
1
2
18
11
0
6
1
1
1
1
6
2
1
2
2
4
9
4
2
1
4
10
0
1
2
5
1
2
4
0
1
2
8
1
1
3
6
0
3
3
3
0
4
0
7
7
9
2
8
1
1
4
0
0
0
5
1
0
1
0
1
3
1
1
8
0
7
3
2
3
2
2
10
0
6
1
0
1
4
2
5
2
1
7
0
6
1
0
2
5
5
2
0
9
11
0
6
0
0
4
2
2
1
1
2
1
1
7
10
1
6
1
4
5
1
4
1
1
0
0
0
...

result:

ok 249962 numbers

Test #28:

score: 0
Accepted
time: 982ms
memory: 212872kb

input:

500000 500000 1
1 2 3 4 5 2 7 1 9 10 11 11 13 14 15 4 11 9 15 20 21 22 16 24 25 26 27 28 26 30 31 32 17 31 23 14 37 38 7 27 41 23 43 37 45 46 28 18 36 29 20 52 53 54 55 10 57 55 59 60 11 51 17 64 65 66 67 68 56 70 71 48 73 74 28 16 77 39 12 80 57 82 58 84 85 86 77 19 89 90 91 92 93 32 24 96 97 73 99...

output:

14
8
20
11
16
29
23
18
12
45
17
36
24
13
23
27
4
6
38
18
10
9
25
48
6
33
14
15
34
34
14
2
7
36
7
31
11
26
7
6
6
27
24
34
14
27
6
11
5
6
16
7
7
17
1
22
20
0
20
3
18
4
21
18
21
47
1
55
5
0
22
11
30
20
14
15
9
8
52
0
5
9
20
23
44
29
21
4
24
14
0
14
16
14
11
2
26
22
38
38
35
19
18
22
3
12
13
18
14
30
23...

result:

ok 249922 numbers

Test #29:

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

input:

500000 499997 1
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...

output:

2282
1315
2875
15269
39
3503
172
3457
1
24667
6229
4864
15610
3
17487
30144
4430
1290
604
3342
45459
44598
32
13912
30630
8705
1929
3988
6426
5772
25750
16152
37539
39892
1
362
28327
2442
15170
32617
3008
22557
342
1839
12421
296
16557
673
64
13283
10048
5587
5201
4262
1357
10602
24727
302
6966
1201...

result:

ok 250713 numbers

Test #30:

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

input:

499995 499999 1
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...

output:

1141
296
28
867
762
968
829
22
161
403
468
499
15
97
838
712
825
651
51
576
50
178
764
424
36
641
341
313
352
31
48
655
280
68
44
64
696
414
1480
91
1308
36
103
660
689
61
124
48
15
789
887
1376
894
524
527
100
1356
732
635
1181
542
429
1336
841
531
0
43
1090
369
143
1405
890
1375
266
344
106
441
39...

result:

ok 250303 numbers

Subtask #4:

score: 10
Accepted

Dependency #3:

100%
Accepted

Test #31:

score: 10
Accepted
time: 431ms
memory: 259628kb

input:

500000 250000 2
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...

output:

865
5300
10122
12652
17483
35706
2763
14333
7545
3654
160
744
91565
33848
11852
28057
66
3
1
179
575
10126
638
25367
24692
53226
7590
20009
59091
43950
19912
2206
57020
10360
7601
9062
35619
11825
8648
18166
15932
48452
169
16770
44001
627
150
32621
7324
229
27803
659
8437
39
870
2
1433
61
33892
233...

result:

ok 124735 numbers

Test #32:

score: 0
Accepted
time: 545ms
memory: 208184kb

input:

500000 499997 1
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...

output:

5286
1048
1042
3261
2592
516
2383
1987
2806
5
1049
2060
2398
1581
812
1856
2065
2454
1766
2051
4043
3047
2570
1565
1
5056
1362
398
592
2722
4060
6
2797
98
4048
5399
1519
2025
6018
3193
5339
581
4954
2083
5477
2479
1376
3253
178
690
1789
2753
493
2252
1997
2556
3004
1885
2119
1996
3525
3904
3078
1128...

result:

ok 250157 numbers

Test #33:

score: 0
Accepted
time: 434ms
memory: 277892kb

input:

500000 250000 2
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...

output:

41399
72571
2598
102571
47010
4334
127395
46710
224
24227
853
28918
39555
9760
78459
13111
273
65
59059
1
58227
170800
6491
2653
115536
1056
30840
21904
175123
38477
17036
5127
8666
17781
28886
16778
162966
251
157943
11000
1728
11496
5938
27977
29071
124740
1787
32357
2162
12037
34621
23559
5588
99...

result:

ok 125344 numbers

Test #34:

score: 0
Accepted
time: 549ms
memory: 233900kb

input:

500000 500000 1
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...

output:

662
295
8243
1
7354
4629
1815
14651
7578
10210
9036
9612
11420
7239
574
4626
1727
11388
13884
441
641
3845
4440
457
4
7596
1974
5420
10998
714
7342
18366
503
16238
2770
734
294
6359
4957
3078
1558
2274
10861
0
13638
9110
9958
265
0
851
2302
8601
505
950
3
4638
943
8681
391
10675
1
8367
131
173
14902...

result:

ok 249990 numbers

Test #35:

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

input:

499998 500000 1
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...

output:

67
334
356
83
31
258
378
10
965
63
36
333
1407
921
215
16
405
19
136
47
96
128
393
71
152
41
552
1006
139
694
1123
73
748
59
851
22
19
77
600
584
741
59
1928
1363
1087
825
510
197
427
329
26
2
261
75
148
53
102
67
1446
10
542
1031
135
767
19
1601
1041
1254
262
505
97
912
251
96
78
346
23
81
1519
706...

result:

ok 249863 numbers

Test #36:

score: 0
Accepted
time: 540ms
memory: 231432kb

input:

500000 500000 1
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...

output:

2381
2056
1379
1
5404
959
1667
62
838
1382
1075
296
94
618
2455
2365
1
704
1619
287
127
47
470
1379
293
783
1169
701
691
123
276
1751
156
832
3490
1306
1841
136
3537
87
2384
929
113
1350
372
1404
1427
203
1168
1
453
291
1021
1771
91
1394
771
233
1631
5857
360
116
3229
4132
103
75
179
2121
295
4136
9...

result:

ok 249909 numbers

Test #37:

score: 0
Accepted
time: 600ms
memory: 253528kb

input:

500000 250000 2
1 2 3 4 5 5 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...

output:

102
141
1
3
52
109
496
25
257
488
34
17
4
120
383
304
1
448
254
258
200
0
126
4
81
338
137
2
368
113
335
147
336
306
170
34
94
7
115
161
210
532
4
143
189
342
91
2
36
107
3
105
60
25
637
92
61
25
49
212
63
20
214
190
70
29
8
141
104
113
97
60
94
97
301
406
123
152
81
30
277
150
129
203
5
51
117
160
...

result:

ok 125338 numbers

Test #38:

score: 0
Accepted
time: 751ms
memory: 214792kb

input:

499998 250000 2
1 2 3 4 5 6 7 6 9 7 11 10 13 14 15 15 17 18 19 1 20 22 14 24 6 11 27 28 29 30 30 32 33 32 15 21 23 12 39 40 40 42 43 44 45 27 30 48 3 12 51 4 53 54 55 54 12 58 19 40 61 1 63 64 33 3 53 52 24 70 71 39 4 74 11 22 19 78 79 23 61 55 83 36 85 86 87 40 89 8 64 92 84 94 8 75 97 6 99 35 101 ...

output:

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

result:

ok 125397 numbers

Test #39:

score: 0
Accepted
time: 458ms
memory: 269408kb

input:

500000 250000 2
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...

output:

154
0
69087
5403
25769
34936
27150
4941
21567
0
75603
14072
23451
99129
23806
1085
134112
32704
107190
31289
13708
37705
935
21218
24765
59552
9771
82349
114424
5
1
80460
21350
28607
79545
13727
649
618
30226
7445
58
12410
24421
21852
314
71174
30543
17673
34542
17699
8082
22
59866
175
21715
375
124...

result:

ok 124887 numbers

Test #40:

score: 0
Accepted
time: 671ms
memory: 293292kb

input:

500000 166666 3
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 21 29 22 31 32 33 34 35 19 37 38 39 40 41 42 43 44 45 46 39 48 49 50 51 52 53 54 55 56 28 58 59 60 61 20 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 54 85 86 87 88 89 90 91 92 93 94 95 96 97 98...

output:

45
1
112
6
38
3
51
12
7
49
15
25
2
3
52
0
1
37
36
49
2
0
4
65
35
15
1
6
9
24
1
30
2
137
172
12
4
7
18
72
1
45
12
5
1
134
46
103
27
1
1
18
26
30
1
9
1
0
0
1
34
1
26
20
12
63
7
6
39
41
1
8
6
25
1
80
51
122
146
30
0
48
24
183
18
0
4
25
188
109
12
51
188
18
81
28
60
0
60
0
57
4
85
0
62
69
0
39
8
35
4
0
...

result:

ok 83412 numbers

Subtask #5:

score: 10
Accepted

Test #41:

score: 10
Accepted
time: 105ms
memory: 204632kb

input:

499997 9 40060
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 ...

output:

1
1
0
0
1
0

result:

ok 6 numbers

Test #42:

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

input:

500000 21 23702
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...

output:

1
1
1
0
1
0

result:

ok 6 numbers

Test #43:

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

input:

500000 20 24356
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...

output:

1
0
0
1
1
0
1
8454
1

result:

ok 9 numbers

Test #44:

score: 0
Accepted
time: 128ms
memory: 206068kb

input:

500000 20 20150
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...

output:

1
1
1
1
0
1
0
1
1
0

result:

ok 10 numbers

Test #45:

score: 0
Accepted
time: 229ms
memory: 200304kb

input:

499998 22 20008
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...

output:

1
1
1
0
1
1
1
0
1
1
1
0
0
1
1

result:

ok 15 numbers

Test #46:

score: 0
Accepted
time: 163ms
memory: 201332kb

input:

500000 24 20019
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...

output:

1
0
1
1
0
16
0
1
1

result:

ok 9 numbers

Test #47:

score: 0
Accepted
time: 158ms
memory: 204460kb

input:

499995 17 29083
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...

output:

0
1
0
0
1
0

result:

ok 6 numbers

Test #48:

score: 0
Accepted
time: 1079ms
memory: 894868kb

input:

499999 4 104570
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...

output:

1

result:

ok 1 number(s): "1"

Test #49:

score: 0
Accepted
time: 120ms
memory: 212872kb

input:

500000 24 20763
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...

output:

1
0
1
1
1
0
1
1
1
1
1
1
53
1
1
1
1

result:

ok 17 numbers

Test #50:

score: 0
Accepted
time: 769ms
memory: 675440kb

input:

500000 24 20521
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...

output:

1
0
1
0
0
1
1
0
0
0
0
15456
1
1

result:

ok 14 numbers

Subtask #6:

score: 10
Accepted

Test #51:

score: 10
Accepted
time: 484ms
memory: 393692kb

input:

500000 62500 8
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 ...

output:

401
4604
1323
306
4495
376
586
755
1378
93
4870
2851
11048
323
394
285
38
3851
2964
10676
877
2741
5036
921
243
436
3738
638
594
620
5202
644
342
1969
1899
87
779
106
3665
3770
20
227
198
85
1504
1455
3
124
591
11012
33
50
36374
0
10596
188
192
28
29
177
417
2141
21266
153
728
2
2
1215
10296
0
0
630...

result:

ok 31162 numbers

Test #52:

score: 0
Accepted
time: 680ms
memory: 521472kb

input:

500000 55555 9
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 ...

output:

1077
1
1176
42
91
0
1413
3059
190
1
5
151
4374
18
5
1
1
373
229
11
499
277
4
172
1
2
11
715
0
292
0
1
56
1539
1775
26
6
2056
17
3
756
9
1
348
471
35
1
0
1
5
77
17
95
7
73
1493
2104
9
1210
378
0
42
669
408
0
9
2
4
2
8
161
0
0
20
47
11
1
0
333
0
5
0
902
48
445
60
135
301
870
230
823
696
744
2424
40
37...

result:

ok 27741 numbers

Test #53:

score: 0
Accepted
time: 347ms
memory: 488600kb

input:

500000 2 186199
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...

output:

0
1

result:

ok 2 number(s): "0 1"

Test #54:

score: 0
Accepted
time: 937ms
memory: 883972kb

input:

500000 15 28214
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...

output:

1
1
0
1
1
1
1

result:

ok 7 numbers

Test #55:

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

input:

500000 125000 4
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...

output:

13
94
1094
13
1121
19
7351
119
2434
597
680
182
1556
67
2080
1586
397
2
12
3
7670
342
841
40
575
253
430
255
268
71
18161
80
34
34
1253
1561
59
1829
573
1459
4446
5
0
5469
394
651
271
253
201
304
138
4341
609
251
0
149
135
657
247
34
4
10
5
16
1394
0
3352
14
945
41
46
3
2
1347
34
114
3
208
20
721
47...

result:

ok 62457 numbers

Test #56:

score: 0
Accepted
time: 782ms
memory: 649956kb

input:

500000 26315 19
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...

output:

1
1
2
3
0
4
39
3
5
2
1
51
1
1
1
1
0
66
83
9
26
100
2
3
0
4
1
1
7
1
5
110
1
0
0
1
5
2
1
3
76
1
1
366
1
3
0
1
0
14
0
9
0
463
21
10
0
88
0
2
6
0
1
0
0
1
21
0
0
0
43
0
1
27
26
7
0
2
0
1
2
4
1
0
1
1
23
258
20
6
1
20
27
14
3
0
19
1
0
19
1
0
3
14
3
0
1
0
0
0
2
0
0
1
0
0
0
1
0
0
0
3
0
0
0
1
0
7
16
74
0
2
1
...

result:

ok 13305 numbers

Test #57:

score: 0
Accepted
time: 258ms
memory: 443496kb

input:

500000 2 241759
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...

output:

1
1

result:

ok 2 number(s): "1 1"

Test #58:

score: 0
Accepted
time: 542ms
memory: 485872kb

input:

500000 41666 12
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...

output:

865
170
1385
1052
19
1
18
1846
650
172
242
11
6962
137
138
54
1
279
225
3
83
15
4
326
15
2345
649
8
1266
1
6
132
2039
24
273
239
25
26
50
17
77
6
161
210
4
712
1817
226
33
104
12
71
1
66
315
2027
132
283
0
253
0
152
149
14
0
190
250
97
103
19
0
0
142
569
73
0
22
64
0
96
28
15
1103
0
62
2
136
107
0
1...

result:

ok 20629 numbers

Test #59:

score: 0
Accepted
time: 346ms
memory: 325392kb

input:

500000 100000 5
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...

output:

1613
4142
18441
23260
9995
4104
621
11967
19653
502
30308
5956
67434
55582
379
21589
376
3272
4
59395
18569
1823
11654
0
6534
3305
23875
1770
1282
1143
2239
3192
32801
55723
2653
11214
384
6748
2086
34608
9052
11193
3397
836
3727
12693
63
2273
18946
6593
8011
3351
2496
27877
10998
1854
1654
57943
50...

result:

ok 49706 numbers

Test #60:

score: 0
Accepted
time: 636ms
memory: 554476kb

input:

499998 50000 10
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...

output:

1
1
98
2
18
107
20
54
3
460
387
1
30
5
1
201
1
8
85
1
0
243
2
1
0
4
12
16
25
22
3
20
23
5
9
18
0
2
212
1
9
1
3
3
1
6
783
0
1
133
1450
4
3
13
1090
749
0
133
5
0
0
1
0
138
122
1188
0
8
0
1
403
1
0
8
0
0
8
467
0
1254
4915
58
548
66
77
0
260
147
23
1
63
0
30
183
17
63
35
22
225
55
4
3
0
7
735
8
32
2
1
0...

result:

ok 25130 numbers

Subtask #7:

score: 10
Accepted

Test #61:

score: 10
Accepted
time: 255ms
memory: 232996kb

input:

500000 100000 5
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...

output:

4
17986
30064
174788
38161
211015
106448
91622
13037
95529
151167
65689
66396
156390
28230
176115
272339
89286
141946
222298
17188
18213
11792
181011
84012
52257
5989
7
124253
93612
38134
153437
28244
265895
49422
144945
116186
6479
39619
48047
258474
169068
66514
134304
108561
96952
184906
38445
12...

result:

ok 49976 numbers

Test #62:

score: 0
Accepted
time: 204ms
memory: 204920kb

input:

500000 4347 115
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...

output:

381
1184
924
428
1113
185
413
980
847
563
716
762
132
801
1172
683
1672
811
963
353
137
345
1672
782
1299
494
678
1686
1051
528
711
525
719
735
339
222
338
1381
1149
156
1127
550
1092
348
391
1058
370
223
168
1366
887
1909
659
1298
1001
346
18
234
811
1096
945
369
934
152
727
539
623
682
705
530
523...

result:

ok 2139 numbers

Test #63:

score: 0
Accepted
time: 181ms
memory: 214912kb

input:

500000 894 559
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 ...

output:

45841
57369
47961
21359
43940
75679
48499
7937
50236
35726
35188
31730
23051
59201
48034
16230
51774
55
55300
95554
20213
37085
47959
53184
53679
43863
5744
37713
50936
79078
7566
24125
107494
30072
26137
28785
9890
43140
38716
7027
18061
11848
34617
39559
66408
2603
46839
69717
1171
120070
19150
49...

result:

ok 447 numbers

Test #64:

score: 0
Accepted
time: 404ms
memory: 201044kb

input:

500000 71428 7
1 2 1 2 1 6 7 4 9 10 5 12 8 12 15 16 6 18 19 20 17 18 23 24 25 26 27 28 15 30 31 32 33 14 1 36 37 38 19 40 41 42 43 44 45 46 47 48 49 50 51 46 53 43 55 56 32 58 59 60 50 62 7 64 65 66 67 68 69 70 71 72 73 74 75 76 77 39 2 63 59 82 83 84 85 86 87 88 89 90 91 87 93 74 95 96 51 98 22 100...

output:

63
46
16
16
23
20
19
20
31
32
23
40
53
30
66
27
28
64
31
91
57
22
40
47
72
14
39
50
54
55
38
2
32
23
49
46
32
12
47
19
44
22
52
21
9
34
24
35
35
50
20
35
63
13
39
25
37
42
11
64
44
54
77
53
43
29
31
25
12
61
16
62
13
55
26
25
45
37
36
31
52
47
43
22
68
17
30
27
53
11
23
1
52
36
41
30
48
28
13
8
28
3...

result:

ok 35811 numbers

Test #65:

score: 0
Accepted
time: 401ms
memory: 203464kb

input:

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

output:

180
180
205
190
91
78
185
185
39
97
115
51
116
90
150
119
117
155
118
92
174
120
37
111
137
93
176
228
102
125
195
168
8
49
33
127
94
72
56
144
27
159
86
110
115
73
111
60
47
301
139
197
57
75
153
165
80
68
158
47
140
70
71
124
127
141
55
184
52
126
122
113
69
59
123
121
65
77
77
209
103
158
127
48
...

result:

ok 49863 numbers

Test #66:

score: 0
Accepted
time: 174ms
memory: 205640kb

input:

499997 1754 285
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...

output:

5524
80
2693
1560
2
2806
3554
2203
3013
3080
4637
3512
1282
11039
1390
4885
5
1569
1689
4068
3087
523
222
18
2055
46
4983
1956
8121
2756
2020
1451
571
11222
4379
3210
398
2082
1348
3005
3509
3393
2341
3210
1084
1492
998
1256
606
2086
394
1724
3425
364
693
4670
1369
12119
6560
2179
2269
2092
7
2899
5...

result:

ok 849 numbers

Test #67:

score: 0
Accepted
time: 118ms
memory: 210820kb

input:

500000 4 101724
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...

output:

3

result:

ok 1 number(s): "3"

Test #68:

score: 0
Accepted
time: 306ms
memory: 205148kb

input:

500000 100000 5
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 13 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 25 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 11 98...

output:

1319
1294
367
1381
1296
323
973
826
1199
1210
327
754
677
720
272
1801
640
487
502
209
1004
810
744
1252
513
887
645
383
350
1475
751
430
415
1167
1007
528
618
1234
433
114
1896
896
322
881
47
547
667
912
481
1014
1710
665
632
1021
87
215
6
882
2173
1138
924
3
422
333
612
366
740
503
653
1179
931
16...

result:

ok 49875 numbers

Test #69:

score: 0
Accepted
time: 214ms
memory: 205244kb

input:

500000 50000 10
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...

output:

189
534
1594
529
138
214
998
628
200
398
698
190
1310
106
242
249
666
311
63
1295
158
67
96
1245
1375
39
1041
966
132
279
383
211
233
919
983
12
234
4
1987
1630
1346
443
289
971
1408
850
1726
304
883
1507
534
589
1859
400
843
761
491
180
241
734
1695
408
854
709
774
557
77
40
114
330
1614
534
438
26...

result:

ok 25010 numbers

Test #70:

score: 0
Accepted
time: 99ms
memory: 221608kb

input:

499996 2 222404
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...

output:

3

result:

ok 1 number(s): "3"

Subtask #8:

score: 10
Accepted

Test #71:

score: 10
Accepted
time: 63ms
memory: 194432kb

input:

25000 2500 10
1 2 3 4 5 6 7 8 9 10 1 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:

1
1
1
4
1
1
1
1
0
2
21
1
1
1
1
1
6
1
3
1
2
0
0
1
2
2
2
1
0
1
1
2
0
14
2
0
1
0
1
1
0
1
1
3
1
1
2
1
3
2
0
0
0
0
0
0
0
0
0
0
0
2
1
1
1
0
0
0
1
0
0
0
19
0
4
0
0
0
1
1
0
0
0
0
0
1
0
1
1
2
2
0
30
0
4
3
0
1
0
0
0
0
0
3
3
0
1
1
1
1
0
0
0
2
4
0
0
1
0
0
0
1
13
0
0
1
0
1
0
0
3
0
0
0
0
0
39
2
0
0
0
0
0
2
0
0
0
...

result:

ok 1310 numbers

Test #72:

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

input:

25000 3570 7
1 2 2 4 5 4 6 1 2 1 2 4 9 6 5 16 17 7 19 15 20 22 10 24 25 20 25 12 12 30 31 32 11 34 35 25 37 38 39 15 41 42 43 32 27 28 47 48 21 12 29 2 5 54 55 4 6 6 59 25 61 57 63 64 65 26 57 37 69 48 49 72 73 74 57 72 77 37 79 6 81 82 83 84 21 55 61 88 78 76 91 92 39 69 95 7 84 98 55 100 101 94 24...

output:

1
1
0
1
0
1
1
1
1
0
0
1
1
1
0
1
1
1
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
1
0
1
1
0
0
0
0
0
0
0
0
1
1
1
0
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1759 numbers

Test #73:

score: 0
Accepted
time: 68ms
memory: 213820kb

input:

25000 3125 8
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:

1
1
0
1
1
0
0
2
1
1
0
1
1
1
0
1
1
1
1
1
1
0
0
1
1
0
1
0
0
2
0
1
1
1
1
0
0
1
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
1
1
0
4
0
12
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
3
0
0
0
0
0
0
0
0
0
0
0
0
0
7
1
0
0
0
0
0
2
0
0
0
3
1
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 1567 numbers

Test #74:

score: 0
Accepted
time: 56ms
memory: 199088kb

input:

25000 2079 12
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:

24
1
2
1
0
2
12
2
1
2
13
2
1
2
7
1
1
3
18
5
0
2
1
1
2
1
6
4
1
14
0
11
1
1
12
0
1
2
1
1
1
9
1
2
21
2
0
4
0
3
0
1
2
4
3
6
4
5
3
1
0
1
34
3
0
0
0
1
1
1
0
1
13
0
9
23
4
0
5
5
1
0
2
0
0
1
0
0
16
0
0
0
2
0
4
0
0
0
1
1
1
31
0
1
0
53
1
7
1
0
0
0
20
0
3
16
3
0
0
3
0
0
6
4
0
5
0
0
0
3
70
0
6
0
2
0
0
28
0
1
4
...

result:

ok 1058 numbers

Test #75:

score: 0
Accepted
time: 56ms
memory: 185116kb

input:

25000 25000 1
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:

2798
2755
1063
1447
7043
8002
2036
2
323
40
262
907
7086
6920
155
472
162
6795
3971
516
3097
127
7608
2551
854
1422
1954
4783
431
6479
1258
1397
513
2080
1258
1548
1576
1875
1116
6050
3485
663
2527
5477
166
272
1470
257
2727
732
2353
5454
353
668
1719
1285
1121
30
465
1275
472
649
4481
5165
4776
251...

result:

ok 12503 numbers

Test #76:

score: 0
Accepted
time: 59ms
memory: 185496kb

input:

25000 12499 2
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 1 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:

29
80
19
98
50
113
4
18
57
22
11
5
15
12
54
42
22
14
8
19
64
39
42
40
2
1
56
6
14
30
26
11
75
26
19
43
138
18
8
27
23
107
13
63
18
39
69
79
34
53
4
23
34
4
15
11
41
6
74
47
37
65
0
41
25
35
34
55
227
8
8
13
75
3
40
89
36
59
45
3
24
42
205
113
24
17
32
5
5
1
36
1
22
57
180
10
75
18
4
3
68
207
1
79
6
...

result:

ok 6223 numbers

Test #77:

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

input:

25000 3123 8
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:

25
71
1
475
56
73
62
56
20
0
9
425
41
12
0
213
369
4
38
2
44
28
11
58
10
12
59
6
2
1
100
148
0
5
1
16
62
5
129
0
376
185
11
3
7
1
1180
976
13
0
125
2
13
1
16
21
20
236
6
2
310
4
3
650
5
1
0
373
108
17
15
52
16
40
182
28
117
43
9
20
0
46
47
19
12
235
310
127
11
17
159
5
259
122
26
0
30
12
63
25
12
65...

result:

ok 1572 numbers

Test #78:

score: 0
Accepted
time: 63ms
memory: 193556kb

input:

24997 45 496
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:

1
0
1
0
1
0
0
0
1
0
0
1
1
1
1
1
1
1
218
1
0

result:

ok 21 numbers

Test #79:

score: 0
Accepted
time: 55ms
memory: 187312kb

input:

24997 12500 2
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:

277
104
13
187
153
3061
566
1967
2176
14
1501
401
171
8
1674
1528
97
313
8
557
1905
232
17
39
88
564
385
32
24
178
45
9
542
947
36
2418
1840
2670
2690
280
2672
179
2
9
94
4
72
6
1272
75
2627
1057
835
1025
2026
1
1133
58
230
1344
382
242
0
2328
71
218
1425
5
33
95
53
645
22
76
25
1393
2
26
676
8
1693...

result:

ok 6313 numbers

Test #80:

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

input:

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

output:

1
1
1
1
2
2
1
1
2
0
1
2
1
1
1
0
2
1
1
1
1
1
1
1
0
2
5
2
1
2
0
1
0
1
1
0
1
0
1
0
0
0
0
4
1
1
1
1
0
1
4
0
0
1
0
0
3
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
3
0
0
0
0
0
0
0
2
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1783 numbers

Subtask #9:

score: 10
Accepted

Dependency #8:

100%
Accepted

Test #81:

score: 10
Accepted
time: 666ms
memory: 618628kb

input:

250000 13888 18
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...

output:

1
0
1
1
0
0
0
0
0
1
1
0
0
1
1
1
0
1
1
0
1
1
1
1
1
1
0
0
0
0
0
0
0
1
0
1
1
1
1
0
1
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 6992 numbers

Test #82:

score: 0
Accepted
time: 720ms
memory: 641572kb

input:

250000 501 499
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 ...

output:

0
0
0
1
1
1
1
1
1
1
1
0
0
1
0
1
1
0
0
1
1
1
0
0
1
1
1
0
0
1
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
10
0
10
4
0
0
7
0
0
2
75
112
0
18
7
0
32
7
0
219
421
0
0
0
410
314
0
2
252
0
7
503
528
11
629
455
2
0
28
455
13
2
0
...

result:

ok 237 numbers

Test #83:

score: 0
Accepted
time: 75ms
memory: 198484kb

input:

250000 22 11183
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...

output:

1
0
1
0
1
1
1

result:

ok 7 numbers

Test #84:

score: 0
Accepted
time: 250ms
memory: 315292kb

input:

250000 25000 10
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 1 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 ...

output:

0
5
5
2
14
19
1
7
2
1
1
84
3
1
1
49
5
3
1
2
1
4
2
12
4
5
4
0
3
1
5
2
7
5
4
1
1
5
0
0
5
6
0
4
1
1
40
7
3
1
4
17
0
0
0
4
1
31
8
4
1
4
0
0
8
0
2
3
21
2
7
0
1
0
0
0
13
3
9
0
0
0
0
10
1
0
3
5
0
0
6
8
0
0
4
4
2
0
9
2
16
4
3
0
0
3
9
0
1
3
1
0
17
51
0
8
0
2
0
3
1
0
30
7
0
0
0
0
2
0
0
5
1
5
0
6
0
16
1
36
0
1...

result:

ok 12442 numbers

Test #85:

score: 0
Accepted
time: 200ms
memory: 304420kb

input:

250000 5 44600
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 ...

output:

1
1

result:

ok 2 number(s): "1 1"

Test #86:

score: 0
Accepted
time: 189ms
memory: 204124kb

input:

249999 125000 2
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...

output:

333
39
1273
1280
1946
808
56
49
214
816
301
1254
1106
52
425
485
157
368
1282
2018
563
394
1459
984
1036
564
1092
278
1731
29
98
506
778
1184
1268
2355
1494
474
187
581
393
253
347
941
545
953
610
639
556
348
82
127
329
180
634
721
927
262
602
994
811
2404
1832
480
234
369
320
1016
295
457
477
335
6...

result:

ok 62442 numbers

Test #87:

score: 0
Accepted
time: 279ms
memory: 267508kb

input:

249999 83333 3
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 ...

output:

4381
2
807
1364
18
926
14583
45
186
4745
797
871
2
3803
280
628
10
266
927
264
705
4853
80
891
20125
12395
76
6
3645
3227
277
6
0
80
1509
615
3455
52
140
33
552
7
25
304
10142
862
1817
1429
989
9
5473
158
9
4
3543
9591
2447
278
4626
280
6029
8
43
7657
6732
1073
58
3592
1687
44
2900
5613
2587
28
409
...

result:

ok 41623 numbers

Test #88:

score: 0
Accepted
time: 257ms
memory: 198188kb

input:

250000 249999 1
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...

output:

22708
16003
7135
24344
36879
34037
1990
10856
874
8708
25245
2
20884
27681
14617
11529
589
635
23403
16727
3030
7996
1
18725
13395
7477
11803
27936
12186
5721
9139
1484
13908
16288
2166
19952
2265
4686
14184
20000
18289
7007
15938
22881
15790
4108
19798
13303
2310
18081
37398
31248
18999
7630
37226
...

result:

ok 124681 numbers

Test #89:

score: 0
Accepted
time: 347ms
memory: 340104kb

input:

249998 1278 195
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...

output:

1
1
1
1
0
1
0
1
1
0
1
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 652 numbers

Test #90:

score: 0
Accepted
time: 334ms
memory: 382904kb

input:

250000 16666 15
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...

output:

2
1
1
1
1
3
3
9
14
8
0
4
4
0
1
6
22
1
1
3
2
5
1
7
0
1
35
1
17
3
2
1
1
6
2
42
1
1
0
23
3
3
1
1
0
3
0
0
1
0
0
9
45
0
0
1
0
54
0
0
1
6
3
2
6
5
0
6
6
0
1
1
2
4
4
2
0
1
0
9
0
3
0
0
0
0
17
0
0
2
3
0
0
0
0
0
3
3
0
2
0
0
7
2
3
3
2
0
101
0
0
7
4
3
0
17
1
0
0
1
3
0
0
19
0
0
30
21
18
0
0
7
1
0
3
0
0
0
7
3
0
1
...

result:

ok 8332 numbers

Subtask #10:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Dependency #9:

100%
Accepted

Test #91:

score: 10
Accepted
time: 415ms
memory: 350120kb

input:

500000 83333 6
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 ...

output:

80
15
1721
439
2002
781
1837
5167
526
1758
0
931
129
1431
26
2177
39
8
1999
8
0
84
1414
213
2582
1063
34
11
120
54
2
73
980
3
566
0
0
1
1
4
340
2630
0
313
720
24
1031
136
272
326
460
4201
1
1760
15
398
23
5
2123
3934
12
7
143
3800
6
2027
38
772
38
14
1287
1613
4
2456
2128
5173
209
4408
0
330
74
3078...

result:

ok 41641 numbers

Test #92:

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

input:

499997 100000 5
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...

output:

3692
450
1685
8
1703
290
12
7294
762
594
4
0
44
10
2
727
283
0
216
4447
1
21
78
1546
4
43
838
947
368
134
2185
0
812
764
0
99
312
1080
343
1581
598
2931
14
309
1132
1119
865
2
17
1127
201
754
1587
5689
0
3058
3
835
44
818
1753
30
2178
1637
3
1239
29
292
18
36
2411
1193
4209
407
10
2
283
1665
313
295...

result:

ok 49905 numbers

Test #93:

score: 0
Accepted
time: 393ms
memory: 217868kb

input:

500000 250000 2
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...

output:

3731
485
25
3923
7
2748
498
4693
2459
7429
2724
729
10252
12
2007
10956
692
8179
240
10958
2991
1
4858
13760
1799
3814
6535
6577
3936
785
7482
4433
5600
6179
507
1928
1162
5212
1850
4697
9070
8
9156
11500
8274
11426
4804
6357
4468
244
903
8417
2125
0
2510
7425
1384
1525
3933
3445
12523
5656
2376
8
1...

result:

ok 125142 numbers

Test #94:

score: 0
Accepted
time: 342ms
memory: 216440kb

input:

499999 249996 2
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...

output:

653
3
640
1289
51
131
352
467
3622
73
2545
711
190
290
114
734
644
235
92
180
815
252
1487
522
1074
2577
2209
9
659
465
245
1333
2239
1127
1472
499
7193
1
961
4777
2063
0
212
380
3809
4453
291
1952
2
410
301
134
2586
120
4201
2931
295
1104
495
93
1175
257
431
154
29
1316
103
1548
204
7305
740
673
41...

result:

ok 125062 numbers

Test #95:

score: 0
Accepted
time: 581ms
memory: 424868kb

input:

500000 83333 6
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 ...

output:

15
12590
9538
2585
1
1
6581
4
348
10
585
7
57
1389
1266
8168
28
4316
4511
3611
126
1533
44
1558
109
2837
1816
2670
98
289
9613
3636
23
0
12
331
228
28
397
1195
1904
301
10173
168
230
2
28
259
1428
1026
435
117
172
6717
7590
7812
3653
40
9
4632
2
21
1722
3
64
17086
8562
22
4253
1586
3632
426
224
24
3...

result:

ok 41754 numbers

Test #96:

score: 0
Accepted
time: 828ms
memory: 719312kb

input:

499999 6 72790
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 ...

output:

0

result:

ok 1 number(s): "0"

Test #97:

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

input:

500000 250000 2
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...

output:

3654
3877
6
2
1641
7242
2599
7807
5334
10
1463
5174
6177
5082
3036
2327
2758
6207
2604
1
5771
2044
8778
7143
7742
8338
1978
97
3929
7907
2890
545
1953
61
3709
867
4097
2379
1205
9236
959
4136
5637
5856
2163
0
8907
2938
2177
861
906
631
2315
4340
8485
170
2055
5654
51
3318
1360
4023
1761
1171
1331
12...

result:

ok 124834 numbers

Test #98:

score: 0
Accepted
time: 123ms
memory: 233112kb

input:

500000 9 50469
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 ...

output:

1
0
1
1
1
1

result:

ok 6 numbers

Test #99:

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

input:

500000 2 193269
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...

output:

0

result:

ok 1 number(s): "0"

Test #100:

score: 0
Accepted
time: 801ms
memory: 402096kb

input:

499995 166664 3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 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 1 53 1 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 1 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

1
1
4
1
1
2
1
3
4
1
4
0
1
11
0
2
10
0
1
0
1
3
1
0
1
1
10
1
1
1
1
1
0
2
11
0
1
1
2
1
0
1
19
1
1
2
0
1
2
1
1
0
1
0
0
3
1
1
0
0
4
2
0
0
6
0
0
1
0
0
0
2
0
0
0
0
0
0
0
0
0
0
0
7
0
2
0
5
2
22
1
0
0
2
0
0
0
0
7
0
0
0
1
0
0
11
0
0
0
14
0
0
7
0
0
4
1
3
3
0
0
0
1
0
0
1
7
0
0
0
2
1
0
2
12
2
7
1
0
3
0
0
4
0
4
0...

result:

ok 83413 numbers