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

#include <stdio.h>
#include <math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
using namespace std;






int main(){
    int n,m;
    int a[20][20];
    cin>>n>>m;
    fill(&a[0][0],&a[20][20],INT_MAX/2);
    for(int i=0;i<m;i++){
        int b,c,d,e;
        scanf("%d%d%d%d",&b,&c,&d,&e);
        a[b][c]=d;
        a[c][b]=e;
    }
    int s,g,gold,p;
    scanf("%d%d%d%d",&s,&g,&gold,&p);
    for(int k=0;k<n;k++){
        for(int i=0;i<n;i++){
            for(int t=0;t<n;t++){
                if(a[i][t]>a[i][k]+a[k][t]){a[i][t]=a[i][k]+a[k][t];}
            }
        }
    }
    cout<<gold-p-a[s][g];
    
    
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:30: error: 'INT_MAX' was not declared in this scope
   24 |     fill(&a[0][0],&a[20][20],INT_MAX/2);
      |                              ^~~~~~~
a.cc:13:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   12 | #include<numeric>
  +++ |+#include <climits>
   13 | using namespace std;
Language: C++

#include <stdio.h>
#include <math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
using namespace std;






int main(){
    int n,m;
    int a[20][20];
    cin>>n>>m;
    fill(&a[0][0],&a[20][20],INT_MAX/2);
    for(int i=0;i<m;i++){
        int b,c,d,e;
        scanf("%d,%d,%d,%d",&b,&c,&d,&e);
        a[b][c]=d;
        a[c][b]=e;
    }
    int s,g,gold,p;
    scanf("%d,%d,%d,%d",&s,&g,&gold,&p);
    for(int k=0;k<n;k++){
        for(int i=0;i<n;i++){
            for(int t=0;t<n;t++){
                if(a[i][t]>a[i][k]+a[k][t]){a[i][t]=a[i][k]+a[k][t];}
            }
        }
    }
    cout<<gold-p-a[s][g];
    
    
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:30: error: 'INT_MAX' was not declared in this scope
   24 |     fill(&a[0][0],&a[20][20],INT_MAX/2);
      |                              ^~~~~~~
a.cc:13:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   12 | #include<numeric>
  +++ |+#include <climits>
   13 | using namespace std;
Language: C++

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

struct Node{
  int num;

  vector<int> edge_to;
  vector<int> edge_cost;

  bool done;
  int cost;
};

vector<string> splitAll(string s, string t) {
  vector<string> v;
  for (int p = 0; (p = s.find(t)) != s.npos; ) {
    v.push_back(s.substr(0, p));
    s = s.substr(p + t.size());
  }
  v.push_back(s);
  return v;
}

int dijkstra (vector<Node> g,int start,int goal){
  int d;
  g[start].cost=0;

  while(1){
    d=-1;

    for(int i=1;i<=g.size();i++){
      if( g[i].done || g[i].cost < 0 ) continue;
      if( d==-1 || g[i].cost < g[d].cost ) d=i;
    }

    if(d==-1) break;
    g[d].done=true;

    for(int i=0; i< g[d].edge_to.size(); i++){
      int to = g[d].edge_to[i];
      int cost = g[d].cost + g[d].edge_cost[i];
      if(g[to].cost < 0 || cost < g[to].cost)
	g[to].cost = cost;
    }
  }

  return g[goal].cost;
}


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

  vector<Node> graph;
  graph.reserve(n+1);
  graph.resize(n+1);

  for(int i=1; i<=n; i++){
    graph[i].num=(i+1);
    graph[i].cost=-1;
    graph[i].done=false;
  }

  string s;

  cin>>m;
  getline(cin,s);

  int a,b,c,d;
  vector<string> vv;
  vv.reserve(4);
  vv.resize(4);

  while(m--){
    getline(cin,s);
    vv = splitAll(s,",");

    a = atoi( vv[0].c_str() );
    b = atoi( vv[1].c_str() );
    c = atoi( vv[2].c_str() );
    d = atoi( vv[3].c_str() );

    graph[a].edge_to.push_back(b);
    graph[a].edge_cost.push_back(c);
    graph[b].edge_to.push_back(a);
    graph[b].edge_cost.push_back(d);

  }

  int x1,x2,y1,y2;
  getline(cin,s);
  vv = splitAll(s,",");

  x1 = atoi( vv[0].c_str() );
  x2 = atoi( vv[1].c_str() );
  y1 = atoi( vv[2].c_str() );
  y2 = atoi( vv[3].c_str() );

  vector<Node> n;
  n.reserve(n+1);
  n.assign(graph.begin(),graph.end());

  int rcost = dijkstra(graph,x2,x1);
  int gcost = dijkstra(n,x1,x2);

  cout<<y1-y2-rcost-gcost<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:103:16: error: conflicting declaration 'std::vector<Node> n'
  103 |   vector<Node> n;
      |                ^
a.cc:55:7: note: previous declaration as 'int n'
   55 |   int n,m;
      |       ^
a.cc:104:5: error: request for member 'reserve' in 'n', which is of non-class type 'int'
  104 |   n.reserve(n+1);
      |     ^~~~~~~
a.cc:105:5: error: request for member 'assign' in 'n', which is of non-class type 'int'
  105 |   n.assign(graph.begin(),graph.end());
      |     ^~~~~~
a.cc:108:24: error: could not convert 'n' from 'int' to 'std::vector<Node>'
  108 |   int gcost = dijkstra(n,x1,x2);
      |                        ^
      |                        |
      |                        int
Language: C++

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

int d[21][21];

int main(){
  char ch;
  int n, m;
  memset(d, -1, sizeof(d));
  int x1, x2, y1, y2;
  cin >> n >> m;
  for(int i = 0; i < m; i++){
    int a, b, c, d2;
    cin >> a >> ch >> b >> ch >> c >> ch >> d2;
    d[a][b] = c;
    d[b][a] = d2;
  }
  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++){
      if(d[j][i] < 0) continue;
      for(int k = 1; k <= n; k++){
	if(d[i][k] >= 0 && (d[j][k] < 0 || d[j][k] > d[j][i] + d[i][k])){
	  d[j][k] = d[j][i] + d[i][k];
	}
      }
    }
  }
  cin >> x1 >> ch >> x2 >> ch >> y1 >> ch >> y2;
  cout << y1 - y2 - d[x1][x2] - d[x2][x1] << endl;
  return 0;
}

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

	}

	int x1, x2, y1, y2;
	scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);

	//processing

	int lowest = wfloyd(n,x1,x2) + wfloyd(n,x2,x1),
		res = y1 - y2 - lowest;

	std::cout << wfloyd(n,x1,x2) << std::endl;
	std::cout << wfloyd(n,x2,x1) << std::endl;
	std::cout << res << std::endl;
	return 0;
}

