criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<iostream>
#include<cstdio>
#include<map>
#include<set>
#include<queue>
#define P pair<int,int>
using namespace std;

int dx[4] = { -1,0,0,1 }, dy[4] = { 0,-1,1,0 };
int main() {
	int a, b;
	while (cin >> a >> b, a | b) {
		int c, d, e, f;
		cin >> c >> d >> e >> f;
		c--; d--; e--; f--;
		bool ba[50][50];
		int k[50][50];
		memset(k, -1, sizeof(k));
		for (int g = 0; g < a; g++) {
			for (int h = 0; h < b; h++) {
				cin >> ba[g][h];
			}
		}
		if ((((c - e) & 1) == 0) && (((d - f) & 1) == 0)) {
			queue<P>Q;
			if(!ba[c][d]&&!ba[e][f]) Q.push(P(c, d));
			k[c][d] = 0;
			while (Q.size()) {
				P o = Q.front(); Q.pop();
				cout << o.first << " " << o.second << endl;
				for (int i = 0; i < 4; i++) {
					int x = dx[i],y=dy[i];
						if (o.first + x >= 0 && o.first + x < a&&o.second + y >= 0 && o.second + y < b) {
							if (c + e - (o.first + x) >= 0 && c + e - (o.first + x) < a&&d + f - (o.second + y) >= 0 && d + f - (o.second + y) < b) {
								if (!ba[o.first + x][o.second + y] && !ba[c + e - (o.first + x)][d + f - (o.second + y)] && k[o.first + x][o.second + y] == -1) {
									Q.push(P(o.first + x, o.second + y));
									k[o.first + x][o.second + y] = k[o.first][o.second] + 1;
								}
							}
						}
				}
			}
			if (k[(c + e) / 2][(d + f) / 2] == -1)puts("NA");
			else cout << k[(c + e) / 2][(d + f) / 2] << endl;
		}
		else puts("NA");
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: 'memset' was not declared in this scope
   18 |                 memset(k, -1, sizeof(k));
      |                 ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<queue>
  +++ |+#include <cstring>
    6 | #define P pair<int,int>
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<queue>
#define P pair<int,int>
using namespace std;

bool c[52][52];
int d[52][52];
int x[4] = { -1,0,0,1 }, y[4] = { 0,-1,1,0 };
int main() {
	int a, b;
	while (cin >> a >> b, a | b) {
		memset(c, true, sizeof(c));
		memset(d,-1,sizeof(d));
		int e, f, g, h; cin >> e >> f >> g >> h;
		for (int i = 0; i < b; i++) {
			for (int j = 0; j < a; j++) {
				cin >> c[j + 1][i + 1];
			}
		}
		if (((e + g) & 1) == ((f + h) & 1)) {
		queue<P>Q;
		Q.push(P(e,f));
		d[e][f] = 0;
		while (Q.size()) {
			P o = Q.front(); Q.pop();
			for (int i = 0; i < 4; i++) {
				if (!c[o.first + x[i]][o.second + y[i]]&&!c[e+g-(o.first + x[i])][f+h-(o.second + y[i])]&& d[o.first + x[i]][o.second + y[i]] ==-1) {
					d[o.first + x[i]][o.second + y[i]] = d[o.first][o.second] + 1;
					Q.push(P(o.first + x[i], o.second + y[i]));
				}
			}
		}
		if (d[(e + g) / 2][(f + h) / 2] == -1)puts("NA");
		else cout << d[(e + g) / 2][(f + h) / 2] << endl;
		}
		else puts("NA");
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'memset' was not declared in this scope
   15 |                 memset(c, true, sizeof(c));
      |                 ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<queue>
  +++ |+#include <cstring>
    6 | #define P pair<int,int>
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<queue>
#define P pair<int,int>
using namespace std;

bool c[52][52];
int d[52][52];
int x[4] = { -1,0,0,1 }, y[4] = { 0,-1,1,0 };
int main() {
	int a, b;
	while (cin >> a >> b, a | b) {
		memset(c, true, sizeof(c));
		memset(d,-1,sizeof(d));
		int e, f, g, h; cin >> e >> f >> g >> h;
		for (int i = 0; i < b; i++) {
			for (int j = 0; j < a; j++) {
				cin >> c[j + 1][i + 1];
			}
		}
		if (((e + g) & 1) == ((f + h) & 1)) {
		queue<P>Q;
		Q.push(P(e,f));
		d[e][f] = 0;
		while (Q.size()) {
			P o = Q.front(); Q.pop();
			for (int i = 0; i < 4; i++) {
				if (!c[o.first + x[i]][o.second + y[i]]&&!c[e+g-(o.first + x[i])][f+h-(o.second + y[i])]&& d[o.first + x[i]][o.second + y[i]] ==-1) {
					d[o.first + x[i]][o.second + y[i]] = d[o.first][o.second] + 1;
					Q.push(P(o.first + x[i], o.second + y[i]));
				}
			}
		}
		if (d[(e + g) / 2][(f + h) / 2] == -1|| d[(e + g) / 2][(f + h) / 2]>99)puts("NA");
		else cout << d[(e + g) / 2][(f + h) / 2] << endl;
		}
		else puts("NA");
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'memset' was not declared in this scope
   15 |                 memset(c, true, sizeof(c));
      |                 ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<queue>
  +++ |+#include <cstring>
    6 | #define P pair<int,int>
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<queue>
#define p pair<int,int>
#define P pair<p,p>
using namespace std;

int a[50][50][50][50];
int x[4] = { -1,0,0,1 }, y[4] = { 0,-1,1,0 };
int S[50][50];
signed main() {
	int b, c;
	while (cin >> c >> b, b | c) {
		memset(a, 0x3f, sizeof(a));
		int d, e, f, g; cin >> e >> d >> g >> f; d--; e--; f--; g--;
		a[d][e][f][g] = 0;
		for (int i = 0; i < b; i++) {
			for (int j = 0; j < c; j++) {
				scanf("%d", &S[i][j]);
			}
		}
		queue<P>Q;
		Q.push(P(p(d,e),p(f,g)));
		while (Q.size()) {
			P t = Q.front(); Q.pop();
			for (int i = 0; i < 4; i++) {
				int j = 3 - i;
				p n, m; n = t.first; m = t.second;
				n.first += x[i]; n.second += y[i];
				m.first += x[j]; m.second += y[j];
				if (n.first < 0 || n.first >= b || n.second < 0 || n.second >= c||S[n.first][n.second]==1) {
					n.first -= x[i]; n.second -= y[i];
				}
				if (m.first < 0 || m.first >= b || m.second < 0 || m.second >= c||S[m.first][m.second]==1) {
					m.first -= x[j]; m.second -= y[j];
				}
				if (a[n.first][n.second][m.first][m.second] == 1061109567) {
					a[n.first][n.second][m.first][m.second] = a[t.first.first][t.first.second][t.second.first][t.second.second]+1;
					Q.push(P(p(n.first,n.second),p(m.first,m.second)));
				}
			}
		}
		int MIN = 100;
		for (int i = 0; i < b; i++) {
			for (int j = 0; j < c; j++) {
				MIN = min(MIN, a[i][j][i][j]);
			}
		}
		if (MIN == 100)puts("NA");
		else cout << MIN << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'memset' was not declared in this scope
   15 |                 memset(a, 0x3f, sizeof(a));
      |                 ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<queue>
  +++ |+#include <cstring>
    5 | #define p pair<int,int>
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<queue>
#define p pair<int,int>
#define P pair<p,p>
using namespace std;

int a[50][50][50][50];
int x[4] = { -1,0,0,1 }, y[4] = { 0,-1,1,0 };
int S[50][50];
signed main() {
	int b, c;
	while (cin >> c >> b, b | c) {
		memset(a, 0x3f, sizeof(a));
		int d, e, f, g; cin >> e >> d >> g >> f; d--; e--; f--; g--;
		a[d][e][f][g] = 0;
		for (int i = 0; i < b; i++) {
			for (int j = 0; j < c; j++) {
				scanf("%d", &S[i][j]);
			}
		}
		queue<P>Q;
		Q.push(P(p(d,e),p(f,g)));
		while (Q.size()) {
			P t = Q.front(); Q.pop();
			if (a[t.first.first][t.first.second][t.second.first][t.second.second] >= 100)break;
			if (t.first.first == t.second.first&&t.first.second == t.second.second) {
				cout << a[t.first.first][t.first.second][t.second.first][t.second.second] << endl;
				goto l;
		}
			for (int i = 0; i < 4; i++) {
				int j = 3 - i;
				p n, m; n = t.first; m = t.second;
				n.first += x[i]; n.second += y[i];
				m.first += x[j]; m.second += y[j];
				if (n.first < 0 || n.first >= b || n.second < 0 || n.second >= c||S[n.first][n.second]==1) {
					n.first -= x[i]; n.second -= y[i];
				}
				if (m.first < 0 || m.first >= b || m.second < 0 || m.second >= c||S[m.first][m.second]==1) {
					m.first -= x[j]; m.second -= y[j];
				}
				if (a[n.first][n.second][m.first][m.second] == 1061109567) {
					a[n.first][n.second][m.first][m.second] = a[t.first.first][t.first.second][t.second.first][t.second.second]+1;
					Q.push(P(p(n.first,n.second),p(m.first,m.second)));
				}
			}
		}
		puts("NA");
	l:;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'memset' was not declared in this scope
   15 |                 memset(a, 0x3f, sizeof(a));
      |                 ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<queue>
  +++ |+#include <cstring>
    5 | #define p pair<int,int>
Language: C++

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

bool went[50 + 10][50 + 10][50 + 10][50 + 10] = { 0 };

int map[50 + 10][50 + 10]/* = { 0 }*/;

int gx[] = { 1,0,-1,0,-1,0,1,0 };
int gy[] = { 0,1,0,-1,0,-1,0,1 };

struct ST
{
	int tx, ty;
	int kx, ky;
	int tim=0;
};

bool ChekNow(ST);


ST GoMap(ST, int);

void test(ST ex, int h, int w)
{
	int i, j;
	cout << endl;
	for (i = 1; i <= h; i++)
	{
		for (j = 1; j <= w; j++)
		{
			if ((i == ex.ky && j == ex.kx) || (i == ex.ty && j == ex.tx))
				cout << "*";
			else cout << map[i][j];
		}
		cout << endl;
	}
	cout << ex.tim << endl;
}


int main()
{
	ST now,tmp;

	queue <ST> nx;


	int w, h;
	int tsx, tsy;
	int ksx, ksy;

	bool flg;
	int i, j;

	while (cin >> w >> h, w != 0 && h != 0)
	{
		flg = true;

		cin >> tsx >> tsy;
		cin >> ksx >> ksy;
		
		for (i = 1; i <= h; i++)
		{
			map[i][0] = map[i][w + 1] = 1;

			for (j = 1; j <= w; j++)
			{
				cin >> map[i][j];
			}
		}

		for (i = 0; i <= w + 1; i++)
		{
			map[0][i] = 1;
			map[h + 1][i] = 1;
		}


		now.tx = tsx;
		now.ty = tsy;
		now.kx = ksx;
		now.ky = ksy;
		now.tim = 0;

		nx.push(now);

		while (!nx.empty())  && now.tim<100)
		{
			now = nx.front();
			nx.pop();

			/*
			if (now.tim >= 100)
			{
				break;
			}
			*/


			//if (ChekNow(now))
			//{
			//	continue;
			//}
			//went[now.tx][now.ty][now.kx][now.ky] = true;


			//test(now, h, w);


			if (now.tx == now.kx && now.ty == now.ky)
			{
				cout << now.tim << endl;

				flg = false;

				break;
			}

			for (i = 0; i < 4; i++)
			{
				//tmp=GoMap(now, i);


				tmp = now;

				if (map[now.ty + gy[i]][now.tx + gx[i]] == 0)
				{
					tmp.ty += gy[i];
					tmp.tx += gx[i];
				}
				if (map[now.ky + gy[i + 4]][now.kx + gx[i + 4]] == 0)
				{
					tmp.ky += gy[i + 4];
					tmp.kx += gx[i + 4];
				}


				if (!ChekNow(tmp))
				{
					tmp.tim++;

					went[tmp.tx][tmp.ty][tmp.kx][tmp.ky] = true;

					nx.push(tmp);
				}
			}
		}

		if (flg)
		{
			cout << "NA\n";
		}

		while (!nx.empty())
		{
			nx.pop();
		}


		memset(went, 0, sizeof(went));
	}
	return 0;
}


bool ChekNow (ST ex)
{
	return went[ex.tx][ex.ty][ex.kx][ex.ky];
}


ST GoMap(ST ex, int i)
{
	if (map[ex.ty + gy[i]][ex.tx + gx[i]] == 0)
	{
		ex.ty += gy[i];
		ex.tx += gx[i];
	}
	if (map[ex.ky + gy[i + 4]][ex.kx + gx[i + 4]] == 0)
	{
		ex.ky += gy[i + 4];
		ex.kx += gx[i + 4];
	}


	return ex;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:89:44: error: expected ';' before '.' token
   89 |                 while (!nx.empty())  && now.tim<100)
      |                                            ^
      |                                            ;
a.cc:89:41: error: label 'now' used but not defined
   89 |                 while (!nx.empty())  && now.tim<100)
      |                                         ^~~
Language: C++

package main

import (
	"fmt"
	"math"
)

type Position struct {
	X int64
	Y int64
}

func (one Position) Distance(another Position) int64 {
	return int64(math.Abs(float64(one.X-another.X)) + math.Abs(float64(one.Y-another.Y)))
}

type PersonPosition struct {
	Takayuki Position
	Kazuyuki Position
}

func (one PersonPosition) Distance() int64 {
	return one.Takayuki.Distance(one.Kazuyuki)
}

type Status struct {
	Person PersonPosition
	Turn   int64
}

type PQStatus []*Status

func solve(h, w int64) {
	var tx, ty, kx, ky int64
	fmt.Scan(&tx, &ty, &kx, &ky)
	tx--
	ty--
	kx--
	ky--
	m := make([][]int64, h)
	for i := range m {
		m[i] = make([]int64, w)
		for j := int64(0); j < w; j++ {
			fmt.Scan(&m[i][j])
		}
	}
	start := &Status{Person: PersonPosition{Takayuki: Position{X: tx, Y: ty}, Kazuyuki: Position{X: kx, Y: ky}}, Turn: 0}
	pq := make(PQStatus, 0)
	pq = append(pq, start)
	dx := []int64{0, 1, 0, -1}
	dy := []int64{1, 0, -1, 0}
	memo := make(map[PersonPosition]int64, 0)
	ans := int64(102)
	for pq.Len() > 0 {
		now := pq[0]
		pq = pq[1:]
		if now.Person.Distance() == 0 && ans > now.Turn {
			ans = now.Turn
		}
		if ans <= now.Turn {
			continue
		}

		if _, ok := memo[now.Person]; ok {
			continue
		}
		memo[now.Person] = now.Turn

		for i := 0; i < 4; i++ {
			next := &Status{}
			*next = *now
			next.Person.Kazuyuki.X += dx[i]
			next.Person.Kazuyuki.Y += dy[i]
			if next.Person.Kazuyuki.X < 0 || next.Person.Kazuyuki.X >= w ||
				next.Person.Kazuyuki.Y < 0 || next.Person.Kazuyuki.Y >= h ||
				m[next.Person.Kazuyuki.Y][next.Person.Kazuyuki.X] == 1 {
				next.Person.Kazuyuki.X -= dx[i]
				next.Person.Kazuyuki.Y -= dy[i]
			}
			next.Person.Takayuki.X -= dx[i]
			next.Person.Takayuki.Y -= dy[i]
			if next.Person.Takayuki.X < 0 || next.Person.Takayuki.X >= w ||
				next.Person.Takayuki.Y < 0 || next.Person.Takayuki.Y >= h ||
				m[next.Person.Takayuki.Y][next.Person.Takayuki.X] == 1 {
				next.Person.Takayuki.X += dx[i]
				next.Person.Takayuki.Y += dy[i]
			}
			next.Turn++
			if next.Turn <= 100 {
				pq = append(pq, next)
			}
		}
	}
	if ans == 102 {
		fmt.Println("NA")
	} else {
		fmt.Println(ans)
	}
}

func main() {
	var h, w int64
	for {
		fmt.Scan(&h, &w)
		if h == 0 && w == 0 {
			break
		}
		solve(h, w)
	}
}



Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:13:6: error: expected constructor, destructor, or type conversion before '(' token
   13 | func (one Position) Distance(another Position) int64 {
      |      ^
a.cc:17:1: error: 'type' does not name a type; did you mean 'typeof'?
   17 | type PersonPosition struct {
      | ^~~~
      | typeof
a.cc:22:6: error: expected constructor, destructor, or type conversion before '(' token
   22 | func (one PersonPosition) Distance() int64 {
      |      ^
a.cc:26:1: error: 'type' does not name a type; did you mean 'typeof'?
   26 | type Status struct {
      | ^~~~
      | typeof
a.cc:31:1: error: 'type' does not name a type; did you mean 'typeof'?
   31 | type PQStatus []*Status
      | ^~~~
      | typeof
a.cc:101:1: error: 'func' does not name a type
  101 | func main() {
      | ^~~~
Language: C++

#include<iostream>
#include<queue>

using namespace std;

#define MAX 51

int xy[MAX][MAX];
int cost[MAX][MAX][MAX][MAX];
int X,Y;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

struct state{
  int tx;
  int ty;
  int kx;
  int ky;
  int co;
  state(){}
  state(int tx,int ty,int kx,int ky,int co):
    tx(tx),ty(ty),kx(kx),ky(ky),co(co){}
};

int solve(int tx,int ty,int kx,int ky){

  memset(cost,101,sizeof(cost));

  queue<state> q;
  q.push( state(tx,ty,kx,ky,0) );

  while( !q.empty() ){
    state p=q.front();
    q.pop();

    //printf("co=%d\n",p.co);

    if(p.co==100){
      break;
    }

    tx=p.tx;
    ty=p.ty;
    kx=p.kx;
    ky=p.ky;

    for(int i=0;i<4;i++){
     
      /*  if( (tx+dx[i] < 0 || ty+dy[i] <0 || tx+dx[i] >= X || ty+dy[i] >= Y) || xy[ty+dy[i]][tx+dx[i]]==1 ){
	fl++;
      }
      if(kx+dx[i]*-1 < 0 || ky+dy[i]*-1 <0 || kx+dx[i]*-1 >= X || ty+dy[i]*-1 >= Y || xy[ky+dy[i]*-1][kx+dx[i]*-1]==1){
	fl+=10;
	}*/

      
      if(kx+dx[i]*-1 < 0 || ky+dy[i]*-1 <0 || kx+dx[i]*-1 >= X || ty+dy[i]*-1 >= Y || 
	 tx+dx[i] < 0 || ty+dy[i] <0 || tx+dx[i] >= X || ty+dy[i] >= Y )
	continue;

      cost[tx][ty][kx][ky]=p.co;

      if( cost[tx+dx[i]][ty+dy[i]][kx+dx[i]*-1][ky+dy[i]*-1] < p.co)
	continue;

      if( xy[ty+dy[i]][tx+dx[i]]==1 || xy[ky+dy[i]*-1][kx+dx[i]*-1]==1 )
	continue;
      
      if(tx+dx[i] == kx+dx[i]*-1 && ty+dy[i] == ky+dy[i]*-1){
	if(p.co+1>=100) return -1;
	return p.co+1;
      }

      //if(cost[p.tx+dx[i]][p.ty+dy[i]] < p.co)
      //continue;
      //if(cosk[p.kx+dx[i]*-1][p.ky+dy[i]*-1] < p.co)
      //continue;

      //cost[p.tx+dx[i]][p.ty+dy[i]]=p.co+1;
      //cosk[p.kx+dx[i]*-1][p.ky+dy[i]*-1]=p.co+1;

      /*if(fl%10==1 && fl/10==1)
	continue;
      else if(fl%10==1)
	q.push( state(tx+dx[i],ty+dy[i],kx,ky,p.co+1) );
      else if(fl/10==1)
      q.push( state(tx,ty,kx+dx[i]*-1,ky+dy[i]*-1,p.co+1) );
      else*/

      q.push( state(tx+dx[i],ty+dy[i],kx+dx[i]*-1,ky+dy[i]*-1,p.co+1) );

    }
  }
  return -1;
} 

main(){
  
  int i,j;
  int kx,ky,tx,ty;
  int n;

  while(1){
    
    cin >> X >> Y;

    if(X==0 && Y==0) break;
    
    cin >> tx >> ty;
    cin >> kx >> ky;
    
    for(i=0;i<Y;i++){
      for(j=0;j<X;j++){
	cin >> xy[i][j];
      }
    }
    
    n=solve(tx-1,ty-1,kx-1,ky-1);
    
    if(n==-1)
      cout << "NA" << endl;
    else
      cout << n << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int solve(int, int, int, int)':
a.cc:28:3: error: 'memset' was not declared in this scope
   28 |   memset(cost,101,sizeof(cost));
      |   ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<queue>
  +++ |+#include <cstring>
    3 | 
a.cc: At global scope:
a.cc:98:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   98 | main(){
      | ^~~~
Language: C++

#include<iostream>
#include<queue>

using namespace std;

#define MAX 51

int xy[MAX][MAX];
int cost[MAX][MAX][MAX][MAX];
int X,Y;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

struct state{
  int tx;
  int ty;
  int kx;
  int ky;
  int co;
  state(){}
  state(int tx,int ty,int kx,int ky,int co):
    tx(tx),ty(ty),kx(kx),ky(ky),co(co){}
};

int solve(int tx,int ty,int kx,int ky){

  memset(cost,101,sizeof(cost));

  queue<state> q;
  q.push( state(tx,ty,kx,ky,0) );

  while( !q.empty() ){
    state p=q.front();
    q.pop();

    if(p.co==100){
      break;
    }

    tx=p.tx;
    ty=p.ty;
    kx=p.kx;
    ky=p.ky;

    for(int i=0;i<4;i++){
      
      if(kx+dx[i]*-1 < 0 || ky+dy[i]*-1 <0 || kx+dx[i]*-1 >= X || ty+dy[i]*-1 >= Y || 
	 tx+dx[i] < 0 || ty+dy[i] <0 || tx+dx[i] >= X || ty+dy[i] >= Y )
	continue;

      cost[tx][ty][kx][ky]=p.co;

      if( cost[tx+dx[i]][ty+dy[i]][kx+dx[i]*-1][ky+dy[i]*-1] < p.co)
	continue;

      if( xy[ty+dy[i]][tx+dx[i]]==1 || xy[ky+dy[i]*-1][kx+dx[i]*-1]==1 )
	continue;
      
      if(tx+dx[i] == kx+dx[i]*-1 && ty+dy[i] == ky+dy[i]*-1){
	if(p.co+1>=100) return -1;
	return p.co+1;
      }

      q.push( state(tx+dx[i],ty+dy[i],kx+dx[i]*-1,ky+dy[i]*-1,p.co+1) );

    }
  }
  return -1;
} 

main(){
  
  int i,j;
  int kx,ky,tx,ty;
  int n;

  while(1){
    
    cin >> X >> Y;

    if(X==0 && Y==0) break;
    
    cin >> tx >> ty;
    cin >> kx >> ky;
    
    for(i=0;i<Y;i++){
      for(j=0;j<X;j++){
	cin >> xy[i][j];
      }
    }
    
    n=solve(tx-1,ty-1,kx-1,ky-1);
    
    if(n==-1)
      cout << "NA" << endl;
    else
      cout << n << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int solve(int, int, int, int)':
a.cc:28:3: error: 'memset' was not declared in this scope
   28 |   memset(cost,101,sizeof(cost));
      |   ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<queue>
  +++ |+#include <cstring>
    3 | 
a.cc: At global scope:
a.cc:72:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   72 | main(){
      | ^~~~
Language: C++

#include <iostream>
#include <queue>
#include <map>

#define INF 100000000
#define MAX_X 1000
#define MAX_Y 1000

using namespace std;

typedef pair<pair<int,int>,pair<int,int> > P;

int d[MAX_Y][MAX_X][MAX_Y][MAX_X];

int tx,ty,kx,ky,ntx,nty,nkx,nky;
int ans;

short maze[MAX_Y][MAX_X];
int Y,X;

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

bool bfs(){
	queue<P> que;
	map<P,int> mat;
	que.push(make_pair(make_pair(ty,tx),make_pair(ky,kx)));
	
	mat[que.front()]=0;
	while (que.size()&&100>=d[nty][ntx][nky][nkx]) {
		P p=que.front();
		que.pop();
		if (p.first.first==p.second.first&&p.first.second==p.second.second) {
			ans=d[p.first.first][p.first.second][p.second.first][p.second.second];
			return true;
		}
		if (mat[que.front()]) {
			continue;
		}

		
		for (int i=0; i<4; i++) {
			ntx=p.first.second+dx[i],nty=p.first.first+dy[i],nkx=p.second.second+dx[i]*(-1),nky=p.second.first+dy[i]*(-1);
			int flag=2;
			if (!(0<=ntx&&ntx<X&&0<=nty&&nty<Y&&maze[nty][ntx]!=1)){
				flag-=1;
				ntx=p.first.second;
				nty=p.first.first;
			}
			if (!(0<=nkx&&nkx<X&&0<=nky&&nky<Y&&maze[nky][nkx]!=1)) {
				flag-=1;
				nkx=p.second.second;
				nky=p.second.first;
			}
			if (flag!=0) {
				que.push(P(make_pair(nty,ntx),make_pair(nky,nkx)));
				d[nty][ntx][nky][nkx]=d[p.first.first][p.first.second][p.second.first][p.second.second]+1;
			}
			mat[que.front()] = d[nty][ntx][nky][nkx];
		}
	}
	return false;
}

int main(){
	while (cin>>X>>Y&&X&&Y) {
		cin>>tx>>ty>>kx>>ky;
		tx-=1;
		ty-=1;
		kx-=1;
		ky-=1;
		for (int i=0; i<Y; i++) {
			for (int j=0; j<X; j++) {
				cin>>maze[i][j];
			}
		}
		if(bfs()){
			cout << ans <<endl;
		}
		else {
			cout << "NA" << endl;
		}
	}
}

Compiler output:
/tmp/ccvd5Gl5.o: in function `bfs()':
a.cc:(.text+0x2d): relocation truncated to fit: R_X86_64_PC32 against symbol `kx' defined in .bss section in /tmp/ccvd5Gl5.o
a.cc:(.text+0x37): relocation truncated to fit: R_X86_64_PC32 against symbol `ky' defined in .bss section in /tmp/ccvd5Gl5.o
a.cc:(.text+0x4a): relocation truncated to fit: R_X86_64_PC32 against symbol `tx' defined in .bss section in /tmp/ccvd5Gl5.o
a.cc:(.text+0x54): relocation truncated to fit: R_X86_64_PC32 against symbol `ty' defined in .bss section in /tmp/ccvd5Gl5.o
a.cc:(.text+0x16c): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccvd5Gl5.o
a.cc:(.text+0x1db): relocation truncated to fit: R_X86_64_PC32 against symbol `ntx' defined in .bss section in /tmp/ccvd5Gl5.o
a.cc:(.text+0x200): relocation truncated to fit: R_X86_64_PC32 against symbol `nty' defined in .bss section in /tmp/ccvd5Gl5.o
a.cc:(.text+0x225): relocation truncated to fit: R_X86_64_PC32 against symbol `nkx' defined in .bss section in /tmp/ccvd5Gl5.o
a.cc:(.text+0x24a): relocation truncated to fit: R_X86_64_PC32 against symbol `nky' defined in .bss section in /tmp/ccvd5Gl5.o
a.cc:(.text+0x257): relocation truncated to fit: R_X86_64_PC32 against symbol `ntx' defined in .bss section in /tmp/ccvd5Gl5.o
a.cc:(.text+0x261): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <queue>
#include <map>

#define INF 100000000
#define MAX_X 1000
#define MAX_Y 1000

using namespace std;

typedef pair<pair<int,int>,pair<int,int> > P;

int d[MAX_Y][MAX_X][MAX_Y][MAX_X];

int tx,ty,kx,ky,ntx,nty,nkx,nky;
int ans;

short maze[MAX_Y][MAX_X];
int Y,X;

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

bool bfs(){
	queue<P> que;
	map<P,int> mat;
	que.push(make_pair(make_pair(ty,tx),make_pair(ky,kx)));
	
	mat[que.front()]=0;
	while (que.size()) {
		P p=que.front();
		que.pop();
		if (p.first.first==p.second.first&&p.first.second==p.second.second) {
			ans=d[p.first.first][p.first.second][p.second.first][p.second.second];
			return true;
		}
		if (d[p.first.first][p.first.second][p.second.first][p.second.second]>=100) {
			return false;
		}
		if (mat[que.front()]) {
			continue;
		}
		for (int i=0; i<4; i++) {
			ntx=p.first.second+dx[i],nty=p.first.first+dy[i],nkx=p.second.second+dx[i]*(-1),nky=p.second.first+dy[i]*(-1);
			int flag=2;
			if (!(0<=ntx&&ntx<X&&0<=nty&&nty<Y&&maze[nty][ntx]!=1)){
				flag-=1;
				ntx=p.first.second;
				nty=p.first.first;
			}
			if (!(0<=nkx&&nkx<X&&0<=nky&&nky<Y&&maze[nky][nkx]!=1)) {
				flag-=1;
				nkx=p.second.second;
				nky=p.second.first;
			}
			if (flag!=0) {
				que.push(P(make_pair(nty,ntx),make_pair(nky,nkx)));
				d[nty][ntx][nky][nkx]=d[p.first.first][p.first.second][p.second.first][p.second.second]+1;
			}
			mat[que.front()] = d[nty][ntx][nky][nkx];
		}
	}
	return false;
}

int main(){
	while (cin>>X>>Y&&X&&Y) {
		cin>>tx>>ty>>kx>>ky;
		tx-=1;
		ty-=1;
		kx-=1;
		ky-=1;
		for (int i=0; i<Y; i++) {
			for (int j=0; j<X; j++) {
				cin>>maze[i][j];
			}
		}
		if(bfs()){
			cout << ans <<endl;
		}
		else {
			cout << "NA" << endl;
		}
	}
}

Compiler output:
/tmp/ccsKjFln.o: in function `bfs()':
a.cc:(.text+0x2d): relocation truncated to fit: R_X86_64_PC32 against symbol `kx' defined in .bss section in /tmp/ccsKjFln.o
a.cc:(.text+0x37): relocation truncated to fit: R_X86_64_PC32 against symbol `ky' defined in .bss section in /tmp/ccsKjFln.o
a.cc:(.text+0x4a): relocation truncated to fit: R_X86_64_PC32 against symbol `tx' defined in .bss section in /tmp/ccsKjFln.o
a.cc:(.text+0x54): relocation truncated to fit: R_X86_64_PC32 against symbol `ty' defined in .bss section in /tmp/ccsKjFln.o
a.cc:(.text+0x16c): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccsKjFln.o
a.cc:(.text+0x23d): relocation truncated to fit: R_X86_64_PC32 against symbol `ntx' defined in .bss section in /tmp/ccsKjFln.o
a.cc:(.text+0x262): relocation truncated to fit: R_X86_64_PC32 against symbol `nty' defined in .bss section in /tmp/ccsKjFln.o
a.cc:(.text+0x287): relocation truncated to fit: R_X86_64_PC32 against symbol `nkx' defined in .bss section in /tmp/ccsKjFln.o
a.cc:(.text+0x2ac): relocation truncated to fit: R_X86_64_PC32 against symbol `nky' defined in .bss section in /tmp/ccsKjFln.o
a.cc:(.text+0x2b9): relocation truncated to fit: R_X86_64_PC32 against symbol `ntx' defined in .bss section in /tmp/ccsKjFln.o
a.cc:(.text+0x2c3): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <queue>
#include <map>

#define MAX_X 1000
#define MAX_Y 1000

using namespace std;

typedef pair<int,int> P;
typedef pair<P,P> PP;

int d[MAX_Y][MAX_X][MAX_Y][MAX_X];

int tx,ty,kx,ky,ntx,nty,nkx,nky;
int ans;

short maze[MAX_Y][MAX_X];
int Y,X;

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

bool bfs(){
	queue<PP> que;
	map<PP,int> mat;
	que.push(make_pair(make_pair(ty,tx),make_pair(ky,kx)));
	
	mat[que.front()]=0;
	while (que.size()) {
		PP p=que.front();
		que.pop();
		if (p.first.first==p.second.first&&p.first.second==p.second.second) {
			ans=d[p.first.first][p.first.second][p.second.first][p.second.second];
			return true;
		}
		if (d[p.first.first][p.first.second][p.second.first][p.second.second]>=100) {
			return false;
		}
		if (mat[que.front()]) {
			continue;
		}
		for (int i=0; i<4; i++) {
			ntx=p.first.second+dx[i],nty=p.first.first+dy[i],nkx=p.second.second+dx[i]*(-1),nky=p.second.first+dy[i]*(-1);
			int flag=2;
			if (!(0<=ntx&&ntx<X&&0<=nty&&nty<Y&&maze[nty][ntx]!=1)){
				flag-=1;
				ntx=p.first.second;
				nty=p.first.first;
			}
			if (!(0<=nkx&&nkx<X&&0<=nky&&nky<Y&&maze[nky][nkx]!=1)) {
				flag-=1;
				nkx=p.second.second;
				nky=p.second.first;
			}
			if (flag!=0) {
				que.push(make_pair(make_pair(nty,ntx),make_pair(nky,nkx)));
				d[nty][ntx][nky][nkx]=d[p.first.first][p.first.second][p.second.first][p.second.second]+1;
			}
			mat[que.front()] = d[nty][ntx][nky][nkx];
		}
	}
	return false;
}

int main(){
	while (cin>>X>>Y&&X&&Y) {
		cin>>tx>>ty>>kx>>ky;
		tx-=1;
		ty-=1;
		kx-=1;
		ky-=1;
		for (int i=0; i<Y; i++) {
			for (int j=0; j<X; j++) {
				cin>>maze[i][j];
			}
		}
		if(bfs()){
			cout << ans <<endl;
		}
		else {
			cout << "NA" << endl;
		}
	}
}

Compiler output:
/tmp/cc0G4e3U.o: in function `bfs()':
a.cc:(.text+0x2d): relocation truncated to fit: R_X86_64_PC32 against symbol `kx' defined in .bss section in /tmp/cc0G4e3U.o
a.cc:(.text+0x37): relocation truncated to fit: R_X86_64_PC32 against symbol `ky' defined in .bss section in /tmp/cc0G4e3U.o
a.cc:(.text+0x4a): relocation truncated to fit: R_X86_64_PC32 against symbol `tx' defined in .bss section in /tmp/cc0G4e3U.o
a.cc:(.text+0x54): relocation truncated to fit: R_X86_64_PC32 against symbol `ty' defined in .bss section in /tmp/cc0G4e3U.o
a.cc:(.text+0x16c): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc0G4e3U.o
a.cc:(.text+0x23d): relocation truncated to fit: R_X86_64_PC32 against symbol `ntx' defined in .bss section in /tmp/cc0G4e3U.o
a.cc:(.text+0x262): relocation truncated to fit: R_X86_64_PC32 against symbol `nty' defined in .bss section in /tmp/cc0G4e3U.o
a.cc:(.text+0x287): relocation truncated to fit: R_X86_64_PC32 against symbol `nkx' defined in .bss section in /tmp/cc0G4e3U.o
a.cc:(.text+0x2ac): relocation truncated to fit: R_X86_64_PC32 against symbol `nky' defined in .bss section in /tmp/cc0G4e3U.o
a.cc:(.text+0x2b9): relocation truncated to fit: R_X86_64_PC32 against symbol `ntx' defined in .bss section in /tmp/cc0G4e3U.o
a.cc:(.text+0x2c3): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;

struct S {
	int tx,ty;
	int kx,ky;
	int turn;
	S::S(int tx,int ty,int kx,int ky,int turn);
};

S::S(int _tx,int _ty,int _kx,int _ky,int _turn) {
	tx=_tx;
	ty=_ty;
	kx=_kx;
	ky=_ky;
	turn=_turn;
}

bool d[50][50];
bool vst[50][50][50][50];
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

int main() {
	int X,Y;
	int tx,ty;
	int kx,ky;
	while(scanf("%d %d",&X,&Y),X||Y) {
		scanf("%d %d",&tx,&ty);
		scanf("%d %d",&kx,&ky);
		for(int j=0;j<Y;j++) {
			for(int i=0;i<X;i++) {
				scanf("%d",&d[i][j]);
			}
		}
		tx--;ty--;kx--;ky--;
		queue<S> q;
		bool ok=false;
		q.push(S(tx,ty,kx,ky,0));
		memset(vst,false,sizeof(vst));
		vst[tx][ty][kx][ky]=true;
		while(!q.empty()) {
			S s=q.front();q.pop();
			if(s.turn>=100) break;
			if(s.tx==s.kx&&s.ty==s.ky) {
				printf("%d\n",s.turn);
				ok=true;
				break;
			}
			for(int i=0;i<4;i++) {
				int ntx=s.tx+dx[i],nty=s.ty+dy[i];
				int nkx=s.kx-dx[i],nky=s.ky-dy[i];
				if(0>ntx||ntx>=X||0>nty||nty>=Y||d[ntx][nty]) {
					ntx-=dx[i],nty-=dy[i];
				}
				if(0>nkx||nkx>=X||0>nky||nky>=Y||d[nkx][nky]) {
					nkx+=dx[i],nky+=dy[i];
				}
				if(!vst[ntx][nty][nkx][nky]) {
					vst[ntx][nty][nkx][nky]=true;
					q.push(S(ntx,nty,nkx,nky,s.turn+1));
				}
			}
		}
		if(!ok) printf("NA\n");
	}
	return 0;
}

Compiler output:
a.cc:10:9: error: extra qualification 'S::' on member 'S' [-fpermissive]
   10 |         S::S(int tx,int ty,int kx,int ky,int turn);
      |         ^
Language: C++

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

struct node 
{
  int step;
  int tx,ty;
  int kx,ky;
  node(int s,int ttx,int tty,int kkx,int kky):
    step(s),tx(ttx),ty(tty),kx(kkx),ky(kky){} 
};
  
int main()
{
  int x,y;
  for(;cin>>x>>y,x;)
    {
      bool data[52][52];
      int tx,ty,kx,ky;
      cin>>tx>>ty>>kx>>ky;
      memset(data,false,sizeof(data));
      for(int i=1;i<=x;i++)
	for(int j=1;j<=y;j++)
	  {
	    char tmp;
	    cin>>tmp;
	    data[j][i]=(tmp=='0');
	  }
      queue<node> qu;
      qu.push(node(0,tx,ty,kx,ky));
      map< pair<pair<int,int>,pair<int,int> > ,bool >hash;      
      int ans=-1;
      int dx[]={0,0,1,-1};
      int dy[]={1,-1,0,0};
      while(!qu.empty())
	{
	  node tmp=qu.front();
	  qu.pop();
	  //	  cout<<tmp.step<<" "<<tmp.tx<<" "<<tmp.ty<<" "<<tmp.kx<<" "<<tmp.ky<<endl;
	  if(hash[make_pair(make_pair(tmp.tx,tmp.ty),make_pair(tmp.kx,tmp.ky))])
	    continue;
	  if(tmp.tx==tmp.kx &&tmp.ty==tmp.ky)
	    {
	      ans=tmp.step;
	      break;
	    }
	  if(tmp.step>=99)
	    continue;
	  hash[make_pair(make_pair(tmp.tx,tmp.ty),make_pair(tmp.kx,tmp.ky))]=true;
	  for(int i=0;i<4;i++)
	    {
	      int ttx=tmp.tx,tty=tmp.ty,tkx=tmp.kx,tky=tmp.ky;
	      if(data[ttx+dx[i]][tty+dy[i]])
		{
		  ttx+=dx[i];
		  tty+=dy[i];
		}
	      if(data[tkx-dx[i]][tky-dy[i]])
		{
		  tkx-=dx[i];
		  tky-=dy[i];
		}
	      //cout<<"make"<<ttx<<" "<<tkx<<" "<<tty<<" "<<tty<<endl;	      
	      if(!hash[make_pair(make_pair(ttx,tty),make_pair(tkx,tky))])
		qu.push(node(tmp.step+1,ttx,tty,tkx,tky));
	    }
	}
      if(ans==-1)
	cout<<"NA"<<endl;
      else
	cout<<ans<<endl;

    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:7: error: 'memset' was not declared in this scope
   23 |       memset(data,false,sizeof(data));
      |       ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<map>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: Java


























































































































































ツ鳴セツ禿コツ閉淞督?づ可帰ツづィツづ慊つキツ?卍（ツゝツε鳴・ツ）vツキツャテ凝?
ツづ?づ債づ?づ催可シ

Compiler output:
Main.java:154: error: class, interface, enum, or record expected
??????????????????????????????????v???????
^
Main.java:154: error: illegal character: '\uff08'
??????????????????????????????????v???????
                         ^
Main.java:154: error: illegal character: '\u30fb'
??????????????????????????????????v???????
                               ^
Main.java:154: error: illegal character: '\uff09'
??????????????????????????????????v???????
                                 ^
4 errors
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>

#define MIN(x,y) (((x)<(y))?(x):(y))
#define INFTY (1<<21)


int m, n, k, d, C[7], G[110][110], N, D[110][64];

int getID(char *str);
int isC(int x);
int bellman(void);

int main(void){
  char source[16], target[16];
  int cost,s,t;
  int i,j;
  while(scanf("%d%*c%d%*c%d%*c%d%*c",&m,&n,&k,&d) && m ){
    N = 2 + n + m;
    for(i=1;i<m+1;i++) scanf("%d%*c",&C[i]);
    for(i=0;i<N;i++) for(j=0;j<N;j++) G[i][j] = INFTY;
    for(i=0;i<d;i++){
      scanf("%s%*c%s%*c%d%*c",source,target,&cost);
      s = getID(source);
      t = getID(target);
      G[t][s] = G[s][t] = MIN(G[s][t], cost * k);
    }
    printf("%d\n",bellman());
  }
  return 0;
}

int getID(char *str){
  char num[16];
  if ( str[0] == 'H' ) return 0;
  if ( str[0] == 'D' ) return N - 1;
  strcpy(num,str+1);
  if ( str[0] == 'C' ) return atoi(num);
  return atoi(num) + m;
}

int isC(int x){
  return (1 <= x) && (x <= m);
}

int bellman(void){
  bool change;
  int minv;
  int i,i1,i2,i3,i4,j;

  for(i=0;i<N;i++) for(j=0;j<(1<<m);j++) D[i][j] = INFTY;
  D[0][0] = 0;
  for(i1=0;i1<N*(1<<m);i1++){
	change=false;
    for(i2=0;i2<N;i2++){
      for(i3=0;i3<N;i3++){
	if ( i2 == i3 || G[i2][i3] == INFTY ) continue;
	for(i4=0;i4<(1<<m);i4++){
	  if (isC(i3) && (b&(1<<(i3-1))) != 0 ) continue;
	  if ( isC(i3) ) {
	    if ( D[i2][i4] + G[i2][i3] - C[i3] < D[i3][i4|(1<<(i3-1))] ) {
	      D[i3][i4|(1<<(i3-1))] = D[i2][i4] + G[i2][i3] - C[i3];
	      change = true;
	    }
	  } else {
	    if ( D[i2][i4] + G[i2][i3] < D[i3][i4] ){
	      D[i3][i4] = D[i2][i4] + G[i2][i3];
	      change = true;
	    }
	  }
	}
      }
    }
    if ( !change ) break;
  }
  minv = INFTY;
  for(i=0;i<(1<<m);i++) minv = MIN(minv, D[N-1][i]);
  return minv;
}

Compiler output:
main.c: In function 'bellman':
main.c:61:27: error: 'b' undeclared (first use in this function)
   61 |           if (isC(i3) && (b&(1<<(i3-1))) != 0 ) continue;
      |                           ^
main.c:61:27: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define INF (1<<30)
typedef pair< int , int > P;
typedef pair< int , P > Pi;
int m,n,k,d;
vector<int> cal;
struct Edge {
  int to,cost;
  Edge(){}
  Edge(int to,int cost):to(to),cost(cost){};
};
vector< Edge > Graph[110];
int min_cost[110][1<<6];
int Bellman_Ford(){
  int ret = INF;
  fill_n(*min_cost,110*(1<<6),INF);
  min_cost[0][(1<<m)-1] = true;
  queue<Pi> que;
  que.push(Pi(0,P(0,(1<<m)-1)));
  while(!que.empty()){
    Pi p = que.front();
    que.pop();
    //int cost = p.first;
    //int now = p.second.first;
    //int bit = p.second.second;
    if(p.second.first == 1) ret = min(ret,p.first);
    if(min_cost[p.second.first][p.second.second] < p.first) continue;
    for(int i=0;i<Graph[p.second.first].size();i++){
      Edge e = Graph[p.second.first][i];
      int nc = p.first + e.cost*k;
      int bit = p.second.second;
      if(e.to >= 2 && e.to < 2 + m){
	if((bit >> (e.to-2)) & 1){
	  nc -= cal[e.to-2];
	  bit &= ~(1 << (e.to-2));
	} else continue;
      }
      if(cost < min_cost[e.to][bit]){
	que.push(Pi(nc,P(e.to,bit)));
	min_cost[e.to][bit] = nc;
      }
    }
  }
  return ret;
}

int judge(string s){
  if(s == "H") return 0;
  else if(s == "D") return 1;
  else if(s[0] == 'C') return atoi(s.substr(1).c_str())+1;
  else if(s[0] == 'L') return atoi(s.substr(1).c_str())+m+1;
}

int main(){
  while(cin >> m >> n >> k >> d , m){
    cal.resize(m);
    for(int i=0;i<m;i++) cin >> cal[i];
    for(int i=0;i<d;i++){
      string s1,s2; int dis;
      cin >> s1 >> s2 >> dis;
      Graph[judge(s1)].push_back(Edge(judge(s2),dis));
      Graph[judge(s2)].push_back(Edge(judge(s1),dis));
    }
    cout << Bellman_Ford() << endl;
    for(int i=0;i<110;i++) Graph[i].clear();
  }
}

Compiler output:
a.cc: In function 'int Bellman_Ford()':
a.cc:39:10: error: 'cost' was not declared in this scope; did you mean 'cosl'?
   39 |       if(cost < min_cost[e.to][bit]){
      |          ^~~~
      |          cosl
a.cc: In function 'int judge(std::string)':
a.cc:53:1: warning: control reaches end of non-void function [-Wreturn-type]
   53 | }
      | ^
Language: C++

#include <stdio.h>
#include <stdlib.h>

#define INF (10000000)
#define REP(i, n) for (int i = 0; i < (n); i++)

int route[110][110];
int quick[110];
int cake_cal[6];
int k;

void set_route(char start[], char end[], int dist)
{
	int s, e;
	if (start[0] == 'H'){
		s = 0;
	}
	else if (start[0] == 'D'){
		s = 109;
	}
	else if (start[0] == 'L'){
		s = 0;
	}
	else if (start[0] == 'C'){
		s = 100;
	}
	s += atoi(start + 1);
	
	if (end[0] == 'H'){
		e = 0;
	}
	else if (end[0] == 'D'){
		e = 109;
	}
	else if (end[0] == 'L'){
		e = 0;
	}
	else if (end[0] == 'C'){
		e = 100;
	}
	e += atoi(end + 1);

	
	route[s][e] = route[e][s] = dist;
}

int track_back(int pos, int cost, int cake_cap)
{
	int ans = INF;
	
	if (pos == 109){
		return (cost);
	}
	
	quick[pos] = min(quick[pos], cost);
	
	for (int i = 0; i < 110; i++){
		if (route[pos][i] != INF && cost + (route[pos][i] * k) + cake_cap < quick[i]){
			if (i >= 101 && i < 109){
				int temp = cake_cal[(i % 100) - 1];
				cake_cal[(i % 100) - 1] = 0;
				ans = min(ans, track_back(i, cost + (route[pos][i] * k) + temp, cake_cap - temp));
				cake_cal[(i % 100) - 1] = temp;
			}
			else {
				ans = min(ans, track_back(i, cost + (route[pos][i] * k), cake_cap));
			}
		}
	}
	
	return (ans);
}

int main(void)
{
	int n, m, d;
	int cake_cap;
	int ans;
	
	for (int i = 0; i < 110; i++){
		for (int j = 0; j < 110; j++){
			route[i][j] = INF;
		}
		quick[i] = INF;
	}
	
	scanf("%d%d%d%d", &m, &n, &k, &d);
	
	cake_cap = 0;
	for (int i = 0; i < m; i++){
		scanf("%d", &cake_cal[i]);
		cake_cal[i] = -cake_cal[i];
		cake_cap += cake_cal[i];
	}
	
	for (int i = 0; i < d; i++){
		char s1[10];
		char s2[10];
		int dist;
		scanf("%s%s%d", s1, s2, &dist);
		set_route(s1, s2, dist);
	}
	
	
	ans = track_back(0, 0, cake_cap);
	
	printf("%d\n", ans);
	
	return (0);
}

Compiler output:
a.cc: In function 'int track_back(int, int, int)':
a.cc:55:22: error: 'min' was not declared in this scope
   55 |         quick[pos] = min(quick[pos], cost);
      |                      ^~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<stdlib>

using namespace std;

struct edge{
	int from,to,cost;
	edge(int a,int b,int c){from = a , to = b , cost = c;} 
};

int m,n,k,dd;
vector<edge> es;
const int INF=100000;
int d[209];
int cake[9];

int root(string s){
	if(s[0]=='H')return 0;
	if(s[0]=='D')return 1;
	string num = s.substr(1,s.size()-1); 
	if(s[0]=='C')return 1+atoi(num.c_str());
	if(s[0]=='L')return m+1+atoi(num.c_str());
}

void path(int s){
	int a,b;
	for(a=0;a<209;a++)d[a]=INF;
	d[s]=0;
	while(true){
		bool upd=false;
		for(a=0;a<es.size();a++){
			edge e=es[a];
			if(e.to>1 && e.to<=1+m){
				if(d[e.from]!=INF && d[e.to]>d[e.from]+e.cost-cake[e.to]){
					d[e.to]=d[e.from]+e.cost-cake[e.to];
					cake[e.to]=0;
					upd=true;
				}
			}else if(d[e.from]!=INF &&  d[e.to]>d[e.from]+e.cost){
				d[e.to]=d[e.from]+e.cost;
				upd=true;
			}
		}
		if(!upd)break;
	}
}

int main(void){
	int a;
	while(1){
		cin >> m >> n >> k >> dd;
		if(m==0 && n==0 && k==0 && dd==0)break;
		es.clear();
		for(a=0;a<m;a++){
			cin >> cake[a+2];
		}
		for(a=0;a<dd*2;a+=2){
			int b,c,dd;
			string s;
			string ss;
			cin >> s >> ss >> dd;
			b=root(s);
			c=root(ss);
			es.push_back(edge(b,c,dd*k));
			es.push_back(edge(c,b,dd*k));
		}
		path(0);
		cout << d[1] << endl;
	}
	return 0;
}

Compiler output:
a.cc:4:9: fatal error: stdlib: No such file or directory
    4 | #include<stdlib>
      |         ^~~~~~~~
compilation terminated.
Language: Java



import java.util.Scanner;

public class main{
	static String term = new String();
	static char t[][];
	static int n;
	
	
	static boolean bt(int m,int cnt){
		if(cnt == n-1) {
			if(t[0][0] == t[m][1]) return true;
			else return false;
		}
		for(int i=0; i<n; i++){
			if(i != m && t[m][1] == t[i][0]){
				if(bt(i,cnt+1)) return true;
			}
		}
		return false;
	}
	
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			n = sc.nextInt();
			if(n == 0) break;
			t = new char[n][2];
			for(int i=0; i<n; i++){
				term = sc.next(); 
				int last = term.length() - 1;
				t[i][0] = term.charAt(0);
				t[i][1] = term.charAt(last);
			}
			if(bt(0,0)) System.out.println("OK");
			else System.out.println("NG");
		
		}
	}
}

Compiler output:
Main.java:5: error: class main is public, should be declared in a file named main.java
public class main{
       ^
1 error
Language: Java

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	
	void run() {

		Scanner in = new Scanner(System.in);

		while(true) {

			int N = Integer.parseInt(in.next());
			
			if (N == 0) break;
			
			List<String> wordList = new ArrayList<String>();
			
			for(int i = 0; i < N; i++) {
				String word = in.next();
				wordList.add(word.substring(0, 1));
				wordList.add(word.substring(word.length() - 1, word.length()));
			}
			
			Collections.sort(wordList);
			
			if(check(wordList)) {
				System.out.println("OK");
			} else {
				System.out.println("NG");
			}
		}
	}
	
	boolean check(List<String> wordList) {
		
		int count = 1;
		String word1 = wordList.get(0);
		for(int i = 1; i < wordList.size(); i++) {
			String word2 = wordList.get(i);
			if(word1.equals(word2)) { 
				count++; 
			} else {
				if(count == 2 || count % 2 != 0) return false;
				word1 = word2;
				count = 1;
			}
		}
		return true;
	}

	public static void main(String[] args) {
		new Main.run();
	}
}

Compiler output:
Main.java:54: error: cannot find symbol
		new Main.run();
		        ^
  symbol:   class run
  location: class Main
1 error
Language: Java


import java.io.*;
import java.util.*;


// 2011/10/19

//@0225 ±Ô½Ê«ÂË±
public class Main {

	// æª¶Æö¶Ìªêv
	// ·×ÄªÂÈªÁÄ¢éÅOK
	
	
	// C return falseÅ¨µÜ¢
	boolean main() throws IOException {

		int N = readIntArray()[0];
		if (N == 0) 
			return false; // ¨µÜ¢

		List<String> list = new ArrayList<String>();
		int[] cnt = new int[26]; // At@xbg26¶ªÌJE^
		int[] flag = new int[26]; // æª¶¶ÝtO At@xbg26¶ª
		
		for(int i = 0; i < N; i++) {
			String s = reader.readLine();
			list.add(s);
//			char c1 = s.charAt(0); //æª
//			char c2 = s.charAt(s.length() - 1); //ö
//			cnt[c1 - 'a']++;
//			flag[c1 - 'a'] = 1;
//			cnt[c2 - 'a']--;
		}

//		// ·×Ä0ªOK
//		boolean dame = false;
//		for(int i = 0; i < cnt.length; i++) {
//			if (cnt[i] != 0) {
//				dame = true;
//				break;
//			}
//		}
//		
//		if (!dame) {
//			// ·×ÄÂÈªÁÄ¢é©
//			String s = list.get(0);
//			char c1 = s.charAt(0); //æª
//			char c2 = s.charAt(s.length() - 1); //ö
//			flag[c1 - 'a'] = 0;
//			for(;;) {
//				boolean modify = false;
//				for(int i = 0; i < list.size(); i++) {
//					s = list.get(i);
//					c1 = s.charAt(0); //æª
//					c2 = s.charAt(s.length() - 1); //ö
//					if (flag[c1 - 'a'] == 0 && flag[c2 - 'a'] != 0) {
//						flag[c2 - 'a'] = 0;
//						modify = true;
//					}
//				}
//				if (!modify)
//					break;
//			}
//			
//			// ·×Ä0ªOK
//			for(int i = 0; i < flag.length; i++) {
//				if (flag[i] != 0) {
//					dame = true;
//					break;
//				}
//			}
//		}
				
		// ðÌ\¦
		System.out.printf("%s\n", dame ? "NG" : "OK");
		
		return true; // ³íI¹ Ö
	}
	

//	private final static boolean DEBUG = true;  // debug
	private final static boolean DEBUG = false; // release

	public static void main(String[] args) throws IOException {

		if (DEBUG) {
			log = System.out;
			
//			String inputStr = "7\nae\nyw\nga\nkg\nel\nwk\nly\n" + "0\n";
			String inputStr = "7\nab\nbc\nca\nde\nef\nfg\ngd\n" + "0\n";

			reader = new BufferedReader(new StringReader(inputStr)); 

		}
		else {
			log = new PrintStream(new OutputStream() { public void write(int b) {} } ); // «ÌÄ
			reader = new BufferedReader(new InputStreamReader(System.in)); // R\[©ç
		}
		
		//int N = readIntArray()[0];

		for(int i = 0; /*i < N*/; i++) {
			boolean b = new Main().main();
			if (!b)
				break;
		}		
		
		reader.close();
	}

	
	static PrintStream log;
	static BufferedReader reader;
	

	// WüÍæè1sªÌXy[XæØèÌ®lðÇÞ
	// EOFÌêÍnullðÔ·
	private static int[] readIntArray() throws IOException {
		
		String s = reader.readLine();
		if (s == null)
			return null;
		String[] sp = s.split(" ");
		int[] a = new int[sp.length];
		for(int i = 0; i < sp.length; i++) {
			a[i] = Integer.parseInt(sp[i]);
		}
		return a;
	}
		
}

Compiler output:
Main.java:76: error: cannot find symbol
		System.out.printf("%s\n", dame ? "NG" : "OK");
		                          ^
  symbol:   variable dame
  location: class Main
1 error
Language: C++

#include <iostream>
#include <string>
#include <utility>
#include <stack>
using namespace std;

bool check(pair<char,char>* words, int num);

int main() {
  int num;
  char buf[33];
  pair<char,char> words[10000];

  while(true) {
    cin >> num;
    if(!num)
      break;

    for(int i=0; i<num; i++) {
      cin >> buf;
      words[i].first = buf[0];
      words[i].second = buf[strlen(buf)-1];
    }

    if(check(words,num))
      cout << "OK" << endl;
    else
      cout << "NG" << endl;
  }
  return 0;
}

bool check(pair<char,char>* words, int num) {
  stack<int> searchStack;
  bool used[10000];
  for(int i=0; i<num; i++) used[i]=false;

  searchStack.push(0);
  searchStack.pop();
  searchStack.push(0);
  used[0] = true;
  int searchPos = 0;

  while(!searchStack.empty()) {
    for(int i=searchPos; i<num; i++) {
      if(words[searchStack.top()].second == words[i].first && !used[i]) {
        searchStack.push(i);
        used[i] = true;
        searchPos = 0;
        break;
      } else if(i==num-1) {
        searchPos = searchStack.top()+1;
        used[searchStack.top()] = false;
        searchStack.pop();
        break;
      }
    }

    if(searchPos >= num) {
      searchPos = searchStack.top() + 1;
      used[searchStack.top()] = false;
      searchStack.pop();
    }

    if(searchStack.size() == num) {
      if(words[searchStack.top()].second == words[0].first) {
        return true;
      } else {
        searchPos = searchStack.top() + 1;
        used[searchStack.top()] = false;
        searchStack.pop();
      }
    }

  }
  return false;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:29: error: 'strlen' was not declared in this scope
   22 |       words[i].second = buf[strlen(buf)-1];
      |                             ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <stack>
  +++ |+#include <cstring>
    5 | using namespace std;