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

#include<stdio.h>

#include<string.h>
int w,h,sx,sy;
int dx[4]={1,0,-1,0},dy[4] = {0,1,0,-1};
char fruit[100][100];
int flag[100][100];
int num;

void dfs(int x,int y,char c){
    flag[x][y] = 1;
    for(int i = 0; i < 4;i++){
            int nx = x + dx[i], ny = y + dy[i];
            if(nx<h&&nx>=0&&ny<w+1&&ny>=0&&!flag[nx][ny])
                dfs(nx,ny,fruit[nx][ny]);
     }
}

void solve(){
    while((~scanf("%d %d",&w,&h))&&w&&h){
        num = 0;
        memset(flag,0,sizeof(flag));
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w;j++)
                scanf("%c",&fruit[i][j]);
        }//for
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w;j++)
            {
                if(flag[i][j]==0){
                dfs(i,j,fruit[i][j]);
                  num++;
    }

        }
        
        printf("%d",num);
    }
}
int main(){
    solve();
}



Compiler output:
main.c: In function 'solve':
main.c:42:1: error: expected declaration or statement at end of input
   42 | }
      | ^
Language: C

#include<stdio.h>

#include<string.h>
int w,h,sx,sy;
int dx[4]={1,0,-1,0},dy[4] = {0,1,0,-1};
char fruit[100][100];
int flag[100][100];
int num;

void dfs(int x,int y,char c){
    flag[x][y] = 1;
    for(int i = 0; i < 4;i++){
            int nx = x + dx[i], ny = y + dy[i];
            if(nx<h&&nx>=0&&ny<w+1&&ny>=0&&!flag[nx][ny])
                dfs(nx,ny,fruit[nx][ny]);
     }
}

void solve(){
    while((~scanf("%d %d",&w,&h))&&w&&h){
        num = 0;
        memset(flag,0,sizeof(flag));
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w;j++)
                scanf("%c",&fruit[i][j]);
        }//for
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w;j++)
            {
                if(!flag[i][j]){
                dfs(i,j,fruit[i][j]);
                  num++;
    }

        }
        
        printf("%d",num);
    }
    return ;
}
int main(){
    solve();
    return 0 ;
}



Compiler output:
main.c: In function 'solve':
main.c:44:1: error: expected declaration or statement at end of input
   44 | }
      | ^
Language: C

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

int h,w,v[100][100];
char c[100][100];

void dfs(int i,int j, char s) {
    if(c[i][j]!=s||v[i][j]) return;
    v[i][j]=1;
    if(i!=0) dfs(i-1,j,s);
    if(i!=h-1) dfs(i+1,j,s);
    if(j!=0) dfs(i,j-1,s);
    if(j!=w-1) dfs(i,j+1,s);
}

int main(){
    while(~scanf("%d%d",&h,&w)&&h&&w){
        memset(c,0,sizeof(c));
        memset(v,0,sizeof(v));
        for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
            scanf(" %c", &c[i][j]);

        int cnt =0;
		for(int i=0;i<h;i++)
        for(int j=0;j<w;j++) {
            if(v[i][j]) continue;
            dfs(i,j,c[i][j]);
            cnt++;
        }
		printf("%d\n",cnt);
    }
    return 0;
}



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

#include<iostream>
#include<string.h>
#include<cmath>
#include<vector>
using namespace std;

char a[101][101];
int h, w;
int f[4][2] = { {0,1},{0,-1},{1,0},{-1,0} };
void dfs(int x,int y,char ch)
{
	if (x<0 || x>h - 1 || y<0 || y>w - 1||a[x][y]!=ch) return;
	a[x][y] = ' ';
	int tx, ty;
	for (int i = 0; i <= 3; i++)
	{
		tx = x + f[i][0];
		ty = y + f[i][1];
		dfs(tx, ty, ch);
	}
}

int main()
{
	while (cin >> h >> w)
	{
		if (!h && !w) break;
		for (int i = 0; i < h; i++)
			cin >> a[i];
		int sum = 0;
		for (int i = 0; i < h; i++)
		{
			for (int j = 0; j < w; j++)
			{
				if (a[i][j] != ' ') {
					dfs(i, j, a[i][j]);
					sum++;
				}
			}
		}
		cout << sum << 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<cstdio>
int H, W;
char map[201][201];
int dx[4]{ 0, 0, 1, -1 };
int dy[4]{ 1, -1, 0, 0 };
int ans = 0;
void dfs(int x, int y,char ch)
{
	map[x][y] = '.';//把符号@，#，*其中一个替换成.。和poj1979很像，稍微改下1979的代码就行
	for (int i = 0; i < 4; i++)
	{
		int nx = x + dx[i], ny = y + dy[i];
		if (0 <= nx&&nx < H && 0 <= ny&&ny < W&&map[nx][ny] ==ch)dfs(nx, ny, ch);
	}
}
int main()
{
	scanf("%d%d", &H, &W);
	while (getchar() != '\n')continue;
	while (W&&H)
	{
		ans = 0;
		for (int i = 0; i < H; i++)
			gets(map[i]);
		for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < W; j++){
				if (map[i][j] == '#'){ dfs(i, j, '#'); ans++; }
				else if (map[i][j] == '@'){ dfs(i, j, '@'); ans++; }
				else if (map[i][j] == '*'){ dfs(i, j, '*') ; ans++; }
			}
		}
		printf("%d\n", ans);
		scanf("%d%d", &H, &W);
		while (getchar() != '\n')continue;

	}
    return 0;
}




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

#include <iostream>
#include <cstdio>
#include <cstring>
#define bswap(a,b) a^=b^=a^=b
#define _for(i,a,b) for(int i = (a); i < b; ++i)
#define _rep(i,a,b) for(int i = (a); i <= b; ++i)
#define met(a) memset(a,0,sizeof(a))
#define _met(a) memset(a,-1,sizeof(a))

using namespace std;
const int maxn = 100+5;
char rec[maxn][maxn];
bool visited[maxn][maxn];
int dx[] = {1, 0, 0, -1};
int dy[] = {0, -1, 1, 0};
//pair<int, int> p;
int ans = 0;
int w, h;
void dfs(int x, int y, char c)
{
    rec[x][y] = '.';
    _for(i,0,4){
        int nowx = x + dx[i];
        int nowy = y + dy[i];
        if(0<=nowx&&nowx<h&&0<=nowy&&nowy<w&&rec[nowx][nowy] == c){

            dfs(nowx, nowy, c);
        }
    }
}
int main()
{

    cin>>w>>h;
    while (getchar() != '\n') continue;
    while(w||h)
    {
        memset(visited,0,sizeof(visited));
        ans = 0;
        _for(i,0,h) _for(j,0,w) cin>>rec[i][j];
        _for(i,0,h) _for(j,0,w){
            if(rec[i][j] == '#'){
                ans++;
                dfs(i,j,rec[i][j]);
            }
            else if(rec[i][j] == '@'){
                ans++;
                dfs(i,j,rec[i][j]);
            }
            else if(rec[i][j] == '*'){
                ans++;
                dfs(i,j,rec[i][j]);
            }
        }
        cout<<ans<<endl;
        cin>>w>>h;
        while (getchar() != '\n')continue;
    }
    return 0;
}



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