Compiler output:
a.cc:1:9: error: expected declaration before '}' token
    1 |         }
      |         ^
a.cc:3:21: warning: built-in function 'y1' declared as non-function [-Wbuiltin-declaration-mismatch]
    3 |         int x1, x2, y1, y2;
      |                     ^~
a.cc:4:14: error: expected constructor, destructor, or type conversion before '(' token
    4 |         scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);
      |              ^
a.cc:8:29: error: 'n' was not declared in this scope
    8 |         int lowest = wfloyd(n,x1,x2) + wfloyd(n,x2,x1),
      |                             ^
a.cc:8:22: error: 'wfloyd' was not declared in this scope
    8 |         int lowest = wfloyd(n,x1,x2) + wfloyd(n,x2,x1),
      |                      ^~~~~~
a.cc:8:47: error: 'n' was not declared in this scope
    8 |         int lowest = wfloyd(n,x1,x2) + wfloyd(n,x2,x1),
      |                                               ^
a.cc:8:40: error: 'wfloyd' was not declared in this scope
    8 |         int lowest = wfloyd(n,x1,x2) + wfloyd(n,x2,x1),
      |                                        ^~~~~~
a.cc:11:14: error: 'cout' in namespace 'std' does not name a type
   11 |         std::cout << wfloyd(n,x1,x2) << std::endl;
      |              ^~~~
a.cc:1:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 |         }
a.cc:12:14: error: 'cout' in namespace 'std' does not name a type
   12 |         std::cout << wfloyd(n,x2,x1) << std::endl;
      |              ^~~~
a.cc:12:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
   12 |         std::cout << wfloyd(n,x2,x1) << std::endl;
      |         ^~~
a.cc:13:14: error: 'cout' in namespace 'std' does not name a type
   13 |         std::cout << res << std::endl;
      |              ^~~~
a.cc:13:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
   13 |         std::cout << res << std::endl;
      |         ^~~
a.cc:14:9: error: expected unqualified-id before 'return'
   14 |         return 0;
      |         ^~~~~~
a.cc:15:1: error: expected declaration before '}' token
   15 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
#define INF (1<<30)

int dist[30][30];
int main(){
	int n, m;
	cin >> n >> m;

	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i == j)dist[i][j] = 0;
			else      dist[i][j] = INF;
		}
	}

	for(int i=0;i<m;i++){
		int a, b, c, d;
		cin >> a >> b >> c >> d;

		dist[a-1][b-1] = c;
		dist[b-1][a-1] = d;
	}	


	for(int k=0;k<n;k++)for(int i=0;i<n;i++)for(int j=0;j<n;j++)
		dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);

	int x1, x2, y1, y2;
	cin >> x1 >> x2 >> y1 >> y2;

	cout << (y1 - y2 - dist[x1-1][x2-1]　- dist[x2-1][x1-1]) << endl;
	return 0;
}

Compiler output:
a.cc:32:44: error: extended character 　 is not valid in an identifier
   32 |         cout << (y1 - y2 - dist[x1-1][x2-1]　- dist[x2-1][x1-1]) << endl;
      |                                            ^
