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

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
#include <cmath>
#include <numeric>
#include <map>

using namespace std;
typedef long long int lint;

void AOJ0119()
{
	int m, n, x, y;
	cin >> m >> n;

	//??£??\?????????
	vector< vector< int > >	list(m + 1);

	for (int i = 0; i < n; i++) {
		cin >> x >> y;
		list[x].push_back(y);
	}

	//L ??? ??????????????????????????????????????????????????????????????????
	vector< int > L;
	//S ??? ??\???????????????????????????????????????????????????
	vector< int > S;

	//??\???????????¨??????????????°
	bool* flag = new bool[m + 1];
	for (int i = 1; i <= m; i++) {
		flag[i] = true;
	}

	for (int i = 1; i <= m; i++) {
		for (auto itr = list[i].begin(); itr != list[i].end(); itr++) {
			flag[*itr] = false;
		}
	}

	for (int i = 1; i <= m; i++) {
		if (flag[i]) {
			S.push_back(i);
		}
	}

	while (!S.empty()) {
		int a = S.back();
		L.push_back(a);
		S.pop_back();
		//foreach a ???????????? e ??¨????????????????????? b do
		while (!list[a].empty()) {
			int b = list[a].back();
			list[a].pop_back();
			bool found = false;
			for (int i = 1; i <= m; i++) {
				if (find(list[i].begin(), list[i].end(), b) != list[i].end()) {
					found = true;
					break;
				}
			}
			if (!found) {
				S.push_back(b);
			}
		}
	}

	for (auto itr = L.begin(); itr != L.end(); itr++) {
		cout << *itr << endl;
	}

	delete[] flag;

	return;
}

int main()
{
	AOJ0119();
	return 0;
}

