Problem p00344 - Generation 2

Orig Description

 Circular Sugoroku 
Yuki made a sugoroku (Japanese board game similar to Snakes and Ladders) for the children's event so that everyone can play together. In this sugoroku, the squares are arranged in a circle, and each square has an integer greater than or equal to 1 written on it.
The player chooses a square as the starting point and places their piece there. Then, they move their piece clockwise according to the number written on the square. They repeat this process, moving clockwise according to the number written on the square they land on, until they reach the starting point again, at which point they win.
In reality, there may be cases where it is impossible to win, depending on which square the player chooses as their starting point. Yuki wants to count the number of squares from which it is possible to win.
Write a program that takes the information of a sugoroku as input and reports the number of squares from which it is possible to win.
Input
The input is given in the following format.
N
a1 a2 ... aN
The first line contains the number of squares N (1 ≤ N ≤ 100000) in the sugoroku. The second line gives the clockwise order of integers written on each square ai (1 ≤ ai ≤ 109).
Output
Print the number of squares from which it is possible to win.
Sample Input 1
3
1 1 1
Sample Output 1
3
Sample Input 2
3
1 1 2
Sample Output 2
2
Sample Input 3
8
2 3 7 3 3 3 4 4
Sample Output 3
6

Extracted Specification

An integer N (1 ≤ N ≤ 100000), representing some quantity or size.
A list of integers A of size N, where each integer is between 1 and 1e9.

### Example Input:

```
3
1 1 2
```

### Function Signature:
Write a function f(N, A) that takes in the input. 
def f(N: int, A: List[int]):
    ''' 
    N: an integer 
    A: a list of integers
    '''

Test Case Generator

Sure! The problem statement for "Circular Sugoroku" is clear, and to generate test cases, we need to ensure that we cover various scenarios within the given constraints. Here's the Python code for generating test cases for this problem:

```python
import random

def tcgen():
    # Number of squares, N (1 ≤ N ≤ 100000)
    N = random.randint(1, 100000)
    
    # List of integers a1, a2, ..., aN where each ai (1 ≤ ai ≤ 10^9)
    A = [random.randint(1, 10**9) for _ in range(N)]
    
    return N, A

# Example of generating one test case
if __name__ == "__main__":
    N, A = tcgen()
    print(N)
    print(" ".join(map(str, A)))
```

### Explanation

1. **N**: This is the number of squares in the sugoroku board. The value is randomly generated between 1 and 100,000 inclusive.
2. **A**: This is the list of integers representing the number of squares to move clockwise from each square. Each value in the list is randomly generated between 1 and 1,000,000,000 inclusive.

### Usage

- Running the script will generate a random test case within the constraints.
- The printed output will be in the format required by the problem statement, suitable for testing purposes.

This generator ensures that the test cases are diverse and cover the edge cases within the specified limits, which is crucial for thoroughly testing the implementation of the solution to the problem.

Extract Arguments

def extract_arguments(fh):
    N = int(fh.readline().strip())
    A = list(map(int, fh.readline().strip().split()))
    return N, A