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

package aizu_olinejudge;

import java.util.*;

public class SevenPuzzle {

	public static int lzh(int puzzle[]){
		return puzzle[0]*10000000+puzzle[1]*1000000+puzzle[2]*100000+puzzle[3]*10000+puzzle[4]*1000+puzzle[5]*100+puzzle[6]*10+puzzle[7];
	}

	public static void changein(int puzzle[],LinkedList<Integer> que,int a,int b,int cnt){
		int[] puzzle_ = new int[8];
		for(int i=0;i<8;i++){
			puzzle_[i]=puzzle[i];
		}
		puzzle_[a]=puzzle[b];
		puzzle_[b]=puzzle[a];

		que.offer(lzh(puzzle_));
		que.offer(cnt+1);
	}

	public static int solve(int puzzle[]){

		LinkedList<Integer> que = new LinkedList<Integer>();
		boolean[] memo = new boolean[76543211];
		int a=0;
		int now,cnt=0;
		int wzero=0;

		//はじめの配置
		a=lzh(puzzle);
		que.offer(a);
		que.offer(0);

		while(que.size()>0){
			now=que.poll();
			cnt=que.poll();
			if(memo[now])		//前に調べたことがあるからtbs
				continue;
			else
				memo[now]=true;

			if(now==1234567)
				break;

			for(int i=0;i<8;i++){
				puzzle[i]=(now/(int)Math.pow(10, 7-i))%10;
				if(puzzle[i]==0) wzero=i;
			}

			if(wzero==0){
				changein(puzzle,que,0,1,cnt);
				changein(puzzle,que,0,4,cnt);
			}

			if(wzero==4){
				changein(puzzle,que,4,5,cnt);
				changein(puzzle,que,0,4,cnt);
			}

			if(wzero==3){
				changein(puzzle,que,2,3,cnt);
				changein(puzzle,que,3,7,cnt);
			}

			if(wzero==7){
				changein(puzzle,que,3,7,cnt);
				changein(puzzle,que,6,7,cnt);
			}

			if(wzero==1){
				changein(puzzle,que,0,1,cnt);
				changein(puzzle,que,1,5,cnt);
				changein(puzzle,que,1,2,cnt);
			}

			if(wzero==5){
				changein(puzzle,que,4,5,cnt);
				changein(puzzle,que,5,1,cnt);
				changein(puzzle,que,5,6,cnt);
			}

			if(wzero==2){
				changein(puzzle,que,1,2,cnt);
				changein(puzzle,que,2,6,cnt);
				changein(puzzle,que,2,3,cnt);
			}

			if(wzero==6){
				changein(puzzle,que,2,6,cnt);
				changein(puzzle,que,6,5,cnt);
				changein(puzzle,que,6,7,cnt);
			}

		}

		return cnt;
	}

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int[] puzzle = new int[8];

		while(scan.hasNext()){

			for(int i=0;i<8;i++){
				puzzle[i]=scan.nextInt();
			}
			System.out.println(solve(puzzle));

		}
	}
}

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

import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	private final static int SIZE = 8;
	
	private final static int[][] MOVABLE_PAIRS = {
		{1,4}, {0,2,5}, {1,3,6}, {2,7},
		{0,5}, {1,4,6}, {2,5,7}, {3,6}
	};
	
	private final static int[] coefficients = {5040, 720, 120, 24, 6, 2, 1, 0};

	private static final int[] ANSWER_STATE = {0,1,2,3,4,5,6,7};
	
	private static final int FORE_DIRECTION = 1;
	private static final int BACK_DIRECTION = -1;
	
	private Main() {
		Scanner in = new Scanner(System.in);
		
		while(in.hasNext()) {
			int[] puzzle = new int[SIZE];
			for(int i=0; i<SIZE; i++) {
				puzzle[i] = in.nextInt();
			}
			System.out.println(solve(puzzle));
- start);
		}
		in.close();
	}
	
	final class Puzzle {
		// 座標番号
		// 0 1 2 3
		// 4 5 6 7
		final int[] state; // パズルの状態
		final int depth; // 深さ(操作回数)
		final int movablePiecePoint; // パズル内にある動かせるピースの座標 
		final int point;// 移動可能なピースの直前にあった座標
		final boolean isRoot; // 根ノードかどうか
		int stateCode;
		final int direction; // 探索の向き
		
		public Puzzle(int[] state, int direction) {
			this.isRoot = true;
			this.depth = 0;
			this.state = state;
			this.point = -1;
			this.direction = direction;
			setStateCode();
			
			for(int i=0; i<SIZE; i++) {
				if(state[i]==0) {
					this.movablePiecePoint = i;
					return;
				}
			}
			this.movablePiecePoint = -1;
		}
		
		public Puzzle (Puzzle parent, int nextMove){
			this.isRoot = false;
			this.depth = parent.depth+1;
			this.point = parent.movablePiecePoint;
			this.movablePiecePoint = nextMove;
			this.direction = parent.direction;
			
			this.state = Arrays.copyOf(parent.state, SIZE);
			this.state[this.point] = this.state[nextMove];
			this.state[nextMove] = 0;

			setStateCode();
		}
		
		private final void setStateCode() {
			for(int i=0; i<SIZE-1; i++) {
				int c = 0;
				for(int j=i+1; j<SIZE; j++) {
					if(this.state[i] > this.state[j]) {
						c++;
					}
				}
				this.stateCode += coefficients[i]*c;
			}
		}
	}
	
	private final int solve(int[] puzzle) {
		int[] isVisit = new int[50430];
		ArrayDeque<Puzzle> queue = new ArrayDeque<Puzzle>();
		queue.add(new Puzzle(puzzle, FORE_DIRECTION)); 
		queue.add(new Puzzle(ANSWER_STATE, BACK_DIRECTION));
		while(!queue.isEmpty()) {
			Puzzle now = queue.poll();
			if(now.stateCode==0 && now.direction==FORE_DIRECTION) {
				return now.depth;
			} else if(isVisit[now.stateCode]!=0 && isVisit[now.stateCode]*now.direction<0) {
				return now.depth + StrictMath.abs(isVisit[now.stateCode]);
			}
			for(int nextMove : MOVABLE_PAIRS[now.movablePiecePoint]) {
				if (now.isRoot || now.point!=nextMove) {
					queue.add(new Puzzle(now, nextMove));
				}
			}
			isVisit[now.stateCode] = now.direction*now.depth;
		}
		return -1;
	}
	
	public static void main(String[] args) {
		new Main();
	}
}

