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

#include <iostream>
#include <queue>

int main(){
	int n,m;
	while(std::cin >> n >> m){
		if(n == 0 && m == 0){
			break;
		}
		std::priority_queue<int> que;
		int vegetable;
		for(int i = 0; i < n; ++i){
			std::cin >> vegetable;
			que.push();
		}
		int price = 0;
		for(int i = 0; i < n; ++i){
		    if((i % m) != (m - 1)){
	  	        price += que.top();
		        que.pop();
		    }
		}
		std::cout << price << std::endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:33: error: no matching function for call to 'std::priority_queue<int>::push()'
   14 |                         que.push();
      |                         ~~~~~~~~^~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = int; _Sequence = std::vector<int, std::allocator<int> >; _Compare = std::less<int>; value_type = int]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = int; _Sequence = std::vector<int, std::allocator<int> >; _Compare = std::less<int>; value_type = int]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note:   candidate expects 1 argument, 0 provided
Language: C

#include<stdio>
int main(void){
int i ,j,n,b,a;
int s[10][7]={{0,1,1,1,1,1,1},{0,0,0,0,1,1,0},{1,0,1,1,0,1,1},{1,0,0,1,1,1,1},{1,1,0,0,1,1,0},{1,1,0,1,1,0,1},{1,1,1,1,1,0,1},{0,1,0,0,1,1,1},{1,1,1,1,1,1,1},{1,1,0,1,1,1,1}};
int ans[7];

while(scanf("%d",&n),n+1){
b=0;
for(i=0;i<n;i++){
scanf("%d",&a);
for(j=0;i<7;j++){
if(s[b][j]==s[a][j]) ans[j]=0;
else ans[j]=1;
}
b=a;
for(i=0;i<7;i++){
printf("%d",ans[i]);
}
puts("");
}
}
return 0;}

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

#include <stdio.h>

