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

#include <iostream>

using namespace std;

int f[21][21];

int main() {
  int n;
  while (cin >> n, n) {
    memset(f, 0, sizeof(f));

    for (int i=0; i<n; i++) {
      int x, y;
      cin >> x >> y;
      f[y][x] = 1;
    }

    int x=10, y=10;
    int cnt = 0;

    int m;
    cin >> m;
    for (int i=0; i<m; i++) {
      char dir;
      int step;
      cin >> dir >> step;
      while (step--) {
        if (dir == 'N') { y++; }
        else if (dir == 'S') { y--; }
        else if (dir == 'E') { x++; }
        else { x--; }

        if (f[y][x]) {
          f[y][x] = 0;
          cnt++;
        }
      }
    }

    if (cnt == n) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'memset' was not declared in this scope
   10 |     memset(f, 0, sizeof(f));
      |     ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 |
Language: C++

#include <iostream>

using namespace std;

int f[21][21];

int main() {
	int n;
	while (cin >> n, n) {
		memset(f, 0, sizeof(f));

		for (int i = 0; i<n; i++) {
			int x, y;
			cin >> x >> y;
			f[y][x] = 1;
		}

		int x = 10, y = 10;

		int m;
		cin >> m;
		for (int i = 0; i<m; i++) {
			char dir;
			int step;
			cin >> dir >> step;
			while (step--) {
				if (dir == 'N') { y++; }
				else if (dir == 'S') { y--; }
				else if (dir == 'E') { x++; }
				else { x--; }
				f[y][x] = 0;
			}
		}

		bool yes = true;
		for (int y = 0; y <= 20; y++) {
			for (int x = 0; x <= 20; x++) {
				if (f[y][x]) {
					yes = false;
					goto ANSWER;
				}
			}
		}
	ANSWER:
		if (yes) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'memset' was not declared in this scope
   10 |                 memset(f, 0, sizeof(f));
      |                 ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 |
Language: C++

#include <iostream>

using namespace std;

int f[21][21];

int main() {
	int n;
	while (cin >> n, n) {
		memset(f, 0, sizeof(f));

		for (int i = 0; i<n; i++) {
			int x, y;
			cin >> x >> y;
			f[y][x] = 1;
		}

		int x = 10, y = 10;

		int m;
		cin >> m;
		for (int i = 0; i<m; i++) {
			char dir;
			int step;
			cin >> dir >> step;
			while (step--) {
				if (dir == 'N') { y++; }
				else if (dir == 'S') { y--; }
				else if (dir == 'E') { x++; }
				else { x--; }
				f[y][x] = 0;
			}
		}

		bool yes = true;
		for (int y = 0; y <= 20; y++) {
			for (int x = 0; x <= 20; x++) {
				if (f[y][x]) {
					yes = false;
					goto ANSWER;
				}
			}
		}
	ANSWER:
		if (yes) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'memset' was not declared in this scope
   10 |                 memset(f, 0, sizeof(f));
      |                 ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 |
Language: C++

#include<iostream>
using namespace std;
int main() {
	int a[21][21] = {};
	int n;
	int x, y;
	while (cin >> n&&n != 0) {
		for (int i = 0; i < n; i++) {
			cin >> y >> x;
			a[y][x] = 1;
		}
		int m;
		x = 10, y = 10;
		int count = 0;
		int num;
		char c;
		cin>>m;
		for (m--) {
			cin >> c >> num;
			for (int i = 0; i < num; i++) {
				if (c == 'N')y++;
				else if (c == 'E')x++;;
				else if (c == 'S')y--;
				else x--;
				if (a[y][x]) {
					count++;
					a[y][x] = 0;
				}
			}

		}
		if (count == n)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: expected ';' before ')' token
   18 |                 for (m--) {
      |                         ^
      |                         ;
a.cc:32:17: error: expected primary-expression before 'if'
   32 |                 if (count == n)cout << "YES" << endl;
      |                 ^~
a.cc:31:18: error: expected ';' before 'if'
   31 |                 }
      |                  ^
      |                  ;
   32 |                 if (count == n)cout << "YES" << endl;
      |                 ~~
a.cc:32:17: error: expected primary-expression before 'if'
   32 |                 if (count == n)cout << "YES" << endl;
      |                 ^~
a.cc:31:18: error: expected ')' before 'if'
   31 |                 }
      |                  ^
      |                  )
   32 |                 if (count == n)cout << "YES" << endl;
      |                 ~~
a.cc:18:21: note: to match this '('
   18 |                 for (m--) {
      |                     ^
Language: C++

while 1:
    find = False
    r_pos = [9,9]
    n = int(raw_input())
    if n == 0: break
    planet = [[0 for j in xrange(20)] for i in xrange(20)]
    for i in xrange(n):
        x,y = map(int, raw_input().split())
        planet[y-1][x-1] = 1
    m = int(raw_input())
    for i in xrange(m):
        d,l = raw_input().split()
        l = int(l)
        if d == 'N':
            for j in xrange(r_pos[0], r_pos[0]+l+1):
                planet[j][r_pos[1]] = 0
            r_pos[0] += l
            #print r_pos
        elif d == 'S':
            for j in xrange(r_pos[0], r_pos[0]-l-1):
                planet[j][r_pos[1]] = 0
            r_pos[0] -= l
            #print r_pos
        elif d == 'E':
            for j in xrange(r_pos[1], r_pos[1]+l+1):
                planet[r_pos[0]][j] = 0
            r_pos[1] += l
            #print r_pos
        elif d == 'W':
            for j in xrange(r_pos[1], r_pos[1]-l-1):
                planet[r_pos[0]][j] = 0
            r_pos[1] -= l
            #print r_pos
    for i in xrange(20):
        for j in xrange(20):
            if planet[j][i] == 1:
                find = True
    if find is True: print 'NO'
    else: print 'YES'

Compiler output:
a.cc:18:14: error: invalid preprocessing directive #print
   18 |             #print r_pos
      |              ^~~~~
a.cc:23:14: error: invalid preprocessing directive #print
   23 |             #print r_pos
      |              ^~~~~
a.cc:28:14: error: invalid preprocessing directive #print
   28 |             #print r_pos
      |              ^~~~~
a.cc:33:14: error: invalid preprocessing directive #print
   33 |             #print r_pos
      |              ^~~~~
a.cc:38:28: warning: multi-character character constant [-Wmultichar]
   38 |     if find is True: print 'NO'
      |                            ^~~~
a.cc:39:17: warning: multi-character character constant [-Wmultichar]
   39 |     else: print 'YES'
      |                 ^~~~~
a.cc:1:1: error: expected unqualified-id before 'while'
    1 | while 1:
      | ^~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <complex>
using namespace std;

#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) REP(i, 0, n)

#define MAX 21
int brd[MAX][MAX];

int N;

int dx[] = { 0, 0, 1, -1 }; // N S E W
int dy[] = { 1, -1, 0, 0 };
int direc[128];

int main()
{
	direc['N'] = 0;
	direc['S'] = 1;
	direc['E'] = 2;
	direc['W'] = 3;
	while (cin >> N, N) {
		memset(brd, 0, sizeof(brd));
		rep(i, N) {
			int x, y;
			cin >> x >> y;
			brd[y][x] = 1;
		}

		int step;
		cin >> step;
		int x = 10, y = 10;	
		rep(t, step) {
			char d;	int s;
			cin >> d >> s;
			while (s--) {
				x += dx[direc[d]];
				y += dy[direc[d]];
				brd[y][x] = 0;
			}
		}

		int cnt = 0;
		rep(j, MAX) rep(i, MAX)	if (brd[j][i]) cnt++;
		cout << (cnt?"No":"Yes") << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: 'memset' was not declared in this scope
   28 |                 memset(brd, 0, sizeof(brd));
      |                 ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <complex>
  +++ |+#include <cstring>
    7 | using namespace std;
Language: C++

#include<iostream>
using namespace std;

int n,m;
const char vec[4]={'N','E','W','S'};
const int   dx[4]={ 0 , 1 ,-1 , 0 };
const int   dy[4]={ 1 , 0 , 0 , -1};
int gx[20],gy[20];
char v; int vn;

int main()
{
	while(cin>>n,n)
	{
		for(int i=0;i<n;i++)
		{
			cin>>gx[i]>>gy[i];
		}

		cin>>m;
		int sx=10,sy=10,gnum=0;
		bool flag[20]; memset(flag,false,sizeof flag);
		for(int i=0;i<m;i++)
		{
			cin>>v>>vn;
			int cnt;
			for(int j=0;j<4;j++)
			{
				if(vec[j]==v) {cnt=j; break;}
			}

			while(vn--)
			{
				sx+=dx[cnt];sy+=dy[cnt];
				for(int j=0;j<n;j++)
				{
					if(sx==gx[j]&&sy==gy[j]&&!flag[j])
					{
						gnum++;
						flag[j]=true;
					}
				}
			}
		}
		cout<<(gnum==n?"Yes":"No")<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:32: error: 'memset' was not declared in this scope
   22 |                 bool flag[20]; memset(flag,false,sizeof flag);
      |                                ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		int[][] field = new int[21][21];
		Scanner sc = new Scanner(System.in);
		while(true){
			int nowx = 10;
			int nowy = 10;
			for(int i=0;i<21;i++){
				for(int j=0;j<21;j++){
					field[i][j] = 0;
				}
			}
			int n = sc.nextInt();
			if(n == 0) break;
			for(int i=0;i<n;i++){
				int x = sc.nextInt();
				int y = sc.nextInt();
				field[x][y] = 1;
			}
			int m = sc.nextInt();
			for(int i=0;i<m;i++){
				String h = sc.next();
				int l = sc.nextInt();
				switch(h){
				case "N":
					for(int j=0;j<l;j++){
						nowy++;
						if(field[nowx][nowy] == 1){
							n--;
							field[nowx][nowy] = 0;
						}
					}
					break;
				case "S":
					for(int j=0;j<l;j++){
						nowy--;
						if(field[nowx][nowy] == 1){
							n--;
							field[nowx][nowy] = 0;
						}
					}
					break;
				case "E":
					for(int j=0;j<l;j++){
						nowx++;
						if(field[nowx][nowy] == 1){
							n--;
							field[nowx][nowy] = 0;
						}
					}
					break;
				case "W":
					for(int j=0;j<l;j++){
						nowx--;
						if(field[nowx][nowy] == 1){
							n--;
							field[nowx][nowy] = 0;
						}
					}
					break;
				}
			}
			if(n == 0) System.out.println("Yes");
			else System.out.println("No");
		}
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: expected unqualified-id before 'public'
    2 | public class Main {
      | ^~~~~~
Language: C++

#include<stdio.h>
int main(void)
{
  int n,i,m,j,k,robo,robox,roboy,sum;
  char news;
  robox=10;
  roboy=10;
  for(;;)
    {
      scanf("%d",&n);
      if(n==0){break;}
      int x[n],y[n],xy[n];
      for(i=0;i<n;i++){xy[i]=0;}
      sum=0;
      for(i=0;i<n;i++){scanf("%d %d",&x[i],&y[i]);}
      scanf("%d",&m);
      for(i=0;i<m;i++)
	{
	  scanf(" %c %d",&news,&robo);
	  for(k=0;k<robo;k++)
	    {
	    if(news=='N'){roboy=roboy+1;}
	    if(news=='W'){robox=robox-1;}
	    if(news=='S'){roboy=roboy-1;}
	    if(news=='E'){robox=robox+1}
	    for(j=0;j<n;j++){if(x[j]==robox && y[j]==roboy){xy[j]=1}}
	    }
	}
      for(j=0;j<n;j++){sum=sum+xy[j];}
      if(sum==n){printf("Yes\n");}
      else{printf("No\n");}
    }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:40: error: expected ';' before '}' token
   25 |             if(news=='E'){robox=robox+1}
      |                                        ^
      |                                        ;
a.cc:26:68: error: expected ';' before '}' token
   26 |             for(j=0;j<n;j++){if(x[j]==robox && y[j]==roboy){xy[j]=1}}
      |                                                                    ^
      |                                                                    ;
Language: C++

#include<stdio.h>
int main(void)
{
  int n,i,m,j,k,robo,robox,roboy,sum;
  char news;
  robox=10;
  roboy=10;
  for(;;)
    {
      scanf("%d",&n);
      if(n==0){break;}
      int x[n],y[n],xy[n];
      for(i=0;i<n;i++){xy[i]=0;}
      sum=0;
      for(i=0;i<n;i++){scanf("%d %d",&x[i],&y[i]);}
      scanf("%d",&m);
      for(i=0;i<m;i++)
	{
	  scanf(" %c %d",&news,&robo);
	  for(k=0;k<robo;k++)
	    {
	    if(news=='N'){roboy=roboy+1;}
	    if(news=='W'){robox=robox-1;}
	    if(news=='S'){roboy=roboy-1;}
	    if(news=='E'){robox=robox+1;}
	    for(j=0;j<n;j++){if(x[j]==robox)
		{
		  if(y[j]==roboy)
		    {
		    xy[j]=1;
		    }
		}
	    }
	}
      for(j=0;j<n;j++){sum=sum+xy[j];}
      if(sum==n){printf("Yes\n");}
      else{printf("No\n");}
    }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:2: error: expected '}' at end of input
   40 | }
      |  ^
a.cc:3:1: note: to match this '{'
    3 | {
      | ^
Language: C++

#include<stdio.h>
int main(void)
{
  int n,i,m,j,k,robo,robox,roboy,sum;
  char news;
  robox=10;
  roboy=10;
  for(;;)
    {
      scanf("%d",&n);
      if(n==0){break;}
      int x[n],y[n],xy[n];
      for(i=0;i<n;i++){xy[i]=0;}
      sum=0;
      for(i=0;i<n;i++){scanf("%d %d",&x[i],&y[i]);}
      scanf("%d",&m);
      for(i=0;i<m;i++)
	{
	  scanf("%c %d",&news,&robo);
	  for(k=0;k<robo;k++)
	    {
	    if(news=='N'){roboy=roboy+1;}
	    if(news=='W'){robox=robox-1;}
	    if(news=='S'){roboy=roboy-1;}
	    if(news=='E'){robox=robox+1;}
	    for(j=0;j<n;j++){if(x[j]==robox && y[j]==robo){xy[j]=1;}}
	    }
      for(j=0;j<n;j++){sum=sum+xy[j];}
      if(sum==n){printf("Yes\n");}
      else{printf("No\n");}
	}
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:3:1: note: to match this '{'
    3 | {
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
#include <string>
#include <cstdlib>
#include <cstdio>
using namespace std;


int d[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
char dc[4] = "NESW";
char Map[25][25];

main(){
	int x,y,n,m,i,j;
	while(cin >> n, n){
		int sx, sy;
		for(i=0;i<=20;i++)
			for(j=0;j<=20;j++)
				Map[i][j] = 0;
		for(i=0;i<n;i++){
			cin >> x >> y;
			Map[x][y] = 1;
		}
		cin >> m;
		int ans = 0;
		x=10;y=10;
		for(j=0;j<m;j++){
			char c;
			int t;
			cin >> c >> t;
			int dt;
			for(i=0;i<4;i++) if(c == dc[i]) dt=i;
			for(i=0;i<t;i++){
				x += d[dt][0];
				y += d[dt][1];
				if(Map[x][y]){
					ans ++;
					Map[x][y] = 0;
				}
			}
		}
		cout << (ans == n ? "Yes":"No") << endl;
	}
	return 0;
}

Compiler output:
a.cc:13:14: error: initializer-string for 'char [4]' is too long [-fpermissive]
   13 | char dc[4] = "NESW";
      |              ^~~~~~
a.cc:16:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   16 | main(){
      | ^~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int grid[21][21];

void init(){
  int nowx = 10,nowy = 10;
  for(int i = 0 ; i <= 20 ; i++ ){
    for(int j = 0 ; j <= 20 ; j++ ){
      grid[j][i] = 0;
    }
  }
}

void serch(int a,int b,int f){
  if(a > b)swap(a,b);
  cout << a << ' ' << b << endl; 
  if(f == 1){
    for(int i = a ; i <= b ; i++ )grid[nowx][i] = 0;
  }else {
    for(int i = a ; i <= b ; i++ )grid[i][nowy] = 0;
  }
}

bool check(){
  bool flag = true; 
  for(int i = 0 ; i <= 20 ; i++ ){
    for(int j = 0 ; j <= 20 ; j++ ){
      if(grid[j][i] == 1){flag = false;goto N;}
    }
  }
 N:;
  if(flag)return true;
  else return false;
}

int main(){
  int n;
  while( cin >> n,n ){
    init();
    for(int i = 0 ; i < n ; i++ ){
      int x,y;
      cin >> x >> y;
      grid[x][y] = 1;
    }
    cin >> n;
    for(int i = 0 ; i < n ; i++ ){
      char c;
      int move,f = 0,past;
      cin >> c >> move;
      if(c == 'N'){
	f = 1;
	past = nowy;
	nowy+=move;
      }else if(c == 'S'){
	f = 1;
	past = nowy;
	nowy-=move;
      }else if(c == 'E'){
	past = nowx;
	nowx+=move;
      } else {
	past = nowx;
	nowx-=move;
      }
      if(f == 0)serch(past,nowx,f);
      else serch(past,nowy,f);
    }
    if( check() )cout << "Yes" << endl;
    else cout << "No" << endl; 
  }
  return 0;
}

Compiler output:
a.cc: In function 'void serch(int, int, int)':
a.cc:19:40: error: 'nowx' was not declared in this scope
   19 |     for(int i = a ; i <= b ; i++ )grid[nowx][i] = 0;
      |                                        ^~~~
a.cc:21:43: error: 'nowy' was not declared in this scope
   21 |     for(int i = a ; i <= b ; i++ )grid[i][nowy] = 0;
      |                                           ^~~~
a.cc: In function 'int main()':
a.cc:53:16: error: 'nowy' was not declared in this scope
   53 |         past = nowy;
      |                ^~~~
a.cc:57:16: error: 'nowy' was not declared in this scope
   57 |         past = nowy;
      |                ^~~~
a.cc:60:16: error: 'nowx' was not declared in this scope
   60 |         past = nowx;
      |                ^~~~
a.cc:63:16: error: 'nowx' was not declared in this scope
   63 |         past = nowx;
      |                ^~~~
a.cc:66:28: error: 'nowx' was not declared in this scope
   66 |       if(f == 0)serch(past,nowx,f);
      |                            ^~~~
a.cc:67:23: error: 'nowy' was not declared in this scope
   67 |       else serch(past,nowy,f);
      |                       ^~~~
Language: C++

#include <iostream>
using namespace std;
int main() {
    int N;
    while (cin >> N && N != 0) {
        int dia[21][21];
        memset(dia, 0, sizeof dia);

        int x, y;
        for (int i=0; i<N; ++i) {
            cin >> x >> y;
            dia[y][x] = 1;
        }

        int trace[21][21];
        memset(trace, 0, sizeof trace);

        int nx = 10; int ny = 10;

        int M; cin >> M;

        int dx[256], dy[256];
        dx['N'] = 0; dx['E'] = 1; dx['W'] = -1; dx['S'] = 0; 
        dy['N'] = 1; dy['E'] = 0; dy['W'] = 0;  dy['S'] = -1;

        for (int i=0; i<M; ++i) {
            trace[ny][nx] = 1;

            char d; cin >> d;
            int l; cin >> l;
            for (int j=0; j<l; ++j) {
                nx += dx[d];
                ny += dy[d];
                trace[ny][nx] = 1;
            }
        }

        string output = "Yes";
        for (int i=0; i<21; ++i) {
            for (int j=0; j<21; ++j) {
                if (dia[i][j] == 1 && trace[i][j] != 1) {
                    output = "No";
                }
            }
        }

        cout << output << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'memset' was not declared in this scope
    7 |         memset(dia, 0, sizeof dia);
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include <iostream>
#include <memory>
using namespace std;
int main() {
    int N;
    while (cin >> N && N != 0) {
        int gems[21][21]; // 宝石の位置を記録する配列
        memset(gems, 0, sizeof gems);

        int x, y;
        for (int i=0; i<N; ++i) {
            cin >> x >> y;
            gems[y][x] = 1;
        }

        int trace[21][21]; // 回収範囲を記録する配列
        memset(trace, 0, sizeof trace);

        int nx = 10; int ny = 10; // 初期位置

        int M; cin >> M;

        int dx[256], dy[256];
        dx['N'] = 0; dx['E'] = 1; dx['W'] = -1; dx['S'] = 0; 
        dy['N'] = 1; dy['E'] = 0; dy['W'] = 0;  dy['S'] = -1;

        for (int i=0; i<M; ++i) {
            trace[ny][nx] = 1;

            char d; cin >> d;
            int l; cin >> l;
            for (int j=0; j<l; ++j) {
                nx += dx[d];
                ny += dy[d];
                trace[ny][nx] = 1;
            }
        }

        string output = "Yes";
        for (int i=0; i<21; ++i) {
            for (int j=0; j<21; ++j) {
                if (gems[i][j] == 1 && trace[i][j] != 1) {
                    output = "No";
                }
            }
        }

        cout << output << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'memset' was not declared in this scope
    8 |         memset(gems, 0, sizeof gems);
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <memory>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

include <iostream>
using namespace std;

int N, M, cnt = 0;
int Map[21][21];

struct Position{
	int x;
	int y;
}robot;

void initMap(void){
	int i, j;
	for(i = 0; i < 21; i++){
		for(j = 0; j < 21; j++){
			Map[i][j] = 0;
		}
	}
}

void setGems(int x, int y){
	Map[x][y] = 1;
}

int main(){
	int x, y, step;
	char dir;
	while(true){
		initMap();
		cnt = 0;
		robot.x = 10; robot.y = 10;
		cin >> N;
		if(N == 0)	break;
		for(int i = 0; i < N; i++){
			cin >> x >> y;
			setGems(x, y);
		}
		//------------Print Map------------
		//for(int i = 20; i >= 0; i--){
		//	for(int j = 0; j < 21; j++){
		//		cout << Map[j][i];
		//	}
		//	cout << endl;
		//}
		cin >> M;
		for(int i = 0; i < M; i++){
			cin >> dir >> step;
			switch(dir){
				case 'N':
					for(int i = 0; i < step; i++){
						robot.y++;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				case 'E':
					for(int i = 0; i < step; i++){
						robot.x++;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				case 'S':
					for(int i = 0; i < step; i++){
						robot.y--;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				case 'W':
					for(int i = 0; i < step; i++){
						robot.x--;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				default:
					break;

			}
		}
		if(cnt == N){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;	
		}
	}
	return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:32:17: error: 'cin' was not declared in this scope
   32 |                 cin >> N;
      |                 ^~~
a.cc:79:25: error: 'cout' was not declared in this scope
   79 |                         cout << "Yes" << endl;
      |                         ^~~~
a.cc:79:42: error: 'endl' was not declared in this scope
   79 |                         cout << "Yes" << endl;
      |                                          ^~~~
a.cc:81:25: error: 'cout' was not declared in this scope
   81 |                         cout << "No" << endl;
      |                         ^~~~
a.cc:81:41: error: 'endl' was not declared in this scope
   81 |                         cout << "No" << endl;
      |                                         ^~~~
Language: Java

import java.util.ArrayList;
import java.util.List;

/**
 * @author ando
 *
 */
public class P2001 {
	
	public static void main(String[] args) {
		int now = 1;
		List<Line> l = new ArrayList<>();
		for(String line : args[0].split("\n")) l.add(new Line(line.split(" ")));
		l.remove(0);
		java.util.Collections.sort(l);
		for(Line ll : l) now = ll.transit(now);
		System.out.println(now);
		//System.out.println(args[0]);
	}
}

public class Line implements Comparable<Line> {
	int hight;
	int left;
	int right;
	
	public Line(String[] lines) {
		hight = Integer.valueOf(lines[0]);
		left = Integer.valueOf(lines[1]);
		right = Integer.valueOf(lines[2]);
	}
	
	public int transit(int now) {
		if(now == left) return right;
		else if(now == right) return left;
		return now;
	}
	
	@Override
	public int compareTo(Line o) {
		if(this.hight == o.hight) return 0;
		if(this.hight < o.hight) return 1;
		return -1;
	}
}

Compiler output:
Main.java:8: error: class P2001 is public, should be declared in a file named P2001.java
public class P2001 {
       ^
Main.java:22: error: class Line is public, should be declared in a file named Line.java
public class Line implements Comparable<Line> {
       ^
2 errors
Language: Java

import java.util.ArrayList;
import java.util.List;

public class Line implements Comparable<Line> {
	int hight;
	int left;
	int right;
	
	public Line(String[] lines) {
		hight = Integer.valueOf(lines[0]);
		left = Integer.valueOf(lines[1]);
		right = Integer.valueOf(lines[2]);
	}
	
	public int transit(int now) {
		if(now == left) return right;
		else if(now == right) return left;
		return now;
	}
	
	@Override
	public int compareTo(Line o) {
		if(this.hight == o.hight) return 0;
		if(this.hight < o.hight) return 1;
		return -1;
	}
}

public class P2001 {
	
	public static void main(String[] args) {
		int now = 1;
		List<Line> l = new ArrayList<>();
		for(String line : args[0].split("\n")) l.add(new Line(line.split(" ")));
		l.remove(0);
		java.util.Collections.sort(l);
		for(Line ll : l) now = ll.transit(now);
		System.out.println(now);
		//System.out.println(args[0]);
	}
}

Compiler output:
Main.java:4: error: class Line is public, should be declared in a file named Line.java
public class Line implements Comparable<Line> {
       ^
Main.java:29: error: class P2001 is public, should be declared in a file named P2001.java
public class P2001 {
       ^
2 errors
Language: Java

import java.util.ArrayList;
import java.util.List;

public class Line implements Comparable<Line> {
	int hight;
	int left;
	int right;
	
	public Line(String[] lines) {
		hight = Integer.valueOf(lines[0]);
		left = Integer.valueOf(lines[1]);
		right = Integer.valueOf(lines[2]);
	}
	
	public int transit(int now) {
		if(now == left) return right;
		else if(now == right) return left;
		return now;
	}
	
	@Override
	public int compareTo(Line o) {
		if(this.hight == o.hight) return 0;
		else if(this.hight < o.hight) return 1;
		return -1;
	}
}

public class P2001 {
	
	public static void main(String[] args) {
		int now = 1;
		List<Line> l = new ArrayList<Line>();
		for(String line : args[0].split("\n")) l.add(new Line(line.split(" ")));
		l.remove(0);
		java.util.Collections.sort(l);
		for(Line ll : l) now = ll.transit(now);
		System.out.println(now);
		//System.out.println(args[0]);
	}
}

Compiler output:
Main.java:4: error: class Line is public, should be declared in a file named Line.java
public class Line implements Comparable<Line> {
       ^
Main.java:29: error: class P2001 is public, should be declared in a file named P2001.java
public class P2001 {
       ^
2 errors
Language: Java

import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args) {
		int now = 1;
		int h = -1;
		List<Line> l = new ArrayList<Line>();
		for(String line : args)) {
			l.add(new Line(line.split("\\s")));
		}
		l.remove(0);
		java.util.Collections.sort(l);
		for(Line ll : l) {
			if(h == -1 || ll.hight < h) h = ll.hight;
			now = ll.transit(now);
			if(h == 0) break;
		}
		System.out.println(now);
	}
}

class Line implements Comparable<Line> {
	int hight;
	int left;
	int right;
	
	public Line(String[] lines) {
		hight = Integer.valueOf(lines[0]);
		left = Integer.valueOf(lines[1]);
		right = Integer.valueOf(lines[2]);
	}
	
	public int transit(int now) {
		if(now == left) return right;
		else if(now == right) return left;
		return now;
	}
	
	@Override
	public int compareTo(Line o) {
		return o.hight - this.hight;
	}
}

Compiler output:
Main.java:9: error: illegal start of expression
		for(String line : args)) {
		                       ^
1 error
Language: Java

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;

public class Main {
    public static void main(String[] args) throws IOException {
	ReadableByteChannel in = Channels.newChannel(System.in);
	ByteBuffer buf = ByteBuffer.allocate(1000000);
	buf.clear();
	in.read(buf);
	buf.flip();
	int n, m, a;
	while ((n = get(buf)) != 0) {
	    m = get(buf);
	    a = get(buf);
	    int max = 0;
	    int[][] amida = new int[1000][n + 1];
	    for (int i = 0; i < m; i++) {
		int h = get(buf) - 1;
		int p = get(buf);
		int q = get(buf);
		amida[h][p] = q;
		amida[h][q] = p;
		max = Math.max(h, max);
	    }
	    for (int h = max; h >= 0; h--) {
		if (amida[h][a] != 0) {
		    a = amida[h][a];
		}
	    }
	    System.out.println(a);
	}
	in.close();
    }

    private static int get(ByteBuffer buf) {
	int i = buf.get();
	while (i < '0' || '9' < i) {
	    i = buf.get();
	}
	int res = 0;
	while ('0' <= i && i <= '9') {
	    res = res * 10 + (i - '0');
	    i = buf.get();
	}
	return res;
    }

Compiler output:
Main.java:48: error: reached end of file while parsing
    }
     ^
1 error
Language: Java

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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		while (true) {
			String line = sc.readLine();
			String[] lineAry = line.split(" ");
			int n = Integer.parseInt(lineAry[0]);
			int m = Integer.parseInt(lineAry[1])
			int a = Integer.parseInt(lineAry[2]);
			List<CrossBar> crbar = new ArrayList<>();
			if (n == 0 && m == 0 && a == 0) {
				return;
			}
			for (int i = 0; i < m; i++) {
				line = sc.readLine();
				lineAry = line.split(" ");
				crbar.add(new CrossBar(Integer.parseInt(lineAry[0]), Integer.parseInt(lineAry[1]),
						Integer.parseInt(lineAry[2])));
			}
			
			MyPoint mypoint = new MyPoint(a, 1002);

			while (mypoint.y > 0) {
				mypoint.y--;
				for (int k = 0; k < m; k++) {
					if (crbar.get(k).y == mypoint.y && crbar.get(k).x1 == mypoint.x) {
						mypoint.setPoint(crbar.get(k).x2, mypoint.y);
						break;
					}
					if (crbar.get(k).y == mypoint.y && crbar.get(k).x2 == mypoint.x) {
						mypoint.setPoint(crbar.get(k).x1, mypoint.y);
						break;
					}
				}
			}
			System.out.println(mypoint.x);
		}
	}

	static class MyPoint {

		private int x = 0;
		private int y = 0;

		public MyPoint(int x_val, int y_val) {
			x = x_val;
			y = y_val;
		}

		public void setPoint(int x_val, int y_val) {
			x = x_val;
			y = y_val;
		}

	}

	static class CrossBar implements Comparable<Object> {

		private int x1 = 0;
		private int x2 = 0;
		private int y = 0;

		public CrossBar(int h, int p, int q) {
			y = h;
			x1 = p;
			x2 = q;
		}

		public int compareTo(Object obj) {
			return Integer.toString(((CrossBar) obj).y).compareTo(Integer.toString(this.y));
		}
	}

}

Compiler output:
Main.java:12: error: ';' expected
			int m = Integer.parseInt(lineAry[1])
			                                    ^
1 error
Language: Java

import java.util.Scanner;

public class amida {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next()); // ???
		int m = Integer.parseInt(sc.next()); // ?¨?????????°
		int a = Integer.parseInt(sc.next()); // ???????????????
		int maxY = 0;

		int[][] map = new int[n][1000];

		for (int i = 0; i < m + 1; i++) {
			int p = Integer.parseInt(sc.next()); // ???
			int q = Integer.parseInt(sc.next()) - 1; // ?¨?????????°
			int r = Integer.parseInt(sc.next()) - 1; // ???????????????
			if(p==0){
				break;
			}
			map[q][1000 - p] = q + 1;
			map[q + 1][1000 - p] = q;
		}
		int x = a;
		int y = 0;
		while (y < 1000) {
			if (map[x][y] != 0) {
				x = x + 1;
			}
			y++;
		}

		System.out.println(x + 1);

	}
}

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

import java.util.Scanner;


public class Amida {
	
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		while(true){
			
			int n = sc.nextInt();
			int m = sc.nextInt();
			int a = sc.nextInt();
			
			int h[] = new int[m];
			int p[] = new int[m];
			int q[] = new int[m];
			int max = 0;
			
			for(int i = 0; i < m; i++){
				h[i] = sc.nextInt();
				p[i] = sc.nextInt();
				q[i] = sc.nextInt();
				if(h[i] > max){
					max = h[i];
				}
			}
			
			int map[][] = new int[n + 1][max + 1];
			
			for(int i = 0; i < n + 1; i++){
				for(int j = 0; j < max + 1; j++){
					map[i][j] = 0;
				}
			}
			
			for(int i = 0; i < m; i++){
				map[p[i]][h[i]] = q[i];
				map[q[i]][h[i]] = p[i];
			}
			
			int nowLocate[][] = new int[1][2];
			nowLocate[0][1] = max;
			nowLocate[0][0] = a;
			
			while(true){
				
				if(nowLocate[0][1] == 0){
					break;
				}
				if(map[nowLocate[0][0]][nowLocate[0][1]] != 0){
					nowLocate[0][0] = map[nowLocate[0][0]][nowLocate[0][1]];
				}
				nowLocate[0][1]--;
			}
			
			System.out.println(nowLocate[0][0]);
			
		}
		
	}

}

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

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main{
	static int N, D, money;
	static int[] prices;
	private static int solve(){
        int answer = 0;
        if (prices[0] * 2 > money) return 0;
        if (prices[prices.length - 1] + prices[prices.length - 2] <= money) return prices[prices.length - 1] + prices[prices.length - 2];
        for (int i = 0; i < N - 1; i++)
        {
            int index = Arrays.binarySearch(prices, i + 1, prices.length - i - 1, money - prices[i]);
            if (index > i) return prices[i] + prices[index];
            index = ~index - 1;
            if (index == i) continue;
            answer = Math.max(prices[i] + prices[index], answer);
        }
        return answer;
	}
	public static void main(String args[]){
		try{
	        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        	String[] strs = br.readLine().split(",");
    	    N = Integer.parseInt(strs[0]); D = Integer.parseInt(strs[1]);
	        prices = new int[N];
        	for (int i = 0; i < N; i++)
    	        prices[i] = Integer.parseInt(br.readLine());
	        Arrays.sort(prices);
        	for (int i = 0; i < D; i++)
    	    {
	            money = Integer.parseInt(br.readLine());
            	System.out.println(solve());
        	}
    	} catch(IOException e){}
	}
}

Compiler output:
Main.java:36: error: cannot find symbol
    	} catch(IOException e){}
    	        ^
  symbol:   class IOException
  location: class Main
1 error
Language: C

#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int n, m, a;
	int line[1024][128] = {0};
	
	while (1){
		cin >> n >> m >> a;
		
		if (!n && !m && !a){
			break;
		}
		
		for (int i = 0; i < m; i++){
			int h, p, q;
			cin >> h >> p >> q;
			
			line[h][p] = q;
			line[h][q] = p;
		}
		
		for (int i = m; i > 0; i--){
			if (line[i][a] != 0){
				a = line[i][a];
			}
		}
		
		cout << a << endl;
	}
	
	return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

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

int cmp(const void *a,const void *b){
  return *(struct data)b.h-*(struct data)a.h;
}

int main(void) {
  int i=0,tmp,d[101];
  int n,m,a;
  struct data{
    int h,p,q;
  }b[1000];
  
  while(scanf("%d%d%d",&n,&m,&a),n){
    for(i=0;i<m;i++){
     scanf("%d%d%d",&b[i].h,&b[i].p,&b[i].q);
    }
    qsort(b,m,sizeof(struct data),cmp);
    for(i=0;i<101;i++)d[i]=i;
    for(i=0;i<m;i++){
      tmp=d[b[i].p];
      d[b[i].p]=d[b[i].q];
      d[b[i].q]=tmp;
    }
    for(i=0;i<m;i++){
      if(d[i]==a){
        printf("%d\n",i);
        break
      }
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'cmp':
main.c:5:25: error: request for member 'h' in something not a structure or union
    5 |   return *(struct data)b.h-*(struct data)a.h;
      |                         ^
main.c:5:43: error: request for member 'h' in something not a structure or union
    5 |   return *(struct data)b.h-*(struct data)a.h;
      |                                           ^
main.c: In function 'main':
main.c:29:14: error: expected ';' before '}' token
   29 |         break
      |              ^
      |              ;
   30 |       }
      |       ~
Language: C

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

  struct data{
    int h,p,q;
  }b[1000];

int cmp(const void *a,const void *b){
  return *(struct data)b.h-*(struct data)a.h;
}

int main(void) {
  int i=0,tmp,d[101];
  int n,m,a;
  
  while(scanf("%d%d%d",&n,&m,&a),n){
    for(i=0;i<m;i++){
     scanf("%d%d%d",&b[i].h,&b[i].p,&b[i].q);
    }
    qsort(b,m,sizeof(struct data),cmp);
    for(i=0;i<101;i++)d[i]=i;
    for(i=0;i<m;i++){
      tmp=d[b[i].p];
      d[b[i].p]=d[b[i].q];
      d[b[i].q]=tmp;
    }
    for(i=0;i<m;i++){
      if(d[i]==a){
        printf("%d\n",i);
        break;
      }
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'cmp':
main.c:9:25: error: request for member 'h' in something not a structure or union
    9 |   return *(struct data)b.h-*(struct data)a.h;
      |                         ^
main.c:9:43: error: request for member 'h' in something not a structure or union
    9 |   return *(struct data)b.h-*(struct data)a.h;
      |                                           ^
Language: C

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

  struct data{
    int h,p,q;
  }b[1000];

int cmp(const void *a,const void *b){
  return (*(struct data)b).h-(*(struct data)a).h;
}

int main(void) {
  int i=0,tmp,d[101];
  int n,m,a;
  
  while(scanf("%d%d%d",&n,&m,&a),n){
    for(i=0;i<m;i++){
     scanf("%d%d%d",&b[i].h,&b[i].p,&b[i].q);
    }
    qsort(b,m,sizeof(struct data),cmp);
    for(i=0;i<101;i++)d[i]=i;
    for(i=0;i<m;i++){
      tmp=d[b[i].p];
      d[b[i].p]=d[b[i].q];
      d[b[i].q]=tmp;
    }
    for(i=0;i<m;i++){
      if(d[i]==a){
        printf("%d\n",i);
        break;
      }
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'cmp':
main.c:9:20: error: conversion to non-scalar type requested
    9 |   return (*(struct data)b).h-(*(struct data)a).h;
      |                    ^~~~
main.c:9:40: error: conversion to non-scalar type requested
    9 |   return (*(struct data)b).h-(*(struct data)a).h;
      |                                        ^~~~
Language: C

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

struct data{
  int h,p,q;
}b[1000];

int cmp(const void *a,const void *b){
  return (struct data *)b.h-(struct data *)a.h;
}

int main(void) {
  int i=0,tmp,d[101];
  int n,m,a;
  
  while(scanf("%d%d%d",&n,&m,&a),n){
    for(i=0;i<m;i++){
     scanf("%d%d%d",&b[i].h,&b[i].p,&b[i].q);
    }
    qsort(b,m,sizeof(struct data),cmp);
    for(i=0;i<101;i++)d[i]=i;
    for(i=0;i<m;i++){
      tmp=d[b[i].p];
      d[b[i].p]=d[b[i].q];
      d[b[i].q]=tmp;
    }
    for(i=0;i<m;i++){
      if(d[i]==a){
        printf("%d\n",i);
        break;
      }
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'cmp':
main.c:9:26: error: request for member 'h' in something not a structure or union
    9 |   return (struct data *)b.h-(struct data *)a.h;
      |                          ^
main.c:9:45: error: request for member 'h' in something not a structure or union
    9 |   return (struct data *)b.h-(struct data *)a.h;
      |                                             ^
Language: C

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

struct data{
  int h,p,q;
}b[1000];

int cmp(const void *a,const void *b){
  return (struct data *)b->h-(struct data *)a->h;
}

int main(void) {
  int i=0,tmp,d[101];
  int n,m,a;
  
  while(scanf("%d%d%d",&n,&m,&a),n){
    for(i=0;i<m;i++){
     scanf("%d%d%d",&b[i].h,&b[i].p,&b[i].q);
    }
    qsort(b,m,sizeof(struct data),cmp);
    for(i=0;i<101;i++)d[i]=i;
    for(i=0;i<m;i++){
      tmp=d[b[i].p];
      d[b[i].p]=d[b[i].q];
      d[b[i].q]=tmp;
    }
    for(i=0;i<m;i++){
      if(d[i]==a){
        printf("%d\n",i);
        break;
      }
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'cmp':
main.c:9:26: warning: dereferencing 'void *' pointer
    9 |   return (struct data *)b->h-(struct data *)a->h;
      |                          ^~
main.c:9:26: error: request for member 'h' in something not a structure or union
main.c:9:46: warning: dereferencing 'void *' pointer
    9 |   return (struct data *)b->h-(struct data *)a->h;
      |                                              ^~
main.c:9:46: error: request for member 'h' in something not a structure or union
Language: C

#include <stdio.h>



#define HEIGHT_MAX 1000
#define N_MAX 100


int main(int argc, char **argv)
{
	char input	line[14];
	int n, m, line_a;
	int height, line_p, line_q;
	int i, j;
	int roof;
	int map[N_MAX][HEIGHT_MAX];
	
	
	while( 1 ){
	roof = 0;
	for( i = 0; i < 100; i++){
		for( j = 0; j < 1000; j++)
			map[i][j] = i;
	}
	
	fgets( inputline, sizeof( inputline ), stdin );
	sscanf( inputline, "%d%d%d", &n, &m, &line_a );
	if( n == 0 && m == 0 && line_a == 0 )
		break;
	if( n > N_MAX || n < 2 ||
		m > HEIGHT_MAX || m < 0 ||
		1 > line_a || line_a > n ){
			return -1;
	}
	line_a--;
	
	for(i = 0; i < m; i++){
		fgets( inputline, sizeof( inputline ), stdin );
		sscanf( inputline, "%d%d%d", &height, &line_p, &line_q );
		if( height < 1 || height > 1000 ||
			line_p < 1 || line_p >= line_q || line_q > n ){
				return -1;
			}
		line_p--;
		line_q--;
		height--;
		if( map[line_p][height] != line_p || map[line_q][height] != line_q )
			return 1;
		else{
			map[line_p][height] = line_q;
			map[line_q][height] = line_p;
		}
		if (roof < height)
			roof = height;
	}
	
	for(i = roof; i >= 0; i-- )
		line_a = map[line_a][i];
	
	
	line_a++;
	printf("%d\n", line_a);
	
	}
	
	return 0;
	
}

Compiler output:
main.c: In function 'main':
main.c:11:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'line'
   11 |         char input      line[14];
      |                         ^~~~
main.c:11:25: error: 'line' undeclared (first use in this function)
main.c:11:25: note: each undeclared identifier is reported only once for each function it appears in
main.c:26:16: error: 'inputline' undeclared (first use in this function)
   26 |         fgets( inputline, sizeof( inputline ), stdin );
      |                ^~~~~~~~~
Language: C++

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

#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define ALL( a )        (a).begin(), (a).end()             

struct HL {
	int h;
	int p;
	int q;
};

int main() {
	while( 1 ) {
		int n, m, a; cin >> n >> m >> a;
		if( n == 0 && m == 0 && a == 0 ) break;

		int h, p, q;
		HL hl[1002] = {};

		REP( i, m ) {
			cin >> h >> p >> q;
			hl[i].h = h; hl[i].p = p; hl[i].q = q;
		}

		for( int i = 1001; i > 0; i-- ) {
			REP( j, m ) {
				if( hl[j].h == i ) {
					if( hl[j].p == a ) {
						a = hl[j].q;
						break;
					} else if( hl[j].q == a ) {
						a = hl[j].p;
						break;
					}
				}
			}
		}

		cout << a << endl;

	


Compiler output:
a.cc: In function 'int main()':
a.cc:41:35: error: expected '}' at end of input
   41 |                 cout << a << endl;
      |                                   ^
a.cc:15:20: note: to match this '{'
   15 |         while( 1 ) {
      |                    ^
a.cc:41:35: error: expected '}' at end of input
   41 |                 cout << a << endl;
      |                                   ^
a.cc:14:12: note: to match this '{'
   14 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <cstdio>

using namespace std;

int line[1024][128];

int main()
{
	int n, m, a;
	
	while (1){
		cin >> n >> m >> a;
		
		if (!n && !m && !a){
			break;
		}
		
		memset(line, 0, sizeof(line));
		
		for (int i = 0; i < m; i++){
			int h, p, q;
			cin >> h >> p >> q;
			
			line[h][p] = q;
			line[h][q] = p;
		}
		
		for (int i = m; i > 0; i--){
			if (line[i][a] != 0){
				a = line[i][a];
			}
		}
		
		cout << a << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: 'memset' was not declared in this scope
   19 |                 memset(line, 0, sizeof(line));
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <cstdio>
  +++ |+#include <cstring>
    3 |
Language: C++

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

int main(void) {
    int n, m, a, h, p, q, i;
    vector<vector<int> > bar;
    cin >> n >> m >> a;
    for (i = 0; i < m; i++) {
        cin >> h >> p >> q;
        vector<int> b;
        b.push_back(h); b.push_back(p); b.push_back(q);
        bar.push_back(b);
    }
    cin >> n >> n >> n;
    
    sort(bar.begin(), bar.end());

    h = 0;
    for (i = m - 1; i >= 0; i--) {
        if (bar[i][0] == h) continue;
        if (bar[i][1] == a) {
            a = bar[i][2];
            h = bar[i][0];
        }
        else if (bar[i][2] == a) {
            a = bar[i][1];
            h = bar[i][0];
        } 
    }
    cout << a << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |     sort(bar.begin(), bar.end());
      |     ^~~~
      |     short
Language: C++

#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
vector <int> ami[100][100];
int hi[1000];
int n,m,a,mh;


int kuji(int x,int h) {
  //cout << "start kuji()"<<endl;
  int t;
  int fl = 0;
  int i;
  // cout << "h = "<< h << endl;
  // cout << "x = " << x << endl;
  mh = -1;
  fl == 0;
  
  if(x > 0)
    for(i =0;i<ami[x][x-1].size();i++){
      if(h>= ami[x][x-1][i] && ami[x][x-1][i] > mh){
	fl = 1;
	mh = ami[x][x-1][i];
	t = i;
      }
    }

  
  if(x < n-1) {
    for(i=0;i<ami[x][x+1].size();i++) {
      if(h >= ami[x][x+1][i] && ami[x][x+1][i] > mh) {
	mh = ami[x][x+1][i];
	fl = 2;
	t = i;
      }
    }
  }

  if(fl == 1) {
    ami[x][x-1][t] = h+1;
    ami[x-1][x][t] = h+1;
  }else if(fl == 2)  {
    ami[x][x+1][t] = h+1;
    ami[x+1][x][t] = h+1;
  }
  if(mh == -1) return x;
  // printf("mh = %d\n",mh);
  if(mh != x && fl == 1) kuji(x-1,mh);
  else if(mh !=x && fl == 2) kuji(x+1,mh);
  
  
}	



int main() {
  

    
  cin >> n >> m >> a;
  
  mh = -1;  
  while(1) {
    int h,p,q;
    cin >> h >> p >> q;
    if(h == 0 && p == 0 && q ==0) break;
    ami[p-1][q-1].push_back(h);
    ami[q-1][p-1].push_back(h);
    //    cout << ami[q-1][p-1].back() << endl;
    if(mh < h) mh = h;
  }

   
  int ans = 0;
  ans = kuji(a-1,mh);
  
  cout << ans+1 << endl;

  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      ami[i][j].clear();
    
 
  
  return 0;
  
}
n;i++)
      for(int j=0;j<n;j++)
	ami[i][j].clear();
    
  }
  
  return 0;
  
}

Compiler output:
a.cc:89:1: error: 'n' does not name a type
   89 | n;i++)
      | ^
a.cc:89:3: error: 'i' does not name a type
   89 | n;i++)
      |   ^
a.cc:90:19: error: 'j' does not name a type
   90 |       for(int j=0;j<n;j++)
      |                   ^
a.cc:90:23: error: 'j' does not name a type
   90 |       for(int j=0;j<n;j++)
      |                       ^
a.cc:93:3: error: expected declaration before '}' token
   93 |   }
      |   ^
a.cc:95:3: error: expected unqualified-id before 'return'
   95 |   return 0;
      |   ^~~~~~
a.cc:97:1: error: expected declaration before '}' token
   97 | }
      | ^
a.cc: In function 'int kuji(int, int)':
a.cc:53:1: warning: control reaches end of non-void function [-Wreturn-type]
   53 | }
      | ^