a.cc: In function 'int main()':
a.cc:32:44: error: expected ')' before '\U00003000'
   32 |         cout << (y1 - y2 - dist[x1-1][x2-1]　- dist[x2-1][x1-1]) << endl;
      |                 ~                          ^~
      |                                            )
Language: C++

#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>
#include <stack>
#include <set>
#include <vector>

using namespace std;

#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INF = 987654321;
const double EPS = 1e-10;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
    return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
    os<<'[';
    rep(i,a.size()) os<<(i?" ":"")<<a[i];
    return os<<']';
}

int G[20][20];
int dp[20][20];
int V;

void warshall_floyd() {
    rep(k, V) rep(i, V) rep(j, V) dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
}


int main() {
    int n; cin >> n;
    int m; cin >> m;
    rep(i, 20) rep(j, 20) G[i][j] = INF;
    rep(i, m) {
        int a, b, c, d; scanf("%d,%d,%d,%d", &a, &b, &c, &d);
        G[a - 1][b - 1] = c;
        G[b - 1][a - 1] = d;
    }
    int x1, x2, y1, y2; scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);

    V = n;
    rep(i, n) rep(j, n) dp[i][j] = G[i][j];
    "rep(i, n) dp[i][i] = 0;

    warshall_floyd();
    cout << y1 - dp[x1 - 1][x2 - 1] - dp[x2 - 1][x1 - 1] - y2 << endl;

    return 0;
}

Compiler output:
a.cc:77:5: warning: missing terminating " character
   77 |     "rep(i, n) dp[i][i] = 0;
      |     ^
a.cc:77:5: error: missing terminating " character
   77 |     "rep(i, n) dp[i][i] = 0;
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

using namespace std;

int main() {
	int n, m;
	int x1, x2, y1, y2;
	char dummy;

	cin >> n;
	cin >> m;

	vector<int> a(m), b(m), c(m), d(m);
	vector< vector <int> > map(n + 1, vector<int>(n + 1, INT_MAX / 4));
	
	for(int i = 0; i < m; i++) {
		cin >> a[i] >> dummy >> b[i] >> dummy >> c[i] >> dummy >> d[i];
	}
	cin >> x1 >> dummy >> x2 >> dummy >> y1 >> dummy >> y2;

	for(int i = 0; i < m; i++) {
		map[a[i]][b[i]] = c[i];
		map[b[i]][a[i]] = d[i];
	}
	for(int i = 0; i < n; i++) {
		map[i][i] = 0;
	}

	for(int k = 0; k < n + 1; k++) {
		for(int i = 0; i < n + 1; i++) {
			for(int j = 0; j < n + 1; j++) {
				map[i][j] = min(map[i][j], map[i][k] + map[k][j]);
			}
		}
	}

	y1 -= map[x1][x2] + map[x2][x1] + y2;

	cout << y1 << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:62: error: 'INT_MAX' was not declared in this scope
   17 |         vector< vector <int> > map(n + 1, vector<int>(n + 1, INT_MAX / 4));
      |                                                              ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <algorithm>
  +++ |+#include <climits>
    5 |
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new int[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next;
}
}
solve();
}
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
}

Compiler output:
Main.java:7: error: incompatible types: int[][] cannot be converted to String[][]
String[][] k=new int[H][W];
             ^
Main.java:10: error: cannot find symbol
k[i][j]=sc.next;
          ^
  symbol:   variable next
  location: variable sc of type Scanner
Main.java:13: error: non-static method solve() cannot be referenced from a static context
solve();
^
Main.java:16: error: cannot find symbol
String p=k[x][y];
         ^
  symbol:   variable k
  location: class Main
Main.java:17: error: cannot find symbol
k[x][y]=".";
^
  symbol:   variable k
  location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
              ^
  symbol:   variable k
  location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
                                                       ^
  symbol:   variable H
  location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
                                                                              ^
  symbol:   variable W
  location: class Main
Main.java:29: error: cannot find symbol
for(int i=0;i<H;i++){
              ^
  symbol:   variable H
  location: class Main
Main.java:30: error: cannot find symbol
for(int j=0;j<W;j++){
              ^
  symbol:   variable W
  location: class Main
10 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
public int H=sc.nextInt();
public int W=sc.nextInt();
public String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next;
}
}
solve();
}
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
public void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
}

Compiler output:
Main.java:5: error: illegal start of expression
public int H=sc.nextInt();
^
Main.java:8: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:8: error: > or ',' expected
for(int i=0;i<H;i++){
               ^
Main.java:8: error: <identifier> expected
for(int i=0;i<H;i++){
                 ^
Main.java:13: error: invalid method declaration; return type required
solve();
^
Main.java:15: error: unnamed classes are a preview feature and are disabled by default.
void kukaku(int x,int y){
^
  (use --enable-preview to enable unnamed classes)
Main.java:37: error: class, interface, enum, or record expected
}
^
7 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next;
}
}
solve();
}
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
public void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
}

