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

#include<iostream>
#include<functional>
#include<queue>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#define pb push_back
#define all(c) c.begin(),c.end()
#define uni(c) c.erase(unique(all(c)),c.end())
using namespace std;
typedef pair<int,vector<int> > P;
struct cmp {
  bool operator() (P a, P b) {
    return a.first > b.first;
  }
};

/*bool cmp(P a,P b){
	return a.first>b.first;
}*/
int main(){
	int n;
	vector<vector<int> > c(8,vector<int>(8));
	while(cin>>n){
		
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				cin>>c[i][j];
			}
		}
		priority_queue<P,vector<P>,greater<P> > que;
		vector<int> v(n);
		for(int i=0;i<n;i++){
			v[i]=i;
		}
		int ans=0;
		map<vector<int>,bool> used;
		que.push(P(0,v));
		while(!que.empty()){
			
			P p=que.top();
			que.pop();
			vector<int> now=p.second;
			if(used[now]){
				continue;
			}
			int np=p.first;
			used[now]=true;
			ans=max(ans,np);
			
			for(int i=0;i<n;i++)
			for(int j=i+1;j<n;j++){
				
				swap(now[i],now[j]);
				if(used[now]){
					swap(now[i],now[j]);
					continue;
				}
				//cout<<"--------"<<endl;
				que.push(P(np+c[now[i]][now[j]],now));
				swap(now[i],now[j]);
			}
			
			
		}
		cout<<ans<<endl;
	}
	return 0;
}

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

#include<iostream>
#include<functional>
#include<queue>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#define pb push_back
#define all(c) c.begin(),c.end()
#define uni(c) c.erase(unique(all(c)),c.end())
using namespace std;
typedef __int64 ll;
typedef pair<int,vector<int> > P;
int main(){
	int n;
	while(cin>>n){
		vector<vector<int> > c(n,vector<int>(n));
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				cin>>c[i][j];
			}
		}
		priority_queue<P,vector<P> , greater<P> > que;
		vector<int> v(n);
		for(int i=0;i<n;i++){
			v[i]=i;
		}
		int ans=0;
		map<vector<int>,bool> used;
		que.push(P(0,v));
		while(!que.empty()){
			
			P p=que.top();
			que.pop();
			vector<int> now=p.second;
			int np=p.first;
			if(used[now]){
				continue;
			}
			used[now]=true;
			ans=max(ans,np);
			
			for(int i=0;i<n;i++)
			for(int j=i+1;j<n;j++){
				
				swap(now[i],now[j]);
				if(used[now]){
					swap(now[i],now[j]);
					continue;
				}
				//cout<<"--------"<<endl;
				que.push(P(np+c[now[i]][now[j]],now));
				swap(now[i],now[j]);
			}
			
			
		}
		cout<<ans<<endl;
	}
	return 0;
}

Compiler output:
a.cc:13:9: error: '__int64' does not name a type; did you mean '__int64_t'?
   13 | typedef __int64 ll;
      |         ^~~~~~~
      |         __int64_t
Language: C

#include<stdio.h>
char S[9005],T[9005],a;
int i,j,k,s=0,rl=0;
int main()
{
	gets(S);
	for(i=0,j=0;S[i];j++)
	{
		T[j]=S[i];
		S[i]=='e'?i+=3:i+=7;
	}
	for(k=1;k<j;k++)
	{
		if(T[k-1]==T[k])
			if(rl<k-s)
			{
				a=T[k];
				rl=k-s;
				s=k;
			}
	}
	if(rl<k-s)
		a=T[k-1];
	puts(a=='e'?"egg":"chicken");
}

Compiler output:
main.c: In function 'main':
main.c:6:9: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    6 |         gets(S);
      |         ^~~~
      |         fgets
main.c:10:33: error: lvalue required as left operand of assignment
   10 |                 S[i]=='e'?i+=3:i+=7;
      |                                 ^~
Language: C

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

int main(){
  string s,ans;
  int num,cnt;
  char prv;

  cin >> s;
  cnt = 0; num = 0; prv = 'a';

  for(int i=0;i<(int)s.size();i++){
    if(s[i] != 'c' && s[i] !='e')cout << i << endl;
    if(prv != s[i]){
      cnt++; prv = s[i];
    }else{
      if(num < cnt){
	num = cnt;
	ans = (prv=='c')?"chicken":"egg";
	cnt = 1;
      }
    }
    if(s[i] == 'e')i += 2;
    else i += 6;
  }
  if(num < cnt)ans = (prv=='c')?"chicken":"egg";

  cout << ans << endl;
}

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

char s[9999],t[1001];
main(i,j,m,r){
	scanf("%s",&s);
	for(i=j=0;i<strlen(s);){
		if(s[i]=='e')t[j++]='e',i+=3;
		else t[j++]='c',i+=7;
	}
	t[j]=0;
	for(m=i=0;i<strlen(t);){
		c=t[i];
		for(j=i+1;j<strlen(t);j++)if(t[j]==t[i])break;
		if(m<j-i)m=j-i,r=t[j-1];
		i=j;
	}
	puts(r=='c'?"chicken":"egg");
	exit(0);
}

