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

#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int solve(int x, int y, int w, int h, vector<vector<int> > &f)
{
int ans = 0;

if(f[x][y] == 0)
return 0;

f[x][y] = 0;

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

for(int i = 0; i < 4; ++i) {
int nx = dx[i] + x;
int ny = dy[i] + y;
if(nx < 0 || ny < 0 || nx >= w || ny >= h)
continue;
int tmp = solve(nx, ny, w, h, f);
ans = max(ans, tmp);
}

f[x][y] = 1;

return ans + 1;
}

int main()
{
while(true) {
int w, h;
vector<vector<int> f;
scanf("%d%d", &w, &h);
if(w == 0)
break;
f.resize(w);
for(int i = 0; i < w; ++i)
f[i].resize(h);
for(int y = 0; y < h; ++y) {
for(int x = 0; x < w; ++x)
scanf("%d", &f[x][y]);
}
int ans = 0;
for(int x = 0; x < w; ++x) {
for(int y = 0; y < h; ++y)
ans = max(ans, solve(x, y, w, h, f));
}
printf("%d\n", ans);
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:20: error: template argument 1 is invalid
   36 | vector<vector<int> f;
      |                    ^
a.cc:36:20: error: template argument 2 is invalid
a.cc:40:1: error: 'f' was not declared in this scope
   40 | f.resize(w);
      | ^
Language: C++

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

int map[90][90],m,n;

int main(){
    int x,max = 0,i,j;
    memset(map,0,sizeof(map));
    scanf("%d",&m);
    scanf("%d",&n);
    for(i=0;i<m;i++){
        for(j=0;j<n;j++)scanf("%d",&map[i][j]);
    }
    for(i=0;i<m;i++){
        for(j=0;j<n;j++){
            x = rec(i,j);
            if(max < x)max = x;
        }
    }
    printf("%d\n",max);
}

int rec(i,j){
    int max = 0,x;
    if(map[i][j] == 0)return 0;
    map[i][j] = 0;
    if(i > 0){
        x = rec(i-1,j);
        if(max < x)max = x;
    }
    if(i+1 < m){
        x = rec(i+1,j);
        if(max < x)max = x;
    }
    if(j > 0){
        x = rec(i,j-1);
        if(max < x)max = x;
    }
    if(j+1 < n){
        x = rec(i,j+1);
        if(max < x)max = x;
    }
    map[i][j] = 1;
    return max + 1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: 'rec' was not declared in this scope
   16 |             x = rec(i,j);
      |                 ^~~
a.cc: At global scope:
a.cc:23:9: error: 'i' was not declared in this scope
   23 | int rec(i,j){
      |         ^
a.cc:23:11: error: 'j' was not declared in this scope
   23 | int rec(i,j){
      |           ^
a.cc:23:12: error: expression list treated as compound expression in initializer [-fpermissive]
   23 | int rec(i,j){
      |            ^
Language: C++

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

int map[90][90],m,n;
int rec(i,j);

int main(){
    int x,max = 0,i,j;
    memset(map,0,sizeof(map));
    scanf("%d",&m);
    scanf("%d",&n);
    for(i=0;i<m;i++){
        for(j=0;j<n;j++)scanf("%d",&map[i][j]);
    }
    for(i=0;i<m;i++){
        for(j=0;j<n;j++){
            x = rec(i,j);
            if(max < x)max = x;
        }
    }
    printf("%d\n",max);
}

int rec(i,j){
    int max = 0,x;
    if(map[i][j] == 0)return 0;
    map[i][j] = 0;
    if(i > 0){
        x = rec(i-1,j);
        if(max < x)max = x;
    }
    if(i+1 < m){
        x = rec(i+1,j);
        if(max < x)max = x;
    }
    if(j > 0){
        x = rec(i,j-1);
        if(max < x)max = x;
    }
    if(j+1 < n){
        x = rec(i,j+1);
        if(max < x)max = x;
    }
    map[i][j] = 1;
    return max + 1;
}

Compiler output:
a.cc:5:9: error: 'i' was not declared in this scope
    5 | int rec(i,j);
      |         ^
a.cc:5:11: error: 'j' was not declared in this scope
    5 | int rec(i,j);
      |           ^
a.cc:5:12: error: expression list treated as compound expression in initializer [-fpermissive]
    5 | int rec(i,j);
      |            ^
a.cc: In function 'int main()':
a.cc:17:20: error: 'rec' cannot be used as a function
   17 |             x = rec(i,j);
      |                 ~~~^~~~~
a.cc: At global scope:
a.cc:24:5: error: redefinition of 'int rec'
   24 | int rec(i,j){
      |     ^~~
a.cc:5:5: note: 'int rec' previously defined here
    5 | int rec(i,j);
      |     ^~~
a.cc:24:9: error: 'i' was not declared in this scope
   24 | int rec(i,j){
      |         ^
a.cc:24:11: error: 'j' was not declared in this scope
   24 | int rec(i,j){
      |           ^
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;
int w[100][100];
int a,b;
int ans(int a,int b){
    int num=0;
    w[a][b]=0;
    if(a>0 && w[a-1][b]==1){
        num=max(num,solve(a-1,b));
    }
    if(b>0 && w[a][b-1]==1){
        num=max(num,solve(a,b-1));
    }
    if(a<b-1 && w[a+1][b]==1){
        num=max(num,solve(a+1,b));
    }
    if(b<a-1 && w[a][b+1]==1){
       num=max(num,solve(a,b+1));
    }
    w[a][b]=1;
    return num++;
}
int main(){
    while(1){
        scanf("%d %d",&a,&b);
        if(!a) break;
        for(int i=0;i<b;i++){
            for(int j=0;j<a;j++){
                scanf("%d",&w[i][j]);
            }
        }
        int aaa=0;
        for(int i=0;i<b;i++){
            for(int j=0;j<a;j++){
                if(w[i][j]==1) aaa=max(aaa,ans(i,j));
            }
        }
        printf("%d\n",aaa);
    }
}

Compiler output:
a.cc: In function 'int ans(int, int)':
a.cc:10:21: error: 'solve' was not declared in this scope
   10 |         num=max(num,solve(a-1,b));
      |                     ^~~~~
a.cc:13:21: error: 'solve' was not declared in this scope
   13 |         num=max(num,solve(a,b-1));
      |                     ^~~~~
a.cc:16:21: error: 'solve' was not declared in this scope
   16 |         num=max(num,solve(a+1,b));
      |                     ^~~~~
a.cc:19:20: error: 'solve' was not declared in this scope
   19 |        num=max(num,solve(a,b+1));
      |                    ^~~~~
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;
int w[100][100];
int a,b;
int ans(int a,int b){
    int num=0;
    w[a][b]=0;
    if(a>0 && w[a-1][b]==1){
        num=max(num,solve(a-1,b));
    }
    if(b>0 && w[a][b-1]==1){
        num=max(num,solve(a,b-1));
    }
    if(a<b-1 && w[a+1][b]==1){
        num=max(num,solve(a+1,b));
    }
    if(b<a-1 && w[a][b+1]==1){
       num=max(num,solve(a,b+1));
    }
    w[a][b]=1;
    return num+1;
}
int main(){
    while(1){
        scanf("%d %d",&a,&b);
        if(!a) break;
        for(int i=0;i<b;i++){
            for(int j=0;j<a;j++){
                scanf("%d",&w[i][j]);
            }
        }
        int aaa=0;
        for(int i=0;i<b;i++){
            for(int j=0;j<a;j++){
                if(w[i][j]==1) aaa=max(aaa,ans(i,j));
            }
        }
        printf("%d\n",aaa);
    }
}

Compiler output:
a.cc: In function 'int ans(int, int)':
a.cc:10:21: error: 'solve' was not declared in this scope
   10 |         num=max(num,solve(a-1,b));
      |                     ^~~~~
a.cc:13:21: error: 'solve' was not declared in this scope
   13 |         num=max(num,solve(a,b-1));
      |                     ^~~~~
a.cc:16:21: error: 'solve' was not declared in this scope
   16 |         num=max(num,solve(a+1,b));
      |                     ^~~~~
a.cc:19:20: error: 'solve' was not declared in this scope
   19 |        num=max(num,solve(a,b+1));
      |                    ^~~~~
Language: C++

#include<cstdio>
 int e[100][100],n,m;
int ax[4]={0, 1, 0, -1},ay[4]={1, 0, -1, 0};
int dfs(int x, int y){
  int i,w=1; 
 for(int i=0;i<4;i++){
    int nx = x + ax[i];  
  int ny = y + ay[i]; 
   if(nx < 0 || nx >= n || ny < 0 || ny >= m){  
    continue; 
   } 
   e[x][y] = 0;
    if(e[nx][ny] == 1){
      int num=dfs(nx, ny) + 1;
      if(num>w){ 
        w=num;  
    }   
 }   
 e[x][y] = 1;  
}
  return w;
} 
int main(){  
while(1){  
  int ans=0;
    scanf("%d %d",&m,&n); 
   if(!m){  
    break; 
   }  
   for(inti = 0;i < n;i++){     
     for(int j=0;j<m;j++){ 
       scanf("%d",e[i]+j); 
     } 
   }  
 for(i = 0;i < n;i++){    
  for(j = 0;j < m;j++){  
   if(e[i][j]){   
    int num=dfs(i, j); 
     if(num>ans){   
     ans=num; 
     } 
   } 
     }
    } 
   printf("%d\n",ans);  
} 
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:8: error: 'inti' was not declared in this scope; did you mean 'int'?
   30 |    for(inti = 0;i < n;i++){
      |        ^~~~
      |        int
a.cc:30:17: error: 'i' was not declared in this scope
   30 |    for(inti = 0;i < n;i++){
      |                 ^
a.cc:35:6: error: 'i' was not declared in this scope
   35 |  for(i = 0;i < n;i++){
      |      ^
a.cc:36:7: error: 'j' was not declared in this scope
   36 |   for(j = 0;j < m;j++){
      |       ^
Language: C++

/**********************
aoj_0535
Crossing Black Ice
***********************/
#include <iostream>
#include <stack>
using namespace std;

struct pos{
	int x;						//座標
	int y;
	int count;					//進んだ数
	int after_move[100][100];	//今まで進んだ配列を記憶する
};

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

		/*入力*/
		int ice[100][100];					//与えられる配列(外壁あり)				
		for(int i = 0; i < 100; i++){		//配列の初期か
			for(int j = 0; j < 100; j++){
				ice[i][j] = 0;
			}
		}
		for(int i = 1; i <= n; i++){		//配列をもらう
			for(int j = 1; j <= m; j++){
				cin >> ice[i][j];
			}
		}

		/*最大移動数を数える(深さ優先探索)*/
		stack<pos> sta;		//スタック
		int ans = 0;		//回答する移動数の数
		for(int i = 1; i <= n; i++){	//与えられた配列分まわす
			for(int j = 1; j <= m; j++){
				/*深さ優先探索*/
				if(ice[i][j]){		//氷だったらそこをスタート地点にする
					pos p;			//スタックに入れるpを作りスタート地点の情報を入れていく
					p.x = j; p.y = i; p.count = 1;
					memcpy(p.after_move, ice, sizeof(p.after_move));
					p.after_move[i][j] = 0;	//スタート地点の氷を割っておく
					sta.push(p);
					/*全パターン探す*/
					while(!sta.empty()){	//stackが空になったら終了
						int x1[] = {-1, 0, 1, 0}, y1[] = {0, 1, 0, -1};	//移動先
						p = sta.top(); 		//スタックを取り出す						
						sta.pop();	//スタックの先頭を削除
						ans = max(ans, p.count);	//進んだ数が最大なら記憶する
						for(int k = 0; k < 4; k++){	//上下左右の４カ所分まわす
							pos p1 = p;		//移動
							p1.x += x1[k]; p1.y += y1[k];	//移動先
							if(p1.after_move[p1.y][p1.x]){	//異動先が氷なら
								p1.after_move[p1.y][p1.x] = 0;	//氷を割る
								p1.count++;					//進んだ数を増やす
								sta.push(p1);				//スタックにいれる
							}
						}

					}
				}
			}
		}

		/*出力*/
		cout << ans << endl;


	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:41: error: 'memcpy' was not declared in this scope
   44 |                                         memcpy(p.after_move, ice, sizeof(p.after_move));
      |                                         ^~~~~~
a.cc:7:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <stack>
  +++ |+#include <cstring>
    7 | using namespace std;
Language: C++

/**********************
aoj_0535
Crossing Black Ice
***********************/
#include <iostream>
#include <stack>
#include <cstdio>
using namespace std;

struct pos{
	int x;						//座標
	int y;
	int count;					//進んだ数
	int after_move[100][100];	//今まで進んだ配列を記憶する
};

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

		/*入力*/
		int ice[100][100];					//与えられる配列(外壁あり)				
		for(int i = 0; i < 100; i++){		//配列の初期か
			for(int j = 0; j < 100; j++){
				ice[i][j] = 0;
			}
		}
		for(int i = 1; i <= n; i++){		//配列をもらう
			for(int j = 1; j <= m; j++){
				cin >> ice[i][j];
			}
		}

		/*最大移動数を数える(深さ優先探索)*/
		stack<pos> sta;		//スタック
		int ans = 0;		//回答する移動数の数
		for(int i = 1; i <= n; i++){	//与えられた配列分まわす
			for(int j = 1; j <= m; j++){
				/*深さ優先探索*/
				if(ice[i][j]){		//氷だったらそこをスタート地点にする
					pos p;			//スタックに入れるpを作りスタート地点の情報を入れていく
					p.x = j; p.y = i; p.count = 1;
					memcpy(p.after_move, ice, sizeof(p.after_move));
					p.after_move[i][j] = 0;	//スタート地点の氷を割っておく
					sta.push(p);
					/*全パターン探す*/
					while(!sta.empty()){	//stackが空になったら終了
						int x1[] = {-1, 0, 1, 0}, y1[] = {0, 1, 0, -1};	//移動先
						p = sta.top(); 		//スタックを取り出す						
						sta.pop();	//スタックの先頭を削除
						ans = max(ans, p.count);	//進んだ数が最大なら記憶する
						for(int k = 0; k < 4; k++){	//上下左右の４カ所分まわす
							pos p1 = p;		//移動
							p1.x += x1[k]; p1.y += y1[k];	//移動先
							if(p1.after_move[p1.y][p1.x]){	//異動先が氷なら
								p1.after_move[p1.y][p1.x] = 0;	//氷を割る
								p1.count++;					//進んだ数を増やす
								sta.push(p1);				//スタックにいれる
							}
						}

					}
				}
			}
		}

		/*出力*/
		cout << ans << endl;


	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:41: error: 'memcpy' was not declared in this scope
   45 |                                         memcpy(p.after_move, ice, sizeof(p.after_move));
      |                                         ^~~~~~
a.cc:8:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    7 | #include <cstdio>
  +++ |+#include <cstring>
    8 | using namespace std;
Language: C++

/**********************
aoj_0535
Crossing Black Ice
***********************/
#include <iostream>
#include <stack>
#include <string>
using namespace std;

struct pos{
	int x;						//座標
	int y;
	int count;					//進んだ数
	int after_move[100][100];	//今まで進んだ配列を記憶する
};

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

		/*入力*/
		int ice[100][100];					//与えられる配列(外壁あり)				
		for(int i = 0; i < 100; i++){		//配列の初期か
			for(int j = 0; j < 100; j++){
				ice[i][j] = 0;
			}
		}
		for(int i = 1; i <= n; i++){		//配列をもらう
			for(int j = 1; j <= m; j++){
				cin >> ice[i][j];
			}
		}

		/*最大移動数を数える(深さ優先探索)*/
		stack<pos> sta;		//スタック
		int ans = 0;		//回答する移動数の数
		for(int i = 1; i <= n; i++){	//与えられた配列分まわす
			for(int j = 1; j <= m; j++){
				/*深さ優先探索*/
				if(ice[i][j]){		//氷だったらそこをスタート地点にする
					pos p;			//スタックに入れるpを作りスタート地点の情報を入れていく
					p.x = j; p.y = i; p.count = 1;
					memcpy(p.after_move, ice, sizeof(p.after_move));
					p.after_move[i][j] = 0;	//スタート地点の氷を割っておく
					sta.push(p);
					/*全パターン探す*/
					while(!sta.empty()){	//stackが空になったら終了
						int x1[] = {-1, 0, 1, 0}, y1[] = {0, 1, 0, -1};	//移動先
						p = sta.top(); 		//スタックを取り出す						
						sta.pop();	//スタックの先頭を削除
						ans = max(ans, p.count);	//進んだ数が最大なら記憶する
						for(int k = 0; k < 4; k++){	//上下左右の４カ所分まわす
							pos p1 = p;		//移動
							p1.x += x1[k]; p1.y += y1[k];	//移動先
							if(p1.after_move[p1.y][p1.x]){	//異動先が氷なら
								p1.after_move[p1.y][p1.x] = 0;	//氷を割る
								p1.count++;					//進んだ数を増やす
								sta.push(p1);				//スタックにいれる
							}
						}

					}
				}
			}
		}

		/*出力*/
		cout << ans << endl;


	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:41: error: 'memcpy' was not declared in this scope
   45 |                                         memcpy(p.after_move, ice, sizeof(p.after_move));
      |                                         ^~~~~~
a.cc:7:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <stack>
  +++ |+#include <cstring>
    7 | #include <string>
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <stack>
 
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
#define X first
#define Y second
 
using namespace std;
 
typedef vector<int> vi;
typedef pair<int, int> P;

const int INF = 1<<29;

int field[100][100];
int visit[100][100];

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

int w, h;
int dfs(int x, int y){
	int res = 0;
	rep(i, 4){
		int nx = x+dx[i], ny = y+dy[i];
		if(nx < 0 || nx >= w || ny < 0 || ny >= h) continue;
		if(!field[ny][nx]) continue;
		if(visit[ny][nx]) continue;
		visit[ny][nx] = 1;
		res = max(res, dfs(nx, ny));
		visit[ny][nx] = 0;
	}

	return res+1;
}

int main(){
	while(cin >> w >> h, w|h){
		rep(i, h) rep(j, w) cin >> field[i][j];
		int ans = 0;
		rep(i, h) rep(j, w){
			if(field[i][j]){
				memset(visit, 0, sizeof(visit));
				visit[i][j] = 1;
				ans = max(ans, dfs(j, i));
			}
		}
		cout << ans << endl;
	}
 
    return 0;
}

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

#include "stdio.h"

int ido(int x,int y,int a[90][90])
{
a[x][y] = 0;
int max = 0;
if(x + 1 < 90)
{
if(a[x + 1][y] == 1)
{
int w = ido(x + 1,y,a)
if(max < w)
{
max = w;
}
}
}
if(0 <= x - 1)
{
int w = ido(x - 1,y,a);
if(max < w)
{
max = w;
}
}
if(y + 1 < 90)
{
int w = ido(x,y + 1,a);
if(max < w)
{
max = w;
}
}
if(0 <= y - 1)
{
int w = ido(x ,y - 1,a);
if(max < w)
{
max = w;
}
}
return max + 1;
}

int main()
{
while(1)
{
int m,n;
scanf("%d",&m);
scanf("%d",&n);
if(n == 0 && m == 0)
{
break;
}
int aw[90][90];
for(int i = 0; i < n; i++)
{
for(int ii = 0; ii < m; ii++)
{
scanf("%d",&aw[i][ii]);
}
}
int h1,h2;
for(int i = 0; i < n; i++)
{
for(int ii = 0; ii < m; ii++)
{
if(aw[i][ii] == 1)
{
h1 = i;
h2 = ii;
goto aa;
}
}
}
aa:
printf("%d\n",ido(h1,h2,aw));
}
return 0;
}

Compiler output:
a.cc: In function 'int ido(int, int, int (*)[90])':
a.cc:12:1: error: expected ',' or ';' before 'if'
   12 | if(max < w)
      | ^~
Language: C++

#include "stdio.h"

int ido(int x,int y,int aw[90][90])
{
a[x][y] = 0;
int a[90][90];
for(int i = 0; i < 90; i++)
{
for(int ii = 0; ii < 90; ii++)
{
a[i][ii] = aw[i][ii];
}
}
int max = 0;
if(x + 1 < 90)
{
if(a[x + 1][y] == 1)
{
int w = ido(x + 1,y,a);
if(max < w)
{
max = w;
}
}
}
if(0 <= x - 1)
{
if(a[x - 1][y] == 1)
{
int w = ido(x - 1,y,a);
if(max < w)
{
max = w;
}
}
}
if(y + 1 < 90)
{
if(a[x][y + 1] == 1)
{
int w = ido(x,y + 1,a);
if(max < w)
{
max = w;
}
}
}
if(0 <= y - 1)
{
if(a[x][y - 1] == 1)
{
int w = ido(x ,y - 1,a);
if(max < w)
{
max = w;
}
}
}
return max + 1;
}

int main()
{
while(1)
{
int m,n;
scanf("%d",&m);
scanf("%d",&n);
if(n == 0 && m == 0)
{
break;
}
int aw[90][90];
for(int i = 0; i < 90; i++)
{
for(int ii = 0; ii < 90; ii++)
{
aw[i][ii] = 0;
}
}
for(int i = 0; i < n; i++)
{
for(int ii = 0; ii < m; ii++)
{
scanf("%d",&aw[i][ii]);
}
}
int h1,h2;
for(int i = 0; i < n; i++)
{
for(int ii = 0; ii < m; ii++)
{
if(aw[i][ii] == 1)
{
h1 = i;
h2 = ii;
goto aa;
}
}
}
aa:
printf("%d\n",ido(h1,h2,aw));
}
return 0;
}

Compiler output:
a.cc: In function 'int ido(int, int, int (*)[90])':
a.cc:5:1: error: 'a' was not declared in this scope
    5 | a[x][y] = 0;
      | ^
Language: C++

/**********************
aoj_0535
Crossing Black Ice
***********************/
#include <iostream>
#include <stack>
using namespace std;

struct pos{
	int x;						//座標
	int y;
	int count;					//進んだ数
	int field[100][100];	//今まで進んだ配列を記憶する
};

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

		/*入力*/
		int ice[100][100] = {{0}};			//与えられる配列(外壁あり)

		for(int i = 1; i <= n; i++){
			for(int j = 1; j <= m; j++){
				cin >> ice[i][j];
			}
		}

		/*最大移動数を数える(深さ優先探索)*/
		stack<pos> sta;		//スタック
		int ans = 0;		//回答する移動数の数
		for(int i = 1; i <= n; i++){	//与えられた配列分まわす
			for(int j = 1; j <= m; j++){
				/*深さ優先探索*/
				if(ice[i][j]){		//氷だったらそこをスタート地点にする
					pos p;			//スタックに入れるpを作りスタート地点の情報を入れていく
					p.x = j; p.y = i; p.count = 1;
					memcpy(p.field, ice, sizeof(p.field));
					p.field[i][j] = 0;	//スタート地点の氷を割っておく
					sta.push(p);
					/*全パターン探す*/
					while(!sta.empty()){	//stackが空になったら終了
						int x1[] = {-1, 0, 1, 0}, y1[] = {0, 1, 0, -1};	//移動先
						p = sta.top(); 		//スタックを取り出す
						sta.pop();	//スタックの先頭を削除
						ans = max(ans, p.count);	//進んだ数が最大なら記憶する
						for(int k = 0; k < 4; k++){	//上下左右の４カ所分まわす
							pos p1 = p;		//移動
							p1.x += x1[k]; p1.y += y1[k];	//移動先
							if(p1.field[p1.y][p1.x]){	//異動先が氷なら
								p1.field[p1.y][p1.x] = 0;	//氷を割る
								p1.count++;					//進んだ数を増やす
								sta.push(p1);				//スタックにいれる
							}
						}

					}
				}
			}
		}

		/*出力*/
		cout << ans << endl;


	}
	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:41: error: 'memcpy' was not declared in this scope
   40 |                                         memcpy(p.field, ice, sizeof(p.field));
      |                                         ^~~~~~
a.cc:7:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <stack>
  +++ |+#include <cstring>
    7 | using namespace std;
Language: C++

/**********************
aoj_0535
Crossing Black Ice
***********************/
#include <iostream>
#include <stack>
#include <cstdlib>
using namespace std;

struct pos{
	int x;						//座標
	int y;
	int count;					//進んだ数
	int field[100][100];	//今まで進んだ配列を記憶する
};

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

		/*入力*/
		int ice[100][100] = {{0}};			//与えられる配列(外壁あり)

		for(int i = 1; i <= n; i++){
			for(int j = 1; j <= m; j++){
				cin >> ice[i][j];
			}
		}

		/*最大移動数を数える(深さ優先探索)*/
		stack<pos> sta;		//スタック
		int ans = 0;		//回答する移動数の数
		for(int i = 1; i <= n; i++){	//与えられた配列分まわす
			for(int j = 1; j <= m; j++){
				/*深さ優先探索*/
				if(ice[i][j]){		//氷だったらそこをスタート地点にする
					pos p;			//スタックに入れるpを作りスタート地点の情報を入れていく
					p.x = j; p.y = i; p.count = 1;
					memcpy(p.field, ice, sizeof(p.field));
					p.field[i][j] = 0;	//スタート地点の氷を割っておく
					sta.push(p);
					/*全パターン探す*/
					while(!sta.empty()){	//stackが空になったら終了
						int x1[] = {-1, 0, 1, 0}, y1[] = {0, 1, 0, -1};	//移動先
						p = sta.top(); 		//スタックを取り出す
						sta.pop();	//スタックの先頭を削除
						ans = max(ans, p.count);	//進んだ数が最大なら記憶する
						for(int k = 0; k < 4; k++){	//上下左右の４カ所分まわす
							pos p1 = p;		//移動
							p1.x += x1[k]; p1.y += y1[k];	//移動先
							if(p1.field[p1.y][p1.x]){	//異動先が氷なら
								p1.field[p1.y][p1.x] = 0;	//氷を割る
								p1.count++;					//進んだ数を増やす
								sta.push(p1);				//スタックにいれる
							}
						}

					}
				}
			}
		}

		/*出力*/
		cout << ans << endl;


	}
	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:41: error: 'memcpy' was not declared in this scope
   41 |                                         memcpy(p.field, ice, sizeof(p.field));
      |                                         ^~~~~~
a.cc:8:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    7 | #include <cstdlib>
  +++ |+#include <cstring>
    8 | using namespace std;
Language: C

#include <stdio.h>
#include <string.h>
unsigned int a[1000000000];
unsigned int s[1000000000];
unsigned int t[1000000000];
unsigned int u[1000000000];
int main()
{
  int n,m,p,q,r,i,x,y;
  for(;;){
    scanf("%d",&n);
    if(n == 0) break;
    for(i=0;i<n;i++){
      a[i] = i+1;
    }
    scanf("%d",&m);
    scanf("%d%d%d",&p,&q,&r);
    for(i=0;i<m;i++){
      scanf("%d%d",&x,&y);
      memcpy(s,a,sizeof(int)*x);
      memcpy(t,a+x,sizeof(int)*(y-x));
      memcpy(u,a+y,sizeof(int)*(n-y));
      memcpy(a,u,sizeof(int)*(n-y));
      memcpy(a+(n-y),t,sizeof(int)*(y-x));
      memcpy(a+(n-x),s,sizeof(int)*x);
    }
    x = 0;
    for(i=p-1;i<q;i++){
      if(a[i] <= r) x++;
    }
    printf("%d\n",x);
  }
  return 0;
}

Compiler output:
/tmp/ccUGPDGx.o: in function `main':
main.c:(.text+0xe4): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/ccUGPDGx.o
main.c:(.text+0x120): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccUGPDGx.o
main.c:(.text+0x15c): relocation truncated to fit: R_X86_64_PC32 against symbol `u' defined in .bss section in /tmp/ccUGPDGx.o
main.c:(.text+0x17d): relocation truncated to fit: R_X86_64_PC32 against symbol `u' defined in .bss section in /tmp/ccUGPDGx.o
main.c:(.text+0x1c6): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccUGPDGx.o
main.c:(.text+0x202): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/ccUGPDGx.o
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
#include<string.h>
#define Max(x,y) ((x>y)?x:y)
typedef struct card{
	int s,t,n;
}card;
card x[10500],y[10500];
int main(){
	int i,j,n,m,p,q,r,a,b,c,d;//(a,b)cut c,d:absolute point
	int xn,yn,e,f,g;//f:flag g:
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		scanf("%d%d%d%d",&m,&p,&q,&r);
		xn=1;
		x[0]=(card){1,n+1,n};
		while(m--){
			scanf("%d%d",&a,&b);
			d=n+1;c=d-x[xn-1].n;
			f=0;yn=0;
			//for(i=0;i<xn;i++)printf("(%d-%d)",x[i].s,x[i].t);
			//printf("\n");
			for(i=xn-1;i>=0;){
				//printf("c:%d  d:%d\n",c,d);
				if(f==0){
					if(c==b+1){
						for(j=i;j<xn;j++)y[yn++]=x[j];
						f=1;g=i-1;i--;
					}else if(c<b+1 && b+1<d){
						y[yn++]=(card){x[i].s+b+1-c,x[i].t,x[i].t-x[i].s-b-1+c};
						for(j=i+1;j<xn;j++)y[yn++]=x[j];
						x[i]=(card){x[i].s,x[i].s+b+1-c,b+1-c};
						//for(j=0;j<=i;j++)printf("(%d-%d)",x[j].s,x[j].t);
						//printf("\n");
						f=1;g=i;d=c+x[i].n;
						continue;
					}else i--;
				}else{
					if(c==a+1){
						for(j=i;j<=g;j++)y[yn++]=x[j];
						for(j=0;j<i;j++)y[yn++]=x[j];
						break;
					}else if(c<a+1 && a+1<d){
						y[yn++]=(card){x[i].s+a+1-c,x[i].t,x[i].t-x[i].s-a-1+c};
						for(j=i+1;j<=g;j++)y[yn++]=x[j];
						x[i]=(card){x[i].s,x[i].s+a+1-c,a+1-c};
						for(j=0;j<=i;j++)y[yn++]=x[j];
						break;
					}else i--;
				}
				d=c;
				c=d-x[i].n;
			}
			//for(i=0;i<yn;i++)printf("(%d-%d)",y[i].s,y[i].t);
			//printf("\n");
			memcpy(x,y,sizeof(card)*yn);
			xn=yn;
		}
		//printf("\n");
		//for(i=0;i<xn;i++)printf("(%d - %d)",x[i].s,x[i].t);
		//printf("\n\n");
		a=0;b=1;
		for(i=0;i<xn;i++){
			/*if(b<p){
				if(q>=b){
					if(q<b+x[i].n){
						a+=(x[i].s>r)?0:( (r<=x[i].s+q-b)?(r-x[i].s+1):(q-b+1) );
						break;
					}
					else
						a+=(x[i].s>r)?0:( (r<x[i].t)?(r-x[i].s+1):(x[i].n) );
				}
			}else if(b==p){
				if(q<b+x[i].n){
					a+=(x[i].s>r)?0:( (r<=x[i].s+q-p)?(r-x[i].s+1):(q-b+1) );
					break;
				}
				else
					a+=(x[i].s>r)?0:( (r<x[i].t)?(r-x[i].s+1):(x[i].n) );
			}else if(b<p && p<b+x[i].n){
				if(q<b+x[i].n){
					a+=(x[i].s+p-b>r)?0:( (r<=x[i].s+q-b)?(r-x[i].s-p+b+1):(q-p+1) );
				}
				else
					a+=(x[i].s+p-b>r)?0:( (r<x[i].t)?(r-x[i].s-p+b+1):(x[i].n-p+b) );
			}*/
			//printf("%d ",b);
			if(p<b+x[i].n && b<=q){
				c=x[i].s;
				d=x[i].t;
				if(b<p)c+=p-b;
				if(b+x[i].n>q)d+=q-b-x[i].n+1;
				if(d>r)d=r+1;
				if(c>r)c=d+1;
				//printf("%d %d",c,d);
				> printf("%d %d",c,d);
> 				
				a+=Max(0,d-c);
			}
			//printf("\n");
			b+=x[i].n;
		}
		printf("%d\n",a);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:96:33: error: expected expression before '>' token
   96 |                                 > printf("%d %d",c,d);
      |                                 ^
main.c:97:1: error: expected expression before '>' token
   97 | >
      | ^
Language: C

#include <stdio.h>

int main(){
  int i, j, n, m, p, q, r;

  while(1){
    scanf("%d",&n);
    if(n == 0) break;
    scanf("%d",&m);
    scanf("%d%d%d",&p,&q,&r);
    int d[n], a[n], b[n], c[n], x[m][2], count = 0;
    for(i = 0 ; i < n ; i++){
      d[i] = i + 1;
    }
    for(i = 0 ; i < m ; i++){
      for(j = 0 ; j < 2 ; j++){
	scanf("%d",&x[i][j]);
      }
    }
    for(j = 0 ; j < m ; j++){
      for(i = 0 ; i < x[j][0] ; i++){
	a[i] = d[i];
      }
      for(i = 0 ; i < x[j][1]-x[j][0] ; i++){
	b[i] = d[x[k][0]];
      }
      for(i = 0 ; i < n-x[j][1] ; i++){
	c[i] = d[x[j][1]-x[j][0]];
      }
      for(i = 0 ; i < n-x[j][1] ; i++){
	d[i] = c[i];
      }
      for(i = 0 ; i < x[j][1]-x[j][0] ; i++){
	d[n-x[j][1]] = b[i];
      }
      for(i = 0 ; i < x[j][0] ; i++){
	d[x[j][1]-x[j][0]] = a[i];
      }
    }
    for(i = 0 ; i < q-p+1 ; i++){
      if(d[i+p] <= r)
	count++;
    }
    printf("%d\n",count);
  }

  return 0;

}

Compiler output:
main.c: In function 'main':
main.c:25:20: error: 'k' undeclared (first use in this function)
   25 |         b[i] = d[x[k][0]];
      |                    ^
main.c:25:20: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<iostream>
using namespace std;
long long int main() {
	long long int size;
	long long int *card;
	long long int *dommy;
	long long int search[3];
	long long int shuffle[2];
	long long int time;
	while (cin >> size&&size) {
		card = new long long int[size];
		for (long long int i = 0; i < size; ++i) {
			card[i] = i + 1;
		}
		cin >> time;
		for (long long int i = 0; i < 3; ++i) {
			cin >> search[i];
		}
		for (long long int i = 0; i < time; ++i) {
			for (long long int j = 0; j < 2; ++j) {
				cin>>shuffle[j];
			}
			dommy = new long long int[size];
			for (long long int j = shuffle[1]; j < size; ++j) {
				dommy[j - shuffle[1]] = card[j];
			}
			for (long long int j = shuffle[0]; j < shuffle[1]; ++j) {
				dommy[size - shuffle[1] + j - shuffle[0]] = card[j];
			}
			for (long long int j = 0; j < shuffle[0]; ++j) {
				dommy[size - shuffle[0] + j] = card[j];
			}
			card = dommy;
		}
		long long int answer = 0;
		for (long long int i = search[0] - 1; i < search[1]; ++i) {
			if (card[i] <= search[2]) {
				++answer;
			}
		}
		cout << answer << endl;
	}
	return 0;
}

Compiler output:
a.cc:3:11: error: '::main' must return 'int'
    3 | long long int main() {
      |           ^~~
Language: C++


#if 1
#include <fstream>
#include <string>
#include <sstream>
#include <iostream>
#include <locale>
#include <codecvt>
#include <memory>
#include <iostream>
#include <fstream>
#include <string>
#include <locale>
#include <iomanip>
#include <utility>
#include <algorithm>


int32_t N;
int32_t p, q, r;
int32_t M;
int32_t X[5000];
int32_t Y[5000];

int32_t K[2][5000 * 3][2];//0: s 1: ?????°
auto K_end = K[0];
inline void insert(decltype(K_end) pos, int32_t ns, int32_t nn)
{
	for (auto iter = K_end; iter != pos; --iter) {
		(*iter)[0] = (*(iter - 1))[0];
		(*iter)[1] = (*(iter - 1))[1];
	}
	(*pos)[0] = ns;
	(*pos)[1] = nn;
	++K_end;
}
int main()
{
	std::cin >> N;
	while (N != 0)
	{
		std::cin >> M >> p >> q >> r;
		for (int32_t i = 0; i < M; ++i) {
			std::cin >> X[i] >> Y[i];
		}
		K_end = K[0];
		(*K_end)[0] = 1;
		(*K_end)[1] = N;
		++K_end;

		for (int32_t i = 0; i < M; ++i)
		{
			//??????
			int num_buf = 0;
			decltype(K_end) x_end_pos = nullptr;
			for (auto iter = K[i & 1]; iter != K_end; ++iter) {
				num_buf += (*iter)[1];
				if (X[i] <= num_buf) {
					auto nn = (num_buf - X[i]);
					(*iter)[1] -= nn;
					insert(iter + 1, (*iter)[0] + (*iter)[1], nn);
					x_end_pos = iter + 1;
					break;
				}
			}
			num_buf = X[i];
			decltype(K_end) y_end_pos = nullptr;
			for (auto iter = x_end_pos; iter != K_end; ++iter) {
				num_buf += (*iter)[1];
				if (Y[i] <= num_buf) {
					auto nn = (num_buf - Y[i]);
					(*iter)[1] -= nn;
					insert(iter + 1, (*iter)[0] + (*iter)[1], nn);
					y_end_pos = iter + 1;
					break;
				}
			}
			//????????????
			auto iter_out = K[(i + 1) & 1];
			for (auto iter = y_end_pos; iter != K_end; ++iter) {
				(*iter_out)[0] = (*iter)[0];
				(*iter_out)[1] = (*iter)[1];
				++iter_out;
			}
			for (auto iter = x_end_pos; iter != y_end_pos; ++iter) {
				(*iter_out)[0] = (*iter)[0];
				(*iter_out)[1] = (*iter)[1];
				++iter_out;
			}
			for (auto iter = K[i & 1]; iter != x_end_pos; ++iter) {
				(*iter_out)[0] = (*iter)[0];
				(*iter_out)[1] = (*iter)[1];
				++iter_out;
			}
			K_end = iter_out;
		}

		//??????
		int32_t num_buf = 0;
		int32_t count = 0;
		for (auto iter = K[M & 1]; iter != K_end; ++iter) {
			auto n_numbuf = num_buf + (*iter)[1];
			auto add = std::min(r - ((*iter)[0] - 1), (*iter)[1]);
			if (num_buf < p) {
				add -= (p - 1 - num_buf);
			}
			if (q < n_numbuf) {
				add = std::min(add, q - num_buf);
			}
			count += std::max(0, add);
			num_buf = n_numbuf;
		}
		std::cout << count << '\n';

		std::cin >> N;
	}
}

Compiler output:
a.cc:2: error: unterminated #if
    2 | #if 1
Language: C++

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

queue<P>operator +(queue<P>a, queue<P>b) {
	while (b.size()) {
		a.push(b.front()); b.pop();
	}
	return a;
}
queue<P>L;
int main() {
	int a;
	while (cin >> a, a) {
		int b, c, d, e; scanf("%d%d%d%d", &b, &c, &d, &e);
		queue<P>tmp;
		swap(L, tmp);
		L.push(P(1, a));
		for (int f = 0; f < b; f++) {
			int g, h; scanf("%d%d", &g, &h);
			queue<P>A, B, C;
			int sum = 0, j = 0;
			while (L.size()) {
				P i = L.front(); L.pop();
				sum += i.second - i.first + 1;
				if (j < g&&sum > g) {
					if (j < h&&sum > h) {
						A.push(P(i.first, i.first + (g - j) - 1));
						B.push(P(i.first + (g - j), i.first + (h - j) - 1));
						C.push(P(i.first + (h - j), i.second));
					}
					else {
						A.push(P(i.first, i.first + (g - j) - 1));
						B.push(P(i.first + (g - j), i.second));
					}
				}
				else {
					if (j < h&&sum > h) {
						B.push(P(i.first, i.first + (h - j) - 1));
						C.push(P(i.first + (h - j), i.second));
					}
					else {
						if (sum > h) {
							C.push(i);
						}
						else if (sum > g) {
							B.push(i);
						}
						else {
							A.push(i);
						}
					}
				}
				j += i.second - i.first + 1;
			}
			L = C + B + A;
		}
}

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

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <deque>
 
using namespace std;
 
#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10
#define MOD 1000000007
 
typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;
 
deque<pi>vec, a, b, c;
int N, M, P, Q, R;
 
int cnt(int p, int q, int r){
  if(p > r) return 0;
  if(r >= q) return q-p+1;
  return r-p+1;
}
 
int countR(int p, int q, int r){
  int n = 1, vp, res = 0;
  for(vp=0;vp<vec.size();vp++){
    int f = vec[vp].F, l = vec[vp].S;
    int c = l-f+1;
    if(n <= p){
      if(n+c < p){
      }
      else if(n + c > q){
    res += cnt(f+p-n, f+q-n, r);
      }else{
    res += cnt(f+p-n, l, r);
      }
      n += c;
    }else if(n <= q){
      if(n+c<=q){
    res += cnt(f, l, r);
      }else{
    res += cnt(f, f+q-n, r);
      }
      n += c;
    }
  }
  return res;
}
 
 
int main(){
  while(1){
    cin >> N;
    if(!N) break;
    cin >> M >> P >> Q >> R;
    vec.clear();
    vec.push_back(MP(1,N));
    int x, y;
    rep(i, M){
      cin >> x >> y;
      a.clear(); b.clear();
      int p=1;
      while(p<=x){
    int f = vec[0].F, s = vec[0].S;
    if(p+s-f<=x){
      a.push_back(MP(f,s));
      p += s-f+1;
      vec.pop_front();
    }else if(p+s-f>x){
      a.push_back(MP(f, f+x-p));
      vec[0].F = f+x-p+1;
      p = x+1;
    }
      }
      while(p<=y){
    int f = vec[0].F, s = vec[0].S;
    if(p+s-f<=y){
      b.push_back(MP(f, s));
      p += s-f+1;
      vec.pop_front();
    }else if(p+s-f>y){
      b.push_back(MP(f, f+y-p));
      vec[0].F = f+y-p+1;
      p = y+1;
    }
      }
 
      vec.insert(vec.end(), b.begin(), b.end());
      vec.insert(vec.end(), a.begin(), a.end());
 
    }
 
 
    /*    rep(i, vec.size()){
      for(int j=vec[i].F;j<=vec[i].S;j++) cout << j << endl;;
      }*/
    cout << countR(P, Q, R) << endl;
  }


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

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	int n,m,p,q,r,x,y;
	vector<int>::iterator itx,ity,it;
	for(;cin>>n>>m>>p>>q>>r;cout<<x<<endl){
		vector<int> v1(1),v2;
		
		for(v1.push_back(r);m--;v2.clear()){
			cin>>x>>y;
			itx=upper_bound(v1.begin(),v1.end(),x);
			ity=upper_bound(v1.begin(),v1.end(),y);
			
			if( ity-v1.begin()+1 & 1 )v2.push_back(0);
			v2.push_back(0);
//			v2.insert(v2.end(),ity-v1.begin()&1?1:2,0);
			for(it=ity;it!=v1.end();++it)
				v2.push_back(*it - y);
			
			if(v1.end()-itx & 1)v2.push_back(n-y);
			for(it=itx;it!=ity;++it)
				v2.push_back(*it-x+n-y);
			
			it = v1.begin();
			if(ity-v1.begin() & 1)++it;
			if(!it[1])it+=2;
			if(*it+n-x==v2.back())++it,v2.pop_back();
			for(;it!=itx;++it)
				v2.push_back(*it+n-x);
			
			v1.swap(v2);
		}
		v1.insert( upper_bound(v1.begin(),v1.end(),p-1), 2, p-1);
		v1.insert( lower_bound(v1.begin(),v1.end(),q), q );
		v1.push_back(n);
		it = upper_bound(v1.begin(),v1.end(),p-1);
		if(it-v1.begin() & 1) --it;
		for(x=0;*it<q;++it){
			m=*it,++it
			x+=*it-m;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:35: error: expected ';' before 'x'
   41 |                         m=*it,++it
      |                                   ^
      |                                   ;
   42 |                         x+=*it-m;
      |                         ~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	int n,m,p,q,r,x,y;
	vector<int>::iterator itx,ity,it;
	for(;cin>>n>>m>>p>>q>>r;cout<<x<<endl){
		vector<int> v1,v2;
		v1.push_back(0);
		for(v1.push_back(r);m--;v2.clear()){
			cin>>x>>y;
			itx=upper_bound(v1.begin(),v1.end(),x);
			ity=upper_bound(v1.begin(),v1.end(),y);
			
//			if( ity-v1.begin()+1 & 1 )v2.push_back(0);
//			v2.push_back(0);
			v2.insert(v2.end(),ity-v1.begin()&1?1:2,0);
			for(it=ity;it!=v1.end();++it)
				v2.push_back(*it - y);
			
			if(v1.end()-itx & 1)v2.push_back(n-y);
			for(it=itx;it!=ity;++it)
				v2.push_back(*it-x+n-y);
			
			it = v1.begin();
			if(ity-v1.begin() & 1)++it;
			if(!it[1])it+=2;
			if(*it+n-x==v2.back()){++it;v2.pop_back();}
			for(;it!=itx;++it)
				v2.push_back(*it+n-x);
			
			v1.swap(v2);
		}
		v1.insert( upper_bound(v1.begin(),v1.end(),p-1), 2, p-1);
		v1.insert( lower_bound(v1.begin(),v1.end(),q), q );
		v1.push_back(n);
		it = upper_bound(v1.begin(),v1.end(),p-1);
		if(it-v1.begin() & 1) --it;
		for(x=0;*it<q;
			x+=*it++-m)
			m=*it++
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:32: error: expected ';' before '}' token
   42 |                         m=*it++
      |                                ^
      |                                ;
   43 |         }
      |         ~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	int n,m,p,q,r,x,y;
	vector<int>::iterator itx,ity,it;
	for(;cin>>n>>m>>p>>q>>r;cout<<x<<endl){
		vector<int> v1,v2;
		v1.push_back(0);
		for(v1.push_back(r);m--;v2.clear()){
			cin>>x>>y;
			itx=upper_bound(v1.begin(),v1.end(),x);
			ity=upper_bound(v1.begin(),v1.end(),y);
			
//			if( ity-v1.begin()+1 & 1 )v2.push_back(0);
//			v2.push_back(0);
			v2.insert(v2.end(),ity-v1.begin()&1?1:2,0);
			for(it=ity;it!=v1.end();++it)
				v2.push_back(*it - y);
			
			if(v1.end()-itx & 1)v2.push_back(n-y);
			for(it=itx;it!=ity;++it)
				v2.push_back(*it-x+n-y);
			
			it = v1.begin();
			if(ity-v1.begin() & 1)++it;
			if(!it[1])it+=2;
			if(*it+n-x==v2.back()){++it;v2.pop_back();}
			for(;it!=itx;++it)
				v2.push_back(*it+n-x);
			
			v1.swap(v2);
		}
		v1.insert( upper_bound(v1.begin(),v1.end(),p-1), 2, p-1);
		v1.insert( lower_bound(v1.begin(),v1.end(),q), q );
		v1.push_back(n);
		it = upper_bound(v1.begin(),v1.end(),p-1);
		if(it-v1.begin() & 1) --it;
		for(x=0;*it<q;it+=2)
			x+=it[1]-*it
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:37: error: expected ';' before '}' token
   41 |                         x+=it[1]-*it
      |                                     ^
      |                                     ;
   42 |         }
      |         ~
Language: C++

#include <cstdio>
#include <algorthm>
#include <queue>
using namespace std;
typedef pair<int,int> P;
#define mp make_pair
#define f first
#define s second
int main(){
while(1){
int n,m,p,q,r;
queue<P>que;
scanf("%d",&n);
if(!n) break;
scanf("%d",&m);
scanf("%d %d %d",&p,&q,&r);
que.push(mp(1,r));
for(int i=0;i<m;i++){
	int x,y;
	scanf("%d %d",&x,&y);
	int e=que.size();
	for(int j=0;j<e;j++){
		P pp=que.front(); que.pop();
		int a=pp.f,b=pp.s;
		if(b<=x){
			que.push(mp(n-x+a,n-x+b));
		}else if(b>x && b<=y){
			if(a<=x){
				que.push(mp(n-x+a,n));
				que.push(mp(n-y+1,n+b-x-y));
			}else{
				que.push(mp(n-y+a-x,n+b-x-y));
			}
		}else{
			if(a<=x){
				que.push(mp(1,b-y));
				que.push(mp(n-x+a,n));
				que.push(mp(n-y+1,n-x));
			}else if(a>x && a<=y){
				que.push(mp(1,b-y));
				que.push(mp(n-y-x+a,n-x));
			}else{
				que.push(mp(a-y,b-y));
			}
		}
	}
}
int ans=0;
while(que.size()){
P pp=que.front(); que.pop();
if(pp.s<p || pp.f>q){
continue;
}else if(pp.f<q){
ans+=q-pp.f+1;
}else{
ans+=pp.s-p+1;
}
}
printf("%d\n",ans);
}
return 0;
}

Compiler output:
a.cc:2:10: fatal error: algorthm: No such file or directory
    2 | #include <algorthm>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include"bits/stdc++.h"
main(){for(int n,m,s,i,j,d[50][3500],M=1e5;std::cin>>n>>m>>s,n*=n;){std::fill(d[0],d[50],M);d[0][0]=1;for(i=1;i<=n;++i)for(j=0;j<=s;++j){if(j>=i)d[i][j]+=d[i-1][j-i]+d[i][j-i];if(j>m)d[i][j]-=d[i-1][j-m-1];d[i][j]%=M;}printf("%d\n",d[n][s]);}}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include"bits/stdc++.h"
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include "bits/stdc++.h"

using namespace std;

typedef long long ll;

int main(){
    int n,m,s;
    while(cin>>n>>m>>s){
        if(n==0&&m==0&&s==0)break;
        
        int dp[2][2300][3300];
        
        rep(i,2)rep(j,2300)rep(k,3300)dp[i][j][k]=0;
        dp[0][0][0] = 1;
        
        for(int i=1;i<=n*n;i++){
            for(int j=0;j<2300;j++)
                for(int k=0;k<3300;k++)
                    dp[i%2][j][k] = 0;
            for(int j=1;j<=m;j++){
                for(int k=1;k<=s;k++){
                    if(k-j>=0){
                        dp[i%2][j][k] += dp[i%2][j-1][k-1] + dp[(i-1)%2][j-1][k-j];
                        dp[i%2][j][k] %= 100000;
                    }
                }
            }
        }
        

        ll ans = 0;
        for(int i=0;i<=m;i++){
            ans+=dp[(n*n)%2][i][s];
            ans%=100000;
        }
        cout<<ans<<endl;   
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: 'i' was not declared in this scope
   14 |         rep(i,2)rep(j,2300)rep(k,3300)dp[i][j][k]=0;
      |             ^
a.cc:14:9: error: 'rep' was not declared in this scope
   14 |         rep(i,2)rep(j,2300)rep(k,3300)dp[i][j][k]=0;
      |         ^~~
Language: C++

#include <iostream>

using namespace std;

const int MAX_N = 7;
const int MAX_S = 3000;

int dp[MAX_N * MAX_N + 1][MAX_S + 1];

int main()
{
	int N, M, S;
	
	while (cin >> N >> M >> S, N) {
		memset(dp, 0, sizeof dp);

		N *= N;

		dp[0][0] = 1;

		for (int i = 1; i <= M; ++i) {
			for (int j = N; j >= 1; --j) {
				for (int k = S; k >= i; --k) {
					dp[j][k] += dp[j - 1][k - i];
					dp[j][k] %= 100000;
				}
			}
		}

		cout << dp[N][S] << endl;
	}
}

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

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

int dp[49][2999][1999]{};
int main() {
	memset(dp, -1, sizeof(dp));
}

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

#include<iostream>
#include<map>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#define int long long
using namespace std;

int dp[2][2000][3000];
signed main() {
	int a, b, c;
	while (cin >> a >> b >> c, a || b || c) {
		a *= a;
		c -= a*(a + 1) / 2;
		b -= a;
		memset(dp, 0, sizeof(dp));
		dp[0][0][0] = 1;
		for (int d = 1; d <= a; d++) {
			memset(dp[d & 1], 0, sizeof(dp[d & 1]));
			for (int e = 0; e <= b; e++) {
				for (int f = 0; f <= c; f++) {
					dp[d & 1][e][f] = dp[(d + 1) & 1][e][f];
					if (e >= 1 && f >= (a - d + 1)) {
						dp[d & 1][e][f] = (dp[d & 1][e][f] + dp[d & 1][e - 1][f - (a - d + 1)])%100000;
					}
				}
			}
		}
		int sum = 0;
		for (int i = 0; i <= b; i++) {
			sum += dp[a & 1][i][c]%100000;
		}
		cout << sum << endl;
	}
}

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

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

int dp[2][2000][3000];
signed main() {
	int a, b, c;
	while (cin >> a >> b >> c, a || b || c) {
		a *= a;
		c -= a*(a + 1) / 2;
		b -= a;
		memset(dp, 0, sizeof(dp));
		dp[0][0][0] = 1;
		for (int d = 1; d <= a; d++) {
			memset(dp[d & 1], 0, sizeof(dp[d & 1]));
			for (int e = 0; e <= b; e++) {
				for (int f = 0; f <= c; f++) {
					dp[d & 1][e][f] = dp[(d + 1) & 1][e][f];
					if (e >= 1 && f >= (a - d + 1)) {
						dp[d & 1][e][f] = (dp[d & 1][e][f] + dp[d & 1][e - 1][f - (a - d + 1)])%100000;
					}
				}
			}
		}
		int sum = 0;
		for (int i = 0; i <= b; i++) {
			sum = (sum+dp[a & 1][i][c])%100000;
		}
		cout << sum << endl;
	}
}

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

#include <cstdio>
using namespace std;

int n, m, s;
int dp[49][2001][3001];

int main(){
	while(1){
		scanf("%d %d %d", &n, &m, &s);
		if(n == 0) break;
		dp = {{{}}};

		for(int i=1; i<s+1; i++){
			dp[0][i][i] = 1;
		}

		for(int i=1; i<n*n; i++){
			for(int j=1; j<s+1; j++){
				for(int k=1; k<m+1; k++){
					for(int l=1; l<k; l++){
						dp[i][j][k] += dp[i-1][j-k][l];
						dp[i][j][k] %= 100000;
					}
				}
			}
		}

		for(int i=1; i<m+1; i++){
			ans += dp[n*n-1][s][i];
			ans %= 100000;
		}

		printf("%d\n", ans);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:20: error: assigning to an array from an initializer list
   11 |                 dp = {{{}}};
      |                 ~~~^~~~~~~~
a.cc:29:25: error: 'ans' was not declared in this scope
   29 |                         ans += dp[n*n-1][s][i];
      |                         ^~~
a.cc:33:32: error: 'ans' was not declared in this scope
   33 |                 printf("%d\n", ans);
      |                                ^~~