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

#include<cstdio>
#include<iostream>
#include<cmath>
#include<map>
#include<queue>

using namespace std;
#define N 4
#define N2 16

static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];

struct Puzzle {
  int f[N2], space, MD;
  int cost;

  bool operator < ( const Puzzle &p ) const {
    for ( int i = 0; i < N2; i++ ) {
      if ( f[i] == p.f[i] ) continue;
      return f[i] < p.f[i];
    }
    return false;
  }
};

struct State {
  Puzzle puzzle;
  int estimated;
  bool operator < (const State &s) const {
    return estimated > s.estimated;
  }
};

int getAllMD(Puzzle pz) {
  int sum = 0;
  for ( int i = 0; i < N2; i++ ) {
    if ( pz.f[i] == N2 ) continue;
    sum += MDT[i][pz.f[i] - 1];
  }
  return sum;
}

int astar(Puzzle s) {
  priority_queue<State> PQ;
  s.MD = getAllMD(s);
  s.cost = 0;
  map<Puzzle, bool> V;
  Puzzle u, v;
  State initial;
  initial.puzzle = s;
  initial.estimated = getAllMD(s);
  PQ.push(initial);

  while ( !PQ.empty() ) {
    State st = PQ.top(); PQ.pop();
    u = st.puzzle;

    if ( u.MD == 0 ) return u.cost;
    V[u] = true;

    int sx = u.space / N;
    int sy = u.space % N;

    for ( int r = 0; r < 4; r++ ) {
      int tx = sx + dx[r];
      int ty = sy + dy[r];
      if ( tx < 0 || ty < 0 || tx >= N || ty >= N ) continue;
      v = u;

      v.MD -= MDT[tx * N + ty][v.f[tx * N + ty] - 1];
      v.MD += MDT[sx * N + sy][v.f[tx * N + ty] - 1];

      swap(v.f[sx * N + sy], v.f[tx * N + ty]);
      v.space = tx * N + ty;
      if ( !V[v] ) {
        v.cost++;
        State news;
        news.puzzle = v;
        news.estimated = v.cost + v.MD;
        PQ.push(news);
      }
    }
  }
  return -1;
}

int main() {
  for ( int i = 0; i < N2; i++ )
    for ( int j = 0; i < N2; j++ )
      MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N);

  Puzzle in;

  for ( int i = 0; i < N2; i++ ) {
    cin >> in.f[i];
    if ( in.f[i] == 0 ) {
      in.f[i] = N2;
      in.space = i;
    }
  }
  cout << aster(in) << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:104:11: error: 'aster' was not declared in this scope; did you mean 'astar'?
  104 |   cout << aster(in) << endl;
      |           ^~~~~
      |           astar
Language: C++

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

const int N = 4;
const int N2 = 16;
const int LIMIT = 45;
const int mx[4] = {0,-1,0,1};
const int my[4] = {-1,0,1,0};

struct Puzzle {
    int p[N2], h, d;
};

Puzzle ans;
int limit, md[N2][N2];

bool visit(Puzzle a,int prev) {
    if(a.h==0) {
        ans = a;
        return true;
    }
    if(a.d + a.h > limit) return false;
    int blank; Puzzle b;
    for(int i=0; i<N2; i++) {
        if(a.p[i]==N2) blank=i;
    }
    int bx = blank%N, by = blank/N;

    for(int i=0; i<4; i++) {
        int x=bx+mx[i],y=by+my[i];
        if(x<0 || x>=N || y<0 || y>=N) continue;
        if(abs(prev-i) == 2) continue;
        b = a;
        b.h += md[blank][b.p[blank] - md[y*N+x][b.p[y*N+x]-1];
        swap(b.p[blank],b.p[y*N+x]);
        b.d++;
        if(visit(b,i)) return true;
    }
    return false;
}

void IDA(Puzzle init) {
    for(int i=0; i<N2; i++)
        if(init.p[i]!=N2) init.h+=md[i][init.p[i]-1];
    for(limit=init.h; limit <= LIMIT; limit++) {
        if(visit(init,10)) break;
    }
}

int main() {
    Puzzle init;
    init.h = init.d = 0;
    for(int i=0; i<N2; i++)
        for(int j=0; j<N2; j++)
            md[i][j] = abs(i/N-j/N)+abs(i%N-j%N);

    for(int i=0; i<N2; i++) {
        cin >> init.p[i];
        if(init.p[i]==0) init.p[i] = N2;
    }
    IDA(init);
    cout << ans.d << endl;
    return 0;
}



Compiler output:
a.cc: In function 'bool visit(Puzzle, int)':
a.cc:35:62: error: expected ']' before ';' token
   35 |         b.h += md[blank][b.p[blank] - md[y*N+x][b.p[y*N+x]-1];
      |                                                              ^
      |                                                              ]
Language: C++

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

using namespace std;
#define N 4
#define N2 16
#define LIMIT 100
 
static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = { 'r', 'u', 'l', 'd'};
int MDT[N2][N2];
 
struct P{int f[N2], space, MD;};
 
P state;
int limit;
int path[LIMIT];
 
int get(P pz){
  int sum = 0;
  for(int i = 0 ; i < N2 ; i++){
    if(pz.f[i] == N2) continue;
    sum += MDT[i][pz.f[i] - 1];
  }
  return sum;
}

string ku(P in){
  in.MD = get(in);
 
  for(limit = in.MD ; limit <= LIMIT ; limit++){
    state = in;
    if(dfs(0, -100)){
      string ans = "";
      for(int i = 0 ; i < limit ; i++) ans += dir[path[i]];
      return ans;
    }
  }
 
  return "";
}
 
bool dfs(int depth, int prev){
  if(state.MD == 0) return true;
  if(depth + state.MD > limit) return false;
 
  int sx = state.space / N;
  int sy = state.space % N;
  P tmp;
 
  for(int r = 0 ; r < 4 ; r++){
    int tx = sx + dx[r];
    int ty = sy + dy[r];
    if(tx < 0 || ty < 0 || tx >= N || ty >= N) continue;
    if(max(prev, r)-min(prev, r) == 2) continue;
    tmp = state;
    state.MD -= MDT[tx * N + ty][state.f[tx * N + ty] - 1];
    state.MD += MDT[sx * N + sy][state.f[tx * N + ty] - 1];
    swap(state.f[tx * N + ty], state.f[sx * N + sy]);
    state.space = tx * N + ty;
    if(dfs(depth + 1, r)) {path[depth] = r; return true;}
    state = tmp;
  }
 
  return false;
}
 

 
int main(){
  for(int i = 0 ; i < N2 ; i++)
    for(int j = 0 ; j < N2 ; j++)
      MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N);
 
  P in;
 
  for(int i = 0 ; i < N2 ; i++){
    cin >> in.f[i];
    if(in.f[i] == 0){
      in.f[i] = N2;
      in.space = i;
    }
  }
  string ans = ku(in);
  cout << ans.size() << endl;
 
  return 0;
}


