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

import java.util.Scanner;

public class a0118 {
    private static char[][] chars;
    private static int row, col;
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        char symbol;
        while (true) {
            row = input.nextInt();
            col = input.nextInt();
            if (row == 0 && col == 0) {
                break;
            }
            chars = new char[row][col];
            for (int i = 0; i < row; i++) {
                chars[i] = input.next().toCharArray();
            }
            int n = 0;
            for (int i = 0; i < row; i++) {
                for (int j = 0; j < col; j++) {
                    symbol = chars[i][j];
                    if (symbol != '.') {
                        dfs(i, j, symbol);
                        n++;
                    }
                }
            }
            System.out.println(n);
        }
    }
    private static void dfs(int x, int y, char symbol) {
        chars[x][y] = '.';
        int dx, dy;
        int[] x_mov = {-1, 0, 0, 1}, y_mov = {0, -1, 1, 0};
        for (int i = 0; i < x_mov.length; i++) {
            dx = x + x_mov[i]; dy = y + y_mov[i];
            if (0 <= dx && dx < row && 0 <= dy && dy < col &&
                    chars[dx][dy] == symbol) {
                dfs(dx, dy, symbol);
            }
        }
    }
}

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

import java.util.*;
import java.io.*;
 
public class Main {
    static IO io = new IO();
    static char map[][];
    static int dx[] = {0, 1, 0, -1};
    static int dy[] = {1, 0, -1, 0};
    static int ys;
    static int xs;
    public static void main(String[] args) {
         
        while (true) {
             
            ys = io.nextInt();
            xs = io.nextInt();
            if (ys==0 && xs==0) break;
            map = new char[ys][xs];
            for (int j=0; j<ys; j++) {
                map[j] = io.nextCharArray(xs);
            }
             
            int ans = 0;
             
            for (int j=0; j<ys; j++) {
                for (int i=0; i<xs; i++) {
                    if (map[j][i]=='@' || map[j][i]=='#' || map[j][i]=='*') {
                        dfs(i, j, map[j][i]);
                        ans++;
                    }
                }
            }
             
            System.out.println(ans);
 
        }
         
    }
     
    static void dfs(int x, int y, char c) {
         
        map[y][x] = ' ';
        for (int i=0; i<4; i++) {
            if (0<=x+dx[i] && x+dx[i]<xs && 0<=y+dy[i] && y+dy[i]<ys) {
                if (map[y+dy[i]][x+dx[i]]==c) dfs(x+dx[i], y+dy[i], c);
            }
        }
         
    }

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

import java.util.*;
import java.io.*;
 
public class Main {
    static Scanner sc = new Scanner(System.in);
    static char map[][];
    static int dx[] = {0, 1, 0, -1};
    static int dy[] = {1, 0, -1, 0};
    static int ys;
    static int xs;
    public static void main(String[] args) {
         
        while (true) {
             
            ys = sc.nextInt();
            xs = sc.nextInt();
            if (ys==0 && xs==0) break;
            map = new char[ys][xs];
            for (int j=0; j<ys; j++) {
                map[j] = sc.nextCharArray(xs);
            }
             
            int ans = 0;
             
            for (int j=0; j<ys; j++) {
                for (int i=0; i<xs; i++) {
                    if (map[j][i]=='@' || map[j][i]=='#' || map[j][i]=='*') {
                        dfs(i, j, map[j][i]);
                        ans++;
                    }
                }
            }
             
            System.out.println(ans);
 
        }
         
    }
     
    static void dfs(int x, int y, char c) {
         
        map[y][x] = ' ';
        for (int i=0; i<4; i++) {
            if (0<=x+dx[i] && x+dx[i]<xs && 0<=y+dy[i] && y+dy[i]<ys) {
                if (map[y+dy[i]][x+dx[i]]==c) dfs(x+dx[i], y+dy[i], c);
            }
        }
         
    }

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


import java.util.Scanner;
 
public class Main {
    static Scanner sc = new Scanner(System.in);
    static char map[][];
    static int dx[] = {0, 1, 0, -1};
    static int dy[] = {1, 0, -1, 0};
    static int ys;
    static int xs;
    public static void main(String[] args) {
         
        while (true) {
             
            ys = sc.nextInt();
            xs = sc.nextInt();
            if (ys==0 && xs==0) break;
            map = new char[ys][xs];
            for (int j=0; j<ys; j++) {
                map[j] = sc.nextCharArray(xs);
            }
             
            int ans = 0;
             
            for (int j=0; j<ys; j++) {
                for (int i=0; i<xs; i++) {
                    if (map[j][i]=='@' || map[j][i]=='#' || map[j][i]=='*') {
                        dfs(i, j, map[j][i]);
                        ans++;
                    }
                }
            }
             
            System.out.println(ans);
 
        }
         
    }
     
    static void dfs(int x, int y, char c) {
         
        map[y][x] = ' ';
        for (int i=0; i<4; i++) {
            if (0<=x+dx[i] && x+dx[i]<xs && 0<=y+dy[i] && y+dy[i]<ys) {
                if (map[y+dy[i]][x+dx[i]]==c) dfs(x+dx[i], y+dy[i], c);
            }
        }
         
    }

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

import java.util.Scanner;

/**
 * Created by The Illsionist on 2018/1/6.
 */
public class AOJ0118 {

    public static void main(String args[]){
        Scanner input = new Scanner(System.in);
        int result = 0;
        while(true){
            int W = input.nextInt(); // W columns
            int H = input.nextInt(); // H rows
            if(W == 0 && H == 0){
                break;  //stop condition
            }
            char[][] array = new char[H][W];
            for(int i = 0;i < H;i++){
                array[i] = input.next().toCharArray();
            }
            for(int i = 0;i < H;i++){
                for(int j = 0;j < W;j++){
                    char fruit = array[i][j];
                    if(fruit == '@' || fruit == '#' || fruit == '*'){
                        result++;
                        dfs(array,i,j,fruit);
                    }
                }
            }
            System.out.println(result);
            result = 0;
        }
        input.close();
    }

