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

import java.util.Scanner;
import java.util.Stack;
import java.util.ArrayDeque;

public class Main{
    public static void main(String[] aaa){
        Scanner s = new Scanner(System.in);
        Stack<Integer> x =new Stack <Integer>();
        Stack<Integer> y =new Stack <Integer>();
        int h,w,i,j,k,l,count=0,xx,yy,nx,ny;
        int[][] memo = new int[51][51];
        while(true){
        h = s.nextInt();
        w = s.nextInt();
        if(h==0&&w==0)break;
        for(i=1;i<=w;i++){
            for(j=1;j<=h;j++){
                memo[i][j] = s.nextInt();
            }
        }
        for(i=1;i<=h;i++){
            for(j=1;j<=w;j++){
                if(memo[i][j]==1){
                   // System.out.println("b"+(i)+" "+(j));
                    memo[i][j]=0;
                    x.push(i);
                    y.push(j);
                    //System.out.println("now"+now.x+" "+now.y);
                    while(x.size()>0&&y.size()>0){
                        nx=x.pop();
                        ny=y.pop();
                        
                        //System.out.println("a"+now.x+" "+now.y);
                        for(k=-1;k<=1;k++){
                            for(l=-1;l<=1;l++){
                                //if(nx==1)System.out.println("c"+(nx+k)+" "+(ny+l));
                                if((nx+k)>=1&&(nx+k)<=h&&(ny+l)>=1&&(ny+l)<=w&&memo[nx+k][ny+l]==1){
                                    memo[nx+k][ny+l]=0;
                                    x.push(nx+k);
                                    y.push(ny+l);
                                    //System.out.println("a"+(nx+k)+" "+(ny+l));
                                    //System.out.println(x.size()+" "+y.size());
                                }
                            }
                        }
                    }
                    count++;
                }
            }
        }
        System.out.println(count);
        count =0;
        for(i=1;i<=50;i++)for(j=1;j<=50;j++)memo[i][j]=0;
    }
    }
    System.out.println();
}


Compiler output:
Main.java:56: error: <identifier> expected
    System.out.println();
                      ^
1 error
Language: Java

import java.util.Scanner;
import java.util.Stack;
import java.util.ArrayDeque;

public class Main{
    public static void main(String[] aaa){
        Scanner s = new Scanner(System.in);
        Stack<Integer> x =new Stack <Integer>();
        Stack<Integer> y =new Stack <Integer>();
        int h,w,i,j,k,l,count=0,xx,yy,nx,ny;
        int[][] memo = new int[51][51];
        while(true){
        h = s.nextInt();
        w = s.nextInt();
        if(h==0&&w==0)break;
        for(i=1;i<=w;i++){
            for(j=1;j<=h;j++){
                memo[i][j] = s.nextInt();
            }
        }
        for(i=1;i<=h;i++){
            for(j=1;j<=w;j++){
                if(memo[i][j]==1){
                   // System.out.println("b"+(i)+" "+(j));
                    memo[i][j]=0;
                    x.push(i);
                    y.push(j);
                    //System.out.println("now"+now.x+" "+now.y);
                    while(x.size()>0&&y.size()>0){
                        nx=x.pop();
                        ny=y.pop();
                        
                        //System.out.println("a"+now.x+" "+now.y);
                        for(k=-1;k<=1;k++){
                            for(l=-1;l<=1;l++){
                                //if(nx==1)System.out.println("c"+(nx+k)+" "+(ny+l));
                                if((nx+k)>=1&&(nx+k)<=h&&(ny+l)>=1&&(ny+l)<=w&&memo[nx+k][ny+l]==1){
                                    memo[nx+k][ny+l]=0;
                                    x.push(nx+k);
                                    y.push(ny+l);
                                    //System.out.println("a"+(nx+k)+" "+(ny+l));
                                    //System.out.println(x.size()+" "+y.size());
                                }
                            }
                        }
                    }
                    count++;
                }
            }
        }
        System.out.println(count);
        count =0;
        for(i=1;i<=50;i++)for(j=1;j<=50;j++)memo[i][j]=0;
    }
    }
    System.out.println();
}
}


Compiler output:
Main.java:56: error: <identifier> expected
    System.out.println();
                      ^
Main.java:58: error: class, interface, enum, or record expected
}
^
2 errors
Language: Java

import java.util.Scanner;

public class Main {
private static int[][]daoyu;
private static int count;
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        while (true) {
            int x = input.nextInt();
            int y = input.nextInt();
            if (x == 0 && y == 0) {
            	break;
            	}
            daoyu = new int [x+2][y+2];
            for(int i = 1;i<=x;i++) {
            	for(int j = 1;j<=y;j++) {
            		daoyu[i][j]=input.nextInt();
            		}
            }
            for (int i=0; i<x+2; i++){
            	daoyu[i][0] = daoyu[i][y+1] = 0;
         
            for (int j=0; j<y+2; j++){
            	daoyu[0][j] = daoyu[x+1][j] = 0;
 
            count = 0;
            }
        }
        for (int i = 1; i <= x; i++) {
            for (int j = 1; j <=y; j++) {
                if (daoyu[i][j] == 1) {
                    count++;
                    lj(i, j);
                }
            }
        } 
        System.out.println(count);
        daoyu=null;
    }
    }
    private static void lj(int i, int j) {
    	 daoyu[i][j] = 2;
         if (i - 1 >= 0 && daoyu[i - 1][j] == 1)
             lj(i - 1, j);
         if (i - 1 >= 0 && j-1>=0 && daoyu[i - 1][j-1] == 1)
             lj(i - 1, j-1);
         if (i - 1 >= 0 && j+1<daoyu.length && daoyu[i - 1][j] == 1)
             lj(i - 1, j+1);
         if (i + 1 < daoyu.length && daoyu[i + 1][j] == 1)
             lj(i + 1, j);
         if (i + 1 < daoyu.length && j-1>=0 && daoyu[i + 1][j-1] == 1)
             lj(i + 1, j-1);
         if (i + 1 < daoyu.length && j+1<daoyu.length &&daoyu[i + 1][j+1] == 1)
             lj(i + 1, j+1);
         if (j - 1 >= 0 && daoyu[i][j - 1] == 1)
             lj(i, j - 1);
         if (j + 1 < daoyu[i].length && daoyu[i][j + 1] == 1)
             lj(i - 1, j + 1);
     }



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

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new A();
	}

	int w, h;
	int[][] c;

	Main() {
		Scanner sc = new Scanner(System.in);
		while (true) {
			w = sc.nextInt();
			h = sc.nextInt();

			if (w == 0 && h == 0)
				break;

			c = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					c[i][j] = sc.nextInt();
				}
			}

			int ans = 0;
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (f(i, j))
						ans++;
				}
			}
			System.out.println(ans);
		}
	}

	boolean f(int x, int y) {
		try {
			if (c[y][x] == 0) {
				return false;
			}
		} catch (Exception e) {
			return false;
		}

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

		c[y][x] = 0;

		for (int i = 0; i < 8; i++) {
			f(x + dx[i], y + dy[i]);
		}
		return true;
	}

}

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

