Language: C++

#include<queue>
#include<vector> 
#include<iostream>
#include<algorithm>
using namespace std;
int same[51][51][51][51];
struct maigo{
	int x[2];// ????????????[0]???????????????[1]
	int y[2];// ????????????[0]???????????????[1]
	int count;
};
int main(){
	queue<maigo> q;
	int tx, ty; int kx, ky;
	int **depart, X, Y;
	int flag = 0, a = 0;
	int c = 0;
	int f = 0;
	cin >> X >> Y;
	while (X != 0 && Y != 0){
		for (int i = 0; i < 51; i++){
			for (int l = 0; l < 51; l++){
				for (int i1 = 0; i1 < 51; i1++){
					for (int l1 = 0; l1 < 51; l1++){
						same[i][l][i1][l1] = 0;
					}
				}
			}
		}
		depart = new int*[Y + 2];
		for (int i = 0; i < Y + 2; i++){
			depart[i] = new int[X + 2];
		}
		for (int i = 0; i < Y + 2; i++){
			for (int l = 0; l < X + 2; l++){
				depart[i][l] = 3;
			}
		}
		cin >> tx >> ty;
		cin >> kx >> ky;
		for (int i = 1; i < Y + 1; i++){
			for (int l = 1; l < X + 1; l++){
				cin >> depart[i][l];
			}
		}
		maigo temp;
		temp.x[0] = tx; temp.y[0] = ty;
		temp.x[1] = kx; temp.y[1] = ky;
		temp.count = 1;
		q.push(temp);
		while (!q.empty() && flag == 0){
			maigo t = q.front();
			maigo into;
			q.pop();
			if (t.count >= 100){
				a = 1; flag = 1;
				break;
			}
			int dx1[4] = { 1, 0, -1, 0 }; int dx2[4] = { 0, 1, 0, -1 };
			for (int i = 0; i < 4; i++){
				if (depart[t.x[0] + dx1[i]][t.y[0] + dx2[i]] == 0 &&
					depart[t.x[1] + dx1[i] * (-1)][t.y[1] + dx2[i] * (-1)] == 0 &&
					same[t.x[0] + dx1[i]][t.y[0] + dx2[i]][t.x[1] + dx1[i] * (-1)][t.y[1] + dx2[i] * (-1)]==0){
					if (t.x[0] + dx1[i] == t.x[1] + dx1[i] * (-1) &&
						t.y[0] + dx2[i] == t.y[1] + dx2[i] * (-1)){
						cout << t.count << endl;
						flag = 1;
					}
					into.x[0] = t.x[0] + dx1[i], into.y[0] = t.y[0] + dx2[i];
					into.x[1] = t.x[1] + dx1[i] * (-1), into.y[1] = t.y[1] + dx2[i] * (-1);

					same[t.x[0] + dx1[i]][t.y[0] + dx2[i]][t.x[1] + dx1[i] * (-1)][t.y[1] + dx2[i] * (-1)] = 1;

					into.count = t.count + 1;
					q.push(into);
				}
				if (depart[t.x[0] + dx1[i]][t.y[0] + dx2[i]] == 0 && //???????????? ok ???????????? no ?????´???
					depart[t.x[1] + dx1[i] * (-1)][t.y[1] + dx2[i] * (-1)] != 0 &&
					same[t.x[0] + dx1[i]][t.y[0] + dx2[i]][t.x[1]][t.y[1]] == 0){
					if (t.x[0] + dx1[i] == t.x[1] &&
						t.y[0] + dx2[i] == t.y[1]){
						cout << t.count << endl;
						flag = 1;
					}
					into.x[0] = t.x[0] + dx1[i], into.y[0] = t.y[0] + dx2[i];
					into.x[1] = t.x[1], into.y[1] = t.y[1];

					same[t.x[0] + dx1[i]][t.y[0] + dx2[i]][t.x[1]][t.y[1]] = 1;

					into.count = t.count + 1;
					q.push(into);
				}
				if (depart[t.x[0] + dx1[i]][t.y[0] + dx2[i]] != 0 && //???????????? no??????????????? yes????????´???
					depart[t.x[1] + dx1[i] * (-1)][t.y[1] + dx2[i] * (-1)] == 0 &&
					same[t.x[0]][t.y[0]][t.x[1] + dx1[i] * (-1)][t.y[1] + dx2[i] * (-1)] == 0){
					if (t.x[0] == t.x[1] + dx1[i] * (-1) &&
?????????						t.y[0] == t.y[1] + dx2[i] * (-1)){
						cout << t.count << endl;
						flag = 1;
					}???                                                            
					into.x[0] = t.x[0], into.y[0] = t.y[0];
					into.x[1] = t.x[1] + dx1[i] * (-1), into.y[1] = t.y[1] + dx2[i] * (-1);

					same[t.x[0]][t.y[0]][t.x[1] + dx1[i] * (-1)][t.y[1] + dx2[i] * (-1)] = 1;

					into.count = t.count + 1;
					q.push(into);
				}
			}
		}if (a == 1 || flag == 0) {
			cout << "NA" << endl;
		}while (!q.empty()) q.pop();
		a = 0; flag = 0;
		cin >> X >> Y;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:97:1: error: expected primary-expression before '?' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      | ^
a.cc:97:2: error: expected primary-expression before '?' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |  ^
a.cc:97:3: error: expected primary-expression before '?' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |   ^
a.cc:97:4: error: expected primary-expression before '?' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |    ^
a.cc:97:5: error: expected primary-expression before '?' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |     ^
a.cc:97:6: error: expected primary-expression before '?' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |      ^
a.cc:97:7: error: expected primary-expression before '?' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |       ^
a.cc:97:8: error: expected primary-expression before '?' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |        ^
a.cc:97:9: error: expected primary-expression before '?' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |         ^
a.cc:97:89: error: expected ':' before ')' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |                                                                                         ^
      |                                                                                         :
a.cc:97:89: error: expected primary-expression before ')' token
a.cc:97:89: error: expected ':' before ')' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |                                                                                         ^
      |                                                                                         :
a.cc:97:89: error: expected primary-expression before ')' token
a.cc:97:89: error: expected ':' before ')' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |                                                                                         ^
      |                                                                                         :
a.cc:97:89: error: expected primary-expression before ')' token
a.cc:97:89: error: expected ':' before ')' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |                                                                                         ^
      |                                                                                         :
a.cc:97:89: error: expected primary-expression before ')' token
a.cc:97:89: error: expected ':' before ')' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |                                                                                         ^
      |                                                                                         :
a.cc:97:89: error: expected primary-expression before ')' token
a.cc:97:89: error: expected ':' before ')' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |                                                                                         ^
      |                                                                                         :
a.cc:97:89: error: expected primary-expression before ')' token
a.cc:97:89: error: expected ':' before ')' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |                                                                                         ^
      |                                                                                         :
a.cc:97:89: error: expected primary-expression before ')' token
a.cc:97:89: error: expected ':' before ')' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |                                                                                         ^
      |                                                                                         :
a.cc:97:89: error: expected primary-expression before ')' token
a.cc:97:89: error: expected ':' before ')' token
   97 | ?????????                                               t.y[0] == t.y[1] + dx2[i] * (-1)){
      |                                                                                         ^
      |                                                                                         :
a.cc:97:89: error: expected primary-expression before ')' token
a.cc:100:42: error: expected primary-expression before '?' token
  100 |                                         }???
      |                                          ^
a.cc:100:43: error: expected primary-expression before '?' token
  100 |                                         }???
      |                                           ^
a.cc:100:44: error: expected primary-expression before '?' token
  100 |                                         }???
      |                                            ^
a.cc:101:79: error: expected ':' before ';' token
  101 |                                         into.x[0] = t.x[0], into.y[0] = t.y[0];
      |                                                                               ^
      |                                                                               :
a.cc:101:79: error: expected primary-expression before ';' token
a.cc:101:79: error: expected ':' before ';' token
  101 |                                         into.x[0] = t.x[0], into.y[0] = t.y[0];
      |                                                                               ^
      |                                                                               :
a.cc:101:79: error: expected primary-expression before ';' token
a.cc:101:79: error: expected ':' before ';' token
  101 |                                         into.x[0] = t.x[0], into.y[0] = t.y[0];
      |                                                                               ^
      |                                                                               :
a.cc:101:79: error: expected primary-expression before ';' token