Compiler output:
Main.java:10: error: cannot find symbol
k[i][j]=sc.next;
          ^
  symbol:   variable next
  location: variable sc of type Scanner
Main.java:13: error: non-static method solve() cannot be referenced from a static context
solve();
^
Main.java:16: error: cannot find symbol
String p=k[x][y];
         ^
  symbol:   variable k
  location: class Main
Main.java:17: error: cannot find symbol
k[x][y]=".";
^
  symbol:   variable k
  location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
              ^
  symbol:   variable k
  location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
                                                       ^
  symbol:   variable H
  location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
                                                                              ^
  symbol:   variable W
  location: class Main
Main.java:29: error: cannot find symbol
for(int i=0;i<H;i++){
              ^
  symbol:   variable H
  location: class Main
Main.java:30: error: cannot find symbol
for(int j=0;j<W;j++){
              ^
  symbol:   variable W
  location: class Main
9 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next;
}
}
solve();
}
void kukaku(int x,int y){
String p=this.k[x][y];
this.k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==this.k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<this.H&&y+dy[i]>=0&&y+dy[i]<this.W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
public void solve(){
int num=0;
for(int i=0;i<this.H;i++){
for(int j=0;j<this.W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
}

Compiler output:
Main.java:10: error: cannot find symbol
k[i][j]=sc.next;
          ^
  symbol:   variable next
  location: variable sc of type Scanner
Main.java:13: error: non-static method solve() cannot be referenced from a static context
solve();
^
Main.java:16: error: cannot find symbol
String p=this.k[x][y];
             ^
  symbol: variable k
Main.java:17: error: cannot find symbol
this.k[x][y]=".";
    ^
  symbol: variable k
Main.java:21: error: cannot find symbol
if(p!="."&&p==this.k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<this.H&&y+dy[i]>=0&&y+dy[i]<this.W){
                  ^
  symbol: variable k
Main.java:21: error: cannot find symbol
if(p!="."&&p==this.k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<this.H&&y+dy[i]>=0&&y+dy[i]<this.W){
                                                                ^
  symbol: variable H
Main.java:21: error: cannot find symbol
if(p!="."&&p==this.k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<this.H&&y+dy[i]>=0&&y+dy[i]<this.W){
                                                                                            ^
  symbol: variable W
Main.java:29: error: cannot find symbol
for(int i=0;i<this.H;i++){
                  ^
  symbol: variable H
Main.java:30: error: cannot find symbol
for(int j=0;j<this.W;j++){
                  ^
  symbol: variable W
9 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next;
}
}
solve();
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
public void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
}
}

Compiler output:
Main.java:14: error: illegal start of expression
void kukaku(int x,int y){
^
Main.java:14: error: ';' expected
void kukaku(int x,int y){
           ^
Main.java:14: error: <identifier> expected
void kukaku(int x,int y){
                  ^
Main.java:14: error: ';' expected
void kukaku(int x,int y){
                       ^
Main.java:26: error: illegal start of expression
public void solve(){
^
Main.java:37: error: class, interface, enum, or record expected
}
^
6 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next;
}
}
solve();
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
}
}

Compiler output:
Main.java:14: error: illegal start of expression
void kukaku(int x,int y){
^
Main.java:14: error: ';' expected
void kukaku(int x,int y){
           ^
Main.java:14: error: <identifier> expected
void kukaku(int x,int y){
                  ^
Main.java:14: error: ';' expected
void kukaku(int x,int y){
                       ^
Main.java:26: error: illegal start of expression
void solve(){
^
Main.java:26: error: ';' expected
void solve(){
          ^
6 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
solve();
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
}
}

Compiler output:
Main.java:14: error: illegal start of expression
void kukaku(int x,int y){
^
Main.java:14: error: ';' expected
void kukaku(int x,int y){
           ^
Main.java:14: error: <identifier> expected
void kukaku(int x,int y){
                  ^
Main.java:14: error: ';' expected
void kukaku(int x,int y){
                       ^
Main.java:26: error: illegal start of expression
void solve(){
^
Main.java:26: error: ';' expected
void solve(){
          ^
6 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
protected int H=sc.nextInt();
protected int W=sc.nextInt();
protected String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
solve();
}
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
}

Compiler output:
Main.java:5: error: illegal start of expression
protected int H=sc.nextInt();
^
Main.java:8: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:8: error: > or ',' expected
for(int i=0;i<H;i++){
               ^
Main.java:8: error: <identifier> expected
for(int i=0;i<H;i++){
                 ^
Main.java:13: error: invalid method declaration; return type required
solve();
^
Main.java:15: error: unnamed classes are a preview feature and are disabled by default.
void kukaku(int x,int y){
^
  (use --enable-preview to enable unnamed classes)
Main.java:37: error: class, interface, enum, or record expected
}
^
7 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
protected int H=sc.nextInt();
protected int W=sc.nextInt();
protected String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
solve();
}
public static void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
public static void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
}

Compiler output:
Main.java:5: error: illegal start of expression
protected int H=sc.nextInt();
^
Main.java:8: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:8: error: > or ',' expected
for(int i=0;i<H;i++){
               ^
Main.java:8: error: <identifier> expected
for(int i=0;i<H;i++){
                 ^
Main.java:13: error: invalid method declaration; return type required
solve();
^
Main.java:15: error: unnamed classes are a preview feature and are disabled by default.
public static void kukaku(int x,int y){
              ^
  (use --enable-preview to enable unnamed classes)
Main.java:37: error: class, interface, enum, or record expected
}
^
7 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
solve();
}
public static void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
public static void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
}

Compiler output:
Main.java:16: error: cannot find symbol
String p=k[x][y];
         ^
  symbol:   variable k
  location: class Main
Main.java:17: error: cannot find symbol
k[x][y]=".";
^
  symbol:   variable k
  location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
              ^
  symbol:   variable k
  location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
                                                       ^
  symbol:   variable H
  location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
                                                                              ^
  symbol:   variable W
  location: class Main
Main.java:29: error: cannot find symbol
for(int i=0;i<H;i++){
              ^
  symbol:   variable H
  location: class Main
Main.java:30: error: cannot find symbol
for(int j=0;j<W;j++){
              ^
  symbol:   variable W
  location: class Main
7 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j,H,W);
num++;
}
}
System.out.println(num);
public static void kukaku(int x,int y,int h,int w){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
kukaku(x+dx[i],y+dy[i],h,w);
}
}
return;
}
}

Compiler output:
Main.java:21: error: illegal start of expression
public static void kukaku(int x,int y,int h,int w){
^
1 error
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j,H,W);
num++;
}
}
System.out.println(num);
void kukaku(int x,int y,int h,int w){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
kukaku(x+dx[i],y+dy[i],h,w);
}
}
return;
}
}
}

Compiler output:
Main.java:21: error: illegal start of expression
void kukaku(int x,int y,int h,int w){
^
Main.java:21: error: ';' expected
void kukaku(int x,int y,int h,int w){
           ^
Main.java:21: error: <identifier> expected
void kukaku(int x,int y,int h,int w){
                  ^
Main.java:21: error: <identifier> expected
void kukaku(int x,int y,int h,int w){
                        ^
Main.java:21: error: <identifier> expected
void kukaku(int x,int y,int h,int w){
                              ^
Main.java:21: error: ';' expected
void kukaku(int x,int y,int h,int w){
                                   ^
6 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j,H,W);
num++;
}
}
System.out.println(num);
void kukaku(int x,int y,int h,int w){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
kukaku(x+dx[i],y+dy[i],h,w);
}
}
}
}
}

Compiler output:
Main.java:21: error: illegal start of expression
void kukaku(int x,int y,int h,int w){
^
Main.java:21: error: ';' expected
void kukaku(int x,int y,int h,int w){
           ^
Main.java:21: error: <identifier> expected
void kukaku(int x,int y,int h,int w){
                  ^
Main.java:21: error: <identifier> expected
void kukaku(int x,int y,int h,int w){
                        ^
Main.java:21: error: <identifier> expected
void kukaku(int x,int y,int h,int w){
                              ^
Main.java:21: error: ';' expected
void kukaku(int x,int y,int h,int w){
                                   ^
6 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j,H,W);
num++;
}
}
System.out.println(num);
}
void kukaku(int x,int y,int h,int w){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
kukaku(x+dx[i],y+dy[i],h,w);
}
}
}

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

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j,H,W);
num++;
}
}
System.out.println(num);
}
void kukaku(int x,int y,int h,int w){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
kukaku(x+dx[i],y+dy[i],h,w);
}
}
}
}

