Language: C++

#include <bits/stdc++.h>
using namespace std;

void my_reverse(int **cell, int i, int j) {
	if (cell[i][j] == 0) {
		cell[i][j] = 1;
	} else {
		cell[i][j] = 0;
	}
}

int main() {
	int N, M;
	cin >> N >> M;
	int **cell == malloc(sizeof(int) * (N+1)*(M+1));
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j <= M; j++) {
			if (j-1 >= 1) {
				my_reverse(cell, i, j-1);
				if (i-1 >= 1) {
					my_reverse(cell, i-1, j-1);
				}
				if (i+1 <= N) {
					my_reverse(cell, i+1, j-1);
				}
			}
			if (i-1 >= 1) {
				my_reverse(cell, i-1, j);
			}
			if (i+1 <= M) {
				my_reverse(cell, i+1, j);
			}

			if (j+1 <= M) {
				my_reverse(i, j+1);
				if (i-1 >= 1) {
					my_reverse(cell, i-1, j+1);
				}
				if (i+1 <= N) {
					my_reverse(cell, i+1, j+1);
				}
			}
		}
	}

	int sum = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= M; j++) {
			sum += cell[i][j];
		}
	}

	cout << sum << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: expected initializer before '==' token
   15 |         int **cell == malloc(sizeof(int) * (N+1)*(M+1));
      |                    ^~
a.cc:19:44: error: 'cell' was not declared in this scope; did you mean 'ceill'?
   19 |                                 my_reverse(cell, i, j-1);
      |                                            ^~~~
      |                                            ceill
a.cc:28:44: error: 'cell' was not declared in this scope; did you mean 'ceill'?
   28 |                                 my_reverse(cell, i-1, j);
      |                                            ^~~~
      |                                            ceill
a.cc:31:44: error: 'cell' was not declared in this scope; did you mean 'ceill'?
   31 |                                 my_reverse(cell, i+1, j);
      |                                            ^~~~
      |                                            ceill
a.cc:35:44: error: invalid conversion from 'int' to 'int**' [-fpermissive]
   35 |                                 my_reverse(i, j+1);
      |                                            ^
      |                                            |
      |                                            int
a.cc:35:43: error: too few arguments to function 'void my_reverse(int**, int, int)'
   35 |                                 my_reverse(i, j+1);
      |                                 ~~~~~~~~~~^~~~~~~~
a.cc:4:6: note: declared here
    4 | void my_reverse(int **cell, int i, int j) {
      |      ^~~~~~~~~~
a.cc:37:52: error: 'cell' was not declared in this scope; did you mean 'ceill'?
   37 |                                         my_reverse(cell, i-1, j+1);
      |                                                    ^~~~
      |                                                    ceill
a.cc:40:52: error: 'cell' was not declared in this scope; did you mean 'ceill'?
   40 |                                         my_reverse(cell, i+1, j+1);
      |                                                    ^~~~
      |                                                    ceill
a.cc:49:32: error: 'cell' was not declared in this scope; did you mean 'ceill'?
   49 |                         sum += cell[i][j];
      |                                ^~~~
      |                                ceill