Compiler output:
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | main(i,j,m,r){
      | ^~~~
main.c: In function 'main':
main.c:2:1: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:2:1: error: type of 'j' defaults to 'int' [-Wimplicit-int]
main.c:2:1: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:2:1: error: type of 'r' defaults to 'int' [-Wimplicit-int]
main.c:3:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    3 |         scanf("%s",&s);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | char s[9999],t[1001];
main.c:3:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    3 |         scanf("%s",&s);
      |         ^~~~~
main.c:3:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:4:21: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
    4 |         for(i=j=0;i<strlen(s);){
      |                     ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'strlen'
  +++ |+#include <string.h>
    1 | char s[9999],t[1001];
main.c:4:21: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
    4 |         for(i=j=0;i<strlen(s);){
      |                     ^~~~~~
main.c:4:21: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:9:21: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
    9 |         for(m=i=0;i<strlen(t);){
      |                     ^~~~~~
main.c:9:21: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:10:17: error: 'c' undeclared (first use in this function)
   10 |                 c=t[i];
      |                 ^
main.c:10:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:9: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
   15 |         puts(r=='c'?"chicken":"egg");
      |         ^~~~
main.c:15:9: note: include '<stdio.h>' or provide a declaration of 'puts'
main.c:16:9: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
   16 |         exit(0);
      |         ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
  +++ |+#include <stdlib.h>
    1 | char s[9999],t[1001];
main.c:16:9: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
   16 |         exit(0);
      |         ^~~~
main.c:16:9: note: include '<stdlib.h>' or provide a declaration of 'exit'
Language: C

#include <iostream>
#include <algorithm>

using namespace std;

int main()
{

  int T;
  cin >> T;
  
  double e1 = 0, e2 = 0;
  for (int i = 0; i < T; i++) {
    double te = 0;
    int n, m;
    double rs = 0;
    cin >> n >> m;
    for (int j = 0; j < m; j++) {
      double v, r;
      cin >> v >> r;
      te += v * r;
      rs += r;
    }

    te /= rs;
    e1 = max(e1, te);
  }

  int p, q;
  double rs = 0;
  cin >> p >> q;
  for (int j = 0; j < q; j++) {
    double v, r;
    cin >> v >> r;
    e2 += v * r;
    rs += r;
  }

  e2 /= rs;
  cout << e1 << " " << e2 << endl;
  if ( (e1 - e2) > 0.0000001 )
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

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

main(){
srand(time(0));
srand(getchar());
puts(rand()%2?"YES":"NO");
}

Compiler output:
a.cc:1:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    1 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:2:7: error: 'time' was not declared in this scope
    2 | srand(time(0));
      |       ^~~~
a.cc:1:1: note: 'time' is defined in header '<ctime>'; this is probably fixable by adding '#include <ctime>'
  +++ |+#include <ctime>
    1 | main(){
a.cc:2:1: error: 'srand' was not declared in this scope
    2 | srand(time(0));
      | ^~~~~
a.cc:3:7: error: 'getchar' was not declared in this scope
    3 | srand(getchar());
      |       ^~~~~~~
a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | main(){
a.cc:4:6: error: 'rand' was not declared in this scope
    4 | puts(rand()%2?"YES":"NO");
      |      ^~~~
a.cc:4:1: error: 'puts' was not declared in this scope
    4 | puts(rand()%2?"YES":"NO");
      | ^~~~
Language: Java

import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;
public class Main {
	static int w;
	static int h;
	static int gx;
	static int gy;
	public static final int INF = 100000000;
	public static final int[] vx = {1,0,-1,0};
	public static final int[] vy = {0,-1,0,1};
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		w = sc.nextInt();
		h = sc.nextInt();
		char[][] s = new char[w][h];
		for (int y=0;y<h;y++) {
			String line = sc.next();
			for (int x=0;x<w;x++) {
				s[x][y] = line.charAt(x);
				if (s[x][y]=='t') {
					gx = x;
					gy = y;
				}
			}
		}
		int n = sc.nextInt();
		Pos2d[] open = new Pos2d[n];
		for(int i=0;i<n;i++) {
			open[i] = new Pos2d(sc.nextInt(),sc.nextInt());
		}

		int ans = -1;
		if (s[0][0]=='t') {
			ans = 0;
		}
		int[][] t = new int[w][h];
		for (int i=0;i<w;i++) {
			for (int j=0;j<h;j++) {
				t[i][j] = INF;
			}
		}
		t[0][0] = 0;

		boolean[] reach = new boolean[n];
		Queue<Pos2d> q = new ArrayDeque<Pos2d>();
		q.offer(new Pos2d(0,0));
		for(int time=0;time<=n;time++) {
			if (time!=0) {
				s[open[time-1].x][open[time-1].y] = '.';
				if (reach[time-1]) {
					q.offer(open[time-1]);
				}else{
					continue;
				}
			}
			while(!q.isEmpty() && ans==-1) {
				Pos2d p = q.poll();
				for(int i=0;i<4;i++) {
					int nx = p.x + vx[i];
					int ny = p.y + vy[i];
					if (nx>= 0 && nx<w && ny>=0 && ny<h) {
						if (s[nx][ny]!='#') {
							if (t[nx][ny]>t[p.x][p.y]) {
								t[nx][ny] = t[p.x][p.y];
								if (s[nx][ny]=='t') {
									ans = t[nx][ny];
								}
								q.offer(new Pos2d(nx,ny));
							}
						}else{
							if (t[nx][ny]>t[p.x][p.y]) {
								for(int j=0;j<n;j++) {
									if (open[j].equals(nx,ny)) {
										t[nx][ny] = max(j+1,t[p.x][p.y]);
										reach[j] = true;
									}
								}
							}
						}
					}
				}
			}
		}
		System.out.println(ans);
		sc.close();
	}
	public static int max(int x,int y) {
		return x>y?x:y;
	}
}

Compiler output:
Main.java:28: error: cannot find symbol
		Pos2d[] open = new Pos2d[n];
		^
  symbol:   class Pos2d
  location: class Main
Main.java:28: error: cannot find symbol
		Pos2d[] open = new Pos2d[n];
		                   ^
  symbol:   class Pos2d
  location: class Main
Main.java:30: error: cannot find symbol
			open[i] = new Pos2d(sc.nextInt(),sc.nextInt());
			              ^
  symbol:   class Pos2d
  location: class Main
Main.java:46: error: cannot find symbol
		Queue<Pos2d> q = new ArrayDeque<Pos2d>();
		      ^
  symbol:   class Pos2d
  location: class Main
Main.java:46: error: cannot find symbol
		Queue<Pos2d> q = new ArrayDeque<Pos2d>();
		                                ^
  symbol:   class Pos2d
  location: class Main
Main.java:47: error: cannot find symbol
		q.offer(new Pos2d(0,0));
		            ^
  symbol:   class Pos2d
  location: class Main
Main.java:58: error: cannot find symbol
				Pos2d p = q.poll();
				^
  symbol:   class Pos2d
  location: class Main
Main.java:69: error: cannot find symbol
								q.offer(new Pos2d(nx,ny));
								            ^
  symbol:   class Pos2d
  location: class Main
8 errors
Language: Java

import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;
public class Main {
	static int w;
	static int h;
	static int gx;
	static int gy;
	public static final int INF = 100000000;
	public static final int[] vx = {1,0,-1,0};
	public static final int[] vy = {0,-1,0,1};
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		w = sc.nextInt();
		h = sc.nextInt();
		char[][] s = new char[w][h];
		for (int y=0;y<h;y++) {
			String line = sc.next();
			for (int x=0;x<w;x++) {
				s[x][y] = line.charAt(x);
				if (s[x][y]=='t') {
					gx = x;
					gy = y;
				}
			}
		}
		int n = sc.nextInt();
		Pos2d[] open = new Pos2d[n];
		for(int i=0;i<n;i++) {
			open[i] = new Pos2d(sc.nextInt(),sc.nextInt());
		}

		int ans = -1;
		if (s[0][0]=='t') {
			ans = 0;
		}
		int[][] t = new int[w][h];
		for (int i=0;i<w;i++) {
			for (int j=0;j<h;j++) {
				t[i][j] = INF;
			}
		}
		t[0][0] = 0;

		boolean[] reach = new boolean[n];
		Queue<Pos2d> q = new ArrayDeque<Pos2d>();
		q.offer(new Pos2d(0,0));
		for(int time=0;time<=n;time++) {
			if (time!=0) {
				s[open[time-1].x][open[time-1].y] = '.';
				if (reach[time-1]) {
					q.offer(open[time-1]);
				}else{
					continue;
				}
			}
			while(!q.isEmpty() && ans==-1) {
				Pos2d p = q.poll();
				for(int i=0;i<4;i++) {
					int nx = p.x + vx[i];
					int ny = p.y + vy[i];
					if (nx>= 0 && nx<w && ny>=0 && ny<h) {
						if (s[nx][ny]!='#') {
							if (t[nx][ny]>t[p.x][p.y]) {
								t[nx][ny] = t[p.x][p.y];
								if (s[nx][ny]=='t') {
									ans = t[nx][ny];
								}
								q.offer(new Pos2d(nx,ny));
							}
						}else{
							if (t[nx][ny]>t[p.x][p.y]) {
								for(int j=0;j<n;j++) {
									if (open[j].equals(nx,ny)) {
										t[nx][ny] = max(j+1,t[p.x][p.y]);
										reach[j] = true;
									}
								}
							}
						}
					}
				}
			}
		}
		System.out.println(ans);
		sc.close();
	}
	public static int max(int x,int y) {
		return x>y?x:y;
	}
}
class Pos2d {
	public int x;
	public int y;
	public Pos2d(int x,int y) {
		this.x = x;
		this.y = y;
	}
	public boolean equals(Object o) {
		Pos2d p = (Pos2d) o;
		return (this.x==p.x && this.y==p.y);
	}
}

Compiler output:
Main.java:74: error: method equals in class Pos2d cannot be applied to given types;
									if (open[j].equals(nx,ny)) {
									           ^
  required: Object
  found:    int,int
  reason: actual and formal argument lists differ in length
1 error
Language: Java

import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;
public class Main {
	public static final int[] vx = {1,0,-1,0};
	public static final int[] vy = {0,-1,0,1};
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		char[][] s = new char[w][h];
		for (int y=0;y<h;y++) {
			String line = sc.next();
			for (int x=0;x<w;x++) {
				s[x][y] = line.charAt(x);
			}
		}
		int n = sc.nextInt();
		Pos2d[] open = new Pos2d[n];
		for(int i=0;i<n;i++) {
			open[i] = new Pos2d(sc.nextInt(),sc.nextInt());
		}

		int ans = -1;
		boolean[][] reach = new boolean[w][h];//壁にめり込むところまでtrue
		reach[0][0] = true;
		if (s[0][0]=='t') {
			ans = 0;
		}
		Queue<Pos2d> q = new ArrayDeque<Pos2d>();
		q.offer(new Pos2d(0,0));
		for(int time=0;time<=n;time++) {
			if (time!=0) {
				s[open[time-1].x][open[time-1].y] = '.';
				if (reach[open[time-1].x][open[time-1].y]) {
					q.offer(open[time-1]);
				}else{
					continue;
				}
			}
			while(!q.isEmpty()) {
				Pos2d p = q.poll();
				for(int i=0;i<4;i++) {
					int nx = p.x + vx[i];
					int ny = p.y + vy[i];
					if (nx>= 0 && nx<w && ny>=0 && ny<h) {
						if (!reach[nx][ny]) {
							reach[nx][ny] = true;
							if (s[nx][ny]=='t') {
								ans = time;
							}else if (s[nx][ny]!='#') {
								q.offer(new Pos2d(nx,ny));
							}
						}
					}
				}
			}
			if (ans!=-1) {
				break;
			}
		}
		System.out.println(ans);
		sc.close();
	}
}
public class Pos2d {
	public int x;
	public int y;
	public Pos2d(int x,int y) {
		this.x = x;
		this.y = y;
	}
}

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

//============================================================================
// Name        : 2364.cpp
// Author      : afterCmidday
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdlib>
#include <string>
#include <queue>
#include <utility>
using namespace std;

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

int main() {
	int h, w;
	int n, x, y, gy, gx;
	int shortest[100][100];

	memset(shortest,-1,sizeof(shortest));
	string mp[1000];
	cin >> h >> w;
	for(int i = 0;i < h;i++){
		cin >> mp[i];
	}
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> x >> y;
		mp[y][x] = 'c';
	}

	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++){
			if(mp[i][j] == 't'){
				gy = i;
				gx = j;
				mp[i][j] = '.';
			}
		}
	}
/*
	for(int i = 0;i < h;i++){
		cout << mp[i] << endl;
	}
*/


	queue<pair<pair<int,int>,int> > que; // first : place, second : cost

	que.push(make_pair(make_pair(0,0),0));
	shortest[0][0] = 0;
	while(que.size()){
		for(int i = 0;i < 4;i++){
			int ny = que.front().first.first + dy[i], nx = que.front().first.second + dx[i];
			int cost = que.front().second;
			if(0 <= nx && nx < w && 0 <= ny && ny< h && mp[ny][nx] != '#'){
				if(mp[ny][nx] == 'c' && (shortest[ny][nx] == -1 || shortest[ny][nx] > cost + 1)){
					shortest[ny][nx] = cost + 1;
					que.push(make_pair(make_pair(ny,nx),cost + 1));
				}else if(mp[ny][nx] == '.' && (shortest[ny][nx] == -1 || shortest[ny][nx] > cost)){
					shortest[ny][nx] = cost;
					que.push(make_pair(make_pair(ny,nx),cost));
				}
			}
		}
		que.pop();
	}
	/*
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++){
			cout << shortest[i][j] << " ";
		}
		cout << endl;
	}
	cout << endl;*/
	cout << shortest[gy][gx] << endl;
	return 0;
}

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

#include<iostream>
#include<queue>
using namespace std;
char T[1003][1003];
int V[1003][1003];
int H, W, N, SX, SY, X, Y; int OK = -1;
inline void P(int x, int y) {
	if (x <= -1 || y <= -1) return;
	if (V[x][y] == 0 && T[x][y] == '.') {
		Q.push(make_pair(x, y));
		V[x][y] = 1;
	}
}
inline bool bfs() {
	queue<pair<int, int> >Q;
	for (int i = 0; i < 1000; i++) {
		for (int j = 0; j < 1000; j++) {
			V[i][j] = 0;
		}
	}
	Q.push(make_pair(0, 0));
	V[0][0] = 1;
	while (!Q.empty()) {
		pair<int, int>pa = Q.front();
		if (V[SX][SY] == 1)return true;
		Q.pop();
		P(pa.first - 1, pa.second);
		P(pa.first + 1, pa.second);
		P(pa.first, pa.second - 1);
		P(pa.first, pa.second + 1);
	}
	return false;
}
int main() {
	cin >> W >> H;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> T[i][j];
			if (T[i][j] == 't') {
				SX = i; SY = j;
				T[i][j] = '.';
			}
		}
	}
	if (bfs() == true) {
		OK = 0;
	}
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> X >> Y;
		T[Y][X] = '.';
		if (bfs() == true && OK == -1) {
			OK = i;
		}
	}
	cout << OK << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void P(int, int)':