Compiler output:
Main.java:16: error: non-static method kukaku(int,int,int,int) cannot be referenced from a static context
kukaku(i,j,H,W);
^
Main.java:23: error: cannot find symbol
String p=k[x][y];
         ^
  symbol:   variable k
  location: class Main
Main.java:24: error: cannot find symbol
k[x][y]=".";
^
  symbol:   variable k
  location: class Main
Main.java:28: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
              ^
  symbol:   variable k
  location: class Main
4 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j,H,W);
num++;
}
}
System.out.println(num);
}
public static void kukaku(int x,int y,int h,int w){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
kukaku(x+dx[i],y+dy[i],h,w);
}
}
}
}

Compiler output:
Main.java:23: error: cannot find symbol
String p=k[x][y];
         ^
  symbol:   variable k
  location: class Main
Main.java:24: error: cannot find symbol
k[x][y]=".";
^
  symbol:   variable k
  location: class Main
Main.java:28: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
              ^
  symbol:   variable k
  location: class Main
3 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
public String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j,H,W);
num++;
}
}
System.out.println(num);
}
public static void kukaku(int x,int y,int h,int w){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
kukaku(x+dx[i],y+dy[i],h,w);
}
}
}
}

Compiler output:
Main.java:7: error: illegal start of expression
public String[][] k=new String[H][W];
^
Main.java:8: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:8: error: > or ',' expected
for(int i=0;i<H;i++){
               ^
Main.java:8: error: <identifier> expected
for(int i=0;i<H;i++){
                 ^
Main.java:14: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:14: error: > or ',' expected
for(int i=0;i<H;i++){
               ^
Main.java:14: error: <identifier> expected
for(int i=0;i<H;i++){
                 ^
Main.java:20: error: <identifier> expected
System.out.println(num);
                  ^
Main.java:20: error: <identifier> expected
System.out.println(num);
                      ^
Main.java:22: error: unnamed classes are a preview feature and are disabled by default.
public static void kukaku(int x,int y,int h,int w){
              ^
  (use --enable-preview to enable unnamed classes)
Main.java:33: error: class, interface, enum, or record expected
}
^
11 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(k,i,j,H,W);
num++;
}
}
System.out.println(num);
}
public static void kukaku(String[] k,int I,int J,int h,int w){
String p=k[I][J];
k[I][J]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[I+dx[i]][J+dy[i]]&&i+dx[i]>=0&&I+dx[i]<h&&J+dy[i]>=0&&J+dy[i]<w){
kukaku(k,I+dx[i],J+dy[i],h,w);
}
}
}
}