Compiler output:
a.cc: In function 'std::string ku(P)':
a.cc:37:8: error: 'dfs' was not declared in this scope
   37 |     if(dfs(0, -100)){
      |        ^~~
Language: C++


#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>

using namespace std;

#define N 4
#define N2 16
#define LIMIT 100

static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];

struct Puzzle {
  int f[N2];
  int space;
  int MD;
};

Puzzle state;
int limit;
int path[LIMIT];

int getAllMD(Puzzle pz) {
  int sum = 0;
  for (int i = 0; i < N2; i++) {
    if (pz.f[i] == N2) {
      continue;
    }
    sum += MDT[i][pz.f[i] - 1];
  }
  return sum;
}

bool isSolved() {
  for (int i = 0; i < N2; i++) {
    if (state.f[i] != i + 1) {
      return false;
    }
  }
  return true;
}

bool dfs(int depth, int prev) {
  if (state.MD == 0) {
    return true;
  }
  if (depth + state.MD > limit) {
    return false;
  }

  int sx = state.space / N;
  int sy = state.space % N;
  Puzzle tmp;

  for (int r = 0; r < 4; r++) {
    int tx = sx + dx[r];
    int ty = sy + dy[r];
    if (tx < 0 || ty < 0 || tx >= N || ty >= N) {
      continue;
    }
    if (max(prev, r) - min(prev, r) == 2) {
      continue;
    }
    tmp = state;
    state.MD -= MDT[tx * N + ty][state.f[tx * N + ty] - 1];
    state.MD += MDT[sx * N + sy][state.f[tx * N + ty] - 1];
    swap(state.f[tx * N + ty], state.f[sx * N + sy]);
    sate.space = tx * N + ty;
    if (dfs(depth + 1, r)) {
      path[depth] = r;
      return true;
    }
    state = tmp;
  }
  return false;
}

string iterative_deepening(Puzzle in) {
  in.MD = getAllMD(in);

  for (limit = in.MD; limit <= LIMIT; limit++) {
    sate = in;
    if (dfs(0, -100)) {
      string ans = "";
      for (int i = 0; i < limit; i++) {
        ans += dir[path[i]];
        return ans;
      }
    }
  }
  return "unsolvable";
}

int main(){
  for (int i = 0; i < N2; i++) {
    for (int j = 0; j < N2; j++) {
      MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N)
    }
  }

  Puzzle in;

  for (int i = 0; i < N2; i++) {
    cin >> in.f[i];
    if (in.f[i] == 0) {
      in.f[i] = N2;
      in.space = i;
    }
  }
  string ans = iterative_deepening(in);
  cout << and.size() << endl;

  return 0;
}




Compiler output:
a.cc: In function 'bool dfs(int, int)':
a.cc:74:5: error: 'sate' was not declared in this scope; did you mean 'state'?
   74 |     sate.space = tx * N + ty;
      |     ^~~~
      |     state
a.cc: In function 'std::string iterative_deepening(Puzzle)':
a.cc:88:5: error: 'sate' was not declared in this scope; did you mean 'state'?
   88 |     sate = in;
      |     ^~~~
      |     state
a.cc: In function 'int main()':
a.cc:103:58: error: expected ';' before '}' token
  103 |       MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N)
      |                                                          ^
      |                                                          ;
  104 |     }
      |     ~                                                     
a.cc:117:14: error: expected identifier before '.' token
  117 |   cout << and.size() << endl;
      |              ^
Language: C++


#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>

using namespace std;

#define N 4
#define N2 16
#define LIMIT 100

static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];

struct Puzzle {
  int f[N2];
  int space;
  int MD;
};

Puzzle state;
int limit;
int path[LIMIT];

int getAllMD(Puzzle pz) {
  int sum = 0;
  for (int i = 0; i < N2; i++) {
    if (pz.f[i] == N2) {
      continue;
    }
    sum += MDT[i][pz.f[i] - 1];
  }
  return sum;
}

bool isSolved() {
  for (int i = 0; i < N2; i++) {
    if (state.f[i] != i + 1) {
      return false;
    }
  }
  return true;
}

bool dfs(int depth, int prev) {
  if (state.MD == 0) {
    return true;
  }
  if (depth + state.MD > limit) {
    return false;
  }

  int sx = state.space / N;
  int sy = state.space % N;
  Puzzle tmp;

  for (int r = 0; r < 4; r++) {
    int tx = sx + dx[r];
    int ty = sy + dy[r];
    if (tx < 0 || ty < 0 || tx >= N || ty >= N) {
      continue;
    }
    if (max(prev, r) - min(prev, r) == 2) {
      continue;
    }
    tmp = state;
    state.MD -= MDT[tx * N + ty][state.f[tx * N + ty] - 1];
    state.MD += MDT[sx * N + sy][state.f[tx * N + ty] - 1];
    swap(state.f[tx * N + ty], state.f[sx * N + sy]);
    state.space = tx * N + ty;
    if (dfs(depth + 1, r)) {
      path[depth] = r;
      return true;
    }
    state = tmp;
  }
  return false;
}