#include <iostream>
#include <algorithm>
int m, n;
int dir[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
char map[125][125];
char f;
int ans;
using namespace std;
void dfs(int x,int y)
{
    for (int i = 0; i < 4; ++i)
    {
        int nx = x + dir[i][0],ny = y + dir[i][1];
        if (nx < 1 || nx > m || ny < 1 || ny > n)
            continue;
        if (map[nx][ny] == f)
        {
            map[nx][ny] = ' ';
            dfs(nx,ny);
        }
        else continue;
    }
}

int main()
{
    while (cin >> m >> n && (m || n))
    {
        for (int i = 1; i <= m; ++i)
            for (int j = 1; j <= n; ++j)
                cin >> map[i][j];
        for (int i = 1; i <= m; ++i)
            for (int j = 1; j <= n; ++j)
            {
                if (map[i][j] != ' ')
                {
                    ans++;
                    f = map[i][j];
                    dfs(i,j);
                }
            }
        cout << ans << endl;
    }
    return 0;
}

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

#include <stdio.h>
#define SQLOOP for(hi = 0;hi < h;hi++)for(wi = 0;wi < w;wi++)

char map[101][101];
short h,hi,w,wi,l,ans;

void mapInfr(short hj,short wj){
	char base;
	base = map[hj][wj];
	map[hj][wj] = 0;
	if(hj && mapInfr[hj - 1][wj] == base)mapInfr(hj - 1,wj);
	if(wj && mapInfr[hj][wj - 1] == base)mapInfr(hj,wj - 1);
	if(hj + 1 < h && mapInfr[hj + 1][wj] == base)mapInfr(hj + 1,wj);
	if(wj + 1 < w && mapInfr[hj][wj + 1] == base)mapInfr(hj,wj + 1);
}

int main(void){
	for(;;){
		scanf("%d%d",&h,&w);
		if(h == 0 && w == 0)break;
		SQLOOP scanf("%c",&map[hi][wi]);
		ans = 0;
		SQLOOP if(map[hi][wi])mapInfr(hi,wi),ans++;
		printf("%d\n",ans);
	}
}

Compiler output:
main.c: In function 'mapInfr':
main.c:11:25: error: subscripted value is neither array nor pointer nor vector
   11 |         if(hj && mapInfr[hj - 1][wj] == base)mapInfr(hj - 1,wj);
      |                         ^
main.c:12:25: error: subscripted value is neither array nor pointer nor vector
   12 |         if(wj && mapInfr[hj][wj - 1] == base)mapInfr(hj,wj - 1);
      |                         ^
main.c:13:33: error: subscripted value is neither array nor pointer nor vector
   13 |         if(hj + 1 < h && mapInfr[hj + 1][wj] == base)mapInfr(hj + 1,wj);
      |                                 ^
main.c:14:33: error: subscripted value is neither array nor pointer nor vector
   14 |         if(wj + 1 < w && mapInfr[hj][wj + 1] == base)mapInfr(hj,wj + 1);
      |                                 ^
Language: C

#include"queue"
#include"stdio.h"
#include"stdlib.h"
#include"string.h"
#include"algorithm"
using namespace std;
struct mmm
{
	int x,y;
}vv;
int dir[4][2] = {0,-1,-1,0,0,1,1,0};
char xx[101][101];
int vis[101][101],m,n,maxx;
int check(int xn,int yn)
{
	if(xn < 0 || yn < 0 || xn >= m || yn >= n)
		return 0;
	else 
		return 1;
}
void bfs(int xl,int yl,char pl)
{
	queue <mmm> qq;
	int sum = 0;
	vv.x = xl;
	vv.y = yl;
	qq.push(vv);
	vis[xl][yl] = 1;
	xx[xl][yl] = '1';
	while(!qq.empty())
	{
		vv = qq.front();
		qq.pop();
		int x0 = vv.x;
		int y0 = vv.y;
		for(int i = 0;i < 4;i ++)
		{
			int xt = x0 + dir[i][0];
			int yt = y0 + dir[i][1];
			if(check(xt,yt) && !vis[xt][yt] && xx[xt][yt] == pl)
			{
				vv.x = xt;
				vv.y = yt;
				qq.push(vv);
				vis[xt][yt] = 1;
				xx[xt][yt] = '1';
			}
		}
	}
}
int main()
{
	int a,b,c,d;
	while(~scanf("%d %d",&m,&n))
	{
		if(!m && !n) break;
		for(int i = 0;i < m;i ++)
		{
			scanf("%s",xx[i]);
		}
		memset(vis,0,sizeof(vis));
		maxx = 0;
		for(int i = 0;i < m;i ++)
		{
			for(int j = 0;j < n;j ++)
			{
				if(xx[i][j] != '1')
				{
					bfs(i,j,xx[i][j]);
					maxx ++;
				}
			}
		}
		printf("%d\n",maxx);
	}
	return 0;
}

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

#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

#define inf 0x3f3f3f3f

using namespace std;

int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
char ma[105][105];
int h, w, vis[105][105];

void dfs(int x, int y, char c)
{
    int i, xx, yy;

    for(i = 0; i < 4; i++)
    {
        xx = x + dx[i];
        yy = y + dy[i];
        
        if(xx >= 0 && xx < h && yy >= 0 && yy < w && !vis[xx][yy] && ma[xx][yy] == c)
        {
            vis[xx][yy] = 1;
            dfs(xx, yy, c);
        }
    }
}

int main()
{
    int i, j, ans;

    while(scanf("%d%d", &h, &w) && (h || w))
    {
        getchar();

        for(i = 0; i < h; i++) scanf("%s", ma[i]);
        memset(vis, 0, sizeof vis);
        ans = 0;

        for(i = 0; i < h; i++)
        {
            for(j = 0; j < w; j++)
            {
                if(!vis[i][j])
                {
                    ans++;
                    dfs(i, j, ma[i][j]);
                }
            }
        }
        printf("%d\n", ans);
    }

    return 0;
}

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

#include <stdio.h>

char s[128][128];//s[h][w]
char cs[4] = "@#*";

int h,w;
int sp = 0;

void check(int t,int sh,int sw){
	int nh,nw;
	s[sh][sw] = '.';
	nh = sh - 1,nw = sw;
	if(0 <= nh && nh < h && 0 <= nw && nw < w && s[nh][nw] == cs[t]) check(t,nh,nw);
	nh = sh,nw = sw - 1;
	if(0 <= nh && nh < h && 0 <= nw && nw < w && s[nh][nw] == cs[t]) check(t,nh,nw);
	nh = sh,nw = sw + 1;
	if(0 <= nh && nh < h && 0 <= nw && nw < w && s[nh][nw] == cs[t]) check(t,nh,nw);
	nh = sh + 1,nw = sw;
	if(0 <= nh && nh < h && 0 <= nw && nw < w && s[nh][nw] == cs[t]) check(t,nh,nw);
}

int main(void) {
	int i,j,k;
	while(scanf("%d%d",&h,&w) , h != 0){
		sp = 0;
		for(i = 0;i < 128;i++){
			for(j = 0;j < 128;j++){
				s[i][j] = '.'
			}
		}
		for(i = 0;i < h;i++){
			scanf("%s",s[i]);
		}
		for(i = 0;i <= 2 ;i++){
			for(j = 0;j < h;j++){
				for(k = 0;k < w;k++){
					if(s[j][k] == cs[i]){
						sp++;
						check(i,j,k);
					}
				}
			}
		}
		printf("%d\n",sp);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:28:46: error: expected ';' before '}' token
   28 |                                 s[i][j] = '.'
      |                                              ^
      |                                              ;
   29 |                         }
      |                         ~
Language: C

#include <cstdio>
#include <cstring>

const int MAX_H = 100;
const int MAX_W = 100;

//?入
int H, W;
char g[MAX_H][MAX_W + 1];

int d[4][2] = {{0, -1}, {0, 1}, {1, 0}, {-1, 0}};        //方向

//深度?先遍?g[i][j]同?局域
void dfs(int x, int y, int c){
    for(int i = 0; i < 4; i ++){
        int nx = x + d[i][0], ny = y + d[i][1];
        if(0 <= nx && nx < H && 0 <= ny && ny < W && g[nx][ny] == c){
            g[nx][ny] = '1';
            dfs(nx, ny, c);
        }
    }
}

void solve(){
    //遍?果?，?到一个新位置，遍??位置能到?的地方
    int ans = 0;
    for(int i = 0; i < H; i ++){
        for(int j = 0; j < W; j ++){
            if(g[i][j] != '1'){
                ans ++;
                char c = g[i][j];
                g[i][j] = '1';
                dfs(i, j, c);
            }
        }
    }
    printf("%d\n", ans);
}

int main(int argc, char const *argv[]){

    while(scanf("%d %d", &H, &W)){
        if(H == 0 && W == 0) break;
        for(int i = 0; i < H; i ++){
            scanf("%s", g[i]);
        }
        solve();
    }

    return 0;
}

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

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

void a(char c, char map[101][101], int i, int j, int H, int W) {
	if (c == map[i][j]) map[i][j] = '0';
	if (i+1 < H && map[i+1][j] == c) a(c,map,i+1,j,H,W);
	if (j+1 < W && map[i][j+1] == c) a(c,map,i,j+1,H,W);
	if (i-1 >= 0 && map[i-1][j] == c) a(c,map,i-1,j,H,W);
	if (j-1 >= 0 && map[i][j-1] == c) a(c,map,i,j-1,H,W);
}

int main() {
	int out, H, W, i, j;
	char map[101][101];
	while (1) {
		out = 0;
		scanf("%d%d", &H, &W);
		if (H == W && H == 0) break;
		for (i=0; i < H ;i++) {
			for (j=0; j < W ;j++) {
				scanf("%c", &map[i][j]);
				if (map[i][j] == '\n') {
					scanf("%c", &map[i][j]);
				}
			}
		}
		for (i=0; i < H ;i++) {
			for (j=0; j < W ;j++) {
				if (map[i][j] != '0') {
					a(map[i][j], map, i, j, H, W);
					out++;
				}
			}
		}
		printf("%d\n", out);
	}
	return 0;
}

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

#include<cstdio>
#include<cstring>
int h,w,ans,b[105][105],dr[5]={0,1,0,-1,0};
char a[105][105];
void dfs(int x,int y,char c)
{
	if(x>h||y>w||x<0||y<0||a[x][y]!=c||b[x][y]) return;
	b[x][y]=ans;
	for(int i=1;i<=4;i++) dfs(x+dr[i-1],y+dr[i],c);
}
int main()
{
	int i,j;
	while(1)
	{
		scanf("%d%d",&h,&w);
		if(!h) break;
		for(i=1;i<=h;i++) scanf("%s",a[i]+1);
		memset(b,0,sizeof(b));ans=0;
		for(i=1;i<=h;i++)
			for(j=1;j<=w;j++)
				if(!b[i][j]) 
				{
					ans++;dfs(i,j,a[i][j]);
				}
		printf("%d\n",ans);
	}
}

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

#include <bits/stdc++.h>
using namespace std;
int h,w,f[101][101],tot;
char s[101][101];
const int dx[]={0,0,1,-1},dy[]={1,-1,0,0};
void dfs(int x,int y,char c)
{
	for(int i=0;i<4;i++){
		int nx=x+dx[i],ny=y+dy[i];
		if(nx>=1&&nx<=h&&ny>=1&&ny<=w&&!f[nx][ny]&&s[nx][ny]==c){
			f[nx][ny]=1;
			dfs(nx,ny,c);
		}
	}
}
int main()
{
#ifdef DEBUG
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
	while(scanf("%d%d",&h,&w)&&h&&w){
		memset(f,0,sizeof(f));
		for(int i=1;i<=h;i++)
		 for(int j=1;j<=w;j++)
		  cin>>s[i][j];
		tot=0;
		for(int i=1;i<=h;i++)
		 for(int j=1;j<=w;j++)
		  if(!f[i][j]&&(s[i][j]=='@'||s[i][j]=='*'||s[i][j]=='#')){
		  	f[i][j]=1;
		  	tot++;
		  	dfs(i,j,s[i][j]);
		  }
		cout<<tot<<endl;
	}
	return 0;
}

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

/*If I get TLE , it is good.If I get AC,it's NICE !*/
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <vector>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
const int MAXN=1e7+10;
const ll mod=1e9+7;
using namespace std;
typedef long long ll;
char mp[1000][1000];
bool vis[1000][1000];
int dir[8][2]= {-1,0,1,0,0,-1,0,1,1,1,1,-1,-1,1,-1,-1};
int cnt=0;
int n,m;
char temp;

void dfs(int x,int y)
{
    vis[x][y]=true;
    for(int i=0; i<4; i++)
    {
        int nx=x+dir[i][0];
        int ny=y+dir[i][1];
        if(nx>=0 && nx<=n-1 && ny>=0 && ny<=m-1 && vis[nx][ny]==false && mp[nx][ny]==temp)
        {
            vis[nx][ny]=true;
            dfs(nx,ny);
        }
    }
}

int main(void)
{
    while((scanf("%d%d",&n,&m))==2)
    {
        if(m==0 && n==0)
            return 0;
        cnt=0;
        memset(vis,false,sizeof(vis));
        for(int i=0; i<n; i++)
            scanf("%s",mp[i]);
        for(int i=0; i<n; i++)
        {
            for(int j=0; j<m; j++)
            {
                if(vis[i][j]==false)
                {
                    temp=mp[i][j];
                    dfs(i,j);
                    cnt++;
                }
            }
        }
        printf("%d\n",cnt);
    }
}

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

#include<algorithm>
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int h, w;
char c[110][110];
bool f[110][110];
int next[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
int cnt = 0;

void dfs(int i, int j){
    for(int k = 0; k <= 3; k++){
        int ii = i + next[k][0];
        int jj = j + next[k][1];
        if(ii > h || ii <= 0 || jj > w || jj <= 0 || f[ii][jj] == 1){
            continue;
        }
        f[ii][jj] = 1;
        dfs(ii, jj);
   }
}

void solve(char s){
    memset(f, 0, sizeof(f));
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            if(c[i][j] != s){
                f[i][j] = 1;
            }
        }
    }
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            if(f[i][j] == 0){
                cnt++;
                dfs(i, j);
            }
        }
    }
}

