atcoder#ARC123E. [ARC123E] Training
[ARC123E] Training
Score : points
Problem Statement
Two programmers, and , are going to start competitive programming.
One's skill in competitive programming is represented by a positive integer called the level. Initially, 's level is , and 's level is . The two will do learning tasks to raise their levels.
We know that they level up as follows.
- 's level raises by one after every learning tasks.
- 's level raises by one after every learning tasks.
How many among satisfy the following?
- 's level and 's level are equal when each of them has done exactly learning tasks.
Process test cases per input file.
Constraints
Input
Input is given from Standard Input in the following format:
Each case is in the following format:
Output
Print the answers.
5
10 5 3 4 2
5 5 3 4 2
100 5 3 4 2
10 5 3 4 3
10 5 10 5 9
6
3
6
0
9
We will describe the first test case.
For each , the two's levels after doing learning tasks are as follows.
- 's level: .
- 's level: .
There are six scenarios () where the two's levels are equal, so the answer is .