    public static void dfs(char[][] array,int x,int y,char fruit){
        array[x][y] = '!';
        int[] dx = new int[]{-1,0,1,0};
        int[] dy = new int[]{0,-1,0,1};
        for(int i = 0;i < 4;i++){
            int tx = x + dx[i];
            int ty = y + dy[i];
            if(tx >= 0 && tx < array.length && ty >= 0 && ty < array[0].length && array[tx][ty] == fruit)
                dfs(array,tx,ty,fruit);
        }
    }
}


Compiler output:
Main.java:6: error: class AOJ0118 is public, should be declared in a file named AOJ0118.java
public class AOJ0118 {
       ^
1 error
Language: Java

class AOJ0118 {
    public static void main(String args[]){
        Scanner input = new Scanner(System.in);
        int result = 0;
        while(true){
            int W = input.nextInt();
            int H = input.nextInt();
            if(W < 0 || H < 0 || (W <= 0 && H <= 0))
                break;
            char[][] array = new char[H][W];
            for(int i = 0;i < H;i++){
                array[i] = input.next().toCharArray();
            }
            for(int i = 0;i < H;i++){
                for(int j = 0;j < W;j++){
                    char fruit = array[i][j];
                    if(fruit == '@' || fruit == '#' || fruit == '*'){
                        result++;
                        dfs(array,i,j,fruit);
                    }
                }
            }
            System.out.println(result);
            result = 0;
        }
    }
    public static void dfs(char[][] array,int x,int y,char fruit){
        array[x][y] = '!';
        int[] dx = new int[]{-1,0,1,0};
        int[] dy = new int[]{0,-1,0,1};
        for(int i = 0;i < 4;i++){
            int tx = x + dx[i];
            int ty = y + dy[i];
            if(tx >= 0 && tx < array.length && ty >= 0 && ty < array[0].length && array[tx][ty] == fruit)
                dfs(array,tx,ty,fruit);
        }
    }
}


Compiler output:
Main.java:3: error: cannot find symbol
        Scanner input = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class AOJ0118
Main.java:3: error: cannot find symbol
        Scanner input = new Scanner(System.in);
                            ^
  symbol:   class Scanner
  location: class AOJ0118
2 errors
Language: Java

public class Main {
    
    public static int[] dx = {-1, 0, 1, 0};
    public static int[] dy = {0, -1, 0, 1};
    public static void dfs(int x, int y, char[][] region, int n, int m)
    {
        char c = region[x][y];
        region[x][y] = 'x';
        
        for(int i=0;i<4;i++)
        {
            int new_x = x + dx[i];
            int new_y = y + dy[i];
            if(new_x >= 0 && new_x < n && new_y >= 0 && new_y < m && region[new_x][new_y] == c)
            {
                dfs(new_x, new_y, region,n, m);
            }
        }
        
    }
    
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        while(true)
        {
            int m = sc.nextInt();
            int n = sc.nextInt();
            String temp = sc.nextLine();
            if(m==0&&n==0)
            {
                break;
            }
            // System.out.println(m+" "+n);
            char[][] region = new char[m][n];
            for(int i=0;i<m;i++)
            {
                // System.out.println(i);
                String line = sc.nextLine();
                // System.out.println(line);
                for(int j=0;j<n;j++)
                {
                    region[i][j] = line.charAt(j);
                }
            }
            
            int res = 0;
            for(int i=0;i<m;i++)
            {
                for(int j=0; j<n;j++)
                {
                    if(region[i][j] == 'x')
                        continue;
                    else
                    {
                        res += 1;
                        dfs(i,j, region, n, m);
                    }
                }
            }
            System.out.println(res);
        }
    }
}



Compiler output:
Main.java:23: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:23: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

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

public class Main{
	public static void main(String args[]){
		try{
			new Main();
		}catch(IOException err){
			err.printStackTrace();
		}
	}

	public Main() throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		List<Integer> Ans = new ArrayList<Integer>();
		String line;

		while((line = in.readLine()) != null){
			String[] dst = line.split(" ");
			int h = Integer.parseInt(dst[0]);
			int w = Integer.parseInt(dst[1]);

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

			String[][] data = new String[h+1][w+1];
			for(int j=1; j<=h; j++){
				line = in.readLine();
				for(int i=1; i<=w; i++){
					data[j][i] = line.substring(i-1, i);
				}
			}

			for(int j=0; j<=h; j++){
				data[j][0] = " ";
			}

			for(int i=0; i<=w; i++){
				data[0][i] = " ";
			}

			int count = 0;
			String prev = "";
			for(int j=1; j<=h; j++){
				for(int i=1; i<=w; i++){
					if(!data[j][i].equals(prev)){
						prev = "";
					}

					if(!data[j][i].equals(data[j-1][i]) && !data[j][i].equals(data[j][i-1])){
						count++;
					}

					else if(data[j][i].equals(data[j-1][i]) && data[j][i].equals(data[j][i-1]) && !data[j][i].equals(data[j-1][i-1])){
						if(prev.equals("")){
							count--;
						}
					}

					else if(data[j][i].equals(data[j-1][i])){
						prev = data[j][i];
					}
				}
			}

			Ans.add(count);
		}