string iterative_deepening(Puzzle in) {
  in.MD = getAllMD(in);

  for (limit = in.MD; limit <= LIMIT; limit++) {
    sate = in;
    if (dfs(0, -100)) {
      string ans = "";
      for (int i = 0; i < limit; i++) {
        ans += dir[path[i]];
        return ans;
      }
    }
  }
  return "unsolvable";
}

int main(){
  for (int i = 0; i < N2; i++) {
    for (int j = 0; j < N2; j++) {
      MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N)
    }
  }

  Puzzle in;

  for (int i = 0; i < N2; i++) {
    cin >> in.f[i];
    if (in.f[i] == 0) {
      in.f[i] = N2;
      in.space = i;
    }
  }
  string ans = iterative_deepening(in);
  cout << and.size() << endl;

  return 0;
}



Compiler output:
a.cc: In function 'std::string iterative_deepening(Puzzle)':
a.cc:88:5: error: 'sate' was not declared in this scope; did you mean 'state'?
   88 |     sate = in;
      |     ^~~~
      |     state
a.cc: In function 'int main()':
a.cc:103:58: error: expected ';' before '}' token
  103 |       MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N)
      |                                                          ^
      |                                                          ;
  104 |     }
      |     ~                                                     
a.cc:117:14: error: expected identifier before '.' token
  117 |   cout << and.size() << endl;
      |              ^
Language: C++

#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>

using namespace std;

#define N 4
#define N2 16
#define LIMIT 100

static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];

struct Puzzle {
  int f[N2];
  int space;
  int MD;
};

Puzzle state;
int limit;
int path[LIMIT];

int getAllMD(Puzzle pz) {
  int sum = 0;
  for (int i = 0; i < N2; i++) {
    if (pz.f[i] == N2) {
      continue;
    }
    sum += MDT[i][pz.f[i] - 1];
  }
  return sum;
}

bool isSolved() {
  for (int i = 0; i < N2; i++) {
    if (state.f[i] != i + 1) {
      return false;
    }
  }
  return true;
}

bool dfs(int depth, int prev) {
  if (state.MD == 0) {
    return true;
  }
  if (depth + state.MD > limit) {
    return false;
  }

  int sx = state.space / N;
  int sy = state.space % N;
  Puzzle tmp;

  for (int r = 0; r < 4; r++) {
    int tx = sx + dx[r];
    int ty = sy + dy[r];
    if (tx < 0 || ty < 0 || tx >= N || ty >= N) {
      continue;
    }
    if (max(prev, r) - min(prev, r) == 2) {
      continue;
    }
    tmp = state;
    state.MD -= MDT[tx * N + ty][state.f[tx * N + ty] - 1];
    state.MD += MDT[sx * N + sy][state.f[tx * N + ty] - 1];
    swap(state.f[tx * N + ty], state.f[sx * N + sy]);
    state.space = tx * N + ty;
    if (dfs(depth + 1, r)) {
      path[depth] = r;
      return true;
    }
    state = tmp;
  }
  return false;
}

string iterative_deepening(Puzzle in) {
  in.MD = getAllMD(in);

  for (limit = in.MD; limit <= LIMIT; limit++) {
    state = in;
    if (dfs(0, -100)) {
      string ans = "";
      for (int i = 0; i < limit; i++) {
        ans += dir[path[i]];
        return ans;
      }
    }
  }
  return "unsolvable";
}

int main(){
  for (int i = 0; i < N2; i++) {
    for (int j = 0; j < N2; j++) {
      MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N)
    }
  }

  Puzzle in;

  for (int i = 0; i < N2; i++) {
    cin >> in.f[i];
    if (in.f[i] == 0) {
      in.f[i] = N2;
      in.space = i;
    }
  }
  string ans = iterative_deepening(in);
  cout << and.size() << endl;

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:102:58: error: expected ';' before '}' token
  102 |       MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N)
      |                                                          ^
      |                                                          ;
  103 |     }
      |     ~                                                     
a.cc:116:14: error: expected identifier before '.' token
  116 |   cout << and.size() << endl;
      |              ^
Language: C++


#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>

using namespace std;

#define N 4
#define N2 16
#define LIMIT 100

static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];

struct Puzzle {
  int f[N2];
  int space;
  int MD;
};

Puzzle state;
int limit;
int path[LIMIT];

int getAllMD(Puzzle pz) {
  int sum = 0;
  for (int i = 0; i < N2; i++) {
    if (pz.f[i] == N2) {
      continue;
    }
    sum += MDT[i][pz.f[i] - 1];
  }
  return sum;
}

bool isSolved() {
  for (int i = 0; i < N2; i++) {
    if (state.f[i] != i + 1) {
      return false;
    }
  }
  return true;
}

bool dfs(int depth, int prev) {
  if (state.MD == 0) {
    return true;
  }
  if (depth + state.MD > limit) {
    return false;
  }

  int sx = state.space / N;
  int sy = state.space % N;
  Puzzle tmp;

  for (int r = 0; r < 4; r++) {
    int tx = sx + dx[r];
    int ty = sy + dy[r];
    if (tx < 0 || ty < 0 || tx >= N || ty >= N) {
      continue;
    }
    if (max(prev, r) - min(prev, r) == 2) {
      continue;
    }
    tmp = state;
    state.MD -= MDT[tx * N + ty][state.f[tx * N + ty] - 1];
    state.MD += MDT[sx * N + sy][state.f[tx * N + ty] - 1];
    swap(state.f[tx * N + ty], state.f[sx * N + sy]);
    state.space = tx * N + ty;
    if (dfs(depth + 1, r)) {
      path[depth] = r;
      return true;
    }
    state = tmp;
  }
  return false;
}

string iterative_deepening(Puzzle in) {
  in.MD = getAllMD(in);

  for (limit = in.MD; limit <= LIMIT; limit++) {
    state = in;
    if (dfs(0, -100)) {
      string ans = "";
      for (int i = 0; i < limit; i++) {
        ans += dir[path[i]];
        return ans;
      }
    }
  }
  return "unsolvable";
}