a.cc:10:17: error: 'Q' was not declared in this scope
   10 |                 Q.push(make_pair(x, y));
      |                 ^
Language: C++

#include <iostream>
#include <queue>

using namespace std;

struct State {
  int x, y, t;
  State (int x, int y, int t): x(x), y(y), t(t) {

  }

  bool operator<(const State & rhs) const {
    return t > rhs.t;
  }
};

const int MAX_W = 1000, MAX_H = 1000;
const int dx[] = {0, 1, 0, -1}, dy[] = {-1, 0, 1, 0};

int W, H, N, gx, gy;
char field[MAX_W][MAX_H];

void solve()
{
  priority_queue<State> que;
  que.push(State(0, 0, 0));
  int ans = -1;
  bool visited[MAX_H][MAX_W];
  memset(visited, false, sizeof(visited));
  while (!que.empty()) {
    State s = que.top();
    que.pop();
    int x = s.x, y = s.y, t = s.t;
    if (visited[y][x]) {
      continue;
    }

    if (x == gx && y == gy) {
      ans = t;
      break;
    }

    visited[y][x] = true;
    for (int k = 0; k < 4; k++) {
      int nx = x + dx[k], ny = y + dy[k];
      if (nx < 0 || nx >= W || ny < 0 || ny >= H 
       || field[ny][nx] == '#' || visited[ny][nx]) {
        continue;
      }


      int nt = t;
      if (field[ny][nx] != '.') {
        if ((field[ny][nx] - '0' - t) > 1) {
          continue;
        }

        nt = max(nt, field[ny][nx] - '0');
      }

      que.push(State(nx, ny, nt));
    }
  }

  cout << ans << endl;
}