int main(){
    while(~scanf("%d%d", &h, &w)){
        if(h == 0 || w == 0)break;
        cnt = 0;
        for(int i = 1; i <= h; i++){
            for(int j = 1; j <= w; j++){
                cin>>c[i][j];
            }
        }
        solve('#');
        solve('*');
        solve('@');
        printf("%d\n", cnt);
    }
    return 0;
}

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

#include <iostream>
#include<cstdio>
#include<cmath>
#include<string.h>
#include<algorithm>
#include<queue>
#include<list>
#include<vector>
#include<stdlib.h>
#include<stack>
#define oo 0x3f3f3f3f

using namespace std;
int n, m;
char str[105][105];
int ans[4][2]={{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
int vis[105][105];
void dfs(int x, int y, char c)
{
    if(str[x][y]!=c)
        return ;
    vis[x][y]=1;
    for(int i=0; i<8; i++)
    {
        int nx=x+ans[i][0];
        int ny=y+ans[i][1];
        if(nx>=0&&nx<n&&ny>=0&&ny<m&&str[nx][ny]==c&&!vis[nx][ny])
        {
            vis[nx][ny]=1;
            dfs(nx, ny, c);
        }
    }
    return ;
}
int main()
{
    while(scanf("%d%d", &n, &m), n+m)
    {
       for(int i=0; i<n; i++)
        scanf("%s", str[i]);
        memset(vis, 0, sizeof(vis));
        int sum=0;
       for(int i=0; i<n; i++)
       {
           for(int j=0; j<m; j++)
           {
               if(!vis[i][j])
               {
                   dfs(i, j, str[i][j]);
                   sum++;
               }
           }
       }
       printf("%d\n", sum);
    }
    return 0;
}

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

#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#include<queue>
int n,m;
int dis[4][2]={{0,1},{0,-1},{-1,0},{1,0}};
#define N 110
char map[N][N];
struct node
{
    int x,y;
};
void bfs(int i,int j,char s)
{
    queue<node>Q;
    node now,next;
    now.x=i;
    now.y=j;
    map[i][j]='E';
    Q.push(now);
    while(Q.size())
    {
        now=Q.front();
        Q.pop();
        for(int i=0;i<4;i++)
        {
            next.x=now.x+dis[i][0];
            next.y=now.y+dis[i][1];
            if(next.x>=0&&next.x<n&&next.y>=0&&next.y<m&&map[next.x][next.y]==s)
            {
                map[next.x][next.y]='E';
                Q.push(next);
            }
        }
    }
}
int main()
{
    while(scanf("%d%d",&n,&m),n+m)
    {
        getchar();
        for(int i=0;i<n;i++)
        {
            scanf("%s",map[i]);
        }
        int sum=0;
        for(int i=0;i<n;i++)
            for(int j=0;j<m;j++)
        {
            if(map[i][j]=='#'||map[i][j]=='@'||map[i][j]=='*')
            {
                sum++;
                bfs(i,j,map[i][j]);
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}

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

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

int H,W;
char map[100][100];
void flood(int typ, int x,int y){
    map[y][x]='X';
    printf("rewritten: map[%d][%d]:%c\n",y,x,map[y][x]);
    //up
    if(y-1>=0&&map[y-1][x]==typ)flood(typ,x,y-1);
    //right
    if(x+1<W&&map[y][x+1]==typ)flood(typ,x+1,y);
    //down
    if(y+1<H&&map[y+1][x]==typ)flood(typ,x,y+1);
    //left
    if(x-1>=0&&map[y][x-1]==typ)flood(typ,x-1,y);
}
int main(){
    while(scanf("%d%d",&H,&W)!=EOF){if(H==0&&W==0)return 0;
        for(int i=0;i<H;i++)scanf("%s",&map[i]);
        int count=0;
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                if(map[i][j]!='X'){flood(map[i][j],j,i);count++;}
            }
        }printf("%d\n",count);
    }return 0;
}

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

#include<stdio.h>
#include<iostream>
using namespace std;
char maze[120][120];
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int m,n;
int dfs(int x,int y,char c)
{
    maze[x][y]='.';
    for(int i=0;i<4;i++)
    {
        int cx=x+dx[i];
        int cy=y+dy[i];
        if(cx>0&&cx<=m&&cy>0&&cy<=n&&maze[cx][cy]==c)
        {
            dfs(cx,cy,c);
        }
    }

}
int main()
{
    char ch;
    while(scanf("%d%d%c",&m,&n,&ch)==3&&m&&n)
    {
        int Kount=0;
        for(int i=1;i<=m;i++)
        {
            for(int j=1;j<=n;j++)
            {
                scanf("%c",&maze[i][j]);
            }
            scanf("%c",&ch);
        }
        for(int i=1;i<=m;i++)
        {
            for(int j=1;j<=n;j++)
            {
                if(maze[i][j]!='.')
                {
                    Kount++;
                    dfs(i,j,maze[i][j]);
                }
            }
        }
        printf("%d\n",Kount);
    }
    return 0;
}

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

#include<iostream>
#include<string.h>
using namespace std;
char field[200][200];
int bench[200][200];
int cnt = 0;
int search(int x, int y,char ch);
int main()
{
	int h, w;
	while (1)
	{
		
		cin >> h >> w;
		if (h == 0 && w == 0)break;
		memset(bench,    -1, sizeof(bench));
		memset(field, '\0', sizeof(field));
		for (int i = 1; i <= h; i++)
		{
			for (int j = 1; j <= w; j++)
			{
				cin >> field[i][j];
				bench[i][j] = 0;
			}
		}

		for (int i = 1; i <= h; i++)
			for (int j = 1; j <= w; j++)
				cnt+=search(i, j,field[i][j]);

		printf("%d\n",cnt);
		cnt = 0;
	}
    return 0;
}

int search(int x, int y,char ch)
{
	if (bench[x][y]==-1)return 0;
	if (field[x][y] != ch)return 0;
	bench[x][y] = -1;

	search(x, y + 1,ch);
	search(x, y - 1,ch);
	search(x + 1, y,ch);
	search(x - 1, y,ch);
	return 1;
}

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

#include<iostream>
#include<algorithm>
using namespace std;
#define N 10
int h, w;
char map[N][N+1];
int cnt;

void dfs(int x, int y, char c)
{
	map[x][y] = 'X';
	int d[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
	for (int i = 0; i < 4; i ++) 
	{  
        int nx = x + d[i][0], ny = y + d[i][1];  
        if (0 <= nx && nx < h && 0 <= ny && ny < w && map[nx][ny] == c) 
        {  
            dfs(nx, ny, c);  
        }
    }
}

void solve()
{
	cnt = 0;
	for(int i = 0; i < h; i++)
	{
		for(int j = 0; j < w; j++)
		{
			if(map[i][j] != 'X')
			{
				dfs(i, j, map[i][j]);
				cnt++;
			}
		}
	}
	cout << cnt << endl;
}

int main()
{
	while(cin >> h >> w, h && w)
	{
		for(int i = 0; i < h; i++)
			cin >> map[i];
		solve();
	}
	return 0; 
}

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

#include <cstdio>  
#include <cstring>  
#include <cstdlib>  
#include <algorithm>  
#include <iostream>  
#include <cmath>  
#include <vector>  
#include <map>  
using namespace std;  
const int maxn = 101;  
char g[maxn][maxn];  
int d[4][2] = {0 , 1 , 1 , 0 , 0 , -1 , -1 ,0};  
void dfs(int si , int sj , int n , int m , char ch)  
{  
    g[si][sj] = '1';  
    for(int i = 0 ; i < 4 ; i ++){  
        int x = si + d[i][0];  
        int y = sj + d[i][1];  
        if(x < 0 || x >= n || y < 0 || y >= m || g[x][y] != ch) continue;  
        dfs(x , y , n , m , ch);  
    }  
}  
  
int main()  
{  
    #ifdef DoubleQ  
    freopen("in.txt" , "r" , stdin);  
    #endif // DoubleQ  
    int n , m;  
    while(cin >> n >> m){  
        if(n == 0 && m == 0) break;  
  
        string str;  
        for(int i = 0 ; i < n ; i ++){  
            cin >> str;  
            for(int j = 0 ; j < m ; j ++){  
                g[i][j] = str[j];  
            }  
        }  
        int cnt = 0;  
        /* 
        for(int i = 0 ; i < n ;i ++){ 
            for(int j = 0 ; j < m ; j ++){ 
                cout << g[i][j] << " "; 
            } 
            cout << endl; 
        } 
        */  
  
        for(int i = 0 ; i < n ; i ++){  
            for(int j = 0 ; j < m ; j ++){  
                if(g[i][j] != '1'){  
                    dfs(i , j , n , m , g[i][j]);  
                    cnt ++;  
                }  
            }  
        }  
        cout << cnt << endl;  
  
    }  
}  

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

#include<cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;
int n,m;
char field[101][101];
int sum=0;
char index;
void dfs(int r,int c)
{
    if(r<0 || r>=n || c<0 || c>=m || field[r][c]!=index)
        return;
    
    
    else{
        
        field[r][c]='.';
        
        dfs(r-1,c);
        dfs(r,c-1);
        dfs(r,c+1);
        dfs(r+1,c);
        
    }
}

int main()
{   
    while(cin>>n>>m &&m&&n){
        
        sum=0;
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                cin>>field[i][j];
                
            }
        }
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                if(field[i][j]!='.')
                {
                    index=field[i][j];
                    sum++;
                    dfs(i,j);
                }
            }
        }

        cout<<sum<<endl;
    }
    system("pause");
    return 0;
}

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

