Language: C++

//AOJ0121

#include <iostream>
#include <queue>
using namespace std;

const int INF = 100000000;

class Point{
public:
  int x;
  int y;
};

int main(){
  char paz[3][5]; //???????????????
  int xz, yz; //0?????\??£???????????´???

  for(int y=0; y<=3; y++){
    for(int x=0; x<5=; x++){
      paz[y][x] = '#';
    }
  }

  for(int y=1; y<2; y++){
    for(int x=1; x<4; x++){
      cin >> paz[y][x]; //???????????????????????????
      if(paz[y][x] == 0){ //????????????????????????????????°???0??????
        xz == x;  //0?????´???????¨????
        yz == y;
      }
    }
  }

  int count[2][4];  //?????°
  for(int y=0; y<2; y++){ //?????°?????§?????????
    for(int x=0; x<4; x++){
      count[y][x] = INF;
    }
  }

queue<Point> que;

Point p;
p.x = xz; p.y = xy;
que.push(p);  //0?????????????????\???????????\
count[p.y][p.x] = 0;  //?????°???0

while(!que.empty()){  //?????\???????????§???????????°?????????
  p = que.front();  que.pop();  //?????\?????????????????????

  if(paz[0][0]<paz[0][1] && paz[0][1]<paz[0][2] && paz[0][2]<paz[0][3] && paz[0][3]<[1][0] && paz[1][0]<paz[1][1] && paz[1][1]<paz[1][2] && paz[1][2]<paz[1][3]){
    cout << count[p.y][p.x] << endl;
    break;  //??????????????£???????????????????????????????°??????°?????????????????????
  }

  if(paz[p.y-1][p.x]!='#' && count[p.y-1][p.x]==INF){ //???
    Point p;
    q.x = p.x;  q.y = p.y-1;
    que.push(q);
    count[q.y][q.x] = count[q.y][q.x]+1;
  }
  if(paz[p.y+1][p.x]!='#' && count[p.y+1][p.x]==INF){ //???
    Point p;
    q.x = p.x;  q.y = p.y+1;
    que.push(q);
    count[q.y][q.x] = count[q.y][q.x]+1;
  }
  if(paz[p.y][p.x-1]!='#' && count[p.y][p.x-1]==INF){ //???
    Point p;
    q.x = p.x-1;  q.y = p.y;
    que.push(q);
    count[q.y][q.x] = count[q.y][q.x]+1;
  }
  if(paz[p.y][p.x+1]!='#' && count[p.y][p.x+1]==INF){ //???
    Point p;
    q.x = p.x+1;  q.y = p.y;
    que.push(q);
    count[q.y][q.x] = count[q.y][q.x]+1;
  }
}

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: expected primary-expression before ';' token
   20 |     for(int x=0; x<5=; x++){
      |                      ^
a.cc:45:17: error: 'xy' was not declared in this scope; did you mean 'xz'?
   45 | p.x = xz; p.y = xy;
      |                 ^~
      |                 xz
a.cc:52:86: error: expected identifier before numeric constant
   52 |   if(paz[0][0]<paz[0][1] && paz[0][1]<paz[0][2] && paz[0][2]<paz[0][3] && paz[0][3]<[1][0] && paz[1][0]<paz[1][1] && paz[1][1]<paz[1][2] && paz[1][2]<paz[1][3]){
      |                                                                                      ^
a.cc: In lambda function:
a.cc:52:88: error: expected '{' before '[' token
   52 |   if(paz[0][0]<paz[0][1] && paz[0][1]<paz[0][2] && paz[0][2]<paz[0][3] && paz[0][3]<[1][0] && paz[1][0]<paz[1][1] && paz[1][1]<paz[1][2] && paz[1][2]<paz[1][3]){
      |                                                                                        ^
a.cc: In function 'int main()':
a.cc:52:88: error: no match for 'operator[]' (operand types are 'main()::<lambda()>' and 'int')
a.cc:59:5: error: 'q' was not declared in this scope
   59 |     q.x = p.x;  q.y = p.y-1;
      |     ^
a.cc:65:5: error: 'q' was not declared in this scope
   65 |     q.x = p.x;  q.y = p.y+1;
      |     ^
a.cc:71:5: error: 'q' was not declared in this scope
   71 |     q.x = p.x-1;  q.y = p.y;
      |     ^
a.cc:77:5: error: 'q' was not declared in this scope
   77 |     q.x = p.x+1;  q.y = p.y;
      |     ^