int main(){
  int i,j,n;
  char L[][8]={"0111111","0000110","1011011","1001111","1100110","1101101","1111101","0100111","1111111","1111110"}:

  while (1){
    scanf("%d",&n);
    if (n==-1) break;
    char b[]="0000000";
    int p=10;
    for (i=0;i<n;i++){
      int a;
      scanf("%d",&a);
      for (j=0;j<7;j++){
        if (L[a][j]==L[p][j])
          b[j]='0';
        else
          b[j]='1';
      }
      p=a;
      printf("%s\n",b);
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:116: error: expected ',' or ';' before ':' token
    5 |   char L[][8]={"0111111","0000110","1011011","1001111","1100110","1101101","1111101","0100111","1111111","1111110"}:
      |                                                                                                                    ^
Language: C++

#include <iostream>
#include <algorithm>
#include <string>

const int V[10][7] = {
  {0, 1, 1, 1, 1, 1, 1},
  {0, 0, 0, 0, 1, 1, 0},
  {1, 0, 1, 1, 0, 1, 1},
  {1, 0, 0, 1, 1, 1, 1},
  {1, 1, 0, 0, 1, 1, 0},
  {1, 1, 0, 1, 1, 0, 1},
  {1, 1, 1, 1, 1, 0, 1},
  {0, 1, 0, 0, 1, 1, 1},
  {1, 1, 1, 1, 1, 1, 1},
  {1, 1, 0, 1, 1, 1, 1}
};

using namespace std;

typedef long long ll;
typedef long double ld;

string change(int a, int b) {
  string res = "";
  for(int i=0; i<7; i++){
    if(V[a][i] == V[b][i]) {
      res += "0";
    } else {
      res += "1";
    }
  }

  return res;
}
  
int main() {
  int n, f=-1, t;

  while(true) {
    cin >> n;
    if(n == -1) break;
    for(int i=0; i<n; i++) {
      cin >> t;
      if(f == -1) {
        for(int j=0; j<7; j++) {
          cout << V[t][j];
        }
        cout << endl;
        f = t;
      } else {
        cout << change(f, t) << endl;
        f = t;
      }
    
    f = -1;
  }

  return 0;
}

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

using namespace std;

string s[10] = {
  "0111111",
  "0000110",
  "1011011",
  "1001111",
  "1100110",
  "1101101",
  "1111101",
  "0100111",
  "1111111",
  "1101111",
};


int main(void){
  int n;
  while(cin>>n, (n!=-1)){
    string now = "0000000";
    for(int i=0;i<n;i++){
      int x;
      cin>>x;
      string change = "0000000";
      for(int i=0;i<7;i++){
        if(s[x][i] != now[i]){
          change[i] = '1';
        }
      }
      cout<<change<<endl;
      now = s[x];
    }
  }

  return 0;
}

Compiler output:
a.cc:3:1: error: 'string' does not name a type
    3 | string s[10] = {
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:19:9: error: 'cin' was not declared in this scope
   19 |   while(cin>>n, (n!=-1)){
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:20:5: error: 'string' was not declared in this scope
   20 |     string now = "0000000";
      |     ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | using namespace std;
a.cc:24:13: error: expected ';' before 'change'
   24 |       string change = "0000000";
      |             ^~~~~~~
      |             ;
a.cc:26:12: error: 's' was not declared in this scope
   26 |         if(s[x][i] != now[i]){
      |            ^
a.cc:26:23: error: 'now' was not declared in this scope
   26 |         if(s[x][i] != now[i]){
      |                       ^~~
a.cc:27:11: error: 'change' was not declared in this scope
   27 |           change[i] = '1';
      |           ^~~~~~
a.cc:30:7: error: 'cout' was not declared in this scope
   30 |       cout<<change<<endl;
      |       ^~~~
a.cc:30:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:30:13: error: 'change' was not declared in this scope
   30 |       cout<<change<<endl;
      |             ^~~~~~
a.cc:30:21: error: 'endl' was not declared in this scope
   30 |       cout<<change<<endl;
      |                     ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:31:7: error: 'now' was not declared in this scope
   31 |       now = s[x];
      |       ^~~
a.cc:31:13: error: 's' was not declared in this scope
   31 |       now = s[x];
      |             ^
Language: C++

// 0228.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//

#include "stdafx.h"

#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
int main()
{
	ios::sync_with_stdio(false);
	string a[10];
	a[0] = "0111111";
	a[1] = "0000110";
	a[2] = "1011011";
	a[3] = "1001111";
	a[4] = "1100001";
	a[5] = "1101101";
	a[7] = "0100111";
	a[6] = "1111101";
	a[8] = "1111111";
	a[9] = "1101111";
	while (true) {

		ll n;
		cin >> n;
		if (n == -1) { break; }
		string  s = "0000000";
		for (int i = 0; i < n; i++) {
			int d;
			cin >> d;
			for (int j = 0; j < 7; j++) {
				if (a[d][j] == s[j]) { cout << 0; }
				else { cout << 1; }
			}
			cout << endl;
			s = a[i];
		}
	
	}
	
	return 0;
}

Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;

public class Mai {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(true){
			int coin=100;
			int b = cin.nextInt();
			int r = cin.nextInt();
			int g = cin.nextInt();
			int c = cin.nextInt();
			int s = cin.nextInt();
			int t = cin.nextInt();
			if(b+r+g+c+s+t==0){
				break;
			}
			t = t-b*5-r*3;
			int bonusGame=b*5+r*3;
			for(int i =0; i < bonusGame;i++){
				coin+=13;
			}
			for(int i = 0; i < b;i++){
				coin+=12;
			}
			for(int i = 0; i < r;i++){
				coin+=12;
			}
			for(int i = 0; i < g;i++){
				coin+=4;
			}
			for(int i = 0; i < c;i++){
				coin-=1;
			}
			t = t-b-r-g-c-s;
			coin -= t*3;
			System.out.println(coin);
		}
	}

}

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

#include <stdio.h>
main(){for(int b,r,g,c,s,t;scanf("%d%d%d%d%d%d",&b,&r,&g,&c,&s,&t),t;printf("%d\n",100+3*s-3*t+2*c+g*7+95*b+63*r));}

Compiler output:
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | main(){for(int b,r,g,c,s,t;scanf("%d%d%d%d%d%d",&b,&r,&g,&c,&s,&t),t;printf("%d\n",100+3*s-3*t+2*c+g*7+95*b+63*r));}
      | ^~~~
Language: C++

#include<stdio.h>
int main(void){
int b,r,g,c,s,t;

while(scanf("%d%d%d%d%d%d",&b,&r,&g,&c,&s,&t),b+r+g+c+s+t){
point=100;
point+=(b*6+r*4)*15+g*7+c*2+s*3;
point-=(b*5+r*3)*2+(t-b*5-r*3)*3;
printf("%d\n",point);
}
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:1: error: 'point' was not declared in this scope; did you mean 'printf'?
    6 | point=100;
      | ^~~~~
      | printf
Language: C++

main(b,r,g,c,s,t){
for(;~scanf("%d%d%d%d%d%d",&b,&r,&g,&c,&s,&t)&&t;)printf("%d\n",b*95+r*63+g*7+c*2+s*3-t*3+100);
}

Compiler output:
a.cc:1:5: error: expected constructor, destructor, or type conversion before '(' token
    1 | main(b,r,g,c,s,t){
      |     ^
Language: C++

main(b,r,g,c,s,t){
	for(;~scanf("%d%d%d%d%d%d",&b,&r,&g,&c,&s,&t)&&t;)printf("%d\n",b*95+r*63+g*7-c+(s+c-t)*3+100);
}

Compiler output:
a.cc:1:5: error: expected constructor, destructor, or type conversion before '(' token
    1 | main(b,r,g,c,s,t){
      |     ^
Language: C++

b,r,g,c,s;
main(t){
  for(;scanf("%d%d%d%d%d%d",&b,&r,&g,&c,&s,&t),t;)
    printf("%d\n",100-(t-s)*3+c*2+g*7+95*b+63*r);return 0;
}

Compiler output:
a.cc:1:1: error: 'b' does not name a type
    1 | b,r,g,c,s;
      | ^
a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token
    2 | main(t){
      |     ^
Language: C++

b,r,g,c,s;main(t){for(;scanf("%d%d%d%d%d%d",&b,&r,&g,&c,&s,&t),t;printf("%d\n",100-(t-s)*3+c*2+g*7+95*b+63*r));}

Compiler output:
a.cc:1:1: error: 'b' does not name a type
    1 | b,r,g,c,s;main(t){for(;scanf("%d%d%d%d%d%d",&b,&r,&g,&c,&s,&t),t;printf("%d\n",100-(t-s)*3+c*2+g*7+95*b+63*r));}
      | ^
a.cc:1:15: error: expected constructor, destructor, or type conversion before '(' token
    1 | b,r,g,c,s;main(t){for(;scanf("%d%d%d%d%d%d",&b,&r,&g,&c,&s,&t),t;printf("%d\n",100-(t-s)*3+c*2+g*7+95*b+63*r));}
      |               ^
Language: C

#include <iostream>
#include <deque>
#include <algorithm>
using namespace std;

struct Node {
    int bid, floor, jump;
    Node(int b, int f, int j) {
        bid = b; floor = f; jump = j;
    }
};

int main() {
    int B[2][100], i, j, n, f, b, c;
    bool visited[2][100];
    deque<Node*> q;
    Node *node;

    while (cin) {
        cin >> n;
        if (n == 0) break;

        for (i = 0; i < 2; i++) {
            for (j = 0; j < n; j++) {
                cin >> B[i][j];
                visited[i][j] = false;
            }
        }

        q.clear();
        for (i = 0; i < 2; i++) {
            f = 0;
            if (B[i][f] == 1) {
                while (B[i][f+1] == 1) f++;
            }
            node = new Node(i, f, 0);
            q.push_back(node);
        }
        while (!q.empty()) {
            node = q.front(); q.pop_front();
            if (visited[node->bid][node->floor]) continue;
            visited[node->bid][node->floor] = true;
            for (i = 0; i <= 2; i++) {
                f = node->floor + i;
                b = node->bid ^ 1;
                c = node->jump + 1;
                switch (B[b][f]) {
                    case 1:
                        while (B[b][f+1] == 1) f++;
                        break;
                    case 2:
                        while (B[b][f] == 2) f--;
                        break;
                }
                if (f == n - 1) {
                    cout << c << endl;
                    goto NEXT;
                }
                if (visited[b][f]) continue;
                q.push_back(new Node(b, f, c));
            }
        }
        cout << "NA" << endl;
        NEXT:;
    }
    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>

int a[2][100];
int su;

int dfs(int building,int level,int count){
	int ret_a=200,ret_b=200,ret_c=200,ret_d=200;
	if(count>su*2 || level>su+1) return 200;
	if(a[building][level+1]==1) ret_a=dfs(building,level+1,count+1);
	else if(su==level-1) return -1;
	else if(a[building][level]==2) ret_b=dfs(building,level-1,count+1);
	else{
		ret_c=dfs((building+1)%2,level+2,count+1)+1;
		ret_d=dfs((building+1)%2,level+1,count+1)+1;
	}
	if(ret_a<ret_b) ret_b=ret_a;
	if(ret_c<ret_d) ret_d=ret_c;
	if(ret_b<ret_d) return ret_b;
	else return ret_d;
	}
}

int main(){
	int i,building,ret;

	while(1){
		building=0;
		scanf("%d",&su);
		if(su==0) break;
		for(i=0;i<su;i++) scanf("%d",&a[0][i]);
		for(i=0;i<su;i++) scanf("%d",&a[1][i]);
		if(a[1][0]==1) building=1;
		ret=dfs(building,0,0);
		if(ret>=200) printf("NA\n");
		else printf("%d\n",ret);
	}
	return 0;
}

Compiler output:
main.c:21:1: error: expected identifier or '(' before '}' token
   21 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#define fr first
#define sc second
#define INF (2 << 28)
using namespace std;

typedef pair<int, int> iiP;

int n, mas[2][101];
int used[2][101];
int dy[] = {0, 1, 2};

int bfs(int sy, int sx){

  queue <iiP> que;
  que.push(iiP(sx, sy));
  memset(used, 0, sizeof(used));
  used[sy][sx] = 0;
  while(!que.empty()){
    iiP p = que.front(); que.pop();
    if(p.fr == n-1 && mas[p.sc][p.fr] != 2) return used[p.sc][p.fr] + 1;
    if(mas[p.sc][p.fr] == 1){
      for(int i = 1;; i++){
	if(mas[p.sc][p.fr+i] != 1){
	  for(int j = 0; j < 3; j++){
	    if(p.fr+i - 1 + dy[j] < n && p.sc == 0 && used[1][p.fr+i - 1 + dy[j]] == 0){
	      que.push(iiP(p.fr+i - 1 + dy[j], 1));
	      used[1][p.fr+i - 1 + dy[j]] = used[p.sc][p.fr] + 1;
	    }
	    else if(p.fr+i - 1 + dy[j] < n && used[0][p.fr+i - 1 + dy[j]] == 0){
	      que.push(iiP(p.fr+i - 1 + dy[j], 0));
	      used[0][p.fr+i - 1 + dy[j]] = used[p.sc][p.fr] + 1;
	    }
	  }
	  break;
	}
      }
    }
    else if(mas[p.sc][p.fr] == 0){
      for(int i = 0; i < 3; i++){
	if(p.fr + dy[i] < n && p.sc == 0 && used[1][p.fr + dy[i]] == 0){
	  que.push(iiP(p.fr + dy[i], 1));
	  used[1][p.fr + dy[i]] = used[p.sc][p.fr] + 1;
	}
	else if(p.fr + dy[i] < n && used[0][p.fr + dy[i]] == 0){
	  que.push(iiP(p.fr + dy[i], 0));
	  used[0][p.fr + dy[i]] = used[p.sc][p.fr] + 1;
	}
      }
    }
    else{
      for(;;){
	if(mas[p.sc][--p.fr] != 2) break;
      }
      que.push(iiP(p.fr, p.sc));
    }
  }

  return INF;

}
	

int main(){

  while(cin >> n, n){
    for(int i = 0; i < 2; i++){
      for(int j = 0; j < n; j++) cin >> mas[i][j];
    }
    
    int ans = min(bfs(0, 0), bfs(1, 0));
    if(ans == INF) cout << "NA" << endl;
    else cout << ans << endl;

  }

}

Compiler output:
a.cc: In function 'int bfs(int, int)':
a.cc:21:3: error: 'memset' was not declared in this scope
   21 |   memset(used, 0, sizeof(used));
      |   ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <algorithm>
  +++ |+#include <cstring>
    6 | #define fr first
Language: C++

#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#define fr first
#define sc second
#define INF (2 << 28)
using namespace std;

typedef pair<int, int> iiP;

int n, mas[2][101];
int used[2][101];
int dy[] = {0, 1, 2};

int bfs(int sy, int sx){

  queue <iiP> que;
  que.push(iiP(sx, sy));
  memset(used, 0, sizeof(used));
  used[sy][sx] = 0;
  while(!que.empty()){
    iiP p = que.front(); que.pop();
    //cout << p.sc << " " << p.fr << endl;
    if(p.fr == n-1 && mas[p.sc][p.fr] != 2) return used[p.sc][p.fr];
    if(mas[p.sc][p.fr] == 1){
      for(int i = 1;; i++){
	if(mas[p.sc][p.fr+i] != 1){
	  for(int j = 0; j < 3; j++){
	    if(p.fr+i - 1 + dy[j] < n && p.sc == 0 && used[1][p.fr+i - 1 + dy[j]] == 0){
	      que.push(iiP(p.fr+i - 1 + dy[j], 1));
	      used[1][p.fr+i - 1 + dy[j]] = used[p.sc][p.fr] + 1;
	    }
	    else if(p.fr+i - 1 + dy[j] < n && used[0][p.fr+i - 1 + dy[j]] == 0){
	      que.push(iiP(p.fr+i - 1 + dy[j], 0));
	      used[0][p.fr+i - 1 + dy[j]] = used[p.sc][p.fr] + 1;
	    }
	  }
	  break;
	}
      }
    }
    else if(mas[p.sc][p.fr] == 0){
      for(int i = 0; i < 3; i++){
	if(p.fr + dy[i] < n && p.sc == 0 && used[1][p.fr + dy[i]] == 0){
	  que.push(iiP(p.fr + dy[i], 1));
	  used[1][p.fr + dy[i]] = used[p.sc][p.fr] + 1;
	}
	else if(p.fr + dy[i] < n && used[0][p.fr + dy[i]] == 0){
	  que.push(iiP(p.fr + dy[i], 0));
	  used[0][p.fr + dy[i]] = used[p.sc][p.fr] + 1;
	}
      }
    }
    else{
      for(int i = 1;;i++){
	if(mas[p.sc][p.fr - i] != 2){
	  que.push(iiP(p.fr - i, p.sc));
	  used[p.sc][p.fr - i] = used[p.sc][p.fr];
	  break;
	}
      }
    }
  }

  return INF;

}
	

int main(){

  while(cin >> n, n){
    for(int i = 0; i < 2; i++){
      for(int j = 0; j < n; j++) cin >> mas[i][j];
    }
    
    int ans = min(bfs(0, 0), bfs(1, 0));
    if(ans == INF) cout << "NA" << endl;
    else cout << ans << endl;

  }

Compiler output:
a.cc: In function 'int main()':
a.cc:84:4: error: expected '}' at end of input
   84 |   }
      |    ^
a.cc:73:11: note: to match this '{'
   73 | int main(){
      |           ^
Language: C++

#include <queue>
#include <cstdio>
#include <algorithm>
using namespace std;
int n, a[100], b[100], d[100][2];
int main() {
	while(scanf("%d", &n), n) {
		for(int i = 0; i < n; i++) scanf("%d", &a[i]);
		for(int i = 0; i < n; i++) scanf("%d", &b[i]);
		for(int i = 1; i < n; i++) d[i][0] = -1, d[i][1] = -1;
		d[0][0] = 0, d[0][1] = 0;
		queue<int> que; que.push(0); que.push(1);
		while(!que.empty()) {
			int x = que.front() / 2, y = que.front() % 2; que.pop();
			for(int i = 0; i <= 2 && x + i < n; i++) {
				if(y == 1) {
					int tx = x + i;
					if(a[tx] == 1) {
						for(; tx + 1 < n; tx++) {
							if(a[tx + 1] != 1) break;
						}
					}
					else if(a[tx] == 2) {
						for(; tx - 1 > 0; tx--) {
							if(a[tx - 1] != 2) break;
						}
					}
					if(d[tx][0] > d[x][y] + 1) {
						d[tx][0] = d[x][y] + 1;
						que.push(make_pair(tx * 2));
					}
				}
				else {
					int tx = x + i;
					if(b[tx] == 1) {
						for(; tx + 1 < n; tx++) {
							if(b[tx + 1] != 1) break;
						}
					}
					else if(b[tx] == 2) {
						for(; tx - 1 > 0; tx--) {
							if(b[tx - 1] != 2) break;
						}
					}
					if(d[tx][1] == -1) {
						d[tx][1] = d[x][y] + 1;
						que.push(make_pair(tx * 2 + 1));
					}
				}
			}
		}
		int r = min(d[n - 1][0], d[n - 1][1]);
		if(r == -1) printf("NA\n");
		else printf("%d\n", r);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:67: error: no matching function for call to 'make_pair(int)'
   30 |                                                 que.push(make_pair(tx * 2));
      |                                                          ~~~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/deque:62,
                 from /usr/include/c++/14/queue:62,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: candidate: 'template<class _T1, class _T2> constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&)'
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1132:5: note:   candidate expects 2 arguments, 1 provided
a.cc:47:67: error: no matching function for call to 'make_pair(int)'
   47 |                                                 que.push(make_pair(tx * 2 + 1));
      |                                                          ~~~~~~~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: candidate: 'template<class _T1, class _T2> constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&)'
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1132:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

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

int n[101], m[101], l[2][100], s[2][100], k[2] = { 1,0 };
int main() {
	int a;
	while (cin >> a, a) {
		memset(n, -1, sizeof(n));
		memset(m, -1, sizeof(m));
		memset(s, -1, sizeof(s));
		for (int b = 0; b < a; b++)cin >> n[b];
		for (int b = 0; b < a; b++)cin >> m[b];
		int  xMAX, yMAX = 0;
		for (int i = 0; i < a; i++) {
			switch (n[i]) {
			case 0: xMAX = i; break;
			case 2:	l[0][i] = xMAX;
			}
			switch (m[i]) {
			case 0: yMAX = i; break;
			case 2:	l[1][i] = yMAX;
			}
		}
		xMAX = yMAX = a + 5;
		for (int i = a - 1; i >= 0; i--) {
			switch (n[i]) {
			case 0: l[0][i] = i; break;
			case 1:	if (n[i + 1] != 1)xMAX = i;
				l[0][i] = xMAX;
			}
			switch (m[i]) {
			case 0: l[1][i] = i; break;
			case 1:
				if (m[i + 1] != 1)yMAX = i;
				l[1][i] = yMAX;
			}
		}
		queue<P>Q;
		Q.push(P(0, l[0][0]));
		Q.push(P(1, l[1][0]));
		s[0][l[0][0]] = s[1][l[1][0]] = 0;
		while (Q.size()) {
			P o = Q.front(); Q.pop();
			for (int i = 0; i <= 2; i++) {
				if (o.second + i < a&&s[k[o.first]][l[k[o.first]][o.second + i]] == -1) {
					s[k[o.first]][l[k[o.first]][o.second + i]] = s[o.first][o.second] + 1;
					Q.push(P(k[o.first], l[k[o.first]][o.second + i]));
				}
			}
		}
		for (int p = a - 1; p != -1; p--) {
			cout << s[0][p] << " " << s[1][p] << endl;
		}
		if (s[0][a - 1] == -1 && s[1][a - 1] == -1)puts("NA");
		else if (s[0][a - 1] != -1 && s[1][a - 1] != -1)cout << min(s[0][a - 1], s[1][a - 1]) << endl;
		else cout << max(s[0][a - 1], s[1][a - 1]) << endl;
	}
}

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

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<functional>
#include<list>
#include<map>
#include<unordered_map>
#define P pair<int,int>
using namespace std;

int main() {
	int a;
	while (cin >> a, a) {
		int n[105], m[105], l[2][105], s[2][105], k[2] = { 1,0 };
		memset(s, -1, sizeof(s));
		for (int b = 0; b < a; b++)cin >> n[b];
		for (int b = 0; b < a; b++)cin >> m[b];
		int xMAX = 0, yMAX = 0;
		for (int i = 0; i < a; i++) {
			switch (n[i]) {
			case 2: l[0][i] = xMAX; break;
			default: xMAX = i; break;
			}
			switch (m[i]) {
			case 2: l[1][i] = yMAX; break;
			default: yMAX = i; break;
			}
		}
		xMAX = yMAX = a + 5;
		for (int i = a - 1; i >= 0; i--) {
			switch (n[i]) {
			case 0: l[0][i] = i; break;
			case 1: if (n[i + 1] != 1)xMAX = i;
				l[0][i] = xMAX;
			}
			switch (m[i]) {
			case 0: l[1][i] = i; break;
			case 1:
				if (m[i + 1] != 1)yMAX = i;
				l[1][i] = yMAX;
			}
		}
		queue<P>Q;
		Q.push(P(0, l[0][0]));
		Q.push(P(1, l[1][0]));
		s[0][l[0][0]] = s[1][l[1][0]] = 0;
		while (Q.size()) {
			P o = Q.front(); Q.pop();
			if (o.second >= a - 1) { cout << s[o.first][o.second] << endl; goto m; }
			for (int i = 0; i <= 2; i++) {
				if (o.second + i < a&&s[k[o.first]][l[k[o.first]][o.second + i]] == -1) {
					s[k[o.first]][l[k[o.first]][o.second + i]] = s[o.first][o.second] + 1;
					Q.push(P(k[o.first], l[k[o.first]][o.second + i]));
				}
			}
		}
		puts("NA");
	m:;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: 'memset' was not declared in this scope
   20 |                 memset(s, -1, sizeof(s));
      |                 ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include<map>
  +++ |+#include <cstring>
   12 | #include<unordered_map>
Language: C++

#include<queue>
#include<iostream>
typedef unsigned long long ull;
typedef pair<ull,ull> UL2;
typedef pair<UL2,UL2> ULUL;
typedef pair<ULUL,ULUL> ULMAX;


using namespace std;

int main(){
int  n;
int r[110],l[110];
cin >> n;
for(int i=0;i<n;i++)cin >> r[i];
for(int j=0;j<n;j++)cin >> l[j];
queue<ULMAX> que;
while(true){
que.push(ULMAX(ULUL(UL2(10000000,11000000),UL2(1222222,41241242)),ULUL(UL2(421412421,4122412),UL2(2222,112241))));
}


return 0;
}

Compiler output:
a.cc:4:9: error: 'pair' does not name a type
    4 | typedef pair<ull,ull> UL2;
      |         ^~~~
a.cc:5:9: error: 'pair' does not name a type
    5 | typedef pair<UL2,UL2> ULUL;
      |         ^~~~
a.cc:6:9: error: 'pair' does not name a type
    6 | typedef pair<ULUL,ULUL> ULMAX;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:17:7: error: 'ULMAX' was not declared in this scope; did you mean 'ELIBMAX'?
   17 | queue<ULMAX> que;
      |       ^~~~~
      |       ELIBMAX
a.cc:17:12: error: template argument 1 is invalid
   17 | queue<ULMAX> que;
      |            ^
a.cc:17:12: error: template argument 2 is invalid
a.cc:19:5: error: request for member 'push' in 'que', which is of non-class type 'int'
   19 | que.push(ULMAX(ULUL(UL2(10000000,11000000),UL2(1222222,41241242)),ULUL(UL2(421412421,4122412),UL2(2222,112241))));
      |     ^~~~
a.cc:19:21: error: 'UL2' was not declared in this scope
   19 | que.push(ULMAX(ULUL(UL2(10000000,11000000),UL2(1222222,41241242)),ULUL(UL2(421412421,4122412),UL2(2222,112241))));
      |                     ^~~
a.cc:19:16: error: 'ULUL' was not declared in this scope
   19 | que.push(ULMAX(ULUL(UL2(10000000,11000000),UL2(1222222,41241242)),ULUL(UL2(421412421,4122412),UL2(2222,112241))));
      |                ^~~~
Language: C++

#include<cstdio>
#include<map>
#include<queue>
#include<algorithm>
#define INF (1<<25)
using namespace std;

int buil[2][105], shortest[2][105];

int dfs(int a, int b){
  if(b == 0)return shortest[a][b] = 1;
  if(b < n - 1 && buil[a][b] == 1 && buil[a][b + 1] == 1)return shortest[a][b] = INF - 1;
  if(buil[a][b] == 2)return shortest[a][b] = INF - 1;
  if(shortest[a][b] != INF)return shortest[a][b];
  for(int i = 0;i <= 2 && b - i >= 0;i++){
  }
}

int main(){
  int n;
  while(true){
    scanf("%d", &n);
    if(n == 0)return 0;
    for(int j = 0;j < 2;j++){
      for(int i = 0;i < n;i++){
	scanf("%d", &buil[j][i]);
	shortest[j][i] = INF;
      }
    }
    queue<pair<int, int> > q;
    if(buil[0][0] != 2){
      int tmp = 0;
      while(buil[0][tmp + 1] == 1)tmp++;
      q.push(make_pair(0,tmp));      
      shortest[0][tmp] = 1;
    }
    if(buil[1][0] != 2){
      int tmp = 0;
      while(buil[1][tmp + 1] == 1)tmp++;
      q.push(make_pair(1,tmp));      
      shortest[1][tmp] = 1;
    }
    int time = 1;
    while(!q.empty()){
      time++;
      int len = q.size();
      while(len--){
	int l = q.front().first, r = q.front().second;
	q.pop();
	for(int i = 0;i <= 2 && r + i < n;i++){
	  int tmpr = r + i;
	  if(buil[1 - l][tmpr] == 1)
	    while(tmpr + 1 < n && buil[1 - l][tmpr + 1] == 1)tmpr++;
	  while(tmpr >= 0 && buil[1 - l][tmpr] == 2)tmpr--;
	  if(shortest[1 - l][tmpr] != INF)continue;
	  if(tmpr == -1)continue;
	  shortest[1 - l][tmpr] = time;
	  q.push(make_pair(1 - l, tmpr));
	}
      }
      if(shortest[0][n - 1] != INF || shortest[1][n - 1] != INF)break;
    }
    if(shortest[0][n - 1] !=INF || shortest[1][n - 1] != INF)
      printf("%d\n", time - 1);
    else
      puts("NA");
  }
}

Compiler output:
a.cc: In function 'int dfs(int, int)':
a.cc:12:10: error: 'n' was not declared in this scope
   12 |   if(b < n - 1 && buil[a][b] == 1 && buil[a][b + 1] == 1)return shortest[a][b] = INF - 1;
      |          ^
a.cc:17:1: warning: control reaches end of non-void function [-Wreturn-type]
   17 | }
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> T;
#define INF (1 << 30)
int n, dist[2][210], window[2][210];
vector<T> edge[2][210];
bool come[2][210];
int main(){
    while(cin >> n, n){
	for(int j = 0;j < 2;j++){
	    for(int i = 0;i < n;i++){
		cin >> window[j][i];
		dist[j][i] = INF;
		come[j][i] = false;
		edge[j][i].clear();
	    }
	}
	for(int j = 0;j < 2;j++){
	    for(int i = 0;i < n;i++){
		if(window[j][i] == 0 ||(window[j][i] == 1 && window[j][i + 1] == 0)){
		    for(int k = 0;k <= 2;k++){
			edge[j][i].push_back(T(1, P(!j, i + k)));
		    }
		}
		if(window[j][i + 1] == 1 && window[j][i] == 1){
		    edge[j][i].push_back(T(0, P(j, i + 1)));
		}
		if(window[j][i] == 2){
		    edge[j][i].push_back(T(0, P(j, i - 1)));
		}
	    }
	}
	priority_queue<T, vector<T>, greater<T> > pq;
	pq.push(T(0, P(0, 0)));
	pq.push(T(0, P(1, 0)));
	dist[0][0] = dist[1][0] = 0;
	while(!pq.empty()){
	    T tmp = pq.top();pq.pop();
	    int d = tmp.first, x = tmp.second.first, y = tmp.second.second;
	    come[x][y] = true;
	    if(dist[x][y] < d)continue;
	    for(int i = 0;i < edge[x][y].size();i++){
		P to = edge[x][y][i].second;
		int r = edge[x][y][i].first, tx = to.first, ty = to.second;
		if(dist[tx][ty] <= d + r)continue;
		dist[tx][ty] = d + r;
		pq.push(T(dist[tx][ty], to));
	    }
	}
	//for(int i = 0;i < 2;i++,cout<<endl)
	    for(int j = 0;j < n;j++)
		//cout << dist[i][j] << " ";
	int res = min(dist[0][n - 1], dist[1][n - 1]);
	if(res == INF)cout << "NA" << endl;
	else cout << res << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:12: error: 'res' was not declared in this scope
   59 |         if(res == INF)cout << "NA" << endl;
      |            ^~~
Language: C++

#include <queue>
#include <tuple>
#include <cstdio>
using namespace std;
typedef tuple<int,int,int> tiii; //building, floor, depth
int M[2][101],B[2][101];
int main(){
	int n,i;
	for(;scanf("%d",&n),n;){
		for(i=0;i<n;i++)scanf("%d",B[0]+i);
		for(i=0;i<n;i++)scanf("%d",B[1]+i);
		memset(M,99,sizeof(M));
		queue<tiii> q;
		q.push(make_tuple(0,0,0));M[0][0]=0;
		q.push(make_tuple(1,0,0));M[1][0]=0;
		for(;!q.empty();){
			tiii t=q.front();q.pop();
			int building=get<0>(t);
			int floor=get<1>(t);
			int depth=get<2>(t);
			for(;B[building][floor]==1&&B[building][floor+1]==1;){
				if(M[building][floor+1]>M[building][floor])M[building][floor+1]=M[building][floor];
				floor++;
			}
			for(;B[building][floor]==2;){
				if(M[building][floor-1]>M[building][floor])M[building][floor-1]=M[building][floor];
				floor--;
			}
			if(floor==n-1){printf("%d\n",depth);goto success;}
			for(i=2;i>=0;i--)if(M[building^1][floor+i]>M[building][floor]){
				M[building^1][floor+i]=M[building][floor];
				q.push(make_tuple(building^1,floor+i,depth+1));
			}
		}
		puts("NA");continue;
success:;
	}
}

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

#include <queue>
#include <tuple>
#include <cstdio>
using namespace std;
#define SENTINEL 99999
typedef tuple<int,int,int> tiii; //building, floor, depth
int M[2][101],B[2][101],n;
int bfs(int i){
		memset(M,99,sizeof(M));
		queue<tiii> q;
		q.push(make_tuple(i,0,0));M[i][0]=0;
		for(;!q.empty();){
			tiii t=q.front();q.pop();
			int building=get<0>(t);
			int floor=get<1>(t);
			int depth=get<2>(t);
			for(;B[building][floor]==1&&B[building][floor+1]==1;){
				if(M[building][floor+1]>M[building][floor])M[building][floor+1]=M[building][floor];
				floor++;
			}
			for(;B[building][floor]==2;){
				if(M[building][floor-1]>M[building][floor])M[building][floor-1]=M[building][floor];
				floor--;
			}
			if(floor>=n-1)return depth;
			for(i=2;i>=0;i--)if(M[building^1][floor+i]>M[building][floor]){
				M[building^1][floor+i]=M[building][floor];
				q.push(make_tuple(building^1,floor+i,depth+1));
			}
		}
		return SENTINEL;
}
int main(){
	int i,j;
	for(;scanf("%d",&n),n;){
		for(j=0;j<2;j++){
			for(i=0;i<n;i++)scanf("%d",B[j]+i),M[j][i]=SENTINEL;
			B[j][i]=0,M[j][i]=SENTINEL;
		}
		i=min(bfs(0),bfs(1));
		printf(i==SENTINEL?"NA\n":"%d\n",i);
	}
}

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

#inlcude<cstdio>
using namespace std;
int m[100],a[100],b[100],n;
bool judge(int x){
    int w=0;
    for(int i=0;i<n;i++)
        if(a[i]<=x&&b[i]>x)w+=m[i];
    return w<=150;
}
int main(){
    while(stanf("%d",&n)&&n){
        for(int i=0;i<n;i++)scanf("%d%d%d",m+i,a+i,b+i);
        bool res=true;
        for(int i=0;i<n;i++)res&=judge(a[i]);
        for(int i=0;i<n;i++)res&=judge(b[i]);
        puts(res?"OK":"NG");
    }
    return 0;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inlcude; did you mean #include?
    1 | #inlcude<cstdio>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:11:11: error: 'stanf' was not declared in this scope
   11 |     while(stanf("%d",&n)&&n){
      |           ^~~~~
a.cc:12:29: error: 'scanf' was not declared in this scope
   12 |         for(int i=0;i<n;i++)scanf("%d%d%d",m+i,a+i,b+i);
      |                             ^~~~~
a.cc:16:9: error: 'puts' was not declared in this scope
   16 |         puts(res?"OK":"NG");
      |         ^~~~
Language: C++

#include<iostream>
#include<vector>

using namespace std;

class Hito{
	public:
	int m,a,b;
	hito();
	void set(int mm, int aa, int bb){
		m = mm;
		a = aa;
		b = bb;
	}
};

int main()
{
	for(;;){
		int n;
		int m, a, b;
		int finTime = 0;
		int nowg = 0;
		bool flg = false;
		vector<Hito> data(n);
		
		cin >> n;
		if(n == 0){
			break;
		}
		
		for(int i = 0;i < n; i++){
			cin >> m >> a >> b;
			if(finTime < b){
				finTime = b;
			}
			data[i].set(m,a,b);
		}
		
		for(int i = 0; i < finTime; i++){
			for(int j = 0; j < n; j++){
				//ÔàÉé
				if(data[j].a <= i && data[j].b > i){
					nowg += data[j].m;
				}
			}
			
		//	printf("%d:nowg>> %d\n",i,nowg);
			if(nowg > 150){
				flg = true;
				break;
			}
			nowg = 0;
		}
		
		if(flg == true){
			cout << "NG" << endl;
		}
		else{
			cout << "OK" << endl;
		}
	}
}

Compiler output:
a.cc:9:9: error: ISO C++ forbids declaration of 'hito' with no type [-fpermissive]
    9 |         hito();
      |         ^~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

void solve()
{
	int n;
	while(cin >> n, n)
	{
		vector<int> weight(n + 1);
		vector<int> start(n + 1);
		vector<int> end(n);
		vector<int> order_start(n + 1);
		vector<int> order_end(n);
		for(int i = 0; i < n; ++i)
		{
			cin >> weight[i] >> start[i] >> end[i];
			order_start[i] = i;
			order_end[i] = i;
		}
		weight[n] = INT_MAX;
		start[n] = INT_MAX;
		for(int i = 0; i < n; ++i)
		{
			for(int j = n - 1; j > i; --j)
			{
				if(start[j] < start[j - 1])
				{
					swap(order_start[j], order_start[j - 1]);
				}
				if(end[j] < end[j - 1])
				{
					swap(order_end[j], order_end[j - 1]);
				}
			}
		}
		int sum = weight[order_start[0]];
		int start_pos = 1;
		int end_pos = 0;
		while(start_pos != n)
		{
			if(start[order_start[start_pos]] == end[order_end[end_pos]])
			{
				sum -= weight[order_end[end_pos]];
				sum += weight[order_start[start_pos]];
				start_pos++;
				end_pos++;
			}
			else if(start[order_start[start_pos]] < end[order_end[end_pos]])
			{
				sum += weight[order_start[start_pos]];
				start_pos++;
			}
			else if(start[order_start[start_pos]] > end[order_end[end_pos]])
			{
				sum -= weight[order_end[end_pos]];
				end_pos++;
			}
			if(sum > 150)
			{
				break;
			}
		}
		if(sum <= 150)
		{
			cout << "OK" << endl;
		}
		else
		{
			cout << "NG" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:22:29: error: 'INT_MAX' was not declared in this scope
   22 |                 weight[n] = INT_MAX;
      |                             ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 |
Language: C++

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

int main() {
  int n;
  
  while(cin>>n, n) {
    vector<pair<int,int> > v(n*2);
    for(int i=0; i<n; i++) {
      int mass, begin, end;
      cin >> mass >> begin >> end;
      // テヲツゥツ凝」ツ?クテ」ツ?凝」ツ?凝」ツつ凝ィツイツ?ィツ債キテ」ツ?ョテ・ツ「ツ療ヲツクツ崚」ツ?ョテ・ツ「ツεァツ閉古」ツ?ッテヲツクツ。テ」ツつ甘・ツァツ凝」ツつ?」ツ?ィテァツオツづ」ツつ?
      v[i*2] = make_pair(begin, mass);
      v[i*2+1] = make_pair(end, -mass);
    }
    // テ、ツコツ凝」ツ?ョティツオツキテ」ツつ甘」ツつ津ヲツ卍づァツウツサテ・ツ按療ゥツ??」ツ?ォテ」ツつステ」ツδシテ」ツδ?
    sort(v.begin(), v.end());
    
    int load = 0;
    bool isOk = true;
    for(int i=0; i<2*n; i++) {
      load += v[i].second;
      if(load > 150) isOk = false;
    }
    cout << (isOk ? "OK" : "NG") << endl;
  }
  
  return 0;
}

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

import java.util.Scanner;
public class P0232 {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			int z = sc.nextInt();
			if (x+y+z==0) {
				break;
			}
			int v[] = new int[x];
			for (int i=0;i<x;i++) {
				v[i] = sc.nextInt();
			}
			double p[][] = new double[y+1][60000];
			p[0][0]=1.0d;
			int event[] = new int[y+1];
			int eventa[] = new int[y+1];
			for (int i=0;i<z;i++) {
				int n = sc.nextInt();
				int e = sc.nextInt();
				int a = sc.nextInt();
				event[n]=e;
				eventa[n]=a;
			}
			//System.out.println("----");
			for (int i=0;i<y;i++) {
				for (int m=0;m<60000;m++) {
					if (p[i][m]==0.0) {
						continue;
					}
					//System.out.println(i+","+m+","+p[i][m]);
					for (int j=0;j<x;j++) {
						int money = m;
						int target = i+v[j];
						if (target>y) {
							target=y;
						}
						switch (event[target]) {
						case 1:
							target+=eventa[target];
							if (target>y) {
								target=y;
							}
							break;
						case 2:
							money+=eventa[target];
							break;
						case 3:
							money-=eventa[target];
							if (money<0) {
								money = 0;
							}
							break;
						}
						p[target][money]+=p[i][m]/x;
						//System.out.println(i+" To "+target+" :p="+p[i][m]/x+" : money=" + m + " To "+money);
					}
				}
			}
			double ans = 0.0;
			for (int i=0;i<60000;i++) {
				ans+=p[y][i]*i;
			}
			System.out.println((int) ans);
		}
	}
}

Compiler output:
Main.java:2: error: class P0232 is public, should be declared in a file named P0232.java
public class P0232 {
       ^
1 error
Language: C

#include<stdio.h>

int x,y,z;
int v[4],n,e[50],a[50];
double dp[51][4901];

int min(int in1,int in2) {
	return in1>in2?in2:in1;
}
int max(int in1,int in2) {
	return in1<in2?in2:in1;
}

double dfs(int current,int money){
	double sum=0;
	int i,j;
	if(current==0) for(i=0;i<51;i++) for(j=0;j<4901;j++) dp[i][j]=-1;
	if(current==y) return (double)money;
	if(e[current]==2) money+=a[current];
	if(e[current]==3) money-=a[current];
	if(money<0) money=0;
	if(dp[current][money]!=-1.0) return dp[current][money];
	if(e[current]==1) sum+=dfs(current+a[current],money);
	else{
		for(i=0;i<x;i++){
			if(current+v[i]) sum+=dfs(min(current+v[i],y),money);
		}
	}
	return dp[current][money]=sum/(double)x;
}

int main(){
	int i;

	while(true){
		scanf("%d %d %d",&x,&y,&z);
		if(x+y+z==0) break;
		for(i=0;i<x;i++) scanf("%d",&v[i]);
		for(i=0;i<z;i++) {
			scanf("%d ",&n);
			scanf("%d %d",&e[n],&a[n]);
		}
		printf("%d\n",(int)dfs(0,0));
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:35:15: error: 'true' undeclared (first use in this function)
   35 |         while(true){
      |               ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include<stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:35:15: note: each undeclared identifier is reported only once for each function it appears in
   35 |         while(true){
      |               ^~~~
Language: C++

#include<iostream>
#include<algorithm>

int x, y, z;
double dp[51][5100];
int rulet[5];
std::pair<int, int>event[51];

int main(){

	memset(dp, 0, sizeof(dp));

	std::cin >> x >> y >> z;
	for (int i = 0; i < x; i++){
		std::cin >> rulet[i];
	}
	for (int i = 0; i < z; i++){
		int n, e, a;
		std::cin >> n >> e >> a;
		event[n] = std::make_pair(e, a);
	}

	dp[0][0] = 1.0;

	for (int i = 0; i < y; i++){
		for (int j = 0; j <= 5000; j++){
			if (dp[i][j] != 0){
				for (int k = 0; k < x; k++){
					int coin = j;
					int to = std::min(y, i + rulet[k]);
					int c = event[to].first;

					if (c == 1)to = std::min(y, to + event[to].second);
					else if (c == 2)coin += event[to].second;
					else if (c == 3)coin = std::max(0, coin - event[to].second);

					dp[to][coin] += dp[i][j] / x;
				}
			}
		}
	}

	double res = 0;
	for (int i = 0; i <= 5000; i++){
		res += i*dp[y][i];
	}
	std::cout << (int)res << std::endl;

	return 0;
}

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

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <complex>
#include <queue>
#include <deque>
#include <cmath>
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define REP(i,a) FOR(i,0,a)
#define FORE(i,a,b) for(int i=(a);i<=(int)(b);i++)
using namespace std;
typedef complex<int> cl;
typedef pair<double,int> pr;
typedef pair<pr,int> ppr;
typedef vector<pr> vpr;
const int INF=1<<30;
const int dx[]={0,1,0,-1},dy[]={1,0,-1,0};

double DP[51][5001]={};
int main() {
	int X,Y,Z;
	int tmp;
	while(cin >> X >> Y >>Z){
		REP(i,51)
			REP(j,5001)
				DP[i][j]=0;
	int event[51][2]={};
	int eye[4]={};
	REP(i,X)
		cin >> eye[i];
	REP(i,Z){
		cin >> tmp ;
		cin >>event[tmp][0] >> event[tmp][1];
	}
	DP[0][0]=1;
	REP(i,Y)
		REP(j,X)
			FORE(k,0,5000){
				double par=DP[i][k]/(double)X;
				if(par==0) continue;
				int money=k;
				int next=min(Y,i+eye[j]);
				switch(event[next][0]){
					case 1:
						next+=event[next][1];
						break;
					case 2:
						money+=event[next][1];
						break;
					case 3:
						money-=event[next][1];
						money=max(0,money);
						break;
				}
				DP[next][money]+=par;
			}/*
	double mean=0;
	FORE(i,1,5000){
		mean+=i*DP[Y][i];
	}
	cout << (int)mean<< endl;	
	}*/
	return 0;
}

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

#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
double EPS=1e-10;
int INF=1e9;
struct dat{
      int x,turn,sum;
      dat(){}
      dat(int x,int turn,int sum):x(x),turn(turn),sum(sum){}
};
int main(){
      int x,y,z;
      while(cin>>x>>y>>z&&(x||y||z)){
            int v[x],e1[y],e2[y];
            REP(i,x)cin>>v[i];
            REP(i,y)e1[i]=e2[i]=-1;
            REP(i,z){
                  int a,b,c;
                  cin>>a>>b>>c;
                  e1[a]=b;
                  e2[a]=c;
            }
            double ans=0;
            queue<dat> Q;
            Q.push((dat){0,0,0.0});
            while(!Q.empty()){
                  dat d=Q.front();Q.pop();
                  REP(i,x){
                        int np=d.x+v[i],ns=d.sum,nt=d.turn+1;
                        if(np>=y){
                              ans+=(double)ns/pow(x,nt);
                              continue;
                        }
                        if(np<0)np=0;
                        if(e1[np]==1){
                              np+=e2[np];
                        }else if(e1[np]==2){
                              ns+=e2[np];
                        }else if(e1[np]==3){
                              ns-=e2[np];
                        }
                        if(ns<0)ns=0;
                        if(np>=y){
                              ans+=ns/pow(x,nt);
                              continue;
                        }
                        Q.push((dat){np,nt,ns});
                  }
            }
            cout<<(int)ans<<endl;
      }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:33: error: narrowing conversion of '0.0' from 'double' to 'int' [-Wnarrowing]
   29 |             Q.push((dat){0,0,0.0});
      |                                 ^
Language: C++

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

int v[4];
int e[51];
int a[51];
double dp[51][5010][2];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int vn, g, en;
	while (cin >> vn >> g >> en , vn) {

		for (int i = 0; i < vn; i++) {
			cin >> v[i];
		}

		memset(e, 0, sizeof e);
		for (int i = 0; i < en; i++) {
			int n;
			cin >> n;
			cin >> e[n] >> a[n];
		}

		memset(dp, 0, sizeof dp);
		dp[0][0][0] = 1.0;

		for (int i = 0; i < g; i++) {
			for (int j = 0; j <= 5000; j++) {
				for (int skip = 0; skip <= 1; skip++) {
					if (dp[i][j][skip] == 0) continue;

					int nj = j;
					if (skip == 0) {
						if (e[i] == 1) {
							int ni = min(i + a[i], g);
							dp[ni][j][1] += dp[i][j][0];
							continue;
						}
						if (e[i] == 2) nj = j + a[i];
						if (e[i] == 3) nj = max(0, j - a[i]);
					}

					for (int k = 0; k < vn; k++) {
						int ni = min(i + v[k], g);
						dp[ni][nj][0] += dp[i][j][skip] / vn;
					}
				}
			}
		}

		double ans = 0;
		for (int j = 0; j <= 5000; j++) {
			for (int s = 0; s < 2; s++) {
				ans += j * dp[g][j][s];
			}
		}
		cout << int(ans) << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: 'memset' was not declared in this scope
   23 |                 memset(e, 0, sizeof e);
      |                 ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <algorithm>
  +++ |+#include <cstring>
    5 | using namespace std;