Compiler output:
Main.java:29: error: not a statement
- start);
^
Main.java:29: error: ';' expected
- start);
       ^
2 errors
Language: Java

package exp0121;

import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	private final static int SIZE = 8;
	
	private final static int[][] MOVABLE_PAIRS = {
		{1,4}, {0,2,5}, {1,3,6}, {2,7},
		{0,5}, {1,4,6}, {2,5,7}, {3,6}
	};
	
	private final static int[] coefficients = {5040, 720, 120, 24, 6, 2, 1, 0};

	private static final int[] ANSWER_STATE = {0,1,2,3,4,5,6,7};
	
	private static final int FORE_DIRECTION = 1;
	private static final int BACK_DIRECTION = -1;
	
	private Main3() {
		Scanner in = new Scanner(System.in);
		
		while(in.hasNext()) {
			int[] puzzle = new int[SIZE];
			for(int i=0; i<SIZE; i++) {
				puzzle[i] = in.nextInt();
			}
			System.out.println(solve(puzzle));
		}
		in.close();
	}
	
	final class Puzzle {
		final int[] state;
		final int depth; 
		final int movablePiecePoint;
		final int point;
		final boolean isRoot;
		int stateCode;
		final int direction;

		public Puzzle(int[] state, int direction) {
			this.isRoot = true;
			this.depth = 0;
			this.state = state;
			this.point = -1;
			this.direction = direction;
			setStateCode();
			
			for(int i=0; i<SIZE; i++) {
				if(state[i]==0) {
					this.movablePiecePoint = i;
					return;
				}
			}
			this.movablePiecePoint = -1;
		}
		
		public Puzzle (Puzzle parent, int nextMove){
			this.isRoot = false;
			this.depth = parent.depth+1;
			this.point = parent.movablePiecePoint;
			this.movablePiecePoint = nextMove;
			this.direction = parent.direction;
			
			this.state = Arrays.copyOf(parent.state, SIZE);
			this.state[this.point] = this.state[nextMove];
			this.state[nextMove] = 0;

			setStateCode();
		}
		
		private final void setStateCode() {
			for(int i=0; i<SIZE-1; i++) {
				int c = 0;
				for(int j=i+1; j<SIZE; j++) {
					if(this.state[i] > this.state[j]) {
						c++;
					}
				}
				this.stateCode += coefficients[i]*c;
			}
		}
		
		public String toString() {
			StringBuilder str = new StringBuilder("");
			for(int s:state) {
				str.append(s+" ");
			}
			return str.toString();
		}
	}

	private final int solve(int[] puzzle) {
		int[] isVisit = new int[50430];
		ArrayDeque<Puzzle> queue = new ArrayDeque<Puzzle>();
		queue.add(new Puzzle(puzzle, FORE_DIRECTION)); // 初期状態から
		queue.add(new Puzzle(ANSWER_STATE, BACK_DIRECTION)); // 完成形から
		while(!queue.isEmpty()) {
			Puzzle now = queue.poll();
			if(now.stateCode==0 && now.direction==FORE_DIRECTION) { // 初期状態から直接完成形にたどり着いた場合
				return now.depth;
			} else if(isVisit[now.stateCode]!=0 && isVisit[now.stateCode]*now.direction<0) { // 01234567のstateCodeは0
				return now.depth + StrictMath.abs(isVisit[now.stateCode]);
			}
			for(int nextMove : MOVABLE_PAIRS[now.movablePiecePoint]) {
				if (now.isRoot || now.point!=nextMove) { // 直前の状態に戻ることを禁止する
					queue.add(new Puzzle(now, nextMove));
				}
			}
			isVisit[now.stateCode] = now.direction*now.depth;
		}
		return -1;
	}
	
	public static void main(String[] args) {
		new Main();
	}
}