#include <iostream>
#include <algorithm>
#include <functional>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>

using namespace std;

int n,m,dx[]={-1,1,0,0},dy[]={0,0,-1,1};
char a[1002][1002];
bool v[1002][1002];

void dfs(int x,int y,char c)
{
	if(v[x][y])return;
	if(a[x][y]!=c)return;
	v[x][y]=1;
	for(int i=0;i<4;++i)
	{
		dfs(x+dx[i],y+dy[i],c);
	}
}
int main()
{
	while(1)
	{
		scanf("%d%d",&n,&m);getchar();
		if(n==0&&m==0)break;
		for(int i=1;i<=n;++i)
		{
			for(int j=1;j<=m;++j)
			{
				scanf("%c",&a[i][j]);
			}
			getchar();
		}
		int cnt=0;
		for(int i=1;i<=n;++i)
		{
			for(int j=1;j<=m;++j)
			{
				if(!v[i][j])
				{
					++cnt;
					dfs(i,j,a[i][j]);
				}
			}
		}
		printf("%d\n",cnt);
	}
	return 0;
}

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

#include <stdio.h>
int k,t=0;
char a[100][100];
void bfs(int i,int j,int n,int m,char x)
{
	k=0;
	if (i<0||j<0||i>=n||j>=m||a[i][j]=='\0'||a[i][j]!=x) return ;
	a[i][j]='\0';
	bfs(i-1,j,n,m,x);
	bfs(i+1,j,n,m,x);
	bfs(i,j-1,n,m,x);
	bfs(i,j+1,n,m,x);
	k++;
}
int main ()
{
	int n,m,i,j;
	while (scanf ("%d%d",&n,&m)!=EOF)
	{
		if (n==0&&m==0) return 0;
		getchar();
		for (i=0;i<n;i++)
		gets(a[i]);
		for (i=0;i<n;i++)
		for (j=0;j<m;j++)
		{
			bfs(i,j,n,m,a[i][j]);
			if (k!=0) t++;
		}
		printf ("%d\n",t);
	}
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:23:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
   23 |                 gets(a[i]);
      |                 ^~~~
      |                 fgets
Language: C

#include <iostream>  
#include <cstdio>  
#include <cstring>  
using namespace std;  
int sum,n,m;  
int k;  
char map[105][105];  
int dx[10]={-1,1,0,0};  
int dy[10]={0,0,-1,1};  
void dfs1(int x,int y)  
{  
    if(x<0||x>=n||y<0||y>=m) return ;  
    if(map[x][y]=='#')  
    {  
        map[x][y]=' ';  
        for(int i=0;i<4;i++)  
        {  
            dfs1(x+dx[i],y+dy[i]);  

        }  
    }  
}  
void dfs2(int x,int y)  
{  
    if(x<0||x>=n||y<0||y>=m) return ;  
    if(map[x][y]=='@')  
    {  
        map[x][y]=' ';  
        for(int i=0;i<4;i++)  
        {  
            dfs2(x+dx[i],y+dy[i]);  

        }  
    }  
}  
void dfs3(int x,int y)  
{  
    if(x<0||x>=n||y<0||y>=m) return ;  
    if(map[x][y]=='*')  
    {  
        map[x][y]=' ';  
        for(int i=0;i<4;i++)  
        {  
            dfs3(x+dx[i],y+dy[i]);  

        }  
    }  
}  
int main()  
{  
    while(scanf("%d%d",&n,&m)!=EOF)  
    {  getchar();
        if(m==0||n==0) break;  
        for(int i=0;i<n;i++)  
        {  
            for(int j=0;j<m;j++)  
            {  
              scanf("%c",&map[i][j]) ;
            }  
            getchar();
        }
        sum=0;  
        for(int i=0;i<n;i++)  
        {  
            for(int j=0;j<m;j++)  
            {  
                if(map[i][j]=='#')  
                {  
                    sum++;  
                    dfs1(i,j);  
                }  
                  if(map[i][j]=='@')  
                {  
                    sum++;  
                    dfs2(i,j);  
                }  
                  if(map[i][j]=='*')  
                {  
                    sum++;  
                    dfs3(i,j);  
                }  
            }  
        }  
        printf("%d\n",sum);  
    }  
    return 0;  
}  


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

#include<stdio.h>
#include<string.h>
char map[105][105];
int flag[105][105],M,N;
void dfs(int x,int y)
{
	flag[x][y]=1;
	if((x+1)>=0&&(x+1)<M&&map[x+1][y]==map[x][y])
		dfs(x+1,y);
	if((x-1)>=0&&(x-1)<M&&map[x-1][y]==map[x][y])
		dfs(x-1,y);
	if((y+1)>0&&(y+1)<N&&map[x][y]==map[x][y+1])
		dfs(x,y+1);
	if((y-1)>=0&&(y-1)<N&&map[x][y]==map[x][y-1])
		dfs(x,y-1);
	}
}
	