Compiler output:
a.cc: In function 'void AOJ0119()':
a.cc:67:41: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   67 |                                 if (find(list[i].begin(), list[i].end(), b) != list[i].end()) {
      |                                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:7:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:67:41: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   67 |                                 if (find(list[i].begin(), list[i].end(), b) != list[i].end()) {
      |                                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
 
struct st {int from, to;};
vector<st> v;

int main() {
    int m, n, a, b;
    cin >> m >> n;
 
    int c[21];
	fill(c, c+21, 0);
    for (int i = 0;i < n;i++) {
        cin >> a >> b;
        v.push_back((st){a, v});
        c[y]++;
    }
 
    for (int i = 0;i < m;i++) {
        for (int j = 1;j <= m;j++) {
            if (c[j] == 0) {
                cout << j << endl;
            	c[j] = (1 << 10);
                for (int k = 0;k < n;k++) {
                    c[v[k].to] -= (v[k].from == j);
                }
                break;
            }
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:29: error: cannot convert 'std::vector<st>' to 'int' in initialization
   16 |         v.push_back((st){a, v});
      |                             ^
      |                             |
      |                             std::vector<st>
a.cc:17:11: error: 'y' was not declared in this scope
   17 |         c[y]++;
      |           ^
Language: C++

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

int main() {
  int m, n; cin >> m >> n;
  vector<vector<int>> g(m);
  vector<int> cnt(m, 0);
  while (n--) {
    int x, y; cin >> x >> y;
    --x; --y;
    g[x].push_back(y);
    ++cnt[y];
  }
  vector<bool> used(m, false);
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < m; ++j) {
      if (cnt[j] == 0 && !used[j]) {
        cout << j + 1 << endl;
        used[j] = true;
        for (auto&& x : g[j]) cnt[x] = max(0, cnt[x] - 1);
      }
    }
  }
  return 0;
}



Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include <bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:5:13: error: 'cin' was not declared in this scope
    5 |   int m, n; cin >> m >> n;
      |             ^~~
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<vector<int>> g(m);
      |   ^~~~~~
a.cc:6:17: error: expected primary-expression before 'int'
    6 |   vector<vector<int>> g(m);
      |                 ^~~
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> cnt(m, 0);
      |          ^~~
a.cc:11:5: error: 'g' was not declared in this scope
   11 |     g[x].push_back(y);
      |     ^
a.cc:12:7: error: 'cnt' was not declared in this scope; did you mean 'int'?
   12 |     ++cnt[y];
      |       ^~~
      |       int
a.cc:14:10: error: expected primary-expression before 'bool'
   14 |   vector<bool> used(m, false);
      |          ^~~~
a.cc:17:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
   17 |       if (cnt[j] == 0 && !used[j]) {
      |           ^~~
      |           int
a.cc:17:27: error: 'used' was not declared in this scope
   17 |       if (cnt[j] == 0 && !used[j]) {
      |                           ^~~~
a.cc:18:9: error: 'cout' was not declared in this scope
   18 |         cout << j + 1 << endl;
      |         ^~~~
a.cc:18:26: error: 'endl' was not declared in this scope
   18 |         cout << j + 1 << endl;
      |                          ^~~~
a.cc:20:25: error: 'g' was not declared in this scope
   20 |         for (auto&& x : g[j]) cnt[x] = max(0, cnt[x] - 1);
      |                         ^
a.cc:20:40: error: 'max' was not declared in this scope
   20 |         for (auto&& x : g[j]) cnt[x] = max(0, cnt[x] - 1);
      |                                        ^~~
Language: C++

#include<iostream>

int main{
    std::cout<<"Hello!"<<endl;
}

Compiler output:
a.cc:3:5: error: cannot declare '::main' to be a global variable
    3 | int main{
      |     ^~~~
a.cc:4:26: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    4 |     std::cout<<"Hello!"<<endl;
      |                          ^~~~
      |                          std::endl
In file included from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:4:30: error: expected '}' before ';' token
    4 |     std::cout<<"Hello!"<<endl;
      |                              ^
a.cc:3:9: note: to match this '{'
    3 | int main{
      |         ^
a.cc:5:1: error: expected declaration before '}' token
    5 | }
      | ^
Language: C++

#include <queue>
#include <cstdio>
using namespace std;
main(){
	int n,m,x,y;
	scanf("%d%d",&m,&n);
	vector<vector<int> >v(m+1);
	vector<int>c(m+1);
	queue<int>q;
	for(;n--;)scanf("%d%d",&x,&y),v[x].push_back(y),c[y]++;
	for(x=1;x<=m;x++)if(!c[x])q.push(x);
	for(;!q.empty();)for(printf("%d\n",n=q.front),q.pop(),x=0;x<v[n].size();x++)if(--c[v[n][x]]==0)q.push(v[n][x]);
}

Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:12:48: error: cannot resolve overloaded function 'front' based on conversion to type 'int'
   12 |         for(;!q.empty();)for(printf("%d\n",n=q.front),q.pop(),x=0;x<v[n].size();x++)if(--c[v[n][x]]==0)q.push(v[n][x]);
      |                                                ^~~~~
Language: C++

$m = gets.to_i
$n = gets.to_i
$s = (1..$n).map{gets.split.map(&:to_i)}

def solve(a)
  if a.size == $m
    return a
  end
  $s.select{|e|a.include?(e[1])&& !a.include?(e[0])}.map{|e|
    solve(a + [e[0]])
  }.shuffle[0]
end

p solve([2])

Compiler output:
a.cc:3:7: error: too many decimal points in number
    3 | $s = (1..$n).map{gets.split.map(&:to_i)}
      |       ^~~~~
a.cc:1:1: error: '$m' does not name a type
    1 | $m = gets.to_i
      | ^~
a.cc:5:1: error: 'def' does not name a type
    5 | def solve(a)
      | ^~~
a.cc:9:53: error: expected unqualified-id before '.' token
    9 |   $s.select{|e|a.include?(e[1])&& !a.include?(e[0])}.map{|e|
      |                                                     ^
a.cc:11:4: error: expected unqualified-id before '.' token
   11 |   }.shuffle[0]
      |    ^
Language: C++

def solve(a,M):
	for x,y in xy:
		if x in a and (y not in a or a.index(x) > a.index(y)): break
	else:
		if len(a) == m: return a
		for i in range(len(M)):
			r =  solve([M[i]] + a,M[:i]+M[i+1:])
			if r: return r
m = input()
xy = [map(int,raw_input().split()) for i in range(input())]
for i in solve([],range(1,m+1)): print i

Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def solve(a,M):
      | ^~~
Language: C++

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

// Ans
// 有向グラフの先の出次数が0のところから取り除いて、出力する

#define N 21

#define rep(i, n) for(int i=0; i<n; ++i)

int main() {
	int m, n, x, y, deg[N];
	bool e[N][N];
	memset(deg, 0, sizeof(deg));
	memset(e, 0, sizeof(e));
	cin >> m >> n;
	rep(i, n) {
		cin >> x >> y; --x; --y;
		e[x][y] = true;
		++deg[y];
	}
	rep(i, m) {
		rep(j, m) {
			if(deg[j]==0) {
				deg[j] = -1;
				cout << j+1 << endl;
				rep(k, m) {
					if(e[j][k]) --deg[k];
				}
			}
		}
	}
	return 0;
}

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

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

// Ans
// 有向グラフの先の出次数が0のところから取り除いて、出力する

#define N 21

#define rep(i, n) for(int i=0; i<n; ++i)

int main() {
	int m, n, x, y, deg[N];
	bool e[N][N];
	memset(deg, 0, sizeof(deg));
	memset(e, 0, sizeof(e));
	cin >> m >> n;
	rep(i, n) {
		cin >> x >> y; --x; --y;
		e[x][y] = true;
		++deg[y];
	}
	rep(i, m) {
		rep(j, m) {
			if(deg[j]==0) {
				deg[j] = -1;
				cout << j+1 << endl;
				rep(k, m) {
					if(e[j][k]) --deg[k];
				}
			}
		}
	}
	return 0;
}

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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {
	
	public static void main(String[] args) throws IOException{
		
		//Scanner sc = new Scanner(System.in);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		while(true){
			String str;
			
			if((str = br.readLine()) == null || str.equals("")){
				break;
			}
			
			String[] params = str.split(" ");
			
			final int box_length = Integer.parseInt(params[0]);
			final int cakes = params.length - 1;
			int[] cake_len = new int[cakes];
			for(int i = 0; i < cakes; i++){
				cake_len[i] = Integer.parseInt(params[i+1]);
			}
			
			Arrays.sort(cake_len);
			
			List<Integer> list = new ArrayList<Integer>();
			for(int i = 0; i < cakes/2; i++){
				if((i % 2) == 0){
					list.add(0, cake_len[i]);
					list.add(cake_len[cakes - i - 1]);
				}else{
					list.add(0, cake_len[cakes - i - 1]);
					list.add(cake_len[i]);
				}
			}
			
			if(cakes % 2 == 1){
				if(list.get(0) > list.get(cakes - 2)){
					list.add(0, cake_len[cakes/2]);
				}else{
					list.add(cake_len[cakes/2]);
				}
			}
			
			double sum = list.get(0) + list.get(cakes-1);
			
			for(int i = 0; i < cakes-1; i++){
				sum += Math.sqrt(list.get(i) * list.get(i+1) * 4);
			}
			
			if(sum < box_length){
				System.out.println("OK");
			}else{
				System.out.println("NG");
			}
			
			
		}
		
		
	}
	
}

Compiler output:
Main.java:7: error: cannot find symbol
	public static void main(String[] args) throws IOException{
	                                              ^
  symbol:   class IOException
  location: class Main
Main.java:10: error: cannot find symbol
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		^
  symbol:   class BufferedReader
  location: class Main
Main.java:10: error: cannot find symbol
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		                        ^
  symbol:   class BufferedReader
  location: class Main
Main.java:10: error: cannot find symbol
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		                                           ^
  symbol:   class InputStreamReader
  location: class Main
4 errors
Language: Java

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

public class Sample0120 {

	public static void main(String[] args) {

		Scanner sc =new Scanner(System.in);
		
		while(sc.hasNext()){
			int box = sc.nextInt();
			LinkedList<Integer> array = new LinkedList<Integer>();
			while(sc.hasNextInt())
				array.push(sc.nextInt());

			double[][] data = new double[(1<<array.size())][array.size()];

			for(int i=0;i<1<<array.size();i++)
				Arrays.fill(data[i], Double.MAX_VALUE);

			for(int i=0;i<array.size();i++)
				data[1<<i][i]=array.get(i);

			for(int i=0;i<1<<array.size();i++){
				for(int j=0;j<array.size();j++){
					int tmp = 1<<j;
					if((i&tmp)==0){
						for(int k=0;k<array.size();k++){
							double x = (double)array.get(j);
							double y = (double)array.get(k);
							data[i|tmp][j]=Math.min(data[i][k]+Math.sqrt((x+y)*(x+y)-(x-y)*(x-y)),data[i|tmp][j]);
						}
					}
				}
			}

			double min = Double.MAX_VALUE;

			for(int i=0;i<array.size();i++){
				data[(1<<array.size())-1][i]+=array.get(i);
				min = Math.min(min,data[(1<<array.size())-1][i]);
			}

			if(min<(box+1e-8)){
				System.out.println("OK");
			}
			else
				System.out.println("NA");
		}
	}
}

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

import java.util.Scanner;

public class A0120 {
	static double dp[][][];
	static int n, a;
	static double r[];

	public static double f(int left, int right, int bit) {
		if (0 < dp[left][right][bit]) {
			return dp[left][right][bit];
		}
		int k = check(bit);
		if (k == 1) {
			return dp[left][right][bit] = 2.0 * r[left];
		}
		if (k == 2) {
			return dp[left][right][bit] = r[left] + r[right] + 2.0 * Math.sqrt(r[left] * r[right]);
		}

		double min = Double.MAX_VALUE;
		for (int i = 0; i < n; i++) {
			if (i == left || i == right || (bit & (1 << i)) == 0) {
				continue;
			}
			for (int j = 0; j < n; j++) {
				if (j == left || j == right || (bit & (1 << j)) == 0) {
					continue;
				}
				if (3 < k && i == j) {
					continue;
				}
				double sub = f(i, j, (bit ^ (1 << left)) ^ (1 << right));
				sub -= r[i] + r[j];
				sub += 2.0 * (Math.sqrt(r[left] * r[i]) + Math.sqrt(r[right] * r[j]));
				sub += r[left] + r[right];
				min = Math.min(min, sub);
			}
		}
		return dp[left][right][bit] = min;
	}

	public static int check(int bit) {
		int count = 0;

		for (int i = 0; i < 12; i++) {
			if (0 < (bit & (1 << i))) {
				count++;
			}
		}
		return count;
	}

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

		while (sc.hasNext()) {
			String b[] = sc.nextLine().split(" ");
			a = Integer.parseInt(b[0]);
			n = b.length - 1;
			r = new double[n];
			dp = new double[n][n][1 << n];
			for (int i = 0; i < n; i++) {
				r[i] = Integer.parseInt(b[i + 1]);
			}
			double min = Double.MAX_VALUE;
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					if (i != j) {
						min = Math.min(min, f(i, j, (1 << n) - 1));
					}
				}
			}
			System.out.println(min <= a ? "OK" : "NA");
		}
	}
}

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

#include <algorithm>
#include <iostream>
#include <sstream>
#include <vector>

using namespace std;

double getPackWidth(vector<int> &v) {
    int n = v.size();
    double ret = v[0] + v[n-1];
    for (int i=0; i+1<n; ++i) {
        ret += sqrt(pow(v[i] + v[i+1], 2) - pow(v[i] - v[i+1], 2));
    }
    return ret;
}

int main() {
    string s;
    while (getline(cin,s)) {
        stringstream ss(s);
        int w;
        ss >> w;
        int r;
        vector<int> cake;
        while (ss >> r) cake.push_back(r);

        sort(cake.begin(), cake.end());

        vector<int> v1, v2;
        int n = cake.size();
        for (int i=0; i<=n-1-i; ++i) {
            if (i == n-1-i) {
                v1.push_back(cake[i]);
                v2.push_back(cake[i]);
            } else {
                v1.push_back(cake[i]);
                v1.push_back(cake[n-1-i]);
                v2.push_back(cake[n-1-i]);
                v2.push_back(cake[i]);
            }
        }

        bool ok = getPackWidth(v1) <= w || getPackWidth(v2) <= w;
        cout << (ok ? "OK" : "NA") << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'double getPackWidth(std::vector<int>&)':
a.cc:12:21: error: 'pow' was not declared in this scope
   12 |         ret += sqrt(pow(v[i] + v[i+1], 2) - pow(v[i] - v[i+1], 2));
      |                     ^~~
a.cc:12:16: error: 'sqrt' was not declared in this scope
   12 |         ret += sqrt(pow(v[i] + v[i+1], 2) - pow(v[i] - v[i+1], 2));
      |                ^~~~
Language: C++

import sys
from math import sqrt


def rec(state, v):
    if state == (1 << N) - 1:
        return cakes[v]
    if dp[state][v] != -1:
        return dp[state][v]

    ret = INF
    for i in range(N):
        if not (state >> i & 1):
            ret = min(ret, rec(state | 1 << i, i) + sqrt(pow(cakes[i] + cakes[v], 2) - pow(cakes[i] - cakes[v], 2)))
    dp[state][v] = ret
    return ret


testcases = [[int(x) for x in line.split()] for line in sys.stdin.readlines()]

for testcase in testcases:
    box, *cakes = testcase
    N = len(cakes)
    INF = box + 1
    ans = INF
    for i in range(N):
        dp = [[-1] * N for _ in range(1 << N)]
        ans = min(ans, rec(1 << i, i) + cakes[i])
    print('OK' if ans <= box else 'NA')

Compiler output:
a.cc:29:11: warning: multi-character character constant [-Wmultichar]
   29 |     print('OK' if ans <= box else 'NA')
      |           ^~~~
a.cc:29:35: warning: multi-character character constant [-Wmultichar]
   29 |     print('OK' if ans <= box else 'NA')
      |                                   ^~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

const int LOOP = 10000; //??????????????°
const double EPS = 1e-6; //??????????????¨(?°??????????????????????)
int L;
int N; //???????????±???????????°

//???????????±????????????????????????????????¨?????¨???????¨????????¨??????????
double Evaluate(int r[12]) {
	double val = r[0] + r[N-1];
	for (int i = 0; i < N - 1; i++)
	{
		int a = abs(r[i] - r[i+1]), c = r[i] + r[i+1];
		val += sqrt(c*c - a*a);
	}
	return val;
}

//?????¨?????????????????°???????????¨??????????????????????§???????????±???????
//(????§?????????????true)
bool Changes(int cnt) {
	return cnt < rand()%LOOP;
}

//?????????????????????????????¢??°
//?????????????°??????????????¨?????????????
//int r[12] : ???????????±?????????0??????N-1???????????????????????????????????????????????????????´???????
double Solve(int r[12]) {
	double score = Evaluate(r); //?????¨?????¶???r[]????¨???????????´????????????°
	double mi = score; //???????????§?????¶???????¨???????????°???????????´????????????°
	for (int cnt = 0; cnt < LOOP; cnt++)
	{
		swap(r[rand()%N],r[rand()%N]);
		double evaluate = Evaluate(r);
		if(evaluate <= mi){
			mi = evaluate;
		}else{
			if(Changes(cnt)){
				mi = evaluate;
			}
		}

	}
	return mi; //????°?????????????
}

//??\?????¢????????????????????¢????????£????????§???????????????
int main() {
	while (cin >> L)
	{
		N = 0;
		int r[12];
		string S;
		getline(cin, S);
		stringstream SS(S);
		while (!SS.eof()) SS >> r[N++];

		double ans;
		if (N == 1) ans = r[0]*2;
		else ans = Solve(r);

		if (L - ans + EPS > 0) puts("OK");
		else puts("NA");
	}
	return 0;
}

Compiler output:
a.cc: In function 'double Evaluate(int*)':
a.cc:18:24: error: 'sqrt' was not declared in this scope
   18 |                 val += sqrt(c*c - a*a);
      |                        ^~~~
Language: C++

#include <algorithm>
#include <string>
#include <sstream>
#include <iostream>
#include<time>
#include<cstdlib>
using namespace std;

const int LOOP = 10000; //??????????????°
const double EPS = 1e-6; //??????????????¨(?°??????????????????????)
int L;
int N; //???????????±???????????°

//???????????±????????????????????????????????¨?????¨???????¨????????¨??????????
double Evaluate(int r[12]) {
	double val = r[0] + r[N-1];
	for (int i = 0; i < N - 1; i++)
	{
		int a = abs(r[i] - r[i+1]), c = r[i] + r[i+1];
		val += sqrt(c*c - a*a);
	}
	return val;
}

//?????¨?????????????????°???????????¨??????????????????????§???????????±???????
//(????§?????????????true)
bool Changes(int cnt) {
	return cnt < rand()%LOOP;
}

//?????????????????????????????¢??°
//?????????????°??????????????¨?????????????
//int r[12] : ???????????±?????????0??????N-1???????????????????????????????????????????????????????´???????
double Solve(int r[12]) {
	double score = Evaluate(r); //?????¨?????¶???r[]????¨???????????´????????????°
	double mi = score; //???????????§?????¶???????¨???????????°???????????´????????????°
	for (int cnt = 0; cnt < LOOP; cnt++)
	{
		swap(r[rand()%N],r[rand()%N]);
		double evaluate = Evaluate(r);
		if(evaluate <= mi){
			mi = evaluate;
		}else{
			if(Changes(cnt)){
				mi = evaluate;
			}
		}

	}
	return mi; //????°?????????????
}

//??\?????¢????????????????????¢????????£????????§???????????????
int main() {
	srand(time(NULL));
	while (cin >> L)
	{
		N = 0;
		int r[12];
		string S;
		getline(cin, S);
		stringstream SS(S);
		while (!SS.eof()) SS >> r[N++];

		double ans;
		if (N == 1) ans = r[0]*2;
		else ans = Solve(r);

		if (L - ans + EPS > 0) puts("OK");
		else puts("NA");
	}
	return 0;
}

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

#include <algorithm>
#include <string>
#include <sstream>
#include <iostream>
#include <ctime>
#include<cstdlib>
using namespace std;

const int LOOP = 10000; //??????????????°
const double EPS = 1e-6; //??????????????¨(?°??????????????????????)
int L;
int N; //???????????±???????????°

//???????????±????????????????????????????????¨?????¨???????¨????????¨??????????
double Evaluate(int r[12]) {
	double val = r[0] + r[N-1];
	for (int i = 0; i < N - 1; i++)
	{
		int a = abs(r[i] - r[i+1]), c = r[i] + r[i+1];
		val += sqrt(c*c - a*a);
	}
	return val;
}

//?????¨?????????????????°???????????¨??????????????????????§???????????±???????
//(????§?????????????true)
bool Changes(int cnt) {
	return cnt < rand()%LOOP;
}

//?????????????????????????????¢??°
//?????????????°??????????????¨?????????????
//int r[12] : ???????????±?????????0??????N-1???????????????????????????????????????????????????????´???????
double Solve(int r[12]) {
	double score = Evaluate(r); //?????¨?????¶???r[]????¨???????????´????????????°
	double mi = score; //???????????§?????¶???????¨???????????°???????????´????????????°
	for (int cnt = 0; cnt < LOOP; cnt++)
	{
		swap(r[rand()%N],r[rand()%N]);
		double evaluate = Evaluate(r);
		if(evaluate <= mi){
			mi = evaluate;
		}else{
			if(Changes(cnt)){
				mi = evaluate;
			}
		}

	}
	return mi; //????°?????????????
}

//??\?????¢????????????????????¢????????£????????§???????????????
int main() {
	srand(time(NULL));
	while (cin >> L)
	{
		N = 0;
		int r[12];
		string S;
		getline(cin, S);
		stringstream SS(S);
		while (!SS.eof()) SS >> r[N++];

		double ans;
		if (N == 1) ans = r[0]*2;
		else ans = Solve(r);

		if (L - ans + EPS > 0) puts("OK");
		else puts("NA");
	}
	return 0;
}

Compiler output:
a.cc: In function 'double Evaluate(int*)':
a.cc:20:24: error: 'sqrt' was not declared in this scope
   20 |                 val += sqrt(c*c - a*a);
      |                        ^~~~
Language: C++

#include <algorithm>
#include <string>
#include <stream>
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <cmath>
#include <cstdio>
using namespace std;

const int LOOP = 10000; //??????????????°
const double EPS = 1e-6; //??????????????¨(?°??????????????????????)
int L;
int N; //???????????±???????????°

//???????????±????????????????????????????????¨?????¨???????¨????????¨??????????
double Evaluate(int r[12]) {
	double val = r[0] + r[N-1];
	for (int i = 0; i < N - 1; i++)
	{
		int a = abs(r[i] - r[i+1]), c = r[i] + r[i+1];
		val += sqrt(c*c - a*a);
	}
	return val;
}

//?????¨?????????????????°???????????¨??????????????????????§???????????±???????
//(????§?????????????true)
bool Changes(int cnt) {
	return cnt < rand()%LOOP;
}

//?????????????????????????????¢??°
//?????????????°??????????????¨?????????????
//int r[12] : ???????????±?????????0??????N-1???????????????????????????????????????????????????????´???????
double Solve(int r[12]) {
	double score = Evaluate(r); //?????¨?????¶???r[]????¨???????????´????????????°
	double mi = score; //???????????§?????¶???????¨???????????°???????????´????????????°
	for (int cnt = 0; cnt < LOOP; cnt++)
	{
		swap(r[rand()%N],r[rand()%N]);
		double evaluate = Evaluate(r);
		if(evaluate <= mi){
			mi = evaluate;
		}else{
			if(Changes(cnt)){
				mi = evaluate;
			}
		}

	}
	return mi; //????°?????????????
}

//??\?????¢????????????????????¢????????£????????§???????????????
int main() {
	srand(time(NULL));
	while (cin >> L)
	{
		N = 0;
		int r[12];
		string S;
		getline(cin, S);
		stringstream SS(S);
		while (!SS.eof()) SS >> r[N++];

		double ans;
		if (N == 1) ans = r[0]*2;
		else ans = Solve(r);

		if (L - ans + EPS > 0) puts("OK");
		else puts("NA");
	}
	return 0;
}

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

#include<sstream>
#include<iostream>
#include<cmath>
using namespace std;
int w,n; int c[12];
string s;

double calc(int *c){
	double r=c[0]+c[n-1];
	for(int i=0;i<n-1;i++)r+=2*sqrt(c[i]*c[i+1]);
	return r;
}
int main(){
	while(getline(cin,s)){
		stringstream ss; ss<<s;
		ss>>w;
		for(n=0;ss>>c[n];n++);
		do{
			if(calc(c)<=w){
				cout<<"OK"<<endl;
				goto NEXT;
			}
		}while(next_permutation(c,c+n));
		cout<<"NA"<<endl;
		NEXT:;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:24: error: 'next_permutation' was not declared in this scope
   23 |                 }while(next_permutation(c,c+n));
      |                        ^~~~~~~~~~~~~~~~
Language: C++

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ALL(A)		(A).begin(),(A).end()
#define DUMP(A)    cout<<#A<<"="<<(A)<< endl
#define SIZE(A)    (int)((A).size())
#define SQ(A)   ((A)*(A))
using namespace std;
typedef long long ll;

int main(){
    int role[12];
    char li[100];
    while(gets(li)!=NULL){
        int len;
        char sp[]=" ";
        char *res=NULL;
        sscanf(strtok(li,sp),"%d",&len);
        int n=0;
        for(;;){
            res=strtok(NULL,sp);
            if(res==NULL) break;
            sscanf(res,"%d",&role[n]);
            n++;
        }
        double path[13][13];
        for(int i=0;i<n;i++){
            path[0][i]=path[i][0]=role[i];
        }
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                path[i][j]=sqrt(SQ(role[i]+role[j])-SQ(role[i]-role[j]));
            }
        }
        double dp[1<<n][n];
        for(int i=0;i<n;i++){
            dp[0][i]=0;
        }
        for(int i=1;i<(1<<n);i++){
            for(int j=0;j<n;j++){
                dp[i][j]=10000;
                if(i&(1<<j)){
                    int bef=i-(i&(1<<j));
                    for(int k=0;k<n;k++){
                        if(bef==0){
                            dp[i][j]=min(dp[i][j],(double)role[j]);
                        }else if(bef&(1<<k)){
                            dp[i][j]=min(dp[i][j],dp[bef][k]+path[k][j]);
                        }
                    }
                }
            }
        }
        double ret=10000;
        for(int i=0;i<n;i++){
            ret=min(ret,dp[(1<<n)-1][i]+role[i]);
        }
        if(ret<=len) printf("OK\n");
        else printf("NA\n");
    }
}

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

//38
#include<iostream>
#include<string>
#include<sstream>
#include<vector>
#include<cmath>
 
using namespace std;
 
int c[11];
 
bool dfs(double r,int nr,int p){
  if(nr==0){
    return r>=p;
  }else{
    for(int i=3;i<=10;i++){
      if(c[i]){
	c[i]--;
	if(dfs(r-2*sqrt(i*p),nr-1,i))return true;
	c[i]++;
      }
    }
    return false;
  }
}
 
int main(){
  for(int w;cin>>w;){
    string s;
    getline(cin,s);
    stringstream ss(s);
    fill(c,c+11,0);
    int nr=0;
    for(int r;ss>>r;){
      c[r]++;
      nr++;
    }
    int i;
    for(i=3;i<=10;i++){
      if(c[i]){
	c[i]--;
	if(dfs(w-i,nr-1,i))break;
	c[i]++;
      }
    }
    cout<<((i<v.size())?"OK":"NA")<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:15: error: 'v' was not declared in this scope
   46 |     cout<<((i<v.size())?"OK":"NA")<<endl;
      |               ^
Language: C++

#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include <sstream>

using namespace std;

const double INF=1000000000;
double ans;
double l;
bool flag;
string str;
vector<double> r;
double dp[1<<12][12];

void rec(int x,int bit,double nl,double nh){
	if(dp[bit][x]<nl)return;
	dp[bit][x]=nl;
	if(bit==(1<<r.size())-1){
		if(nl+nh<=l)flag=true;
		ans=min(ans,nl+nh);
		return;
	}
	else{
		for(int i=0;i<r.size();i++){
			if(!(bit>>i & 1)){
				double nnh=r[i];
				double nnl=nl+sqrt(pow(nh+nnh,2)-pow(fabs(nh-nnh),2));
				if(nnl<dp[bit | 1<<i][i]){
					dp[bit | 1<<i][i]=nnl;
					rec(i,bit | 1<<i,nnl,nnh);
				}
			}
		}
	}
}


int main(void){
	while(getline(cin,str)){
		flag=false;
		ans=INF;
		r.clear();
		for(int i=0;i<(1<<12)-1;i++){
			for(int j=0;j<12;j++){
				dp[i][j]=INF;
			}
		}
		stringstream input(str);
		input >> l;
		double a;
		while(input >> a)r.push_back(a);
		for(int i=0;i<r.size();i++){
			rec(i,1<<i,r[i],r[i]);
		}
		if(flag)cout << "OK" << endl;
		else cout << "NA" << endl;
	}
    return 0;
}

Compiler output:
a.cc: In function 'void rec(int, int, double, double)':
a.cc:29:52: error: 'pow' was not declared in this scope
   29 |                                 double nnl=nl+sqrt(pow(nh+nnh,2)-pow(fabs(nh-nnh),2));
      |                                                    ^~~
a.cc:29:70: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   29 |                                 double nnl=nl+sqrt(pow(nh+nnh,2)-pow(fabs(nh-nnh),2));
      |                                                                      ^~~~
      |                                                                      labs
a.cc:29:47: error: 'sqrt' was not declared in this scope
   29 |                                 double nnl=nl+sqrt(pow(nh+nnh,2)-pow(fabs(nh-nnh),2));
      |                                               ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <sstream>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
typedef long long LL;
#define OFFSET 2

int box_width;

double dist(int r1, int r2)
{
	double a = pow(abs(r1 - r2), 2);
	double b = pow(r1 + r2, 2);
	return sqrt(-a + b);
}

bool solve(vector<int> cakes, LL state)
{
	if (cakes.empty()) {
		// calculate the length
		double length = 0;
		int prev = 0;
		int save_state = state;
		do {
			int current = state % 10 + OFFSET;
			state /= 10;
			if (prev) {
				length -= prev;
				length += dist(prev, current);
				length += current;
			} else {
				length += current * 2;
			}
			prev = current;
		} while (state);
		// cout << "state: " << save_state << ", length: " << length << endl;
		if (length <= box_width) {
			return true;
		} else {
			return false;
		}
	}

	int prev_cake = 0;
	for (int i = 0; i < cakes.size(); ++i) {
		vector<int> next_cakes = cakes;
		int cake = next_cakes[i];
		if (cake == prev_cake) {
			next;
		}
		LL next_state = state * 10 + (cake - OFFSET);
		next_cakes.erase(next_cakes.begin() + i);
		if (solve(next_cakes, next_state)) {
			return true;
		}
		prev_cake = cake;
	}

	return false;
}

int main()
{
	while (cin >> box_width) {
		string line;
		stringstream ss;
		vector<int> cakes;
		getline(cin, line);
		ss << line;
		int r;
		while (ss >> r) {
			cakes.push_back(r);
		}
		sort(cakes.begin(), cakes.end());

		if (solve(cakes, 0)) {
			cout << "OK" << endl;
		} else {
			cout << "NA" << endl;
		}
	}
}

Compiler output:
a.cc: In function 'bool solve(std::vector<int>, LL)':
a.cc:53:29: error: statement cannot resolve address of overloaded function
   53 |                         next;
      |                             ^
Language: Java



import java.util.*;

public class Main {
static final int[] dir={1,-1,4,-4};
static Map<String,Integer> m=new HashMap<String,Integer>();
static void bfs(){
	String s="01234567";
	m.put(s,0);
	Queue<String> que=new LinkedList<String>();
	que.offer(s);
	while(!que.isEmpty()){
		String tmp=que.poll();
		int step=m.get(tmp);
		//謇セ蛻ー'0'
		int index=-100;
		for(int i=0;i<8;i++)
			if(tmp.charAt(i)=='0') index=i;
		//遘サ蜉ィ'0'
		for(int i=0;i<4;i++){
			if((index==3&&dir[i]==1)||(index==4&&dir[i]==-1)) continue;
			int newindex=index+dir[i];
			if(newindex>=0&&newindex<8){
				//莠、謐「
				StringBuffer sss=new StringBuffer(tmp);
				sss.setCharAt(index, tmp.charAt(newindex));
				sss.setCharAt(newindex, tmp.charAt(index));
				//System.out.println(tmp+"  "+sss.toString());
				String tmp1=sss.toString();
				//譛ェ蜃コ邇ー鬘コ蠎擾シ悟?髦?				if(m.get(tmp1)==null){
					m.put(tmp1,step+1);
					que.offer(tmp1);
				}
			}
		}
	}
}
public static void main(String[] args){
	bfs();
	String input=null;
	Scanner scan=new Scanner(System.in);
	while((input=scan.nextLine()).length()>7){
		input=input.replace(" ","");
		System.out.println(m.get(input));
	}
	scan.close();
}
}

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

import java.util.*;

class State {
    private static int[] vy = {0, 1, 0, -1};
    private static int[] vx = {1, 0, -1, 0};

    private int[][] nums;
    private int zeroY, zeroX;
    private int hash;
    int step;

    public State(int[][] _nums, int _zeroY, int _zeroX, int _step) {
        nums = _nums;
        zeroY = _zeroY;
        zeroX = _zeroX;
        hash = -1;
        step = _step;
    }

    @Override
    public int hashCode() {
        if (hash != -1) return hash;
        hash = 0;
        for (int y=0; y<2; y++) {
            for (int x=0; x<4; x++) {
                hash = hash*10 + nums[y][x];
            }
        }
        return hash;
    }

    public LinkedList<State> nextMove() {
        LinkedList<State> ret = new LinkedList<>();

        for (int i=0; i<4; i++) {
            int nextZeroY = zeroY + vy[i];
            if (nextZeroY < 0 || nextZeroY >= 2) continue;
            int nextZeroX = zeroX + vx[i];
            if (nextZeroX < 0 || nextZeroX >= 4) continue;

            int[][] nextNums = new int[2][4];
            for (int y=0; y<2; y++) {
                for (int x=0; x<4; x++) {
                    nextNums[y][x] = nums[y][x];
                }
            }

            nextNums[nextZeroY][nextZeroX] = 0;
            nextNums[zeroY][zeroX] = nums[nextZeroY][nextZeroX];
            ret.add(new State(nextNums, nextZeroY, nextZeroX, step+1));
        }
        return ret;
    }
}

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

        Queue<State> queue = new LinkedList<>();
        Set<Integer> set = new HashSet<>();

        State firstState;
        int[][] firstNums = new int[2][4];
        int firstZeroY = -1, firstZeroX = -1;

        while (sc.hasNext()) {
            for (int y=0; y<2; y++) {
                for (int x=0; x<4; x++) {
                    firstNums[y][x] = sc.nextInt();
                    if (firstNums[y][x] == 0) {
                        firstZeroY = y;
                        firstZeroX = x;
                    }
                }
            }
            firstState = new State(firstNums, firstZeroY, firstZeroX, 0);

            set.add(firstState.hashCode());
            queue.add(firstState);

            while (!queue.isEmpty()) {
                State nowState = queue.poll();

                if (nowState.hashCode() == 1234567) {
                    System.out.println(nowState.step);
                    break;
                }

                for (State nextState : nowState.nextMove()) {
                    if (!set.contains(nextState.hashCode())) {
                        set.add(nextState.hashCode());
                        queue.add(nextState);
                    }
                }
            }

            queue.clear();
            set.clear();
        }
    }

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

public class Main {
    private static int[] move = {1, -1, 4, -4};
    private static Map<String, Integer> map = new HashMap<>();
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        dsf();
        while (in.hasNext()) {
            String str = in.nextLine();
            str = str.replaceAll("\\s+", "");
            System.out.println(map.get(str));
        }
    }
    private static void dsf() {
        Queue<String> q = new LinkedList<>();
        map.put("01234567", 0);
        q.add("01234567");
        while (!q.isEmpty()) {
            String init = q.peek();
            q.poll();
            int p = 0;
            for (int i = 0; i < 8; i++) {
                if (init.charAt(i) == '0') {
                    p = i;
                    break;
                }
            }
            for (int i = 0; i < 4; i++) {
                int dx = p + move[i];   // ?????¢????¬??????????
                if (0 <= dx && dx < 8 &&
                        !(p == 3 && i == 0) && // ??????????????????????§?
                        !(p == 4 && i == 1)) { // ??????????????????????§?
                    String next = swap(init, p, dx);
                    if (!map.containsKey(next)) {
                        int val = map.get(init) + 1;
                        map.put(next, val);
                        q.add(next);
                    }
                }
            }
        }
    }
    private static String swap(String str, int init, int toChange) {
        char[] chars = str.toCharArray();
        char temp = chars[init];
        chars[init] = chars[toChange];
        chars[toChange] = temp;
        return new String(chars);
    }
}

Compiler output:
Main.java:3: error: cannot find symbol
    private static Map<String, Integer> map = new HashMap<>();
                   ^
  symbol:   class Map
  location: class Main
Main.java:3: error: cannot find symbol
    private static Map<String, Integer> map = new HashMap<>();
                                                  ^
  symbol:   class HashMap
  location: class Main
Main.java:5: error: cannot find symbol
        Scanner in = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
        Scanner in = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
Main.java:14: error: cannot find symbol
        Queue<String> q = new LinkedList<>();
        ^
  symbol:   class Queue
  location: class Main
Main.java:14: error: cannot find symbol
        Queue<String> q = new LinkedList<>();
                              ^
  symbol:   class LinkedList
  location: class Main
6 errors
Language: Java

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


public class sevenp{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
       int[][] a = new int[2][4];
       int i,j,m;
       long k=1,n=0;
       while(s.hasNext()){
       for(i=0;i<2;i++){
           for(j=0;j<4;j++){
        m=s.nextInt();
        n+=k*(long)m;
        k*=10;
       }
    }


           
        m = solve(n);
        System.out.println(m);
        n=0;
        k=1;
}
    }
    public static int solve(long n){
        Queue<Long> qu=new LinkedList<Long>();
        int[] x = {1,-1,0,0},y= {0,0,1,-1};
        int[] za = new int[100000];
        int[] zb = new int[100000];
        long[] zc =new long[10000000];
        int[][] arr = new int[2][4];
        int i,j,zh=-5,zw=-5,e,ppp=0,col=0,kri=0;
        long k=n,temp,no;
        boolean ch=false,chk=false;
        qu.add(n);
        while(true){
        k = qu.remove();
        if(k%100000000==76543210)return (int)k/100000000+kri;
        for(i=0;i<2;i++){
            for(j=0;j<4;j++){
                arr[i][j]=(int)k%10;
                k/=10;
                if(arr[i][j]==0){
                    zh=i;
                    zw=j;
                }
            }
        }
   //     System.out.println(k+" " +col);
        if(k==19){
            kri=20;
            k=0;
        }
        else k++;

        k*=100000000;
        no = k;
        for(e=0;e<4;e++){
            if(zh+x[e]>=0&&zh+x[e]<2&&zw+y[e]>=0&&zw+y[e]<4){
            arr[zh][zw] = arr[zh+x[e]][zw+y[e]];
            arr[zh+x[e]][zw+y[e]]=0;
        temp =1;
        for(i=0;i<2;i++){
            for(j=0;j<4;j++){
                k+=temp*(long)arr[i][j];
                temp*=10;
            }
        }
        for(ppp=0;ppp<col;ppp++)if(zc[ppp]==k%100000000)ch=true;
        if(ch==false){
            zc[col]=k%100000000;
            qu.add(k);
            col++;
        }
        else ch = false;
        k = no;
        arr[zh+x[e]][zw+y[e]] = arr[zh][zw];
        arr[zh][zw]=0;
    }
}
    }
}

    }



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

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

		  
		   Scanner x = new Scanner(System.in);
			int data [] = new int[8];
			for(int i = 0;i<8;i++) {
				data[i]=x.nextInt();
			}
			int count = 0;
			for(int i = 0;i < data.length;i++) {
				for(int j = i + 1; j<data.length;j++) {
				if(data[i]>data[j]) {
					int a = data[i];
					data[i] = data[j];
					data [j]= a;
					count ++;
				}
			}
		  }
			System.out.println(count);
			x.close();
		 }
}


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


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