Compiler output:
Main.java:22: error: invalid method declaration; return type required
	private Main3() {
	        ^
1 error
Language: Java


import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class P0121_ {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;
	HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
	void run() {
		Scanner sc = new Scanner(System.in);
		pow = new int[8];
		pow[0] = 1;
		for (int i=1;i<8;i++) pow[i] = pow[i-1]*10;
		solve();
//		debug(map.size(), 2*3*4*5*6*7*8);
		for (;sc.hasNext();) {
			String num = "";
			for (int i=0;i<8;i++) {
				num += sc.nextInt();
			}
			System.out.println(map.get(Integer.parseInt(num)));
		}
	}

	void solve() {
		LinkedList<Integer> q = new LinkedList<Integer>();
		LinkedList<Integer> d = new LinkedList<Integer>();
		q.add(1234567);
		d.add(0);
		map.put(1234567,  0);
		while(!q.isEmpty()) {
			int cp = q.removeFirst(), cd = d.removeFirst();
//			debug(nextState(cp));
			for (int i: nextState(cp)) if (! map.containsKey(i)) {
				map.put(i, cd + 1);
				q.add(i); d.add(cd + 1);
			}
		}
	}
	
	int[] pow;
	int[] nextState(int s) {
		int p=0;
		String num = "" + s;
		if (num.length() == 7) p = 0;
		else for (;p<8;p++) if (num.charAt(p) == '0') break;
		p = 7-p;
		if (p == 1 || p == 2 || p == 5 || p == 6) {
			int[] next = new int[3];
			next[0] = swap(s, p, p-1);
			next[1] = swap(s, p, p+1);
			next[2] = swap(s, p, (p+4)%8);
			return next;
		}
		if (p == 0 || p == 4) {
			int[] next = new int[2];
			next[0] = swap(s, p, p+1);
			next[1] = swap(s, p, (p+4)%8);
			return next;
		}
		int[] next = new int[2];
		next[0] = swap(s, p, p-1);
		next[1] = swap(s, p, (p+4)%8);
		return next;
	}

	int swap(int a, int s, int t) {
		int tmp1 = (a / pow[s]) % 10;
		int tmp2 = (a / pow[t]) % 10;

		return a + (tmp2 - tmp1) * pow[s] + (tmp1 - tmp2) * pow[t];
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Compiler output:
Main.java:8: error: class P0121_ is public, should be declared in a file named P0121_.java
public class P0121_ {
       ^
Main.java:84: error: cannot access Main
		new Main().run();
		    ^
  bad source file: ./Main.java
    file does not contain class Main
    Please remove or make sure it appears in the correct subdirectory of the sourcepath.
2 errors
Language: C

//??-2015-11-8
# include <cstdio>
# include <algorithm>
# include <iostream>
# include <string>
# include <cstring>
# include <map>
# include <queue>

using namespace std;

int direction[4] = { -4, 4, -1, 1 };                   //4个方向，上下左右
map<string, int>dp;                                   //事先将?果保存在?里
void Bfs()
{
	string p = "01234567";
	queue<string>Q;
	Q.push(p);
	dp[p] = 0;                                          //在?个地方是不用??的

	while (!Q.empty())
	{
		printf("出不去\n");
		string q = Q.front();
		Q.pop();
		int v,w,i,j;
		for (v = 0; v < q.length(); v++)
		{
			if (q[v] == '0')
			{
				w = v;                                       //??0的位置，然后以他?中心?行走?
				break;
			}
		}
		for (i = 0; i < 4; i++)
		{
			string temp2 = q;
			int r = w + direction[i];
			if (r >= 0 && r < 8 && !(w == 3 && i == 3) && !(w == 4 && i == 2))         //特?看清楚?个限制条件
			{
				char c;                                                                //交?位置
				c = temp2[r];
				temp2[r] = temp2[w];
				temp2[w] = c;
				//必?要是map中没有的，?才??列，要不永不停止
				if (dp.find(temp2) == dp.end())                        //没找到,一定要想?法知道是否已??找?
				{
					Q.push(temp2);
					dp[temp2] = dp[q] + 1;
				}
			}
		}
	}
}
int main(void)
{
	//freopen("in.txt", "r", stdin);
	string s;
	Bfs();
	while (getline(cin, s))
	{
		int i;
		string temp;
		for (i = 0; i < s.length(); i++)
		{
			if (s[i] != ' ')
				temp.push_back(s[i]);
		}
		cout << dp[temp] << endl;
	}
	return 0;
}

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

#include<cstdio>
#include<map>
#include<queue>
using namespace std;
map<int,bool>p;
map<int,int>ans;
int a[10],b[10],dr[4]={1,-1,4,-4};
struct nde
{
	int x,c,t;
}f,g;
queue<nde>q;
int main()
{
	int i,j,k;
	while(scanf("%d",&a[1])==1)
	{
		while(!q.empty()) q.pop();
		p.clear();
		f.t=0;
		for(i=2;i<=8;i++) 
		{
			scanf("%d",&a[i]);
			if(!a[i]) f.x=i;
		}
		for(i=1,j=1,f.c=0;i<=8;i++,j*=10) f.c+=a[i]*j;
		if(ans[f.c]) {printf("%d\n",ans[f.c]);continue;}
		q.push(f);
		while(!q.empty())
		{
			g=q.front();q.pop();
			if(g.c==76543210) {printf("%d\n",g.t);ans[g.c]=g.t;break;}
			p[g.c]=1;
			int r=g.c;
			for(j=1;j<=8;r/=10,j++)
				b[j]=r%10;
			for(i=0;i<4;i++)
			{
				f.x=g.x+dr[i];f.t=g.t+1;
				if(f.x<=0||f.x>8||(f.x==4&&dr[i]==-1)||(f.x==5&&dr[i]==1)) continue;
				int t=b[f.x];b[f.x]=b[g.x];b[g.x]=t;
				for(j=1,k=1,f.c=0;j<=8;j++,k*=10) f.c+=b[j]*k;
				if(p[f.c]) {t=b[f.x];b[f.x]=b[g.x];b[g.x]=t;continue;}
				if(f.c==76543210) {printf("%d\n",f.t);break;}
				p[f.c]=1;q.push(f);
				t=b[f.x];b[f.x]=b[g.x];b[g.x]=t;
			}
			if(f.c==76543210||g.c==76543210) break; 
		}
	}
}

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

#include<iostream>
#include<cstdio>
#include<queue>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>

using namespace std;

#define maxn 305

int map[3][5];

int main()
{
	int i,j;
cin>>i;
cout<<1<<endl;


	return 0;
}



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

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>

using namespace std;

typedef pair<string, int> P;

vector<string> make(string str) {
	vector<string> ret;

	int pos;
	for (int i = 0; i < str.size(); ++i)
		if (str[i] == '0') pos = i;

	vector<int> v;
	if (pos % 4 != 3) v.push_back( pos+1 );
	if (pos % 4 != 0) v.push_back( pos-1 );
	if (pos < 4) v.push_back( pos+4 );
	else v.push_back( pos-4 );

	for (int i = 0; i < v.size(); ++i) {
		string s = str;
		swap(s[pos], s[v[i]]);
		ret.push_back(s);
	}

	return ret;
}

int main() {
	while (1) {
		string str;
		for (int i = 0; i < 8; ++i) {
			int a; if ( !(cin >> a) ) return 0;
			str += a + '0';
		}

		queue<P> Q; Q.push( P(str, 0) );
		map<string, bool> m;
		while ( !Q.empty() ) {
			P p = Q.front(); Q.pop();
			string str = p.first;
			int step = p.second;

			if (m[str]) continue;
			m[str] = true;

			if (str == "01234567") {
				cout << step << endl;
				break;
			}

			vector<string> v = make(str);
			for (int i = 0; i < v.size(); ++i)
				Q.push( P(v[i], step+1) );
		}
	}
}

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

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstdio>
#include <queue>

using namespace std;

typedef pair<string, int> P;

string String(vector<int> v) {
	string ret = "";
	for (int i = 0; i < v.size(); ++i)
		ret += v[i] + '0';

	return ret;
}

int main() {
	map<string, int> steps;
	queue<P> Q; Q.push( P("01234567", 0) );

	while ( !Q.empty() ) {
		P p = Q.front(); Q.pop();
		string str = p.first;
		int step = p.second;

		if (steps[str]) continue;
		steps[str] = step+1;

		int pos = -1;
		for (int i = 0; i < 8; ++i)
			if (str[i] == '0') pos = i;

		string next = str;

		if (pos > 3) swap(next[pos], next[pos-4]);
		else swap(next[pos], next[pos+4]);

		Q.push( P(next, step+1) ); next = str;

		if (pos % 4 != 0) { swap(next[pos], next[pos-1]); Q.push( P(next, step+1) ); next = str; }
		if (pos % 4 != 3) { swap(next[pos], next[pos+1]); Q.push( P(next, step+1) ); next = str; }
	}

	int a;
	while (scanf("%d", &a) != EOF) {
		vector<int> now(8, a);
		for (int i = 1; i < 8; ++i) cin >> now[i];
		cout << (steps[String(now)]-1) << endl;
	}
}

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

#include <cstdio>
#include <queue>
#include <complex>
#include <algorithm>
using namespace std;

const int MAX_PTN = 76543211;

struct state {
  int i;
  int n;
  int t;
  state(int i, int n, int t) : i(i), n(n), t(t) {}
};

bool done[MAX_PTN];
int zi, n;

int di[4] = {4, -4, 1, -1};

int make_nextnum(state cur, int nexti)
{
  int nd = (cur.n / (int)pow(10, 7 - nexti)) % 10;
  int ret = cur.n + nd * (int)pow(10, 7 - cur.i) - nd * (int)pow(10, 7 - nexti);
  return ret;
}

int bfs()
{
  queue<state> que;
  que.push(state(zi, n, 0));
  memset(done, false, sizeof done);
  done[n] = true;

  while (!que.empty()) {
    state s = que.front(); que.pop();

    if (s.n == 1234567) return s.t;

    for (int i = 0; i < 4; i++) {
      int ni = s.i + di[i];
      int nn;

      if (s.i == 3 && di[i] == 1) continue;
      if (s.i == 4 && di[i] == -1) continue;
      if (ni < 0 || 7 < ni) continue;

      nn = make_nextnum(s, ni);

      if (done[nn]) continue;

      done[nn] = true;
      que.push(state(ni, nn, s.t + 1));
    }
  }

  return -1;
}

int solve()
{
  return bfs();
}

int main()
{

  while (true) {
    char s[32];
    int d = 10000000;

    fgets(s, 31, stdin);
    if (s[0] < '0' || '9' < s[0]) break;

    n = 0;
    for (int i = 0; i < 8; i++) {
      int a;
      a = s[2 * i] - '0';
      n += a * d;
      d /= 10;

      if (a == 0) { zi = i; }
    }

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

  return 0;
}


Compiler output:
a.cc: In function 'int bfs()':
a.cc:32:3: error: 'memset' was not declared in this scope
   32 |   memset(done, false, sizeof done);
      |   ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <algorithm>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
  int paSize = printArray.size();
  for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
  if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

bool check(vector<int> v) {
  for (int i = 0; i < v.size(); i++) {
    if (v[i] != i) {
      return false;
    }
  }
  return true;
}

int bfs(vector<int> v) {
  queue<vector<int>> que;
  que.push(v);
  map<vector<int>, int> mp;
  mp[v] = 0;

  int ans = -1;
  while (que.size()) {
    vector<int> t = que.front(); que.pop();
    初手に戻ったかチェックする
    if (check(t)) {
      ans = mp[t];
      break;
    }

    // 0の位置を求める
    int zeroPos = 0;
    for (int i = 0; i < t.size(); i++) {
      if (t[i] == 0) zeroPos = i;
    }

    int y = zeroPos / 4, x = zeroPos % 4;
    for (int i = 0; i < 4; i++) {
      int ny = y + dy[i], nx = x + dx[i];
      if (ny < 0 || ny >= 2 || nx < 0 || nx >= 4) continue;
      vector<int> tt = t;
      int pos = y * 4 + x, npos = ny * 4 + nx;
      swap(tt[pos], tt[npos]);
      if (mp.count(tt)) continue;
      mp[tt] = mp[t] + 1;
      que.push(tt);
    }
  }

  return ans;
}

signed main() {
  string s;
  vector<int> v;
  while (getline(cin, s)) {
    for (int i = 0; i < s.size(); i+=2) {
      v.push_back(s[i] - '0');
    }
    cout << bfs(v) << endl;
  }

  return 0;
}


Compiler output:
a.cc: In function 'long long int bfs(std::vector<long long int>)':
a.cc:52:5: error: '\U0000521d\U0000624b\U0000306b\U0000623b\U00003063\U0000305f\U0000304b\U000030c1\U000030a7\U000030c3\U000030af\U00003059\U0000308b' was not declared in this scope
   52 |     初手に戻ったかチェックする
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

bool acceptable(int** p) {
  for (int j = 0; j < 2; j++)
    for (int i = 0; i < 4; i++)
      if (p[i][j] != j * 4 + i) return false;

  return true;
}

int** move_0_up(int** p) {
  int val[4][2];

  for (int j = 0; j < 2; j++)
    for (int i = 0; i < 4; i++)
      val[i][j] = p[i][j];

  int x, y;
  for (int j = 0; j < 2; j++) {
    for (int i = 0; i < 4; i++) {
      if (p[i][j] == 0) {
        x = i; y = j;
      }
    }
  }

  val[x][y] = p[x][(y == 0)? 1:0];
  val[x][(y == 0)? 1:0] = 0;

  return val;
}

int** move_0_right(int** p) {
  int val[4][2];

  for (int j = 0; j < 2; j++)
    for (int i = 0; i < 4; i++)
      val[i][j] = p[i][j];

  int x, y;
  for (int j = 0; j < 2; j++) {
    for (int i = 0; i < 4; i++) {
      if (p[i][j] == 0) {
        x = i; y = j;
      }
    }
  }

  if (x == 3) return val;

  val[x][y] = p[x+1][y]

Compiler output:
a.cc: In function 'int** move_0_up(int**)':
a.cc:32:10: error: cannot convert 'int (*)[2]' to 'int**' in return
   32 |   return val;
      |          ^~~
      |          |
      |          int (*)[2]
a.cc: In function 'int** move_0_right(int**)':
a.cc:51:22: error: cannot convert 'int (*)[2]' to 'int**' in return
   51 |   if (x == 3) return val;
      |                      ^~~
      |                      |
      |                      int (*)[2]
a.cc:53:24: error: expected ';' at end of input
   53 |   val[x][y] = p[x+1][y]
      |                        ^
      |                        ;
a.cc:53:24: error: expected '}' at end of input
a.cc:35:29: note: to match this '{'
   35 | int** move_0_right(int** p) {
      |                             ^
Language: C++

#include <iostream>
#include <vector>
#include <map>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
static const int INF=1<<24;
map<vector<vector<int> >,int> ma;
vector<vector<int> > puz;
vector<vectr<int> > v;
template<class T>
void initvv(vector<vector<T> > &v,int a,int b,const T &t=T()){
	v.assign(a,vector<T>(b,t));
}


int solve(int c){
	if(v==puz) return c;
	if(ma[v]) return ma[v];
	int t=INF;
	rep(i,4){
		if(v[0][i]==0){
			if(i>=1){
				swap(v[0][i-1],v[0][i]);
				t=min(t,solve()
			}
		}
	}
}


int main(){
	initvv(puz,2,4);
	rep(i,4){
		// cout<<i<<endl;
		puz[0][i]=i;
		puz[1][i]=i+4;
	}
	// rep(i,2){
		// rep(j,4){
			// cout<<puz[i][j]<<endl;
		// }
	// }
	// vector<vector<int> > v;
	initvv(v,2,4);
	while(cin>>v[0][0]){
		rep(i,3){
			cin>>v[0][i+1];
		}
		rep(i,4) cin>>v[1][i];
		cout<<solve(0)<<endl;
	}
}

Compiler output:
a.cc:11:8: error: 'vectr' was not declared in this scope; did you mean 'qecvt_r'?
   11 | vector<vectr<int> > v;
      |        ^~~~~
      |        qecvt_r
a.cc:11:17: error: template argument 1 is invalid
   11 | vector<vectr<int> > v;
      |                 ^
a.cc:11:17: error: template argument 2 is invalid
a.cc:11:19: error: expected unqualified-id before '>' token
   11 | vector<vectr<int> > v;
      |                   ^
a.cc: In function 'int solve(int)':
a.cc:19:12: error: 'v' was not declared in this scope
   19 |         if(v==puz) return c;
      |            ^
a.cc:20:15: error: 'v' was not declared in this scope
   20 |         if(ma[v]) return ma[v];
      |               ^
a.cc:23:20: error: 'v' was not declared in this scope
   23 |                 if(v[0][i]==0){
      |                    ^
a.cc:26:46: error: too few arguments to function 'int solve(int)'
   26 |                                 t=min(t,solve()
      |                                         ~~~~~^~
a.cc:18:5: note: declared here
   18 | int solve(int c){
      |     ^~~~~
a.cc: In function 'int main()':
a.cc:46:16: error: 'v' was not declared in this scope
   46 |         initvv(v,2,4);
      |                ^
Language: C++

#include<iostream>
#include<queue>
#include<algorithm>
using namespace std;
int vis[17000000];
int temp[10];
int s;
int dir[4]={-1,1,4,-4};
struct Node
{
    int x;
	int line;
    int step;
    friend bool operator <(Node a, Node b)
    {
        return a.step>b.step;
    }
};
void BFS(int x,int s)
{
    priority_queue<Node> Q;
    Node p,q;
    int k,t,i;
    p.x=x;
    p.step=0;
	p.line=s;
    Q.push(p);
    while(!Q.empty())
    {
		q=Q.top();
		Q.pop();
		if(q.line==342391)
		{
			printf("%d\n",q.step);
			return ;
		}
		
		for(k=0;k<4;k++)
		{
			p.x=q.x+dir[k];
			if(p.x>8||p.x<=0||(p.x==5&&(q.x==4||q.x==6)))
				continue;
			t=q.line;
			for(i=8;i>=1;i--)
			{
				temp[i]=t%8;
				t=t>>3;
			}
			p.line=0;
			for(i=1;i<=8;i++)
			{
				if(i==p.x)
				{
					p.line=(p.line<<3)+temp[q.x];
				}
				else if(i==q.x)
				{
					p.line=(p.line<<3)+temp[p.x];
				}
				else
				{
					p.line=(p.line<<3)+temp[i];
				}
			}
			if(vis[p.line])
				continue;
			vis[p.line]=1;
			p.step=q.step+1;
			Q.push(p);
		}
    }
    printf("-1\n");
}
int main()
{
	int k=0;
	int t;
    while(scanf("%d",&t)!=EOF)
	{
		k=(k<<3)+t;
		memset(vis,0,sizeof(vis));
		if(t==0)
			s=1;
		for(int i=2;i<=8;i++)
		{
			scanf("%d",&t);
			if(t==0)
				s=i;
			k=(k<<3)+t;
		}
		vis[k]=1;
		BFS(s,k);
		k=0;
	}
    return 0;
} 

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

import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);

	HashMap<String, Integer> map;
	LinkedList<String> que;

	void run() {
		map = new HashMap<String, Integer>();
		que = new LinkedList<String>();
		int cnt = 0;
		que.add("01234567");
		map.put("01234567", cnt);
		while (!que.isEmpty()) {
			cnt++;
			int size = que.size();
			for (int i = 0; i < size; i++) {
				String now = que.poll();
				int zero = now.indexOf('0');
				if (zero != 0 && zero != 4) {
					char[] next = now.toCharArray();
					char t = next[zero - 1];
					next[zero] = t;
					next[zero - 1] = '0';
					setParam(next, cnt);
				}
				if (zero != 3 && zero != 7) {
					char[] next = now.toCharArray();
					char t = next[zero + 1];
					next[zero] = t;
					next[zero + 1] = '0';
					setParam(next, cnt);
				}
				char[] next = now.toCharArray();
				char t = next[(zero + 4) % 8];
				next[zero] = t;
				next[(zero + 4) % 8] = '0';
				setParam(next, cnt);
			}
		}
		while (sc.hasNext()) {
			String key = "";
			for (int i = 0; i < 8; i++) {
				key += sc.nextInt();
			}
			System.out.println(map.get(key));
		}
	}

	void setParam(char[] next, int cnt) {
		String nextS = String.valueOf(next);
		if (!map.containsKey(nextS)) {
			map.put(nextS, cnt);
			que.add(nextS);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Arrays;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.HashMap;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.LinkedList;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.Scanner;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: expected unqualified-id before 'public'
    6 | public class Main {
      | ^~~~~~
Language: C++

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

int main()
{
string a;
cin >> a
cout << a << endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: expected ';' before 'cout'
    8 | cin >> a
      |         ^
      |         ;
    9 | cout << a << endl;
      | ~~~~
Language: C++

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

typedef struct node {
	int seq[8];
	int id;
	int s;
	int step;
} item;

int idBox[40400];
int idCnt;

int dmove[] = {-1, -4, +1, +4};
int ans[] = {0,1,2,3,4,5,6,7};

int bfs(item n);
bool isUnique(int id);


int main() {
	while (1) {
		item start;
		start.step = 0;
		
		for (int i = 0; i<8; i++) {
			if (scanf("%d", &start.seq[i])==EOF) return 0;
			if (start.seq[i]==0) start.s = i;
		}
		for (int i = 0; i<8; i++)
			start.id = start.id*10+start.seq[i];
		isUnique(start.id);
		
		cout<<bfs(start)<<endl;
		
		
		memset(idBox, 0, sizeof(idBox));
		idCnt = 0;
	}
	
	return 0;
}


bool isUnique(int id) {
	//??????idBox????????????id??????????°±??????id??°idBox???

	for (int i = 0; i<idCnt; i++)
		if (id==idBox[i]) return false;
	idBox[idCnt++] = id;
	return true;
}

int bfs(item n) {
	queue<item> Q;
	Q.push(n);
	
	while (Q.size()) {
		item now = Q.front();
		Q.pop();
		if (memcmp(ans, now.seq, sizeof(ans))==0)
			return now.step;
		
		for (int i = 0; i<4; i++) {
			int ns = now.s + dmove[i];
			if (ns>=0 && ns<=7 && !(now.s==3 && ns==4) && !(now.s==4 && ns==3)) {
				item tmp;//???????????¨????????????????????°????????????????\????
				memset(&tmp, 0, sizeof(tmp));
				for (int i = 0; i<8; i++)
					tmp.seq[i] = now.seq[i];
				tmp.seq[ns] = now.seq[now.s];
				tmp.seq[now.s] = now.seq[ns];

				//?????¢0???ns???????????°??????
				for (int i = 0; i<8; i++) 
					tmp.id = tmp.id*10+tmp.seq[i];
				//??????id
				tmp.s = ns; tmp.step = now.step+1;
				//??????????????¶????????°
				if (isUnique(tmp.id)) Q.push(tmp);
			}
		}
		
	}
	return -1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:17: error: 'memset' was not declared in this scope
   40 |                 memset(idBox, 0, sizeof(idBox));
      |                 ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <queue>
  +++ |+#include <cstring>
    5 | using namespace std;
a.cc: In function 'int bfs(item)':
a.cc:64:21: error: 'memcmp' was not declared in this scope
   64 |                 if (memcmp(ans, now.seq, sizeof(ans))==0)
      |                     ^~~~~~
a.cc:64:21: note: 'memcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:71:33: error: 'memset' was not declared in this scope
   71 |                                 memset(&tmp, 0, sizeof(tmp));
      |                                 ^~~~~~
a.cc:71:33: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
 
using namespace std;


 
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
 

 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;



const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-7;

vi d(8, 0), t;
vi a(8, 0);

set<vi> s;
pair<int ,vi> p;

int ans = 0;
int c;

bool check(vi v){
	for(int i = 0; i < 8; i++){
		if(v[i]!=i) return false; 
	}
	return true;
}

int main(){
	rep(i, 8) a[i]=i;
	int cnt = 0;
	while(/*cin>>d[0]*/scanf("%d", &d[i])!=EOF){
		//rep(i, 7) cin>>d[i+1];
		rep(i, 7){
			scanf("%d", &d[i+1]);
		}
		s.clear();
		queue<pair<int ,vi> > q;
		q.push(mp(0, d));
		s.insert(d);
		cnt = 0;
		while(!q.empty()){
		//cout<<cnt++<<endl;
			cnt++;
			p = q.front(); q.pop();
			c = p.fi;
			t = p.se;
			// if(cnt == 0){
			// 	for(int i = 0; i < 8; i++){
			// 		cout<<" "<<t[i];
			// 	}
			// 	cout<<endl;
			// }
			if(check(t)){
				//cout<<c<<endl;
				printf("%d\n", c);
				break;
			}
			for(int i = 0; i < 8; i++){
				//cout<<" "<<i<<endl;
				if(p.se[i] == 0){
					if(i%4!=0){
						t = p.se;
						swap(t[i], t[i-1]);
						if(s.count(t)==0){
							q.push(mp(c+1, t));
							s.insert(t);
						}
					}
					if(i%4!=3){
						t = p.se;
						swap(t[i], t[i+1]);
						if(s.count(t)==0){
							q.push(mp(c+1, t));
							s.insert(t);
						}
					}
					if(i/4==0){
						t = p.se;
						swap(t[i], t[i+4]);
						if(s.count(t)==0){
							q.push(mp(c+1, t));
							s.insert(t);
						}
					}
					else{
						t = p.se;
						swap(t[i], t[i-4]);
						if(s.count(t)==0){
							q.push(mp(c+1, t));
							s.insert(t);
						}
					}
					break;
				}
			}
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:43: error: 'i' was not declared in this scope; did you mean 'vi'?
   68 |         while(/*cin>>d[0]*/scanf("%d", &d[i])!=EOF){
      |                                           ^
      |                                           vi
Language: C++

// test.cpp : 定?控制台?用程序的入口点。
//

#include "stdafx.h"

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

int a[8] = {0};
int direction[4][2] = {{-1,0},{1,0},{0,-1},{0,1}};
map<int,int> exitmap;

struct array{
	int map[2][4];
	int step;
};

bool isInMap(int x,int y){
	if(x<0 || x>=2)return 0;
	if(y<0 || y>=4)return 0;
	else return 1;
}

void bfs(){
	array begin = {{0,1,2,3,4,5,6,7},0};
	queue<array> que;
	que.push(begin);
	exitmap.insert(make_pair(1234567,0));
	while(!que.empty()){
		int x,y;
		array temp = que.front();
		que.pop();
		for(int i = 0; i < 2; i++)
			for(int j = 0; j < 4; j++)
				if(temp.map[i][j] == 0)
				{x = i;y = j;}
		for(int k = 0; k < 4; k++)
		{
			if(isInMap(x+direction[k][0],y+direction[k][1])){
				array newarray = temp;
				int r = newarray.map[x][y];
				newarray.map[x][y] = newarray.map[x+direction[k][0]][y+direction[k][1]];
				newarray.map[x+direction[k][0]][y+direction[k][1]] = r;
				newarray.step = temp.step + 1;
				int num = 0;
				for(int i = 0; i < 2; i++)
					for(int j = 0; j < 4; j++)
						num = num * 10 + newarray.map[i][j];
				if(exitmap.find(num) == exitmap.end())
				{
					que.push(newarray);
					exitmap.insert(make_pair(num,newarray.step));
				}

			}
		}

	}

}

int main(){
	bfs();
	int temp;
	 while (~scanf("%d",&temp))  
    {  
		int num = temp;
		for(int i = 1; i < 8; i++)
		{
			scanf("%d",&temp);
			num = num * 10 + temp;
		}
		printf("%d\n",exitmap[num]);
       
    }  
	return 0;		
}

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

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

typedef pair<string, int> P;
map<string, int> m;

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

	queue<P> q;
	q.push(P("01234567", 0));
	m["01234567"] = 0;
	while(!q.empty()) {
		P p = q.front();
		q.pop();
		if(m[p.first] != p.second) continue;
		string s = p.first;
		int d[] = { 1, -1 4, -4 };
		for(int i = 0; i < 8; i++) {
			if(s[i] != '0') continue;
			for(int j = 0; j < 4; j++) {
				if(i + d[j] < 0 || 8 <= i + d[j]) continue;
				if(d[j] == 1 && i == 3) continue;
				swap(s[i], s[i + d[j]]);
				if(m.find(s) == m.end() || p.second + 1 < m[s]) {
					m[s] = p.second + 1;
					q.push(P(s, p.second + 1));
				}
				swap(s[i], s[i + d[j]]);
			}
		}
	}

	string s;
	while(getline(cin, s)) {
		string ss;
		for(int i = 0; i < 8; i++) {
			ss += s[2 * i];
		}
		cout << m[ss] << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:35: error: expected '}' before numeric constant
   23 |                 int d[] = { 1, -1 4, -4 };
      |                           ~       ^
a.cc:23:35: error: expected ',' or ';' before numeric constant
a.cc:25:28: error: 's' was not declared in this scope
   25 |                         if(s[i] != '0') continue;
      |                            ^
a.cc:27:40: error: 'd' was not declared in this scope
   27 |                                 if(i + d[j] < 0 || 8 <= i + d[j]) continue;
      |                                        ^
a.cc:28:36: error: 'd' was not declared in this scope
   28 |                                 if(d[j] == 1 && i == 3) continue;
      |                                    ^
a.cc:29:38: error: 's' was not declared in this scope
   29 |                                 swap(s[i], s[i + d[j]]);
      |                                      ^
a.cc:29:50: error: 'd' was not declared in this scope
   29 |                                 swap(s[i], s[i + d[j]]);
      |                                                  ^
a.cc:30:60: error: 'p' was not declared in this scope
   30 |                                 if(m.find(s) == m.end() || p.second + 1 < m[s]) {
      |                                                            ^
a.cc: At global scope:
a.cc:40:9: error: expected unqualified-id before 'while'
   40 |         while(getline(cin, s)) {
      |         ^~~~~
a.cc:47:1: error: expected declaration before '}' token
   47 | }
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
	map<vector<int>, int>MVII;
	vector<int>D(8);
for(int i = 0;i < 8; i++){
	D[i]=i;
}

queue<vector<int>>que;
que.push(D);
while(que.size()){
	auto now = que.front(); que.pop();

	for(int i = 0;i < 4; i++){
	auto E = now;
	swap(E[i], E[i+4]);
	if(MVII[E]==0){
	MVII[E]=MVII(now)+1;
	que.push(E);
}
	}
for(int i = 0; i < 3; i++){
for(int j = 0; j < 2; j++){
auto E = now;
swap(E[j*4+i],E[j*4+i+1]);
	if(MVII[E]==0){
	MVII[E]=MVII(now)+1;
	que.push(E);
}
}
}
while(cin>>D[0]){
	for(int i = 1;i<8;i++){
	cin>>D[i];
}
cout<<MVII[D]<<endl;
}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:21: error: no match for call to '(std::map<std::vector<int>, int>) (std::vector<int>&)'
   21 |         MVII[E]=MVII(now)+1;
      |                 ~~~~^~~~~
a.cc:30:21: error: no match for call to '(std::map<std::vector<int>, int>) (std::vector<int>&)'
   30 |         MVII[E]=MVII(now)+1;
      |                 ~~~~^~~~~
a.cc:42:2: error: expected '}' at end of input
   42 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
	map<vector<int>, int>MVII;
	vector<int>D(8);
for(int i = 0;i < 8; i++){
	D[i]=i;
}

queue<vector<int>>que;
que.push(D);
while(que.size()){
	vector<int> now = que.front(); que.pop();

	for(int i = 0;i < 4; i++){
	auto E = now;
	swap(E[i], E[i+4]);
	if(MVII[E]==0){
	MVII[E]=MVII(now)+1;
	que.push(E);
}
	}
for(int i = 0; i < 3; i++){
for(int j = 0; j < 2; j++){
auto E = now;
swap(E[j*4+i],E[j*4+i+1]);
	if(MVII[E]==0){
	MVII[E]=MVII(now)+1;
	que.push(E);
}
}
}
while(cin>>D[0]){
	for(int i = 1;i<8;i++){
	cin>>D[i];
}
cout<<MVII[D]<<endl;
}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:21: error: no match for call to '(std::map<std::vector<int>, int>) (std::vector<int>&)'
   21 |         MVII[E]=MVII(now)+1;
      |                 ~~~~^~~~~
a.cc:30:21: error: no match for call to '(std::map<std::vector<int>, int>) (std::vector<int>&)'
   30 |         MVII[E]=MVII(now)+1;
      |                 ~~~~^~~~~
a.cc:42:2: error: expected '}' at end of input
   42 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
	map<vector<int>, int>MVII;
	vector<int>D(8);
for(int i = 0;i < 8; i++){
	D[i]=i;
}

queue<vector<int>>que;
que.push(D);
while(que.size()){
	vector<int> now = que.front(); que.pop();

	for(int i = 0;i < 4; i++){
	auto E = now;
	swap(E[i], E[i+4]);
	if(MVII[E]==0){
	MVII[E]=MVII[now]+1;
	que.push(E);
}
	}
for(int i = 0; i < 3; i++){
for(int j = 0; j < 2; j++){
auto E = now;
swap(E[j*4+i],E[j*4+i+1]);
	if(MVII[E]==0){
	MVII[E]=MVII[now]+1;
	que.push(E);
}
}

while(cin>>D[0]){
	for(int i = 1;i<8;i++){
	cin>>D[i];
}
cout<<MVII[D]<<endl;
}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:2: error: expected '}' at end of input
   42 | }
      |  ^
a.cc:14:18: note: to match this '{'
   14 | while(que.size()){
      |                  ^
a.cc:42:2: error: expected '}' at end of input
   42 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <cstdio>
#include <set>
#include <vector>
#include <ctype.h>
#include <iostream>
#include <<algorithm>

bool is_find(std::vector<int> pieace,std::vector<int> cadidate)
{
	for(int i=0;i<8;i++)
		if(pieace[i]!=cadidate[i]) return false;
	return true;
}
int solve(std::vector<int> init_pieace)
{
	int total_step = 0;
	std::vector<int> target_list = {0,1,2,3,4,5,6,7};

	std::set<std::vector<int>> frontier;
	frontier.insert(init_pieace);

	std::set<std::vector<int>> previous_frontier;
	int step = 0;
	while(true)
	{
		std::set<std::vector<int>> next_frontier;
		for(auto p : frontier)
		{
			if(is_find(target_list,p)) return step;
			int zero_position=0;
			for(int i=0;i<8;i++)
			{
				if(p[i]==0)
				{
					zero_position = i;
					break;
				}
			}
			int relative = zero_position%4;

			std::vector<int> new_peiace=p;
			int swap = new_peiace[relative];
			new_peiace[relative] = new_peiace[relative+4];
			new_peiace[relative+4] = swap;
			if(std::find(previous_frontier.begin(), previous_frontier.end(), new_peiace) == previous_frontier.end())
				next_frontier.insert(new_peiace);

			if(0<=relative && relative<3)
			{
				std::vector<int> new_peiace=p;
				int swap = new_peiace[zero_position];
				new_peiace[zero_position] = new_peiace[zero_position+1];
				new_peiace[zero_position+1] = swap;
				if(std::find(previous_frontier.begin(), previous_frontier.end(), new_peiace) == previous_frontier.end())
					next_frontier.insert(new_peiace);
			}

			if(0<relative && relative<=3)
			{
				std::vector<int> new_peiace=p;
				int swap = new_peiace[zero_position];
				new_peiace[zero_position] = new_peiace[zero_position-1];
				new_peiace[zero_position-1] = swap;
				if(std::find(previous_frontier.begin(), previous_frontier.end(), new_peiace) == previous_frontier.end())
					next_frontier.insert(new_peiace);
			}
		}
		previous_frontier = frontier;
		frontier = next_frontier;
		step++;
	}
}
int main()
{
	char cline[16];
	std::cin.getline(cline, sizeof(cline));
	while(0<=cline[0]-'0' && cline[0]-'0'<8)
	{
		std::vector<int> pieace(8);
		int cp = 0;
		for(int i=0;i<16;i++)
			if(isdigit(cline[i]))
				pieace[cp++]=cline[i]-'0';
		std::cout << solve(pieace) << std::endl;
		std::cin.getline(cline, sizeof(cline));
	}
}

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

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <set>
#include <utility>
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;

typedef pair<string,int> P;
string str;
map<string,int> table;
int dir[]= {-1,1,-4,4}; //移?方向
void bfs()
{
    queue<P> q;
    string s,s_next;
    P temp;
    int cur,next;
    q.push(P("01234567",0));
    table["01234567"]=0;
    while(!q.empty())
    {
        temp=q.front();
        q.pop();
        s=temp.first;
        cur=temp.second;
        for(int i=0; i<4; i++)//将0向四个方向移?
        {
            next=cur+dir[i];
            str=s;
            swap(str[cur],str[next]);
            if(next>=0&&next<8&&!(cur==3&&next==4)&&!(cur==4&&next==3)&&table.find(str)==table.end())
            {                           //判断移?是否合法及?状?是否已存在
                table[str]=table[s]+1;
                q.push(P(str,next));
            }
        }
    }
}
int main()
{
    //freopen("input.txt","r",stdin);
    char sstr[50];
    bfs();
    while(gets(sstr))
    {
        for(int i=1; i<8; i++)
            sstr[i]=sstr[i*2];
        sstr[8]='\0';
        str=sstr;
        printf("%d\n",table[str]);
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:11: error: 'gets' was not declared in this scope; did you mean 'getw'?
   54 |     while(gets(sstr))
      |           ^~~~
      |           getw
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <set>
#include <utility>
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;

typedef pair<string,int> P;
string str;
map<string,int> table;
int dir[]= {-1,1,-4,4}; //移?方向
void bfs()
{
    queue<P> q;
    string s,s_next;
    P temp;
    int cur,next;
    q.push(P("01234567",0));
    table["01234567"]=0;
    while(!q.empty())
    {
        temp=q.front();
        q.pop();
        s=temp.first;
        cur=temp.second;
        for(int i=0; i<4; i++)//将0向四个方向移?
        {
            next=cur+dir[i];
            str=s;
            swap(str[cur],str[next]);
            if(next>=0&&next<8&&!(cur==3&&next==4)&&!(cur==4&&next==3)&&table.find(str)==table.end())
            {                           //判断移?是否合法及?状?是否已存在
                table[str]=table[s]+1;
                q.push(P(str,next));
            }
        }
    }
}
int main()
{
    //freopen("input.txt","r",stdin);
    char sstr[50];
    bfs();
    while(gets(sstr))
    {
        for(int i=1; i<8; i++)
            sstr[i]=sstr[i*2];
        sstr[8]='\0';
        str=sstr;
        printf("%d\n",table[str]);
    }
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:11: error: 'gets' was not declared in this scope; did you mean 'getw'?
   54 |     while(gets(sstr))
      |           ^~~~
      |           getw