int main()
{
	while(scanf("%d%d",&M,&N)&&(M+N))
	{
		int count=0;
		memset(flag,0,sizeof(flag));
		for(int i=0;i<M;i++)
			scanf("%s",map[i]);
		for(int i=0;i<M;i++)
			for(int j=0;j<N;j++)
				if(flag[i][j]==0)
				{
					count++;
					dfs(i,j);
				}
		printf("%d\n",count);
	}
}


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

/*
Á·Ï°Ìâ£ºProperty Distribution_AOJ 0118
*/
#include <stdio.h>
using namespace std;

char maze[25][25];
int W, H;
int sx, sy;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int count;

void dfs1(int x, int y)
{
	for(int i=0; i<4; i++)
	{
		int nx=x+dx[i];
		int ny=y+dy[i];
		if(nx>=0&&nx<W&&ny>=0&&ny<H&&maze[nx][ny]=='@')
		{
			maze[nx][ny]='.';
			dfs1(nx,ny);
		}
	}
	return ;
}
void dfs2(int x, int y)
{
	for(int i=0; i<4; i++)
	{
		int nx=x+dx[i];
		int ny=y+dy[i];
		if(nx>=0&&nx<W&&ny>=0&&ny<H&&maze[nx][ny]=='*')
		{
			maze[nx][ny]='.';
			dfs2(nx,ny);
		}
	}
	return ;
}
void dfs3(int x, int y)
{
	for(int i=0; i<4; i++)
	{
		int nx=x+dx[i];
		int ny=y+dy[i];
		if(nx>=0&&nx<W&&ny>=0&&ny<H&&maze[nx][ny]=='#')
		{
			maze[nx][ny]='.';
			dfs3(nx,ny);
		}
	}
	return ;
}