int main(){
  for (int i = 0; i < N2; i++) {
    for (int j = 0; j < N2; j++) {
      MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N);
    }
  }

  Puzzle in;

  for (int i = 0; i < N2; i++) {
    cin >> in.f[i];
    if (in.f[i] == 0) {
      in.f[i] = N2;
      in.space = i;
    }
  }
  string ans = iterative_deepening(in);
  cout << and.size() << endl;

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:117:14: error: expected identifier before '.' token
  117 |   cout << and.size() << endl;
      |              ^
Language: C++


#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>

using namespace std;

#define N 4
#define N2 16
#define LIMIT 100

static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];

struct Puzzle {
  int f[N2];
  int space;
  int MD;
  int cost;

  bool operator < (const Puzzle& p) const {
    for (int i = 0; i < N2; i++) {
      if (f[i] == p.f[i]) {
        continue;
      }
      return f[i] < p.f[i];
    }
    return false;
  }
};

struct State {
  Puzzle puzzle;
  int estimated;
  bool operator < (const State& s) const {
    return estimated > s.estimated;
  }
};

int getAllMD(Puzzle pz) {
  int sum = 0;
  for (int i = 0; i < N2; i++) {
    if (pz.f[i] == N2) {
      continue;
    }
    sum += MDT[i][pz.f[i] - 1];
  }
  return sum;
}

bool isSolved() {
  for (int i = 0; i < N2; i++) {
    if (state.f[i] != i + 1) {
      return false;
    }
  }
  return true;
}

int astat(Puzzle pz) {
  priority_queue<State> PQ;
  s.MD = getAllMD(s);
  s.cost = 0;
  map<Puzzle, bool> V;
  Puzzle u, v;
  State initial;
  initial.puzzle = s;
  initial.estimated = getAllMD(s);
  PQ.push(initial);

  while (!PQ.empty()) {
    State st = PQ.top(); PQ.pop();
    u = st.puzzle;

    if (u.MD == 0) {
      return u.cost;
    }
    V[u] = true;

    int sx = u.space / N;
    int sy = u.space % N;

    for (int r = 0; r < 4; r++) {
      int tx = sx + dx[r];
      int ty = sy + dy[r];
      if (tx < 0 || ty < 0 || tx >= N || ty >= N) {
        continue;
      }
      v = u;

      v.MD -= MDT[tx * N + ty][v.f[tx * N + ty] - 1];
      v.MD += MDT[sx * N + sy][v.f[tx * N + ty] - 1];
      swap(v.f[sx * N + sy], v.f[tx * N + ty]);
      v.space = tx * N + ty;
      if (!V[v]) {
        v.cost++;
        State news;
        news.puzzle = v;
        news.estimated = v.cost + v.MD;
        PQ.push(news);
      }
    }
  }
  return -1;
}

int main(){
  for (int i = 0; i < N2; i++) {
    for (int j = 0; j < N2; j++) {
      MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N);
    }
  }

  Puzzle in;

  for (int i = 0; i < N2; i++) {
    cin >> in.f[i];
    if (in.f[i] == 0) {
      in.f[i] = N2;
      in.space = i;
    }
  }

  cout << astar(in) << endl;

  return 0;
}


Compiler output:
a.cc: In function 'bool isSolved()':
a.cc:57:9: error: 'state' was not declared in this scope; did you mean 'State'?
   57 |     if (state.f[i] != i + 1) {
      |         ^~~~~
      |         State
a.cc: In function 'int astat(Puzzle)':
a.cc:66:3: error: 's' was not declared in this scope
   66 |   s.MD = getAllMD(s);
      |   ^
a.cc: In function 'int main()':
a.cc:128:11: error: 'astar' was not declared in this scope; did you mean 'astat'?
  128 |   cout << astar(in) << endl;
      |           ^~~~~
      |           astat
Language: C++


#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>

using namespace std;

#define N 4
#define N2 16
#define LIMIT 100

static const int dx[4] = {0, -1, 0, 1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];

struct Puzzle {
  int f[N2];
  int space;
  int MD;
  int cost;

  bool operator < (const Puzzle& p) const {
    for (int i = 0; i < N2; i++) {
      if (f[i] == p.f[i]) {
        continue;
      }
      return f[i] < p.f[i];
    }
    return false;
  }
};

struct State {
  Puzzle puzzle;
  int estimated;
  bool operator < (const State& s) const {
    return estimated > s.estimated;
  }
};

int getAllMD(Puzzle pz) {
  int sum = 0;
  for (int i = 0; i < N2; i++) {
    if (pz.f[i] == N2) {
      continue;
    }
    sum += MDT[i][pz.f[i] - 1];
  }
  return sum;
}

int astar(Puzzle pz) {
  priority_queue<State> PQ;
  s.MD = getAllMD(s);
  s.cost = 0;
  map<Puzzle, bool> V;
  Puzzle u, v;
  State initial;
  initial.puzzle = s;
  initial.estimated = getAllMD(s);
  PQ.push(initial);

  while (!PQ.empty()) {
    State st = PQ.top(); PQ.pop();
    u = st.puzzle;

    if (u.MD == 0) {
      return u.cost;
    }
    V[u] = true;

    int sx = u.space / N;
    int sy = u.space % N;

    for (int r = 0; r < 4; r++) {
      int tx = sx + dx[r];
      int ty = sy + dy[r];
      if (tx < 0 || ty < 0 || tx >= N || ty >= N) {
        continue;
      }
      v = u;

      v.MD -= MDT[tx * N + ty][v.f[tx * N + ty] - 1];
      v.MD += MDT[sx * N + sy][v.f[tx * N + ty] - 1];
      swap(v.f[sx * N + sy], v.f[tx * N + ty]);
      v.space = tx * N + ty;
      if (!V[v]) {
        v.cost++;
        State news;
        news.puzzle = v;
        news.estimated = v.cost + v.MD;
        PQ.push(news);
      }
    }
  }
  return -1;
}

int main(){
  for (int i = 0; i < N2; i++) {
    for (int j = 0; j < N2; j++) {
      MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N);
    }
  }

  Puzzle in;

  for (int i = 0; i < N2; i++) {
    cin >> in.f[i];
    if (in.f[i] == 0) {
      in.f[i] = N2;
      in.space = i;
    }
  }

  cout << astar(in) << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int astar(Puzzle)':
a.cc:57:3: error: 's' was not declared in this scope
   57 |   s.MD = getAllMD(s);
      |   ^
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;

public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str1 = br.readLine();
		String str2 = br.readLine();
		int[] x = new int[4];
		LinkedList<Integer> a = new LinkedList<Integer>();
		
		x[0] = str1.indexOf(str2);
		a.add(str1.indexOf(str2));
		
		for(int i = 1; i < str1.length(); i++){
			if(str1.indexOf(str2, a.get(i - 1) + 1) == str1.lastIndexOf(str2)){
				a.add(str1.indexOf(str2, a.get(i - 1) + 1));
				break;
			}
			a.add(str1.indexOf(str2, a.get(i - 1) + 1));
		}
		
		if(a.size() <= 0){
			for(int i = 0; i < a.size(); i++){
				System.out.println(a.get(i));
			}
		}
	}
}