		for(int n=0; n<Ans.size(); n++){
			System.out.println(Ans.get(n));
		}
	}
}import java.io.*;
import java.util.*;

public class Main{
	public static void main(String args[]){
		try{
			new Main();
		}catch(IOException err){
			err.printStackTrace();
		}
	}

	public Main() throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		List<Integer> Ans = new ArrayList<Integer>();
		String line;

		while((line = in.readLine()) != null){
			String[] dst = line.split(" ");
			int h = Integer.parseInt(dst[0]);
			int w = Integer.parseInt(dst[1]);

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

			String[][] data = new String[h+1][w+1];
			for(int j=1; j<=h; j++){
				line = in.readLine();
				for(int i=1; i<=w; i++){
					data[j][i] = line.substring(i-1, i);
				}
			}

			for(int j=0; j<=h; j++){
				data[j][0] = " ";
			}

			for(int i=0; i<=w; i++){
				data[0][i] = " ";
			}

			int count = 0;
			String prev = "";
			for(int j=1; j<=h; j++){
				for(int i=1; i<=w; i++){
					if(!data[j][i].equals(prev)){
						prev = "";
					}

					if(!data[j][i].equals(data[j-1][i]) && !data[j][i].equals(data[j][i-1])){
						count++;
					}

					else if(data[j][i].equals(data[j-1][i]) && data[j][i].equals(data[j][i-1]) && !data[j][i].equals(data[j-1][i-1])){
						if(prev.equals("")){
							count--;
						}
					}

					else if(data[j][i].equals(data[j-1][i])){
						prev = data[j][i];
					}
				}
			}

			Ans.add(count);
		}

		for(int n=0; n<Ans.size(); n++){
			System.out.println(Ans.get(n));
		}
	}
}

Compiler output:
Main.java:74: error: class, interface, enum, or record expected
}import java.io.*;
 ^
Main.java:75: error: class, interface, enum, or record expected
import java.util.*;
^
2 errors
Language: Java

import java.io.*;
import java.util.*;
import java.math.*;
public class Main { 
    public static void main(String[] args) throws java.io.IOException{ 
        Scanner scan = new Scanner(System.in);
        
        while(true){
            int M = scan.nextInt();
            int N = scan.nextInt();
            if(N==0 && M ==0)break;
            int ans =0;
            char [][] field =new char[M][N];
            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    field[i][j] = nextByte();
                }
                skip("\n");
            }

            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    if(field[i][j] != '.'){
                        dfs(i,j,field);
                        ans++;
                    }
                }
            }
            System.out.println(ans);
    }


}
  public static void dfs(int x,int y,char [][] field){
      char crop = field[y][x];
      field[y][x] = '.';
      char [] dx= {1,0,-1,0};
      
      for(int i=0;i<3;i++){
          int nx = x+dx;
          int ny = x + dx^1;
          if(0<=nx 
            && nx < N 
            &&0<=ny 
            &&ny <M 
            && field[ny][nx].equals(crop)){
              dfs(ny,nx,field);
          }
      }
  }
}

Compiler output:
Main.java:16: error: cannot find symbol
                    field[i][j] = nextByte();
                                  ^
  symbol:   method nextByte()
  location: class Main
Main.java:18: error: cannot find symbol
                skip("\n");
                ^
  symbol:   method skip(String)
  location: class Main
Main.java:37: error: incompatible types: possible lossy conversion from int to char
      char [] dx= {1,0,-1,0};
                       ^
Main.java:40: error: bad operand types for binary operator '+'
          int nx = x+dx;
                    ^
  first type:  int
  second type: char[]
Main.java:41: error: bad operand types for binary operator '+'
          int ny = x + dx^1;
                     ^
  first type:  int
  second type: char[]
Main.java:43: error: cannot find symbol
            && nx < N 
                    ^
  symbol:   variable N
  location: class Main
Main.java:45: error: cannot find symbol
            &&ny <M 
                  ^
  symbol:   variable M
  location: class Main
Main.java:46: error: char cannot be dereferenced
            && field[ny][nx].equals(crop)){
                            ^
8 errors
Language: Java

import java.io.*;
import java.util.*;
import java.math.*;
public class Main { 
    public static void main(String[] args) throws java.io.IOException{ 
        Scanner scan = new Scanner(System.in);
        
        while(true){
            int M = scan.nextInt();
            int N = scan.nextInt();
            if(N==0 && M ==0)break;
            int ans =0;
            char [][] field =new char[M][N];
            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    field[i][j] = scan.nextByte();
                }
                scan.skip("\n");
            }

            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    if(field[i][j] != '.'){
                        dfs(i,j,field);
                        ans++;
                    }
                }
            }
            System.out.println(ans);
    }


}
  public static void dfs(int x,int y,char [][] field){
      char crop = field[y][x];
      field[y][x] = '.';
      int  [] dx= {1,0,-1,0};
      
      for(int i=0;i<3;i++){
          int nx = x+dx;
          int ny = x + dx^1;
          if(0<=nx 
            && nx < N 
            &&0<=ny 
            &&ny <M 
            && field[ny][nx].equals(crop)){
              dfs(ny,nx,field);
          }
      }
  }
}

Compiler output:
Main.java:16: error: incompatible types: possible lossy conversion from byte to char
                    field[i][j] = scan.nextByte();
                                               ^
Main.java:40: error: bad operand types for binary operator '+'
          int nx = x+dx;
                    ^
  first type:  int
  second type: int[]
Main.java:41: error: bad operand types for binary operator '+'
          int ny = x + dx^1;
                     ^
  first type:  int
  second type: int[]
Main.java:43: error: cannot find symbol
            && nx < N 
                    ^
  symbol:   variable N
  location: class Main
Main.java:45: error: cannot find symbol
            &&ny <M 
                  ^
  symbol:   variable M
  location: class Main