int main()
{
	while(scanf("%d%d", &H, &W)!=EOF)
	{
		count=0;
		if(W==0&&H==0)
			break;
		getchar();
		for(int i=0; i<H; i++)
		{
			for(int j=0; j<W; j++)
				maze[i][j]=getchar();
			getchar();
		}
		for(int i=0; i<H; i++)
			for(int j=0; j<W; j++)
				if(maze[i][j]=='@')
				{
					sx=i;
					sy=j;
					count++;
					dfs1(sx, sy);
				}
				else if(maze[i][j]=='*')
				{
					sx=i;
					sy=j;
					count++;
					dfs2(sx, sy);
				}
				else if(maze[i][j]=='#')
				{
					sx=i;
					sy=j;
					count++;
					dfs3(sx, sy);
				}
		
		
		
		printf("%d\n", count);
		
	}
	
	return 0;
}


Compiler output:
main.c:5:1: error: unknown type name 'using'
    5 | using namespace std;
      | ^~~~~
main.c:5:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
    5 | using namespace std;
      |                 ^~~
Language: C

#include<cstdio>
#include<cstring>
const int maxn=100+5;
char pic[maxn][maxn];
int dix[4]={0,1,0,-1},diy[4]={1,0,-1,0},sum,m,n;
void dfs(int i,int j,char x)
{
	if(i<0||i>=m||j<0||j>=n||pic[i][j]=='z')return;
	pic[i][j]='z';
	for(int s=0;s<4;s++)
	        if(pic[i+dix[s]][j+diy[s]]==x)dfs(i+dix[s],j+diy[s],x);
}
int main()
{
	while(scanf("%d%d",&m,&n)!=EOF)
	{
		if(m==0&&n==0)break;
		for(int i=0;i<m;i++)scanf("%s",pic[i]);
		for(int i=0;i<m;i++)
		    for(int j=0;j<n;j++)
		        if(pic[i][j]!='z')
		        {
		            dfs(i,j,pic[i][j]);
		            sum++;
                }
        printf("%d\n",sum);
        sum=0;
	}
	return 0;
} 


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

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int N,M,ans;
char map[25][25];
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

void dfs(int x,int y,char c)
{
	map[x][y]='.';
	for(int i = 0; i < 4;i++)
	{
		int nx = x + dx[i];
		int ny = y + dy[i];
		if(0 <= nx && nx < N && 0 <= ny && ny <= M && map[nx][ny]==c){
			map[nx][ny]='.';
			dfs(nx,ny,c);
		}
	}
	return ;
}