int main()
{
  cin >> W >> H;
  memset(field, '#', sizeof(field));

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> field[i][j];
      if (field[i][j] == 't') {
        gx = j; gy = i;
        field[i][j] = '.';
      }
    }
  }

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

Compiler output:
a.cc: In function 'void solve()':
a.cc:29:3: error: 'memset' was not declared in this scope
   29 |   memset(visited, false, sizeof(visited));
      |   ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <queue>
  +++ |+#include <cstring>
    3 | 
a.cc: In function 'int main()':
a.cc:71:3: error: 'memset' was not declared in this scope
   71 |   memset(field, '#', sizeof(field));
      |   ^~~~~~
a.cc:71:3: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair

using namespace std;

typedef pair<int, int> P;

vector<P> open;
int gx, gy;
int W, H, N;
char field[1002][1002];

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

bool visit[1001][1001];
bool check(int n){
	memset(visit, 0, sizeof(visit));

	rep(i, n){
		field[open[i].second][open[i].first] = '.';
	}
	for(int i = n; i < open.size(); i++){
		field[open[i].second][open[i].first] = '#';
	}

	//rep(i, 10){
	//	rep(j, 10){
	//		cout << field[i][j];
	//	}cout << endl;
	//}cout << endl;

	queue<P> q;
	q.push(MP(0, 0));

	while(!q.empty()){
		P p = q.front();
		q.pop();
		
		if(visit[p.second][p.first]) continue;
		visit[p.second][p.first] = true;

		if(field[p.second][p.first] == 't') return true;

		rep(i, 4){
			int nx = p.first+dx[i], ny = p.second+dy[i];
			if(nx < 0 || nx >= W || ny < 0 || ny >= H) continue;
			if(field[ny][nx] != '#') q.push(MP(nx, ny));
		}
	}

	return false;
}