Main.java:46: error: char cannot be dereferenced
            && field[ny][nx].equals(crop)){
                            ^
6 errors
Language: Java

import java.io.*;                                                                                                             
import java.util.*;                                                                                                           
import java.math.*;                                                                                                           
public class Main {                                                                                                           
    public static void main(String[] args) throws java.io.IOException{                                                        
        Scanner scan = new Scanner(System.in);                                                                                
                                                                                                                              
        while(true){                                                                                                          
            int M = scan.nextInt();                                                                                           
            int M = scan.nextInt();
            int N = scan.nextInt();
            if(N==0 && M ==0)break;
            int ans =0;
            char [][] field =new char[M][N];
            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    field[i][j] = (char)(scan.nextInt());
                }
                scan.skip("\n");
            }

            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    if(field[i][j] != '.'){
                        dfs(i,j,field);
                        ans++;
                    }
                }
            }
            System.out.println(ans);
    }


}
  public static void dfs(int x,int y,char [][] field){
      char crop = field[y][x];
      field[y][x] = '.';
      int  [] dx= {1,0,-1,0};
      
      for(int i=0;i<3;i++){
          int nx = x+dx;
          int ny = x + dx^1;
          if(0<=nx 
            && nx < N 
            &&0<=ny 
            &&ny <M 
            && field[ny][nx].equals(crop)){
              dfs(ny,nx,field);
          }
      }
  }
}

Compiler output:
Main.java:10: error: variable M is already defined in method main(String[])
            int M = scan.nextInt();
                ^
Main.java:41: error: bad operand types for binary operator '+'
          int nx = x+dx;
                    ^
  first type:  int
  second type: int[]
Main.java:42: error: bad operand types for binary operator '+'
          int ny = x + dx^1;
                     ^
  first type:  int
  second type: int[]
Main.java:44: error: cannot find symbol
            && nx < N 
                    ^
  symbol:   variable N
  location: class Main
Main.java:46: error: cannot find symbol
            &&ny <M 
                  ^
  symbol:   variable M
  location: class Main
Main.java:47: error: char cannot be dereferenced
            && field[ny][nx].equals(crop)){
                            ^
6 errors
Language: Java

import java.io.*;
import java.util.*;
import java.math.*;
public class Main { 
    public static void main(String[] args) throws java.io.IOException{ 
        Scanner scan = new Scanner(System.in);
        
        while(true){
            int M = scan.nextInt();
            int N = scan.nextInt();
            if(N==0 && M ==0)break;
            int ans =0;
            char [][] field =new char[M][N];
            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    field[i][j] = (char)(scan.nextInt());
                }
                scan.skip("\n");
            }

            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    if(field[i][j] != '.'){
                        dfs(i,j,field);
                        ans++;
                    }
                }
            }
            System.out.println(ans);
    }


}
  public static void dfs(int x,int y,char [][] field){
      char crop = field[y][x];
      field[y][x] = '.';
      int  [] dx= {1,0,-1,0};
      
      for(int i=0;i<3;i++){
          int nx = x+dx[i];
          int ny = y + dx[i]^1;
          if(0<=nx 
            && nx < N 
            &&0<=ny 
            &&ny <M 
            && field[ny][nx].equals(crop)){
              dfs(ny,nx,field);
          }
      }
  }
}

Compiler output:
Main.java:43: error: cannot find symbol
            && nx < N 
                    ^
  symbol:   variable N
  location: class Main
Main.java:45: error: cannot find symbol
            &&ny <M 
                  ^
  symbol:   variable M
  location: class Main
Main.java:46: error: char cannot be dereferenced
            && field[ny][nx].equals(crop)){
                            ^
3 errors
Language: Java

import java.io.*;
import java.util.*;
import java.math.*;
public class Main { 
    public static void main(String[] args) throws java.io.IOException{ 
        Scanner scan = new Scanner(System.in);
        
        while(true){
            int M = scan.nextInt();
            int N = scan.nextInt();
            if(N==0 && M ==0)break;
            int ans =0;
            char [][] field =new char[M][N];
            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    field[i][j] = (char)(scan.nextInt());
                }
                scan.skip("\n");
            }

            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    if(field[i][j] != '.'){
                        dfs(i,j,field);
                        ans++;
                    }
                }
            }
            System.out.println(ans);
    }


}
  public static void dfs(int x,int y,char [][] field){
      char crop = field[y][x];
      field[y][x] = '.';
      int  [] dx= {1,0,-1,0};
      
      for(int i=0;i<3;i++){
          int nx = x+dx[i];
          int ny = y + dx[i]^1;
          if((0<=nx )&& (nx < N) &&(0<=ny )&& (ny <M)  &&( field[ny][nx].equals(crop))){
              dfs(ny,nx,field);
          }
      }
  }
}

