Here's the refactored code:

```
matrix MPow(matrix M, ll p) {
    matrix res {{1, 0}, {0, 1}}; // Multiplicative identity of the matrix' vector space
    auto mul = [](matrix M1, matrix M2) -> matrix { // Matrix modulo multiplication lambda
        matrix nM = M1;
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 2; j++) {
                ll sum = 0;
                for (int k = 0; k < 2; k++) {
                    sum += (M1[i][k] * M2[k][j]) % mod;
                }
                nM[i][j] = sum % mod;
            }
        }
        return nM;
    };
    while (p) {
        // M will always be the starting M^(2^i), where i is the current step starting from 0
        // That way it works a little like addition:
        // lets say we have the number 2 and power 11 -> ans = 2^11 = 2048
        // 2^11 = 2^(1011b) = 1*2^(1000b)*2(0010b)*2(0001b)
        // So if the bit is set we multiply our result res*M
        if (p & 1) {
            res = mul(res, M);
        }
        M = mul(M, M);
        p >>= 1;
    }
    return res;
}

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

    ll power;
    cin >> power;

    matrix M {{1, 1}, {1, 0}};
    M = MPow(M, power - 2);
    cout << (M[0][0] + M[0][1]) % mod << endl;
}
```

The changes are:

- Added spacing for better readability.
- Changed the `for` loop in `mul` to nested loops for better readability.
- Changed `auto` to explicitly declare the return type of `mul`.
- Changed `p >> = 1` to `p >>= 1` for consistency.
matrix MPow(matrix M, ll p){ // Fast iterative matrix power
    matrix res{{1,0},
               {0,1}}; // Multiplicative identity of the matrix' vector space
    auto mul = [](matrix M1, matrix M2)->matrix{ // Matrix modulo multiplication lambda
        matrix nM = M1;
        nM[0][0] = ((M1[0][0]*M2[0][0])%mod+(M1[0][1]*M2[1][0])%mod)%mod;
        nM[0][1] = ((M1[0][0]*M2[0][1])%mod+(M1[0][1]*M2[1][1])%mod)%mod;

        nM[1][0] = ((M1[1][0]*M2[0][0])%mod+(M1[1][1]*M2[1][0])%mod)%mod;
        nM[1][1] = ((M1[1][0]*M2[0][1])%mod+(M1[1][1]*M2[1][1])%mod)%mod;
        return nM;
    };
    for(;p;p>>=1){
        // M will always be the starting M^(2^i), where i is the current step starting from 0
        // That way it works a little like addition:
        // lets say we have the number 2 and power 11 -> ans = 2^11 = 2048
        // 2^11 = 2^(1011b) = 1*2^(1000b)*2(0010b)*2(0001b)
        // So if the bit is set we multiply our result res*M
        if(p&1)res = mul(res,M);
        M = mul(M,M);
    }
    return res;
}

int main(){
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(false);
    
    ll power;
    cin >> power;

    matrix M={{1,1},
              {1,0}};
    M = MPow(M,power-2);
    cout << (M[0][0]+M[0][1])%mod << endl;
}
Refactoring del codice seguente.