Compiler output:
Main.java:6: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args)throws IOException{
              ^
  (use --enable-preview to enable unnamed classes)
Main.java:30: error: class, interface, enum, or record expected
}
^
2 errors
Language: Java

//API???????????????
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
class Main {
  	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str1 = br.readLine();
		String str2 = br.readLine();
		int[] x = new int[4];
		LinkedList list = new LinkedList();
		
		if(str1.length() < str2.length()){
			return;
		}else if(str1.indexOf(str2) == -1){
			return;
		}else if(str1.equals(str2)){
			System.out.println("0");
			return;
		}
		
		
		list.insert(str1.indexOf(str2));
		while(str1.indexOf(str2, list.getData() + 1) != -1){
			list.insert(str1.indexOf(str2, list.getData() + 1));
		}
		
		System.out.println(list.toString());
	}
}

class Room{
	Room prev; //????????¨?±????????????????
	Room next; //?¬??????¨?±????????????????
	int data; //??¨?±?????????????
	
	public Room(int data){
		this.data = data;
		prev = null;
		next = null;
	}

}

class LinkedList {
	Room head;
	Room leg;
	
	public LinkedList(){
		head = new Room(0);
		head.next = head;
		head.prev = head;
		leg = head;
	}
	
	//??¨?±?x?????´??????data????????\
	void insert(int data){
		Room x = new Room(data);
		x.prev = head;
		x.next = head.next;
		head.next.prev = x;
		head.next = x;
		leg = head.prev;
	}
	
	public int getData(){
		Room p = head.next;
		return p.data;
	}

	public String toString(){
		StringBuilder st = new StringBuilder();
		for(Room p=head.prev; p != head; p = p.prev){
			st.append(p.data + "\r\n");
		}
		return st.toString();
	}
} 

Compiler output:
Main.java:5: error: LinkedList is already defined in this compilation unit
import java.util.LinkedList;
^
Main.java:24: error: cannot find symbol
		list.insert(str1.indexOf(str2));
		    ^
  symbol:   method insert(int)
  location: variable list of type LinkedList