Compiler output:
Main.java:42: error: cannot find symbol
          if((0<=nx )&& (nx < N) &&(0<=ny )&& (ny <M)  &&( field[ny][nx].equals(crop))){
                              ^
  symbol:   variable N
  location: class Main
Main.java:42: error: cannot find symbol
          if((0<=nx )&& (nx < N) &&(0<=ny )&& (ny <M)  &&( field[ny][nx].equals(crop))){
                                                   ^
  symbol:   variable M
  location: class Main
Main.java:42: error: char cannot be dereferenced
          if((0<=nx )&& (nx < N) &&(0<=ny )&& (ny <M)  &&( field[ny][nx].equals(crop))){
                                                                        ^
3 errors
Language: Java

import java.io.*;
import java.util.*;
import java.math.*;
public class Main { 
    public static void main(String[] args) throws java.io.IOException{ 
        Scanner scan = new Scanner(System.in);
        
        while(true){
            int M = scan.nextInt();
            int N = scan.nextInt();
            if(N==0 && M ==0)break;
            int ans =0;
            char [][] field =new char[M][N];
            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    field[i][j] = (char)(scan.nextInt());
                }
                scan.skip("\n");
            }

            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    if(field[i][j] != '.'){
                        dfs(i,j,field,M,N);
                        ans++;
                    }
                }
            }
            System.out.println(ans);
    }


}
  public static void dfs(int x,int y,char [][] field,int M,int N){
      char crop = field[y][x];
      field[y][x] = '.';
      int  [] dx= {1,0,-1,0};
      
      for(int i=0;i<3;i++){
          int nx = x+dx[i];
          int ny = y + dx[i]^1;
          if((0<=nx )&& (nx < N) &&(0<=ny )&& (ny <M)  &&( field[ny][nx].equals(crop))){
              dfs(ny,nx,field);
          }
      }
  }
}

Compiler output:
Main.java:42: error: char cannot be dereferenced
          if((0<=nx )&& (nx < N) &&(0<=ny )&& (ny <M)  &&( field[ny][nx].equals(crop))){
                                                                        ^
Main.java:43: error: method dfs in class Main cannot be applied to given types;
              dfs(ny,nx,field);
              ^
  required: int,int,char[][],int,int
  found:    int,int,char[][]
  reason: actual and formal argument lists differ in length
2 errors
Language: Java

import java.io.*;
import java.util.*;
import java.math.*;
public class Main { 
    public static void main(String[] args) throws java.io.IOException{ 
        Scanner scan = new Scanner(System.in);
        
        while(true){
            int M = scan.nextInt();
            int N = scan.nextInt();
            if(N==0 && M ==0)break;
            int ans =0;
            char [][] field =new char[M][N];
            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    field[i][j] = (char)(scan.nextInt());
                }
                scan.skip("\n");
            }

            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    if(field[i][j] != '.'){
                        dfs(i,j,field,M,N);
                        ans++;
                    }
                }
            }
            System.out.println(ans);
    }


}
  public static void dfs(int x,int y,char [][] field,int M,int N){
      char crop = field[y][x];
      field[y][x] = '.';
      int  [] dx= {1,0,-1,0};
      
      for(int i=0;i<3;i++){
          int nx = x+dx[i];
          int ny = y + dx[i]^1;
          if((0<=nx )&& (nx < N) &&(0<=ny )&& (ny <M)  &&( field[ny][nx].equals(crop))){
              dfs(ny,nx,field,M,N);
          }
      }
  }
}

Compiler output:
Main.java:42: error: char cannot be dereferenced
          if((0<=nx )&& (nx < N) &&(0<=ny )&& (ny <M)  &&( field[ny][nx].equals(crop))){
                                                                        ^
1 error
Language: Java

import java.io.*;
import java.util.*;
import java.math.*;
public class Main { 
    public static void main(String[] args) throws java.io.IOException{ 
        Scanner scan = new Scanner(System.in);
        
        while(true){
            int M = scan.nextInt();
            int N = scan.nextInt();
            if(N==0 && M ==0)break;
            int ans =0;
            char [][] field =new char[M][N];
            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    field[i][j] = (char)(scan.nextInt());
                }
                scan.skip("\n");
            }

            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    if(field[i][j] != '.'){
                        dfs(i,j,field,M,N);
                        ans++;
                    }
                }
            }
            System.out.println(ans);
    }


}
  public static void dfs(int x,int y,char [][] field,int M,int N){
      String crop = (String)(field[y][x]);
      field[y][x] = '.';
      int  [] dx= {1,0,-1,0};
      
      for(int i=0;i<3;i++){
          int nx = x+dx[i];
          int ny = y + dx[i]^1;
          if((0<=nx )&& (nx < N) &&(0<=ny )&& (ny <M)  &&( field[ny][nx].equals(crop))){
              dfs(ny,nx,field,M,N);
          }
      }
  }
}

Compiler output:
Main.java:35: error: incompatible types: char cannot be converted to String
      String crop = (String)(field[y][x]);
                            ^
Main.java:42: error: char cannot be dereferenced
          if((0<=nx )&& (nx < N) &&(0<=ny )&& (ny <M)  &&( field[ny][nx].equals(crop))){
                                                                        ^
2 errors
Language: Java

import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
  public static int M;
  public static int N;
    public static void main(String[] args) throws java.io.IOException{
        Scanner scan = new Scanner(System.in);
        Boolean flag = true;
         
        while(flag){
            M = scan.nextInt();
            N = scan.nextInt();
         //   System.out.println(M);System.out.println(N);
           
            if(N ==0 && M ==0){break;}
            
            int ans =0;
            if(M==1&&N==0){System.out.println(ans);continue;}
            scan.nextLine();
            char [][] field =new char[M][N];
            for(int i=0;i<M;i++){
             String line = scan.nextLine();
                for(int j=0;j<N;j++){
                    field[i][j] = line.charAt(j);
                
                }
            }
            
 
            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    if(field[i][j] != '.'){
                    	++ans;
                        dfs(i,j,field);
                        
                    }
                }
            }
            System.out.println(ans);
            
    }

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