int main(){
	cin >> W >> H;
	rep(i, H) rep(j, W) cin >> field[i][j];
	cin >> N;
	rep(i, N){
		int x, y;
		cin >> x >> y;
		if(field[y][x] == '.'){
			x = y = 1001;
		}
		open.push_back(MP(x, y));
	}
	int lb = -1, ub = N+1;
	while(ub - lb > 1){
		int mid = (lb+ub)/2;
		if(check(mid))ub = mid;
		else lb = mid;
	}
	if(ub == N+1) ub = -1;
	cout << ub << endl;

	return 0;
}

Compiler output:
a.cc: In function 'bool check(int)':
a.cc:24:9: error: 'memset' was not declared in this scope
   24 |         memset(visit, 0, sizeof(visit));
      |         ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <queue>
  +++ |+#include <cstring>
    6 |
Language: C++

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

#define INF 1000000

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int d[1100][1100];
char store[1100][1100];

bool bfs(int w,int h,int sy,int sx,int gy,int gx){
	queue<P> que;
	for(int i=0;i<1100;i++){
		for(int j=0;j<1100;j++){
			d[i][j]=INF;
		}
	}
	d[sy][sx]=0;
	que.push(P(sy,sx));
	
	while(que.size()){
		P p=que.front();que.pop();
		if(p.first==gy&&p.second==gx) break;
	
		for(int i=0;i<4;i++){
			int ny=p.first+dy[i],nx=p.second+dx[i];
			if(ny>=0 && nx>=0 && ny<h && nx<w && store[ny][nx]!='#' && d[ny][nx]==INF){
				d[ny][nx]=d[p.first][p.second]+1;
				que.push(P(ny,nx));
			}
		}
	}
	
	return d[gy][gx]!=INF;
}

int main(){
	int w,h,n;
	int gx,gy;
	P open[1100];
	cin>>w>>h;
	
	for(int i=0;i<1100;i++){
		for(int j=0;j<1100;j++){
			store[i][j]='#';
		}
	}

	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>store[i][j];
			if(store[i][j]=='t'){
				gx=j;gy=i;
		}
	}
	
	cin>>n;
	for(int i=1;i<=n;i++){
		int x,y;
		cin>>x>>y;
		open[i]=P(y,x);
	}
	
	for(int i=0;i<=n;i++){
		if(i>0) store[open[i].first][open[i].second]='.';
		if(bfs(w,h,0,0,gy,gx)) {
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
	return 0;
}

			

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

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

#define INF 1000000

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int d[1100][1100];
char store[1100][1100];

bool bfs(int w,int h,int sy,int sx,int gy,int gx){
	queue<P> que;
	d[sy][sx]=0;
	que.push(P(sy,sx));
	
	while(que.size()){
		P p=que.front();que.pop();
		if(p.first==gy&&p.second==gx) break;
	
		for(int i=0;i<4;i++){
			int ny=p.first+dy[i],nx=p.second+dx[i];
			if(ny>=0 && nx>=0 && ny<h && nx<w && store[ny][nx]!='#' && d[ny][nx]==INF){
				d[ny][nx]=d[p.first][p.second]+1;
				que.push(P(ny,nx));
			}
		}
	}
	
	return d[gy][gx]!=INF;
}

int main(){
	int w,h,n;
	int gx,gy;
	bool flag=false;
	P open[1100];
	cin>>w>>h;
	
	/*for(int i=0;i<1100;i++){
		for(int j=0;j<1100;j++){
			store[i][j]='#';
		}
	}*/
	
	for(int i=0;i<1100;i++){
		for(int j=0;j<1100;j++){
			d[i][j]=INF;
		}
	}

	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>store[i][j];
			if(store[i][j]=='t'){
				gx=j;gy=i;
			}
		}
	}
	
	cin>>n;
	for(int i=1;i<=n;i++){
		int x,y;
		cin>>x>>y;
		open[i]=P(y,x);
	}
	
	for(int i=0;i<=n;i++){
		if(i>0){
			store[open[i].first][open[i].second]='.';
			for(int j=0;j<4;j++){
				int ny=open[i].first+dy[j],nx=open[i].second+dx[j]
				if(ny>=0 && nx>=0 && ny<h && nx<w && d[ny][nx]!=INF) flag=true;
			}
		}
		if((i==0 && bfs(w,h,0,0,gy,gx)) || (i>0 && flag && bfs(w,h,open[i].first,open[i].second,gy,gx))) {
			cout<<i<<endl;
			return 0;
		}
		flag=false;
	}
	cout<<-1<<endl;
	return 0;
}

			

Compiler output:
a.cc: In function 'int main()':
a.cc:74:33: error: expected ',' or ';' before 'if'
   74 |                                 if(ny>=0 && nx>=0 && ny<h && nx<w && d[ny][nx]!=INF) flag=true;
      |                                 ^~
Language: C++

10 10
.....#....
.....#....
.....#....
######....
..........
####......
....###...
t..#..####
...##.....
....#...##
3
0 3
0 5
4 6

Compiler output:
a.cc:2:6: error: stray '#' in program
    2 | .....#....
      |      ^
a.cc:3:6: error: stray '#' in program
    3 | .....#....
      |      ^
a.cc:4:6: error: stray '#' in program
    4 | .....#....
      |      ^
a.cc:5:1: error: stray '##' in program
    5 | ######....
      | ^~
a.cc:5:3: error: stray '##' in program
    5 | ######....
      |   ^~
a.cc:5:5: error: stray '##' in program
    5 | ######....
      |     ^~
a.cc:7:1: error: stray '##' in program
    7 | ####......
      | ^~
a.cc:7:3: error: stray '##' in program
    7 | ####......
      |   ^~
a.cc:8:5: error: stray '##' in program
    8 | ....###...
      |     ^~
a.cc:8:7: error: stray '#' in program
    8 | ....###...
      |       ^
a.cc:9:4: error: stray '#' in program
    9 | t..#..####
      |    ^
a.cc:9:7: error: stray '##' in program
    9 | t..#..####
      |       ^~
a.cc:9:9: error: stray '##' in program
    9 | t..#..####
      |         ^~
a.cc:10:4: error: stray '##' in program
   10 | ...##.....
      |    ^~
a.cc:11:5: error: stray '#' in program
   11 | ....#...##
      |     ^