public class P0121 {

	int INF = 1 << 28;

	int[][] next = {{1,4},
					{0,2,5},
					{1,3,6},
					{2,7},
					{0,5},
					{1,4,6},
					{2,5,7},
					{3,6}};
	void run() {
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNext()) {
			int[] q = new int[8];
			for(int i=0;i<8;i++) {
				q[i] = sc.nextInt();
			}
			System.out.println(dfs(q));
		}
	}
	
	int dfs(int[] s) {
		LinkedList<String> visited = new LinkedList<String>();
		Struct now = new Struct(s, 0);
		LinkedList<Struct> que = new LinkedList<Struct>();
		que.add(now);
		visited.add(toString(s));
		for(;!que.isEmpty();) {
			now = que.removeFirst();
//			System.out.println(toString(now.s));
			if(toString(now.s).equals("01234567")) break;
			int a[] = now.s.clone();
			int zero = 0;
			for(int i=0;i<8;i++) if(a[i] == 0) {
				zero = i; break;
			}
			for(int i=0;i<next[zero].length;i++) {
				int[] b = a.clone();
				int tmp = b[zero];
				b[zero] = b[next[zero][i]];
				b[next[zero][i]] = tmp;
				Struct next_s = new Struct(b, now.c+1);
				if( !visited.contains(toString(b)) ) {
					visited.add(toString(b));
					que.addLast(next_s);
				}
			}
		}
		
		return now.c;
	}
	String toString(int[] a) {
		String ret = "";
		for(int i=0;i<8;i++) ret += a[i];
		return ret;
	}
	
	public static void main(String[] args) {
		new P0121().run();
	}
	
	class Struct {
		int[] s;
		int c;
		int zero;
		Struct(int s[], int c) {
			this.s = s.clone();
			this.c = c;
		}
	}
}

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