import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
  public static int M;
  public static int N;
    public static void main(String[] args) throws java.io.IOException{
        Scanner scan = new Scanner(System.in);
        Boolean flag = true;

        while(flag){
            M = scan.nextInt();
            N = scan.nextInt();
         //   System.out.println(M);System.out.println(N);

            if(N ==0 && M ==0){break;}

            int ans =0;
            if(M==1&&N==0){System.out.println(ans);continue;}
            scan.nextLine();
            char [][] field =new char[M][N];
            for(int i=0;i<M;i++){
             String line = scan.nextLine();
                for(int j=0;j<N;j++){
                    field[i][j] = line.charAt(j);

                }
            }


            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    if(field[i][j] != '.'){
                        ++ans;
                        dfs(i,j,field);

                    }
                }
            }
            System.out.println(ans);

    }


}
  public static void dfs(byte y,byte x,char [][] field){
      char crop = field[y][x];
      field[y][x] = '.';
      byte  [] dx= {1,0,-1,0};
      for(byte i=0;i<4;i++){

          if(0<=x|dx[i] && x | dx[i] < N &&0<=(y | (dx[i]^1)) && (y | (dx[i]^1)) <M  &&( field[y+dx[i]^1][x | dx[i]]==crop))
              dfs(y | dx[i],x| (dx[i]^1),field);
      }
      return;
  }
}

Compiler output:
Main.java:35: error: incompatible types: possible lossy conversion from int to byte
                        dfs(i,j,field);
                            ^
Main.java:52: error: bad operand types for binary operator '|'
          if(0<=x|dx[i] && x | dx[i] < N &&0<=(y | (dx[i]^1)) && (y | (dx[i]^1)) <M  &&( field[y+dx[i]^1][x | dx[i]]==crop))
                 ^
  first type:  boolean
  second type: byte
Main.java:52: error: bad operand types for binary operator '|'
          if(0<=x|dx[i] && x | dx[i] < N &&0<=(y | (dx[i]^1)) && (y | (dx[i]^1)) <M  &&( field[y+dx[i]^1][x | dx[i]]==crop))
                             ^
  first type:  byte
  second type: boolean
Main.java:53: error: incompatible types: possible lossy conversion from int to byte
              dfs(y | dx[i],x| (dx[i]^1),field);
                    ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
4 errors
Language: Java

import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
  public static int M;
  public static int N;
    public static void main(String[] args) throws java.io.IOException{
        Scanner scan = new Scanner(System.in);
        Boolean flag = true;

        while(flag){
            M = scan.nextInt();
            N = scan.nextInt();
         //   System.out.println(M);System.out.println(N);

            if(N ==0 && M ==0){break;}

            int ans =0;
            if(M==1&&N==0){System.out.println(ans);continue;}
            scan.nextLine();
            char [][] field =new char[M][N];
            for(int i=0;i<M;i++){
             String line = scan.nextLine();
                for(int j=0;j<N;j++){
                    field[i][j] = line.charAt(j);

                }
            }


            for(int i=0;i<M;i++){
                for(int j=0;j<N;j++){
                    if(field[i][j] != '.'){
                        ++ans;
                        dfs(i,j,field);

                    }
                }
            }
            System.out.println(ans);

    }


}
  public static void dfs(byte y,byte x,char [][] field){
      char crop = field[y][x];
      field[y][x] = '.';
      byte  [] dx= {1,0,-1,0};
      for(byte i=0;i<4;i++){

          if((0<=(x|dx[i])) && (x | dx[i]) < N &&0<=(y | (dx[i]^1)) && (y | (dx[i]^1)) <M  &&( field[y+(dx[i]^1)][x | dx[i]]==crop))
              dfs(y | (dx[i]^1),x| dx[i],field);
      }
      return;
  }
}

Compiler output:
Main.java:35: error: incompatible types: possible lossy conversion from int to byte
                        dfs(i,j,field);
                            ^
Main.java:53: error: incompatible types: possible lossy conversion from int to byte
              dfs(y | (dx[i]^1),x| dx[i],field);
                    ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
Language: Java

import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
  public static int M;
  public static int N;
    public static void main(String[] args) throws java.io.IOException{
        Scanner scan = new Scanner(System.in);
        Boolean flag = true;

        while(flag){
            M = scan.nextInt();
            N = scan.nextInt();
         //   System.out.println(M);System.out.println(N);

            if(N ==0 && M ==0){break;}

            int ans =0;
            if(M==1&&N==0){System.out.println(ans);continue;}
            scan.nextLine();
            char [][] field =new char[M][N];
            for(int i=0;i<M;i++){
             String line = scan.nextLine();
                for(int j=0;j<N;j++){
                    field[i][j] = line.charAt(j);

                }
            }


            for(byte i=0;i<M;i++){
                for(byte j=0;j<N;j++){
                    if(field[i][j] != '.'){
                        ++ans;
                        dfs(i,j,field);

                    }
                }
            }
            System.out.println(ans);

    }


}
  public static void dfs(byte y,byte x,char [][] field){
      char crop = field[y][x];
      field[y][x] = '.';
      byte  [] dx= {1,0,-1,0};
      for(byte i=0;i<4;i++){

          if((0<=(x|dx[i])) && (x | dx[i]) < N &&0<=(y | (dx[i]^1)) && (y | (dx[i]^1)) <M  &&( field[y+(dx[i]^1)][x | dx[i]]==crop))
              dfs(y | (dx[i]^1),x| dx[i],field);
      }
      return;
  }
}