a.cc:11:9: error: stray '##' in program
   11 | ....#...##
      |         ^~
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 10 10
      | ^~
Language: C++

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

const int NOT_ASIGNED = -1;
const int FREE = -2;
int n = 1;
int m;
int pos;
int sum = 0;
char str[1000];
int variable[200];
int pointer[10000];

int Expr();
int Malloc(int s) {
  if (sum + s > m) { return 0; }
  pointer[n++] = s;
  sum += s;
  return -(n - 1);
}

int Clone(int p) {
  if (p == 0) { return 0; }
  if (p > 0 || pointer[-p] == NOT_ASIGNED || pointer[-p] == FREE) { throw 1; }
  return Malloc(pointer[-p]);
}

void Free(int p) {
  if (p == 0) { return; }
  if (p > 0 || pointer[-p] == NOT_ASIGNED || pointer[-p] == FREE) { throw 1; }
  sum -= pointer[-p];
  pointer[-p] = FREE;
}

int Number() {
  int ret = 0;
  while (isdigit(str[pos])) {
    ret = ret * 10 + (str[pos] - '0');
    pos++;
  }
  return ret;
}

int Expr() {
  int lhs;
  if (str[pos] == '(') {
    pos++;
    lhs = Expr();
    assert(str[pos] == ')');
    pos++;
  } else if (str[pos] == 'N' && str[pos + 1] == 'U') {
    lhs = 0;
    pos += 4;
  } else if (str[pos] == 'm') {
    pos += 7;
    int s = Number();
    lhs = Malloc(s);
    assert(str[pos] == ')');
    pos++;
  } else if (str[pos] == 'c') {
    pos += 6;
    int p = Expr();
    lhs = Clone(p);
    assert(str[pos] == ')');
    pos++;
  } else {
    assert(isupper(str[pos]));
    int p = str[pos] - 'A';
    pos++;
    if (str[pos] == '=') {
      pos++;
      int rhs = Expr();
      variable[p] = rhs;
    }
    lhs = variable[p];
  }
  return lhs;
}

void Line() {
  if (str[pos] == 'f') {
    pos += 5;
    int p = Expr();
    Free(p);
    assert(str[pos] == ')');
    pos++;
  } else {
    Expr();
  }
}