int main()
{
	while(scanf("%d %d",&N,&M)!=EOF)
	{
		if(N==0&&M==0)
		  break;
		ans=0;
		for(int i=0; i < N;i++)
		{
			scanf("%s",map[i]);
		}
		for(int i = 0; i < N;i++)
		{
			for(int j = 0; j < M;j++){
				if(map[i][j]=='#'){
					dfs(i,j,'#');
					ans++;
				}
				else if(map[i][j]=='@'){
					dfs(i,j,'@');
					ans++;
				}
				else if(map[i][j]=='*'){
					dfs(i,j,'*');
					ans++;
				}
				
			}
		}
		printf("%d\n",ans);
	}

	return 0;
}


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

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

int farm[101][101];

void kubun(int k,int a,int b){
	farm[a][b]=0;
	if(k==farm[a-1][b])kubun(farm[a-1][b],a-1,b);
	if(k==farm[a+1][b])kubun(farm[a+1][b],a+1,b);
	if(k==farm[a][b-1])kubun(farm[a][b-1],a,b-1);
	if(k==farm[a][b+1])kubun(farm[a][b+1],a,b+1);
	
}
int main(void){
	char c[101][101];
	int a,b;
	int h,w;
	int ans=0;
	while(1){
		ans=0;
		memset(farm,0,sizeof(farm));
		cin >> h >> w;
		if(h==0 && w==0)break;
		for(b=0;b<w;b++){
			cin >> c[b];
			for(a=0;a<h;a++){
				if(c[b][a]=='@')farm[a][b]=1;
				if(c[b][a]=='#')farm[a][b]=2;
				if(c[b][a]=='*')farm[a][b]=3;
				
			}
		}
		for(b=0;b<w;b++){
			for(a=0;a<h;a++){
				if(farm[a][b]==0);
				else{
					ans++;
					kubun(farm[a][b],a,b); 
				}
			}
		}
		cout<< ans << endl;
	}
	return 0;
}

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

#include<stdio.h>

