<|instruction|>
Solve the below problem. The solution should start with an abridged problem statement. Then key observations. Then full solution based on the observations. Then C++ and Python implementations with comments.

444. Headstrong Student
Time limit per test: 0.75 second(s)
Memory limit: 262144 kilobytes
input: standard
output: standard

You are a teacher at a cram school for elementary school pupils. One day, you showed your students how to calculate division of fraction in a class of mathematics. Your lesson was kind and fluent, and it seemed everything was going so well — except for one thing. After some experiences, a student Max got so curious about how precise he could compute the quotient. He tried many divisions asking you for a help, and finally found a case where the answer became an infinite fraction. He was fascinated with such a case, so he continued computing the answer. But it was clear for you the answer was an infinite fraction — no matter how many digits he computed, he wouldn't reach the end. Since you have many other things to tell in today's class, you can't leave this as it is. So you decided to use a computer to calculate the answer in turn of him. Actually you succeeded to persuade him that he was going into a loop, so it was enough for him to know how long he could compute before entering a loop. Your task now is to write a program which computes where the recurring part starts and the length of the recurring part, for given dividend/divisor pairs. All computation should be done in decimal numbers. If the specified dividend/divisor pair gives a finite fraction, your program should treat the length of the recurring part as 0.
Input
The input consists of a line containing two positive integers x and y, which specifies the dividend and the divisor, respectively. You may assume that 1 <= x,y <= 1000000.
Output
Your program should output a line containing two integers separated by exactly one blank character. The former describes the number of digits after the decimal point before the recurring part starts. And the latter describes the length of the recurring part.
Example(s)
sample input
sample output
1 3
0 1

sample input
sample output
1 6
1 1

sample input
sample output
5 3
0 1

sample input
sample output
5 4
2 0

sample input
sample output
200 2
0 0

sample input
sample output
25000 99
0 2

<|response|>
1. Abridged Problem Statement
   You are given two positive integers x (numerator) and y (denominator). Consider the decimal expansion of the fraction x/y.
   - If it terminates, report how many digits appear after the decimal point (the non-repeating part) and report 0 for the repeating-cycle length.
   - If it does not terminate, determine where the repeating cycle of digits begins (the count of non-repeating digits) and how many digits are in that cycle.

2. Key Observations
   - When you do long division of x by y in base 10, you repeatedly carry down zeros and compute new remainders.
   - Let r_0 = x mod y be the initial remainder after removing the integer part.
   - At each step k, you multiply the previous remainder r_k by 10, divide by y to get the next digit, and take r_{k+1} = (r_k * 10) mod y.
   - If at some step r_k becomes 0, the decimal expansion terminates.
   - Otherwise, there are at most y-1 nonzero remainders, so some remainder must eventually repeat. When a remainder r repeats, the block of digits between its first occurrence and the current step is the repeating cycle.
   - By recording the first step index at which each remainder appears, you can detect both the start and the length of the cycle.

3. Full Solution Approach
   1. Compute the initial remainder: rem = x % y.
   2. Create a vector visited of size y, initialized to -1. visited[r] will store the step index (0-based) when remainder r first appeared.
   3. Initialize digits = 0.
   4. While rem != 0 and visited[rem] == -1:
         - record visited[rem] = digits
         - produce the next remainder: rem = (rem * 10) % y
         - increment digits
   5. After the loop, two cases arise:
      a. rem == 0 -> the division terminated after digits steps.
         - non_recurring = digits
         - cycle_length = 0
      b. rem != 0 and visited[rem] >= 0 -> we found a cycle.
         - cycle_length = digits - visited[rem]
         - non_recurring = digits - cycle_length
   6. Output non_recurring and cycle_length.

   Time complexity: O(y) steps in the worst case
   Space complexity: O(y) for the visited array

4. C++ Implementation with Detailed Comments
```cpp
#include <bits/stdc++.h>

using namespace std;

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& x) {
    return out << x.first << ' ' << x.second;
}

template<typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& x) {
    return in >> x.first >> x.second;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for(auto& x: a) {
        in >> x;
    }
    return in;
};

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
    for(auto x: a) {
        out << x << ' ';
    }
    return out;
};

int64_t x, y;

void read() {
    cin >> x >> y;
}

void solve() {
    // Simulate long division of x by y digit by digit. The state at each step
    // is the current remainder; the next remainder is (rem * 10) % y. A finite
    // expansion is reached when the remainder hits 0; a recurring part begins
    // when a remainder repeats.
    //
    // visited[rem] stores the digit index at which remainder rem was first
    // seen. When rem == 0 we stop with no recurring part (length 0). When a
    // remainder repeats, the cycle length is the difference between the current
    // digit index and the index where that remainder first appeared, and the
    // non-recurring prefix length is digits - cycle_length.

    vector<int64_t> visited(y, -1);
    int64_t rem = x % y;
    int64_t digits = 0;
    while(rem != 0 && visited[rem] == -1) {
        visited[rem] = digits;
        rem = (rem * 10) % y;
        digits++;
    }

    int64_t non_recurring, cycle_length;
    if(rem == 0) {
        non_recurring = digits;
        cycle_length = 0;
    } else {
        cycle_length = digits - visited[rem];
        non_recurring = digits - cycle_length;
    }

    cout << non_recurring << ' ' << cycle_length << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    for(int test = 1; test <= T; test++) {
        read();
        // cout << "Case #" << test << ": ";
        solve();
    }

    return 0;
}
```

5. Python Implementation with Detailed Comments
```python
def find_decimal_info(x, y):
    # visited[r] = index of digit when remainder r first appeared (-1 if unseen)
    visited = [-1] * y

    # initial remainder after integer part
    rem = x % y
    step = 0  # number of digits generated so far

    # long division simulation
    while rem != 0 and visited[rem] == -1:
        visited[rem] = step
        rem = (rem * 10) % y
        step += 1

    # if remainder became zero, decimal terminates
    if rem == 0:
        return step, 0  # non-recurring = step, cycle length = 0

    # found a cycle: starts at visited[rem], length = current step - start
    start = visited[rem]
    cycle_len = step - start
    return start, cycle_len

def main():
    x, y = map(int, input().split())
    non_rec, cycle = find_decimal_info(x, y)
    print(non_rec, cycle)

if __name__ == "__main__":
    main()
```