int main() {
  MEMSET(variable, 0x0f);
  MEMSET(pointer, -1);
  pointer[0] = 0;
  scanf("%d", &m);
  try {
    gets(str);
    while (gets(str)) {
      pos = 0;
      Line();
    }
    REP(i, 200) {
      if (variable[i] <= 0) { pointer[-variable[i]] = 0; }
    }
    int ans = 0;
    REP(i, n) {
      if (pointer[i] == FREE) { continue; }
      ans += pointer[i];
    }
    printf("%d\n", ans);
  } catch (int x) {
    puts("Error");
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:120:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
  120 |     gets(str);
      |     ^~~~
      |     getw
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
#include <map>
 
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
 
using namespace std;
 
typedef pair<int, int> P;
 
bool error;
int M;
int rest;

map<char, int> val;
vector<int> memory;

char expr(const string &s);

char assign(const string &s){
	val[s[0]] = val[expr(s.substr(2))];
	return s[0];
}

char malloc(const string &s){
	int mem = atoi(s.substr(7).c_str());
	if(mem > rest) return 'n';
	rest -= mem;
	memory.push_back(mem);
	val['-'] = memory.size()-1;
	return '-';
}

char clone(const string &s){
	char c = expr(s.substr(6, s.size()-7));
	if(c == 'n') return;
	if(val[c] == -1) error = true;
	else{
		int mem = memory[val[c]];
		if(mem > rest) return 'n';
		rest -= mem;
		memory.push_back(mem);
		val['-'] = memory.size()-1;
	}
	return '-';	
}

char expr(const string &s){
	if(s.size() == 1) return s[0];
	if(s[1] == '=') return assign(s);
	if(s[0] == '(') return expr(s);
	if(s[0] == 'm') return malloc(s);
	if(s[0] == 'c') return clone(s);
	return 'n';
}

void free(const string &s){
	char c = expr(s.substr(5, s.size()-6));
	if(c == 'n') return;
	if(val[c] == -1) error = true;
	else{
		rest += memory[val[c]];
		memory[val[c]] = 0;
		val[c] = -1;
	}
}

void line(const string &s){
	if(s[0] == 'f'){
		free(s);
	}else{
		expr(s);
	}
}

void init(){
	for(int i = 'A'; i <= 'Z'; i++){
		val[i] = -1;
	}
	val['-'] = -1;
	val['n'] = 0;
	memory.push_back(0);
	rest = M;
}

int check(){
	for(int i = 'A'; i <= 'Z'; i++){
		if(val[i] != -1){
			string s = "free";
			free(s+'('+(char)i+')');
		}
	}

	return M-rest;
}

int main(){
	cin >> M;
	init();
	string s;
	while(cin >> s) line(s);

	if(error) cout << "Error" << endl;
	else cout << check() << endl;

	return 0;
}

Compiler output:
a.cc: In function 'char clone(const std::string&)':
a.cc:41:22: error: return-statement with no value, in function returning 'char' [-fpermissive]
   41 |         if(c == 'n') return;
      |                      ^~~~~~
Language: C++

#include<cstdio>
#include<vector>

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

using namespace std;

const int INF=1<<29;

int main(){
	int n,m,W; scanf("%d%d%d",&n,&m,&W); m--;
	vector<int> floor[10000],a; // eKÉ é×¨, ×¨Ìd³
	rep(i,n){
		int k; scanf("%d",&k);
		floor[i].resize(k);
		rep(j,k){
			int w; scanf("%d",&w);
			floor[i][j]=a.size();
			a.push_back(w);
		}
	}

	static int sum[1<<15];
	rep(S,1<<a.size()) rep(i,a.size()) if(S&(1<<i)) sum[S]+=a[i];

	static int dp[1<<15];
	rep(S,1<<a.size()) dp[S]=(S==0?0:INF);
	rep(S,1<<a.size()) for(int T=S;T;T=T-1&S) {
		if(sum[T]<=W) dp[S]=min(dp[S],dp[S-T]+1);
	}

	int top=0;
	rep(i,n) if(floor[i].size()>0) top=i;

	if(top==0){ puts("0"); return 0; }

	int ans=abs(m-top),S=0;
	for(int i=top;i>0;i--){
		rep(j,floor[i].size()) S|=1<<floor[i][j];
		ans+=2*dp[S]-1;
	}
	printf("%d\n",ans);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:17: error: 'abs' was not declared in this scope; did you mean 'ans'?
   37 |         int ans=abs(m-top),S=0;
      |                 ^~~
      |                 ans
a.cc:39:40: error: 'S' was not declared in this scope
   39 |                 rep(j,floor[i].size()) S|=1<<floor[i][j];
      |                                        ^
a.cc:40:27: error: 'S' was not declared in this scope
   40 |                 ans+=2*dp[S]-1;
      |                           ^
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };
bool valid_pos(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; }



int main()
{
	ios::sync_with_stdio(false);

	int n, m, W, w[16], K = 0;
	cin >> n >> m >> W;
	--m;
	int f[12345], top;
	for (int i = 0; i < n; ++i)
	{
		int k;
		cin >> k;
		int s = 0;
		for (int j = 0; j < k; ++j, ++K)
		{
			cin >> w[K];
			s |= 1 << K;
		}
		f[i] = s;
		if (s)
			top = i;
	}
	if (f[0] == (1 << K) - 1)
	{
		cout << 0 << endl;
		return 0;
	}

	int sum_w[1 << 15];
	for (int i = 0; i < 1 << K; ++i)
	{
		int s = 0;
		for (int j = 0; j < K; ++j)
			if (i >> j & 1)
				s += w[j];
		sum_w[i] = s;
	}

	int dp[1 << 15];
	dp[0] = 0;
	for (int S = 1; S < 1 << K; ++S)
	{
		dp[S] = 1 << 27;
		for (int T = S; T > 0; T = --T & S)
		{
			if (sum_w[T] <= W)
				min_swap(dp[S], dp[S ^ T] + 1);
		}
	}

	int rider = 0;
	int res = abs(m - top);
	for (int i = top i > 0; --i)
	{
		rider |= f[i];
		res += dp[rider] * 2 - 1;
	}
	cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:106:25: error: expected ';' before 'i'
  106 |         for (int i = top i > 0; --i)
      |                         ^~
      |                         ;
Language: C++

#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

template <unsigned T>
bool prevSubset(bitset<T>& bs, const bitset<T>& mask)
{
    if(bs.none())
        return false;
    bs = bs.to_ulong() - 1ull;
    bs &= mask;
    return true;
}

int solve(vector<int>& w, int limit)
{
    int n = w.size();
    vector<int> dp(1<<n, INT_MAX/2);
    dp[(1<<n)-1] = 0;
    for(int i=(1<<n)-1; i>0; --i){
        bitset<15> mask(i);
        bitset<15> bs(i);
        do{
            int sum = 0;
            for(int j=0; j<n; ++j){
                if(bs[j])
                    sum += w[j];
            }
            if(sum <= limit)
                dp[(mask^bs).to_ulong()] = min(dp[(mask^bs).to_ulong()], dp[i] + 1);
        }while(prevSubset(bs, mask));
    }

    return dp[0];
}

int main()
{
    int n, m, limit;
    cin >> n >> m >> limit;

    vector<vector<int> > w(n);
    for(int i=0; i<n; ++i){
        int k;
        cin >> k;
        w[i].resize(k);
        for(int j=0; j<k; ++j)
            cin >> w[i][j];
    }

    vector<int> a;
    int prev = 0;
    int ret = 1 - m;
    for(int i=n-1; i>=0; --i){
        ret += prev * 2;
        if(w[i].size() > 0){
            for(unsigned j=0; j<w[i].size(); ++j)
                a.push_back(w[i][j]);
            prev = solve(a, limit);
        }
    }

    cout << max(0, ret) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int solve(std::vector<int>&, int)':
a.cc:46:26: error: no matching function for call to 'prevSubset(std::bitset<15>&, std::bitset<15>&)'
   46 |         }while(prevSubset(bs, mask));
      |                ~~~~~~~~~~^~~~~~~~~~
a.cc:21:6: note: candidate: 'template<unsigned int T> bool prevSubset(std::bitset<T>&, const std::bitset<T>&)'
   21 | bool prevSubset(bitset<T>& bs, const bitset<T>& mask)
      |      ^~~~~~~~~~
a.cc:21:6: note:   template argument deduction/substitution failed:
a.cc:46:26: note:   mismatched types 'unsigned int' and 'long unsigned int'
   46 |         }while(prevSubset(bs, mask));
      |                ~~~~~~~~~~^~~~~~~~~~
Language: C++

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int n, m, k;
char input[6][500];
char str[10000100];
set<string> opened;

string Open(int &pos) {
  string ret;
  while (input[5][pos] != '\0' && input[5][pos] != ')') {
    if (isdigit(input[5][pos])) {
      int num = atoi(input[5] + pos);
      int v = 0;
      while (isdigit(input[5][pos])) { pos++; v++; }
      assert(v <= 7);
ツ　ツ　ツ　assert(num != 0);
      assert(input[5][pos] == '(');
      pos++;
      string nret = Open(pos);
      assert(input[5][pos] == ')');
      pos++;
      num = min(num, max(2, (m + (int)nret.size() - 1) / (int)nret.size()));
      if (nret.size() >= 400) {
        if (opened.count(nret)) { num = 1; }
        opened.insert(nret);
      }
      string add;
      REP(i, num) { add += nret; }
      if (add.size() >= 400) { opened.insert(add); }
      ret += add;
    } else {
      ret += input[5][pos++];
    }
  }
  assert((int)ret.size() <= 10000000);
  return ret;
}

int main() {
  while (scanf("%d %d %d", &n, &m, &k) > 0) {
    opened.clear();
    scanf("%s", input[5]);
    REP(i, k) {
      scanf("%s", input[i]);
    }
    {
      int pos = 0;
      string s = Open(pos);
      sprintf(str, "%s", s.c_str());
    }
    int ans = -1;
    int maxValue = -1;
    REP(iter, k) {
      int lv = 0;
      REP(r, m) {
        REP(l, r + 1) {
          char c = input[iter][r + 1];
          input[iter][r + 1] = 0;
          lv += strstr(str, input[iter] + l) != NULL;
          input[iter][r + 1] = c;
        }
      }
      if (lv > maxValue) {
        ans = iter + 1;
        maxValue = lv;
      }
    }
    printf("%d %d\n", ans, maxValue);
  }
}

Compiler output:
a.cc:39:1: error: extended character 　 is not valid in an identifier
   39 | ツ　ツ　ツ　assert(num != 0);
      | ^
a.cc:39:1: error: extended character 　 is not valid in an identifier
a.cc:39:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'std::string Open(int&)':
a.cc:39:1: error: 'ツ　ツ　ツ　assert' was not declared in this scope
   39 | ツ　ツ　ツ　assert(num != 0);
      | ^~~~~~~~~~~~~~~~~~
Language: Java


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

public class Main {
	FastScanner in = new FastScanner(System.in);
	PrintWriter out = new PrintWriter(System.out);
	HashMap<String, Boolean> hash = new HashMap<String, Boolean>();
	boolean check(String s) {
		if (s.isEmpty()) return true;
		if (hash.containsKey(s)) return hash.get(s);
		int len = s.length();
		if (s.charAt(0) != 'm' || s.charAt(len-1) != 'w') {
			hash.put(s, false);
			return false;
		}

		for (int i = 1; i < len - 1; i++) {
			if (s.charAt(i) == 'e') {
				if (check(s.substring(1, i)) && check(s.substring(i+1, len - 1))) {
					hash.put(s, true);
					return true;
				}
			}
		}
		
		hash.put(s, false)
		return false;
	}
	
	public void run() {
		String s = in.next();
		System.out.println(check(s) ? "Cat" : "Rabbit");
		out.close();
	}

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

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}

		System.out.println("----------------------------");
		System.out.println();
	}

	public void debug(Object... obj) {
		System.out.println(Arrays.deepToString(obj));
	}

	class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
			//stream = new FileInputStream(new File("dec.in"));

		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}