Compiler output:
Main.java:53: error: incompatible types: possible lossy conversion from int to byte
              dfs(y | (dx[i]^1),x| dx[i],field);
                    ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: Java

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main2 {

	static int h, w;
	static int[][] field;
	static int[] v1 = { 0, 1, 0, -1 };
	static int[] v2 = { 1, 0, -1, 0 };

	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while (true) {
			h = cin.nextInt();
			w = cin.nextInt();
			if (h + w == 0) {
				break;
			}
			field = new int[h + 2][w + 2];
			for (int i = 0; i < h; i++) {
				String str = cin.next();
				for (int j = 0; j < str.length(); j++) {
					if (str.charAt(j) == '#') {
						field[i + 1][j + 1] = 1;
					} else if (str.charAt(j) == '@') {
						field[i + 1][j + 1] = 2;
					} else {
						field[i + 1][j + 1] = 3;
					}
				}
			}
			int count=0;
			for (int i = 1; i <= h; i++) {
				for (int j = 1; j <= w; j++) {
					if (field[i][j] == 0) {
						continue;
					} else {
						count++;
						Queue<Integer[]> que = new LinkedList<Integer[]>();
						Integer[] a = { i, j };
						que.add(a);
						int value = field[i][j];
						while (!que.isEmpty()) {
							Integer[] c = que.poll();
							field[c[0]][c[1]]=0;
							for(int k = 0;k<4;k++){
								int xx=c[0]+v1[k];
								int yy=c[1]+v2[k];
								if(field[xx][yy]==value){
									Integer[] d = {xx,yy};
									que.add(d);
								}
							}
						}
					}
				}
			}
			System.out.println(count);
		}

	}
}

Compiler output:
Main.java:5: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
       ^
1 error
Language: Java

import java.util.*;

public class Main {
	int h, w;
	int[][] map;
	
	public void loop(int y, int x, int d){
		map[y][x] = 0;
		if(x!=0 && map[y][x-1]==d) loop(y,x-1,d);
		if(y!=0 && map[y-1][x]==d) loop(y-1,x,d);
		if(x!=w-1 && map[y][x+1]==d) loop(y,x+1,d);
		if(y!=h-1 && map[y+1][x]==d) loop(y+1,x,d);
	}
	
	public void func(){
		int count = 0;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if(map[i][j]!=0){
					count++;
					loop(i, j, map[i][j]);
				}
			}
		}
		System.out.println(count);
	}
	
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			AOJ_0118 A = new AOJ_0118();
			A.h = sc.nextInt();
			A.w = sc.nextInt();
			if(A.h==0 && A.w==0) break;
			
			A.map = new int[A.h][A.w];
			String s = "";
			for(int i=0;i<A.h;i++){
				s = sc.next();
				for(int j=0;j<A.w;j++){
					if(s.codePointAt(j)==64) A.map[i][j] = 1;
					else if(s.codePointAt(j)==35) A.map[i][j] = 2;
					else if(s.codePointAt(j)==42) A.map[i][j] = 3;
				}
			}
			A.func();
		}
		
	}	
}

Compiler output:
Main.java:33: error: cannot find symbol
			AOJ_0118 A = new AOJ_0118();
			^
  symbol:   class AOJ_0118
  location: class Main
Main.java:33: error: cannot find symbol
			AOJ_0118 A = new AOJ_0118();
			                 ^
  symbol:   class AOJ_0118
  location: class Main
2 errors
Language: Java

import java.util.*;
public class AOJ0118{
  static Scanner sc = new Scanner(System.in);
  static char [][] map;
  static boolean [][] mapSearched;
  static int [] dx = {0, -1, 0, 1}, dy = {1, 0, -1, 0};
  static int H;
  static int W;
  static int ans;

	public static void main(String [] args){
    while(solve()){
      System.out.println(ans);
    }
	}

  static boolean solve(){
    H = sc.nextInt();
    W = sc.nextInt();
    if(H == 0 && W == 0)return false;
    readMap();
    createMapSearched();
    for(int i = 0; i < H; i++){
      for(int j = 0; j < W; j++){
        dfs(j, i, 0);
      }
    }
    return true;
  }

  static void dfs(int x, int y, int node){
    if(mapSearched[y][x] == true) return;
    mapSearched[y][x] = true;
    for(int i = 0; i < dx.length ; i++){
      if(check(x + dx[i], y + dy[i])){
        if(map[y + dy[i]][x + dx[i]] == map[y][x]){
          dfs(x + dx[i], y + dy[i], node + 1);
        }
      }
    }
    if(node == 0){
      ans++;
    }
    return;
  }

  static boolean check(int x, int y){
    if(x < 0 || W <= x || y < 0 || H <= y) return false;
    else return true;
  }

  static void readMap(){
    map = new char[H][W];
    for(int i = 0; i < H; i++){
      map[i] = sc.next().toCharArray();
    }
    return;
  }

  static void createMapSearched(){
    mapSearched = new boolean[H][W];
    for(int i = 0; i < H; i++){
      Arrays.fill(mapSearched[i], false);
    }
  }
}

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

import java.util.*;
public class Main
  static Scanner sc = new Scanner(System.in);
  static char [][] map;
  static char tmp_fruit;
  static int [] dx = {0, -1, 0, 1}, dy = {1, 0, -1, 0};
  static int H;
  static int W;
  static int ans;

  public static void main(String [] args){
    while(solve()){
      System.out.println(ans);
    }
  }

  static boolean solve(){
    H = sc.nextInt();
    W = sc.nextInt();
    if(H == 0 && W == 0)return false;
    readMap();
    for(int i = 0; i < H; i++){
      for(int j = 0; j < W; j++){
        dfs(j, i, 0);
      }
    }
    return true;
  }
  static void dfs(int x, int y, int node){
    if(map[y][x] == '.') return;
    tmp_fruit = map[y][x];
    map[y][x] = '.';
    for(int i = 0; i < dx.length ; i++){
      if(check(x + dx[i], y + dy[i])){
        if(map[y + dy[i]][x + dx[i]] == tmp_fruit){
          dfs(x + dx[i], y + dy[i], node + 1);
        }
      }
    }
    if(node == 0){
      ans++;
    }
    return;
  }

  static boolean check(int x, int y){
    if(x < 0 || W <= x || y < 0 || H <= y) return false;
    else return true;
  }

  static void readMap(){
    map = new char[H][W];
    for(int i = 0; i < H; i++){
      map[i] = sc.next().toCharArray();
    }
    return;
  }

}