import java.util.*;

public class MainThree {
	static int w;
	static int h;
	static int[][] fi;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			w = sc.nextInt();
			h = sc.nextInt();
			if (w == 0 && h == 0)
				break;
			fi = new int[h][w];
			for (int i = 0; i < h; i++)
				for (int j = 0; j < w; j++)
					fi[i][j] = sc.nextInt();
			int n = 0;
			for (int i = 0; i < h; i++)
				for (int j = 0; j < w; j++)
					if (fi[i][j] == 1)
						n += loop(j, i);
			System.out.println(n);
		}
		sc.close();
	}

	public static int loop(int x, int y) {
		fi[x][y] = 0;
		if (x > 0 && y > 0) {
			if (fi[x - 1][y] == 1)
				loop(x - 1, y);
			if (fi[x - 1][y - 1] == 1)
				loop(x - 1, y - 1);
			if (fi[x][y - 1] == 1)
				loop(x, y - 1);
		}
		if (x > 0 && y < w - 1) {
			if (fi[x - 1][y + 1] == 1)
				loop(x - 1, y + 1);
			if (fi[x][y + 1] == 1)
				loop(x, y + 1);
		}
		if (x < h - 1 && y < w - 1) {
			if (fi[x + 1][y + 1] == 1)
				loop(x + 1, y + 1);
			if (fi[x + 1][y] == 1)
				loop(x + 1, y);
		}
		if (x < h - 1 && y > 0)
			if (fi[x + 1][y - 1] == 1)
				loop(x + 1, y - 1);
		return 1;
	}
}

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

#include<iostream>
using namespace std;
int w,h,i,j;
int map[52][52];