Compiler output:
Main.java:16: error: incompatible types: String[][] cannot be converted to String[]
kukaku(k,i,j,H,W);
       ^
Main.java:23: error: array required, but String found
String p=k[I][J];
             ^
Main.java:24: error: array required, but String found
k[I][J]=".";
    ^
Main.java:28: error: array required, but String found
if(p!="."&&p==k[I+dx[i]][J+dy[i]]&&i+dx[i]>=0&&I+dx[i]<h&&J+dy[i]>=0&&J+dy[i]<w){
                        ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
4 errors
Language: Java

import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(k,i,j,H,W);
num++;
}
}
System.out.println(num);
}
public static void kukaku(String k[],int I,int J,int h,int w){
String p=k[I][J];
k[I][J]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[I+dx[i]][J+dy[i]]&&i+dx[i]>=0&&I+dx[i]<h&&J+dy[i]>=0&&J+dy[i]<w){
kukaku(k,I+dx[i],J+dy[i],h,w);
}
}
}
}

Compiler output:
Main.java:16: error: incompatible types: String[][] cannot be converted to String[]
kukaku(k,i,j,H,W);
       ^
Main.java:23: error: array required, but String found
String p=k[I][J];
             ^
Main.java:24: error: array required, but String found
k[I][J]=".";
    ^