Compiler output:
Main.java:2: error: '{' expected
public class Main
                 ^
Main.java:4: error: unnamed classes are a preview feature and are disabled by default.
  static char [][] map;
         ^
  (use --enable-preview to enable unnamed classes)
Main.java:59: error: class, interface, enum, or record expected
}
^
3 errors
Language: Java

import java.util.*;
public class Main
  static Scanner sc = new Scanner(System.in);
  static char [][] map;
  static char ch;
  static int tmp_x, tmp_y;
  static int [] dx = {0, -1, 0, 1}, dy = {1, 0, -1, 0};
  static int H;
  static int W;
  static int ans;

	public static void main(String [] args){
    while(solve()){
      System.out.println(ans);
    }
	}

  static boolean solve(){
    H = sc.nextInt();
    W = sc.nextInt();
    if(H == 0 && W == 0)return false;
    readMap();
    Deque <Integer> x = new ArrayDeque <Integer>();
    Deque <Integer> y = new ArrayDeque <Integer>();
    for(int i = 0; i < H; i++){
      for(int j = 0; j < W; j++){
        if(map[i][j] == '.') continue;
        x.push(j);
        y.push(i);
        while(!x.isEmpty()){
          tmp_x = x.pop();
          tmp_y = y.pop();
          ch = map[tmp_y][tmp_x];
          map[tmp_y][tmp_x] = '.';
          for(int k = 0; k < dx.length; k++){
            if(!check(tmp_x + dx[k], tmp_y + dy[k]))continue;
            if(ch == '.') continue;
            else if(ch == map[tmp_y + dy[k]][tmp_x + dx[k]]){
              x.push(tmp_x + dx[k]);
              y.push(tmp_y + dy[k]);
            }
          }
        }
        ans++;
      }
    }
    return true;
  }

  static boolean check(int x, int y){
    if(x < 0 || W <= x || y < 0 || H <= y) return false;
    else return true;
  }

  static void readMap(){
    map = new char[H][W];
    for(int i = 0; i < H; i++){
      map[i] = sc.next().toCharArray();
    }
    return;
  }
}

Compiler output:
Main.java:2: error: '{' expected
public class Main
                 ^
Main.java:4: error: unnamed classes are a preview feature and are disabled by default.
  static char [][] map;
         ^
  (use --enable-preview to enable unnamed classes)
Main.java:6: error: class, interface, enum, or record expected
  static int tmp_x, tmp_y;
         ^
Main.java:62: error: class, interface, enum, or record expected
}
^
4 errors
Language: Java

import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;
public class Main {
	public static final int vx[] = {1,0,-1,0};
	public static final int vy[] = {0,-1,0,1};
	public static int h = 0;
	public static int w = 0;
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			h = sc.nextInt();
			w = sc.nextInt();
			if (h+w==0) {
				break;
			}
			char[][] f = new char[w][h];
			for (int y=0;y<h;y++) {
				String line = sc.next();
				for(int x=0;x<w;x++) {
					f[x][y] = line.charAt(x);
				}
			}
			int ans = 0;
			for (int x=0;x<w;x++) {
				for (int y=0;y<h;y++) {
					if (f[x][y]!='.') {
						ans++;
						//BFS-------
						char tf = f[x][y];
						Queue<Pos2d> q = new ArrayDeque<Pos2d>();
						q.offer(new Pos2d(x,y));
						while(!q.isEmpty()) {
							Pos2d p = q.poll();
							if (f[p.x][p.y]==tf) {
								f[p.x][p.y]='.';
								for(int i=0;i<4;i++) {
									int nx = p.x + vx[i];
									int ny = p.y + vy[i];
									if (nx>=0 && nx<w && ny>=0 && ny<h) {
										q.offer(new Pos2d(nx,ny));
									}
								}
							}
						}
						//----------
					}
				}
			}
			System.out.println(ans);
		}
	}
}
public class Pos2d {
	public int x = 0;
	public int y = 0;
	public Pos2d(int x,int y) {
		this.x = x;
		this.y = y;
	}
	public boolean equals(Object o) {
		Pos2d p = (Pos2d) o;
		return (this.x==p.x && this.y==p.y);
	}
	public String toString() {
		return "("+x+","+y+")";
	}
}

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

#include<stdio.h>
#include<iostream>
#include<queue>
#include<map>
#include<string>
#include<algorithm>
using namespace std;

typedef long long ll;	
typedef pair<int, int> P;
const int maxn = 102;
const int inf = 0x3f3f3f3f;
char a[maxn][maxn];
int vis[maxn][maxn];
int dre[4][2] = { 0,1,1,0,0,-1,-1,0 };
int n, m;

void init()
{
	memset(vis, 0, sizeof(vis));
}

void DFS(int x, int y)
{
	vis[x][y] = 1;
	for (int i = 0; i < 4; i++)
	{
		int nx = x + dre[i][0], ny = y + dre[i][1];
		//cout << " " << nx << " " << ny << endl;
		if (nx >= 0 && nx < n&&ny >= 0 && ny < m && a[nx][ny] == a[x][y] &&!vis[nx][ny])
			DFS(nx, ny);
	}
	return;
}

int main()
{

	while (scanf("%d%d", &n, &m), m || m)
	{
		init();
		int ans = 0;
		for (int i = 0; i < n; i++)
			scanf("%s", &a[i]);
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < m; j++)
			{
				if (!vis[i][j])
				{
					DFS(i,j);
					ans++;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}



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