void rec(int i,int j){
 
  if(map[i][j]==0)return;
  map[i][j]=0;
  rec(i+1,j);
  rec(i-1,j);
  rec(i,j-1);
  rec(i,j+1);
  rec(i-1,j-1);
  rec(i-1,j+1);
  rec(i+1,j-1);
  rec(i+1,j+1);
}
int main(){
  
  
  while(1){
    cin >> w >> h;
    if(w==0 && h==0)break;
    
    for(i=1;i<=h;i++){
      for(j=1;j<=w;j++){
	cin >> map[i][j];
	
      }
    }
    int count=0;
    for(int k=1;k<=h;k++){
      for(int l=1;l<=w;l++){
	if(map[k][l]==1){
	  count++;
	  rec(k,l);
	}
      }
    }
    cout << count << 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<stdio.h>
#include<stdlib.h>

int main() {

	int w,h;
	int i,j,**map,count;
	int pos_x,pos_y;

	for(;;) {
		scanf("%d %d",&w,&h);
		if(!w&&!h) break;

		map=malloc(h*sizeof(int));
		for(i=0;i<h;i++) {
			map[i]=(int *)malloc(w*sizeof(int));
		}

		for(i=0;i<h;i++)
			for(j=0;j<w;j++)
				scanf("%d",&map[i][j]);

		count=0;
		for(pos_x=0;pos_x<w;pos_x++) {
			for(pos_y=0;pos_y<h;pos_y++) {
				if(map[pos_y][pos_x]==1) {
					count++;
					Search(map,pos_x,pos_y,h,w);
				}
			}
		}
		printf("%d\n",count);
	}
		return 0;
	}

Compiler output:
main.c: In function 'main':
main.c:28:41: error: implicit declaration of function 'Search'; did you mean 'bsearch'? [-Wimplicit-function-declaration]
   28 |                                         Search(map,pos_x,pos_y,h,w);
      |                                         ^~~~~~
      |                                         bsearch
Language: C

#include <stdio.h>
int a, b;
scanf("%d", &a, &b);
int G[a][b]
int i, j;

for(i=0;i<a;i++){
    for(j=0;j<b;j++){
      scanf("%d", &G[i][j]);
    }
  }

void visit(int i, int j){
  int di[8] = { 0, -1, -1, -1, 0, 1, 1, 1};
  int dj[8] = { 1, 1, 0, -1, -1, -1, 0, 1};
  int r;
  int ni, nj;

  G[i][j]=0;

  for( r=0; r<8; r++){
    ni = i+di[r];
    nj = j+dj[r];

  if(0<=ni<=a-1 && 0<=nj<=b-1 && G[ni][nj]==1)
    visit(ni, nj);
  }
}

main(void){
  int count;

  for(i=0;i<a;i++){
    for(j=0;j<b;j++){
      if(G[i][j]==1){
        count++;
        visit(i, j);
      }
    }
  }
  printf("%d\n", count);

  return 0;
}

Compiler output:
main.c:3:7: error: expected declaration specifiers or '...' before string constant
    3 | scanf("%d", &a, &b);
      |       ^~~~
main.c:3:13: error: expected declaration specifiers or '...' before '&' token
    3 | scanf("%d", &a, &b);
      |             ^
main.c:3:17: error: expected declaration specifiers or '...' before '&' token
    3 | scanf("%d", &a, &b);
      |                 ^
main.c:4:12: error: expected ';' before 'int'
    4 | int G[a][b]
      |            ^
      |            ;
    5 | int i, j;
      | ~~~         
main.c:7:1: error: expected identifier or '(' before 'for'
    7 | for(i=0;i<a;i++){
      | ^~~
main.c:7:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    7 | for(i=0;i<a;i++){
      |          ^
main.c:7:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    7 | for(i=0;i<a;i++){
      |              ^~
main.c: In function 'visit':
main.c:19:3: error: 'G' undeclared (first use in this function)
   19 |   G[i][j]=0;
      |   ^
main.c:19:3: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:30:1: error: return type defaults to 'int' [-Wimplicit-int]
   30 | main(void){
      | ^~~~
main.c: In function 'main':
main.c:35:10: error: 'G' undeclared (first use in this function)
   35 |       if(G[i][j]==1){
      |          ^
Language: C

#include <stdio.h>

void visit(int i, int j){
  int di[8] = { 0, -1, -1, -1, 0, 1, 1, 1};
  int dj[8] = { 1, 1, 0, -1, -1, -1, 0, 1};
  int r;
  int ni, nj;

  G[i][j]=0;

  for( r=0; r<8; r++){
    ni = i+di[r];
    nj = j+dj[r];

  if(0<=ni<=a-1 && 0<=nj<=b-1 && G[ni][nj]==1)
    visit(ni, nj);
  }
}

main(void){
int a, b;
scanf("%d", &a, &b);
int G[a][b];
int i, j;
for(i=0;i<a;i++){
  for(j=0;j<b;j++){
    scanf("%d", &G[i][j]);
    }
  
  int count;

  for(i=0;i<a;i++){
    for(j=0;j<b;j++){
      if(G[i][j]==1){
        count++;
        visit(i, j);
      }
    }
  }
  printf("%d\n", count);

  return 0;
}

Compiler output:
main.c: In function 'visit':
main.c:9:3: error: 'G' undeclared (first use in this function)
    9 |   G[i][j]=0;
      |   ^
main.c:9:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:13: error: 'a' undeclared (first use in this function)
   15 |   if(0<=ni<=a-1 && 0<=nj<=b-1 && G[ni][nj]==1)
      |             ^
main.c:15:27: error: 'b' undeclared (first use in this function)
   15 |   if(0<=ni<=a-1 && 0<=nj<=b-1 && G[ni][nj]==1)
      |                           ^
main.c: At top level:
main.c:20:1: error: return type defaults to 'int' [-Wimplicit-int]
   20 | main(void){
      | ^~~~
main.c: In function 'main':
main.c:43:1: error: expected declaration or statement at end of input
   43 | }
      | ^
Language: C

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

int w, h;
int island[50][50];

void dfs(int a, int b)
{
	int dx, dy;
	
	island[a][b] = 0;
	
	for (dy = -1; dy < 2; dy++){
		for (dx = -1; dx < 2; dx++){
			if (dx == 0 && dy == 0){
				continue;
			}
			if (0 <= a + dy && a + dy < h && 0 <= b + dx && b + dx < w && island[a + dy][b + dx] == 1){
				dfs(a + dy, b + dx);
			}
		}
	}
	return;
}

int main(void)
{
	int i, j;
	int count;
	
	while (1){
		scanf("%d%d", &w, &h);
		
		if (w + h == 0){
			break;
		}
		
		for (i = 0; i < h; i++){
			for (j = 0; j < w; j++){
				scanf("%d", &island[i][j]);
			}
		}
		
		count = 0;
		for (i = 0; i < h; i++){
			for (j = 0; j < w; j++){
				if (island[i][j]){
					dfs(i, j);
					count++;
				}
			}
		}
		
		printf("%d\n", count);
	}
	
	return (0);
}
#include <stdio.h>
#include <string.h>

int w, h;
int island[50][50];

void dfs(int a, int b)
{
	int dx, dy;
	
	island[a][b] = 0;
	
	for (dy = -1; dy < 2; dy++){
		for (dx = -1; dx < 2; dx++){
			if (dx == 0 && dy == 0){
				continue;
			}
			if (0 <= a + dy && a + dy < h && 0 <= b + dx && b + dx < w && island[a + dy][b + dx] == 1){
				dfs(a + dy, b + dx);
			}
		}
	}
	return;
}

int main(void)
{
	int i, j;
	int count;
	
	while (1){
		scanf("%d%d", &w, &h);
		
		if (w + h == 0){
			break;
		}
		
		for (i = 0; i < h; i++){
			for (j = 0; j < w; j++){
				scanf("%d", &island[i][j]);
			}
		}
		
		count = 0;
		for (i = 0; i < h; i++){
			for (j = 0; j < w; j++){
				if (island[i][j]){
					dfs(i, j);
					count++;
				}
			}
		}
		
		printf("%d\n", count);
	}
	
	return (0);
}

Compiler output:
main.c:65:6: error: redefinition of 'dfs'
   65 | void dfs(int a, int b)
      |      ^~~
main.c:7:6: note: previous definition of 'dfs' with type 'void(int,  int)'
    7 | void dfs(int a, int b)
      |      ^~~
main.c:84:5: error: redefinition of 'main'
   84 | int main(void)
      |     ^~~~
main.c:26:5: note: previous definition of 'main' with type 'int(void)'
   26 | int main(void)
      |     ^~~~
Language: C

#include <cstdio>
#include <stack>
#include <utility>

using namespace std;

typedef pair<int, int> point;

int w, h;
int c[50][50];
const int d[8][2] = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

int count()
{
    stack<point> s;
    bool v[50][50] = {};
    int n = 0;

    for (int y = 0; y < h; ++y) {
        for (int x = 0; x < w; ++x) {
            if (v[x][y] || c[x][y] == 0)
                continue;

            s.push(point(x, y));
            v[x][y] = true;
            ++n;
            while (!s.empty()) {
                int x = s.top().first, y = s.top().second;
                s.pop();

                for (int i = 0; i < 8; ++i) {
                    int xx = x + d[i][0], yy = y + d[i][1];
                    if (0 <= xx && xx < w && 0 <= yy && yy < h
                            && !v[xx][yy] && c[xx][yy] == 1) {
                        s.push(point(xx, yy));
                        v[xx][yy] = true;
                    }
                }
            }
        }
    }

    return n;
}

int main()
{
    for (;;) {
        scanf("%d %d", &w, &h);
        if (w == 0 && h == 0)
            break;

        for (int i = 0; i < h; ++i)
            for (int j = 0; j < w; ++j)
                scanf("%d", &c[j][i]);

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

    return 0;
}

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

#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
static const ll maxLL = (ll)1 << 62;

//dfs(bool型)
int dy[]={-1,0,1,0,1,-1,-1,1};
int dx[]={0,1,0,-1,1,1,-1,-1};
bool visited[1000][1000];
int t[1000][1000];
char copy_t[1000][1000];
int h,w;
int si,sj;

void dfs(int y,int x){
  if(y<=0||x<=0)return;
  if(y>h||x>w)return;
  if(t[y][x]==0)return;
  if(visited[y][x])return;
  visited[y][x]=true;
  for(int i=0;i<8;i++){
    int ny=y+dy[i];
    int nx=x+dx[i];
    dfs(ny,nx);
  }
  return;
}

int main(){
    while(0){
    int cnt=0;
    cin>>w>>h;
    if(w==\0 && h==\0)break;
    repe(i,1,h){
        for(int j=1;j<=w;j++){
            cin>>t[i][j];
        }
    }
    repe(i,1,h){
        repe(j,1,w){
             if(t[i][j]==1 && visited[i][j]==false)cnt++;
        dfs(i,j);
        }
    }
    cout<<cnt<<endl;
}
return 0;
}


Compiler output:
a.cc:40:11: error: stray '\' in program
   40 |     if(w==\0 && h==\0)break;
      |           ^
a.cc:40:20: error: stray '\' in program
   40 |     if(w==\0 && h==\0)break;
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
typedef pair<int,int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int w,h;
int nx,ny;
void dfs(vector<vector<int>> &G,int a,int b){
    G.at(a).at(b)=0;
    
    for(int k=-1;k<=1;k++){
        for(int s=-1;s<=1;l++){
            nx=a+k;
            ny=b+s;
        if(0<=nx&& nx<h && 0<=ny&& ny<w && G.at(nx).at(ny)==1) dfs(G,nx,ny);
        }
    }
    return ;
}



int main(){
    int w,h;
    cin>>w>>h;
    vector<vector<int>>G(h,vector<int>(w));
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>G.at(i).at(j);
        }
    }
    int count=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(G.at(i).at(j)==1){
                dfs(G,i,j);
                count++;
            }
        }
    }
cout<<count<<endl;
}


Compiler output:
a.cc: In function 'void dfs(std::vector<std::vector<int> >&, int, int)':
a.cc:13:27: error: 'l' was not declared in this scope
   13 |         for(int s=-1;s<=1;l++){
      |                           ^
Language: C++

#include <cstdio>
#include <cstdlib>
#include <vector>
#include <iostream>

using namespace std;


#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

int h,w;

int c[52][52];

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


void dfs(int i,int j);



int main(){


	while(1){
		cin >> w >> ;

		if(h==0 && w == 0){
			break;
		}

		cnt=0;

		REP(i,h){
			REP(j,w){


				cin >> c[i][j] ;

			}
		}

		REP(i,h){
			REP(j,w){

				//cnt++??????????????\???????????????????????\???????????????
				if(c[i][j] == 1){
					cnt++;
					dfs(j,i);
				}
			}
		}

		cout << cnt << endl;
	}
	return 0;
}

void dfs(int i,int j){

	if(c[j][i] == 1){

		c[j][i] = 0;
		REP(k,8){
			//w???<=???????????£??????????????????
			if(0 <= i+dx[k] && i+dx[k] < w && 0 <= j+dy[k] && j+dy[k] < h){

				dfs(i+dx[k],j+dy[k]);
			}
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:29: error: expected primary-expression before ';' token
   31 |                 cin >> w >> ;
      |                             ^
Language: C++

#include <cstdio>
#define f(n)for(int i=0;i<n;i++)
#define s(w)scanf("%d",&w)
int a,n,m,d[99][99];
int u[16]={-1,-1,-1,0,0,1,1,1,-1,0,1,-1,1,-1,0,1};
void k(int x,int y){
	if(d[x+1][y+1]){f(8)k(x+u[i],y+u[i+8]);d[x+1][y+1]=0;}
}
int main(){
	a=0;
	s(n);s(m);
	f(10000)d[i]=0;
	f(n*m)s(d[i/n][i%n]);
	f(n*m)if(d[i/n][i%n])a++,k(i/n,i%n);
	printf("%d\n",a);
	main();
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: incompatible types in assignment of 'int' to 'int [99]'
   12 |         f(10000)d[i]=0;
      |                 ~~~~^~
Language: C++

#include<iostream>
using namespace std;
void b(int ,int );
int a[100][100]={};
 
int main(){
  while(1){
    int count=0,w,h;
    cin>>w>>h;
    if(w+h==0)break;
     
    for(int i=1;i<=h;i++)
      for(int j=1;j<=w;j++)
    cin>>a[i][j];
 
    for(int i=1;i<=h;i++)
      for(int j=1;j<=w;j++)
    if(a[i][j]==1){
      dfs(j,i);
      count++;
    }
    cout<<count<<endl;  
  }
  return 0;
}
 
  void b(int x,int y){
    a[y][x]=0;
    int x1,y1;
    int x2[8]={-1,0,1,1,1,0,-1,-1};
    int y2[8]={1,1,1,0,-1,-1,-1,0};
    for(int k=0;k<8;k++){
    x1=x+x2[k];
    y1=y+y2[k];
    if(a[y1][x1]==1)
      dfs(x1,y1);
    }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:19:7: error: 'dfs' was not declared in this scope
   19 |       dfs(j,i);
      |       ^~~
a.cc: In function 'void b(int, int)':
a.cc:36:7: error: 'dfs' was not declared in this scope
   36 |       dfs(x1,y1);
      |       ^~~
Language: C++

#include <iostream>
using namespace std;
void kazoeruyo(int p,int P,int box[50][50]){
  box[p][P]=0;
    if(box[p][P+1]==1) {
      box[p][P+1]=0;
      P=P+1; 
      kazoeruyo(p,P,box);
    }
    if(box[p][P-1]==1){
      box[p][P-1]=0;
      P=P-1;
      kazoeruyo(p,P,box);
    }
    if(box[p+1][P]==1){ 
      box[p+1][P]=0;
      p=p+1;
      kazoeruyo(p,P,box);
    }
    if(box[p-1][P]==1){
      box[p-1][P]=0;
      p=p-1;
      kazoeruyo(p,P,box);
    }
    if(box[p-1][P-1]==1){
      box[p-1][P-1]=0;
      p=p-1;
      P=P-1;
      kazoeruyo(p,P,box);
    }
    if(box[p-1][P+1]==1){
      box[p-1][P+1]=0;
      p=p-1;
      P=P+1;
      kazoeruyo(p,P,box);
    }
    if(box[p+1][P+1]==1){
      box[p+1][P+1]=0;
      p=p+1;
      P=P+1;
      kazoeruyo(p,P,box);
    }
    if(box[p+1][P-1]==1){
      box[p+1][P-1]=0;
      p=p+1;
      P=P-1;
      kazoeruyo(p,P,box);
    }	
}
int main(){
  int w,h,i,I,p,P,o,t,T,y,Y;
  int box[10][10];
  while(1){
    cin>>w>>h;
    if(w==0&&h==0) break;
    for(i=0;i<h;i++){
      for(I=0;I<w;I++){
	cin>>box[i][I];
      }
    }
    o=0;
    for(i=0;i<h;i++){
      for(I=0;I<w;I++){
	if(box[i][I]==1) {
	  p=i;
	  P=I;
	  kazoeruyo(p,P,box);
	  box[p][P]=1;
	}
      }
    }
    for(i=0;i<h;i++){
      for(I=0;I<w;I++){
	if(box[i][I]==1) o++;
      }
    }
    cout<<o<<endl;
    o=0;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:25: error: cannot convert 'int (*)[10]' to 'int (*)[50]'
   67 |           kazoeruyo(p,P,box);
      |                         ^~~
      |                         |
      |                         int (*)[10]
a.cc:3:32: note:   initializing argument 3 of 'void kazoeruyo(int, int, int (*)[50])'
    3 | void kazoeruyo(int p,int P,int box[50][50]){
      |                            ~~~~^~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;
int box[51][51];
int main(){
  int w,h,i,I,a;
  while(1){
    a=0;
    cin>>w>>h;
    if(w==0&&h==0) break;
    for(i=0;i<=h+1;i++){
      for(I=0;I<=w+1;I++){
	box[i][I]==0;
      }
    }
    for(i=1;i<=h;i++){
      for(I=1;I<=w;I++){
	cin>>box[i][I];
      }
    }
    for(i=1;i<=h;i++){
      for(I=1;I<=w;I++){
	if(box[i][I]==1){
	  kazu(i,I);
	  a++;
	}
      }
    }
    cout<<a<<endl;
  }
  return 0;
}
  void kazu(int i,int I){
    if(box[i][I+1]==1) {
      box[i][I+1]=0;
      kazu(i,I+1);
    }
    if(box[i][I-1]==1) {
      box[i][I-1]=0;
      kazu(i,I-1);
    }
    if(box[i+1][I]==1) {
      box[i+1][I]=0;
      kazu(i+1,I);
    }
    if(box[i+1][I+1]==1) {
      box[i+1][I+1]=0;
      kazu(i+1,I+1);
    }
    if(box[i+1][I-1]==1) {
      box[i+1][I-1]=0;
      kazu(i+1,I-1);
    }
    if(box[i-1][I+1]==1) {
      box[i-1][I+1]=0;
      kazu(i-1,I+1);
    }
    if(box[i-1][I-1]==1) {
      box[i-1][I+1]=0;
      kazu(i-1,I+1);
    }
    if(box[i-1][I]==1) {
      box[i-1][I]=0;
      kazu(i-1,I);
    }

  }

Compiler output:
a.cc: In function 'int main()':
a.cc:23:11: error: 'kazu' was not declared in this scope
   23 |           kazu(i,I);
      |           ^~~~
Language: C++

#include<iostream>
using namespace std;

int w,h;
int filed[51][51];

void dfs(int x,int y){
  filexd[x][y]=0;
  for(int dx=-1;dx<=1;dx++){
    for(int dy=-1;dy<=1;dy++){
      int nx=x+dx,ny=y+dy;
      if(0<=nx&&nx<h&&0<=ny&&ny<w&&filed[nx][ny]==1)dfs(nx,ny);
    }
  }
}

void solve(){
  int res=0;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(filed[i][j]==1){
	dfs(i,j);
	res++;
      }
    }
  }
  cout<<res<<endl;
}

int main(){
  while(1){
    cin>>w>>h;
    if(w+h==0)break;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin>>filed[i][j];
      }
    }
    solve();
  }
  return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:8:3: error: 'filexd' was not declared in this scope; did you mean 'filed'?
    8 |   filexd[x][y]=0;
      |   ^~~~~~
      |   filed
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e7+9
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int w, h;
int c[100][100];
int ans;
void dfs(int y, int x){
	c[y][x] = 0;
	for (int i = -1; i <= 1; i++){
		for (int j = -1; j <= 1; j++){
			int ny = y + i, nx = x + j;//??????8???????????§?¨?
			if (ny >= 0 && ny < h&&nx >= 0 && nx < w){//?????????????????????
				//???????????£???????????¶???????????????????????°
				if (c[ny][nx] == 1)dfs(ny, nx);
			}
		}
	}
}

int main(){
	while (cin >> w >> h&&w + h){
		for (int i = 0; i < h; i++)for (int j = 0; j < w; j++) cin >> c[i][j];
		ans = 0;
		for (int i = 0; i < h; i++){
			for (int j = 0; j < w; j++){
				if (c[i][j] == 1){//??¶??????????????????
					solve(i, j);//???????????£???????????¶????????¶???
					ans++;
				}
			}
		}
		cout << ans << endl;
	}
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:64:41: error: 'solve' was not declared in this scope
   64 |                                         solve(i, j);//???????????£???????????¶????????¶???
      |                                         ^~~~~
a.cc: At global scope:
a.cc:72:1: error: expected declaration before '}' token
   72 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
???
using ll=long long;
#define int ll
???
#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
???
int read(){
	int i;
	scanf("%lld",&i);
	return i;
}
???
int land[100][100]={0};
int dy[]={-1,-1,-1,0,0,1,1,1};
int dx[]={-1,0,1,-1,1,-1,0,1};
int cnt=0;
???
void isLand(int i,int j){
    if(land[i][j]==1){
    	land[i][j] = 0;
		REP(k,8){
			int newy=i+dy[k];
			int newx=j+dx[k];
			isLand(newy,newx);
		}
    }
}
???
signed main(){
	int w,h;
	while( w=read(),h=read(),w||h){
		cnt=0;
		
		REP(i,100){
			REP(j,100){
				land[i][j]=0;
			}
		}
		FOR(i,1,w+1){
			FOR(j,1,h+1){
				land[i][j]=read();
			}
		}
		
		FOR(i,1,w+1){
			FOR(j,1,h+1){
				if(land[i][j]==1){
					cnt++;
					isLand(i,j);
				}
			}
		}
		
		cout << cnt << endl;
	}
	
}

Compiler output:
a.cc:3:1: error: expected unqualified-id before '?' token
    3 | ???
      | ^
a.cc:6:1: error: expected unqualified-id before '?' token
    6 | ???
      | ^
a.cc:15:1: error: expected unqualified-id before '?' token
   15 | ???
      | ^
a.cc:5:13: error: 'll' does not name a type
    5 | #define int ll
      |             ^~
a.cc:17:1: note: in expansion of macro 'int'
   17 | int dy[]={-1,-1,-1,0,0,1,1,1};
      | ^~~
a.cc:5:13: error: 'll' does not name a type
    5 | #define int ll
      |             ^~
a.cc:18:1: note: in expansion of macro 'int'
   18 | int dx[]={-1,0,1,-1,1,-1,0,1};
      | ^~~
a.cc:5:13: error: 'll' does not name a type
    5 | #define int ll
      |             ^~
a.cc:19:1: note: in expansion of macro 'int'
   19 | int cnt=0;
      | ^~~
a.cc:20:1: error: expected unqualified-id before '?' token
   20 | ???
      | ^
a.cc:31:1: error: expected unqualified-id before '?' token
   31 | ???
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
???
using ll=long long;
#define int ll
???
#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
???
int read(){
	int i;
	scanf("%lld",&i);
	return i;
}
???
int land[100][100]={0};
int dy[]={-1,-1,-1,0,0,1,1,1};
int dx[]={-1,0,1,-1,1,-1,0,1};
int cnt=0;
???
void isLand(int i,int j){
    if(land[i][j]==1){
    	land[i][j] = 0;
		REP(k,8){
			int newx=j+dx[k];
			int newy=i+dy[k];
			isLand(newy,newx);
		}
    }
}
???
signed main(){
	int w,h;
	while( w=read(),h=read(),w||h){
		cnt=0;
		
		REP(i,100){
			REP(j,100){
				land[i][j]=0;
			}
		}
		FOR(i,1,w+1){
			FOR(j,1,h+1){
				land[i][j]=read();
			}
		}
		
		FOR(i,1,w+1){
			FOR(j,1,h+1){
				if(land[i][j]==1){
					cnt++;
					isLand(i,j);
				}
			}
		}
		
		cout << cnt << endl;
	}
	
}

Compiler output:
a.cc:3:1: error: expected unqualified-id before '?' token
    3 | ???
      | ^
a.cc:6:1: error: expected unqualified-id before '?' token
    6 | ???
      | ^
a.cc:15:1: error: expected unqualified-id before '?' token
   15 | ???
      | ^
a.cc:5:13: error: 'll' does not name a type
    5 | #define int ll
      |             ^~
a.cc:17:1: note: in expansion of macro 'int'
   17 | int dy[]={-1,-1,-1,0,0,1,1,1};
      | ^~~
a.cc:5:13: error: 'll' does not name a type
    5 | #define int ll
      |             ^~
a.cc:18:1: note: in expansion of macro 'int'
   18 | int dx[]={-1,0,1,-1,1,-1,0,1};
      | ^~~
a.cc:5:13: error: 'll' does not name a type
    5 | #define int ll
      |             ^~
a.cc:19:1: note: in expansion of macro 'int'
   19 | int cnt=0;
      | ^~~
a.cc:20:1: error: expected unqualified-id before '?' token
   20 | ???
      | ^
a.cc:31:1: error: expected unqualified-id before '?' token
   31 | ???
      | ^
Language: C++

/************************************
 * ???????????¢?´¢??§??¶?????°?????°??????????????°?????? *
 ************************************/

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

#define LAND '1'  //??? char???
#define SEA  '0'   //??? char???

using namespace std;

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

/*8??????*/
int dx[] = {1,1,0,-1,-1,-1, 0, 1};
int dy[] = {0,1,1, 1, 0,-1,-1,-1};

bool input(vector< vector<char> > &m);
void delete_island(vector< vector< char > > &m, int x, int y);
void output(vector< vector< char> > m);


int main(){
  int w, h;
    
  while(cin >> w >> h, w && h){
    vector< vector< char > > m(h+2, vector<char>(w+2));
    input(m);
    
    int island = 0;
    for(int y = 0; y < m.size(); y++){
      for(int x = 0; x < m[y].size(); x++){
	if(m[y][x] == LAND){
	  delete_island(m,x,y);
	  island++;
	}
      }
    }
    cout << island << endl;
  }
}


bool input(vector< vector<char> > &m){
  for(int y = 0; y < m.size(); y++){
    for(int x = 0; x < m[y].size(); x++){
      if(y == 0 || x == 0 ||
	 y == m.size()-1 || x == m[y].size()-1){
	m[y][x] = SEA;
      }else{
	if(!(cin >> m[y][x])) return false;
      }
    }
  }
  return true;
}


 void delete_island(vector< vector< char > > &m, int x, int y){
   queue< pair< int, int > > q;
   q.push(make_pair(x,y));

   while(!(q.empty())){
     pair<int, int> cur = q.front();
     q.pop();
     if(m[cur.second][cur.first] == LAND){
       m[cur.second][cur.first] = SEA;
       for(int i = 0; i < sizeof(dx)/sizeof(int); i++){
	 q.push(make_pair(cur.first+dx[i],cur.second+dy[i]));
       }
     }
   }
}

void output(vector< vector< char> > m){
  for(int y = 0; y < m.size()-1; y++){
    for(int x = 0; x < m[y].size()-1; x++{
      cout << m[y][x] << " ";
    }
    cout << endl;
  }
  cout << endl;
}

Compiler output:
a.cc: In function 'void output(std::vector<std::vector<char> >)':
a.cc:82:42: error: expected ')' before '{' token
   82 |     for(int x = 0; x < m[y].size()-1; x++{
      |        ~                                 ^
      |                                          )
Language: C++

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

int main(){
  bool map[52][52];
  int w,h;

  while(cin >> w >> h && w>0 && h>0){
    for(int i=0;i<52;i++){
      for(int j=0;j<52;j++)
        map[i][j]=false;
    }

    int land=0;

    for(int i=1;i<=h;i++){
      for(int j=1;j<=w;j++){
        int c;
        cin >> c;
        if(c==1) map[i][j]=true;
        land++;
      }
    }

    int visited=0,cnt=0;
    queue<int> cur;
    int d[8]={-w-3,-w-2,-w-1,-1,1,w+1,w+2,w+3}

    while(visited<land){
      cnt++;
      for(int i=0;i<(w+2)*(h+2);i++){
        if(map[i/(w+2)][i%(w+2)]){
          map[i/(w+2)][i%(w+2)]=false;
          visited++;
          cur.push(i);
          break;
        }
      }
      while(!cur.empty()){
        for(int i=0;i<8;i++){
          if(map[(cur.front()+d[i])/(w+2)][(cur.front()+d[i])%(w+2)]){
            map[(cur.front()+d[i])/(w+2)][(cur.front()+d[i])%(w+2)]=false;
            visited++;
            cur.push(cur.front()+d[i]);
          }
        }
        cur.pop();
      }
    }

    cout << cnt << endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:5: error: expected ',' or ';' before 'while'
   30 |     while(visited<land){
      |     ^~~~~
Language: C++

#include<iostream>
using namespace std;
int map[114][514];
int h, w;
bool dfs(int i, int j) {
	map[i][j] = 0;
	if (i > 0) {
		if (j > 0) {
			if (map[i - 1][j - 1] == 1)dfs(i - 1, j - 1);
		}
		if(map[i - 1][j] = 1)dfs(i - 1, j);
		if (j < w) {
			if (map[i - 1][j + 1] == 1)dfs(i - 1, j + 1);
		}
	}
	if (j > 0) {
		if (map[i][j - 1] == 1)dfs(i, j - 1);
	}
	if (j < w) {
		if (map[i][j + 1] == 1)dfs(i, j + 1);
	}
	if (i < h) {
		if (j > 0) {
			if (map[i + 1][j - 1] == 1)dfs(i + 1, j - 1);
		}
		if (map[i + 1][j] = 1)dfs(i + 1, j);
		if (j < w) {
			if (map[i + 1][j + 1] == 1)dfs(i + 1, j + 1);
		}
	}
	return;
}
int main() {
	while (cin >> h >> w) {
		if (!h && !w)return 0;
		int INF = 0;
		for (int i = 0; i < h; i++)for (int j = 0; j < w; j++)cin >> map[i][j];
		for (int i = 0; i < h; i++)for (int j = 0; j < w; j++)if (map[i][j] == 1) {
			INF++;
			dfs(i, j);
		}
		cout << INF << endl;
	}
}

Compiler output:
a.cc: In function 'bool dfs(int, int)':
a.cc:31:9: error: return-statement with no value, in function returning 'bool' [-fpermissive]
   31 |         return;
      |         ^~~~~~
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int W, H;
int c[50][50];
bool visited[50][50];
int vy[8] = {-1,-1,0,1,1,1,0,-1};
int vx[8] = {0,1,1,1,0,-1,-1,-1};
void calc(int y, int x) {
  if(y < 0 || y >= H || x < 0 || x >= W) return;
  if(visited[y][x] || c[y][x] == 0) return;
  visited[y][x] = true;
  FOR(i,0,8) calc(y+vy[i],x+vx[i]);
  return;
}
int main()
{
  while(cin >> W >> H, (W || H)) {
    CLR(visited);
    FOR(y,0,H) FOR(x,0,W) cin >> c[y][x];
    int ans = 0;
    FOR(y,0,H) {
      FOR(x,0,W) {
        if(visited[y][x] || c[y][x] == 0) continue;
        calc(y, x);
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: 'memset' was not declared in this scope
   17 | #define CLR(mat) memset(mat, 0, sizeof(mat))
      |                  ^~~~~~
a.cc:34:5: note: in expansion of macro 'CLR'
   34 |     CLR(visited);
      |     ^~~
a.cc:15:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   14 | #include <bitset>
  +++ |+#include <cstring>
   15 | using namespace std;
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <limits>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int W, H;
int c[50][50];
bool visited[50][50];
int vy[8] = {-1,-1,0,1,1,1,0,-1};
int vx[8] = {0,1,1,1,0,-1,-1,-1};
void calc(int y, int x) {
  if(y < 0 || y >= H || x < 0 || x >= W) return;
  if(visited[y][x] || c[y][x] == 0) return;
  visited[y][x] = true;
  FOR(i,0,8) calc(y+vy[i],x+vx[i]);
  return;
}
int main()
{
  while(cin >> W >> H, (W || H)) {
    CLR(visited);
    FOR(y,0,H) FOR(x,0,W) cin >> c[y][x];
    int ans = 0;
    FOR(y,0,H) {
      FOR(x,0,W) {
        if(visited[y][x] || c[y][x] == 0) continue;
        calc(y, x);
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:18: error: 'memset' was not declared in this scope
   18 | #define CLR(mat) memset(mat, 0, sizeof(mat))
      |                  ^~~~~~
a.cc:35:5: note: in expansion of macro 'CLR'
   35 |     CLR(visited);
      |     ^~~
a.cc:15:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   14 | #include <bitset>
  +++ |+#include <cstring>
   15 | #include <limits>
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int W, H;
int c[50][50];
int vy[8] = {-1,-1,0,1,1,1,0,-1};
int vx[8] = {0,1,1,1,0,-1,-1,-1};
void calc(int y, int x) {
  if(y < 0 || y >= H || x < 0 || x >= W) return;
  if(c[y][x] == 0) return;
  visited[y][x] = 0;
  FOR(i,0,8) calc(y+vy[i],x+vx[i]);
  return;
}
int main()
{
  while(cin >> W >> H, (W || H)) {
    CLR(visited);
    FOR(y,0,H) FOR(x,0,W) cin >> c[y][x];
    int ans = 0;
    FOR(y,0,H) {
      FOR(x,0,W) {
        if(c[y][x] == 0) continue;
        calc(y, x);
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'void calc(int, int)':
a.cc:26:3: error: 'visited' was not declared in this scope
   26 |   visited[y][x] = 0;
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:33:9: error: 'visited' was not declared in this scope
   33 |     CLR(visited);
      |         ^~~~~~~
a.cc:17:25: note: in definition of macro 'CLR'
   17 | #define CLR(mat) memset(mat, 0, sizeof(mat))
      |                         ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define llong long long 
int w,h;
int sum;
int area[50][50];
int nw[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int nh[8] = {1, 1, 0, -1, -1, -1, 0, 1};

void solve(int h, int w){
	if(area[h][w] == 0)return;
	area[h][w] == 0;
	for(int i = 0; i < 8; i++){
		int sh = h + nh[i];
		int sw = w + nw[i];
		if(sh < 0 || sw < 0 || sh >= h || sw >= w) continue;
		solve(sh, sw);
	}
	return;
}

int main(){

	while(cin >> w >> h, w){
		sum = 0;
		fill_n(*area, 50 * 50, 0);
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				cin >> area[i][j];
			}
		}	

		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				if(area[i][j] == 1){
					sum++;
					solve(i, j);
				}
			}
		}

		cout << sum << endl;
	return 0;
}

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

#include <iostream>
#include <cstdio>
#include <queue>

using namespace std;

typedef pair<int, int> p;

int t_x[] = {1, 1, 1, 0, -1, -1, -1, 0};
int t_y[] = {1, 0, -1, -1, -1, 0, 1, 1};

int field[52][52];  

int main()
{
  while (true) {
    memset(field, 0, sizeof field);
    int width, height;
    scanf("%d %d", &width, &height);
    
    if (width == 0 && height == 0) break;
    
    for (int i = 1; i <= height; i++) {
      for (int j = 1; j <= width; j++) {
	scanf(" %d", &field[i][j]);
      }
    }
    
    queue<p> que;
    int c = 0;

    for (int i = 1; i <= height; i++) {
      for (int j = 1; j <= width; j++) {
	if (field[i][j] == 1) {
	  c++;
	  que.push(p(i, j));
	  field[i][j] = 0;
	  while (!que.empty()) {
	    p tmp = que.front();
	    que.pop();
	    //field[tmp.second][tmp.first] = 0;
	    //cout << tmp.first << ", " << tmp.second << endl;
	    for (int k = 0; k < 8; k++) {
	      int tx = tmp.second + t_x[k];
	      int ty = tmp.first + t_y[k];
	      //cout << ty << ", "<< tx << " =  "<< field[ty][tx] << endl;
	      if (field[ty][tx] == 1) {
		field[ty][tx] = 0;
		que.push(p(ty, tx));
	      }
	    }
	    //cout << endl;
	    //cout << i << " " << j << endl;
	    for (int k = 1; k <= height; k++) {
	      for (int l = 1; l <= width; l++) {
		//cout << field[k][l] << " ";
	      }
	      //cout << endl;
	    }
	    //cout << endl;
	  }
	}
      }     
    }
    cout << c << endl;
  }
  return 0;
}

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

#include<cstring>
#define foreach(t,p) for(t::iterator it=p.begin();it!=p.end();p++)
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
#define MAX_W 50

bool island[MAX_W+3][MAX_W+3];

int solve(int x,int y)
{
	if(!island[x][y]) {return 0;}

	island[x][y]= false;
	solve(x-1,y-1);
	solve(x-1,y);
	solve(x-1,y+1);
	solve(x,y-1);
	solve(x,y+1);
	solve(x+1,y+1);
	solve(x+1,y);
	solve(x+1,y-1);
//	cout << x << " " << y << endl;
	return 1;
}


int main()
{
	int w,h;
	while(cin >> w >> h &&w && h)
	{
		REP(i,MAX_W+2)REP(j,MAX_W+2) island[i][j]=false;
		REP(i,h)REP(j,w){cin >> island[i+1][j+1];}
		int kosu = 0;
		REP(i,h)REP(j,w){kosu += solve(i+1,j+1);}
		cout << kosu << endl;
		
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:15: error: 'cin' was not declared in this scope
   30 |         while(cin >> w >> h &&w && h)
      |               ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<cstring>
  +++ |+#include <iostream>
    2 | #define foreach(t,p) for(t::iterator it=p.begin();it!=p.end();p++)
a.cc:36:17: error: 'cout' was not declared in this scope
   36 |                 cout << kosu << endl;
      |                 ^~~~
a.cc:36:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:36:33: error: 'endl' was not declared in this scope
   36 |                 cout << kosu << endl;
      |                                 ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<cstring>
  +++ |+#include <ostream>
    2 | #define foreach(t,p) for(t::iterator it=p.begin();it!=p.end();p++)
Language: C++

#include <iostream>
#include <map>
// #include <cstdio>
#include <stacK>

using namespace std;

int main() {
	while(1) {
	int w, h, data[52][52]={{0}};
	cin >> w >> h;
	if (w == 0 && h ==0) break;
	// memset(data, 0, sizeof(data));
	for (int i=1; i<=h; i++) {
		for (int j=1; j<=w; j++) {
			cin >> data[i][j];
		}
	}
	// for (int i=0; i<h; i++) {
	// 	for (int j=0; j<w; j++) {
	// 		cout << data[i][j] << "," ;
	// 	}cout <<endl;
	// }
	stack<pair<int, int> > s;
	int count=0;
	int H[8] = {-1, -1, -1, 0, 0, 1, 1, 1}, W[8] ={-1, 0, 1, -1, 1, -1, 0, 1};
	for(int i=1; i<=h; i++) {
		for (int j=1; j<=w; j++) {
			if (data[i][j]) {
				count++;
				s.push(make_pair(i, j));
				while (!(s.empty())) {
					pair<int, int> now;
					now = s.top();
					s.pop();
					data[now.first][now.second]=0;
					for (int k=0; k<8; k++) {
						if (data[H[k]+now.first][W[k]+now.second])
							s.push(make_pair(H[k]+now.first, W[k]+now.second));
					}
				}
			}
		}
	}
	cout << count <<endl;
}
}

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

#include <iostream>
#include <vector>
#include <queue>
#include <utility>

using namespace std;

inline bool inRange(int a, int x, int b) {
    return a <= x && x < b;
}

void fill(vector<vector<int> > &v, int r, int c) {
    queue<pair<int,int> > q;
    q.push(make_pair(r, c));
    v[r][c] = 0;
    while(!q.empty()) {
        const pair<int,int> cur = q.front();
        q.pop();
        for(int dr = -1; dr <= 1; ++dr) {
            for(int dc = -1; dc <= 1; ++dc) {
                int nr = cur.first + dr;
                int nc = cur.second + dc;
                if(inRange(0, nr, v.size()) && 
                   inRange(0, nc, v[0].size()) && v[nr][nc])
                {
                    v[nr][nc] = 0;
                    q.push_back(make_pair(nr, nc))
                }
            }
        }
    }
}

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

    while(true) {
        int C, R;
        cin >> C >> R;
        if(!C && !R) break;

        vector<vector<int> > v(R, vector<int>(C));
        for(int i = 0; i < R; ++i) 
            for(int j = 0; j < C; ++j)
                cin >> v[i][j];

        int cnt = 0;
        for(int r = 0; r < R; ++r) {
            for(int c = 0; c < C; ++c) {
                if(v[r][c]) {
                    ++cnt;
                    fill(v, r, c);
                }
            }
        }

        cout << cnt << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'void fill(std::vector<std::vector<int> >&, int, int)':
a.cc:27:23: error: 'class std::queue<std::pair<int, int> >' has no member named 'push_back'
   27 |                     q.push_back(make_pair(nr, nc))
      |                       ^~~~~~~~~