Main.java:25: error: cannot find symbol
		while(str1.indexOf(str2, list.getData() + 1) != -1){
		                             ^
  symbol:   method getData()
  location: variable list of type LinkedList
Main.java:26: error: cannot find symbol
			list.insert(str1.indexOf(str2, list.getData() + 1));
			                                   ^
  symbol:   method getData()
  location: variable list of type LinkedList
4 errors
Language: Java

import java.util.*;

public class Main{
	public static void main(String[] args){

		Scanner scan = new Scanner(System.in);
		String t = scan.next();
		String p = scan.next();

		nFind(t, p);

		scan.colse();
		System.exit(0);
	}

	private static void nFind(String t, String p){
		for(int st = 0; st < t.length() - p.length()+1; st++) //t?????????-p?????????+1??????????¢??????????
			if(isEqual(t, p, st))
				System.out.println(st);
	}

	private static boolean isEquals(String t, String p, int st){
		for(int i = 0; i < p.length(); i++)
			if(t.charAt(st + i) != p.charAt(i))
				return false;
		return true;
	}
}

Compiler output:
Main.java:12: error: cannot find symbol
		scan.colse();
		    ^
  symbol:   method colse()
  location: variable scan of type Scanner
Main.java:18: error: cannot find symbol
			if(isEqual(t, p, st))
			   ^
  symbol:   method isEqual(String,String,int)
  location: class Main
2 errors
Language: C

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

int find(char *a, char *b, int i, int al){
  int j;

  for(j = 0; j < al; j++){
    if(a[i+j] != b[j]){
      return 0;
    }
  }
  return -1;
}

int main(){
  char a[1000], b[1000];
  int i, , plength;

  scanf("%s", a);
  scanf("%s", b);

  al = strlen(a);
  bl = strlen(b);

  for(i = 0; i <al; i++){
    if(find(a, b, i, al)){
      printf("%d\n", i);
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:10: error: expected identifier or '(' before ',' token
   17 |   int i, , plength;
      |          ^
main.c:22:3: error: 'al' undeclared (first use in this function); did you mean 'a'?
   22 |   al = strlen(a);
      |   ^~
      |   a
main.c:22:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:23:3: error: 'bl' undeclared (first use in this function); did you mean 'b'?
   23 |   bl = strlen(b);
      |   ^~
      |   b
Language: C

#include<stdio.h>
#include<string.h>
#define MAX 1000
 
int main(){
  

  int i,j;
  int n;
  int k = 0;
  int total = 0;
  int t, p;
  int v[MAX];
  char T[MAX],P[MAX];


  
  scanf("%s%s",T,P);
  
  t=strlen(T);
  p=strlen(P);

  for(i = 0;i < t;i++){
    if(T[i] == P[0]){
      
      j = i+1;
      n = 1;

      while(n < p){
        if(T[j] != P[n])
          break;
        j++;
	n++;
      }
      else if(n == p){
        v[k] = i;
        total++;
	k++;
      }
    }
  }
  for(k = 0;k < total;k++){
    printf("%d\n",v[k]);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:35:7: error: expected '}' before 'else'
   35 |       else if(n == p){
      |       ^~~~
main.c: At top level:
main.c:42:3: error: expected identifier or '(' before 'for'
   42 |   for(k = 0;k < total;k++){
      |   ^~~
main.c:42:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   42 |   for(k = 0;k < total;k++){
      |               ^
main.c:42:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   42 |   for(k = 0;k < total;k++){
      |                        ^~
main.c:46:3: error: expected identifier or '(' before 'return'
   46 |   return 0;
      |   ^~~~~~
main.c:47:1: error: expected identifier or '(' before '}' token
   47 | }
      | ^
Language: C

#include <stdio.h>
#include <string.h>
#define N 1001
int main(){
  char T[N],P[N];
  int i,j,l1,l2,flag;
   
  scanf("%s",T);
  scanf("%s",P);
   
  l1=strlen(T);
  l2=strlen(P);
   
  for(i=0;i<l1;i++){
    flag=0;
    for(j=0;j<l2;j++){
      if(T[i+j]==P[j]) flag++;
   
    }
    if(flag==l2) printf("%d\n",i);
  }
 
  

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

#include<stdio.h>
int check(int, int, int, int )
int main(){
    int i, t[1000], p[1000], l=0, q=0;
    while((t[l++]=getchar())!='\n'){}
    while((p[q++]=getchar())!='\n'){}
    for(i=0; i<l-q+1; i++)if(check(t, p, i, q-1))printf("%d\n", i);
    return 0;
}
int check(int a[], int b[], int i, int q){
    int j;
    for(j=0; j<q; j++)if(a[j+i]!=b[j])return 0;
    return 1;
}

Compiler output:
main.c: In function 'check':
main.c:3:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    3 | int main(){
      |           ^
main.c:10:42: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   10 | int check(int a[], int b[], int i, int q){
      |                                          ^
main.c:15: error: expected '{' at end of input
Language: C

#include<stdio.h>
#include<string.h>
#define N 1000
 
int main() {
    int i, j, len, flag;
    char A[N], B[N];
 
    scanf("%s", A);
    scanf("%s", B);
 
    for (i = 0; i < strlen(T); i++) {
        flag = 0;
        if (A[i] == B[0]) {
            flag = 1;
            for (j = 0; j < strlen(B); j++) {
                if (A[i+j] != B[j]) {
                    flag = 0;
                    break;
                }
            }
        }
        if (flag == 1) printf("%d\n", i);
    }
 
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:28: error: 'T' undeclared (first use in this function)
   12 |     for (i = 0; i < strlen(T); i++) {
      |                            ^
main.c:12:28: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

void solve(string T,string P){
    int size = T.size() - P.size() +1;
    for (int i = 0; i < size ; ++i) {
        if(T[i] == P[0])
        {
            bool isSame = true;
            for (int j = 0; j < P.size ; ++j) {
                if( T[i+j] != P[j]) {
                    isSame = false;
                    break;
                }
            }
            if(isSame){
                cout << i << endl;
            }
        }
    }
}

int main(){
    string T,P;
    cin >> T >> P;
    solve(T,P);
    return 0;
}

Compiler output:
a.cc: In function 'void solve(std::string, std::string)':
a.cc:11:35: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   11 |             for (int j = 0; j < P.size ; ++j) {
      |                                 ~~^~~~
      |                                       ()
Language: C++

import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		char[] s = scan.next().toCharArray();
		char[] a = scan.next().toCharArray();
		
		for(int i = 0; i < s.length - a.length + 1; i++){
			for(int j = 0; j < a.length; j++){
				if(a[j] == s[i + j]){
					if(j == a.length - 1){
						System.out.println(i);
					}
				}else break;
			}
		}
		
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:15: error: expected ':' before 'static'
    4 |         public static void main(String[] args) {
      |               ^~~~~~~
      |               :
a.cc:4:33: error: 'String' has not been declared
    4 |         public static void main(String[] args) {
      |                                 ^~~~~~
a.cc:4:42: error: expected ',' or '...' before 'args'
    4 |         public static void main(String[] args) {
      |                                          ^~~~
a.cc:20:2: error: expected ';' after class definition
   20 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:5:17: error: 'Scanner' was not declared in this scope
    5 |                 Scanner scan = new Scanner(System.in);
      |                 ^~~~~~~
a.cc:6:21: error: structured binding declaration cannot have type 'char'
    6 |                 char[] s = scan.next().toCharArray();
      |                     ^~
a.cc:6:21: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:6:21: error: empty structured binding declaration
a.cc:6:24: error: expected initializer before 's'
    6 |                 char[] s = scan.next().toCharArray();
      |                        ^
a.cc:7:21: error: structured binding declaration cannot have type 'char'
    7 |                 char[] a = scan.next().toCharArray();
      |                     ^~
a.cc:7:21: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:7:21: error: empty structured binding declaration
a.cc:7:24: error: expected initializer before 'a'
    7 |                 char[] a = scan.next().toCharArray();
      |                        ^
a.cc:9:36: error: 's' was not declared in this scope
    9 |                 for(int i = 0; i < s.length - a.length + 1; i++){
      |                                    ^
a.cc:9:47: error: 'a' was not declared in this scope
    9 |                 for(int i = 0; i < s.length - a.length + 1; i++){
      |                                               ^
a.cc:13:49: error: 'System' was not declared in this scope
   13 |                                                 System.out.println(i);
      |                                                 ^~~~~~
Language: C++

include <string>
using namespace std;

int main() {
  string s, t;

  cin >> s >> t;

  for ( int i = 0; i < s.size(); i++ ) {
    for ( int j = 0, k = i; j < t.size(); k++) {
      if ( s[k] != t[j++] ) break;
      if ( t[j] == '\0' ) {
        cout << i << endl;
      }
    }
  }
  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <string>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:3: error: 'string' was not declared in this scope
    5 |   string s, t;
      |   ^~~~~~
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> s >> t;
      |   ^~~
a.cc:7:10: error: 's' was not declared in this scope
    7 |   cin >> s >> t;
      |          ^
a.cc:7:15: error: 't' was not declared in this scope
    7 |   cin >> s >> t;
      |               ^
a.cc:13:9: error: 'cout' was not declared in this scope
   13 |         cout << i << endl;
      |         ^~~~
a.cc:13:22: error: 'endl' was not declared in this scope
   13 |         cout << i << endl;
      |                      ^~~~
Language: C++

#include <string>
using namespace std;

int main() {
  string s, t;

  cin >> s >> t;

  for ( int i = 0; i < s.size(); i++ ) {
    for ( int j = 0, k = i; j < t.size(); k++) {
      if ( s[k] != t[j++] ) break;
      if ( t[j] == '\0' ) {
        cout << i << endl;
      }
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> s >> t;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <string>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:13:9: error: 'cout' was not declared in this scope
   13 |         cout << i << endl;
      |         ^~~~
a.cc:13:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:22: error: 'endl' was not declared in this scope
   13 |         cout << i << endl;
      |                      ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <string>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include <bits/stdc++.h>
??
using namespace std;
??
int main(){
????????int N,M;
????????string S,T;
????????cin >> S >> T;
????????N = S.size(); M = T.size();
????????for(int i = 0 ; i <= N-M ; i++){
????????????????bool ok = 1;
????????????????for(int j = 0 ; j < M ; j++){
????????????????????????if(T[j] != S[i+j]){
????????????????????????????????ok = 0;
????????????????????????????????break;
????????????????????????}
????????????????}
????????????????if(ok){
????????????????????????cout << i << endl;
????????????????}
????????}
????????return 0;
}

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

#include<stdio.h>
#include<string.h>
#define N 1000
 
int main() {
    int i, j, len, flag;
    char A[N], B[N];
 
    scanf("%s", A);
    scanf("%s", B);
 
    for (i = 0; i < strlen(T); i++) {
        flag = 0;
        if (A[i] == B[0]) {
            flag = 1;
            for (j = 0; j < strlen(B); j++) {
                if (A[i+j] != B[j]) {
                    flag = 0;
                    break;
                }
            }
        }
        if (flag == 1) printf("%d\n", i);
    }
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:28: error: 'T' was not declared in this scope
   12 |     for (i = 0; i < strlen(T); i++) {
      |                            ^
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main() {
    string s1, s2;
    cin >> s1 >> s2;

    for (int i = 0; i < s1.size(); ++i) {
        int j = 0;
        int k = i;
        while (j < s2.size() && k < s1.size()) {
            if (s1[koch_curve] != s2[j])
                break;
            j++; k++;
        }
        if (j >= s2.size()) {
            cout << i << endl;
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: 'koch_curve' was not declared in this scope
   14 |             if (s1[koch_curve] != s2[j])
      |                    ^~~~~~~~~~
Language: Java


import java.io.IOException;
import java.util.Scanner;

public class Main_Kmp {

    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);
        String ori = in.nextLine();
        String pattern = in.nextLine();

        int next[] = new int[pattern.length() + 1];
        //?±?next??°?????????????´????                    
        next[0] = -1;
        int k = -1, j = 0;
        while (j < pattern.length()) {
            //k == -1?°±??¨???????????°????¬¬??????????????????????????\next[j] = 0
            //k??¶????°±???next[j-1](k == -1??¶??¶?????????),par.charAt(j) == par.charAt(k)????¶??????????????°±?????´next[j] = next[j-1]+1
            //?????????????¶???£?°±?????????k???????¬????????????????????????£??????????§?
            if (k == -1 || pattern.charAt(j) == pattern.charAt(k)) {
                next[++j] = ++k;//????°±?????´next[j] = next[j-1]+1
            } else {
                k = next[k];//??????k???????¬????????????????????????£??????????§??????°??????
            }
        }
        int p = 0, q = 0, ans = 0;
        while (p < ori.length()) {
            if (pattern.charAt(q) == ori.charAt(p)) {
                if (q == pattern.length() - 1) {
                    System.out.println(p-1);
                    q = next[q];
                    ans++; //?????°????¨???????????¬???°?¢????
                } else { //???????????§???????????????
                    p++;
                    q++;
                }
            } else { //?????????????§???¨
                q = next[q];
            }
            if (q == -1) { //??????????¨???????????¬¬??????????¬?????????????
                p++;
                q++;
            }
        }
//        System.out.println(ans);
    }
}

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

#include <iostream>
#include <cstring>
using namespace std;
typedef unsigned long long ull;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    char t[1000001], p[10001];
    cin>>t>>p;
    int tl=strlen(t);
    int pl=strlen(p);
    if(pl>tl) return 0;
    const ull base = 1000000007ULL;
    ull bt = 1;
    for(int i=0; i<pl; i++) bt*=base;
    ull th=0, ph=0;
    for(int i=0; i<pl; i++){
        ph*=base;
        ph+=p[i];
        th*=base;
        th+=t[i];
    }
    for(int pos=0; pos<=tl-pl; pos++) {
        if(th==ph) {
            if(memcmp(t+pos, p, pl)==0) cout<<pos<<'\n';
        }
        th*=base;
        th-=bt*t[pos];
        th+=t[pos+pl];
    }
    return 0;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:2: error: illegal character: '#'
#include <cstring>
^
Main.java:4: error: class, interface, enum, or record expected
typedef unsigned long long ull;
^
Main.java:8: error: not a statement
    ios::sync_with_stdio(false);
    ^
Main.java:10: error: not a statement
    char t[1000001], p[10001];
                      ^
Main.java:11: error: not a statement
    cin>>t>>p;
          ^
Main.java:15: error: not a statement
    const ull base = 1000000007ULL;
                               ^
Main.java:27: error: not a statement
            if(memcmp(t+pos, p, pl)==0) cout<<pos<<'\n';
                                                 ^
Main.java:6: error: unnamed classes are a preview feature and are disabled by default.
int main()
^
  (use --enable-preview to enable unnamed classes)
Main.java:8: error: ';' expected
    ios::sync_with_stdio(false);
                        ^
Main.java:10: error: ']' expected
    char t[1000001], p[10001];
           ^
Main.java:15: error: illegal start of expression
    const ull base = 1000000007ULL;
    ^
12 errors
Language: Java

import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main{

     public static void main(String []args)???throws IOException {
         BufferedReader br = new BufferedReamder(new InputStreamReader(System.in));
         String text = br.readLine();
         String pattern = br.readLine();
         bmSearch(text,pattern);
         
        
     }
     public static void bmSearch(String text, String pattern){
         int textLen = text.length();
         int patnLen = pattern.length();
         int [] skip = new int[128];
         for(int i = 0; i< 128;i++){
             skip[i] = patnLen;
         }
         for(int i = 0; i<patnLen - 1;i++){
             skip[pattern.charAt(i)]=patnLen - i -1;
         }
         int i = patnLen -1;
         while(i < textLen){
             int j = patnLen - 1;
             while(text.charAt(i) == pattern.charAt(j)){
                 if(j==0){
                     System.out.println(i);
                     break;
                 }
                 i--;
                 j--;
             }
             i += Math.max(patnLen -j,skip[text.charAt(i)]);
         }
     }
}

Compiler output:
Main.java:6: error: ';' expected
     public static void main(String []args)???throws IOException {
                                           ^
1 error
Language: Java

import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main{

     public static void main(String []args){
         BufferedReader br = new BufferedReamder(new InputStreamReader(System.in));
         String text = br.readLine();
         String pattern = br.readLine();
         bmSearch(text,pattern);
         
        
     }
     public static void bmSearch(String text, String pattern){
         int textLen = text.length();
         int patnLen = pattern.length();
         int [] skip = new int[128];
         for(int i = 0; i< 128;i++){
             skip[i] = patnLen;
         }
         for(int i = 0; i<patnLen - 1;i++){
             skip[pattern.charAt(i)]=patnLen - i -1;
         }
         int i = patnLen -1;
         while(i < textLen){
             int j = patnLen - 1;
             while(text.charAt(i) == pattern.charAt(j)){
                 if(j==0){
                     System.out.println(i);
                     break;
                 }
                 i--;
                 j--;
             }
             i += Math.max(patnLen -j,skip[text.charAt(i)]);
         }
     }
}

Compiler output:
Main.java:7: error: cannot find symbol
         BufferedReader br = new BufferedReamder(new InputStreamReader(System.in));
                                 ^
  symbol:   class BufferedReamder
  location: class Main
1 error
Language: Java

import java.io.IOException;
import java.util.Scanner;
class Main{
public static void main(String[] args)throws IOException{
		Scanner scan = new Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();
		int[] x = new int[4];
		LinkedList list = new LinkedList();
		
		if(str1.length() < str2.length()){
			return;
		}else if(str1.indexOf(str2) == -1){
			return;
		}else if(str1.equals(str2)){
			System.out.println("0");
			return;
		}
		
		
		list.insert(str1.indexOf(str2));
		while(str1.indexOf(str2, list.getData() + 1) != -1){
			list.insert(str1.indexOf(str2, list.getData() + 1));
		}
		
		System.out.print(list.toString());
	}
}

class Room{
	Room prev; //????????¨?±????????????????
	Room next; //?¬??????¨?±????????????????
	int data; //??¨?±?????????????
	
	public Room(int data){
		this.data = data;
		prev = null;
		next = null;
	}

}

class LinkedList {
	Room head;
	Room leg;
	
	public LinkedList(){
		head = new Room(0);
		head.next = head;
		head.prev = head;
		leg = head;
	}
	
	//??¨?±?x?????´??????data????????\
	void insert(int data){
		Room x = new Room(data);
		x.prev = head;
		x.next = head.next;
		head.next.prev = x;
		head.next = x;
		leg = head.prev;
	}
	
	public int getData(){
		Room p = head.next;
		return p.data;
	}

	public String toString(){
		StringBuilder st = new StringBuilder();
		for(Room p=head.prev; p != head; p = p.prev){
			st.append(p.data + "\r\n");
		}
		return st.toString();
	}
}
}

Compiler output:
Main.java:77: error: class, interface, enum, or record expected
}
^
1 error
Language: Java

import java.io.*;
import java.util.Iterator;
import java.util.LinkedList;

public class Main {
    public static void main(String[] args) {    
        InputStreamReader in = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(in);
        LinkedList<int> result = new LinkedList<int>();
        try{
            String text = reader.readLine();
            String word = reader.readLine();
            for(int i = 0; i < text.length() - word.length() + 1; i++){
            	String str = text.substring(i,i + word.length());
            	if(str.equals(word)){
            		result.add(i);
            	}
            }
            Iterator<String> it = result.iterator();
            while (it.hasNext()) {
            	System.out.println(it.next);
            }
        }catch(IOException e){
            System.out.println(e);
        }  
    }
}

Compiler output:
Main.java:9: error: unexpected type
        LinkedList<int> result = new LinkedList<int>();
                   ^
  required: reference
  found:    int
Main.java:9: error: unexpected type
        LinkedList<int> result = new LinkedList<int>();
                                                ^
  required: reference
  found:    int
Main.java:21: error: cannot find symbol
            	System.out.println(it.next);
            	                     ^
  symbol:   variable next
  location: variable it of type Iterator<String>
3 errors