Orig Description
Score : 100 points
Problem StatementThere is an N-car train.
You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."
Constraints
1 \leq N \leq 100
1 \leq i \leq N
InputInput is given from Standard Input in the following format:
N i
OutputPrint the answer.
Sample Input 14 2
Sample Output 13
The second car from the front of a 4-car train is the third car from the back.
Sample Input 21 1
Sample Output 21
Sample Input 315 11
Sample Output 35
Extracted Specification
Canonicalized Input Description:
An integer N (1 ≤ N ≤ 100), representing some quantity or size.
An integer i (1 ≤ i ≤ N), representing some position or index.
### Example Input:
```
14 2
```
### Function Signature:
Write a function f(N, i) that takes in the input.
```python
def f(N: int, i: int):
'''
N: an integer
i: an integer
'''
```
Test Case Generator
Sure! Here's the test case generator for the problem statement you provided:
```python
import random
def tcgen():
# Generate N within the range [1, 100]
N = random.randint(1, 100)
# Generate i within the range [1, N]
i = random.randint(1, N)
return N, i
# Example usage
for _ in range(5): # Generating 5 test cases
N, i = tcgen()
print(f"Generated test case: N = {N}, i = {i}")
```
Explanation of the test case generator:
1. **Generate `N`**: We randomly generate an integer `N` within the range [1, 100] as per the given constraints.
2. **Generate `i`**: We then randomly generate an integer `i` within the range [1, N], ensuring it is a valid car position in the train.
3. **Return `N` and `i`**: The function returns these values as a tuple, which represents a single test case for the problem.
You can use the `tcgen` function to generate multiple test cases and print them out or use them in your testing framework.
Extract Arguments
def extract_arguments(fh):
N, i = map(int, fh.readline().strip().split())
return N, i