int main(void) 
{
	int i, j, k;
	int H, W;
	char farm[102][102];
	int vector[4][2]={{-1,0},{1,0},{0,-1},{0,1}};
	int ans=0;
	while (scanf("%d %d\n",&H,&W) != EOF)
	{
		if (H == 0 && W == 0)
		{
			break;
		}
		for (i = 0; i < H + 2; i++)
		{
			if (i == 0 || i == H + 1)
			{
				for (j = 0; j < W + 2; j++)
				{
					farm[i][j] = 'o';
				}
			}
			else
			{
				farm[i][0] = 'o';
				scanf("%s", &farm[i][1]);
				farm[i][W+1] = 'o';
			}
		}
		ans = 0;
		for (i = 1; i < H + 1; i++)
		{
			for (j = 1; j < W + 1; j++)
			{
				if (farm[i][j] != 'o')
				{
					ans += bfs(i, j, farm, vector);
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:39:48: error: implicit declaration of function 'bfs' [-Wimplicit-function-declaration]
   39 |                                         ans += bfs(i, j, farm, vector);
      |                                                ^~~
Language: C

#include<iostream>
#include<cstdio>
using namespace std;
int h,w;
char fruit[100][100];
void dfs(int y, int x);
int dx[4] = {0,1,0,-1},dy[4] = {1,0,-1,0};
main(){
  while(1){
    int cnt=0;
  cin >> h >> w;
  if(h==0 && w==0) break;
  for(int i=0; i<h ;i++){
    cin >> fruit[i];
  }
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      if(fruit[i][j]!='.'){
	dfs(i,j);
      cnt++;
      }
    }
  }
  
  cout << cnt << endl;
  
  }
}

void dfs(int y, int x){
  char f=fruit[y][x];
  fruit[y][x]='.';
  for(int i=0; i<4 ; i++){
    int ny = y+dy[i];
    int nx= x+dx[i]; 
    if(x>=0 && x<w && y>=0 && y<h && fruit[ny][nx]==f){
      dfs(ny,nx);
    }
  }
}

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 i, j;
int h, w;
int dx[4] = {1, 0, -1,  0};
int dy[4] = {0, 1,  0, -1};
char **data;
char rLine[101];

void dfs(int x, int y, char fType)
{
	data[y][x] = 0;

	int k;
	for (k=0; k<4; k++) {
		int nx = x + dx[k];
		int ny = y + dy[k];
		if (nx>=0 && nx<w && ny>=0 && ny<h && data[ny][nx] == fType)
			dfs(nx, ny, data[ny][nx]);	
  }
}

int main()
{
	while (1) {
		scanf("%d%d ", &h, &w);
		if (!h && !w) break;
	
		data = (char **)calloc(h, sizeof(char *));
		for (i=0; i<h; i++)
			data[i] = (char *)calloc(w, sizeof(char));
		
		for (i=0; i<h; i++) {
			gets(rLine);
			for (j=0; j<w; j++) data[i][j] = rLine[j];
		}

		int res = 0;
		for (int i=0; i<h; i++)
			for (int j=0; j<w; j++)
				if (data[i][j] != 0) {
					dfs(j, i, data[i][j]);
					res++;
				}

		for (i=0; i<h; i++)	
			free(data[i]);
		free(data);
	}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:35:25: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
   35 |                         gets(rLine);
      |                         ^~~~
      |                         fgets
Language: C

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

int i, j;
int h, w;
int dx[4] = {1, 0, -1,  0};
int dy[4] = {0, 1,  0, -1};
char **data;
char rLine[101];

void dfs(int x, int y, char fType)
{
	data[y][x] = 0;

	int k;
	for (k=0; k<4; k++) {
		int nx = x + dx[k];
		int ny = y + dy[k];
		if (nx>=0 && nx<w && ny>=0 && ny<h && data[ny][nx] == fType)
			dfs(nx, ny, data[ny][nx]);	
  }
}

int main()
{
	while (1) {
		scanf("%d%d ", &h, &w);
		if (!h && !w) break;
	
		data = (char **)calloc(h, sizeof(char *));
		for (i=0; i<h; i++)
			data[i] = (char *)calloc(w, sizeof(char));
		
		for (i=0; i<h; i++) {
			gets(rLine);
			for (j=0; j<w; j++) data[i][j] = rLine[j];
		}

		int res = 0;
		for (int i=0; i<h; i++)
			for (int j=0; j<w; j++)
				if (data[i][j] != 0) {
					dfs(j, i, data[i][j]);
					res++;
				}

		printf("%d\n", res);

		for (i=0; i<h; i++)	
			free(data[i]);
		free(data);
	}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:35:25: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
   35 |                         gets(rLine);
      |                         ^~~~
      |                         fgets
Language: C

#include <stdio.h>
char mp[102][102];//mp[w][h]

void dfs(int wj,int hi,char c){
  mp[wj][hi] = '.';
  if(mp[wj+1][hi] == c) dfs(wj+1,hi,c);
  if(mp[wj-1][hi] == c) dfs(wj-1,hi,c);
  if(mp[wj][hi+1] == c) dfs(wj,hi+1,c);
  if(mp[wj][hi-1] == c) dfs(wj,hi-1,c);
  return;
}
  
int main(){
  int w,h,i,j;

  while(1){
    int cnt = 0;
     scanf("%d%d",&h,&w);
    if((!w) && (!h)) break;
    for(i=0;i <=w+1;i++) mp[i][0] ='.',mp[i][h+1] = '.';
    for(i=1;i <=h;i++) mp[0][i] = '.'.mp[w+1][i] = '.';
    for(i=1;i <= h;i++){
      for(j=1;j <= w;j++){
        scanf(" %c",&mp[j][i]);
      }
    }
    for(i=1;i <= h;i++){
      for(j=1;j <= w;j++){
        if(mp[j][i] != '.') cnt++,dfs(j,i,mp[j][i]);
      }
    }

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

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:21:38: error: request for member 'mp' in something not a structure or union
   21 |     for(i=1;i <=h;i++) mp[0][i] = '.'.mp[w+1][i] = '.';
      |                                      ^
Language: C++

#include<cstdio>
int H , W;
char room[100][100];
int next_step[4][2] = {
	{0 , 1} , {1 , 0} , {0 , -1} , {-1 , 0}
};
int number;
void dfs(int x , int y , char c)
{
	room[x][y] = 'X';
	for(int i = 0 ; i < 4 ; i++)
	{
		int nx = x + next_step[i][0] , ny = y + next_step[i][1];
		if(nx >= 0 && nx < W && ny >= 0 && ny < H && room[nx][ny] == c)
		{
			dfs(nx , ny , c);
		}
	}
}
void solve()
{
	for(int y = 0 ; y < H ; y++)
		for(int x = 0 ; x < W ; x++)
		{
			if(room[x][y] != 'X')
			{
				dfs(x , y , room[x][y]);
				number++;
			}
		}
	printf("%d\n",number );
}
int main(int argc, char const *argv[])
{
	while(scanf("%d %d" , &H , &W) ,  H != 0)
	{
	    number = 0;
		for(int y = 0 ; y < H ; y++)
		{
			scanf("%s", room[i]);
		}
		solve();
	}
	return 0;
}

.......


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:40:42: error: 'i' was not declared in this scope
   40 |                         scanf("%s", room[i]);
      |                                          ^
a.cc: At global scope:
a.cc:47:1: error: expected unqualified-id before '...' token
   47 | .......
      | ^~~
Language: C++

#include<cstdio>
int H , W;
char room[100][100];
int next_step[4][2] = {
	{0 , 1} , {1 , 0} , {0 , -1} , {-1 , 0}
};
int number;
void dfs(int x , int y , char c)
{
	room[x][y] = 'X';
	for(int i = 0 ; i < 4 ; i++)
	{
		int nx = x + next_step[i][0] , ny = y + next_step[i][1];
		if(nx >= 0 && nx < W && ny >= 0 && ny < H && room[nx][ny] == c)
		{
			dfs(nx , ny , c);
		}
	}
}
void solve()
{
	for(int y = 0 ; y < H ; y++)
		for(int x = 0 ; x < W ; x++)
		{
			if(room[x][y] != 'X')
			{
				dfs(x , y , room[x][y]);
				number++;
			}
		}
	printf("%d\n",number );
}
int main(int argc, char const *argv[])
{
	while(scanf("%d %d" , &H , &W), H != 0)
	{
	    number = 0;
		for(int y = 0 ; y < H ; y++)
		{
			scanf("%s" , room[y]);
		}
		solve();
	}
	return 0;
}

.......................


Compiler output:
a.cc:47:1: error: expected unqualified-id before '...' token
   47 | .......................
      | ^~~
Language: C++

#include<stdio.h>
#include<iostream>
using namespace std;
int w,h;
int dx[4]={1,0,-1,0},dy[4] = {0,1,0,-1};
char fruit[100][100];
//int num;
void dfs(int x,int y,char c){
    fruit[x][y]='.';
    for(int i = 0; i < 4;i++){
            int nx = x + dx[i], ny = y + dy[i];
            if(nx<h&&nx>=0&&ny<w&&ny>=0&&fruit[nx][ny]==c)
                dfs(nx,ny,fruit[nx][ny]);
     }
return ;
}

void solve(){
    while(cin>>w>>h&&w&&h){
        num = 0;
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w;j++)
                cin>>fruit[i][j];
        }
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w;j++)
            {
                if(fruit[i][j]!='.'){
                dfs(i,j,fruit[i][j]);
                  num++;
    }

        }
        }
        printf("%d\n",num);
        }
return ;
}
int main(){
    solve();
    return 0 ;
}



Compiler output:
a.cc: In function 'void solve()':
a.cc:20:9: error: 'num' was not declared in this scope; did you mean 'enum'?
   20 |         num = 0;
      |         ^~~
      |         enum
Language: C++

#include<iostream>
#include<string>

using namespace std;

string map[101];
int count=0;
int n,m;

void dfs(char c,int i,int j){
  
    s[i][j] = '.';
    if(i+1 < n && s[i+1][j] == c)
    {
        dfs(c,i+1,j);
    }
    if(i-1 >= 0 && s[i-1][j] == c)
    {
        dfs(c,i-1,j);
    }
    if(j+1 < m && s[i][j+1] == c)
    {
        dfs(c,i,j+1);
    }
    if(j-1 >= 0 && s[i][j-1] == c)
    {
        dfs(c,i,j-1);
    }
}

int main(){

  while(1){

    cin >> n >> m;
     {
       if(n == 0 && m == 0)
	 break;
 
       count = 0;
       rep(i,n) cin >> s[i];
         
       rep(i,n)
	 {
	   rep(j,m)
	     {
	       if(s[i][j] != '.')
		 {
		   dfs(s[i][j],i,j);
		   count++;
		 }
	     }
	 }
         
       cout << count << endl
     }
  }
}
 


Compiler output:
a.cc: In function 'void dfs(char, int, int)':
a.cc:12:5: error: 's' was not declared in this scope
   12 |     s[i][j] = '.';
      |     ^
a.cc: In function 'int main()':
a.cc:41:12: error: 'i' was not declared in this scope
   41 |        rep(i,n) cin >> s[i];
      |            ^
a.cc:41:8: error: 'rep' was not declared in this scope
   41 |        rep(i,n) cin >> s[i];
      |        ^~~
a.cc:55:29: error: expected ';' before '}' token
   55 |        cout << count << endl
      |                             ^
      |                             ;
   56 |      }
      |      ~