Main.java:28: error: array required, but String found
if(p!="."&&p==k[I+dx[i]][J+dy[i]]&&i+dx[i]>=0&&I+dx[i]<h&&J+dy[i]>=0&&J+dy[i]<w){
                        ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
4 errors
Language: Java

import java.util.*;

public class Main{

Scanner sc=new Scanner(System.in);

int H=sc.nextInt();

int W=sc.nextInt();

String[][] k=new String[H][W];


for(int i=0;i<H;i++){

for(int j=0;j<W;j++){

k[i][j]=sc.next();

}

}

public static void main(String[] args){

int num=0;

for(int i=0;i<H;i++){

for(int j=0;j<W;j++){

if(k[i][j]!="."){

kukaku(k,i,j,H,W);

num++;

}

}

}

System.out.println(num);

}

public static void kukaku(int I,int J){

String p=k[I][J];

k[I][J]=".";

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

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

for(int i=0;i<4;i++){

if(p==k[I+dx[i]][J+dy[i]]&&I+dx[i]>=0&&I+dx[i]<H&&J+dy[i]>=0&&J+dy[i]<W){

kukaku(I+dx[i],J+dy[i]);

}

return;

}

}

}

Compiler output:
Main.java:14: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:14: error: > or ',' expected
for(int i=0;i<H;i++){
               ^
Main.java:14: error: <identifier> expected
for(int i=0;i<H;i++){
                 ^
3 errors
Language: Java

import java.util.*;

public class Main{

Scanner sc=new Scanner(System.in);

int H=sc.nextInt();

int W=sc.nextInt();

String[][] k=new String[H][W];

for(int i=0;i<H;i++){

for(int j=0;j<W;j++){

k[i][j]=sc.next();

}

}

public static void main(String[] args){

int num=0;

for(int i=0;i<H;i++){

for(int j=0;j<W;j++){

if(k[i][j]!="."){

kukaku(k,i,j,H,W);

num++;

}

}

}

System.out.println(num);

}

public static void kukaku(int I,int J){

String p=k[I][J];

k[I][J]=".";

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

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

for(int i=0;i<4;i++){

if(p==k[I+dx[i]][J+dy[i]]&&I+dx[i]>=0&&I+dx[i]<H&&J+dy[i]>=0&&J+dy[i]<W){

kukaku(I+dx[i],J+dy[i]);

}

return;

}

}

}

Compiler output:
Main.java:13: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:13: error: > or ',' expected
for(int i=0;i<H;i++){
               ^
Main.java:13: error: <identifier> expected
for(int i=0;i<H;i++){
                 ^
3 errors
Language: Java

import java.util.*;

public class Main{

Scanner sc=new Scanner(System.in);

int H=sc.nextInt();

int W=sc.nextInt();

String[][] k=new String[H][W];

for(int i=0;i<H;i++){

for(int j=0;j<W;j++){

k[i][j]=sc.next();

}

}

public static void main(String[] args){

int num=0;

for(int i=0;i<H;i++){

for(int j=0;j<W;j++){

if(k[i][j]!="."){

kukaku(k,i,j,H,W);

num++;

}

}

}

System.out.println(num);

}

public static void kukaku(int I,int J){

String p=k[I][J];

k[I][J]=".";

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

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

for(int i=0;i<4;i++){

if(p==k[I+dx[i]][J+dy[i]]&&I+dx[i]>=0&&I+dx[i]<H&&J+dy[i]>=0&&J+dy[i]<W){

kukaku(I+dx[i],J+dy[i]);

}

}

return;

}

}

}

Compiler output:
Main.java:13: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:13: error: > or ',' expected
for(int i=0;i<H;i++){
               ^
Main.java:13: error: <identifier> expected
for(int i=0;i<H;i++){
                 ^
Main.java:73: error: class, interface, enum, or record expected
}
^
4 errors
Language: Java

import java.util.*;

public class Main{

Scanner sc=new Scanner(System.in);

int H=sc.nextInt();

int W=sc.nextInt();

String[][] k=new String[H][W];

for(int i=0;i<H;i++){

for(int j=0;j<W;j++){

k[i][j]=sc.next();

}

}

public static void main(String[] args){

int num=0;

for(int i=0;i<H;i++){

for(int j=0;j<W;j++){

if(k[i][j]!="."){

kukaku(i,j);

num++;

}

}

}

System.out.println(num);

}

public static void kukaku(int I,int J){

String p=k[I][J];

k[I][J]=".";

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

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

for(int i=0;i<4;i++){

if(p==k[I+dx[i]][J+dy[i]]&&I+dx[i]>=0&&I+dx[i]<H&&J+dy[i]>=0&&J+dy[i]<W){

kukaku(I+dx[i],J+dy[i]);

}

}

return;

}

}

}

Compiler output:
Main.java:13: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:13: error: > or ',' expected
for(int i=0;i<H;i++){
               ^
Main.java:13: error: <identifier> expected
for(int i=0;i<H;i++){
                 ^
Main.java:73: error: class, interface, enum, or record expected
}
^
4 errors
Language: Java

import java.util.*;

public class Main{

Scanner sc=new Scanner(System.in);

int H=sc.nextInt();

int W=sc.nextInt();

String[][] k=new String[H][W];

for(int i=0;i<H;i++){

for(int j=0;j<W;j++){

k[i][j]=sc.next();

}

}

public static void main(String[] args){

int num=0;

for(int i=0;i<H;i++){

for(int j=0;j<W;j++){

if(k[i][j]!="."){

kukaku(i,j);

num++;

}

}

}

System.out.println(num);

}

public static void kukaku(int I,int J){

String p=k[I][J];

k[I][J]=".";

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

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

for(int i=0;i<4;i++){

if(p==k[I+dx[i]][J+dy[i]]&&I+dx[i]>=0&&I+dx[i]<H&&J+dy[i]>=0&&J+dy[i]<W){

kukaku(I+dx[i],J+dy[i]);

}

}

return;

}

}

Compiler output:
Main.java:13: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:13: error: > or ',' expected
for(int i=0;i<H;i++){
               ^
Main.java:13: error: <identifier> expected
for(int i=0;i<H;i++){
                 ^
3 errors
Language: Java

import java.util.*;

public class Main{

Scanner sc=new Scanner(System.in);

int H=sc.nextInt();

int W=sc.nextInt();

String[][] k=new String[H][W];

for(int i=0;i<H;i++){

for(int j=0;j<W;j++){

k[i][j]=sc.next();

}

}

public static void main(String[] args){

int num=0;

for(int i=0;i<H;i++){

for(int j=0;j<W;j++){

if(k[i][j]!="."){

kukaku(k,i,j,H,W);

num++;

}

}

}

System.out.println(num);

}

public static void kukaku(int I,int J){

String p=k[I][J];

k[I][J]=".";

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

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

for(int i=0;i<4;i++){

if(p==k[I+dx[i]][J+dy[i]]&&I+dx[i]>=0&&I+dx[i]<H&&J+dy[i]>=0&&J+dy[i]<W){

kukaku(I+dx[i],J+dy[i]);

}

}

return;

}

}

Compiler output:
Main.java:13: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:13: error: > or ',' expected
for(int i=0;i<H;i++){
               ^
Main.java:13: error: <identifier> expected
for(int i=0;i<H;i++){
                 ^
3 errors
Language: Java

import java.util.*;

public class Main{

Scanner sc=new Scanner(System.in);

int H=sc.nextInt();

int W=sc.nextInt();

String[][] k=new String[H][W];

for(int i=0;i<H;i++){

for(int j=0;j<W;j++){

k[i][j]=sc.next();

}

}

public static void main(String[] args){

int num=0;

for(int i=0;i<H;i++){

for(int j=0;j<W;j++){

if(k[i][j]!="."){

dfs(k,i,j,H,W);

num++;

}

}

}

System.out.println(num);

}

public static void dfs(int I,int J){

String p=k[I][J];

k[I][J]=".";

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

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

for(int i=0;i<4;i++){

if(p==k[I+dx[i]][J+dy[i]]&&I+dx[i]>=0&&I+dx[i]<H&&J+dy[i]>=0&&J+dy[i]<W){

dfs(I+dx[i],J+dy[i]);

}

}

return;

}

}

Compiler output:
Main.java:13: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:13: error: > or ',' expected
for(int i=0;i<H;i++){
               ^
Main.java:13: error: <identifier> expected
for(int i=0;i<H;i++){
                 ^
3 errors
Language: Java

import java.util.*;

public class Main{

Scanner sc=new Scanner(System.in);

int H=sc.nextInt();

int W=sc.nextInt();

String[][] k=new String[H][W];

for(int i=0;i< H;i++){

for(int j=0;j<W;j++){

k[i][j]=sc.next();

}

}

public static void main(String[] args){

int num=0;

for(int i=0;i<H;i++){

for(int j=0;j<W;j++){

if(k[i][j]!="."){

dfs(k,i,j,H,W);

num++;

}

}

}

System.out.println(num);

}

public static void dfs(int I,int J){

String p=k[I][J];

k[I][J]=".";

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

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

for(int i=0;i<4;i++){

if(p==k[I+dx[i]][J+dy[i]]&&I+dx[i]>=0&&I+dx[i]<H&&J+dy[i]>=0&&J+dy[i]<W){

dfs(I+dx[i],J+dy[i]);

}

}

return;

}

}

Compiler output:
Main.java:13: error: illegal start of type
for(int i=0;i< H;i++){
^
Main.java:13: error: > or ',' expected
for(int i=0;i< H;i++){
                ^
Main.java:13: error: <identifier> expected
for(int i=0;i< H;i++){
                  ^
3 errors
Language: Java

import java.util.*;

public class Main{

Scanner sc=new Scanner(System.in);

int H=sc.nextInt();

int W=sc.nextInt();

String[][] k=new String[H][W];

for(int i=0; i<=H-1; i++){

for(int j=0; j<=W-1; j++){

k[i][j]=sc.next();

}

}

public static void main(String[] args){

int num=0;

for(int i=0; i<=H-1; i++){

for(int j=0; j<=W-1; j++){

if(k[i][j]!="."){

dfs(k,i,j,H,W);

num++;

}

}

}

System.out.println(num);

}

public static void dfs(int I,int J){

String p=k[I][J];

k[I][J]=".";

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

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

for(int i=0;i<=3;i++){

if(p==k[I+dx[i]][J+dy[i]]&&I+dx[i]>=0&&I+dx[i]<H&&J+dy[i]>=0&&J+dy[i]<W){

dfs(I+dx[i],J+dy[i]);

}

}

return;

}

}

Compiler output:
Main.java:13: error: illegal start of type
for(int i=0; i<=H-1; i++){
^
Main.java:13: error: <identifier> expected
for(int i=0; i<=H-1; i++){
              ^
Main.java:13: error: <identifier> expected
for(int i=0; i<=H-1; i++){
                 ^
Main.java:13: error: <identifier> expected
for(int i=0; i<=H-1; i++){
                      ^
4 errors
Language: Java

import java.util.*;

public class Main{

Scanner sc=new Scanner(System.in);

int H=sc.nextInt();

int W=sc.nextInt();

String[][] k=new String[H][W];

for(int i=0; i< H; i++){

for(int j=0; j< W; j++){

k[i][j]=sc.next();

}

}

public static void main(String[] args){

int num=0;

for(int i=0; i<H; i++){

for(int j=0; j<W; j++){

if(k[i][j]!="."){

dfs(k,i,j,H,W);

num++;

}

}

}

System.out.println(num);

}

public static void dfs(int I,int J){

String p=k[I][J];

k[I][J]=".";

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

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

for(int i=0;i<4;i++){

if(p==k[I+dx[i]][J+dy[i]]&&I+dx[i]>=0&&I+dx[i]<H&&J+dy[i]>=0&&J+dy[i]<W){

dfs(I+dx[i],J+dy[i]);

}

}

return;

}

}

Compiler output:
Main.java:13: error: illegal start of type
for(int i=0; i< H; i++){
^
Main.java:13: error: > or ',' expected
for(int i=0; i< H; i++){
                 ^
Main.java:13: error: <identifier> expected
for(int i=0; i< H; i++){
                    ^
3 errors