QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#521472#5039. Black and WhitelyceggAC ✓2ms5544kbC++201.1kb2024-08-16 11:13:212024-08-16 11:13:22

Judging History

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

  • [2024-08-16 11:13:22]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:5544kb
  • [2024-08-16 11:13:21]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
int t,n,m,k;
#define M 998244353
int jiecheng[200200];
int mypow(int a,int b){
    int ret=1;
    while(b){
        if(b&1)ret=ret*a%M;
        a=a*a%M;
        b/=2;
    }
    return ret;
}
int niyuan(int a){
    return mypow(a,M-2);
}
int zuhe(int a,int b){
    if(a<b)return 0;
    if(b<0)return 0;
    return jiecheng[a]*niyuan(jiecheng[b]*jiecheng[a-b]%M)%M;
}
int jia1,jian1;
int qry(int v){
    int jianab=v+jia1-jian1;
    if(jianab%2!=0)return 0;
    jianab/=2;
    int jiaab=m;
    if((jianab+jiaab)%2!=0)return 0;
    int a=(jianab+jiaab)/2,b=(jiaab-jianab)/2;
    int ret=zuhe(jia1,a)*zuhe(jian1,b)%M;
    //printf("%lld\n",ret);
    return ret;
}
signed main(){
    scanf("%lld",&t);
    jiecheng[0]=1;
    for(int i=1;i<200200;i++)
        jiecheng[i]=jiecheng[i-1]*i%M;
    while(t--){
        scanf("%lld%lld%lld",&n,&m,&k);
        jia1=0,jian1=0;
        int sum=n+m;
        jian1=sum/2;
        jia1=sum-jian1;
        printf("%lld\n",(qry(4*k-2)+qry(4*k-1)+qry(4*k)+qry(4*k+1))%M);
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 5404kb

input:

5
1 1 0
1 1 -1
2 2 1
2 2 0
4 4 1

output:

1
0
1
4
16

result:

ok 5 number(s): "1 0 1 4 16"

Test #2:

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

input:

100
1 1 -10
1 1 -9
1 1 -8
1 1 -7
1 1 -6
1 1 -5
1 1 -4
1 1 -3
1 1 -2
1 1 -1
1 1 0
1 1 1
1 1 2
1 1 3
1 1 4
1 1 5
1 1 6
1 1 7
1 1 8
1 1 9
1 1 10
1 2 -10
1 2 -9
1 2 -8
1 2 -7
1 2 -6
1 2 -5
1 2 -4
1 2 -3
1 2 -2
1 2 -1
1 2 0
1 2 1
1 2 2
1 2 3
1 2 4
1 2 5
1 2 6
1 2 7
1 2 8
1 2 9
1 2 10
1 3 -10
1 3 -9
1 3 -...

output:

0
0
0
0
0
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
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3
0
0
0
0

result:

ok 100 numbers

Test #3:

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

input:

100
1 5 6
1 5 7
1 5 8
1 5 9
1 5 10
1 6 -10
1 6 -9
1 6 -8
1 6 -7
1 6 -6
1 6 -5
1 6 -4
1 6 -3
1 6 -2
1 6 -1
1 6 0
1 6 1
1 6 2
1 6 3
1 6 4
1 6 5
1 6 6
1 6 7
1 6 8
1 6 9
1 6 10
1 7 -10
1 7 -9
1 7 -8
1 7 -7
1 7 -6
1 7 -5
1 7 -4
1 7 -3
1 7 -2
1 7 -1
1 7 0
1 7 1
1 7 2
1 7 3
1 7 4
1 7 5
1 7 6
1 7 7
1 7 8
1 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5
5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6

result:

ok 100 numbers

Test #4:

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

input:

100
1 10 1
1 10 2
1 10 3
1 10 4
1 10 5
1 10 6
1 10 7
1 10 8
1 10 9
1 10 10
2 1 -10
2 1 -9
2 1 -8
2 1 -7
2 1 -6
2 1 -5
2 1 -4
2 1 -3
2 1 -2
2 1 -1
2 1 0
2 1 1
2 1 2
2 1 3
2 1 4
2 1 5
2 1 6
2 1 7
2 1 8
2 1 9
2 1 10
2 2 -10
2 2 -9
2 2 -8
2 2 -7
2 2 -6
2 2 -5
2 2 -4
2 2 -3
2 2 -2
2 2 -1
2 2 0
2 2 1
2 2 ...

output:

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

result:

ok 100 numbers

Test #5:

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

input:

100
2 5 -4
2 5 -3
2 5 -2
2 5 -1
2 5 0
2 5 1
2 5 2
2 5 3
2 5 4
2 5 5
2 5 6
2 5 7
2 5 8
2 5 9
2 5 10
2 6 -10
2 6 -9
2 6 -8
2 6 -7
2 6 -6
2 6 -5
2 6 -4
2 6 -3
2 6 -2
2 6 -1
2 6 0
2 6 1
2 6 2
2 6 3
2 6 4
2 6 5
2 6 6
2 6 7
2 6 8
2 6 9
2 6 10
2 7 -10
2 7 -9
2 7 -8
2 7 -7
2 7 -6
2 7 -5
2 7 -4
2 7 -3
2 7 -2...

output:

0
0
0
6
12
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6
16
6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
10
20
6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
10
25
10
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15
30
10
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #6:

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

input:

100
2 10 -9
2 10 -8
2 10 -7
2 10 -6
2 10 -5
2 10 -4
2 10 -3
2 10 -2
2 10 -1
2 10 0
2 10 1
2 10 2
2 10 3
2 10 4
2 10 5
2 10 6
2 10 7
2 10 8
2 10 9
2 10 10
3 1 -10
3 1 -9
3 1 -8
3 1 -7
3 1 -6
3 1 -5
3 1 -4
3 1 -3
3 1 -2
3 1 -1
3 1 0
3 1 1
3 1 2
3 1 3
3 1 4
3 1 5
3 1 6
3 1 7
3 1 8
3 1 9
3 1 10
3 2 -10
...

output:

0
0
0
0
0
0
0
0
15
36
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
6
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
9
9
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
18
12
1
0
0
0
0

result:

ok 100 numbers

Test #7:

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

input:

100
3 4 7
3 4 8
3 4 9
3 4 10
3 5 -10
3 5 -9
3 5 -8
3 5 -7
3 5 -6
3 5 -5
3 5 -4
3 5 -3
3 5 -2
3 5 -1
3 5 0
3 5 1
3 5 2
3 5 3
3 5 4
3 5 5
3 5 6
3 5 7
3 5 8
3 5 9
3 5 10
3 6 -10
3 6 -9
3 6 -8
3 6 -7
3 6 -6
3 6 -5
3 6 -4
3 6 -3
3 6 -2
3 6 -1
3 6 0
3 6 1
3 6 2
3 6 3
3 6 4
3 6 5
3 6 6
3 6 7
3 6 8
3 6 9
3 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
4
24
24
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
10
40
30
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
10
50
50
10
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
20
75
60
10
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
20
90
90

result:

ok 100 numbers

Test #8:

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

input:

100
3 9 2
3 9 3
3 9 4
3 9 5
3 9 6
3 9 7
3 9 8
3 9 9
3 9 10
3 10 -10
3 10 -9
3 10 -8
3 10 -7
3 10 -6
3 10 -5
3 10 -4
3 10 -3
3 10 -2
3 10 -1
3 10 0
3 10 1
3 10 2
3 10 3
3 10 4
3 10 5
3 10 6
3 10 7
3 10 8
3 10 9
3 10 10
4 1 -10
4 1 -9
4 1 -8
4 1 -7
4 1 -6
4 1 -5
4 1 -4
4 1 -3
4 1 -2
4 1 -1
4 1 0
4 1 1...

output:

20
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
35
126
105
20
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
9
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
12
18
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #9:

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

input:

100
4 4 -3
4 4 -2
4 4 -1
4 4 0
4 4 1
4 4 2
4 4 3
4 4 4
4 4 5
4 4 6
4 4 7
4 4 8
4 4 9
4 4 10
4 5 -10
4 5 -9
4 5 -8
4 5 -7
4 5 -6
4 5 -5
4 5 -4
4 5 -3
4 5 -2
4 5 -1
4 5 0
4 5 1
4 5 2
4 5 3
4 5 4
4 5 5
4 5 6
4 5 7
4 5 8
4 5 9
4 5 10
4 6 -10
4 6 -9
4 6 -8
4 6 -7
4 6 -6
4 6 -5
4 6 -4
4 6 -3
4 6 -2
4 6 -1...

output:

0
1
16
36
16
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5
40
60
20
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5
50
100
50
5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15
100
150
60
5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15
120
225
120
15
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #10:

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

input:

100
4 9 -8
4 9 -7
4 9 -6
4 9 -5
4 9 -4
4 9 -3
4 9 -2
4 9 -1
4 9 0
4 9 1
4 9 2
4 9 3
4 9 4
4 9 5
4 9 6
4 9 7
4 9 8
4 9 9
4 9 10
4 10 -10
4 10 -9
4 10 -8
4 10 -7
4 10 -6
4 10 -5
4 10 -4
4 10 -3
4 10 -2
4 10 -1
4 10 0
4 10 1
4 10 2
4 10 3
4 10 4
4 10 5
4 10 6
4 10 7
4 10 8
4 10 9
4 10 10
5 1 -10
5 1 -9...

output:

0
0
0
0
0
0
35
210
315
140
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
35
245
441
245
35
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
12
6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
24
24
4
0
0
0
0
0

result:

ok 100 numbers

Test #11:

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

input:

100
5 3 8
5 3 9
5 3 10
5 4 -10
5 4 -9
5 4 -8
5 4 -7
5 4 -6
5 4 -5
5 4 -4
5 4 -3
5 4 -2
5 4 -1
5 4 0
5 4 1
5 4 2
5 4 3
5 4 4
5 4 5
5 4 6
5 4 7
5 4 8
5 4 9
5 4 10
5 5 -10
5 5 -9
5 5 -8
5 5 -7
5 5 -6
5 5 -5
5 5 -4
5 5 -3
5 5 -2
5 5 -1
5 5 0
5 5 1
5 5 2
5 5 3
5 5 4
5 5 5
5 5 6
5 5 7
5 5 8
5 5 9
5 5 10
5...

output:

0
0
0
0
0
0
0
0
0
0
0
1
20
60
40
5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
25
100
100
25
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6
75
200
150
30
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6
90
300
300
90
6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
21
210
525
420
105

result:

ok 100 numbers

Test #12:

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

input:

100
5 8 3
5 8 4
5 8 5
5 8 6
5 8 7
5 8 8
5 8 9
5 8 10
5 9 -10
5 9 -9
5 9 -8
5 9 -7
5 9 -6
5 9 -5
5 9 -4
5 9 -3
5 9 -2
5 9 -1
5 9 0
5 9 1
5 9 2
5 9 3
5 9 4
5 9 5
5 9 6
5 9 7
5 9 8
5 9 9
5 9 10
5 10 -10
5 10 -9
5 10 -8
5 10 -7
5 10 -6
5 10 -5
5 10 -4
5 10 -3
5 10 -2
5 10 -1
5 10 0
5 10 1
5 10 2
5 10 3
...

output:

6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
21
245
735
735
245
21
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
56
490
1176
980
280
21
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6
16
6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #13:

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

input:

100
6 3 -2
6 3 -1
6 3 0
6 3 1
6 3 2
6 3 3
6 3 4
6 3 5
6 3 6
6 3 7
6 3 8
6 3 9
6 3 10
6 4 -10
6 4 -9
6 4 -8
6 4 -7
6 4 -6
6 4 -5
6 4 -4
6 4 -3
6 4 -2
6 4 -1
6 4 0
6 4 1
6 4 2
6 4 3
6 4 4
6 4 5
6 4 6
6 4 7
6 4 8
6 4 9
6 4 10
6 5 -10
6 5 -9
6 5 -8
6 5 -7
6 5 -6
6 5 -5
6 5 -4
6 5 -3
6 5 -2
6 5 -1
6 5 0
...

output:

4
30
40
10
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5
50
100
50
5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
30
150
200
75
6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
36
225
400
225
36
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
7
126
525
700
315
42
1
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #14:

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

input:

100
6 8 -7
6 8 -6
6 8 -5
6 8 -4
6 8 -3
6 8 -2
6 8 -1
6 8 0
6 8 1
6 8 2
6 8 3
6 8 4
6 8 5
6 8 6
6 8 7
6 8 8
6 8 9
6 8 10
6 9 -10
6 9 -9
6 9 -8
6 9 -7
6 9 -6
6 9 -5
6 9 -4
6 9 -3
6 9 -2
6 9 -1
6 9 0
6 9 1
6 9 2
6 9 3
6 9 4
6 9 5
6 9 6
6 9 7
6 9 8
6 9 9
6 9 10
6 10 -10
6 10 -9
6 10 -8
6 10 -7
6 10 -6
6...

output:

0
0
0
0
7
147
735
1225
735
147
7
0
0
0
0
0
0
0
0
0
0
0
0
0
0
28
392
1470
1960
980
168
7
0
0
0
0
0
0
0
0
0
0
0
0
0
0
28
448
1960
3136
1960
448
28
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6
20
10
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #15:

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

input:

100
7 2 9
7 2 10
7 3 -10
7 3 -9
7 3 -8
7 3 -7
7 3 -6
7 3 -5
7 3 -4
7 3 -3
7 3 -2
7 3 -1
7 3 0
7 3 1
7 3 2
7 3 3
7 3 4
7 3 5
7 3 6
7 3 7
7 3 8
7 3 9
7 3 10
7 4 -10
7 4 -9
7 4 -8
7 4 -7
7 4 -6
7 4 -5
7 4 -4
7 4 -3
7 4 -2
7 4 -1
7 4 0
7 4 1
7 4 2
7 4 3
7 4 4
7 4 5
7 4 6
7 4 7
7 4 8
7 4 9
7 4 10
7 5 -10...

output:

0
0
0
0
0
0
0
0
0
0
0
10
50
50
10
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5
60
150
100
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6
90
300
300
90
6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
42
315
700
525
126
7
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
49
441
1225
1225
441
49

result:

ok 100 numbers

Test #16:

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

input:

100
7 7 4
7 7 5
7 7 6
7 7 7
7 7 8
7 7 9
7 7 10
7 8 -10
7 8 -9
7 8 -8
7 8 -7
7 8 -6
7 8 -5
7 8 -4
7 8 -3
7 8 -2
7 8 -1
7 8 0
7 8 1
7 8 2
7 8 3
7 8 4
7 8 5
7 8 6
7 8 7
7 8 8
7 8 9
7 8 10
7 9 -10
7 9 -9
7 9 -8
7 9 -7
7 9 -6
7 9 -5
7 9 -4
7 9 -3
7 9 -2
7 9 -1
7 9 0
7 9 1
7 9 2
7 9 3
7 9 4
7 9 5
7 9 6
7 ...

output:

1
0
0
0
0
0
0
0
0
0
0
0
0
0
8
196
1176
2450
1960
588
56
1
0
0
0
0
0
0
0
0
0
0
0
0
0
8
224
1568
3920
3920
1568
224
8
0
0
0
0
0
0
0
0
0
0
0
0
0
36
672
3528
7056
5880
2016
252
8
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #17:

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

input:

100
8 2 -1
8 2 0
8 2 1
8 2 2
8 2 3
8 2 4
8 2 5
8 2 6
8 2 7
8 2 8
8 2 9
8 2 10
8 3 -10
8 3 -9
8 3 -8
8 3 -7
8 3 -6
8 3 -5
8 3 -4
8 3 -3
8 3 -2
8 3 -1
8 3 0
8 3 1
8 3 2
8 3 3
8 3 4
8 3 5
8 3 6
8 3 7
8 3 8
8 3 9
8 3 10
8 4 -10
8 4 -9
8 4 -8
8 4 -7
8 4 -6
8 4 -5
8 4 -4
8 4 -3
8 4 -2
8 4 -1
8 4 0
8 4 1
8...

output:

10
25
10
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
10
60
75
20
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15
120
225
120
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6
105
420
525
210
21
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
7
147
735
1225
735
147
7
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #18:

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

input:

100
8 7 -6
8 7 -5
8 7 -4
8 7 -3
8 7 -2
8 7 -1
8 7 0
8 7 1
8 7 2
8 7 3
8 7 4
8 7 5
8 7 6
8 7 7
8 7 8
8 7 9
8 7 10
8 8 -10
8 8 -9
8 8 -8
8 8 -7
8 8 -6
8 8 -5
8 8 -4
8 8 -3
8 8 -2
8 8 -1
8 8 0
8 8 1
8 8 2
8 8 3
8 8 4
8 8 5
8 8 6
8 8 7
8 8 8
8 8 9
8 8 10
8 9 -10
8 9 -9
8 9 -8
8 9 -7
8 9 -6
8 9 -5
8 9 -4...

output:

0
0
1
56
588
1960
2450
1176
196
8
0
0
0
0
0
0
0
0
0
0
0
0
0
1
64
784
3136
4900
3136
784
64
1
0
0
0
0
0
0
0
0
0
0
0
0
9
288
2352
7056
8820
4704
1008
72
1
0
0
0
0
0
0
0
0
0
0
0
0
9
324
3024
10584
15876
10584
3024
324
9
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5
5
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #19:

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

input:

100
9 1 10
9 2 -10
9 2 -9
9 2 -8
9 2 -7
9 2 -6
9 2 -5
9 2 -4
9 2 -3
9 2 -2
9 2 -1
9 2 0
9 2 1
9 2 2
9 2 3
9 2 4
9 2 5
9 2 6
9 2 7
9 2 8
9 2 9
9 2 10
9 3 -10
9 3 -9
9 3 -8
9 3 -7
9 3 -6
9 3 -5
9 3 -4
9 3 -3
9 3 -2
9 3 -1
9 3 0
9 3 1
9 3 2
9 3 3
9 3 4
9 3 5
9 3 6
9 3 7
9 3 8
9 3 9
9 3 10
9 4 -10
9 4 -...

output:

0
0
0
0
0
0
0
0
0
0
10
30
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
20
90
90
20
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15
140
315
210
35
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
21
245
735
735
245
21
0
0
0
0
0
0
0
0
0
0
0
0
0
0
7
168
980
1960
1470
392
28
0

result:

ok 100 numbers

Test #20:

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

input:

100
9 6 5
9 6 6
9 6 7
9 6 8
9 6 9
9 6 10
9 7 -10
9 7 -9
9 7 -8
9 7 -7
9 7 -6
9 7 -5
9 7 -4
9 7 -3
9 7 -2
9 7 -1
9 7 0
9 7 1
9 7 2
9 7 3
9 7 4
9 7 5
9 7 6
9 7 7
9 7 8
9 7 9
9 7 10
9 8 -10
9 8 -9
9 8 -8
9 8 -7
9 8 -6
9 8 -5
9 8 -4
9 8 -3
9 8 -2
9 8 -1
9 8 0
9 8 1
9 8 2
9 8 3
9 8 4
9 8 5
9 8 6
9 8 7
9 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
8
224
1568
3920
3920
1568
224
8
0
0
0
0
0
0
0
0
0
0
0
0
1
72
1008
4704
8820
7056
2352
288
9
0
0
0
0
0
0
0
0
0
0
0
0
1
81
1296
7056
15876
15876
7056
1296
81
1
0
0
0
0
0
0
0
0
0
0
0
10
405
4320
17640
31752
26460
10080
1620
90
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5

result:

ok 100 numbers

Test #21:

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

input:

100
10 1 0
10 1 1
10 1 2
10 1 3
10 1 4
10 1 5
10 1 6
10 1 7
10 1 8
10 1 9
10 1 10
10 2 -10
10 2 -9
10 2 -8
10 2 -7
10 2 -6
10 2 -5
10 2 -4
10 2 -3
10 2 -2
10 2 -1
10 2 0
10 2 1
10 2 2
10 2 3
10 2 4
10 2 5
10 2 6
10 2 7
10 2 8
10 2 9
10 2 10
10 3 -10
10 3 -9
10 3 -8
10 3 -7
10 3 -6
10 3 -5
10 3 -4
10...

output:

6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15
36
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
20
105
126
35
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
35
245
441
245
35
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
21
280
980
1176
490
56
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #22:

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

input:

100
10 6 -5
10 6 -4
10 6 -3
10 6 -2
10 6 -1
10 6 0
10 6 1
10 6 2
10 6 3
10 6 4
10 6 5
10 6 6
10 6 7
10 6 8
10 6 9
10 6 10
10 7 -10
10 7 -9
10 7 -8
10 7 -7
10 7 -6
10 7 -5
10 7 -4
10 7 -3
10 7 -2
10 7 -1
10 7 0
10 7 1
10 7 2
10 7 3
10 7 4
10 7 5
10 7 6
10 7 7
10 7 8
10 7 9
10 7 10
10 8 -10
10 8 -9
10...

output:

0
0
28
448
1960
3136
1960
448
28
0
0
0
0
0
0
0
0
0
0
0
0
0
8
252
2016
5880
7056
3528
672
36
0
0
0
0
0
0
0
0
0
0
0
0
0
9
324
3024
10584
15876
10584
3024
324
9
0
0
0
0
0
0
0
0
0
0
0
1
90
1620
10080
26460
31752
17640
4320
405
10
0
0
0
0
0
0
0
0
0
0
0
1
100
2025
14400
44100
63504
44100
14400
2025
100
1
...

result:

ok 100 numbers

Test #23:

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

input:

100
30062 71054 -100000
30062 71054 -100000
30062 71054 -100000
30062 71054 40992
30062 71054 40991
30062 71054 40993
30062 71054 -30062
30062 71054 -30063
30062 71054 -30061
30062 71054 -40992
30062 71054 -40993
30062 71054 -40991
30062 71054 100000
30062 71054 100000
30062 71054 100000
30062 71054...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
328961717
795085417
795085417
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
934094839
969352177
969352177
0
0
0
0
0
0
747859250
187904707
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
355654512
451404637

result:

ok 100 numbers

Test #24:

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

input:

100
63684 22752 1
63684 22752 20364
63684 22752 69271
63684 22752 -86656
63684 22752 55933
63684 22752 -11815
63684 22752 70378
63684 22752 13354
63684 22752 14668
63684 22752 24671
63684 22752 11054
23704 37810 -61514
23704 37810 -61515
23704 37810 -61513
23704 37810 14106
23704 37810 14105
23704 3...

output:

451404637
0
0
0
0
0
0
0
0
0
872411452
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
509601357
228091250
228091250
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
551068346
847872047
847872047
0
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 100 numbers

Test #25:

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

input:

100
24004 64934 24004
24004 64934 24003
24004 64934 24005
24004 64934 -64934
24004 64934 -64935
24004 64934 -64933
24004 64934 64934
24004 64934 64933
24004 64934 64935
24004 64934 0
24004 64934 -1
24004 64934 1
24004 64934 42215
24004 64934 10969
24004 64934 82472
24004 64934 -20662
24004 64934 770...

output:

0
0
0
0
0
0
0
0
0
460705185
110081025
110081025
0
838201440
0
0
0
476158505
0
0
0
233841145
0
0
0
977289918
924294219
674387937
0
0
0
977289918
674387937
924294219
0
0
0
0
0
0
0
0
0
0
0
0
563850706
744004222
744004222
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
371614744
6648...

result:

ok 100 numbers

Test #26:

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

input:

100
100000 28788 -71213
100000 28788 -71211
100000 28788 -100000
100000 28788 -100000
100000 28788 -99999
100000 28788 71212
100000 28788 71211
100000 28788 71213
100000 28788 100000
100000 28788 100000
100000 28788 100000
100000 28788 100000
100000 28788 99999
100000 28788 100000
100000 28788 -2878...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
17617002
828748626
828748626
0
0
810632534
0
0
0
0
290244300
0
0
0
0
0
168631746
756159424
756159424
0
0
0
168631746
756159424
756159424
0
0
0
0
0
0
0
0
0
0
0
0
168631746
756159424
756159424
0
790541780
524070713
0
120609040
0
0
0
0
262679929
0
0
0
0
0
0
0
0
0...

result:

ok 100 numbers

Test #27:

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

input:

100
1590 90861 -97553
1590 90861 75708
1590 90861 -33554
1590 90861 -75651
1590 90861 56307
1590 90861 54146
1590 90861 -23231
80504 57309 -100000
80504 57309 -100000
80504 57309 -100000
80504 57309 -23195
80504 57309 -23196
80504 57309 -23194
80504 57309 -80504
80504 57309 -80505
80504 57309 -80503...

output:

0
0
0
0
0
0
0
0
0
0
389476153
709587950
625157677
0
0
0
486517148
34501037
89897117
0
0
0
0
0
0
0
0
0
0
0
0
475011857
414911465
62138847
0
0
0
0
0
0
40397698
0
801433270
0
0
0
0
434344889
457076849
343367765
0
0
0
432972189
155306622
624019451
0
0
0
0
0
0
0
0
0
0
0
0
224574427
208557589
163068041
0
...

result:

ok 100 numbers

Test #28:

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

input:

100
24852 40223 -40224
24852 40223 -40222
24852 40223 40223
24852 40223 40222
24852 40223 40224
24852 40223 0
24852 40223 -1
24852 40223 1
24852 40223 60505
24852 40223 2171
24852 40223 -27351
24852 40223 18764
24852 40223 13536
24852 40223 73677
24852 40223 -98550
24852 40223 -52685
24852 40223 590...

output:

0
0
0
0
0
403327719
248903564
512870347
0
945576169
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
330803843
565804639
943466480
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
703778845
368097840
1842804
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #29:

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

input:

100
5766 27201 -5765
5766 27201 -21435
5766 27201 -21436
5766 27201 -21434
5766 27201 32967
5766 27201 32966
5766 27201 32968
5766 27201 5766
5766 27201 5765
5766 27201 5767
5766 27201 -27201
5766 27201 -27202
5766 27201 -27200
5766 27201 27201
5766 27201 27200
5766 27201 27202
5766 27201 0
5766 272...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
887411836
759727601
586710166
0
0
0
0
0
0
0
0
0
0
0
0
0
449380602
274388405
129668896
0
0
0
503843522
346518968
593689872
0
0
0
0
0
0
0
0
0
0
0
0
368919453
850511929
897334562
544815731
0
0
0
28297911
153035719
929755564
0
0
570322714
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 100 numbers

Test #30:

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

input:

100
100000 30123 -47123
100000 30123 -50487
100000 30123 96438
100000 99999 -100000
100000 99999 -100000
100000 99999 -100000
100000 99999 -1
100000 99999 -2
100000 99999 0
100000 99999 -100000
100000 99999 -100000
100000 99999 -99999
100000 99999 1
100000 99999 0
100000 99999 2
100000 99999 100000
...

output:

0
0
0
0
0
0
595624683
162261985
84315873
0
0
0
160534741
84315873
96926507
0
0
0
0
0
0
0
0
0
0
0
0
84315873
595624683
160534741
0
864078321
0
274932874
712677591
915344261
0
0
0
0
0
0
0
410347316
526053952
42187059
0
0
0
823936793
892973349
570318883
0
0
0
0
0
0
0
0
0
0
0
0
348564900
689240813
31664...

result:

ok 100 numbers

Test #31:

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

input:

100
54877 88160 88161
54877 88160 0
54877 88160 -1
54877 88160 1
54877 88160 72726
54877 88160 31766
54877 88160 -22093
54877 88160 33495
54877 88160 -30160
54877 88160 97203
54877 88160 23587
54877 88160 10561
54877 88160 50087
54877 88160 96658
97971 18866 -100000
97971 18866 -100000
97971 18866 -...

output:

0
901646285
319563024
287497553
0
0
796497192
0
0
0
424218411
50872453
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
656313299
218617530
208335277
0
414817479
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
71622
415938136
187784648
0
777932337
0
0
0
750931992
0
0
0
0
0
0
0
0
0...

result:

ok 100 numbers

Test #32:

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

input:

100
51889 79266 100000
51889 79266 100000
51889 79266 100000
51889 79266 51889
51889 79266 51888
51889 79266 51890
51889 79266 -79266
51889 79266 -79267
51889 79266 -79265
51889 79266 79266
51889 79266 79265
51889 79266 79267
51889 79266 0
51889 79266 -1
51889 79266 1
51889 79266 -28551
51889 79266 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
796568196
758781257
428169385
0
553478371
0
0
0
0
0
0
555011476
503711061
0
0
0
61961228
28761942
663510278
0
0
0
449735754
233718965
565915277
0
0
0
0
0
0
0
0
0
0
0
0
855454523
300365794
249404310
0
0
0
670864470
0
0
0
0
538951439
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100 numbers

Test #33:

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

input:

100
20307 100000 -100000
20307 100000 -100000
20307 100000 79693
20307 100000 79692
20307 100000 79694
20307 100000 -20307
20307 100000 -20308
20307 100000 -20306
20307 100000 -79693
20307 100000 -79694
20307 100000 -79692
20307 100000 100000
20307 100000 100000
20307 100000 100000
20307 100000 2030...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
133697209
248268532
323237382
0
0
0
0
0
0
0
0
0
0
0
0
0
986800752
870293215
71584192
0
0
0
433163020
633180255
674963011
0
0
0
0
0
0
0
0
0
0
0
0
759229586
700942449
10031822
452377830
0
85482090
0
338311496
0
0
0
0
0
0
0
0
595624683
84315873
162261985
0
...

result:

ok 100 numbers

Test #34:

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

input:

100
99999 100000 -61057
99999 100000 46555
99999 100000 -12346
99999 100000 -22115
99999 100000 75818
99999 100000 -44397
99999 100000 -48184
99999 100000 28620
99999 100000 48646
99999 100000 -12255
94387 71501 -100000
94387 71501 -100000
94387 71501 -100000
94387 71501 -22886
94387 71501 -22887
94...

output:

0
446995346
160050053
45606468
0
715353995
325611061
452730911
141902197
24979986
0
0
0
680560124
362258782
409276761
0
0
0
409276761
446869314
680560124
0
0
0
0
0
0
0
0
0
0
0
0
905710830
807100766
905710830
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
297892748
357694202
2978...

result:

ok 100 numbers

Test #35:

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

input:

100
513 94645 512
513 94645 514
513 94645 -94645
513 94645 -94646
513 94645 -94644
513 94645 94645
513 94645 94644
513 94645 94646
513 94645 0
513 94645 -1
513 94645 1
513 94645 47180
513 94645 -81562
513 94645 79168
513 94645 23106
513 94645 72977
513 94645 58538
513 94645 83416
513 94645 6407
513 ...

output:

0
0
0
0
0
0
0
0
166282355
160742097
166282355
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
475839432
709778460
475839432
0
0
0
0
0
840845308
629365957
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
273766555
60441312
273766555
0
0
0
256256609
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #36:

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

input:

100
53147 91057 37911
53147 91057 -53147
53147 91057 -53148
53147 91057 -53146
53147 91057 -37910
53147 91057 -37911
53147 91057 -37909
53147 91057 100000
53147 91057 100000
53147 91057 100000
53147 91057 53147
53147 91057 53146
53147 91057 53148
53147 91057 -91057
53147 91057 -91058
53147 91057 -91...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
35019577
797136302
35019577
0
935642661
951812912
0
113449374
0
0
0
0
0
0
0
0
430150384
686422598
863822976
0
0
0
863822976
528178625
430150384
0
0
0
0
0
0
0
0
0
0
0
0
560225899
313764880
560225899
0
220433530
708766934
567869348
723666999
481934318
0
0
40394994...

result:

ok 100 numbers

Test #37:

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

input:

80
13801 99999 67485
13801 99999 22149
13801 99999 -25279
13801 99999 -35515
13801 99999 2708
13801 99999 -68464
99999 45615 -100000
99999 45615 -100000
99999 45615 -100000
99999 45615 -54384
99999 45615 -54385
99999 45615 -54383
99999 45615 -99999
99999 45615 -100000
99999 45615 -99998
99999 45615 ...

output:

0
0
0
0
979562562
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
454868111
81550453
454868111
0
0
0
0
0
0
0
0
0
0
0
0
0
541280113
106190171
541280113
0
0
0
541280113
106190171
541280113
0
0
0
0
0
0
0
0
0
0
0
0
541280113
106190171
541280113
0
678619914
0
172475095
0
0
656774803
695140653
0
836211548

result:

ok 80 numbers

Test #38:

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

input:

100
99946 99953 -15768
99914 99983 18929
99915 99939 -5006
99915 99930 -5598
99977 99914 -45792
99959 99927 -11348
99960 99924 41324
99936 99943 -43458
99980 99919 30678
99922 99935 -27629
99920 99924 -18751
99994 99970 -37683
99928 99901 -45759
99950 99988 -14522
99966 99967 49912
99992 99955 7410
...

output:

606672921
615566378
259709186
589801350
167898773
678287770
42339000
462688724
602660104
373376756
15618108
893700204
54628863
991978790
824312943
144540561
344466265
352964709
779773622
772207668
714538307
122591384
838051239
128024063
346509985
793606669
834991205
144754796
974502821
638800266
795...

result:

ok 100 numbers

Test #39:

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

input:

100
99900 99977 -12987
99959 99998 10930
99953 99922 -27467
99951 99957 0
99935 99941 0
99983 99901 37482
99959 99957 16727
99960 99934 -38800
99960 99926 -40582
99905 99917 -6038
99971 99948 36826
99918 99995 0
99951 99960 -1522
99927 99925 -20441
99989 99993 10657
99909 99908 -46945
99983 99903 0
...

output:

249294624
8155540
854756613
693817772
603737236
100795275
740481800
632501659
982612387
157888662
720218332
360671731
627535461
220561435
255353301
697882665
697340998
969810120
930402307
992975658
766893659
326979474
734620073
830528433
534399877
675514632
798768576
83495848
752937560
650236915
113...

result:

ok 100 numbers

Test #40:

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

input:

100
99955 99934 41100
99915 99923 5553
99965 99924 27287
99938 99927 -12341
99928 99934 25660
100000 99922 -32879
99942 99971 37625
99965 99994 45829
99942 99931 8362
99909 99917 0
99962 99930 41973
99982 99971 -27310
99982 99989 15190
99937 99923 16994
99909 99950 -33540
99942 99967 -32436
99911 99...

output:

270599962
123653763
356031524
528586127
601873574
744203801
581915184
12593661
179691366
505639354
410084117
249570166
639291722
447542338
101992293
994525110
508267505
675044339
357695863
816573149
820761576
519737841
517086179
495506566
311392039
818033324
987282123
504078404
453296768
792105152
1...

result:

ok 100 numbers

Test #41:

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

input:

100
99977 99958 42830
99951 99953 0
99994 99963 -8535
99987 99960 21751
99957 99957 -2169
99947 99967 -37182
99980 99945 34164
99945 99969 -18703
99923 99926 -36544
99992 99924 0
99928 99990 47848
99904 99957 23858
99949 99927 -38981
99963 99953 0
99908 99918 28935
99976 99988 0
99983 99993 0
99975 ...

output:

964044444
126985942
831902597
681694414
93647236
767250867
835451083
341086924
523188525
698080637
838589586
596646896
299145136
535285493
630472009
845969235
284474064
357635084
861469168
571167809
108312185
260679536
867937380
73872920
740975467
798770242
693567579
515142418
393037669
747942745
81...

result:

ok 100 numbers

Test #42:

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

input:

100
99931 99949 41641
99970 99938 -10186
99979 99940 -10361
99909 99924 -47150
99915 99906 -17453
99997 99924 22412
99982 99989 46766
99955 99994 -34102
99905 99930 7340
99900 99989 12004
99961 99996 27344
99979 99994 -47561
99910 99971 21225
99967 99963 -46757
99962 99989 0
99988 99916 -23279
99944...

output:

831972421
457990111
5423817
953179860
622639328
99973211
541678457
763575942
907637435
583553688
185320316
829790658
633510803
868995746
721770061
914733861
665921680
98372025
302350381
369183718
332651467
829731160
369389190
976521752
685900811
499762451
820773369
966203790
106379352
391490129
9856...

result:

ok 100 numbers