# Rely of wierd sum Submatrix with odd aspect rely within the Matrix

`#embody <bits/stdc++.h>`

`utilizing` `namespace` `std;`

` `

`int` `countOddSumSubmatrices(vector<vector<``int``> >& matrix)`

`{`

`    ``int` `n = matrix.measurement();`

`    ``int` `m = matrix[0].measurement();`

`    ``int` `rely = 0;`

` `

`    `

`    ``vector<vector<``int``> > prefixSum(n + 1,`

`                                   ``vector<``int``>(m + 1, 0));`

` `

`    `

`    ``for` `(``int` `i = 1; i <= n; i++) {`

`        ``for` `(``int` `j = 1; j <= m; j++) {`

`            ``prefixSum[i][j] = prefixSum[i - 1][j]`

`                              ``+ prefixSum[i][j - 1]`

`                              ``- prefixSum[i - 1][j - 1]`

`                              ``+ matrix[i - 1][j - 1];`

`        ``}`

`    ``}`

` `

`    `

`    ``for` `(``int` `i = 1; i <= n; i++) {`

`        ``for` `(``int` `j = 1; j <= m; j++) {`

`            ``for` `(``int` `okay = i; okay <= n; okay++) {`

`                ``for` `(``int` `l = j; l <= m; l++) {`

` `

`                    `

`                    `

`                    ``int` `sum = prefixSum[k][l]`

`                              ``- prefixSum[i - 1][l]`

`                              ``- prefixSum[k][j - 1]`

`                              ``+ prefixSum[i - 1][j - 1];`

` `

`                    `

`                    `

`                    `

`                    ``if` `(sum % 2 == 1`

`                        ``&& ((okay - i + 1) * (l - j + 1)) % 2`

`                               ``== 1) {`

`                        ``rely++;`

`                    ``}`

`                ``}`

`            ``}`

`        ``}`

`    ``}`

` `

`    ``return` `rely;`

`}`

` `

`int` `major()`

`{`

`    ``vector<vector<``int``> > matrix`

`        ``= { { 1, 2, 3 }, { 7, 5, 9 }, { 6, 8, 10 } };`

`    ``int` `rely = countOddSumSubmatrices(matrix);`

` `

`    `

`    ``cout << ``"Variety of odd sum submatrices with odd quantity "`

`            ``"of parts: "`

`         ``<< rely << endl;`

`    ``return` `0;`

`}`