Compiler output:
Main.java:27: error: ';' expected
		hash.put(s, false)
		                  ^
1 error
Language: C

#include<stdio.h>
int dp[501][501];
char s[501];

int f(int l, int r){
 int m;
 if(dp[l][r] >= 0) return dp[l][r];
 if(r-l == 0) return 1;
 if(s[l] != 'm' || s[r-1] !='w')
  return 0;
 for(m = l+1; m < r-1; m++){
  if(s[m] == 'e'){
   if(f(l+1, m) && f(m+1, r-1)){
    return 1;
   }
  }
 }
 return 0;
}

 int main(){
  scanf("%s",s);
  for(i=0;s[i]!='\0';i++)s[-1];
  if (f(0,i)==1) puts("Cat");
  else puts("Rabbit");
  return 0;
 }
}

Compiler output:
main.c: In function 'main':
main.c:23:7: error: 'i' undeclared (first use in this function)
   23 |   for(i=0;s[i]!='\0';i++)s[-1];
      |       ^
main.c:23:7: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:28:1: error: expected identifier or '(' before '}' token
   28 | }
      | ^
Language: C

#include<stdio.h>
int dp[501][501];
char s[501];

int f(int l, int r){
 int m;
 if(dp[l][r] >= 0) return dp[l][r];
 if(r-l == 0) return 1;
 if(s[l] != 'm' || s[r-1] !='w')
  return 0;
 for(m = l+1; m < r-1; m++){
  if(s[m] == 'e'){
   if(f(l+1, m) && f(m+1, r-1)){
    return 1;
   }
  }
 }
 return 0;
}

 int main(){
  int i;
  scanf("%s",s);
  for(i=0;s[i]!='\0';i++)s[-1];
  if (f(0,i)==1) puts("Cat");
  else puts("Rabbit");
  return 0;
 }
}

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

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

char str[1024];
bool f[1024][1024];

int main()
{
	scanf("%s", str);
	int n = strlen(str);
	for (int i = 0; i < n; i++){
		f[i][i] = true;
	}
	for (int t = 0; t < n; t++){
	{
	for (int w1 = 0; w1 < n; w1 += 3){
		for (int w2 = 0; w2 < n; w2 += 3){
			for (int i = 0; i < n; i++){
				int j = i + w1 + 1;
				int k = i + w1 + w2 + 2;
				if (str[i] != 'm') continue;
				if (str[j] != 'e') continue;
				if (str[k] != 'w') continue;
				if (!f[i + 1][j]) continue;
				if (!f[j + 1][k]) continue;
				f[i][k + 1] = true;
			}
		}
	}
	}
	puts(f[0][n] ? "Cat" : "Rabbit");
}

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

#include<iostream>
#include<string>
using namespace std;
string S;
int main() {
	cin >> S;
	for (int i = 0; i < S.size() - 1; i++) {
		if (S.substr(i, 2) == "mw") { cout << "Rabbit" << endl; goto E:; }
	}
	cout << "Cat" << endl;
E:;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:79: error: expected ';' before ':' token
    8 |                 if (S.substr(i, 2) == "mw") { cout << "Rabbit" << endl; goto E:; }
      |                                                                               ^
      |                                                                               ;
a.cc:8:79: error: expected primary-expression before ':' token
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)

int main()
{
	string S;
	cin >> S;

	if (S == "") cout << "Cat" << endl;

	int m = S.find("m");
	int r = S.rfind("w");
	if (m != -1 && r != -1) {
		int e = S.find("e", m + 2);

		if (e != -1 && e < r - 1) {
			cout << "Cat" << endl;
			return 0;
		}
	}

	cout << "Rabbit" << endl;
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:26:18: error: expected '}' at end of input
   26 |         return 0;
      |                  ^
a.cc:8:1: note: to match this '{'
    8 | {
      | ^